package day22

import java.io.File

fun main() {
    val data = parse("src/main/kotlin/day22/Day22.txt")

    val answer1 = part1(data)
    val answer2 = part2(data)

    println("🎄 Day 22 🎄")

    println()

    println("[Part 1]")
    println("Answer: $answer1")

    println()

    println("[Part 2]")
    println("Answer: $answer2")
}

private data class Point(
    val x: Int,
    val y: Int,
)

private sealed interface Step {
    data class Move(val count: Int) : Step
    object TurnRight : Step
    object TurnLeft : Step
}

private data class Board(
    val walls: Set<Point>,
    val steps: List<Step>,
)

private fun String.toSteps(): List<Step> {
    val steps = mutableListOf<Step>()
    var count = 0
    for (c in this) {
        if (c.isDigit()) {
            count = count * 10 + c.digitToInt()
        } else {
            steps += Step.Move(count)
            steps += when (c) {
                'R' -> Step.TurnRight
                'L' -> Step.TurnLeft
                else -> error("Unknown turn: $c")
            }
            count = 0
        }
    }

    steps += Step.Move(count)
    return steps
}

private fun List<String>.toWalls(): Set<Point> {
    val walls = mutableSetOf<Point>()
    for ((y, row) in this.withIndex()) {
        for ((x, col) in row.withIndex()) {
            if (col == '#') {
                walls += Point(x, y)
            }
        }
    }
    return walls
}

@Suppress("SameParameterValue")
private fun parse(path: String): Board =
    File(path).readLines().let { lines ->
        val walls = lines.dropLast(2).toWalls()
        val steps = lines.last().toSteps()
        Board(walls, steps)
    }

private sealed interface Facing {
    fun turnLeft(): Facing
    fun turnRight(): Facing

    object E : Facing {
        override fun turnLeft(): Facing = N
        override fun turnRight(): Facing = S
        override fun toString() = "E"
    }

    object S : Facing {
        override fun turnLeft(): Facing = E
        override fun turnRight(): Facing = W
        override fun toString() = "S"
    }

    object W : Facing {
        override fun turnLeft(): Facing = S
        override fun turnRight(): Facing = N
        override fun toString() = "W"
    }

    object N : Facing {
        override fun turnLeft(): Facing = W
        override fun turnRight(): Facing = E
        override fun toString() = "N"
    }
}

private data class Transition(
    val sourceId: String,
    val targetId: String,
    val sourceFacing: Facing,
    val targetFacing: Facing,
)

private const val PLANE_SIZE = 50
private data class Plane(
    val topLeft: Point,
    val transitionToE: Transition,
    val transitionToS: Transition,
    val transitionToW: Transition,
    val transitionToN: Transition,
)

private fun Plane.selectTransition(facing: Facing): Transition =
    when (facing) {
        is Facing.E -> transitionToE
        is Facing.S -> transitionToS
        is Facing.W -> transitionToW
        is Facing.N -> transitionToN
    }

private val planes = mapOf(
    // == Part 1 ==============================================================
    "A1" to Plane(
        topLeft = Point(50, 0),
        transitionToE = Transition(sourceId = "A1", targetId = "A2", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "A1", targetId = "A3", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "A1", targetId = "A2", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "A1", targetId = "A5", Facing.N, Facing.N),
    ),
    "A2" to Plane(
        topLeft = Point(100, 0),
        transitionToE = Transition(sourceId = "A2", targetId = "A1", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "A2", targetId = "A2", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "A2", targetId = "A1", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "A2", targetId = "A2", Facing.N, Facing.N),
    ),
    "A3" to Plane(
        topLeft = Point(50, 50),
        transitionToE = Transition(sourceId = "A3", targetId = "A3", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "A3", targetId = "A5", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "A3", targetId = "A3", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "A3", targetId = "A1", Facing.N, Facing.N),
    ),
    "A4" to Plane(
        topLeft = Point(0, 100),
        transitionToE = Transition(sourceId = "A4", targetId = "A5", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "A4", targetId = "A6", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "A4", targetId = "A5", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "A4", targetId = "A6", Facing.N, Facing.N),
    ),
    "A5" to Plane(
        topLeft = Point(50, 100),
        transitionToE = Transition(sourceId = "A5", targetId = "A4", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "A5", targetId = "A1", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "A5", targetId = "A4", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "A5", targetId = "A3", Facing.N, Facing.N),
    ),
    "A6" to Plane(
        topLeft = Point(0, 150),
        transitionToE = Transition(sourceId = "A6", targetId = "A6", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "A6", targetId = "A4", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "A6", targetId = "A6", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "A6", targetId = "A4", Facing.N, Facing.N),
    ),
    // == Part 2 ==============================================================
    "B1" to Plane(
        topLeft = Point(50, 0),
        transitionToE = Transition(sourceId = "B1", targetId = "B2", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "B1", targetId = "B3", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "B1", targetId = "B4", Facing.W, Facing.E),
        transitionToN = Transition(sourceId = "B1", targetId = "B6", Facing.N, Facing.E),
    ),
    "B2" to Plane(
        topLeft = Point(100, 0),
        transitionToE = Transition(sourceId = "B2", targetId = "B5", Facing.E, Facing.W),
        transitionToS = Transition(sourceId = "B2", targetId = "B3", Facing.S, Facing.W),
        transitionToW = Transition(sourceId = "B2", targetId = "B1", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "B2", targetId = "B6", Facing.N, Facing.N),
    ),
    "B3" to Plane(
        topLeft = Point(50, 50),
        transitionToE = Transition(sourceId = "B3", targetId = "B2", Facing.E, Facing.N),
        transitionToS = Transition(sourceId = "B3", targetId = "B5", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "B3", targetId = "B4", Facing.W, Facing.S),
        transitionToN = Transition(sourceId = "B3", targetId = "B1", Facing.N, Facing.N),
    ),
    "B4" to Plane(
        topLeft = Point(0, 100),
        transitionToE = Transition(sourceId = "B4", targetId = "B5", Facing.E, Facing.E),
        transitionToS = Transition(sourceId = "B4", targetId = "B6", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "B4", targetId = "B1", Facing.W, Facing.E),
        transitionToN = Transition(sourceId = "B4", targetId = "B3", Facing.N, Facing.E),
    ),
    "B5" to Plane(
        topLeft = Point(50, 100),
        transitionToE = Transition(sourceId = "B5", targetId = "B2", Facing.E, Facing.W),
        transitionToS = Transition(sourceId = "B5", targetId = "B6", Facing.S, Facing.W),
        transitionToW = Transition(sourceId = "B5", targetId = "B4", Facing.W, Facing.W),
        transitionToN = Transition(sourceId = "B5", targetId = "B3", Facing.N, Facing.N),
    ),
    "B6" to Plane(
        topLeft = Point(0, 150),
        transitionToE = Transition(sourceId = "B6", targetId = "B5", Facing.E, Facing.N),
        transitionToS = Transition(sourceId = "B6", targetId = "B2", Facing.S, Facing.S),
        transitionToW = Transition(sourceId = "B6", targetId = "B1", Facing.W, Facing.S),
        transitionToN = Transition(sourceId = "B6", targetId = "B4", Facing.N, Facing.N),
    ),
)

private val Plane.minX: Int
    get() = topLeft.x

private val Plane.maxX: Int
    get() = topLeft.x + PLANE_SIZE - 1

private val Plane.minY: Int
    get() = topLeft.y

