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

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

class CurrentHolder {
    inline val current: Int
        @ReadOnlyComposable
        @Composable
        get() = 0
}

class HolderHolder {
    private val _currentHolder = CurrentHolder()
    val current: Int
        @ReadOnlyComposable
        @Composable
        get() = _currentHolder.current
}

val holderHolder = HolderHolder()

@Composable
@ReadOnlyComposable
fun calculateSomething(): Int {
    return 0;
}

@Composable
fun Test() {
    val c = holderHolder.current
    val cl = calculateSomething()
    Layout {
        Text("$c $cl")
    }
}

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

@StabilityInferred(parameters = 1)
class CurrentHolder {
  val current: Int
    @ReadOnlyComposable @Composable @JvmName(name = "getCurrent") @FunctionKeyMeta(key = -1234923825, startOffset = 286, endOffset = 295)
    get() {
      sourceInformationMarkerStart(%composer, <>, "CC(<get-current>):Test.kt")
      val tmp0 = 0
      sourceInformationMarkerEnd(%composer)
      return tmp0
    }
  static val %stable: Int = 0
}
@StabilityInferred(parameters = 1)
class HolderHolder {
  val _currentHolder: CurrentHolder = CurrentHolder()
  val current: Int
    @ReadOnlyComposable @Composable @JvmName(name = "getCurrent") @FunctionKeyMeta(key = 1636580468, startOffset = 530, endOffset = 560)
    get() {
      sourceInformationMarkerStart(%composer, <>, "C(<get-current>)<curren...>:Test.kt")
      if (isTraceInProgress()) {
        traceEventStart(<>, %changed, -1, "HolderHolder.<get-current> (Test.kt:16)")
      }
      val tmp0 = _currentHolder.<get-current>(%composer, 0)
      if (isTraceInProgress()) {
        traceEventEnd()
      }
      sourceInformationMarkerEnd(%composer)
      return tmp0
    }
  static val %stable: Int = 0
}
val holderHolder: HolderHolder = HolderHolder()
@Composable
@ReadOnlyComposable
@FunctionKeyMeta(key = 902964415, startOffset = 691, endOffset = 762)
fun calculateSomething(%composer: Composer?, %changed: Int): Int {
  sourceInformationMarkerStart(%composer, <>, "C(calculateSomething):Test.kt")
  if (isTraceInProgress()) {
    traceEventStart(<>, %changed, -1, "calculateSomething (Test.kt:23)")
  }
  val tmp0 = 0
  if (isTraceInProgress()) {
    traceEventEnd()
  }
  sourceInformationMarkerEnd(%composer)
  return tmp0
}
@Composable
@FunctionKeyMeta(key = -1794342280, startOffset = 800, endOffset = 995)
fun Test(%composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(Test)<curren...>,<calcul...>,<Layout>:Test.kt")
  if (%composer.shouldExecute(%changed != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, "Test (Test.kt:28)")
    }
    val c = holderHolder.<get-current>(%composer, 0b0110)
    val cl = calculateSomething(%composer, 0)
    Layout({ %composer: Composer?, %changed: Int ->
      sourceInformationMarkerStart(%composer, <>, "C<Text("...>:Test.kt")
      Text("%c %cl", %composer, 0)
      sourceInformationMarkerEnd(%composer)
    }, %composer, 0)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    Test(%composer, updateChangedFlags(%changed or 0b0001))
  }
}
