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

@file:OptIn(
  InternalComposeApi::class,
)
package test

import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.ComposeCompilerApi
import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonRestartableComposable


@Composable
fun VarArgsFirst(vararg foo: Any?) {
    println(foo)
}

@Composable
fun VarArgsCaller() {
    VarArgsFirst()
}

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

@Composable
@FunctionKeyMeta(key = -1432450653, startOffset = 274, endOffset = 329)
fun VarArgsFirst(foo: Array<out Any?>, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(VarArgsFirst)N(foo):Test.kt#2487m")
  val %dirty = %changed
  %composer.startMovableGroup(<>, foo.size)
  %dirty = %dirty or if (%composer.changed(foo.size)) 0b0100 else 0
  val <iterator> = foo.iterator()
  while (<iterator>.hasNext()) {
    val value = <iterator>.next()
    %dirty = %dirty or if (%composer.changedInstance(value)) 0b0100 else 0
  }
  %composer.endMovableGroup()
  if (%dirty and 0b1110 == 0) {
    %dirty = %dirty or 0b0010
  }
  if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    println(foo)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    VarArgsFirst(foo, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
@Composable
@FunctionKeyMeta(key = -442597657, startOffset = 343, endOffset = 385)
fun VarArgsCaller(%composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(VarArgsCaller)<VarArg...>:Test.kt#2487m")
  if (%composer.shouldExecute(%changed != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    VarArgsFirst(
      %composer = %composer,
      %changed = 0
    )
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    VarArgsCaller(%composer, updateChangedFlags(%changed or 0b0001))
  }
}
