package com.github.brpeterman.advent2022

class RopeSnake {
    data class Coords(val row: Int, val column: Int) {
        operator fun plus(other: Coords): Coords {
            return Coords(row + other.row, column + other.column)
        }
    }
    enum class Direction(val offset: Coords) {
        UP(Coords(-1, 0)),
        DOWN(Coords(1, 0)),
        LEFT(Coords(0, -1)),
        RIGHT(Coords(0, 1))
    }

    fun simulateAndCount(steps: List<Pair<Direction, Int>>, tailCount: Int = 1): Int {
        val visited = mutableSetOf(Coords(0, 0))
        var head = Coords(0, 0)
        val tails = (1..tailCount).fold(ArrayList<Coords>()) { list, _ ->
            list.add(Coords(0, 0))
            list
        }
        steps.forEach { (direction, count) ->
            (1..count).forEach {
                head = head + direction.offset
                tails.withIndex().forEach { (index, tail) ->
                    val leader = if (index == 0) {
                        head
                    } else {
                        tails[index - 1]
                    }
                    if (!isAdjacent(tail, leader)) {
                        val newTail = moveTo(tail, leader)
                        tails[index] = newTail
                        if (index == tailCount - 1) {
                            visited.add(newTail)
                        }
                    }
                }
            }
        }
        return visited.size
    }

    fun isAdjacent(tail: Coords, head: Coords): Boolean {
        return listOf(Coords(0, 0),
            Direction.UP.offset, Direction.DOWN.offset,
            Direction.LEFT.offset, Direction.RIGHT.offset,
            Direction.UP.offset + Direction.LEFT.offset,
            Direction.UP.offset + Direction.RIGHT.offset,
            Direction.DOWN.offset + Direction.LEFT.offset,
            Direction.DOWN.offset + Direction.RIGHT.offset)
            .any { head + it == tail }
    }

    fun moveTo(tail: Coords, head: Coords): Coords {
        val rowOffset = if (tail.row == head.row) {
            0
        } else {
            (head.row - tail.row) / Math.abs(head.row - tail.row)
        }
        val colOffset = if (tail.column == head.column) {
            0
        } else {
            (head.column - tail.column) / Math.abs(head.column - tail.column)
        }
        return Coords(tail.row + rowOffset, tail.column + colOffset)
    }

    companion object {
        fun parseInput(input: String): List<Pair<Direction, Int>> {
            return input.split("\n")
                .filter { it.isNotBlank() }
                .map { line ->
                    val (dir, count) = line.split(" ")
                    val direction = when (dir) {
                        "U" -> Direction.UP
                        "D" -> Direction.DOWN
                        "L" -> Direction.LEFT
                        "R" -> Direction.RIGHT
                        else -> throw IllegalStateException("Unexpected direction: ${dir}")
                    }
                    Pair(direction, count.toInt())
                }
        }
    }
}

Compiled from "RopeSnake.kt"
public final class com.github.brpeterman.advent2022.RopeSnake$Coords {
  private final int row;

  private final int column;

