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

import androidx.compose.runtime.Composable


context(Foo, Bar)
@Composable
fun A(a: Int = 1) { }

context(Foo, Bar, FooBar)
@Composable
fun B(a: Int, b: String = "", c: Int = 1) { }

context(Foo)
@Composable
fun C(a: Int, bar: Bar = Bar()) { }

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

@Composable
@FunctionKeyMeta(key = 1146828261, startOffset = 75, endOffset = 96)
context(%context_receiver_0: Foo, %context_receiver_1: Bar)
fun A(a: Int, %composer: Composer?, %changed: Int, %default: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(A)N(a):Test.kt")
  if (%composer.shouldExecute(%changed and 0b0001 != 0, %changed and 0b0001)) {
    if (%default and 0b0001 != 0) {
      a = 1
    }
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    A(%context_receiver_0, %context_receiver_1, a, %composer, updateChangedFlags(%changed or 0b0001), %default)
  }
}
@Composable
@FunctionKeyMeta(key = -1264785437, startOffset = 136, endOffset = 181)
context(%context_receiver_0: Foo, %context_receiver_1: Bar, %context_receiver_2: FooBar)
fun B(a: Int, b: String?, c: Int, %composer: Composer?, %changed: Int, %default: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(B)N(a,b,c):Test.kt")
  if (%composer.shouldExecute(%changed and 0b0001 != 0, %changed and 0b0001)) {
    if (%default and 0b0010 != 0) {
      b = ""
    }
    if (%default and 0b0100 != 0) {
      c = 1
    }
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    B(%context_receiver_0, %context_receiver_1, %context_receiver_2, a, b, c, %composer, updateChangedFlags(%changed or 0b0001), %default)
  }
}
@Composable
@FunctionKeyMeta(key = 1772367395, startOffset = 208, endOffset = 243)
context(%context_receiver_0: Foo)
fun C(a: Int, bar: Bar?, %composer: Composer?, %changed: Int, %default: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(C)N(a,bar):Test.kt")
  val %dirty = %changed
  if (%composer.shouldExecute(%dirty and 0b0001 != 0, %dirty and 0b0001)) {
    %composer.startDefaults()
    if (%changed and 0b0001 == 0 || %composer.defaultsInvalid) {
      if (%default and 0b0010 != 0) {
        bar = Bar()
        %dirty = %dirty and 0b001110000000.inv()
      }
    } else {
      %composer.skipToGroupEnd()
      if (%default and 0b0010 != 0) {
        %dirty = %dirty and 0b001110000000.inv()
      }
    }
    %composer.endDefaults()
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    C(%context_receiver_0, a, bar, %composer, updateChangedFlags(%changed or 0b0001), %default)
  }
}
