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

import androidx.compose.runtime.Composable

@Composable
fun Test() {
  var lambda: (@Composable () -> Unit)? = null
  f { s -> lambda = { Text(s) } }
  lambda?.let { it() }
}

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

@Composable
@FunctionKeyMeta(key = -1794342280, startOffset = 93, endOffset = 259)
fun Test(%composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(Test):Test.kt")
  if (%composer.shouldExecute(%changed != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    var lambda = null
    f { s: String ->
      lambda = composableLambdaInstance(<>, true) { %composer: Composer?, %changed: Int ->
        sourceInformation(%composer, "C<Text(s...>:Test.kt")
        if (%composer.shouldExecute(%changed and 0b0011 != 0b0010, %changed and 0b0001)) {
          if (isTraceInProgress()) {
            traceEventStart(<>, %changed, -1, <>)
          }
          Text(s, %composer, 0)
          if (isTraceInProgress()) {
            traceEventEnd()
          }
        } else {
          %composer.skipToGroupEnd()
        }
      }
    }
    val tmp0_safe_receiver = lambda
    when {
      tmp0_safe_receiver == null -> {
        %composer.startReplaceGroup(<>)
        %composer.endReplaceGroup()
        null
      }
      else -> {
        %composer.startReplaceGroup(<>)
        sourceInformation(%composer, "*<it()>")
        tmp0_safe_receiver as Function2<Composer, Int, Unit>.let { it: Function2<Composer, Int, Unit> ->
          it(%composer, 0)
        }
        %composer.endReplaceGroup()
      }
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    Test(%composer, updateChangedFlags(%changed or 0b0001))
  }
}
