package juuxel.advent

import java.nio.file.Files
import java.nio.file.Paths

fun main() {
    val input = Files.readAllLines(Paths.get("day2.txt")).joinToString(separator = "")
    val mem = input.split(',').map { it.toInt() }.toIntArray()

    part1(mem.copyOf())
    part2(mem) // Part 2 is mem-safe
}

private fun part1(mem: IntArray) {
    println(
        "Part 1: " + run(mem, noun = 12, verb = 2)
    )
}

private fun part2(mem: IntArray) {
    for (noun in mem.indices) {
        for (verb in mem.indices) {
            val result = run(mem.copyOf(), noun, verb)

            if (result == 19690720) {
                println("Part 2: ${100 * noun + verb}")
                break
            }
        }
    }
}

private fun run(mem: IntArray, noun: Int, verb: Int): Int {
    val reader = MemReader(mem)
    mem[1] = noun
    mem[2] = verb
    while (true) {
        reader.nextOpcode().run(mem) ?: return mem[0]
    }
}

private class MemReader(private val mem: IntArray) {
    private var pos: Int = 0

    fun nextOpcode(): Intcode {
        val result = when (val opcode = mem[pos]) {
            1 -> Intcode.Add(mem[pos + 1], mem[pos + 2], mem[pos + 3])
            2 -> Intcode.Multiply(mem[pos + 1], mem[pos + 2], mem[pos + 3])
            99 -> Intcode.Halt
            else -> Intcode.Unknown(opcode)
        }

        pos += 4
        return result
    }
}

private sealed class Intcode {
    data class Add(val a: Int, val b: Int, val out: Int) : Intcode()
    data class Multiply(val a: Int, val b: Int, val out: Int) : Intcode()
    object Halt : Intcode()
    data class Unknown(val opcode: Int) : Intcode()

    fun run(mem: IntArray): Unit? =
        when (this) {
            is Add -> mem[out] = mem[a] + mem[b]
            is Multiply -> mem[out] = mem[a] * mem[b]
            else -> null
        }
}

Compiled from "Day2.kt"
public final class juuxel.advent.Day2Kt {
  public static final void main();
    Code:
       0: ldc           #8                  // String day2.txt
       2: iconst_0
       3: anewarray     #10                 // class java/lang/String
       6: invokestatic  #16                 // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
       9: invokestatic  #22                 // Method java/nio/file/Files.readAllLines:(Ljava/nio/file/Path;)Ljava/util/List;
      12: dup
      13: ldc           #24                 // String readAllLines(...)
      15: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      18: checkcast     #32                 // class java/lang/Iterable
      21: ldc           #34                 // String
      23: checkcast     #36                 // class java/lang/CharSequence
      26: aconst_null
      27: aconst_null
      28: iconst_0
      29: aconst_null
      30: aconst_null
      31: bipush        62
      33: aconst_null
      34: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      37: astore_0
      38: aload_0
      39: checkcast     #36                 // class java/lang/CharSequence
      42: iconst_1
      43: newarray       char
      45: astore_2
      46: aload_2
      47: iconst_0
      48: bipush        44
      50: castore
      51: aload_2
      52: iconst_0
      53: iconst_0
      54: bipush        6
      56: aconst_null
      57: invokestatic  #48                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[CZIILjava/lang/Object;)Ljava/util/List;
      60: checkcast     #32                 // class java/lang/Iterable
      63: astore_2
      64: iconst_0
      65: istore_3
      66: aload_2
      67: astore        4
      69: new           #50                 // class java/util/ArrayList
      72: dup
      73: aload_2
      74: bipush        10
      76: invokestatic  #54                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      79: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
      82: checkcast     #60                 // class java/util/Collection
      85: astore        5
      87: iconst_0
      88: istore        6
      90: aload         4
      92: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      97: astore        7
      99: aload         7
     101: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     106: ifeq          153
     109: aload         7
     111: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     116: astore        8
     118: aload         5
     120: aload         8
     122: checkcast     #10                 // class java/lang/String
     125: astore        9
     127: astore        11
     129: iconst_0
     130: istore        10
     132: aload         9
     134: invokestatic  #80                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     137: nop
     138: invokestatic  #84                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     141: aload         11
     143: swap
     144: invokeinterface #88,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     149: pop
     150: goto          99
     153: aload         5
     155: checkcast     #90                 // class java/util/List
     158: nop
     159: checkcast     #60                 // class java/util/Collection
     162: invokestatic  #94                 // Method kotlin/collections/CollectionsKt.toIntArray:(Ljava/util/Collection;)[I
     165: astore_1
     166: aload_1
     167: dup
     168: arraylength
     169: invokestatic  #100                // Method java/util/Arrays.copyOf:([II)[I
     172: dup
     173: ldc           #102                // String copyOf(...)
     175: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     178: invokestatic  #106                // Method part1:([I)V
     181: aload_1
     182: invokestatic  #109                // Method part2:([I)V
     185: return

  private static final void part1(int[]);
    Code:
       0: new           #127                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #129                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #131                // String Part 1:
       9: invokevirtual #135                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: bipush        12
      15: iconst_2
      16: invokestatic  #139                // Method run:([III)I
      19: invokevirtual #142                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      22: invokevirtual #146                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      25: astore_1
      26: getstatic     #152                // Field java/lang/System.out:Ljava/io/PrintStream;
      29: aload_1
      30: invokevirtual #158                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      33: return

  private static final void part2(int[]);
    Code:
       0: iconst_0
       1: istore_1
       2: aload_0
       3: arraylength
       4: istore_2
       5: iload_1
       6: iload_2
       7: if_icmpge     94
      10: iconst_0
      11: istore_3
      12: aload_0
      13: arraylength
      14: istore        4
      16: iload_3
      17: iload         4
      19: if_icmpge     88
      22: aload_0
      23: dup
      24: arraylength
      25: invokestatic  #100                // Method java/util/Arrays.copyOf:([II)[I
      28: dup
      29: ldc           #102                // String copyOf(...)
      31: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      34: iload_1
      35: iload_3
      36: invokestatic  #139                // Method run:([III)I
      39: istore        5
      41: iload         5
      43: ldc           #159                // int 19690720
      45: if_icmpne     82
      48: new           #127                // class java/lang/StringBuilder
      51: dup
      52: invokespecial #129                // Method java/lang/StringBuilder."<init>":()V
      55: ldc           #161                // String Part 2:
      57: invokevirtual #135                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      60: bipush        100
      62: iload_1
      63: imul
      64: iload_3
      65: iadd
      66: invokevirtual #142                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      69: invokevirtual #146                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      72: getstatic     #152                // Field java/lang/System.out:Ljava/io/PrintStream;
      75: swap
      76: invokevirtual #158                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      79: goto          88
      82: iinc          3, 1
      85: goto          16
      88: iinc          1, 1
      91: goto          5
      94: return

  private static final int run(int[], int, int);
    Code:
       0: new           #166                // class juuxel/advent/MemReader
       3: dup
       4: aload_0
       5: invokespecial #168                // Method juuxel/advent/MemReader."<init>":([I)V
       8: astore_3
       9: aload_0
      10: iconst_1
      11: iload_1
      12: iastore
      13: aload_0
      14: iconst_2
      15: iload_2
      16: iastore
      17: nop
      18: aload_3
      19: invokevirtual #172                // Method juuxel/advent/MemReader.nextOpcode:()Ljuuxel/advent/Intcode;
      22: aload_0
      23: invokevirtual #177                // Method juuxel/advent/Intcode.run:([I)Lkotlin/Unit;
      26: ifnonnull     17
      29: aload_0
      30: iconst_0
      31: iaload
      32: ireturn

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #182                // Method main:()V
       3: return
}