private val Plane.maxY: Int
    get() = topLeft.y + PLANE_SIZE - 1

private operator fun Plane.contains(point: Point): Boolean =
    (point.x in minX..maxX) && (point.y in minY..maxY)

private fun Point.toLocal(plane: Plane): Point =
    Point(x - plane.topLeft.x, y - plane.topLeft.y)

private fun Point.toGlobal(plane: Plane): Point =
    Point(x + plane.topLeft.x, y + plane.topLeft.y)

private fun Point.flip(): Point =
    Point(y, x)

private val Transition.source: Plane
    get() = planes[sourceId] ?: error("Plane '$sourceId' doesn't exist.")

private val Transition.target: Plane
    get() = planes[targetId] ?: error("Plane '$targetId' doesn't exist.")

private fun Transition.findPosition(start: Point): Point =
    when (sourceFacing to targetFacing) {
        Facing.E to Facing.E -> Point(target.minX, start.toLocal(source).toGlobal(target).y)
        Facing.W to Facing.W -> Point(target.maxX, start.toLocal(source).toGlobal(target).y)
        Facing.S to Facing.S -> Point(start.toLocal(source).toGlobal(target).x, target.minY)
        Facing.N to Facing.N -> Point(start.toLocal(source).toGlobal(target).x, target.maxY)
        Facing.N to Facing.E -> Point(target.minX, start.toLocal(source).flip().toGlobal(target).y)
        Facing.S to Facing.W -> Point(target.maxX, start.toLocal(source).flip().toGlobal(target).y)
        Facing.W to Facing.E -> Point(target.minX, target.maxY - start.toLocal(source).y)
        Facing.E to Facing.W -> Point(target.maxX, target.maxY - start.toLocal(source).y)
        Facing.W to Facing.S -> Point(start.toLocal(source).flip().toGlobal(target).x, target.minY)
        Facing.E to Facing.N -> Point(start.toLocal(source).flip().toGlobal(target).x, target.maxY)
        else -> error("Transition from $sourceFacing to $targetFacing isn't defined.")
    }

private fun Facing.toOffset(): Point =
    when (this) {
        is Facing.E -> Point(+1, +0)
        is Facing.S -> Point(+0, +1)
        is Facing.W -> Point(-1, +0)
        is Facing.N -> Point(+0, -1)
    }

private fun Facing.toValue(): Int =
    when (this) {
        is Facing.E -> 0
        is Facing.S -> 1
        is Facing.W -> 2
        is Facing.N -> 3
    }

private fun solve(data: Board, start: String): Int {
    val (walls, steps) = data

    var plane = planes[start] ?: error("Plane '$start' doesn't exist.")
    var facing: Facing = Facing.E
    var position = plane.topLeft

    for (step in steps) {
        when (step) {
            is Step.TurnLeft -> facing = facing.turnLeft()
            is Step.TurnRight -> facing = facing.turnRight()
            is Step.Move -> {
                for (i in 1..step.count) {
                    val (dx, dy) = facing.toOffset()

                    var newFacing = facing
                    var newPosition = Point(position.x + dx, position.y + dy)
                    var newPlane = plane

                    if (newPosition !in plane) {
                        val transition = plane.selectTransition(facing)
                        newFacing = transition.targetFacing
                        newPosition = transition.findPosition(position)
                        newPlane = transition.target
                    }
                    if (newPosition in walls) {
                        break
                    }

                    facing = newFacing
                    position = newPosition
                    plane = newPlane
                }
            }
        }
    }

    return (1000 * (position.y + 1)) + (4 * (position.x + 1)) + facing.toValue()
}

private fun part1(data: Board): Int =
    solve(data, start = "A1")

private fun part2(data: Board): Int =
    solve(data, start = "B1")

Compiled from "Day22.kt"
public final class day22.Day22Kt {
  private static final int PLANE_SIZE;

  private static final java.util.Map<java.lang.String, day22.Plane> planes;

  public static final void main();
    Code:
       0: ldc           #8                  // String src/main/kotlin/day22/Day22.txt
       2: invokestatic  #12                 // Method parse:(Ljava/lang/String;)Lday22/Board;
       5: astore_0
       6: aload_0
       7: invokestatic  #16                 // Method part1:(Lday22/Board;)I
      10: istore_1
      11: aload_0
      12: invokestatic  #19                 // Method part2:(Lday22/Board;)I
      15: istore_2
      16: ldc           #21                 // String 🎄 Day 22 🎄
      18: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      21: swap
      22: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      25: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      28: invokevirtual #35                 // Method java/io/PrintStream.println:()V
      31: ldc           #37                 // String [Part 1]
      33: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      36: swap
      37: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      40: new           #39                 // class java/lang/StringBuilder
      43: dup
      44: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      47: ldc           #44                 // String Answer:
      49: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      52: iload_1
      53: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      56: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      59: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      62: swap
      63: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      66: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      69: invokevirtual #35                 // Method java/io/PrintStream.println:()V
      72: ldc           #57                 // String [Part 2]
      74: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
      77: swap
      78: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      81: new           #39                 // class java/lang/StringBuilder
      84: dup
      85: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      88: ldc           #44                 // String Answer:
      90: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      93: iload_2
      94: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      97: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     100: getstatic     #27                 // Field java/lang/System.out:Ljava/io/PrintStream;
     103: swap
     104: invokevirtual #33                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     107: return

  private static final java.util.List<day22.Step> toSteps(java.lang.String);
    Code:
       0: new           #67                 // class java/util/ArrayList
       3: dup
       4: invokespecial #68                 // Method java/util/ArrayList."<init>":()V
       7: checkcast     #70                 // class java/util/List
      10: astore_1
      11: iconst_0
      12: istore_2
      13: iconst_0
      14: istore_3
      15: aload_0
      16: invokevirtual #76                 // Method java/lang/String.length:()I
      19: istore        4
      21: iload_3
      22: iload         4
      24: if_icmpge     177
      27: aload_0
      28: iload_3
      29: invokevirtual #80                 // Method java/lang/String.charAt:(I)C
      32: istore        5
      34: iload         5
      36: invokestatic  #86                 // Method java/lang/Character.isDigit:(C)Z
      39: ifeq          56
      42: iload_2
      43: bipush        10
      45: imul
      46: iload         5
      48: invokestatic  #92                 // Method kotlin/text/CharsKt.digitToInt:(C)I
      51: iadd
      52: istore_2
      53: goto          171
      56: aload_1
      57: checkcast     #94                 // class java/util/Collection
      60: new           #96                 // class day22/Step$Move
      63: dup
      64: iload_2
      65: invokespecial #99                 // Method day22/Step$Move."<init>":(I)V
      68: invokeinterface #103,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
      73: pop
      74: aload_1
      75: checkcast     #94                 // class java/util/Collection
      78: astore        6
      80: iload         5
      82: lookupswitch  { // 2
                    76: 117
                    82: 108
               default: 126
          }
     108: getstatic     #109                // Field day22/Step$TurnRight.INSTANCE:Lday22/Step$TurnRight;
     111: checkcast     #111                // class day22/Step
     114: goto          157
     117: getstatic     #116                // Field day22/Step$TurnLeft.INSTANCE:Lday22/Step$TurnLeft;
     120: checkcast     #111                // class day22/Step
     123: goto          157
     126: new           #118                // class java/lang/IllegalStateException
     129: dup
     130: new           #39                 // class java/lang/StringBuilder
     133: dup
     134: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
     137: ldc           #120                // String Unknown turn:
     139: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     142: iload         5
     144: invokevirtual #123                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     147: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     150: invokevirtual #124                // Method java/lang/Object.toString:()Ljava/lang/String;
     153: invokespecial #127                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     156: athrow
     157: astore        7
     159: aload         6
     161: aload         7
     163: invokeinterface #103,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     168: pop
     169: iconst_0
     170: istore_2
     171: iinc          3, 1
     174: goto          21
     177: aload_1
     178: checkcast     #94                 // class java/util/Collection
     181: new           #96                 // class day22/Step$Move
     184: dup
     185: iload_2
     186: invokespecial #99                 // Method day22/Step$Move."<init>":(I)V
     189: invokeinterface #103,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     194: pop
     195: aload_1
     196: areturn