  public com.github.brpeterman.advent2022.RopeSnake$Coords(int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field row:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field column:I
      14: return

  public final int getRow();
    Code:
       0: aload_0
       1: getfield      #13                 // Field row:I
       4: ireturn

  public final int getColumn();
    Code:
       0: aload_0
       1: getfield      #16                 // Field column:I
       4: ireturn

  public final com.github.brpeterman.advent2022.RopeSnake$Coords plus(com.github.brpeterman.advent2022.RopeSnake$Coords);
    Code:
       0: aload_1
       1: ldc           #26                 // String other
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Coords
       9: dup
      10: aload_0
      11: getfield      #13                 // Field row:I
      14: aload_1
      15: getfield      #13                 // Field row:I
      18: iadd
      19: aload_0
      20: getfield      #16                 // Field column:I
      23: aload_1
      24: getfield      #16                 // Field column:I
      27: iadd
      28: invokespecial #34                 // Method "<init>":(II)V
      31: areturn

  public final int component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field row:I
       4: ireturn

  public final int component2();
    Code:
       0: aload_0
       1: getfield      #16                 // Field column:I
       4: ireturn

  public final com.github.brpeterman.advent2022.RopeSnake$Coords copy(int, int);
    Code:
       0: new           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Coords
       3: dup
       4: iload_1
       5: iload_2
       6: invokespecial #34                 // Method "<init>":(II)V
       9: areturn

  public static com.github.brpeterman.advent2022.RopeSnake$Coords copy$default(com.github.brpeterman.advent2022.RopeSnake$Coords, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #13                 // Field row:I
      10: istore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #16                 // Field column:I
      21: istore_2
      22: aload_0
      23: iload_1
      24: iload_2
      25: invokevirtual #42                 // Method copy:(II)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #46                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #47                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #49                 // String Coords(row=
       9: invokevirtual #53                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field row:I
      16: invokevirtual #56                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #58                 // String , column=
      21: invokevirtual #53                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field column:I
      28: invokevirtual #56                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #61                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #63                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field row:I
       4: invokestatic  #69                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field column:I
      16: invokestatic  #69                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class com/github/brpeterman/advent2022/RopeSnake$Coords
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/github/brpeterman/advent2022/RopeSnake$Coords
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field row:I
      25: aload_2
      26: getfield      #13                 // Field row:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field column:I
      38: aload_2
      39: getfield      #16                 // Field column:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: iconst_1
      48: ireturn
}

Compiled from "RopeSnake.kt"
public final class com.github.brpeterman.advent2022.RopeSnake$Companion {
  private com.github.brpeterman.advent2022.RopeSnake$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.util.List<kotlin.Pair<com.github.brpeterman.advent2022.RopeSnake$Direction, java.lang.Integer>> parseInput(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #26                 // class java/lang/String
      14: astore_2
      15: aload_2
      16: iconst_0
      17: ldc           #28                 // String \n
      19: aastore
      20: aload_2
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #34                 // 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_2
      33: nop
      34: iconst_0
      35: istore_3
      36: aload_2
      37: astore        4
      39: new           #38                 // class java/util/ArrayList
      42: dup
      43: invokespecial #39                 // Method java/util/ArrayList."<init>":()V
      46: checkcast     #41                 // class java/util/Collection
      49: astore        5
      51: iconst_0
      52: istore        6
      54: aload         4
      56: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      61: astore        7
      63: aload         7
      65: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      70: ifeq          125
      73: aload         7
      75: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      80: astore        8
      82: aload         8
      84: checkcast     #26                 // class java/lang/String
      87: astore        9
      89: iconst_0
      90: istore        10
      92: aload         9
      94: checkcast     #24                 // class java/lang/CharSequence
      97: invokestatic  #59                 // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     100: ifne          107
     103: iconst_1
     104: goto          108
     107: iconst_0
     108: nop
     109: ifeq          63
     112: aload         5
     114: aload         8
     116: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     121: pop
     122: goto          63
     125: aload         5
     127: checkcast     #65                 // class java/util/List
     130: nop
     131: checkcast     #36                 // class java/lang/Iterable
     134: astore_2
     135: nop
     136: iconst_0
     137: istore_3
     138: aload_2
     139: astore        4
     141: new           #38                 // class java/util/ArrayList
     144: dup
     145: aload_2
     146: bipush        10
     148: invokestatic  #71                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     151: invokespecial #74                 // Method java/util/ArrayList."<init>":(I)V
     154: checkcast     #41                 // class java/util/Collection
     157: astore        5
     159: iconst_0
     160: istore        6
     162: aload         4
     164: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     169: astore        7
     171: aload         7
     173: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     178: ifeq          447
     181: aload         7
     183: invokeinterface #55,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     188: astore        8
     190: aload         5
     192: aload         8
     194: checkcast     #26                 // class java/lang/String
     197: astore        9
     199: astore        16
     201: iconst_0
     202: istore        10
     204: aload         9
     206: checkcast     #24                 // class java/lang/CharSequence
     209: iconst_1
     210: anewarray     #26                 // class java/lang/String
     213: astore        11
     215: aload         11
     217: iconst_0
     218: ldc           #76                 // String
     220: aastore
     221: aload         11
     223: iconst_0
     224: iconst_0
     225: bipush        6
     227: aconst_null
     228: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     231: astore        12
     233: aload         12
     235: iconst_0
     236: invokeinterface #80,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     241: checkcast     #26                 // class java/lang/String
     244: astore        11
     246: aload         12
     248: iconst_1
     249: invokeinterface #80,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     254: checkcast     #26                 // class java/lang/String
     257: astore        13
     259: aload         11
     261: astore        14
     263: aload         14
     265: invokevirtual #84                 // Method java/lang/String.hashCode:()I
     268: lookupswitch  { // 4
                    68: 325
                    76: 351
                    82: 312
                    85: 338
               default: 388
          }
     312: aload         14
     314: ldc           #86                 // String R
     316: invokevirtual #89                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     319: ifne          382
     322: goto          388
     325: aload         14
     327: ldc           #91                 // String D
     329: invokevirtual #89                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     332: ifne          370
     335: goto          388
     338: aload         14
     340: ldc           #93                 // String U
     342: invokevirtual #89                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     345: ifne          364
     348: goto          388
     351: aload         14
     353: ldc           #95                 // String L
     355: invokevirtual #89                 // Method java/lang/String.equals:(Ljava/lang/Object;)Z
     358: ifne          376
     361: goto          388
     364: getstatic     #101                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.UP:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     367: goto          416
     370: getstatic     #104                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.DOWN:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     373: goto          416
     376: getstatic     #107                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.LEFT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     379: goto          416
     382: getstatic     #110                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.RIGHT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     385: goto          416
     388: new           #112                // class java/lang/IllegalStateException
     391: dup
     392: new           #114                // class java/lang/StringBuilder
     395: dup
     396: invokespecial #115                // Method java/lang/StringBuilder."<init>":()V
     399: ldc           #117                // String Unexpected direction:
     401: invokevirtual #121                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     404: aload         11
     406: invokevirtual #121                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     409: invokevirtual #125                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     412: invokespecial #128                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     415: athrow
     416: astore        15
     418: new           #130                // class kotlin/Pair
     421: dup
     422: aload         15
     424: aload         13
     426: invokestatic  #136                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     429: invokestatic  #140                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     432: invokespecial #143                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     435: aload         16
     437: swap
     438: invokeinterface #63,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     443: pop
     444: goto          171
     447: aload         5
     449: checkcast     #65                 // class java/util/List
     452: nop
     453: areturn

  public com.github.brpeterman.advent2022.RopeSnake$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #168                // Method "<init>":()V
       4: return
}

Compiled from "RopeSnake.kt"
public final class com.github.brpeterman.advent2022.RopeSnake$Direction extends java.lang.Enum<com.github.brpeterman.advent2022.RopeSnake$Direction> {
  private final com.github.brpeterman.advent2022.RopeSnake$Coords offset;

  public static final com.github.brpeterman.advent2022.RopeSnake$Direction UP;

  public static final com.github.brpeterman.advent2022.RopeSnake$Direction DOWN;

  public static final com.github.brpeterman.advent2022.RopeSnake$Direction LEFT;

  public static final com.github.brpeterman.advent2022.RopeSnake$Direction RIGHT;

  private static final com.github.brpeterman.advent2022.RopeSnake$Direction[] $VALUES;

  private static final kotlin.enums.EnumEntries $ENTRIES;

  private com.github.brpeterman.advent2022.RopeSnake$Direction(com.github.brpeterman.advent2022.RopeSnake$Coords);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: invokespecial #11                 // Method java/lang/Enum."<init>":(Ljava/lang/String;I)V
       6: aload_0
       7: aload_3
       8: putfield      #15                 // Field offset:Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      11: return

  public final com.github.brpeterman.advent2022.RopeSnake$Coords getOffset();
    Code:
       0: aload_0
       1: getfield      #15                 // Field offset:Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
       4: areturn

  public static com.github.brpeterman.advent2022.RopeSnake$Direction[] values();
    Code:
       0: getstatic     #30                 // Field $VALUES:[Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
       3: invokevirtual #36                 // Method java/lang/Object.clone:()Ljava/lang/Object;
       6: checkcast     #37                 // class "[Lcom/github/brpeterman/advent2022/RopeSnake$Direction;"
       9: areturn

  public static com.github.brpeterman.advent2022.RopeSnake$Direction valueOf(java.lang.String);
    Code:
       0: ldc           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
       2: aload_0
       3: invokestatic  #42                 // Method java/lang/Enum.valueOf:(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Enum;
       6: checkcast     #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
       9: areturn

  public static kotlin.enums.EnumEntries<com.github.brpeterman.advent2022.RopeSnake$Direction> getEntries();
    Code:
       0: getstatic     #50                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
       3: areturn

  private static final com.github.brpeterman.advent2022.RopeSnake$Direction[] $values();
    Code:
       0: iconst_4
       1: anewarray     #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
       4: astore_0
       5: aload_0
       6: iconst_0
       7: getstatic     #54                 // Field UP:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      10: aastore
      11: aload_0
      12: iconst_1
      13: getstatic     #57                 // Field DOWN:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      16: aastore
      17: aload_0
      18: iconst_2
      19: getstatic     #60                 // Field LEFT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      22: aastore
      23: aload_0
      24: iconst_3
      25: getstatic     #63                 // Field RIGHT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      28: aastore
      29: aload_0
      30: areturn

  static {};
    Code:
       0: new           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
       3: dup
       4: ldc           #66                 // String UP
       6: iconst_0
       7: new           #68                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      10: dup
      11: iconst_m1
      12: iconst_0
      13: invokespecial #71                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      16: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILcom/github/brpeterman/advent2022/RopeSnake$Coords;)V
      19: putstatic     #54                 // Field UP:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      22: new           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
      25: dup
      26: ldc           #74                 // String DOWN
      28: iconst_1
      29: new           #68                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      32: dup
      33: iconst_1
      34: iconst_0
      35: invokespecial #71                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      38: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILcom/github/brpeterman/advent2022/RopeSnake$Coords;)V
      41: putstatic     #57                 // Field DOWN:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      44: new           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
      47: dup
      48: ldc           #75                 // String LEFT
      50: iconst_2
      51: new           #68                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      54: dup
      55: iconst_0
      56: iconst_m1
      57: invokespecial #71                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      60: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILcom/github/brpeterman/advent2022/RopeSnake$Coords;)V
      63: putstatic     #60                 // Field LEFT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      66: new           #2                  // class com/github/brpeterman/advent2022/RopeSnake$Direction
      69: dup
      70: ldc           #76                 // String RIGHT
      72: iconst_3
      73: new           #68                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      76: dup
      77: iconst_0
      78: iconst_1
      79: invokespecial #71                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      82: invokespecial #73                 // Method "<init>":(Ljava/lang/String;ILcom/github/brpeterman/advent2022/RopeSnake$Coords;)V
      85: putstatic     #63                 // Field RIGHT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      88: invokestatic  #78                 // Method $values:()[Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      91: putstatic     #30                 // Field $VALUES:[Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      94: getstatic     #30                 // Field $VALUES:[Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      97: checkcast     #80                 // class "[Ljava/lang/Enum;"
     100: invokestatic  #86                 // Method kotlin/enums/EnumEntriesKt.enumEntries:([Ljava/lang/Enum;)Lkotlin/enums/EnumEntries;
     103: putstatic     #50                 // Field $ENTRIES:Lkotlin/enums/EnumEntries;
     106: return
}

Compiled from "RopeSnake.kt"
public final class com.github.brpeterman.advent2022.RopeSnake {
  public static final com.github.brpeterman.advent2022.RopeSnake$Companion Companion;

  public com.github.brpeterman.advent2022.RopeSnake();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int simulateAndCount(java.util.List<? extends kotlin.Pair<? extends com.github.brpeterman.advent2022.RopeSnake$Direction, java.lang.Integer>>, int);
    Code:
       0: aload_1
       1: ldc           #16                 // String steps
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_1
       7: anewarray     #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      10: astore        4
      12: aload         4
      14: iconst_0
      15: new           #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      18: dup
      19: iconst_0
      20: iconst_0
      21: invokespecial #27                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      24: aastore
      25: aload         4
      27: invokestatic  #33                 // Method kotlin/collections/SetsKt.mutableSetOf:([Ljava/lang/Object;)Ljava/util/Set;
      30: astore_3
      31: aconst_null
      32: astore        4
      34: new           #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      37: dup
      38: iconst_0
      39: iconst_0
      40: invokespecial #27                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      43: astore        4
      45: new           #35                 // class kotlin/ranges/IntRange
      48: dup
      49: iconst_1
      50: iload_2
      51: invokespecial #36                 // Method kotlin/ranges/IntRange."<init>":(II)V
      54: checkcast     #38                 // class java/lang/Iterable
      57: astore        6
      59: new           #40                 // class java/util/ArrayList
      62: dup
      63: invokespecial #41                 // Method java/util/ArrayList."<init>":()V
      66: astore        7
      68: iconst_0
      69: istore        8
      71: aload         7
      73: astore        9
      75: aload         6
      77: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      82: astore        10
      84: aload         10
      86: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      91: ifeq          133
      94: aload         10
      96: checkcast     #53                 // class kotlin/collections/IntIterator
      99: invokevirtual #57                 // Method kotlin/collections/IntIterator.nextInt:()I
     102: istore        11
     104: aload         9
     106: astore        13
     108: iconst_0
     109: istore        14
     111: aload         13
     113: new           #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
     116: dup
     117: iconst_0
     118: iconst_0
     119: invokespecial #27                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
     122: invokevirtual #61                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     125: pop
     126: aload         13
     128: astore        9
     130: goto          84
     133: aload         9
     135: astore        5
     137: aload_1
     138: checkcast     #38                 // class java/lang/Iterable
     141: astore        6
     143: iconst_0
     144: istore        7
     146: aload         6
     148: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     153: astore        8
     155: aload         8
     157: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     162: ifeq          439
     165: aload         8
     167: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     172: astore        9
     174: aload         9
     176: checkcast     #67                 // class kotlin/Pair
     179: astore        10
     181: iconst_0
     182: istore        11
     184: aload         10
     186: invokevirtual #70                 // Method kotlin/Pair.component1:()Ljava/lang/Object;
     189: checkcast     #72                 // class com/github/brpeterman/advent2022/RopeSnake$Direction
     192: astore        12
     194: aload         10
     196: invokevirtual #75                 // Method kotlin/Pair.component2:()Ljava/lang/Object;
     199: checkcast     #77                 // class java/lang/Number
     202: invokevirtual #80                 // Method java/lang/Number.intValue:()I
     205: istore        13
     207: new           #35                 // class kotlin/ranges/IntRange
     210: dup
     211: iconst_1
     212: iload         13
     214: invokespecial #36                 // Method kotlin/ranges/IntRange."<init>":(II)V
     217: checkcast     #38                 // class java/lang/Iterable
     220: astore        14
     222: iconst_0
     223: istore        15
     225: aload         14
     227: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     232: astore        16
     234: aload         16
     236: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     241: ifeq          433
     244: aload         16
     246: checkcast     #53                 // class kotlin/collections/IntIterator
     249: invokevirtual #57                 // Method kotlin/collections/IntIterator.nextInt:()I
     252: istore        17
     254: iload         17
     256: istore        18
     258: iconst_0
     259: istore        19
     261: aload         4
     263: aload         12
     265: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     268: invokevirtual #88                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords.plus:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     271: astore        4
     273: aload         5
     275: checkcast     #38                 // class java/lang/Iterable
     278: invokestatic  #94                 // Method kotlin/collections/CollectionsKt.withIndex:(Ljava/lang/Iterable;)Ljava/lang/Iterable;
     281: astore        20
     283: iconst_0
     284: istore        21
     286: aload         20
     288: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     293: astore        22
     295: aload         22
     297: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     302: ifeq          427
     305: aload         22
     307: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     312: astore        23
     314: aload         23
     316: checkcast     #96                 // class kotlin/collections/IndexedValue
     319: astore        24
     321: iconst_0
     322: istore        25
     324: aload         24
     326: invokevirtual #98                 // Method kotlin/collections/IndexedValue.component1:()I
     329: istore        26
     331: aload         24
     333: invokevirtual #99                 // Method kotlin/collections/IndexedValue.component2:()Ljava/lang/Object;
     336: checkcast     #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
     339: astore        27
     341: iload         26
     343: ifne          351
     346: aload         4
     348: goto          372
     351: aload         5
     353: iload         26
     355: iconst_1
     356: isub
     357: invokevirtual #103                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     360: astore        28
     362: aload         28
     364: invokestatic  #107                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     367: aload         28
     369: checkcast     #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
     372: astore        29
     374: aload_0
     375: aload         27
     377: aload         29
     379: invokevirtual #111                // Method isAdjacent:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Z
     382: ifne          422
     385: aload_0
     386: aload         27
     388: aload         29
     390: invokevirtual #115                // Method moveTo:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     393: astore        28
     395: aload         5
     397: iload         26
     399: aload         28
     401: invokevirtual #119                // Method java/util/ArrayList.set:(ILjava/lang/Object;)Ljava/lang/Object;
     404: pop
     405: iload         26
     407: iload_2
     408: iconst_1
     409: isub
     410: if_icmpne     422
     413: aload_3
     414: aload         28
     416: invokeinterface #122,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     421: pop
     422: nop
     423: nop
     424: goto          295
     427: nop
     428: nop
     429: nop
     430: goto          234
     433: nop
     434: nop
     435: nop
     436: goto          155
     439: nop
     440: aload_3
     441: invokeinterface #125,  1          // InterfaceMethod java/util/Set.size:()I
     446: ireturn

  public static int simulateAndCount$default(com.github.brpeterman.advent2022.RopeSnake, java.util.List, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_2
       2: iand
       3: ifeq          8
       6: iconst_1
       7: istore_2
       8: aload_0
       9: aload_1
      10: iload_2
      11: invokevirtual #162                // Method simulateAndCount:(Ljava/util/List;I)I
      14: ireturn

  public final boolean isAdjacent(com.github.brpeterman.advent2022.RopeSnake$Coords, com.github.brpeterman.advent2022.RopeSnake$Coords);
    Code:
       0: aload_1
       1: ldc           #163                // String tail
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #164                // String head
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: bipush        9
      14: anewarray     #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      17: astore_3
      18: aload_3
      19: iconst_0
      20: new           #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      23: dup
      24: iconst_0
      25: iconst_0
      26: invokespecial #27                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
      29: aastore
      30: aload_3
      31: iconst_1
      32: getstatic     #167                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.UP:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      35: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      38: aastore
      39: aload_3
      40: iconst_2
      41: getstatic     #170                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.DOWN:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      44: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      47: aastore
      48: aload_3
      49: iconst_3
      50: getstatic     #173                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.LEFT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      53: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      56: aastore
      57: aload_3
      58: iconst_4
      59: getstatic     #176                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.RIGHT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      62: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      65: aastore
      66: aload_3
      67: iconst_5
      68: getstatic     #167                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.UP:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      71: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      74: getstatic     #173                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.LEFT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      77: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      80: invokevirtual #88                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords.plus:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      83: aastore
      84: aload_3
      85: bipush        6
      87: getstatic     #167                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.UP:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      90: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      93: getstatic     #176                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.RIGHT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
      96: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
      99: invokevirtual #88                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords.plus:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     102: aastore
     103: aload_3
     104: bipush        7
     106: getstatic     #170                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.DOWN:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     109: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     112: getstatic     #173                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.LEFT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     115: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     118: invokevirtual #88                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords.plus:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     121: aastore
     122: aload_3
     123: bipush        8
     125: getstatic     #170                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.DOWN:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     128: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     131: getstatic     #176                // Field com/github/brpeterman/advent2022/RopeSnake$Direction.RIGHT:Lcom/github/brpeterman/advent2022/RopeSnake$Direction;
     134: invokevirtual #84                 // Method com/github/brpeterman/advent2022/RopeSnake$Direction.getOffset:()Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     137: invokevirtual #88                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords.plus:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     140: aastore
     141: aload_3
     142: invokestatic  #180                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     145: checkcast     #38                 // class java/lang/Iterable
     148: astore_3
     149: nop
     150: iconst_0
     151: istore        4
     153: aload_3
     154: instanceof    #182                // class java/util/Collection
     157: ifeq          176
     160: aload_3
     161: checkcast     #182                // class java/util/Collection
     164: invokeinterface #185,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
     169: ifeq          176
     172: iconst_0
     173: goto          231
     176: aload_3
     177: invokeinterface #45,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     182: astore        5
     184: aload         5
     186: invokeinterface #51,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     191: ifeq          230
     194: aload         5
     196: invokeinterface #65,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     201: astore        6
     203: aload         6
     205: checkcast     #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
     208: astore        7
     210: iconst_0
     211: istore        8
     213: aload_2
     214: aload         7
     216: invokevirtual #88                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords.plus:(Lcom/github/brpeterman/advent2022/RopeSnake$Coords;)Lcom/github/brpeterman/advent2022/RopeSnake$Coords;
     219: aload_1
     220: invokestatic  #189                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     223: ifeq          184
     226: iconst_1
     227: goto          231
     230: iconst_0
     231: ireturn

  public final com.github.brpeterman.advent2022.RopeSnake$Coords moveTo(com.github.brpeterman.advent2022.RopeSnake$Coords, com.github.brpeterman.advent2022.RopeSnake$Coords);
    Code:
       0: aload_1
       1: ldc           #163                // String tail
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #164                // String head
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      16: aload_2
      17: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      20: if_icmpne     27
      23: iconst_0
      24: goto          49
      27: aload_2
      28: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      31: aload_1
      32: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      35: isub
      36: aload_2
      37: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      40: aload_1
      41: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      44: isub
      45: invokestatic  #201                // Method java/lang/Math.abs:(I)I
      48: idiv
      49: istore_3
      50: aload_1
      51: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
      54: aload_2
      55: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
      58: if_icmpne     65
      61: iconst_0
      62: goto          87
      65: aload_2
      66: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
      69: aload_1
      70: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
      73: isub
      74: aload_2
      75: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
      78: aload_1
      79: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
      82: isub
      83: invokestatic  #201                // Method java/lang/Math.abs:(I)I
      86: idiv
      87: istore        4
      89: new           #24                 // class com/github/brpeterman/advent2022/RopeSnake$Coords
      92: dup
      93: aload_1
      94: invokevirtual #195                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getRow:()I
      97: iload_3
      98: iadd
      99: aload_1
     100: invokevirtual #204                // Method com/github/brpeterman/advent2022/RopeSnake$Coords.getColumn:()I
     103: iload         4
     105: iadd
     106: invokespecial #27                 // Method com/github/brpeterman/advent2022/RopeSnake$Coords."<init>":(II)V
     109: areturn

  static {};
    Code:
       0: new           #209                // class com/github/brpeterman/advent2022/RopeSnake$Companion
       3: dup
       4: aconst_null
       5: invokespecial #212                // Method com/github/brpeterman/advent2022/RopeSnake$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #216                // Field Companion:Lcom/github/brpeterman/advent2022/RopeSnake$Companion;
      11: return
}


package com.github.brpeterman.advent2022

class DirTree(input: String, val root: Folder = Folder("")) {
    init {
        constructTree(parseInput(input))
    }

    data class Folder(val name: String, val parent: Folder? = null, val children: MutableMap<String, Folder> = mutableMapOf(), val files: MutableMap<String, Int> = mutableMapOf())

    fun sumSmallDirs(threshold: Int = 100000): Int {
        val index = mutableMapOf<String, Int>()
        dirSize(root, index)
        return index.values
            .filter { it <= threshold }
            .sum()
    }

    fun findThresholdDir(totalSpace: Int = 70000000, requiredSpace: Int = 30000000): Int {
        val index = mutableMapOf<String, Int>()
        dirSize(root, index)
        val usedSpace = index[""]!!
        return index.values.sorted()
            .first { totalSpace - usedSpace + it >= requiredSpace }
    }

    fun dirSize(dir: Folder, index: MutableMap<String, Int> = mutableMapOf()): Int {
        val count = dir.files.values.sum() +
                dir.children.values.map { dirSize(it, index) }.sum()
        index[dir.name] = count
        return count
    }

    fun constructTree(lines: List<String>) {
        var workingDir = root
        var index = 0
        while (index < lines.size - 1) {
            val line = lines[index]
            val tokens = line.split(" ")
            val cmd = tokens[1]
            when (cmd) {
                "cd" -> {
                    val dir = tokens[2]
                    workingDir = when (dir) {
                        "/" -> root
                        ".." -> workingDir.parent!!
                        else -> workingDir.children[dir]!!
                    }
                    index++
                }
                "ls" -> {
                    var outputIndex = index + 1
                    while (lines[outputIndex].isNotBlank() && !lines[outputIndex].startsWith('$')) {
                        val outputLine = lines[outputIndex]
                        val outputTokens = outputLine.split(" ")
                        when (outputTokens[0]) {
                            "dir" -> workingDir.children.put(outputTokens[1], Folder("${workingDir.name}/${outputTokens[1]}", workingDir))
                            else -> workingDir.files.put(outputTokens[1], outputTokens[0].toInt())
                        }
                        outputIndex++
                    }
                    index = outputIndex
                }
            }
        }
    }

    companion object {
        fun parseInput(input: String): List<String> {
            return input.split("\n")
        }
    }
}

Compiled from "DirTree.kt"
public final class com.github.brpeterman.advent2022.DirTree {
  public static final com.github.brpeterman.advent2022.DirTree$Companion Companion;

  private final com.github.brpeterman.advent2022.DirTree$Folder root;

  public com.github.brpeterman.advent2022.DirTree(java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder);
    Code:
       0: aload_1
       1: ldc           #9                  // String input
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String root
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokespecial #20                 // Method java/lang/Object."<init>":()V
      16: aload_0
      17: aload_2
      18: putfield      #23                 // Field root:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      21: nop
      22: aload_0
      23: getstatic     #27                 // Field Companion:Lcom/github/brpeterman/advent2022/DirTree$Companion;
      26: aload_1
      27: invokevirtual #33                 // Method com/github/brpeterman/advent2022/DirTree$Companion.parseInput:(Ljava/lang/String;)Ljava/util/List;
      30: invokevirtual #37                 // Method constructTree:(Ljava/util/List;)V
      33: nop
      34: return

  public com.github.brpeterman.advent2022.DirTree(java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload_3
       1: iconst_2
       2: iand
       3: ifeq          22
       6: new           #43                 // class com/github/brpeterman/advent2022/DirTree$Folder
       9: dup
      10: ldc           #45                 // String
      12: aconst_null
      13: aconst_null
      14: aconst_null
      15: bipush        14
      17: aconst_null
      18: invokespecial #48                 // Method com/github/brpeterman/advent2022/DirTree$Folder."<init>":(Ljava/lang/String;Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
      21: astore_2
      22: aload_0
      23: aload_1
      24: aload_2
      25: invokespecial #50                 // Method "<init>":(Ljava/lang/String;Lcom/github/brpeterman/advent2022/DirTree$Folder;)V
      28: return

  public final com.github.brpeterman.advent2022.DirTree$Folder getRoot();
    Code:
       0: aload_0
       1: getfield      #23                 // Field root:Lcom/github/brpeterman/advent2022/DirTree$Folder;
       4: areturn

  public final int sumSmallDirs(int);
    Code:
       0: new           #56                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #57                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #59                 // class java/util/Map
      10: astore_2
      11: aload_0
      12: aload_0
      13: getfield      #23                 // Field root:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      16: aload_2
      17: invokevirtual #63                 // Method dirSize:(Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;)I
      20: pop
      21: aload_2
      22: invokeinterface #67,  1           // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      27: checkcast     #69                 // class java/lang/Iterable
      30: astore_3
      31: nop
      32: iconst_0
      33: istore        4
      35: aload_3
      36: astore        5
      38: new           #71                 // class java/util/ArrayList
      41: dup
      42: invokespecial #72                 // Method java/util/ArrayList."<init>":()V
      45: checkcast     #74                 // class java/util/Collection
      48: astore        6
      50: iconst_0
      51: istore        7
      53: aload         5
      55: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      60: astore        8
      62: aload         8
      64: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      69: ifeq          121
      72: aload         8
      74: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      79: astore        9
      81: aload         9
      83: checkcast     #90                 // class java/lang/Number
      86: invokevirtual #94                 // Method java/lang/Number.intValue:()I
      89: istore        10
      91: iconst_0
      92: istore        11
      94: iload         10
      96: iload_1
      97: if_icmpgt     104
     100: iconst_1
     101: goto          105
     104: iconst_0
     105: ifeq          62
     108: aload         6
     110: aload         9
     112: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     117: pop
     118: goto          62
     121: aload         6
     123: checkcast     #100                // class java/util/List
     126: nop
     127: checkcast     #69                 // class java/lang/Iterable
     130: invokestatic  #106                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     133: ireturn

  public static int sumSmallDirs$default(com.github.brpeterman.advent2022.DirTree, int, int, java.lang.Object);
    Code:
       0: iload_2
       1: iconst_1
       2: iand
       3: ifeq          9
       6: ldc           #124                // int 100000
       8: istore_1
       9: aload_0
      10: iload_1
      11: invokevirtual #126                // Method sumSmallDirs:(I)I
      14: ireturn

  public final int findThresholdDir(int, int);
    Code:
       0: new           #56                 // class java/util/LinkedHashMap
       3: dup
       4: invokespecial #57                 // Method java/util/LinkedHashMap."<init>":()V
       7: checkcast     #59                 // class java/util/Map
      10: astore_3
      11: aload_0
      12: aload_0
      13: getfield      #23                 // Field root:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      16: aload_3
      17: invokevirtual #63                 // Method dirSize:(Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;)I
      20: pop
      21: aload_3
      22: ldc           #45                 // String
      24: invokeinterface #132,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      29: dup
      30: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      33: checkcast     #90                 // class java/lang/Number
      36: invokevirtual #94                 // Method java/lang/Number.intValue:()I
      39: istore        4
      41: aload_3
      42: invokeinterface #67,  1           // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      47: checkcast     #69                 // class java/lang/Iterable
      50: invokestatic  #140                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
      53: checkcast     #69                 // class java/lang/Iterable
      56: astore        5
      58: nop
      59: iconst_0
      60: istore        6
      62: aload         5
      64: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      69: astore        7
      71: aload         7
      73: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      78: ifeq          127
      81: aload         7
      83: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: astore        8
      90: aload         8
      92: checkcast     #90                 // class java/lang/Number
      95: invokevirtual #94                 // Method java/lang/Number.intValue:()I
      98: istore        9
     100: iconst_0
     101: istore        10
     103: iload_1
     104: iload         4
     106: isub
     107: iload         9
     109: iadd
     110: iload_2
     111: if_icmplt     118
     114: iconst_1
     115: goto          119
     118: iconst_0
     119: ifeq          71
     122: aload         8
     124: goto          137
     127: new           #142                // class java/util/NoSuchElementException
     130: dup
     131: ldc           #144                // String Collection contains no element matching the predicate.
     133: invokespecial #147                // Method java/util/NoSuchElementException."<init>":(Ljava/lang/String;)V
     136: athrow
     137: checkcast     #90                 // class java/lang/Number
     140: invokevirtual #94                 // Method java/lang/Number.intValue:()I
     143: ireturn

  public static int findThresholdDir$default(com.github.brpeterman.advent2022.DirTree, int, int, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          9
       6: ldc           #157                // int 70000000
       8: istore_1
       9: iload_3
      10: iconst_2
      11: iand
      12: ifeq          18
      15: ldc           #158                // int 30000000
      17: istore_2
      18: aload_0
      19: iload_1
      20: iload_2
      21: invokevirtual #160                // Method findThresholdDir:(II)I
      24: ireturn

  public final int dirSize(com.github.brpeterman.advent2022.DirTree$Folder, java.util.Map<java.lang.String, java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #163                // String dir
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #164                // String index
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: invokevirtual #168                // Method com/github/brpeterman/advent2022/DirTree$Folder.getFiles:()Ljava/util/Map;
      16: invokeinterface #67,  1           // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      21: checkcast     #69                 // class java/lang/Iterable
      24: invokestatic  #106                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
      27: aload_1
      28: invokevirtual #171                // Method com/github/brpeterman/advent2022/DirTree$Folder.getChildren:()Ljava/util/Map;
      31: invokeinterface #67,  1           // InterfaceMethod java/util/Map.values:()Ljava/util/Collection;
      36: checkcast     #69                 // class java/lang/Iterable
      39: astore        4
      41: istore        13
      43: iconst_0
      44: istore        5
      46: aload         4
      48: astore        6
      50: new           #71                 // class java/util/ArrayList
      53: dup
      54: aload         4
      56: bipush        10
      58: invokestatic  #175                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      61: invokespecial #178                // Method java/util/ArrayList."<init>":(I)V
      64: checkcast     #74                 // class java/util/Collection
      67: astore        7
      69: iconst_0
      70: istore        8
      72: aload         6
      74: invokeinterface #78,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      79: astore        9
      81: aload         9
      83: invokeinterface #84,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      88: ifeq          136
      91: aload         9
      93: invokeinterface #88,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      98: astore        10
     100: aload         7
     102: aload         10
     104: checkcast     #43                 // class com/github/brpeterman/advent2022/DirTree$Folder
     107: astore        11
     109: astore        14
     111: iconst_0
     112: istore        12
     114: aload_0
     115: aload         11
     117: aload_2
     118: invokevirtual #63                 // Method dirSize:(Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;)I
     121: invokestatic  #184                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     124: aload         14
     126: swap
     127: invokeinterface #98,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     132: pop
     133: goto          81
     136: aload         7
     138: checkcast     #100                // class java/util/List
     141: nop
     142: astore        14
     144: iload         13
     146: aload         14
     148: checkcast     #69                 // class java/lang/Iterable
     151: invokestatic  #106                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     154: iadd
     155: istore_3
     156: iload_3
     157: invokestatic  #184                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     160: astore        6
     162: aload_2
     163: aload_1
     164: invokevirtual #188                // Method com/github/brpeterman/advent2022/DirTree$Folder.getName:()Ljava/lang/String;
     167: aload         6
     169: invokeinterface #192,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     174: pop
     175: iload_3
     176: ireturn

  public static int dirSize$default(com.github.brpeterman.advent2022.DirTree, com.github.brpeterman.advent2022.DirTree$Folder, java.util.Map, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_2
       2: iand
       3: ifeq          17
       6: new           #56                 // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #57                 // Method java/util/LinkedHashMap."<init>":()V
      13: checkcast     #59                 // class java/util/Map
      16: astore_2
      17: aload_0
      18: aload_1
      19: aload_2
      20: invokevirtual #63                 // Method dirSize:(Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;)I
      23: ireturn

  public final void constructTree(java.util.List<java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #204                // String lines
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #23                 // Field root:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      10: astore_2
      11: iconst_0
      12: istore_3
      13: iload_3
      14: aload_1
      15: invokeinterface #207,  1          // InterfaceMethod java/util/List.size:()I
      20: iconst_1
      21: isub
      22: if_icmpge     412
      25: aload_1
      26: iload_3
      27: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      32: checkcast     #212                // class java/lang/String
      35: astore        4
      37: aload         4
      39: checkcast     #214                // class java/lang/CharSequence
      42: iconst_1
      43: anewarray     #212                // class java/lang/String
      46: astore        6
      48: aload         6
      50: iconst_0
      51: ldc           #216                // String
      53: aastore
      54: aload         6
      56: iconst_0
      57: iconst_0
      58: bipush        6
      60: aconst_null
      61: invokestatic  #222                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      64: astore        5
      66: aload         5
      68: iconst_1
      69: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      74: checkcast     #212                // class java/lang/String
      77: astore        6
      79: aload         6
      81: astore        7
      83: aload         7
      85: ldc           #224                // String cd
      87: invokestatic  #228                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      90: ifeq          173
      93: aload         5
      95: iconst_2
      96: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     101: checkcast     #212                // class java/lang/String
     104: astore        8
     106: aload         8
     108: astore        9
     110: aload         9
     112: ldc           #230                // String /
     114: invokestatic  #228                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     117: ifeq          127
     120: aload_0
     121: getfield      #23                 // Field root:Lcom/github/brpeterman/advent2022/DirTree$Folder;
     124: goto          166
     127: aload         9
     129: ldc           #232                // String ..
     131: invokestatic  #228                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     134: ifeq          148
     137: aload_2
     138: invokevirtual #235                // Method com/github/brpeterman/advent2022/DirTree$Folder.getParent:()Lcom/github/brpeterman/advent2022/DirTree$Folder;
     141: dup
     142: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     145: goto          166
     148: aload_2
     149: invokevirtual #171                // Method com/github/brpeterman/advent2022/DirTree$Folder.getChildren:()Ljava/util/Map;
     152: aload         8
     154: invokeinterface #132,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     159: dup
     160: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     163: checkcast     #43                 // class com/github/brpeterman/advent2022/DirTree$Folder
     166: astore_2
     167: iinc          3, 1
     170: goto          13
     173: aload         7
     175: ldc           #237                // String ls
     177: invokestatic  #228                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     180: ifeq          13
     183: iload_3
     184: iconst_1
     185: iadd
     186: istore        8
     188: aload_1
     189: iload         8
     191: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     196: checkcast     #214                // class java/lang/CharSequence
     199: invokestatic  #241                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
     202: ifne          209
     205: iconst_1
     206: goto          210
     209: iconst_0
     210: ifeq          406
     213: aload_1
     214: iload         8
     216: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     221: checkcast     #214                // class java/lang/CharSequence
     224: bipush        36
     226: iconst_0
     227: iconst_2
     228: aconst_null
     229: invokestatic  #245                // Method kotlin/text/StringsKt.startsWith$default:(Ljava/lang/CharSequence;CZILjava/lang/Object;)Z
     232: ifne          406
     235: aload_1
     236: iload         8
     238: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     243: checkcast     #212                // class java/lang/String
     246: astore        9
     248: aload         9
     250: checkcast     #214                // class java/lang/CharSequence
     253: iconst_1
     254: anewarray     #212                // class java/lang/String
     257: astore        11
     259: aload         11
     261: iconst_0
     262: ldc           #216                // String
     264: aastore
     265: aload         11
     267: iconst_0
     268: iconst_0
     269: bipush        6
     271: aconst_null
     272: invokestatic  #222                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     275: astore        10
     277: aload         10
     279: iconst_0
     280: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     285: checkcast     #212                // class java/lang/String
     288: ldc           #163                // String dir
     290: invokestatic  #228                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     293: ifeq          365
     296: aload_2
     297: invokevirtual #171                // Method com/github/brpeterman/advent2022/DirTree$Folder.getChildren:()Ljava/util/Map;
     300: aload         10
     302: iconst_1
     303: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     308: new           #43                 // class com/github/brpeterman/advent2022/DirTree$Folder
     311: dup
     312: new           #247                // class java/lang/StringBuilder
     315: dup
     316: invokespecial #248                // Method java/lang/StringBuilder."<init>":()V
     319: aload_2
     320: invokevirtual #188                // Method com/github/brpeterman/advent2022/DirTree$Folder.getName:()Ljava/lang/String;
     323: invokevirtual #252                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     326: bipush        47
     328: invokevirtual #255                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     331: aload         10
     333: iconst_1
     334: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     339: checkcast     #212                // class java/lang/String
     342: invokevirtual #252                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     345: invokevirtual #258                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     348: aload_2
     349: aconst_null
     350: aconst_null
     351: bipush        12
     353: aconst_null
     354: invokespecial #48                 // Method com/github/brpeterman/advent2022/DirTree$Folder."<init>":(Ljava/lang/String;Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;Ljava/util/Map;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
     357: invokeinterface #192,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     362: goto          399
     365: aload_2
     366: invokevirtual #168                // Method com/github/brpeterman/advent2022/DirTree$Folder.getFiles:()Ljava/util/Map;
     369: aload         10
     371: iconst_1
     372: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     377: aload         10
     379: iconst_0
     380: invokeinterface #210,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     385: checkcast     #212                // class java/lang/String
     388: invokestatic  #262                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     391: invokestatic  #184                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     394: invokeinterface #192,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     399: pop
     400: iinc          8, 1
     403: goto          188
     406: iload         8
     408: istore_3
     409: goto          13
     412: return

  static {};
    Code:
       0: new           #29                 // class com/github/brpeterman/advent2022/DirTree$Companion
       3: dup
       4: aconst_null
       5: invokespecial #276                // Method com/github/brpeterman/advent2022/DirTree$Companion."<init>":(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
       8: putstatic     #27                 // Field Companion:Lcom/github/brpeterman/advent2022/DirTree$Companion;
      11: return
}

Compiled from "DirTree.kt"
public final class com.github.brpeterman.advent2022.DirTree$Folder {
  private final java.lang.String name;

  private final com.github.brpeterman.advent2022.DirTree$Folder parent;

  private final java.util.Map<java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder> children;

  private final java.util.Map<java.lang.String, java.lang.Integer> files;

  public com.github.brpeterman.advent2022.DirTree$Folder(java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder, java.util.Map<java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder>, java.util.Map<java.lang.String, java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #11                 // String name
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #19                 // String children
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload         4
      14: ldc           #21                 // String files
      16: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      19: aload_0
      20: invokespecial #24                 // Method java/lang/Object."<init>":()V
      23: aload_0
      24: aload_1
      25: putfield      #27                 // Field name:Ljava/lang/String;
      28: aload_0
      29: aload_2
      30: putfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      33: aload_0
      34: aload_3
      35: putfield      #34                 // Field children:Ljava/util/Map;
      38: aload_0
      39: aload         4
      41: putfield      #36                 // Field files:Ljava/util/Map;
      44: return

  public com.github.brpeterman.advent2022.DirTree$Folder(java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder, java.util.Map, java.util.Map, int, kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: iload         5
       2: iconst_2
       3: iand
       4: ifeq          9
       7: aconst_null
       8: astore_2
       9: iload         5
      11: iconst_4
      12: iand
      13: ifeq          27
      16: new           #40                 // class java/util/LinkedHashMap
      19: dup
      20: invokespecial #41                 // Method java/util/LinkedHashMap."<init>":()V
      23: checkcast     #43                 // class java/util/Map
      26: astore_3
      27: iload         5
      29: bipush        8
      31: iand
      32: ifeq          47
      35: new           #40                 // class java/util/LinkedHashMap
      38: dup
      39: invokespecial #41                 // Method java/util/LinkedHashMap."<init>":()V
      42: checkcast     #43                 // class java/util/Map
      45: astore        4
      47: aload_0
      48: aload_1
      49: aload_2
      50: aload_3
      51: aload         4
      53: invokespecial #45                 // Method "<init>":(Ljava/lang/String;Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;Ljava/util/Map;)V
      56: return

  public final java.lang.String getName();
    Code:
       0: aload_0
       1: getfield      #27                 // Field name:Ljava/lang/String;
       4: areturn

  public final com.github.brpeterman.advent2022.DirTree$Folder getParent();
    Code:
       0: aload_0
       1: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
       4: areturn

  public final java.util.Map<java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder> getChildren();
    Code:
       0: aload_0
       1: getfield      #34                 // Field children:Ljava/util/Map;
       4: areturn

  public final java.util.Map<java.lang.String, java.lang.Integer> getFiles();
    Code:
       0: aload_0
       1: getfield      #36                 // Field files:Ljava/util/Map;
       4: areturn

  public final java.lang.String component1();
    Code:
       0: aload_0
       1: getfield      #27                 // Field name:Ljava/lang/String;
       4: areturn

  public final com.github.brpeterman.advent2022.DirTree$Folder component2();
    Code:
       0: aload_0
       1: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
       4: areturn

  public final java.util.Map<java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder> component3();
    Code:
       0: aload_0
       1: getfield      #34                 // Field children:Ljava/util/Map;
       4: areturn

  public final java.util.Map<java.lang.String, java.lang.Integer> component4();
    Code:
       0: aload_0
       1: getfield      #36                 // Field files:Ljava/util/Map;
       4: areturn

  public final com.github.brpeterman.advent2022.DirTree$Folder copy(java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder, java.util.Map<java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder>, java.util.Map<java.lang.String, java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #11                 // String name
       3: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #19                 // String children
       9: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload         4
      14: ldc           #21                 // String files
      16: invokestatic  #17                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      19: new           #2                  // class com/github/brpeterman/advent2022/DirTree$Folder
      22: dup
      23: aload_1
      24: aload_2
      25: aload_3
      26: aload         4
      28: invokespecial #45                 // Method "<init>":(Ljava/lang/String;Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;Ljava/util/Map;)V
      31: areturn

  public static com.github.brpeterman.advent2022.DirTree$Folder copy$default(com.github.brpeterman.advent2022.DirTree$Folder, java.lang.String, com.github.brpeterman.advent2022.DirTree$Folder, java.util.Map, java.util.Map, int, java.lang.Object);
    Code:
       0: iload         5
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #27                 // Field name:Ljava/lang/String;
      11: astore_1
      12: iload         5
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      23: astore_2
      24: iload         5
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #34                 // Field children:Ljava/util/Map;
      35: astore_3
      36: iload         5
      38: bipush        8
      40: iand
      41: ifeq          50
      44: aload_0
      45: getfield      #36                 // Field files:Ljava/util/Map;
      48: astore        4
      50: aload_0
      51: aload_1
      52: aload_2
      53: aload_3
      54: aload         4
      56: invokevirtual #65                 // Method copy:(Ljava/lang/String;Lcom/github/brpeterman/advent2022/DirTree$Folder;Ljava/util/Map;Ljava/util/Map;)Lcom/github/brpeterman/advent2022/DirTree$Folder;
      59: areturn

  public java.lang.String toString();
    Code:
       0: new           #68                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #69                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #71                 // String Folder(name=
       9: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #27                 // Field name:Ljava/lang/String;
      16: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      19: ldc           #77                 // String , parent=
      21: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      28: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: ldc           #82                 // String , children=
      33: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #34                 // Field children:Ljava/util/Map;
      40: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: ldc           #84                 // String , files=
      45: invokevirtual #75                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      48: aload_0
      49: getfield      #36                 // Field files:Ljava/util/Map;
      52: invokevirtual #80                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      55: bipush        41
      57: invokevirtual #87                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      60: invokevirtual #89                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      63: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #27                 // Field name:Ljava/lang/String;
       4: invokevirtual #95                 // Method java/lang/String.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      16: ifnonnull     23
      19: iconst_0
      20: goto          30
      23: aload_0
      24: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      27: invokevirtual #96                 // Method hashCode:()I
      30: iadd
      31: istore_1
      32: iload_1
      33: bipush        31
      35: imul
      36: aload_0
      37: getfield      #34                 // Field children:Ljava/util/Map;
      40: invokevirtual #97                 // Method java/lang/Object.hashCode:()I
      43: iadd
      44: istore_1
      45: iload_1
      46: bipush        31
      48: imul
      49: aload_0
      50: getfield      #36                 // Field files:Ljava/util/Map;
      53: invokevirtual #97                 // Method java/lang/Object.hashCode:()I
      56: iadd
      57: istore_1
      58: iload_1
      59: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class com/github/brpeterman/advent2022/DirTree$Folder
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/github/brpeterman/advent2022/DirTree$Folder
      20: astore_2
      21: aload_0
      22: getfield      #27                 // Field name:Ljava/lang/String;
      25: aload_2
      26: getfield      #27                 // Field name:Ljava/lang/String;
      29: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      41: aload_2
      42: getfield      #31                 // Field parent:Lcom/github/brpeterman/advent2022/DirTree$Folder;
      45: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #34                 // Field children:Ljava/util/Map;
      57: aload_2
      58: getfield      #34                 // Field children:Ljava/util/Map;
      61: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      64: ifne          69
      67: iconst_0
      68: ireturn
      69: aload_0
      70: getfield      #36                 // Field files:Ljava/util/Map;
      73: aload_2
      74: getfield      #36                 // Field files:Ljava/util/Map;
      77: invokestatic  #105                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      80: ifne          85
      83: iconst_0
      84: ireturn
      85: iconst_1
      86: ireturn
}

Compiled from "DirTree.kt"
public final class com.github.brpeterman.advent2022.DirTree$Companion {
  private com.github.brpeterman.advent2022.DirTree$Companion();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.util.List<java.lang.String> parseInput(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #16                 // String input
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #24                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #26                 // class java/lang/String
      14: astore_2
      15: aload_2
      16: iconst_0
      17: ldc           #28                 // String \n
      19: aastore
      20: aload_2
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #34                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: areturn

  public com.github.brpeterman.advent2022.DirTree$Companion(kotlin.jvm.internal.DefaultConstructorMarker);
    Code:
       0: aload_0
       1: invokespecial #37                 // Method "<init>":()V
       4: return
}