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

import androidx.compose.runtime.*


interface Test {
    @Composable fun Int.bar(param: Int = remember { 0 }): Int = param
}

class TestImpl : Test {
    @Composable override fun Int.bar(param: Int): Int = 0
}

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

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

interface Test {
  @Composable
  @FunctionKeyMeta(key = -796062154, startOffset = 69, endOffset = 122)
  open fun Int.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
  }
  class ComposeDefaultImpls {
    @Composable
    fun bar%default(param: Int, %this%: Test, %this%: Int, %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 shr 0b0110 or 0b01110000 and %changed shl 0b0011 or 0b001110000000 and %changed shl 0b0011)
      if (isTraceInProgress()) {
        traceEventEnd()
      }
      sourceInformationMarkerEnd(%composer)
      return tmp1
    }
  }
  @Composable
  @JvmSynthetic
  @Deprecated(message = "Binary compatibility stub for default parameters", level = DeprecationLevel.HIDDEN)
  open fun Int.bar(param: Int, %composer: Composer?, %changed: Int, %default: Int): Int {
    return bar%default(param, <this>, <this>, %composer, %changed, %default)
  }
}
@StabilityInferred(parameters = 1)
class TestImpl : Test {
  @Composable
  @FunctionKeyMeta(key = -1311712522, startOffset = 175, endOffset = 207)
  override fun Int.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 = 0
    if (isTraceInProgress()) {
      traceEventEnd()
    }
    %composer.endReplaceGroup()
    return tmp0
  }
  static val %stable: Int = 0
}
@Composable
@FunctionKeyMeta(key = 53166890, startOffset = 223, endOffset = 317)
fun CallWithDefaults(test: Test, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(CallWithDefaults)N(test)*<bar()>,<bar(0)>:Test.kt")
  val %dirty = %changed
  if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (if (%changed and 0b1000 == 0) {
      %composer.changed(test)
    } else {
      %composer.changedInstance(test)
    }
    ) 0b0100 else 0b0010
  }
  if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    val tmp0_group = with(test) {
      bar%default(0, %this%with, 42, %composer, 0b000110000000, 0b0001)
      val tmp0_return = bar%default(0, %this%with, 42, %composer, 0b000110000110, 0)
      tmp0_return
    }
    tmp0_group
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    CallWithDefaults(test, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