  private static final java.util.Set<day22.Point> toWalls(java.util.List<java.lang.String>);
    Code:
       0: new           #139                // class java/util/LinkedHashSet
       3: dup
       4: invokespecial #140                // Method java/util/LinkedHashSet."<init>":()V
       7: checkcast     #142                // class java/util/Set
      10: astore_1
      11: aload_0
      12: checkcast     #144                // class java/lang/Iterable
      15: invokeinterface #148,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      20: astore_2
      21: iconst_0
      22: istore_3
      23: aload_2
      24: invokeinterface #154,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      29: ifeq          114
      32: iload_3
      33: istore        4
      35: iload_3
      36: iconst_1
      37: iadd
      38: istore_3
      39: aload_2
      40: invokeinterface #158,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      45: checkcast     #72                 // class java/lang/String
      48: astore        5
      50: iconst_0
      51: istore        6
      53: aload         5
      55: invokevirtual #76                 // Method java/lang/String.length:()I
      58: istore        7
      60: iload         6
      62: iload         7
      64: if_icmpge     23
      67: iload         6
      69: istore        8
      71: aload         5
      73: iload         6
      75: invokevirtual #80                 // Method java/lang/String.charAt:(I)C
      78: istore        9
      80: iload         9
      82: bipush        35
      84: if_icmpne     108
      87: aload_1
      88: checkcast     #94                 // class java/util/Collection
      91: new           #160                // class day22/Point
      94: dup
      95: iload         8
      97: iload         4
      99: invokespecial #163                // Method day22/Point."<init>":(II)V
     102: invokeinterface #103,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     107: pop
     108: iinc          6, 1
     111: goto          60
     114: aload_1
     115: areturn

  private static final day22.Board parse(java.lang.String);
    Code:
       0: new           #172                // class java/io/File
       3: dup
       4: aload_0
       5: invokespecial #173                // Method java/io/File."<init>":(Ljava/lang/String;)V
       8: aconst_null
       9: iconst_1
      10: aconst_null
      11: invokestatic  #179                // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      14: astore_1
      15: iconst_0
      16: istore_2
      17: aload_1
      18: iconst_2
      19: invokestatic  #185                // Method kotlin/collections/CollectionsKt.dropLast:(Ljava/util/List;I)Ljava/util/List;
      22: invokestatic  #187                // Method toWalls:(Ljava/util/List;)Ljava/util/Set;
      25: astore_3
      26: aload_1
      27: invokestatic  #191                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      30: checkcast     #72                 // class java/lang/String
      33: invokestatic  #193                // Method toSteps:(Ljava/lang/String;)Ljava/util/List;
      36: astore        4
      38: new           #195                // class day22/Board
      41: dup
      42: aload_3
      43: aload         4
      45: invokespecial #198                // Method day22/Board."<init>":(Ljava/util/Set;Ljava/util/List;)V
      48: nop
      49: areturn

  private static final day22.Transition selectTransition(day22.Plane, day22.Facing);
    Code:
       0: aload_1
       1: astore_2
       2: aload_2
       3: instanceof    #205                // class day22/Facing$E
       6: ifeq          16
       9: aload_0
      10: invokevirtual #211                // Method day22/Plane.getTransitionToE:()Lday22/Transition;
      13: goto          66
      16: aload_2
      17: instanceof    #213                // class day22/Facing$S
      20: ifeq          30
      23: aload_0
      24: invokevirtual #216                // Method day22/Plane.getTransitionToS:()Lday22/Transition;
      27: goto          66
      30: aload_2
      31: instanceof    #218                // class day22/Facing$W
      34: ifeq          44
      37: aload_0
      38: invokevirtual #221                // Method day22/Plane.getTransitionToW:()Lday22/Transition;
      41: goto          66
      44: aload_2
      45: instanceof    #223                // class day22/Facing$N
      48: ifeq          58
      51: aload_0
      52: invokevirtual #226                // Method day22/Plane.getTransitionToN:()Lday22/Transition;
      55: goto          66
      58: new           #228                // class kotlin/NoWhenBranchMatchedException
      61: dup
      62: invokespecial #229                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      65: athrow
      66: areturn

  private static final int getMinX(day22.Plane);
    Code:
       0: aload_0
       1: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
       4: invokevirtual #246                // Method day22/Point.getX:()I
       7: ireturn

  private static final int getMaxX(day22.Plane);
    Code:
       0: aload_0
       1: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
       4: invokevirtual #246                // Method day22/Point.getX:()I
       7: bipush        50
       9: iadd
      10: iconst_1
      11: isub
      12: ireturn

  private static final int getMinY(day22.Plane);
    Code:
       0: aload_0
       1: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
       4: invokevirtual #253                // Method day22/Point.getY:()I
       7: ireturn

  private static final int getMaxY(day22.Plane);
    Code:
       0: aload_0
       1: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
       4: invokevirtual #253                // Method day22/Point.getY:()I
       7: bipush        50
       9: iadd
      10: iconst_1
      11: isub
      12: ireturn

  private static final boolean contains(day22.Plane, day22.Point);
    Code:
       0: aload_0
       1: ldc_w         #260                // String <this>
       4: invokestatic  #266                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokestatic  #268                // Method getMinX:(Lday22/Plane;)I
      11: istore_2
      12: aload_0
      13: invokestatic  #270                // Method getMaxX:(Lday22/Plane;)I
      16: istore_3
      17: aload_1
      18: invokevirtual #246                // Method day22/Point.getX:()I
      21: istore        4
      23: iload_2
      24: iload         4
      26: if_icmpgt     43
      29: iload         4
      31: iload_3
      32: if_icmpgt     39
      35: iconst_1
      36: goto          44
      39: iconst_0
      40: goto          44
      43: iconst_0
      44: ifeq          91
      47: aload_0
      48: invokestatic  #272                // Method getMinY:(Lday22/Plane;)I
      51: istore_2
      52: aload_0
      53: invokestatic  #274                // Method getMaxY:(Lday22/Plane;)I
      56: istore_3
      57: aload_1
      58: invokevirtual #253                // Method day22/Point.getY:()I
      61: istore        4
      63: iload_2
      64: iload         4
      66: if_icmpgt     83
      69: iload         4
      71: iload_3
      72: if_icmpgt     79
      75: iconst_1
      76: goto          84
      79: iconst_0
      80: goto          84
      83: iconst_0
      84: ifeq          91
      87: iconst_1
      88: goto          92
      91: iconst_0
      92: ireturn