package days

import java.io.File

fun String.parse() = when(this) {
    "noop" -> sequence{ yield { (cycle, x): Pair<Int, Int> -> cycle + 1 to x } }
    else -> this.replace("addx ", "").toInt().let {
        sequence{
            yield { (cycle, x): Pair<Int, Int> -> cycle + 1 to x }
            yield { (cycle, x): Pair<Int, Int> -> cycle + 1 to x + it }
        }
    }
}

fun day10part1() = File("input/10.txt").readLines()
    .flatMap { it.parse() }
    .scan(1 to 1) { acc, f -> f(acc) }
    .filter { (cycle, _) -> cycle in 20..220 step 40 }
    .sumOf { (cycle, x) -> cycle * x }

fun day10part2() = File("input/10.txt").readLines()
    .flatMap { it.parse() }.asSequence()
    .scan(0 to 1) { acc, f -> f(acc) }
    .map { (cycle, x) -> cycle.mod(40) to x }
    .map { (pointer, x ) -> if (x in (pointer - 1 .. pointer + 1)) '#' else '.' }
    .chunked(40)
    .map { it.joinToString(" ") }
    .joinToString("\n")

Compiled from "day10.kt"
final class days.Day10Kt$parse$2$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super kotlin.jvm.functions.Function1<? super kotlin.Pair<? extends java.lang.Integer, ? extends java.lang.Integer>, ? extends kotlin.Pair<? extends java.lang.Integer, ? extends java.lang.Integer>>>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {
  int label;

  private java.lang.Object L$0;

  final int $it;

  days.Day10Kt$parse$2$1(int, kotlin.coroutines.Continuation<? super days.Day10Kt$parse$2$1>);
    Code:
       0: aload_0
       1: iload_1
       2: putfield      #14                 // Field $it:I
       5: aload_0
       6: iconst_2
       7: aload_2
       8: invokespecial #16                 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda."<init>":(ILkotlin/coroutines/Continuation;)V
      11: return

  public final java.lang.Object invokeSuspend(java.lang.Object);
    Code:
       0: invokestatic  #43                 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;
       3: astore_3
       4: aload_0
       5: getfield      #46                 // Field label:I
       8: tableswitch   { // 0 to 2
                     0: 36
                     1: 78
                     2: 126
               default: 136
          }
      36: aload_1
      37: invokestatic  #52                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      40: aload_0
      41: getfield      #55                 // Field L$0:Ljava/lang/Object;
      44: checkcast     #57                 // class kotlin/sequences/SequenceScope
      47: astore_2
      48: aload_2
      49: invokedynamic #75,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      54: aload_0
      55: checkcast     #77                 // class kotlin/coroutines/Continuation
      58: aload_0
      59: aload_2
      60: putfield      #55                 // Field L$0:Ljava/lang/Object;
      63: aload_0
      64: iconst_1
      65: putfield      #46                 // Field label:I
      68: invokevirtual #81                 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      71: dup
      72: aload_3
      73: if_acmpne     91
      76: aload_3
      77: areturn
      78: aload_0
      79: getfield      #55                 // Field L$0:Ljava/lang/Object;
      82: checkcast     #57                 // class kotlin/sequences/SequenceScope
      85: astore_2
      86: aload_1
      87: invokestatic  #52                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      90: aload_1
      91: pop
      92: aload_2
      93: aload_0
      94: getfield      #14                 // Field $it:I
      97: invokedynamic #89,  0             // InvokeDynamic #1:invoke:(I)Lkotlin/jvm/functions/Function1;
     102: aload_0
     103: checkcast     #77                 // class kotlin/coroutines/Continuation
     106: aload_0
     107: aconst_null
     108: putfield      #55                 // Field L$0:Ljava/lang/Object;
     111: aload_0
     112: iconst_2
     113: putfield      #46                 // Field label:I
     116: invokevirtual #81                 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
     119: dup
     120: aload_3
     121: if_acmpne     131
     124: aload_3
     125: areturn
     126: aload_1
     127: invokestatic  #52                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     130: aload_1
     131: pop
     132: getstatic     #95                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     135: areturn
     136: new           #97                 // class java/lang/IllegalStateException
     139: dup
     140: ldc           #99                 // String call to \'resume\' before \'invoke\' with coroutine
     142: invokespecial #102                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     145: athrow

  public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);
    Code:
       0: new           #2                  // class days/Day10Kt$parse$2$1
       3: dup
       4: aload_0
       5: getfield      #14                 // Field $it:I
       8: aload_2
       9: invokespecial #110                // Method "<init>":(ILkotlin/coroutines/Continuation;)V
      12: astore_3
      13: aload_3
      14: aload_1
      15: putfield      #55                 // Field L$0:Ljava/lang/Object;
      18: aload_3
      19: checkcast     #77                 // class kotlin/coroutines/Continuation
      22: areturn

  public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super kotlin.jvm.functions.Function1<? super kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>>, kotlin.coroutines.Continuation<? super kotlin.Unit>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokevirtual #115                // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
       6: checkcast     #2                  // class days/Day10Kt$parse$2$1
       9: getstatic     #95                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      12: invokevirtual #117                // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;
      15: areturn

  private static final kotlin.Pair invokeSuspend$lambda$0(kotlin.Pair);
    Code:
       0: aload_0
       1: invokevirtual #124                // Method kotlin/Pair.component1:()Ljava/lang/Object;
       4: checkcast     #126                // class java/lang/Number
       7: invokevirtual #130                // Method java/lang/Number.intValue:()I
      10: istore_1
      11: aload_0
      12: invokevirtual #133                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      15: checkcast     #126                // class java/lang/Number
      18: invokevirtual #130                // Method java/lang/Number.intValue:()I
      21: istore_2
      22: iload_1
      23: iconst_1
      24: iadd
      25: invokestatic  #139                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: iload_2
      29: invokestatic  #139                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      32: invokestatic  #145                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      35: areturn

  private static final kotlin.Pair invokeSuspend$lambda$1(int, kotlin.Pair);
    Code:
       0: aload_1
       1: invokevirtual #124                // Method kotlin/Pair.component1:()Ljava/lang/Object;
       4: checkcast     #126                // class java/lang/Number
       7: invokevirtual #130                // Method java/lang/Number.intValue:()I
      10: istore_2
      11: aload_1
      12: invokevirtual #133                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      15: checkcast     #126                // class java/lang/Number
      18: invokevirtual #130                // Method java/lang/Number.intValue:()I
      21: istore_3
      22: iload_2
      23: iconst_1
      24: iadd
      25: invokestatic  #139                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: iload_3
      29: iload_0
      30: iadd
      31: invokestatic  #139                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      34: invokestatic  #145                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      37: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #57                 // class kotlin/sequences/SequenceScope
       5: aload_2
       6: checkcast     #77                 // class kotlin/coroutines/Continuation
       9: invokevirtual #150                // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      12: areturn
}

