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

import androidx.compose.runtime.Composable

data class ChatRequestConfig(val a: Int = 10)

@Composable
fun TextField(
    onValueChange: (String) -> Unit
) {}

@Composable
fun App() {
    val currentRequestConfig = ChatRequestConfig(321)
    fun updateRequestConfig() {
        val config = ChatRequestConfig(currentRequestConfig.a ?: 10)
    }

    TextField(
        onValueChange = {
            updateRequestConfig()
        }
    )
}

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

@StabilityInferred(parameters = 1)
data class ChatRequestConfig(val a: Int = 10) {
  fun component1(): Int {
    return <this>.a
  }
  fun copy(a: Int = <this>.a): ChatRequestConfig {
    return ChatRequestConfig(a)
  }
  override fun toString(): String {
    return "ChatRequestConfig(a=%{<this>.a})"
  }
  override fun hashCode(): Int {
    return <this>.a.hashCode()
  }
  override fun equals(other: Any?): Boolean {
    when {
      <this> === other -> {
        return true
      }
    }
    when {
      other !is Boolean -> {
        return false
      }
    }
    val tmp0_other_with_cast = other as ChatRequestConfig
    when {
      <this>.a != tmp0_other_with_cast.a -> {
        return false
      }
    }
    return true
  }
  static val %stable: Int = 0
}
@Composable
@FunctionKeyMeta(key = 1476494640, startOffset = 152, endOffset = 231)
fun TextField(onValueChange: Function1<String, Unit>, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(TextField)N(onValueChange):Test.kt")
  if (%composer.shouldExecute(%changed and 0b0001 != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    TextField(onValueChange, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
@Composable
@FunctionKeyMeta(key = 61783979, startOffset = 269, endOffset = 655)
fun App(%composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(App)<{>,<TextFi...>:Test.kt")
  if (%composer.shouldExecute(%changed != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    val currentRequestConfig = ChatRequestConfig(321)
    fun updateRequestConfig() {
      val config = ChatRequestConfig(<block>{
        val tmp0_elvis_lhs = currentRequestConfig.a
        when {
          tmp0_elvis_lhs == null -> {
            10
          }
          else -> {
            tmp0_elvis_lhs
          }
        }
      })
    }
    TextField(<block>{
      sourceInformationMarkerStart(%composer, <>, "CC(remember):Test.kt#9igjgp")
      val tmp0_group = %composer.cache(%composer.changed(currentRequestConfig)) {
        { it: String ->
          updateRequestConfig()
        }
      }
      sourceInformationMarkerEnd(%composer)
      tmp0_group
    }, %composer, 0)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    App(%composer, updateChangedFlags(%changed or 0b0001))
  }
}