  private static final day22.Point toLocal(day22.Point, day22.Plane);
    Code:
       0: new           #160                // class day22/Point
       3: dup
       4: aload_0
       5: invokevirtual #246                // Method day22/Point.getX:()I
       8: aload_1
       9: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
      12: invokevirtual #246                // Method day22/Point.getX:()I
      15: isub
      16: aload_0
      17: invokevirtual #253                // Method day22/Point.getY:()I
      20: aload_1
      21: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
      24: invokevirtual #253                // Method day22/Point.getY:()I
      27: isub
      28: invokespecial #163                // Method day22/Point."<init>":(II)V
      31: areturn

  private static final day22.Point toGlobal(day22.Point, day22.Plane);
    Code:
       0: new           #160                // class day22/Point
       3: dup
       4: aload_0
       5: invokevirtual #246                // Method day22/Point.getX:()I
       8: aload_1
       9: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
      12: invokevirtual #246                // Method day22/Point.getX:()I
      15: iadd
      16: aload_0
      17: invokevirtual #253                // Method day22/Point.getY:()I
      20: aload_1
      21: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
      24: invokevirtual #253                // Method day22/Point.getY:()I
      27: iadd
      28: invokespecial #163                // Method day22/Point."<init>":(II)V
      31: areturn

  private static final day22.Point flip(day22.Point);
    Code:
       0: new           #160                // class day22/Point
       3: dup
       4: aload_0
       5: invokevirtual #253                // Method day22/Point.getY:()I
       8: aload_0
       9: invokevirtual #246                // Method day22/Point.getX:()I
      12: invokespecial #163                // Method day22/Point."<init>":(II)V
      15: areturn

  private static final day22.Plane getSource(day22.Transition);
    Code:
       0: getstatic     #292                // Field planes:Ljava/util/Map;
       3: aload_0
       4: invokevirtual #295                // Method day22/Transition.getSourceId:()Ljava/lang/String;
       7: invokeinterface #301,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      12: checkcast     #207                // class day22/Plane
      15: dup
      16: ifnonnull     60
      19: pop
      20: new           #118                // class java/lang/IllegalStateException
      23: dup
      24: new           #39                 // class java/lang/StringBuilder
      27: dup
      28: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      31: ldc_w         #303                // String Plane \'
      34: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      37: aload_0
      38: invokevirtual #295                // Method day22/Transition.getSourceId:()Ljava/lang/String;
      41: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      44: ldc_w         #305                // String \' doesn\'t exist.
      47: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      50: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      53: invokevirtual #124                // Method java/lang/Object.toString:()Ljava/lang/String;
      56: invokespecial #127                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      59: athrow
      60: areturn

  private static final day22.Plane getTarget(day22.Transition);
    Code:
       0: getstatic     #292                // Field planes:Ljava/util/Map;
       3: aload_0
       4: invokevirtual #311                // Method day22/Transition.getTargetId:()Ljava/lang/String;
       7: invokeinterface #301,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      12: checkcast     #207                // class day22/Plane
      15: dup
      16: ifnonnull     60
      19: pop
      20: new           #118                // class java/lang/IllegalStateException
      23: dup
      24: new           #39                 // class java/lang/StringBuilder
      27: dup
      28: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      31: ldc_w         #303                // String Plane \'
      34: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      37: aload_0
      38: invokevirtual #311                // Method day22/Transition.getTargetId:()Ljava/lang/String;
      41: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      44: ldc_w         #305                // String \' doesn\'t exist.
      47: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      50: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      53: invokevirtual #124                // Method java/lang/Object.toString:()Ljava/lang/String;
      56: invokespecial #127                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      59: athrow
      60: areturn

  private static final day22.Point findPosition(day22.Transition, day22.Point);
    Code:
       0: aload_0
       1: invokevirtual #318                // Method day22/Transition.getSourceFacing:()Lday22/Facing;
       4: aload_0
       5: invokevirtual #321                // Method day22/Transition.getTargetFacing:()Lday22/Facing;
       8: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      11: astore_2
      12: aload_2
      13: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
      16: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
      19: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      22: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      25: ifeq          63
      28: new           #160                // class day22/Point
      31: dup
      32: aload_0
      33: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
      36: invokestatic  #268                // Method getMinX:(Lday22/Plane;)I
      39: aload_1
      40: aload_0
      41: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
      44: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
      47: aload_0
      48: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
      51: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
      54: invokevirtual #253                // Method day22/Point.getY:()I
      57: invokespecial #163                // Method day22/Point."<init>":(II)V
      60: goto          589
      63: aload_2
      64: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
      67: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
      70: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      73: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      76: ifeq          114
      79: new           #160                // class day22/Point
      82: dup
      83: aload_0
      84: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
      87: invokestatic  #270                // Method getMaxX:(Lday22/Plane;)I
      90: aload_1
      91: aload_0
      92: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
      95: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
      98: aload_0
      99: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     102: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     105: invokevirtual #253                // Method day22/Point.getY:()I
     108: invokespecial #163                // Method day22/Point."<init>":(II)V
     111: goto          589
     114: aload_2
     115: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     118: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     121: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     124: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     127: ifeq          165
     130: new           #160                // class day22/Point
     133: dup
     134: aload_1
     135: aload_0
     136: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     139: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     142: aload_0
     143: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     146: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     149: invokevirtual #246                // Method day22/Point.getX:()I
     152: aload_0
     153: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     156: invokestatic  #272                // Method getMinY:(Lday22/Plane;)I
     159: invokespecial #163                // Method day22/Point."<init>":(II)V
     162: goto          589
     165: aload_2
     166: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     169: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     172: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     175: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     178: ifeq          216
     181: new           #160                // class day22/Point
     184: dup
     185: aload_1
     186: aload_0
     187: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     190: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     193: aload_0
     194: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     197: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     200: invokevirtual #246                // Method day22/Point.getX:()I
     203: aload_0
     204: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     207: invokestatic  #274                // Method getMaxY:(Lday22/Plane;)I
     210: invokespecial #163                // Method day22/Point."<init>":(II)V
     213: goto          589
     216: aload_2
     217: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     220: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     223: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     226: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     229: ifeq          270
     232: new           #160                // class day22/Point
     235: dup
     236: aload_0
     237: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     240: invokestatic  #268                // Method getMinX:(Lday22/Plane;)I
     243: aload_1
     244: aload_0
     245: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     248: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     251: invokestatic  #353                // Method flip:(Lday22/Point;)Lday22/Point;
     254: aload_0
     255: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     258: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     261: invokevirtual #253                // Method day22/Point.getY:()I
     264: invokespecial #163                // Method day22/Point."<init>":(II)V
     267: goto          589
     270: aload_2
     271: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     274: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     277: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     280: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     283: ifeq          324
     286: new           #160                // class day22/Point
     289: dup
     290: aload_0
     291: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     294: invokestatic  #270                // Method getMaxX:(Lday22/Plane;)I
     297: aload_1
     298: aload_0
     299: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     302: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     305: invokestatic  #353                // Method flip:(Lday22/Point;)Lday22/Point;
     308: aload_0
     309: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     312: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     315: invokevirtual #253                // Method day22/Point.getY:()I
     318: invokespecial #163                // Method day22/Point."<init>":(II)V
     321: goto          589
     324: aload_2
     325: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     328: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     331: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     334: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     337: ifeq          376
     340: new           #160                // class day22/Point
     343: dup
     344: aload_0
     345: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     348: invokestatic  #268                // Method getMinX:(Lday22/Plane;)I
     351: aload_0
     352: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     355: invokestatic  #274                // Method getMaxY:(Lday22/Plane;)I
     358: aload_1
     359: aload_0
     360: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     363: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     366: invokevirtual #253                // Method day22/Point.getY:()I
     369: isub
     370: invokespecial #163                // Method day22/Point."<init>":(II)V
     373: goto          589
     376: aload_2
     377: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     380: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     383: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     386: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     389: ifeq          428
     392: new           #160                // class day22/Point
     395: dup
     396: aload_0
     397: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     400: invokestatic  #270                // Method getMaxX:(Lday22/Plane;)I
     403: aload_0
     404: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     407: invokestatic  #274                // Method getMaxY:(Lday22/Plane;)I
     410: aload_1
     411: aload_0
     412: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     415: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     418: invokevirtual #253                // Method day22/Point.getY:()I
     421: isub
     422: invokespecial #163                // Method day22/Point."<init>":(II)V
     425: goto          589
     428: aload_2
     429: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     432: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     435: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     438: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     441: ifeq          482
     444: new           #160                // class day22/Point
     447: dup
     448: aload_1
     449: aload_0
     450: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     453: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     456: invokestatic  #353                // Method flip:(Lday22/Point;)Lday22/Point;
     459: aload_0
     460: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     463: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     466: invokevirtual #246                // Method day22/Point.getX:()I
     469: aload_0
     470: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     473: invokestatic  #272                // Method getMinY:(Lday22/Plane;)I
     476: invokespecial #163                // Method day22/Point."<init>":(II)V
     479: goto          589
     482: aload_2
     483: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     486: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     489: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     492: invokestatic  #334                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     495: ifeq          536
     498: new           #160                // class day22/Point
     501: dup
     502: aload_1
     503: aload_0
     504: invokestatic  #338                // Method getSource:(Lday22/Transition;)Lday22/Plane;
     507: invokestatic  #340                // Method toLocal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     510: invokestatic  #353                // Method flip:(Lday22/Point;)Lday22/Point;
     513: aload_0
     514: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     517: invokestatic  #342                // Method toGlobal:(Lday22/Point;Lday22/Plane;)Lday22/Point;
     520: invokevirtual #246                // Method day22/Point.getX:()I
     523: aload_0
     524: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     527: invokestatic  #274                // Method getMaxY:(Lday22/Plane;)I
     530: invokespecial #163                // Method day22/Point."<init>":(II)V
     533: goto          589
     536: new           #118                // class java/lang/IllegalStateException
     539: dup
     540: new           #39                 // class java/lang/StringBuilder
     543: dup
     544: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
     547: ldc_w         #355                // String Transition from
     550: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     553: aload_0
     554: invokevirtual #318                // Method day22/Transition.getSourceFacing:()Lday22/Facing;
     557: invokevirtual #358                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     560: ldc_w         #360                // String  to
     563: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     566: aload_0
     567: invokevirtual #321                // Method day22/Transition.getTargetFacing:()Lday22/Facing;
     570: invokevirtual #358                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     573: ldc_w         #362                // String  isn\'t defined.
     576: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     579: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     582: invokevirtual #124                // Method java/lang/Object.toString:()Ljava/lang/String;
     585: invokespecial #127                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     588: athrow
     589: areturn