Compiled from "day10.kt"
public final class days.Day10Kt {
  public static final kotlin.sequences.Sequence<kotlin.jvm.functions.Function1<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>> parse(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: ldc           #18                 // String noop
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      12: ifeq          32
      15: new           #24                 // class days/Day10Kt$parse$1
      18: dup
      19: aconst_null
      20: invokespecial #28                 // Method days/Day10Kt$parse$1."<init>":(Lkotlin/coroutines/Continuation;)V
      23: checkcast     #30                 // class kotlin/jvm/functions/Function2
      26: invokestatic  #36                 // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
      29: goto          66
      32: aload_0
      33: ldc           #38                 // String addx
      35: ldc           #40                 // String
      37: iconst_0
      38: iconst_4
      39: aconst_null
      40: invokestatic  #46                 // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
      43: invokestatic  #52                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      46: istore_1
      47: iconst_0
      48: istore_2
      49: new           #54                 // class days/Day10Kt$parse$2$1
      52: dup
      53: iload_1
      54: aconst_null
      55: invokespecial #57                 // Method days/Day10Kt$parse$2$1."<init>":(ILkotlin/coroutines/Continuation;)V
      58: checkcast     #30                 // class kotlin/jvm/functions/Function2
      61: invokestatic  #36                 // Method kotlin/sequences/SequencesKt.sequence:(Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
      64: nop
      65: nop
      66: areturn

  public static final int day10part1();
    Code:
       0: new           #68                 // class java/io/File
       3: dup
       4: ldc           #70                 // String input/10.txt
       6: invokespecial #73                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #79                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      15: checkcast     #81                 // class java/lang/Iterable
      18: astore_0
      19: nop
      20: iconst_0
      21: istore_1
      22: aload_0
      23: astore_2
      24: new           #83                 // class java/util/ArrayList
      27: dup
      28: invokespecial #86                 // Method java/util/ArrayList."<init>":()V
      31: checkcast     #88                 // class java/util/Collection
      34: astore_3
      35: iconst_0
      36: istore        4
      38: aload_2
      39: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        5
      46: aload         5
      48: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          92
      56: aload         5
      58: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        6
      65: aload         6
      67: checkcast     #104                // class java/lang/String
      70: astore        7
      72: iconst_0
      73: istore        8
      75: aload         7
      77: invokestatic  #106                // Method parse:(Ljava/lang/String;)Lkotlin/sequences/Sequence;
      80: astore        7
      82: aload_3
      83: aload         7
      85: invokestatic  #112                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Lkotlin/sequences/Sequence;)Z
      88: pop
      89: goto          46
      92: aload_3
      93: checkcast     #114                // class java/util/List
      96: nop
      97: checkcast     #81                 // class java/lang/Iterable
     100: astore_0
     101: iconst_1
     102: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     105: iconst_1
     106: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     109: invokestatic  #124                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     112: astore_1
     113: iconst_0
     114: istore_2
     115: aload_0
     116: astore_3
     117: iconst_0
     118: istore        4
     120: aload_3
     121: bipush        9
     123: invokestatic  #128                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     126: istore        5
     128: iload         5
     130: ifne          140
     133: aload_1
     134: invokestatic  #132                // Method kotlin/collections/CollectionsKt.listOf:(Ljava/lang/Object;)Ljava/util/List;
     137: goto          245
     140: new           #83                 // class java/util/ArrayList
     143: dup
     144: iload         5
     146: iconst_1
     147: iadd
     148: invokespecial #135                // Method java/util/ArrayList."<init>":(I)V
     151: astore        6
     153: aload         6
     155: astore        7
     157: iconst_0
     158: istore        8
     160: aload         7
     162: aload_1
     163: invokevirtual #139                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     166: pop
     167: aload         6
     169: astore        9
     171: aload_1
     172: astore        6
     174: aload_3
     175: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     180: astore        7
     182: aload         7
     184: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     189: ifeq          240
     192: aload         7
     194: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     199: astore        8
     201: aload         6
     203: aload         8
     205: checkcast     #141                // class kotlin/jvm/functions/Function1
     208: astore        10
     210: astore        11
     212: iconst_0
     213: istore        12
     215: aload         10
     217: aload         11
     219: invokeinterface #145,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     224: checkcast     #147                // class kotlin/Pair
     227: astore        6
     229: aload         9
     231: aload         6
     233: invokevirtual #139                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     236: pop
     237: goto          182
     240: aload         9
     242: checkcast     #114                // class java/util/List
     245: nop
     246: checkcast     #81                 // class java/lang/Iterable
     249: astore_0
     250: nop
     251: iconst_0
     252: istore_1
     253: aload_0
     254: astore_2
     255: new           #83                 // class java/util/ArrayList
     258: dup
     259: invokespecial #86                 // Method java/util/ArrayList."<init>":()V
     262: checkcast     #88                 // class java/util/Collection
     265: astore_3
     266: iconst_0
     267: istore        4
     269: aload_2
     270: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     275: astore        5
     277: aload         5
     279: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     284: ifeq          365
     287: aload         5
     289: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     294: astore        6
     296: aload         6
     298: checkcast     #147                // class kotlin/Pair
     301: astore        7
     303: iconst_0
     304: istore        8
     306: aload         7
     308: invokevirtual #150                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     311: checkcast     #152                // class java/lang/Number
     314: invokevirtual #155                // Method java/lang/Number.intValue:()I
     317: istore        9
     319: new           #157                // class kotlin/ranges/IntRange
     322: dup
     323: bipush        20
     325: sipush        220
     328: invokespecial #160                // Method kotlin/ranges/IntRange."<init>":(II)V
     331: checkcast     #162                // class kotlin/ranges/IntProgression
     334: bipush        40
     336: invokestatic  #168                // Method kotlin/ranges/RangesKt.step:(Lkotlin/ranges/IntProgression;I)Lkotlin/ranges/IntProgression;
     339: checkcast     #81                 // class java/lang/Iterable
     342: iload         9
     344: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     347: invokestatic  #172                // Method kotlin/collections/CollectionsKt.contains:(Ljava/lang/Iterable;Ljava/lang/Object;)Z
     350: ifeq          277
     353: aload_3
     354: aload         6
     356: invokeinterface #173,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     361: pop
     362: goto          277
     365: aload_3
     366: checkcast     #114                // class java/util/List
     369: nop
     370: checkcast     #81                 // class java/lang/Iterable
     373: astore_0
     374: iconst_0
     375: istore_1
     376: aload_0
     377: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     382: astore_2
     383: aload_2
     384: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     389: ifeq          453
     392: aload_2
     393: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     398: astore_3
     399: iload_1
     400: aload_3
     401: checkcast     #147                // class kotlin/Pair
     404: astore        4
     406: istore        13
     408: iconst_0
     409: istore        5
     411: aload         4
     413: invokevirtual #150                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     416: checkcast     #152                // class java/lang/Number
     419: invokevirtual #155                // Method java/lang/Number.intValue:()I
     422: istore        6
     424: aload         4
     426: invokevirtual #176                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     429: checkcast     #152                // class java/lang/Number
     432: invokevirtual #155                // Method java/lang/Number.intValue:()I
     435: istore        7
     437: iload         6
     439: iload         7
     441: imul
     442: istore        14
     444: iload         13
     446: iload         14
     448: iadd
     449: istore_1
     450: goto          383
     453: iload_1
     454: ireturn

  public static final java.lang.String day10part2();
    Code:
       0: new           #68                 // class java/io/File
       3: dup
       4: ldc           #70                 // String input/10.txt
       6: invokespecial #73                 // Method java/io/File."<init>":(Ljava/lang/String;)V
       9: aconst_null
      10: iconst_1
      11: aconst_null
      12: invokestatic  #79                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      15: checkcast     #81                 // class java/lang/Iterable
      18: astore_0
      19: nop
      20: iconst_0
      21: istore_1
      22: aload_0
      23: astore_2
      24: new           #83                 // class java/util/ArrayList
      27: dup
      28: invokespecial #86                 // Method java/util/ArrayList."<init>":()V
      31: checkcast     #88                 // class java/util/Collection
      34: astore_3
      35: iconst_0
      36: istore        4
      38: aload_2
      39: invokeinterface #92,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      44: astore        5
      46: aload         5
      48: invokeinterface #98,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      53: ifeq          92
      56: aload         5
      58: invokeinterface #102,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: astore        6
      65: aload         6
      67: checkcast     #104                // class java/lang/String
      70: astore        7
      72: iconst_0
      73: istore        8
      75: aload         7
      77: invokestatic  #106                // Method parse:(Ljava/lang/String;)Lkotlin/sequences/Sequence;
      80: astore        7
      82: aload_3
      83: aload         7
      85: invokestatic  #112                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Lkotlin/sequences/Sequence;)Z
      88: pop
      89: goto          46
      92: aload_3
      93: checkcast     #114                // class java/util/List
      96: nop
      97: checkcast     #81                 // class java/lang/Iterable
     100: invokestatic  #218                // Method kotlin/collections/CollectionsKt.asSequence:(Ljava/lang/Iterable;)Lkotlin/sequences/Sequence;
     103: iconst_0
     104: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     107: iconst_1
     108: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     111: invokestatic  #124                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     114: invokedynamic #236,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
     119: invokestatic  #240                // Method kotlin/sequences/SequencesKt.scan:(Lkotlin/sequences/Sequence;Ljava/lang/Object;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
     122: invokedynamic #250,  0            // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function1;
     127: invokestatic  #254                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     130: invokedynamic #262,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function1;
     135: invokestatic  #254                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     138: bipush        40
     140: invokestatic  #266                // Method kotlin/sequences/SequencesKt.chunked:(Lkotlin/sequences/Sequence;I)Lkotlin/sequences/Sequence;
     143: invokedynamic #273,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
     148: invokestatic  #254                // Method kotlin/sequences/SequencesKt.map:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     151: ldc_w         #275                // String \n
     154: checkcast     #277                // class java/lang/CharSequence
     157: aconst_null
     158: aconst_null
     159: iconst_0
     160: aconst_null
     161: aconst_null
     162: bipush        62
     164: aconst_null
     165: invokestatic  #281                // Method kotlin/sequences/SequencesKt.joinToString$default:(Lkotlin/sequences/Sequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
     168: areturn

  private static final kotlin.Pair day10part2$lambda$6(kotlin.Pair, kotlin.jvm.functions.Function1);
    Code:
       0: aload_0
       1: ldc_w         #283                // String acc
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #284                // String f
      11: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_1
      15: aload_0
      16: invokeinterface #145,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
      21: checkcast     #147                // class kotlin/Pair
      24: areturn

  private static final kotlin.Pair day10part2$lambda$7(kotlin.Pair);
    Code:
       0: aload_0
       1: ldc_w         #286                // String <destruct>
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #150                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      11: checkcast     #152                // class java/lang/Number
      14: invokevirtual #155                // Method java/lang/Number.intValue:()I
      17: istore_1
      18: aload_0
      19: invokevirtual #176                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      22: checkcast     #152                // class java/lang/Number
      25: invokevirtual #155                // Method java/lang/Number.intValue:()I
      28: istore_2
      29: iload_1
      30: istore_3
      31: bipush        40
      33: istore        4
      35: iload_3
      36: iload         4
      38: irem
      39: istore        5
      41: iload         5
      43: iload         4
      45: iload         5
      47: iload         4
      49: ixor
      50: iload         5
      52: iload         5
      54: ineg
      55: ior
      56: iand
      57: bipush        31
      59: ishr
      60: iand
      61: iadd
      62: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      65: iload_2
      66: invokestatic  #118                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      69: invokestatic  #124                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      72: areturn

  private static final char day10part2$lambda$8(kotlin.Pair);
    Code:
       0: aload_0
       1: ldc_w         #286                // String <destruct>
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #150                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      11: checkcast     #152                // class java/lang/Number
      14: invokevirtual #155                // Method java/lang/Number.intValue:()I
      17: istore_1
      18: aload_0
      19: invokevirtual #176                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      22: checkcast     #152                // class java/lang/Number
      25: invokevirtual #155                // Method java/lang/Number.intValue:()I
      28: istore_2
      29: iload_1
      30: iconst_1
      31: isub
      32: istore_3
      33: iload_2
      34: iload_1
      35: iconst_1
      36: iadd
      37: if_icmpgt     53
      40: iload_3
      41: iload_2
      42: if_icmpgt     49
      45: iconst_1
      46: goto          54
      49: iconst_0
      50: goto          54
      53: iconst_0
      54: ifeq          62
      57: bipush        35
      59: goto          64
      62: bipush        46
      64: ireturn

  private static final java.lang.String day10part2$lambda$9(java.util.List);
    Code:
       0: aload_0
       1: ldc_w         #288                // String it
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: checkcast     #81                 // class java/lang/Iterable
      11: ldc_w         #290                // String
      14: checkcast     #277                // class java/lang/CharSequence
      17: aconst_null
      18: aconst_null
      19: iconst_0
      20: aconst_null
      21: aconst_null
      22: bipush        62
      24: aconst_null
      25: invokestatic  #293                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      28: areturn
}

Compiled from "day10.kt"
final class days.Day10Kt$parse$1 extends kotlin.coroutines.jvm.internal.RestrictedSuspendLambda implements kotlin.jvm.functions.Function2<kotlin.sequences.SequenceScope<? super kotlin.jvm.functions.Function1<? super kotlin.Pair<? extends java.lang.Integer, ? extends java.lang.Integer>, ? extends kotlin.Pair<? extends java.lang.Integer, ? extends java.lang.Integer>>>, kotlin.coroutines.Continuation<? super kotlin.Unit>, java.lang.Object> {
  int label;

