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

import androidx.compose.runtime.*

@Composable
fun Test(states: List<String>, condition: Boolean) {
    states.forEach { state ->
        key(state) {
            if (condition) {
                LaunchedEffect(state) { println(state) }
            }
            TwoLambdas(
                lambda1 = { println(state) },
                lambda2 = { println(state) }
            )
        }
    }
}

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

@Composable
@FunctionKeyMeta(key = -1277138018, startOffset = 84, endOffset = 578)
fun Test(states: List<String>, condition: Boolean, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(Test)N(states,condition):Test.kt")
  val %dirty = %changed
  if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (%composer.changedInstance(states)) 0b0100 else 0b0010
  }
  if (%changed and 0b00110000 == 0) {
    %dirty = %dirty or if (%composer.changed(condition)) 0b00100000 else 0b00010000
  }
  if (%composer.shouldExecute(%dirty and 0b00010011 != 0b00010010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    states.forEach { state: String ->
      %composer.startMovableGroup(<>, state)
      sourceInformation(%composer, "<{>,<{>,<TwoLam...>")
      %composer.startReplaceGroup(<>)
      sourceInformation(%composer, "<{>,<Launch...>")
      if (condition) {
        LaunchedEffect(state, <block>{
          %composer.startReplaceGroup(<>)
          sourceInformation(%composer, "CC(remember):Test.kt#9igjgp")
          val tmp0_group = %composer.cache(%composer.changed(state)) {
            {
              println(state)
            }
          }
          %composer.endReplaceGroup()
          tmp0_group
        }, %composer, 0)
      }
      %composer.endReplaceGroup()
      TwoLambdas(<block>{
        %composer.startReplaceGroup(<!DUPLICATE KEY: 5004770!>)
        sourceInformation(%composer, "CC(remember):Test.kt#9igjgp")
        val tmp1_group = %composer.cache(%composer.changed(state)) {
          {
            println(state)
          }
        }
        %composer.endReplaceGroup()
        tmp1_group
      }, <block>{
        %composer.startReplaceGroup(<!DUPLICATE KEY: 5004770!>)
        sourceInformation(%composer, "CC(remember):Test.kt#9igjgp")
        val tmp2_group = %composer.cache(%composer.changed(state)) {
          { it: Int ->
            println(state)
          }
        }
        %composer.endReplaceGroup()
        tmp2_group
      }, %composer, 0)
      %composer.endMovableGroup()
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    Test(states, condition, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