  private static final day22.Point toOffset(day22.Facing);
    Code:
       0: aload_0
       1: astore_1
       2: aload_1
       3: instanceof    #205                // class day22/Facing$E
       6: ifeq          21
       9: new           #160                // class day22/Point
      12: dup
      13: iconst_1
      14: iconst_0
      15: invokespecial #163                // Method day22/Point."<init>":(II)V
      18: goto          86
      21: aload_1
      22: instanceof    #213                // class day22/Facing$S
      25: ifeq          40
      28: new           #160                // class day22/Point
      31: dup
      32: iconst_0
      33: iconst_1
      34: invokespecial #163                // Method day22/Point."<init>":(II)V
      37: goto          86
      40: aload_1
      41: instanceof    #218                // class day22/Facing$W
      44: ifeq          59
      47: new           #160                // class day22/Point
      50: dup
      51: iconst_m1
      52: iconst_0
      53: invokespecial #163                // Method day22/Point."<init>":(II)V
      56: goto          86
      59: aload_1
      60: instanceof    #223                // class day22/Facing$N
      63: ifeq          78
      66: new           #160                // class day22/Point
      69: dup
      70: iconst_0
      71: iconst_m1
      72: invokespecial #163                // Method day22/Point."<init>":(II)V
      75: goto          86
      78: new           #228                // class kotlin/NoWhenBranchMatchedException
      81: dup
      82: invokespecial #229                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      85: athrow
      86: areturn

  private static final int toValue(day22.Facing);
    Code:
       0: aload_0
       1: astore_1
       2: aload_1
       3: instanceof    #205                // class day22/Facing$E
       6: ifeq          13
       9: iconst_0
      10: goto          54
      13: aload_1
      14: instanceof    #213                // class day22/Facing$S
      17: ifeq          24
      20: iconst_1
      21: goto          54
      24: aload_1
      25: instanceof    #218                // class day22/Facing$W
      28: ifeq          35
      31: iconst_2
      32: goto          54
      35: aload_1
      36: instanceof    #223                // class day22/Facing$N
      39: ifeq          46
      42: iconst_3
      43: goto          54
      46: new           #228                // class kotlin/NoWhenBranchMatchedException
      49: dup
      50: invokespecial #229                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      53: athrow
      54: ireturn

