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

import androidx.compose.runtime.Composable

fun interface CustomComposable {
    @Composable
    fun call()
}

@Composable
fun OpenCustom(content: CustomComposable) {
    content.call()
}

@Composable
fun ClosedCustom(content: CustomComposable) {
    Text("Test")
    content.call()
}

@Composable
fun Test() {
    OpenCustom {
        Text("Test")
    }
    ClosedCustom  {
        Text("Test")
    }
}

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

interface CustomComposable {
  @Composable
  @FunctionKeyMeta(key = 607754244, startOffset = 130, endOffset = 140)
  abstract fun call(%composer: Composer?, %changed: Int)
}
@Composable
@ComposableInferredTarget(scheme = "[0[0]]")
@FunctionKeyMeta(key = 799442755, startOffset = 180, endOffset = 260)
fun OpenCustom(content: CustomComposable, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(OpenCustom)<call()>:Test.kt")
  val %dirty = %changed
  if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (if (%changed and 0b1000 == 0) {
      %composer.changed(content)
    } else {
      %composer.changedInstance(content)
    }
    ) 0b0100 else 0b0010
  }
  if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    content.call(%composer, 0b1110 and %dirty)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    OpenCustom(content, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
@Composable
@ComposableInferredTarget(scheme = "[UI[UI]]")
@FunctionKeyMeta(key = -1487019547, startOffset = 290, endOffset = 397)
fun ClosedCustom(content: CustomComposable, %composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(ClosedCustom)<Text("...>,<call()>:Test.kt")
  val %dirty = %changed
  if (%changed and 0b0110 == 0) {
    %dirty = %dirty or if (if (%changed and 0b1000 == 0) {
      %composer.changed(content)
    } else {
      %composer.changedInstance(content)
    }
    ) 0b0100 else 0b0010
  }
  if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %dirty, -1, <>)
    }
    Text("Test", %composer, 0b0110)
    content.call(%composer, 0b1110 and %dirty)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    ClosedCustom(content, %composer, updateChangedFlags(%changed or 0b0001))
  }
}
@Composable
@ComposableTarget(applier = "UI")
@FunctionKeyMeta(key = -1794342280, startOffset = 427, endOffset = 588)
fun Test(%composer: Composer?, %changed: Int) {
  %composer = %composer.startRestartGroup(<>)
  sourceInformation(%composer, "C(Test)<OpenCu...>,<Closed...>:Test.kt")
  if (%composer.shouldExecute(%changed != 0, %changed and 0b0001)) {
    if (isTraceInProgress()) {
      traceEventStart(<>, %changed, -1, <>)
    }
    OpenCustom(<block>{
      class <no name provided> : CustomComposable {
        @Composable
        @ComposableTarget(applier = "UI")
        @FunctionKeyMeta(key = 1579781544, startOffset = 463, endOffset = 507)
        override fun call(%composer: Composer?, %changed: Int) {
          %composer = %composer.startRestartGroup(<>)
          sourceInformation(%composer, "C(call)<Text("...>:Test.kt")
          val %dirty = %changed
          if (%changed and 0b0110 == 0) {
            %dirty = %dirty or if (%composer.changed(<this>)) 0b0100 else 0b0010
          }
          if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
            if (isTraceInProgress()) {
              traceEventStart(<>, %dirty, -1, <>)
            }
            Text("Test", %composer, 0b0110)
            if (isTraceInProgress()) {
              traceEventEnd()
            }
          } else {
            %composer.skipToGroupEnd()
          }
          val tmp0_rcvr = <this>
          %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
            tmp0_rcvr.call(%composer, updateChangedFlags(%changed or 0b0001))
          }
        }
      }
      <no name provided>()
    }, %composer, 0)
    ClosedCustom(<block>{
      class <no name provided> : CustomComposable {
        @Composable
        @ComposableTarget(applier = "UI")
        @FunctionKeyMeta(key = -1274072378, startOffset = 534, endOffset = 578)
        override fun call(%composer: Composer?, %changed: Int) {
          %composer = %composer.startRestartGroup(<>)
          sourceInformation(%composer, "C(call)<Text("...>:Test.kt")
          val %dirty = %changed
          if (%changed and 0b0110 == 0) {
            %dirty = %dirty or if (%composer.changed(<this>)) 0b0100 else 0b0010
          }
          if (%composer.shouldExecute(%dirty and 0b0011 != 0b0010, %dirty and 0b0001)) {
            if (isTraceInProgress()) {
              traceEventStart(<>, %dirty, -1, <>)
            }
            Text("Test", %composer, 0b0110)
            if (isTraceInProgress()) {
              traceEventEnd()
            }
          } else {
            %composer.skipToGroupEnd()
          }
          val tmp0_rcvr = <this>
          %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
            tmp0_rcvr.call(%composer, updateChangedFlags(%changed or 0b0001))
          }
        }
      }
      <no name provided>()
    }, %composer, 0)
    if (isTraceInProgress()) {
      traceEventEnd()
    }
  } else {
    %composer.skipToGroupEnd()
  }
  %composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int ->
    Test(%composer, updateChangedFlags(%changed or 0b0001))
  }
}