  private java.lang.Object L$0;

  days.Day10Kt$parse$1(kotlin.coroutines.Continuation<? super days.Day10Kt$parse$1>);
    Code:
       0: aload_0
       1: iconst_2
       2: aload_1
       3: invokespecial #13                 // Method kotlin/coroutines/jvm/internal/RestrictedSuspendLambda."<init>":(ILkotlin/coroutines/Continuation;)V
       6: return

  public final java.lang.Object invokeSuspend(java.lang.Object);
    Code:
       0: invokestatic  #36                 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;
       3: astore_3
       4: aload_0
       5: getfield      #40                 // Field label:I
       8: tableswitch   { // 0 to 1
                     0: 32
                     1: 69
               default: 79
          }
      32: aload_1
      33: invokestatic  #46                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      36: aload_0
      37: getfield      #50                 // Field L$0:Ljava/lang/Object;
      40: checkcast     #52                 // class kotlin/sequences/SequenceScope
      43: astore_2
      44: aload_2
      45: invokedynamic #70,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      50: aload_0
      51: checkcast     #72                 // class kotlin/coroutines/Continuation
      54: aload_0
      55: iconst_1
      56: putfield      #40                 // Field label:I
      59: invokevirtual #76                 // Method kotlin/sequences/SequenceScope.yield:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      62: dup
      63: aload_3
      64: if_acmpne     74
      67: aload_3
      68: areturn
      69: aload_1
      70: invokestatic  #46                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
      73: aload_1
      74: pop
      75: getstatic     #82                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      78: areturn
      79: new           #84                 // class java/lang/IllegalStateException
      82: dup
      83: ldc           #86                 // String call to \'resume\' before \'invoke\' with coroutine
      85: invokespecial #89                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      88: athrow