  private static final int solve(day22.Board, java.lang.String);
    Code:
       0: aload_0
       1: invokevirtual #378                // Method day22/Board.component1:()Ljava/util/Set;
       4: astore_2
       5: aload_0
       6: invokevirtual #382                // Method day22/Board.component2:()Ljava/util/List;
       9: astore_3
      10: getstatic     #292                // Field planes:Ljava/util/Map;
      13: aload_1
      14: invokeinterface #301,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      19: checkcast     #207                // class day22/Plane
      22: dup
      23: ifnonnull     64
      26: pop
      27: new           #118                // class java/lang/IllegalStateException
      30: dup
      31: new           #39                 // class java/lang/StringBuilder
      34: dup
      35: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
      38: ldc_w         #303                // String Plane \'
      41: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      44: aload_1
      45: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      48: ldc_w         #305                // String \' doesn\'t exist.
      51: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      54: invokevirtual #55                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      57: invokevirtual #124                // Method java/lang/Object.toString:()Ljava/lang/String;
      60: invokespecial #127                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      63: athrow
      64: astore        4
      66: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
      69: checkcast     #235                // class day22/Facing
      72: astore        5
      74: aload         4
      76: invokevirtual #243                // Method day22/Plane.getTopLeft:()Lday22/Point;
      79: astore        6
      81: aload_3
      82: invokeinterface #383,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      87: astore        7
      89: aload         7
      91: invokeinterface #154,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      96: ifeq          326
      99: aload         7
     101: invokeinterface #158,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     106: checkcast     #111                // class day22/Step
     109: astore        8
     111: aload         8
     113: astore        9
     115: aload         9
     117: instanceof    #113                // class day22/Step$TurnLeft
     120: ifeq          135
     123: aload         5
     125: invokeinterface #386,  1          // InterfaceMethod day22/Facing.turnLeft:()Lday22/Facing;
     130: astore        5
     132: goto          89
     135: aload         9
     137: instanceof    #105                // class day22/Step$TurnRight
     140: ifeq          155
     143: aload         5
     145: invokeinterface #389,  1          // InterfaceMethod day22/Facing.turnRight:()Lday22/Facing;
     150: astore        5
     152: goto          89
     155: aload         9
     157: instanceof    #96                 // class day22/Step$Move
     160: ifeq          318
     163: iconst_1
     164: istore        10
     166: aload         8
     168: checkcast     #96                 // class day22/Step$Move
     171: invokevirtual #392                // Method day22/Step$Move.getCount:()I
     174: istore        11
     176: iload         10
     178: iload         11
     180: if_icmpgt     89
     183: aload         5
     185: invokestatic  #394                // Method toOffset:(Lday22/Facing;)Lday22/Point;
     188: astore        12
     190: aload         12
     192: invokevirtual #396                // Method day22/Point.component1:()I
     195: istore        13
     197: aload         12
     199: invokevirtual #398                // Method day22/Point.component2:()I
     202: istore        14
     204: aload         5
     206: astore        15
     208: new           #160                // class day22/Point
     211: dup
     212: aload         6
     214: invokevirtual #246                // Method day22/Point.getX:()I
     217: iload         13
     219: iadd
     220: aload         6
     222: invokevirtual #253                // Method day22/Point.getY:()I
     225: iload         14
     227: iadd
     228: invokespecial #163                // Method day22/Point."<init>":(II)V
     231: astore        16
     233: aload         4
     235: astore        17
     237: aload         4
     239: aload         16
     241: invokestatic  #400                // Method contains:(Lday22/Plane;Lday22/Point;)Z
     244: ifne          279
     247: aload         4
     249: aload         5
     251: invokestatic  #402                // Method selectTransition:(Lday22/Plane;Lday22/Facing;)Lday22/Transition;
     254: astore        18
     256: aload         18
     258: invokevirtual #321                // Method day22/Transition.getTargetFacing:()Lday22/Facing;
     261: astore        15
     263: aload         18
     265: aload         6
     267: invokestatic  #404                // Method findPosition:(Lday22/Transition;Lday22/Point;)Lday22/Point;
     270: astore        16
     272: aload         18
     274: invokestatic  #336                // Method getTarget:(Lday22/Transition;)Lday22/Plane;
     277: astore        17
     279: aload_2
     280: aload         16
     282: invokeinterface #406,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     287: ifeq          293
     290: goto          89
     293: aload         15
     295: astore        5
     297: aload         16
     299: astore        6
     301: aload         17
     303: astore        4
     305: iload         10
     307: iload         11
     309: if_icmpeq     89
     312: iinc          10, 1
     315: goto          183
     318: new           #228                // class kotlin/NoWhenBranchMatchedException
     321: dup
     322: invokespecial #229                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     325: athrow
     326: sipush        1000
     329: aload         6
     331: invokevirtual #253                // Method day22/Point.getY:()I
     334: iconst_1
     335: iadd
     336: imul
     337: iconst_4
     338: aload         6
     340: invokevirtual #246                // Method day22/Point.getX:()I
     343: iconst_1
     344: iadd
     345: imul
     346: iadd
     347: aload         5
     349: invokestatic  #408                // Method toValue:(Lday22/Facing;)I
     352: iadd
     353: ireturn

  private static final int part1(day22.Board);
    Code:
       0: aload_0
       1: ldc_w         #420                // String A1
       4: invokestatic  #422                // Method solve:(Lday22/Board;Ljava/lang/String;)I
       7: ireturn

  private static final int part2(day22.Board);
    Code:
       0: aload_0
       1: ldc_w         #424                // String B1
       4: invokestatic  #422                // Method solve:(Lday22/Board;Ljava/lang/String;)I
       7: ireturn

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

