package com.advent.of.code.hjk

object Day23 {

    private fun process(input: List<String>, initial: Map<String, Int>): Int {
        val copy = input.toMutableList()
        val registers = initial.toMutableMap()
        var i = 0
        while (i < copy.size) {
            val values = copy[i].split(" ")
            i++
            when (values[0]) {
                "cpy" -> values[2].takeIf { it in "abcd" }?.let { registers[it] = parseOrGet(values[1], registers) }
                "inc" -> registers.compute(values[1]) { _, v -> v!! + 1 }
                "dec" -> registers.compute(values[1]) { _, v -> v!! - 1 }
                "jnz" -> {
                    var value = parseOrGet(values[1], registers)
                    val offset = parseOrGet(values[2], registers)
                    if (value > 0) {
                        val current = i - 1
                        i = current + offset
                        if (values[1] in "abcd") {
                            val loopOffset =
                                copy.subList(i, current).indexOfFirst { it.matches("(inc|dec) ${values[1]}".toRegex()) }
                            if (loopOffset < 0) continue
                            val multiplier: Int
                            val loopIndex: Int
                            if (offset == -2) {
                                multiplier = 1
                                loopIndex = if (loopOffset == 0) i + 1 else i
                            } else {
                                val inner = copy.subList(i, i + loopOffset)
                                val innerLoopOffset = inner.indexOfFirst { it.matches("jnz.*-2".toRegex()) }
                                val key = copy[i + innerLoopOffset].split(" ")[1]
                                val from = inner.singleOrNull { it.matches("cpy . $key".toRegex()) } ?: continue
                                multiplier = value
                                value = registers.getValue(from.split(" ")[1])
                                val temp = copy.subList(i, i + innerLoopOffset)
                                    .indexOfFirst { it.matches("(inc|dec) $key".toRegex()) }
                                loopIndex = if (temp + 1 == innerLoopOffset) i + temp - 1 else i + temp
                            }
                            val (loopInstruction, loopVariable) = copy[loopIndex].split(" ")
                            if (loopInstruction == "inc") {
                                registers.compute(loopVariable) { _, v -> v!! + value * multiplier }
                                registers[values[1]] = 0
                            } else {
                                registers.compute(loopVariable) { _, v -> v!! - value * multiplier }
                                registers[values[1]] = 0
                            }
                            i = current + 1
                        }
                    }
                }
                "tgl" -> {
                    val target = i - 1 + parseOrGet(values[1], registers)
                    if (target < copy.size && target >= 0) {
                        val newInstruction = when (copy[target].count { it == ' ' }) {
                            1 -> if (copy[target].startsWith("inc")) "dec" else "inc"
                            2 -> if (copy[target].startsWith("jnz")) "cpy" else "jnz"
                            else -> values[0]
                        }
                        copy[target] = copy[target].replaceRange(0, 3, newInstruction)
                    }
                }
            }
        }
        return registers.getValue("a")
    }

    private fun parseOrGet(value: String, registers: Map<String, Int>) = try {
        value.toInt()
    } catch (e: NumberFormatException) {
        registers.getValue(value)
    }

    fun part1(input: List<String>) = process(input, mapOf("a" to 7, "b" to 0, "c" to 0, "d" to 0))

    fun part2(input: List<String>) = process(input, mapOf("a" to 12, "b" to 0, "c" to 0, "d" to 0))
}

Compiled from "Day23.kt"
public final class com.advent.of.code.hjk.Day23 {
  public static final com.advent.of.code.hjk.Day23 INSTANCE;