  public final kotlin.coroutines.Continuation<kotlin.Unit> create(java.lang.Object, kotlin.coroutines.Continuation<?>);
    Code:
       0: new           #2                  // class days/Day10Kt$parse$1
       3: dup
       4: aload_2
       5: invokespecial #99                 // Method "<init>":(Lkotlin/coroutines/Continuation;)V
       8: astore_3
       9: aload_3
      10: aload_1
      11: putfield      #50                 // Field L$0:Ljava/lang/Object;
      14: aload_3
      15: checkcast     #72                 // class kotlin/coroutines/Continuation
      18: areturn

  public final java.lang.Object invoke(kotlin.sequences.SequenceScope<? super kotlin.jvm.functions.Function1<? super kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>>, kotlin.coroutines.Continuation<? super kotlin.Unit>);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokevirtual #104                // Method create:(Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Lkotlin/coroutines/Continuation;
       6: checkcast     #2                  // class days/Day10Kt$parse$1
       9: getstatic     #82                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      12: invokevirtual #106                // Method invokeSuspend:(Ljava/lang/Object;)Ljava/lang/Object;
      15: areturn

  private static final kotlin.Pair invokeSuspend$lambda$0(kotlin.Pair);
    Code:
       0: aload_0
       1: invokevirtual #113                // Method kotlin/Pair.component1:()Ljava/lang/Object;
       4: checkcast     #115                // class java/lang/Number
       7: invokevirtual #119                // Method java/lang/Number.intValue:()I
      10: istore_1
      11: aload_0
      12: invokevirtual #122                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      15: checkcast     #115                // class java/lang/Number
      18: invokevirtual #119                // Method java/lang/Number.intValue:()I
      21: istore_2
      22: iload_1
      23: iconst_1
      24: iadd
      25: invokestatic  #128                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      28: iload_2
      29: invokestatic  #128                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      32: invokestatic  #134                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      35: areturn

  public java.lang.Object invoke(java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #52                 // class kotlin/sequences/SequenceScope
       5: aload_2
       6: checkcast     #72                 // class kotlin/coroutines/Continuation
       9: invokevirtual #139                // Method invoke:(Lkotlin/sequences/SequenceScope;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
      12: areturn
}


package days

import java.nio.file.Files
import java.nio.file.Paths
import java.util.*

fun parseCrates(crates: String) = crates.split("\n").dropLast(1)
    .map { it.windowed(3,4) }
    .map { it.map { s -> s.trim(' ', '[', ']') } }
    .foldRight(mapOf<Int, Stack<String>>()) { line, cratesAcc ->
        line.foldIndexed(cratesAcc) { index, acc, crate ->
            if (crate.isNotBlank())
                acc.toMutableMap().let { map ->
                    map.getOrDefault(index + 1, Stack())
                        .also { it.push(crate) }
                        .also { map[index + 1] = it }
                    map.toMap()
                }
            else acc
        }
    }

fun parseMoves(moves: String) = moves.split("\n")
    .map { it.replace("move ", "").replace(" from ", " ").replace(" to ", " ") }
    .map { it.split(" ").map(String::toInt) }

fun Map<Int, Stack<String>>.move(quantity: Int, from: Int, to: Int) =
    this.toMutableMap().let { stacks ->
        repeat(quantity) {
            stacks[to]!!.push(stacks[from]!!.pop())
        }
        stacks.toMap()
    }

fun Map<Int, Stack<String>>.peekString() = this.entries.sortedBy { it.key }.joinToString("") { it.value.peek() }

fun day5part1() = Files.readString(Paths.get("input/05.txt")).split("\n\n")
    .let { parseCrates(it[0]) to parseMoves(it[1]) }
    .let { (crates, moves) -> moves.fold(crates) { acc, move -> acc.move(move[0], move[1], move[2]) } }
    .peekString()

fun Map<Int, Stack<String>>.move2(quantity: Int, from: Int, to: Int) =
    this.toMutableMap().let {
        (1..quantity)
            .fold(listOf<String>()) { acc, _ -> (acc + it[from]!!.pop()) }
            .reversed().forEach { crate -> it[to]!!.push(crate) }
        it.toMap()
    }

fun day5part2() = Files.readString(Paths.get("input/05.txt")).split("\n\n")
    .let { parseCrates(it[0]) to parseMoves(it[1]) }
    .let { (crates, moves) -> moves.fold(crates) { acc, move -> acc.move2(move[0], move[1], move[2]) } }
    .peekString()

Compiled from "Comparisons.kt"
public final class days.Day05Kt$peekString$$inlined$sortedBy$1<T> implements java.util.Comparator {
  public days.Day05Kt$peekString$$inlined$sortedBy$1();
    Code:
       0: aload_0
       1: invokespecial #16                 // Method java/lang/Object."<init>":()V
       4: return