  static {};
    Code:
       0: bipush        12
       2: anewarray     #366                // class kotlin/Pair
       5: astore_0
       6: aload_0
       7: iconst_0
       8: ldc_w         #420                // String A1
      11: new           #207                // class day22/Plane
      14: dup
      15: new           #160                // class day22/Point
      18: dup
      19: bipush        50
      21: iconst_0
      22: invokespecial #163                // Method day22/Point."<init>":(II)V
      25: new           #237                // class day22/Transition
      28: dup
      29: ldc_w         #420                // String A1
      32: ldc_w         #432                // String A2
      35: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
      38: checkcast     #235                // class day22/Facing
      41: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
      44: checkcast     #235                // class day22/Facing
      47: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
      50: new           #237                // class day22/Transition
      53: dup
      54: ldc_w         #420                // String A1
      57: ldc_w         #437                // String A3
      60: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
      63: checkcast     #235                // class day22/Facing
      66: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
      69: checkcast     #235                // class day22/Facing
      72: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
      75: new           #237                // class day22/Transition
      78: dup
      79: ldc_w         #420                // String A1
      82: ldc_w         #432                // String A2
      85: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
      88: checkcast     #235                // class day22/Facing
      91: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
      94: checkcast     #235                // class day22/Facing
      97: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     100: new           #237                // class day22/Transition
     103: dup
     104: ldc_w         #420                // String A1
     107: ldc_w         #439                // String A5
     110: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     113: checkcast     #235                // class day22/Facing
     116: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     119: checkcast     #235                // class day22/Facing
     122: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     125: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     128: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     131: aastore
     132: aload_0
     133: iconst_1
     134: ldc_w         #432                // String A2
     137: new           #207                // class day22/Plane
     140: dup
     141: new           #160                // class day22/Point
     144: dup
     145: bipush        100
     147: iconst_0
     148: invokespecial #163                // Method day22/Point."<init>":(II)V
     151: new           #237                // class day22/Transition
     154: dup
     155: ldc_w         #432                // String A2
     158: ldc_w         #420                // String A1
     161: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     164: checkcast     #235                // class day22/Facing
     167: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     170: checkcast     #235                // class day22/Facing
     173: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     176: new           #237                // class day22/Transition
     179: dup
     180: ldc_w         #432                // String A2
     183: ldc_w         #432                // String A2
     186: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     189: checkcast     #235                // class day22/Facing
     192: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     195: checkcast     #235                // class day22/Facing
     198: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     201: new           #237                // class day22/Transition
     204: dup
     205: ldc_w         #432                // String A2
     208: ldc_w         #420                // String A1
     211: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     214: checkcast     #235                // class day22/Facing
     217: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     220: checkcast     #235                // class day22/Facing
     223: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     226: new           #237                // class day22/Transition
     229: dup
     230: ldc_w         #432                // String A2
     233: ldc_w         #432                // String A2
     236: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     239: checkcast     #235                // class day22/Facing
     242: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     245: checkcast     #235                // class day22/Facing
     248: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     251: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     254: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     257: aastore
     258: aload_0
     259: iconst_2
     260: ldc_w         #437                // String A3
     263: new           #207                // class day22/Plane
     266: dup
     267: new           #160                // class day22/Point
     270: dup
     271: bipush        50
     273: bipush        50
     275: invokespecial #163                // Method day22/Point."<init>":(II)V
     278: new           #237                // class day22/Transition
     281: dup
     282: ldc_w         #437                // String A3
     285: ldc_w         #437                // String A3
     288: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     291: checkcast     #235                // class day22/Facing
     294: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     297: checkcast     #235                // class day22/Facing
     300: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     303: new           #237                // class day22/Transition
     306: dup
     307: ldc_w         #437                // String A3
     310: ldc_w         #439                // String A5
     313: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     316: checkcast     #235                // class day22/Facing
     319: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     322: checkcast     #235                // class day22/Facing
     325: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     328: new           #237                // class day22/Transition
     331: dup
     332: ldc_w         #437                // String A3
     335: ldc_w         #437                // String A3
     338: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     341: checkcast     #235                // class day22/Facing
     344: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     347: checkcast     #235                // class day22/Facing
     350: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     353: new           #237                // class day22/Transition
     356: dup
     357: ldc_w         #437                // String A3
     360: ldc_w         #420                // String A1
     363: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     366: checkcast     #235                // class day22/Facing
     369: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     372: checkcast     #235                // class day22/Facing
     375: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     378: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     381: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     384: aastore
     385: aload_0
     386: iconst_3
     387: ldc_w         #444                // String A4
     390: new           #207                // class day22/Plane
     393: dup
     394: new           #160                // class day22/Point
     397: dup
     398: iconst_0
     399: bipush        100
     401: invokespecial #163                // Method day22/Point."<init>":(II)V
     404: new           #237                // class day22/Transition
     407: dup
     408: ldc_w         #444                // String A4
     411: ldc_w         #439                // String A5
     414: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     417: checkcast     #235                // class day22/Facing
     420: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     423: checkcast     #235                // class day22/Facing
     426: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     429: new           #237                // class day22/Transition
     432: dup
     433: ldc_w         #444                // String A4
     436: ldc_w         #446                // String A6
     439: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     442: checkcast     #235                // class day22/Facing
     445: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     448: checkcast     #235                // class day22/Facing
     451: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     454: new           #237                // class day22/Transition
     457: dup
     458: ldc_w         #444                // String A4
     461: ldc_w         #439                // String A5
     464: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     467: checkcast     #235                // class day22/Facing
     470: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     473: checkcast     #235                // class day22/Facing
     476: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     479: new           #237                // class day22/Transition
     482: dup
     483: ldc_w         #444                // String A4
     486: ldc_w         #446                // String A6
     489: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     492: checkcast     #235                // class day22/Facing
     495: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     498: checkcast     #235                // class day22/Facing
     501: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     504: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     507: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     510: aastore
     511: aload_0
     512: iconst_4
     513: ldc_w         #439                // String A5
     516: new           #207                // class day22/Plane
     519: dup
     520: new           #160                // class day22/Point
     523: dup
     524: bipush        50
     526: bipush        100
     528: invokespecial #163                // Method day22/Point."<init>":(II)V
     531: new           #237                // class day22/Transition
     534: dup
     535: ldc_w         #439                // String A5
     538: ldc_w         #444                // String A4
     541: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     544: checkcast     #235                // class day22/Facing
     547: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     550: checkcast     #235                // class day22/Facing
     553: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     556: new           #237                // class day22/Transition
     559: dup
     560: ldc_w         #439                // String A5
     563: ldc_w         #420                // String A1
     566: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     569: checkcast     #235                // class day22/Facing
     572: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     575: checkcast     #235                // class day22/Facing
     578: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     581: new           #237                // class day22/Transition
     584: dup
     585: ldc_w         #439                // String A5
     588: ldc_w         #444                // String A4
     591: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     594: checkcast     #235                // class day22/Facing
     597: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     600: checkcast     #235                // class day22/Facing
     603: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     606: new           #237                // class day22/Transition
     609: dup
     610: ldc_w         #439                // String A5
     613: ldc_w         #437                // String A3
     616: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     619: checkcast     #235                // class day22/Facing
     622: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     625: checkcast     #235                // class day22/Facing
     628: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     631: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     634: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     637: aastore
     638: aload_0
     639: iconst_5
     640: ldc_w         #446                // String A6
     643: new           #207                // class day22/Plane
     646: dup
     647: new           #160                // class day22/Point
     650: dup
     651: iconst_0
     652: sipush        150
     655: invokespecial #163                // Method day22/Point."<init>":(II)V
     658: new           #237                // class day22/Transition
     661: dup
     662: ldc_w         #446                // String A6
     665: ldc_w         #446                // String A6
     668: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     671: checkcast     #235                // class day22/Facing
     674: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     677: checkcast     #235                // class day22/Facing
     680: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     683: new           #237                // class day22/Transition
     686: dup
     687: ldc_w         #446                // String A6
     690: ldc_w         #444                // String A4
     693: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     696: checkcast     #235                // class day22/Facing
     699: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     702: checkcast     #235                // class day22/Facing
     705: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     708: new           #237                // class day22/Transition
     711: dup
     712: ldc_w         #446                // String A6
     715: ldc_w         #446                // String A6
     718: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     721: checkcast     #235                // class day22/Facing
     724: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     727: checkcast     #235                // class day22/Facing
     730: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     733: new           #237                // class day22/Transition
     736: dup
     737: ldc_w         #446                // String A6
     740: ldc_w         #444                // String A4
     743: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     746: checkcast     #235                // class day22/Facing
     749: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     752: checkcast     #235                // class day22/Facing
     755: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     758: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     761: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     764: aastore
     765: aload_0
     766: bipush        6
     768: ldc_w         #424                // String B1
     771: new           #207                // class day22/Plane
     774: dup
     775: new           #160                // class day22/Point
     778: dup
     779: bipush        50
     781: iconst_0
     782: invokespecial #163                // Method day22/Point."<init>":(II)V
     785: new           #237                // class day22/Transition
     788: dup
     789: ldc_w         #424                // String B1
     792: ldc_w         #448                // String B2
     795: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     798: checkcast     #235                // class day22/Facing
     801: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     804: checkcast     #235                // class day22/Facing
     807: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     810: new           #237                // class day22/Transition
     813: dup
     814: ldc_w         #424                // String B1
     817: ldc_w         #450                // String B3
     820: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     823: checkcast     #235                // class day22/Facing
     826: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     829: checkcast     #235                // class day22/Facing
     832: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     835: new           #237                // class day22/Transition
     838: dup
     839: ldc_w         #424                // String B1
     842: ldc_w         #452                // String B4
     845: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     848: checkcast     #235                // class day22/Facing
     851: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     854: checkcast     #235                // class day22/Facing
     857: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     860: new           #237                // class day22/Transition
     863: dup
     864: ldc_w         #424                // String B1
     867: ldc_w         #454                // String B6
     870: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
     873: checkcast     #235                // class day22/Facing
     876: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     879: checkcast     #235                // class day22/Facing
     882: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     885: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
     888: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     891: aastore
     892: aload_0
     893: bipush        7
     895: ldc_w         #448                // String B2
     898: new           #207                // class day22/Plane
     901: dup
     902: new           #160                // class day22/Point
     905: dup
     906: bipush        100
     908: iconst_0
     909: invokespecial #163                // Method day22/Point."<init>":(II)V
     912: new           #237                // class day22/Transition
     915: dup
     916: ldc_w         #448                // String B2
     919: ldc_w         #456                // String B5
     922: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
     925: checkcast     #235                // class day22/Facing
     928: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     931: checkcast     #235                // class day22/Facing
     934: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     937: new           #237                // class day22/Transition
     940: dup
     941: ldc_w         #448                // String B2
     944: ldc_w         #450                // String B3
     947: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
     950: checkcast     #235                // class day22/Facing
     953: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     956: checkcast     #235                // class day22/Facing
     959: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     962: new           #237                // class day22/Transition
     965: dup
     966: ldc_w         #448                // String B2
     969: ldc_w         #424                // String B1
     972: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     975: checkcast     #235                // class day22/Facing
     978: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
     981: checkcast     #235                // class day22/Facing
     984: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
     987: new           #237                // class day22/Transition
     990: dup
     991: ldc_w         #448                // String B2
     994: ldc_w         #454                // String B6
     997: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1000: checkcast     #235                // class day22/Facing
    1003: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1006: checkcast     #235                // class day22/Facing
    1009: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1012: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
    1015: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1018: aastore
    1019: aload_0
    1020: bipush        8
    1022: ldc_w         #450                // String B3
    1025: new           #207                // class day22/Plane
    1028: dup
    1029: new           #160                // class day22/Point
    1032: dup
    1033: bipush        50
    1035: bipush        50
    1037: invokespecial #163                // Method day22/Point."<init>":(II)V
    1040: new           #237                // class day22/Transition
    1043: dup
    1044: ldc_w         #450                // String B3
    1047: ldc_w         #448                // String B2
    1050: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1053: checkcast     #235                // class day22/Facing
    1056: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1059: checkcast     #235                // class day22/Facing
    1062: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1065: new           #237                // class day22/Transition
    1068: dup
    1069: ldc_w         #450                // String B3
    1072: ldc_w         #456                // String B5
    1075: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1078: checkcast     #235                // class day22/Facing
    1081: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1084: checkcast     #235                // class day22/Facing
    1087: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1090: new           #237                // class day22/Transition
    1093: dup
    1094: ldc_w         #450                // String B3
    1097: ldc_w         #452                // String B4
    1100: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1103: checkcast     #235                // class day22/Facing
    1106: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1109: checkcast     #235                // class day22/Facing
    1112: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1115: new           #237                // class day22/Transition
    1118: dup
    1119: ldc_w         #450                // String B3
    1122: ldc_w         #424                // String B1
    1125: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1128: checkcast     #235                // class day22/Facing
    1131: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1134: checkcast     #235                // class day22/Facing
    1137: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1140: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
    1143: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1146: aastore
    1147: aload_0
    1148: bipush        9
    1150: ldc_w         #452                // String B4
    1153: new           #207                // class day22/Plane
    1156: dup
    1157: new           #160                // class day22/Point
    1160: dup
    1161: iconst_0
    1162: bipush        100
    1164: invokespecial #163                // Method day22/Point."<init>":(II)V
    1167: new           #237                // class day22/Transition
    1170: dup
    1171: ldc_w         #452                // String B4
    1174: ldc_w         #456                // String B5
    1177: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1180: checkcast     #235                // class day22/Facing
    1183: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1186: checkcast     #235                // class day22/Facing
    1189: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1192: new           #237                // class day22/Transition
    1195: dup
    1196: ldc_w         #452                // String B4
    1199: ldc_w         #454                // String B6
    1202: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1205: checkcast     #235                // class day22/Facing
    1208: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1211: checkcast     #235                // class day22/Facing
    1214: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1217: new           #237                // class day22/Transition
    1220: dup
    1221: ldc_w         #452                // String B4
    1224: ldc_w         #424                // String B1
    1227: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1230: checkcast     #235                // class day22/Facing
    1233: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1236: checkcast     #235                // class day22/Facing
    1239: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1242: new           #237                // class day22/Transition
    1245: dup
    1246: ldc_w         #452                // String B4
    1249: ldc_w         #450                // String B3
    1252: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1255: checkcast     #235                // class day22/Facing
    1258: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1261: checkcast     #235                // class day22/Facing
    1264: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1267: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
    1270: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1273: aastore
    1274: aload_0
    1275: bipush        10
    1277: ldc_w         #456                // String B5
    1280: new           #207                // class day22/Plane
    1283: dup
    1284: new           #160                // class day22/Point
    1287: dup
    1288: bipush        50
    1290: bipush        100
    1292: invokespecial #163                // Method day22/Point."<init>":(II)V
    1295: new           #237                // class day22/Transition
    1298: dup
    1299: ldc_w         #456                // String B5
    1302: ldc_w         #448                // String B2
    1305: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1308: checkcast     #235                // class day22/Facing
    1311: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1314: checkcast     #235                // class day22/Facing
    1317: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1320: new           #237                // class day22/Transition
    1323: dup
    1324: ldc_w         #456                // String B5
    1327: ldc_w         #454                // String B6
    1330: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1333: checkcast     #235                // class day22/Facing
    1336: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1339: checkcast     #235                // class day22/Facing
    1342: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1345: new           #237                // class day22/Transition
    1348: dup
    1349: ldc_w         #456                // String B5
    1352: ldc_w         #452                // String B4
    1355: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1358: checkcast     #235                // class day22/Facing
    1361: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1364: checkcast     #235                // class day22/Facing
    1367: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1370: new           #237                // class day22/Transition
    1373: dup
    1374: ldc_w         #456                // String B5
    1377: ldc_w         #450                // String B3
    1380: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1383: checkcast     #235                // class day22/Facing
    1386: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1389: checkcast     #235                // class day22/Facing
    1392: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1395: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
    1398: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1401: aastore
    1402: aload_0
    1403: bipush        11
    1405: ldc_w         #454                // String B6
    1408: new           #207                // class day22/Plane
    1411: dup
    1412: new           #160                // class day22/Point
    1415: dup
    1416: iconst_0
    1417: sipush        150
    1420: invokespecial #163                // Method day22/Point."<init>":(II)V
    1423: new           #237                // class day22/Transition
    1426: dup
    1427: ldc_w         #454                // String B6
    1430: ldc_w         #456                // String B5
    1433: getstatic     #330                // Field day22/Facing$E.INSTANCE:Lday22/Facing$E;
    1436: checkcast     #235                // class day22/Facing
    1439: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1442: checkcast     #235                // class day22/Facing
    1445: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1448: new           #237                // class day22/Transition
    1451: dup
    1452: ldc_w         #454                // String B6
    1455: ldc_w         #448                // String B2
    1458: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1461: checkcast     #235                // class day22/Facing
    1464: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1467: checkcast     #235                // class day22/Facing
    1470: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1473: new           #237                // class day22/Transition
    1476: dup
    1477: ldc_w         #454                // String B6
    1480: ldc_w         #424                // String B1
    1483: getstatic     #345                // Field day22/Facing$W.INSTANCE:Lday22/Facing$W;
    1486: checkcast     #235                // class day22/Facing
    1489: getstatic     #348                // Field day22/Facing$S.INSTANCE:Lday22/Facing$S;
    1492: checkcast     #235                // class day22/Facing
    1495: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1498: new           #237                // class day22/Transition
    1501: dup
    1502: ldc_w         #454                // String B6
    1505: ldc_w         #452                // String B4
    1508: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1511: checkcast     #235                // class day22/Facing
    1514: getstatic     #351                // Field day22/Facing$N.INSTANCE:Lday22/Facing$N;
    1517: checkcast     #235                // class day22/Facing
    1520: invokespecial #435                // Method day22/Transition."<init>":(Ljava/lang/String;Ljava/lang/String;Lday22/Facing;Lday22/Facing;)V
    1523: invokespecial #442                // Method day22/Plane."<init>":(Lday22/Point;Lday22/Transition;Lday22/Transition;Lday22/Transition;Lday22/Transition;)V
    1526: invokestatic  #327                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
    1529: aastore
    1530: aload_0
    1531: invokestatic  #462                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
    1534: putstatic     #292                // Field planes:Ljava/util/Map;
    1537: return
}