  private com.advent.of.code.hjk.Day23();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  private final int process(java.util.List<java.lang.String>, java.util.Map<java.lang.String, java.lang.Integer>);
    Code:
       0: aload_1
       1: checkcast     #15                 // class java/util/Collection
       4: invokestatic  #21                 // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
       7: astore_3
       8: aload_2
       9: invokestatic  #27                 // Method kotlin/collections/MapsKt.toMutableMap:(Ljava/util/Map;)Ljava/util/Map;
      12: astore        4
      14: iconst_0
      15: istore        5
      17: iload         5
      19: aload_3
      20: invokeinterface #33,  1           // InterfaceMethod java/util/List.size:()I
      25: if_icmpge     1540
      28: aload_3
      29: iload         5
      31: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      36: checkcast     #39                 // class java/lang/CharSequence
      39: iconst_1
      40: anewarray     #41                 // class java/lang/String
      43: astore        7
      45: aload         7
      47: iconst_0
      48: ldc           #43                 // String
      50: aastore
      51: aload         7
      53: iconst_0
      54: iconst_0
      55: bipush        6
      57: aconst_null
      58: invokestatic  #49                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      61: astore        6
      63: iinc          5, 1
      66: aload         6
      68: iconst_0
      69: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      74: checkcast     #41                 // class java/lang/String
      77: astore        7
      79: aload         7
      81: invokevirtual #52                 // Method java/lang/String.hashCode:()I
      84: lookupswitch  { // 5
                 98732: 175
                 99330: 136
                104414: 188
                105398: 149
                114777: 162
               default: 1537
          }
     136: aload         7
     138: ldc           #54                 // String dec
     140: invokevirtual #58                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     143: ifne          327
     146: goto          17
     149: aload         7
     151: ldc           #60                 // String jnz
     153: invokevirtual #58                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     156: ifne          356
     159: goto          17
     162: aload         7
     164: ldc           #62                 // String tgl
     166: invokevirtual #58                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     169: ifne          1273
     172: goto          17
     175: aload         7
     177: ldc           #64                 // String cpy
     179: invokevirtual #58                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     182: ifne          201
     185: goto          17
     188: aload         7
     190: ldc           #66                 // String inc
     192: invokevirtual #58                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     195: ifne          298
     198: goto          17
     201: aload         6
     203: iconst_2
     204: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     209: astore        9
     211: aload         9
     213: checkcast     #41                 // class java/lang/String
     216: astore        10
     218: iconst_0
     219: istore        11
     221: ldc           #68                 // String abcd
     223: checkcast     #39                 // class java/lang/CharSequence
     226: aload         10
     228: checkcast     #39                 // class java/lang/CharSequence
     231: iconst_0
     232: iconst_2
     233: aconst_null
     234: invokestatic  #72                 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
     237: ifeq          245
     240: aload         9
     242: goto          246
     245: aconst_null
     246: checkcast     #41                 // class java/lang/String
     249: dup
     250: ifnull        294
     253: astore        10
     255: iconst_0
     256: istore        11
     258: aload         4
     260: aload         10
     262: getstatic     #75                 // Field INSTANCE:Lcom/advent/of/code/hjk/Day23;
     265: aload         6
     267: iconst_1
     268: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     273: checkcast     #41                 // class java/lang/String
     276: aload         4
     278: invokespecial #79                 // Method parseOrGet:(Ljava/lang/String;Ljava/util/Map;)I
     281: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     284: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     289: pop
     290: nop
     291: goto          17
     294: pop
     295: goto          17
     298: aload         4
     300: aload         6
     302: iconst_1
     303: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     308: invokedynamic #109,  0            // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
     313: invokedynamic #120,  0            // InvokeDynamic #1:apply:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiFunction;
     318: invokeinterface #124,  3          // InterfaceMethod java/util/Map.compute:(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
     323: pop
     324: goto          17
     327: aload         4
     329: aload         6
     331: iconst_1
     332: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     337: invokedynamic #129,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;
     342: invokedynamic #134,  0            // InvokeDynamic #3:apply:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiFunction;
     347: invokeinterface #124,  3          // InterfaceMethod java/util/Map.compute:(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
     352: pop
     353: goto          17
     356: new           #136                // class kotlin/jvm/internal/Ref$IntRef
     359: dup
     360: invokespecial #137                // Method kotlin/jvm/internal/Ref$IntRef."<init>":()V
     363: astore        8
     365: aload         8
     367: aload_0
     368: aload         6
     370: iconst_1
     371: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     376: checkcast     #41                 // class java/lang/String
     379: aload         4
     381: invokespecial #79                 // Method parseOrGet:(Ljava/lang/String;Ljava/util/Map;)I
     384: putfield      #141                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     387: aload_0
     388: aload         6
     390: iconst_2
     391: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     396: checkcast     #41                 // class java/lang/String
     399: aload         4
     401: invokespecial #79                 // Method parseOrGet:(Ljava/lang/String;Ljava/util/Map;)I
     404: istore        9
     406: aload         8
     408: getfield      #141                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     411: ifle          17
     414: iload         5
     416: iconst_1
     417: isub
     418: istore        10
     420: iload         10
     422: iload         9
     424: iadd
     425: istore        5
     427: ldc           #68                 // String abcd
     429: checkcast     #39                 // class java/lang/CharSequence
     432: aload         6
     434: iconst_1
     435: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     440: checkcast     #39                 // class java/lang/CharSequence
     443: iconst_0
     444: iconst_2
     445: aconst_null
     446: invokestatic  #72                 // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
     449: ifeq          17
     452: aload_3
     453: iload         5
     455: iload         10
     457: invokeinterface #145,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     462: astore        12
     464: iconst_0
     465: istore        13
     467: iconst_0
     468: istore        14
     470: aload         12
     472: invokeinterface #149,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     477: astore        15
     479: aload         15
     481: invokeinterface #155,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     486: ifeq          571
     489: aload         15
     491: invokeinterface #159,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     496: astore        16
     498: aload         16
     500: checkcast     #41                 // class java/lang/String
     503: astore        17
     505: iconst_0
     506: istore        18
     508: aload         17
     510: checkcast     #39                 // class java/lang/CharSequence
     513: astore        19
     515: new           #161                // class kotlin/text/Regex
     518: dup
     519: new           #163                // class java/lang/StringBuilder
     522: dup
     523: invokespecial #164                // Method java/lang/StringBuilder."<init>":()V
     526: ldc           #166                // String (inc|dec)
     528: invokevirtual #170                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     531: aload         6
     533: iconst_1
     534: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     539: checkcast     #41                 // class java/lang/String
     542: invokevirtual #170                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     545: invokevirtual #174                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     548: invokespecial #177                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     551: aload         19
     553: invokevirtual #181                // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z
     556: nop
     557: ifeq          565
     560: iload         14
     562: goto          572
     565: iinc          14, 1
     568: goto          479
     571: iconst_m1
     572: istore        11
     574: iload         11
     576: iflt          17
     579: iconst_0
     580: istore        12
     582: iconst_0
     583: istore        13
     585: iload         9
     587: bipush        -2
     589: if_icmpne     614
     592: iconst_1
     593: istore        12
     595: iload         11
     597: ifne          607
     600: iload         5
     602: iconst_1
     603: iadd
     604: goto          609
     607: iload         5
     609: istore        13
     611: goto          1102
     614: aload_3
     615: iload         5
     617: iload         5
     619: iload         11
     621: iadd
     622: invokeinterface #145,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     627: astore        14
     629: aload         14
     631: astore        16
     633: iconst_0
     634: istore        17
     636: iconst_0
     637: istore        18
     639: aload         16
     641: invokeinterface #149,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     646: astore        19
     648: aload         19
     650: invokeinterface #155,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     655: ifeq          713
     658: aload         19
     660: invokeinterface #159,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     665: astore        20
     667: aload         20
     669: checkcast     #41                 // class java/lang/String
     672: astore        21
     674: iconst_0
     675: istore        22
     677: aload         21
     679: checkcast     #39                 // class java/lang/CharSequence
     682: astore        23
     684: new           #161                // class kotlin/text/Regex
     687: dup
     688: ldc           #183                // String jnz.*-2
     690: invokespecial #177                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     693: aload         23
     695: invokevirtual #181                // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z
     698: nop
     699: ifeq          707
     702: iload         18
     704: goto          714
     707: iinc          18, 1
     710: goto          648
     713: iconst_m1
     714: istore        15
     716: aload_3
     717: iload         5
     719: iload         15
     721: iadd
     722: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     727: checkcast     #39                 // class java/lang/CharSequence
     730: iconst_1
     731: anewarray     #41                 // class java/lang/String
     734: astore        17
     736: aload         17
     738: iconst_0
     739: ldc           #43                 // String
     741: aastore
     742: aload         17
     744: iconst_0
     745: iconst_0
     746: bipush        6
     748: aconst_null
     749: invokestatic  #49                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     752: iconst_1
     753: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     758: checkcast     #41                 // class java/lang/String
     761: astore        16
     763: aload         14
     765: checkcast     #185                // class java/lang/Iterable
     768: astore        19
     770: iconst_0
     771: istore        20
     773: aconst_null
     774: astore        21
     776: iconst_0
     777: istore        22
     779: aload         19
     781: invokeinterface #186,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     786: astore        23
     788: aload         23
     790: invokeinterface #155,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     795: ifeq          879
     798: aload         23
     800: invokeinterface #159,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     805: astore        24
     807: aload         24
     809: checkcast     #41                 // class java/lang/String
     812: astore        25
     814: iconst_0
     815: istore        26
     817: aload         25
     819: checkcast     #39                 // class java/lang/CharSequence
     822: astore        27
     824: new           #161                // class kotlin/text/Regex
     827: dup
     828: new           #163                // class java/lang/StringBuilder
     831: dup
     832: invokespecial #164                // Method java/lang/StringBuilder."<init>":()V
     835: ldc           #188                // String cpy .
     837: invokevirtual #170                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     840: aload         16
     842: invokevirtual #170                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     845: invokevirtual #174                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     848: invokespecial #177                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
     851: aload         27
     853: invokevirtual #181                // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z
     856: nop
     857: ifeq          788
     860: iload         22
     862: ifeq          869
     865: aconst_null
     866: goto          890
     869: aload         24
     871: astore        21
     873: iconst_1
     874: istore        22
     876: goto          788
     879: iload         22
     881: ifne          888
     884: aconst_null
     885: goto          890
     888: aload         21
     890: checkcast     #41                 // class java/lang/String
     893: dup
     894: ifnonnull     901
     897: pop
     898: goto          17
     901: astore        17
     903: aload         8
     905: getfield      #141                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     908: istore        12
     910: aload         8
     912: aload         4
     914: aload         17
     916: checkcast     #39                 // class java/lang/CharSequence
     919: iconst_1
     920: anewarray     #41                 // class java/lang/String
     923: astore        18
     925: aload         18
     927: iconst_0
     928: ldc           #43                 // String
     930: aastore
     931: aload         18
     933: iconst_0
     934: iconst_0
     935: bipush        6
     937: aconst_null
     938: invokestatic  #49                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     941: iconst_1
     942: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     947: invokestatic  #192                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
     950: checkcast     #194                // class java/lang/Number
     953: invokevirtual #197                // Method java/lang/Number.intValue:()I
     956: putfield      #141                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     959: aload_3
     960: iload         5
     962: iload         5
     964: iload         15
     966: iadd
     967: invokeinterface #145,  3          // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     972: astore        19
     974: nop
     975: iconst_0
     976: istore        20
     978: iconst_0
     979: istore        21
     981: aload         19
     983: invokeinterface #149,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     988: astore        22
     990: aload         22
     992: invokeinterface #155,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     997: ifeq          1073
    1000: aload         22
    1002: invokeinterface #159,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1007: astore        23
    1009: aload         23
    1011: checkcast     #41                 // class java/lang/String
    1014: astore        24
    1016: iconst_0
    1017: istore        25
    1019: aload         24
    1021: checkcast     #39                 // class java/lang/CharSequence
    1024: astore        26
    1026: new           #161                // class kotlin/text/Regex
    1029: dup
    1030: new           #163                // class java/lang/StringBuilder
    1033: dup
    1034: invokespecial #164                // Method java/lang/StringBuilder."<init>":()V
    1037: ldc           #166                // String (inc|dec)
    1039: invokevirtual #170                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1042: aload         16
    1044: invokevirtual #170                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
    1047: invokevirtual #174                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
    1050: invokespecial #177                // Method kotlin/text/Regex."<init>":(Ljava/lang/String;)V
    1053: aload         26
    1055: invokevirtual #181                // Method kotlin/text/Regex.matches:(Ljava/lang/CharSequence;)Z
    1058: nop
    1059: ifeq          1067
    1062: iload         21
    1064: goto          1074
    1067: iinc          21, 1
    1070: goto          990
    1073: iconst_m1
    1074: istore        18
    1076: iload         18
    1078: iconst_1
    1079: iadd
    1080: iload         15
    1082: if_icmpne     1095
    1085: iload         5
    1087: iload         18
    1089: iadd
    1090: iconst_1
    1091: isub
    1092: goto          1100
    1095: iload         5
    1097: iload         18
    1099: iadd
    1100: istore        13
    1102: aload_3
    1103: iload         13
    1105: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1110: checkcast     #39                 // class java/lang/CharSequence
    1113: iconst_1
    1114: anewarray     #41                 // class java/lang/String
    1117: astore        15
    1119: aload         15
    1121: iconst_0
    1122: ldc           #43                 // String
    1124: aastore
    1125: aload         15
    1127: iconst_0
    1128: iconst_0
    1129: bipush        6
    1131: aconst_null
    1132: invokestatic  #49                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
    1135: astore        14
    1137: aload         14
    1139: iconst_0
    1140: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1145: checkcast     #41                 // class java/lang/String
    1148: astore        15
    1150: aload         14
    1152: iconst_1
    1153: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1158: checkcast     #41                 // class java/lang/String
    1161: astore        16
    1163: aload         15
    1165: ldc           #66                 // String inc
    1167: invokestatic  #203                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
    1170: ifeq          1220
    1173: aload         4
    1175: aload         16
    1177: aload         8
    1179: iload         12
    1181: invokedynamic #211,  0            // InvokeDynamic #4:invoke:(Lkotlin/jvm/internal/Ref$IntRef;I)Lkotlin/jvm/functions/Function2;
    1186: invokedynamic #216,  0            // InvokeDynamic #5:apply:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiFunction;
    1191: invokeinterface #124,  3          // InterfaceMethod java/util/Map.compute:(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
    1196: pop
    1197: aload         4
    1199: aload         6
    1201: iconst_1
    1202: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1207: iconst_0
    1208: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1211: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1216: pop
    1217: goto          1264
    1220: aload         4
    1222: aload         16
    1224: aload         8
    1226: iload         12
    1228: invokedynamic #221,  0            // InvokeDynamic #6:invoke:(Lkotlin/jvm/internal/Ref$IntRef;I)Lkotlin/jvm/functions/Function2;
    1233: invokedynamic #226,  0            // InvokeDynamic #7:apply:(Lkotlin/jvm/functions/Function2;)Ljava/util/function/BiFunction;
    1238: invokeinterface #124,  3          // InterfaceMethod java/util/Map.compute:(Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object;
    1243: pop
    1244: aload         4
    1246: aload         6
    1248: iconst_1
    1249: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1254: iconst_0
    1255: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1258: invokeinterface #91,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1263: pop
    1264: iload         10
    1266: iconst_1
    1267: iadd
    1268: istore        5
    1270: goto          17
    1273: iload         5
    1275: iconst_1
    1276: isub
    1277: aload_0
    1278: aload         6
    1280: iconst_1
    1281: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1286: checkcast     #41                 // class java/lang/String
    1289: aload         4
    1291: invokespecial #79                 // Method parseOrGet:(Ljava/lang/String;Ljava/util/Map;)I
    1294: iadd
    1295: istore        8
    1297: iload         8
    1299: aload_3
    1300: invokeinterface #33,  1           // InterfaceMethod java/util/List.size:()I
    1305: if_icmpge     17
    1308: iload         8
    1310: iflt          17
    1313: aload_3
    1314: iload         8
    1316: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1321: checkcast     #39                 // class java/lang/CharSequence
    1324: astore        11
    1326: iconst_0
    1327: istore        12
    1329: iconst_0
    1330: istore        13
    1332: iconst_0
    1333: istore        14
    1335: iload         14
    1337: aload         11
    1339: invokeinterface #229,  1          // InterfaceMethod java/lang/CharSequence.length:()I
    1344: if_icmpge     1389
    1347: aload         11
    1349: iload         14
    1351: invokeinterface #233,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
    1356: istore        15
    1358: iload         15
    1360: istore        16
    1362: iconst_0
    1363: istore        17
    1365: iload         16
    1367: bipush        32
    1369: if_icmpne     1376
    1372: iconst_1
    1373: goto          1377
    1376: iconst_0
    1377: ifeq          1383
    1380: iinc          13, 1
    1383: iinc          14, 1
    1386: goto          1335
    1389: iload         13
    1391: tableswitch   { // 1 to 2
                     1: 1412
                     2: 1444
               default: 1476
          }
    1412: aload_3
    1413: iload         8
    1415: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1420: checkcast     #41                 // class java/lang/String
    1423: ldc           #66                 // String inc
    1425: iconst_0
    1426: iconst_2
    1427: aconst_null
    1428: invokestatic  #237                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
    1431: ifeq          1439
    1434: ldc           #54                 // String dec
    1436: goto          1487
    1439: ldc           #66                 // String inc
    1441: goto          1487
    1444: aload_3
    1445: iload         8
    1447: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1452: checkcast     #41                 // class java/lang/String
    1455: ldc           #60                 // String jnz
    1457: iconst_0
    1458: iconst_2
    1459: aconst_null
    1460: invokestatic  #237                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Z
    1463: ifeq          1471
    1466: ldc           #64                 // String cpy
    1468: goto          1487
    1471: ldc           #60                 // String jnz
    1473: goto          1487
    1476: aload         6
    1478: iconst_0
    1479: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1484: checkcast     #41                 // class java/lang/String
    1487: astore        9
    1489: aload_3
    1490: iload         8
    1492: aload_3
    1493: iload         8
    1495: invokeinterface #37,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
    1500: checkcast     #41                 // class java/lang/String
    1503: astore        10
    1505: iconst_0
    1506: istore        11
    1508: iconst_3
    1509: istore        12
    1511: aload         10
    1513: checkcast     #39                 // class java/lang/CharSequence
    1516: iload         11
    1518: iload         12
    1520: aload         9
    1522: checkcast     #39                 // class java/lang/CharSequence
    1525: invokestatic  #241                // Method kotlin/text/StringsKt.replaceRange:(Ljava/lang/CharSequence;IILjava/lang/CharSequence;)Ljava/lang/CharSequence;
    1528: invokevirtual #242                // Method java/lang/Object.toString:()Ljava/lang/String;
    1531: invokeinterface #246,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
    1536: pop
    1537: goto          17
    1540: aload         4
    1542: ldc           #248                // String a
    1544: invokestatic  #192                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
    1547: checkcast     #194                // class java/lang/Number
    1550: invokevirtual #197                // Method java/lang/Number.intValue:()I
    1553: ireturn