  public final int compare(T, T);
    Code:
       0: aload_1
       1: checkcast     #23                 // class java/util/Map$Entry
       4: astore_3
       5: iconst_0
       6: istore        4
       8: aload_3
       9: invokeinterface #27,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      14: checkcast     #29                 // class java/lang/Integer
      17: checkcast     #31                 // class java/lang/Comparable
      20: aload_2
      21: checkcast     #23                 // class java/util/Map$Entry
      24: astore_3
      25: astore        5
      27: iconst_0
      28: istore        4
      30: aload_3
      31: invokeinterface #27,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      36: checkcast     #29                 // class java/lang/Integer
      39: aload         5
      41: swap
      42: checkcast     #31                 // class java/lang/Comparable
      45: invokestatic  #37                 // Method kotlin/comparisons/ComparisonsKt.compareValues:(Ljava/lang/Comparable;Ljava/lang/Comparable;)I
      48: ireturn
}

Compiled from "day05.kt"
public final class days.Day05Kt {
  public static final java.util.Map<java.lang.Integer, java.util.Stack<java.lang.String>> parseCrates(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #10                 // String crates
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #18                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #20                 // class java/lang/String
      14: astore_1
      15: aload_1
      16: iconst_0
      17: ldc           #22                 // String \n
      19: aastore
      20: aload_1
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #28                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: iconst_1
      30: invokestatic  #34                 // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;
      33: checkcast     #36                 // class java/lang/Iterable
      36: astore_1
      37: nop
      38: iconst_0
      39: istore_2
      40: aload_1
      41: astore_3
      42: new           #38                 // class java/util/ArrayList
      45: dup
      46: aload_1
      47: bipush        10
      49: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      52: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      55: checkcast     #48                 // class java/util/Collection
      58: astore        4
      60: iconst_0
      61: istore        5
      63: aload_3
      64: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      69: astore        6
      71: aload         6
      73: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      78: ifeq          129
      81: aload         6
      83: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: astore        7
      90: aload         4
      92: aload         7
      94: checkcast     #20                 // class java/lang/String
      97: astore        8
      99: astore        25
     101: iconst_0
     102: istore        9
     104: aload         8
     106: checkcast     #18                 // class java/lang/CharSequence
     109: iconst_3
     110: iconst_4
     111: iconst_0
     112: iconst_4
     113: aconst_null
     114: invokestatic  #66                 // Method kotlin/text/StringsKt.windowed$default:(Ljava/lang/CharSequence;IIZILjava/lang/Object;)Ljava/util/List;
     117: aload         25
     119: swap
     120: invokeinterface #70,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     125: pop
     126: goto          71
     129: aload         4
     131: checkcast     #72                 // class java/util/List
     134: nop
     135: checkcast     #36                 // class java/lang/Iterable
     138: astore_1
     139: nop
     140: iconst_0
     141: istore_2
     142: aload_1
     143: astore_3
     144: new           #38                 // class java/util/ArrayList
     147: dup
     148: aload_1
     149: bipush        10
     151: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     154: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     157: checkcast     #48                 // class java/util/Collection
     160: astore        4
     162: iconst_0
     163: istore        5
     165: aload_3
     166: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     171: astore        6
     173: aload         6
     175: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     180: ifeq          345
     183: aload         6
     185: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     190: astore        7
     192: aload         4
     194: aload         7
     196: checkcast     #72                 // class java/util/List
     199: astore        8
     201: astore        25
     203: iconst_0
     204: istore        9
     206: aload         8
     208: checkcast     #36                 // class java/lang/Iterable
     211: astore        10
     213: iconst_0
     214: istore        11
     216: aload         10
     218: astore        12
     220: new           #38                 // class java/util/ArrayList
     223: dup
     224: aload         10
     226: bipush        10
     228: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     231: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     234: checkcast     #48                 // class java/util/Collection
     237: astore        13
     239: iconst_0
     240: istore        14
     242: aload         12
     244: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     249: astore        15
     251: aload         15
     253: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     258: ifeq          326
     261: aload         15
     263: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     268: astore        16
     270: aload         13
     272: aload         16
     274: checkcast     #20                 // class java/lang/String
     277: astore        17
     279: astore        18
     281: iconst_0
     282: istore        19
     284: aload         17
     286: iconst_3
     287: newarray       char
     289: astore        20
     291: aload         20
     293: iconst_0
     294: bipush        32
     296: castore
     297: aload         20
     299: iconst_1
     300: bipush        91
     302: castore
     303: aload         20
     305: iconst_2
     306: bipush        93
     308: castore
     309: aload         20
     311: invokestatic  #76                 // Method kotlin/text/StringsKt.trim:(Ljava/lang/String;[C)Ljava/lang/String;
     314: aload         18
     316: swap
     317: invokeinterface #70,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     322: pop
     323: goto          251
     326: aload         13
     328: checkcast     #72                 // class java/util/List
     331: nop
     332: nop
     333: aload         25
     335: swap
     336: invokeinterface #70,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     341: pop
     342: goto          173
     345: aload         4
     347: checkcast     #72                 // class java/util/List
     350: nop
     351: astore_1
     352: invokestatic  #82                 // Method kotlin/collections/MapsKt.emptyMap:()Ljava/util/Map;
     355: astore_2
     356: nop
     357: iconst_0
     358: istore_3
     359: aload_2
     360: astore        4
     362: aload_1
     363: invokeinterface #85,  1           // InterfaceMethod java/util/List.isEmpty:()Z
     368: ifne          618
     371: aload_1
     372: aload_1
     373: invokeinterface #89,  1           // InterfaceMethod java/util/List.size:()I
     378: invokeinterface #93,  2           // InterfaceMethod java/util/List.listIterator:(I)Ljava/util/ListIterator;
     383: astore        5
     385: aload         5
     387: invokeinterface #98,  1           // InterfaceMethod java/util/ListIterator.hasPrevious:()Z
     392: ifeq          618
     395: aload         5
     397: invokeinterface #101,  1          // InterfaceMethod java/util/ListIterator.previous:()Ljava/lang/Object;
     402: aload         4
     404: astore        6
     406: checkcast     #72                 // class java/util/List
     409: astore        7
     411: iconst_0
     412: istore        8
     414: aload         7
     416: checkcast     #36                 // class java/lang/Iterable
     419: astore        9
     421: iconst_0
     422: istore        10
     424: iconst_0
     425: istore        11
     427: aload         6
     429: astore        12
     431: aload         9
     433: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     438: astore        13
     440: aload         13
     442: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     447: ifeq          610
     450: aload         13
     452: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     457: astore        14
     459: iload         11
     461: iinc          11, 1
     464: istore        15
     466: iload         15
     468: ifge          474
     471: invokestatic  #105                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     474: iload         15
     476: aload         12
     478: aload         14
     480: checkcast     #20                 // class java/lang/String
     483: astore        16
     485: astore        17
     487: istore        18
     489: iconst_0
     490: istore        19
     492: aload         16
     494: checkcast     #18                 // class java/lang/CharSequence
     497: invokestatic  #109                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     500: ifne          507
     503: iconst_1
     504: goto          508
     507: iconst_0
     508: ifeq          603
     511: aload         17
     513: invokestatic  #113                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
     516: astore        20
     518: iconst_0
     519: istore        21
     521: aload         20
     523: iload         18
     525: iconst_1
     526: iadd
     527: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     530: new           #121                // class java/util/Stack
     533: dup
     534: invokespecial #123                // Method java/util/Stack."<init>":()V
     537: invokeinterface #129,  3          // InterfaceMethod java/util/Map.getOrDefault:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     542: astore        22
     544: aload         22
     546: checkcast     #121                // class java/util/Stack
     549: astore        23
     551: iconst_0
     552: istore        24
     554: aload         23
     556: aload         16
     558: invokevirtual #133                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     561: pop
     562: aload         22
     564: astore        22
     566: aload         22
     568: checkcast     #121                // class java/util/Stack
     571: astore        23
     573: iconst_0
     574: istore        24
     576: aload         20
     578: iload         18
     580: iconst_1
     581: iadd
     582: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     585: aload         23
     587: invokeinterface #136,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     592: pop
     593: nop
     594: nop
     595: aload         20
     597: invokestatic  #139                // Method kotlin/collections/MapsKt.toMap:(Ljava/util/Map;)Ljava/util/Map;
     600: goto          605
     603: aload         17
     605: astore        12
     607: goto          440
     610: aload         12
     612: nop
     613: astore        4
     615: goto          385
     618: aload         4
     620: areturn

  public static final java.util.List<java.util.List<java.lang.Integer>> parseMoves(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #184                // String moves
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #18                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #20                 // class java/lang/String
      14: astore_1
      15: aload_1
      16: iconst_0
      17: ldc           #22                 // String \n
      19: aastore
      20: aload_1
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #28                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: checkcast     #36                 // class java/lang/Iterable
      32: astore_1
      33: nop
      34: iconst_0
      35: istore_2
      36: aload_1
      37: astore_3
      38: new           #38                 // class java/util/ArrayList
      41: dup
      42: aload_1
      43: bipush        10
      45: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      48: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
      51: checkcast     #48                 // class java/util/Collection
      54: astore        4
      56: iconst_0
      57: istore        5
      59: aload_3
      60: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      65: astore        6
      67: aload         6
      69: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      74: ifeq          144
      77: aload         6
      79: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      84: astore        7
      86: aload         4
      88: aload         7
      90: checkcast     #20                 // class java/lang/String
      93: astore        8
      95: astore        20
      97: iconst_0
      98: istore        9
     100: aload         8
     102: ldc           #186                // String move
     104: ldc           #188                // String
     106: iconst_0
     107: iconst_4
     108: aconst_null
     109: invokestatic  #192                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     112: ldc           #194                // String  from
     114: ldc           #196                // String
     116: iconst_0
     117: iconst_4
     118: aconst_null
     119: invokestatic  #192                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     122: ldc           #198                // String  to
     124: ldc           #196                // String
     126: iconst_0
     127: iconst_4
     128: aconst_null
     129: invokestatic  #192                // Method kotlin/text/StringsKt.replace$default:(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String;
     132: aload         20
     134: swap
     135: invokeinterface #70,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     140: pop
     141: goto          67
     144: aload         4
     146: checkcast     #72                 // class java/util/List
     149: nop
     150: checkcast     #36                 // class java/lang/Iterable
     153: astore_1
     154: nop
     155: iconst_0
     156: istore_2
     157: aload_1
     158: astore_3
     159: new           #38                 // class java/util/ArrayList
     162: dup
     163: aload_1
     164: bipush        10
     166: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     169: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     172: checkcast     #48                 // class java/util/Collection
     175: astore        4
     177: iconst_0
     178: istore        5
     180: aload_3
     181: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     186: astore        6
     188: aload         6
     190: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     195: ifeq          364
     198: aload         6
     200: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     205: astore        7
     207: aload         4
     209: aload         7
     211: checkcast     #20                 // class java/lang/String
     214: astore        8
     216: astore        20
     218: iconst_0
     219: istore        9
     221: aload         8
     223: checkcast     #18                 // class java/lang/CharSequence
     226: iconst_1
     227: anewarray     #20                 // class java/lang/String
     230: astore        10
     232: aload         10
     234: iconst_0
     235: ldc           #196                // String
     237: aastore
     238: aload         10
     240: iconst_0
     241: iconst_0
     242: bipush        6
     244: aconst_null
     245: invokestatic  #28                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     248: checkcast     #36                 // class java/lang/Iterable
     251: astore        10
     253: iconst_0
     254: istore        11
     256: aload         10
     258: astore        12
     260: new           #38                 // class java/util/ArrayList
     263: dup
     264: aload         10
     266: bipush        10
     268: invokestatic  #42                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     271: invokespecial #46                 // Method java/util/ArrayList."<init>":(I)V
     274: checkcast     #48                 // class java/util/Collection
     277: astore        13
     279: iconst_0
     280: istore        14
     282: aload         12
     284: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     289: astore        15
     291: aload         15
     293: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     298: ifeq          345
     301: aload         15
     303: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     308: astore        16
     310: aload         13
     312: aload         16
     314: checkcast     #20                 // class java/lang/String
     317: astore        17
     319: astore        18
     321: iconst_0
     322: istore        19
     324: aload         17
     326: invokestatic  #202                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     329: nop
     330: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     333: aload         18
     335: swap
     336: invokeinterface #70,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     341: pop
     342: goto          291
     345: aload         13
     347: checkcast     #72                 // class java/util/List
     350: nop
     351: nop
     352: aload         20
     354: swap
     355: invokeinterface #70,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     360: pop
     361: goto          188
     364: aload         4
     366: checkcast     #72                 // class java/util/List
     369: nop
     370: areturn

  public static final java.util.Map<java.lang.Integer, java.util.Stack<java.lang.String>> move(java.util.Map<java.lang.Integer, ? extends java.util.Stack<java.lang.String>>, int, int, int);
    Code:
       0: aload_0
       1: ldc           #211                // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #113                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
      10: astore        4
      12: iconst_0
      13: istore        5
      15: iconst_0
      16: istore        6
      18: iload         6
      20: iload_1
      21: if_icmpge     81
      24: iload         6
      26: istore        7
      28: iconst_0
      29: istore        8
      31: aload         4
      33: iload_3
      34: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      37: invokeinterface #214,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      42: dup
      43: invokestatic  #218                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      46: checkcast     #121                // class java/util/Stack
      49: aload         4
      51: iload_2
      52: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      55: invokeinterface #214,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      60: dup
      61: invokestatic  #218                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      64: checkcast     #121                // class java/util/Stack
      67: invokevirtual #221                // Method java/util/Stack.pop:()Ljava/lang/Object;
      70: invokevirtual #133                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
      73: pop
      74: nop
      75: iinc          6, 1
      78: goto          18
      81: aload         4
      83: invokestatic  #139                // Method kotlin/collections/MapsKt.toMap:(Ljava/util/Map;)Ljava/util/Map;
      86: nop
      87: areturn

  public static final java.lang.String peekString(java.util.Map<java.lang.Integer, ? extends java.util.Stack<java.lang.String>>);
    Code:
       0: aload_0
       1: ldc           #211                // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokeinterface #235,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      12: checkcast     #36                 // class java/lang/Iterable
      15: astore_1
      16: iconst_0
      17: istore_2
      18: aload_1
      19: new           #237                // class days/Day05Kt$peekString$$inlined$sortedBy$1
      22: dup
      23: invokespecial #238                // Method days/Day05Kt$peekString$$inlined$sortedBy$1."<init>":()V
      26: checkcast     #240                // class java/util/Comparator
      29: invokestatic  #244                // Method kotlin/collections/CollectionsKt.sortedWith:(Ljava/lang/Iterable;Ljava/util/Comparator;)Ljava/util/List;
      32: checkcast     #36                 // class java/lang/Iterable
      35: ldc           #188                // String
      37: checkcast     #18                 // class java/lang/CharSequence
      40: aconst_null
      41: aconst_null
      42: iconst_0
      43: aconst_null
      44: invokedynamic #262,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      49: bipush        30
      51: aconst_null
      52: invokestatic  #266                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      55: areturn

  public static final java.lang.String day5part1();
    Code:
       0: ldc_w         #273                // String input/05.txt
       3: iconst_0
       4: anewarray     #20                 // class java/lang/String
       7: invokestatic  #278                // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
      10: invokestatic  #284                // Method java/nio/file/Files.readString:(Ljava/nio/file/Path;)Ljava/lang/String;
      13: dup
      14: ldc_w         #286                // String readString(...)
      17: invokestatic  #289                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      20: checkcast     #18                 // class java/lang/CharSequence
      23: iconst_1
      24: anewarray     #20                 // class java/lang/String
      27: astore_0
      28: aload_0
      29: iconst_0
      30: ldc_w         #291                // String \n\n
      33: aastore
      34: aload_0
      35: iconst_0
      36: iconst_0
      37: bipush        6
      39: aconst_null
      40: invokestatic  #28                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      43: astore_1
      44: iconst_0
      45: istore_2
      46: aload_1
      47: iconst_0
      48: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      53: checkcast     #20                 // class java/lang/String
      56: invokestatic  #296                // Method parseCrates:(Ljava/lang/String;)Ljava/util/Map;
      59: aload_1
      60: iconst_1
      61: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      66: checkcast     #20                 // class java/lang/String
      69: invokestatic  #298                // Method parseMoves:(Ljava/lang/String;)Ljava/util/List;
      72: invokestatic  #303                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      75: nop
      76: astore_1
      77: iconst_0
      78: istore_2
      79: aload_1
      80: invokevirtual #308                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      83: checkcast     #125                // class java/util/Map
      86: astore_3
      87: aload_1
      88: invokevirtual #311                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      91: checkcast     #72                 // class java/util/List
      94: astore        4
      96: aload         4
      98: checkcast     #36                 // class java/lang/Iterable
     101: astore        5
     103: iconst_0
     104: istore        6
     106: aload_3
     107: astore        7
     109: aload         5
     111: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     116: astore        8
     118: aload         8
     120: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     125: ifeq          203
     128: aload         8
     130: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     135: astore        9
     137: aload         7
     139: aload         9
     141: checkcast     #72                 // class java/util/List
     144: astore        10
     146: astore        11
     148: iconst_0
     149: istore        12
     151: aload         11
     153: aload         10
     155: iconst_0
     156: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     161: checkcast     #313                // class java/lang/Number
     164: invokevirtual #316                // Method java/lang/Number.intValue:()I
     167: aload         10
     169: iconst_1
     170: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     175: checkcast     #313                // class java/lang/Number
     178: invokevirtual #316                // Method java/lang/Number.intValue:()I
     181: aload         10
     183: iconst_2
     184: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     189: checkcast     #313                // class java/lang/Number
     192: invokevirtual #316                // Method java/lang/Number.intValue:()I
     195: invokestatic  #318                // Method move:(Ljava/util/Map;III)Ljava/util/Map;
     198: astore        7
     200: goto          118
     203: aload         7
     205: nop
     206: nop
     207: invokestatic  #320                // Method peekString:(Ljava/util/Map;)Ljava/lang/String;
     210: areturn

  public static final java.util.Map<java.lang.Integer, java.util.Stack<java.lang.String>> move2(java.util.Map<java.lang.Integer, ? extends java.util.Stack<java.lang.String>>, int, int, int);
    Code:
       0: aload_0
       1: ldc           #211                // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #113                // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
      10: astore        4
      12: iconst_0
      13: istore        5
      15: new           #330                // class kotlin/ranges/IntRange
      18: dup
      19: iconst_1
      20: iload_1
      21: invokespecial #333                // Method kotlin/ranges/IntRange."<init>":(II)V
      24: checkcast     #36                 // class java/lang/Iterable
      27: astore        6
      29: invokestatic  #337                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      32: astore        7
      34: nop
      35: iconst_0
      36: istore        8
      38: aload         7
      40: astore        9
      42: aload         6
      44: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      49: astore        10
      51: aload         10
      53: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      58: ifeq          112
      61: aload         10
      63: checkcast     #339                // class kotlin/collections/IntIterator
      66: invokevirtual #342                // Method kotlin/collections/IntIterator.nextInt:()I
      69: istore        11
      71: aload         9
      73: astore        12
      75: iconst_0
      76: istore        13
      78: aload         12
      80: checkcast     #48                 // class java/util/Collection
      83: aload         4
      85: iload_2
      86: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      89: invokeinterface #214,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      94: dup
      95: invokestatic  #218                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      98: checkcast     #121                // class java/util/Stack
     101: invokevirtual #221                // Method java/util/Stack.pop:()Ljava/lang/Object;
     104: invokestatic  #346                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Object;)Ljava/util/List;
     107: astore        9
     109: goto          51
     112: aload         9
     114: checkcast     #36                 // class java/lang/Iterable
     117: invokestatic  #350                // Method kotlin/collections/CollectionsKt.reversed:(Ljava/lang/Iterable;)Ljava/util/List;
     120: checkcast     #36                 // class java/lang/Iterable
     123: astore        6
     125: iconst_0
     126: istore        7
     128: aload         6
     130: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     135: astore        8
     137: aload         8
     139: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     144: ifeq          194
     147: aload         8
     149: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     154: astore        9
     156: aload         9
     158: checkcast     #20                 // class java/lang/String
     161: astore        10
     163: iconst_0
     164: istore        11
     166: aload         4
     168: iload_3
     169: invokestatic  #119                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     172: invokeinterface #214,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     177: dup
     178: invokestatic  #218                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     181: checkcast     #121                // class java/util/Stack
     184: aload         10
     186: invokevirtual #133                // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     189: pop
     190: nop
     191: goto          137
     194: nop
     195: aload         4
     197: invokestatic  #139                // Method kotlin/collections/MapsKt.toMap:(Ljava/util/Map;)Ljava/util/Map;
     200: nop
     201: areturn

  public static final java.lang.String day5part2();
    Code:
       0: ldc_w         #273                // String input/05.txt
       3: iconst_0
       4: anewarray     #20                 // class java/lang/String
       7: invokestatic  #278                // Method java/nio/file/Paths.get:(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;
      10: invokestatic  #284                // Method java/nio/file/Files.readString:(Ljava/nio/file/Path;)Ljava/lang/String;
      13: dup
      14: ldc_w         #286                // String readString(...)
      17: invokestatic  #289                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      20: checkcast     #18                 // class java/lang/CharSequence
      23: iconst_1
      24: anewarray     #20                 // class java/lang/String
      27: astore_0
      28: aload_0
      29: iconst_0
      30: ldc_w         #291                // String \n\n
      33: aastore
      34: aload_0
      35: iconst_0
      36: iconst_0
      37: bipush        6
      39: aconst_null
      40: invokestatic  #28                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      43: astore_1
      44: iconst_0
      45: istore_2
      46: aload_1
      47: iconst_0
      48: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      53: checkcast     #20                 // class java/lang/String
      56: invokestatic  #296                // Method parseCrates:(Ljava/lang/String;)Ljava/util/Map;
      59: aload_1
      60: iconst_1
      61: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      66: checkcast     #20                 // class java/lang/String
      69: invokestatic  #298                // Method parseMoves:(Ljava/lang/String;)Ljava/util/List;
      72: invokestatic  #303                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      75: nop
      76: astore_1
      77: iconst_0
      78: istore_2
      79: aload_1
      80: invokevirtual #308                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      83: checkcast     #125                // class java/util/Map
      86: astore_3
      87: aload_1
      88: invokevirtual #311                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      91: checkcast     #72                 // class java/util/List
      94: astore        4
      96: aload         4
      98: checkcast     #36                 // class java/lang/Iterable
     101: astore        5
     103: iconst_0
     104: istore        6
     106: aload_3
     107: astore        7
     109: aload         5
     111: invokeinterface #52,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     116: astore        8
     118: aload         8
     120: invokeinterface #58,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     125: ifeq          203
     128: aload         8
     130: invokeinterface #62,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     135: astore        9
     137: aload         7
     139: aload         9
     141: checkcast     #72                 // class java/util/List
     144: astore        10
     146: astore        11
     148: iconst_0
     149: istore        12
     151: aload         11
     153: aload         10
     155: iconst_0
     156: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     161: checkcast     #313                // class java/lang/Number
     164: invokevirtual #316                // Method java/lang/Number.intValue:()I
     167: aload         10
     169: iconst_1
     170: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     175: checkcast     #313                // class java/lang/Number
     178: invokevirtual #316                // Method java/lang/Number.intValue:()I
     181: aload         10
     183: iconst_2
     184: invokeinterface #294,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     189: checkcast     #313                // class java/lang/Number
     192: invokevirtual #316                // Method java/lang/Number.intValue:()I
     195: invokestatic  #359                // Method move2:(Ljava/util/Map;III)Ljava/util/Map;
     198: astore        7
     200: goto          118
     203: aload         7
     205: nop
     206: nop
     207: invokestatic  #320                // Method peekString:(Ljava/util/Map;)Ljava/lang/String;
     210: areturn

  private static final java.lang.CharSequence peekString$lambda$13(java.util.Map$Entry);
    Code:
       0: aload_0
       1: ldc_w         #363                // String it
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokeinterface #368,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      13: checkcast     #121                // class java/util/Stack
      16: invokevirtual #371                // Method java/util/Stack.peek:()Ljava/lang/Object;
      19: dup
      20: ldc_w         #373                // String peek(...)
      23: invokestatic  #289                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      26: checkcast     #18                 // class java/lang/CharSequence
      29: areturn
}