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

import androidx.compose.runtime.*


@Composable fun CallWithDefaults(test: Test) {
    test.foo()
    test.foo(0)
    test.bar()
    test.bar(0)
}

open class Test {
    @Composable open fun foo(param: Int = remember { 0 }) {}
    @Composable open fun bar(param: Int = remember { 0 }): Int = param
}

class TestImpl : Test() {
    @Composable override fun foo(param: Int) {}
    @Composable override fun bar(param: Int): Int {
        return super.bar(param)
    }
}

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

@Composable
@FunctionKeyMeta(key = 53166890, startOffset = 48, endOffset = 146)
fun CallWithDefaults(test: Test, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(CallWithDefaults)N(test)<foo()>,<foo(0)>,<bar()>,<bar(0)>:Test.kt")
  val %dirty = %changed
  if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (%composer.changed(test)) 0b0100 else 0b0010
  }
  if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    foo%default(0, test, %composer, 0b01110000 and %dirty shl 0b0011, 0b0001)
    foo%default(0, test, %composer, 0b0110 or 0b01110000 and %dirty shl 0b0011, 0)
    bar%default(0, test, %composer, 0b01110000 and %dirty shl 0b0011, 0b0001)
    bar%default(0, test, %composer, 0b0110 or 0b01110000 and %dirty shl 0b0011, 0)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    CallWithDefaults(test, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
@StabilityInferred(parameters = 1)
open class Test {
  @Composable
  @FunctionKeyMeta(key = -1866428133, startOffset = 187, endOffset = 226)
  open fun foo(param: Int, %composer: Composer?, %changed: Int) {
    %composer.startReplaceGroup(<>)
    sourceInformation(%composer, "C(foo)N(param):Test.kt")
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
    %composer.endReplaceGroup()
  }
  @Composable
  @FunctionKeyMeta(key = -671088329, startOffset = 248, endOffset = 297)
  open fun bar(param: Int, %composer: Composer?, %changed: Int): Int {
    %composer.startReplaceGroup(<>)
    sourceInformation(%composer, "C(bar)N(param):Test.kt")
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    val tmp0 = param
    if (isTraceInProgress()) {
      traceEventEnd()
    }
    %composer.endReplaceGroup()
    return tmp0
  }
  static val %stable: Int = 0
  class ComposeDefaultImpls {
    @Composable
    fun foo%default(param: Int, %this%: Test, %composer: Composer?, %changed: Int, %default: Int) {
      %composer = %composer.startRestartGroup(<>)
      sourceInformation(%composer, "C(foo%default)N(param)<rememb...>:Test.kt")
      val %dirty = %changed
      if (%default and 0b0001 != 0) {
        %dirty = %dirty or 0b0110
      } else if (%changed and 0b0110 == 0) {
        %dirty = %dirty or if (%composer.changed(param)) 0b0100 else 0b0010
      }
      if (%changed and 0b00110000 == 0) {
        %dirty = %dirty or if (%composer.changed(%this%)) 0b00100000 else 0b00010000
      }
      if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
        if (%default and 0b0001 != 0) {
          param = <block>{
            sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp")
            val tmp0_group = %composer.cache(false) {
              0
            }
            sourceInformationMarkerEnd(%composer)
            tmp0_group
          }
        }
        if (isTraceInProgress()) {
          traceEventStart(<>, %dirty, -1, <>)
        }
        %this%.foo(param, %composer, 0b1110 and %dirty or 0b01110000 and %dirty)
        if (isTraceInProgress()) {
          traceEventEnd()
        }
      } else {
        %composer.skipToGroupEnd()
      }
      %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
        foo%default(param, %this%, %composer, updateChangedFlags(%changed or 0b0001), %default)
      }
    }
    @Composable
    fun bar%default(param: Int, %this%: Test, %composer: Composer?, %changed: Int, %default: Int): Int {
      sourceInformationMarkerStart(%composer, <>, "C(bar%default)N(param)<rememb...>:Test.kt")
      if (%default and 0b0001 != 0) {
        param = <block>{
          sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp")
          val tmp0_group = %composer.cache(false) {
            0
          }
          sourceInformationMarkerEnd(%composer)
          tmp0_group
        }
      }
      if (isTraceInProgress()) {
        traceEventStart(<>, %changed, -1, <>)
      }
      val tmp1 = %this%.bar(param, %composer, 0b1110 and %changed or 0b01110000 and %changed)
      if (isTraceInProgress()) {
        traceEventEnd()
      }
      sourceInformationMarkerEnd(%composer)
      return tmp1
    }
  }
  @Composable
  @JvmSynthetic
  @Deprecated(message = "Binary compatibility stub for default parameters", level = DeprecationLevel.HIDDEN)
  open fun foo(param: Int, %composer: Composer?, %changed: Int, %default: Int) {
    return foo%default(param, <this>, %composer, %changed, %default)
  }
  @Composable
  @JvmSynthetic
  @Deprecated(message = "Binary compatibility stub for default parameters", level = DeprecationLevel.HIDDEN)
  open fun bar(param: Int, %composer: Composer?, %changed: Int, %default: Int): Int {
    return bar%default(param, <this>, %composer, %changed, %default)
  }
}
@StabilityInferred(parameters = 1)
class TestImpl : Test {
  @Composable
  @FunctionKeyMeta(key = 1427006299, startOffset = 352, endOffset = 374)
  override fun foo(param: Int, %composer: Composer?, %changed: Int) {
    %composer.startReplaceGroup(<>)
    sourceInformation(%composer, "C(foo)N(param):Test.kt")
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
    %composer.endReplaceGroup()
  }
  @Composable
  @FunctionKeyMeta(key = 278947191, startOffset = 400, endOffset = 464)
  override fun bar(param: Int, %composer: Composer?, %changed: Int): Int {
    %composer.startReplaceGroup(<>)
    sourceInformation(%composer, "C(bar)N(param)<bar(pa...>:Test.kt")
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    val tmp0 = super<Test>.bar(param, %composer, 0b1110 and %changed or 0b01110000 and %changed)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
    %composer.endReplaceGroup()
    return tmp0
  }
  static val %stable: Int = 0
}