  private final int parseOrGet(java.lang.String, java.util.Map<java.lang.String, java.lang.Integer>);
    Code:
       0: nop
       1: aload_1
       2: invokestatic  #307                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
       5: istore_3
       6: goto          23
       9: astore        4
      11: aload_2
      12: aload_1
      13: invokestatic  #192                // Method kotlin/collections/MapsKt.getValue:(Ljava/util/Map;Ljava/lang/Object;)Ljava/lang/Object;
      16: checkcast     #194                // class java/lang/Number
      19: invokevirtual #197                // Method java/lang/Number.intValue:()I
      22: istore_3
      23: iload_3
      24: ireturn
    Exception table:
       from    to  target type
           0     6     9   Class java/lang/NumberFormatException

  public final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc_w         #314                // String input
       4: invokestatic  #318                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: aload_1
       9: iconst_4
      10: anewarray     #320                // class kotlin/Pair
      13: astore_2
      14: aload_2
      15: iconst_0
      16: ldc           #248                // String a
      18: bipush        7
      20: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      23: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      26: aastore
      27: aload_2
      28: iconst_1
      29: ldc_w         #328                // String b
      32: iconst_0
      33: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      36: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      39: aastore
      40: aload_2
      41: iconst_2
      42: ldc_w         #330                // String c
      45: iconst_0
      46: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      49: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      52: aastore
      53: aload_2
      54: iconst_3
      55: ldc_w         #332                // String d
      58: iconst_0
      59: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      62: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      65: aastore
      66: aload_2
      67: invokestatic  #336                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
      70: invokespecial #338                // Method process:(Ljava/util/List;Ljava/util/Map;)I
      73: ireturn

