//
// Source
// ------------------------------------------

import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonRestartableComposable
import androidx.compose.runtime.ReadOnlyComposable


@Composable fun CanSkip(a: Int = 0, b: Foo = Foo()) {
    used(a)
    used(b)
}
@Composable fun CannotSkip(a: Int, b: Foo) {
    used(a)
    used(b)
    print("Hello World")
}
@Composable fun NoParams() {
    print("Hello World")
}

//
// Transformed IR
// ------------------------------------------

@Composable
@FunctionKeyMeta(key = 1470961278, startOffset = 226, endOffset = 329)
fun CanSkip(a: Int, b: Foo?, %composer: Composer?, %changed: Int, %default: Int) {
  %composer = %composer.startRestartGroup(<>)
  val %dirty = %changed
  if (%default and 0b0001 != 0) {
    %dirty = %dirty or 0b0110
  } else if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (%composer.changed(a)) 0b0100 else 0b0010
  }
  if (%changed and 0b00110000 == 0) {
    %dirty = %dirty or if (%default and 0b0010 == 0 && %composer.changedInstance(b)) 0b00100000 else 0b00010000
  }
  if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
    %composer.startDefaults()
    if (%changed and 0b0001 == 0 || %composer.defaultsInvalid) {
      if (%default and 0b0001 != 0) {
        a = 0
      }
      if (%default and 0b0010 != 0) {
        b = Foo()
        %dirty = %dirty and 0b01110000.inv()
      }
    } else {
      %composer.skipToGroupEnd()
      if (%default and 0b0010 != 0) {
        %dirty = %dirty and 0b01110000.inv()
      }
    }
    %composer.endDefaults()
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    used(a)
    used(b as Foo)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    CanSkip(a, b, %composer, updateChangedFlags(%changed or 0b0001), %default)
  }
}
@Composable
@FunctionKeyMeta(key = -63784817, startOffset = 354, endOffset = 485)
fun CannotSkip(a: Int, b: Foo, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  val %dirty = %changed
  if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (%composer.changed(a)) 0b0100 else 0b0010
  }
  if (%changed and 0b00110000 == 0) {
    %dirty = %dirty or if (%composer.changedInstance(b)) 0b00100000 else 0b00010000
  }
  if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    used(a)
    used(b)
    print("Hello World")
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    CannotSkip(a, b, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
@Composable
@FunctionKeyMeta(key = 735888077, startOffset = 510, endOffset = 577)
fun NoParams(%composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  if (%composer.shouldExecute(%changed != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    print("Hello World")
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    NoParams(%composer, updateChangedFlags(%changed or 0b0001))
  }
}