  public final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc_w         #314                // String input
       4: invokestatic  #318                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: aload_1
       9: iconst_4
      10: anewarray     #320                // class kotlin/Pair
      13: astore_2
      14: aload_2
      15: iconst_0
      16: ldc           #248                // String a
      18: bipush        12
      20: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      23: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      26: aastore
      27: aload_2
      28: iconst_1
      29: ldc_w         #328                // String b
      32: iconst_0
      33: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      36: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      39: aastore
      40: aload_2
      41: iconst_2
      42: ldc_w         #330                // String c
      45: iconst_0
      46: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      49: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      52: aastore
      53: aload_2
      54: iconst_3
      55: ldc_w         #332                // String d
      58: iconst_0
      59: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      62: invokestatic  #326                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      65: aastore
      66: aload_2
      67: invokestatic  #336                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
      70: invokespecial #338                // Method process:(Ljava/util/List;Ljava/util/Map;)I
      73: ireturn

  private static final java.lang.Integer process$lambda$2(java.lang.String, java.lang.Integer);
    Code:
       0: aload_0
       1: ldc_w         #341                // String <unused var>
       4: invokestatic  #318                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: dup
       9: invokestatic  #345                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      12: invokevirtual #346                // Method java/lang/Integer.intValue:()I
      15: iconst_1
      16: iadd
      17: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      20: areturn

  private static final java.lang.Integer process$lambda$3(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #352,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #81                 // class java/lang/Integer
      11: areturn

  private static final java.lang.Integer process$lambda$4(java.lang.String, java.lang.Integer);
    Code:
       0: aload_0
       1: ldc_w         #341                // String <unused var>
       4: invokestatic  #318                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: dup
       9: invokestatic  #345                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      12: invokevirtual #346                // Method java/lang/Integer.intValue:()I
      15: iconst_1
      16: isub
      17: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      20: areturn

  private static final java.lang.Integer process$lambda$5(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #352,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #81                 // class java/lang/Integer
      11: areturn

  private static final java.lang.Integer process$lambda$10(kotlin.jvm.internal.Ref$IntRef, int, java.lang.String, java.lang.Integer);
    Code:
       0: aload_2
       1: ldc_w         #341                // String <unused var>
       4: invokestatic  #318                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_3
       8: dup
       9: invokestatic  #345                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      12: invokevirtual #346                // Method java/lang/Integer.intValue:()I
      15: aload_0
      16: getfield      #141                // Field kotlin/jvm/internal/Ref$IntRef.element:I
      19: iload_1
      20: imul
      21: iadd
      22: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: areturn

  private static final java.lang.Integer process$lambda$11(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #352,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #81                 // class java/lang/Integer
      11: areturn

  private static final java.lang.Integer process$lambda$12(kotlin.jvm.internal.Ref$IntRef, int, java.lang.String, java.lang.Integer);
    Code:
       0: aload_2
       1: ldc_w         #341                // String <unused var>
       4: invokestatic  #318                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_3
       8: dup
       9: invokestatic  #345                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      12: invokevirtual #346                // Method java/lang/Integer.intValue:()I
      15: aload_0
      16: getfield      #141                // Field kotlin/jvm/internal/Ref$IntRef.element:I
      19: iload_1
      20: imul
      21: isub
      22: invokestatic  #85                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: areturn

  private static final java.lang.Integer process$lambda$13(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #352,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #81                 // class java/lang/Integer
      11: areturn

  static {};
    Code:
       0: new           #2                  // class com/advent/of/code/hjk/Day23
       3: dup
       4: invokespecial #360                // Method "<init>":()V
       7: putstatic     #75                 // Field INSTANCE:Lcom/advent/of/code/hjk/Day23;
      10: return
}