package day22

import Point
import day22.Direction.DOWN
import day22.Direction.LEFT
import day22.Direction.RIGHT
import day22.Direction.UP
import readInput

typealias Board = Map<Point, Char>

const val WALL = '#'
const val OPEN = '.'

fun main() {
    val input = readInput("main/day22/Day22")

    println(part1(input))
    println(part2(input))
}

fun part1(input: List<String>): Int {
    val board = input.parseBoard()
    val directions = input.readDirections()

    var currentDirection = RIGHT
    var position = board.filter { it.key.y == 1 }.minBy { it.key.x }.key

    var index = 0
    while (index < directions.length) {
        var steps = ""
        while (index < directions.length && directions[index].isDigit()) {
            steps += directions[index]
            index++
        }
        val numSteps = steps.toInt()
        repeat(numSteps) {
            position = board.nextTileFrom(position, currentDirection)
        }
        if (index < directions.length) {
            currentDirection = if (directions[index] == 'L') currentDirection.left() else currentDirection.right()
            index++
        }
    }

    return position.y * 1000 + position.x * 4 + currentDirection.facing
}

fun part2(input: List<String>): Int {
    val board = input.parseBoard()
    val directions = input.readDirections()

    var currentDirection = RIGHT
    var position = board.filter { it.key.y == 1 }.minBy { it.key.x }.key

    var index = 0
    while (index < directions.length) {
        var steps = ""
        while (index < directions.length && directions[index].isDigit()) {
            steps += directions[index]
            index++
        }
        val numSteps = steps.toInt()
        repeat(numSteps) {
            val (pos, dir) = board.nextTileOnCubeFrom(position, currentDirection)
            position = pos
            currentDirection = dir
        }
        if (index < directions.length) {
            currentDirection = if (directions[index] == 'L') currentDirection.left() else currentDirection.right()
            index++
        }
    }

    return position.y * 1000 + position.x * 4 + currentDirection.facing
}

fun List<String>.parseBoard(): Board {
    val board = mutableMapOf<Point, Char>()
    this.takeWhile { it.isNotBlank() }.mapIndexed { y, line ->
        line.mapIndexed { x, c ->
            if (c == OPEN || c == WALL) board[Point(x + 1, y + 1)] = c
        }
    }
    return board
}

fun List<String>.readDirections() = this.dropLastWhile { it.isBlank() }.last()

fun Board.nextTileFrom(p: Point, direction: Direction): Point = when (direction) {
    UP -> {
        var next = Point(p.x, p.y - 1)
        if (this[next] == WALL) next = p
        if (this[next] == null) next = keys.filter { it.x == p.x }.maxBy { it.y }
        if (this[next] == WALL) next = p
        next
    }

    DOWN -> {
        var next = Point(p.x, p.y + 1)
        if (this[next] == WALL) next = p
        if (this[next] == null) next = keys.filter { it.x == p.x }.minBy { it.y }
        if (this[next] == WALL) next = p
        next
    }

    RIGHT -> {
        var next = Point(p.x + 1, p.y)
        if (this[next] == WALL) next = p
        if (this[next] == null) next = keys.filter { it.y == p.y }.minBy { it.x }
        if (this[next] == WALL) next = p
        next
    }

    LEFT -> {
        var next = Point(p.x - 1, p.y)
        if (this[next] == WALL) next = p
        if (this[next] == null) next = keys.filter { it.y == p.y }.maxBy { it.x }
        if (this[next] == WALL) next = p
        next
    }
}

fun Board.nextTileOnCubeFrom(p: Point, direction: Direction): Pair<Point, Direction> {
    return when (direction) {
        UP -> nextPositionAndDirection(Point(p.x, p.y - 1), p, direction)
        DOWN -> nextPositionAndDirection(Point(p.x, p.y + 1), p, direction)
        RIGHT -> nextPositionAndDirection(Point(p.x + 1, p.y), p, direction)
        LEFT -> nextPositionAndDirection(Point(p.x - 1, p.y), p, direction)
    }
}

private fun Board.nextPositionAndDirection(next: Point, p: Point, direction: Direction): Pair<Point, Direction> {
    var next1 = next
    var newDirection = direction
    if (this[next1] == WALL) next1 = p
    if (this[next1] == null) {
        val (pos, dir) = gotoNextSide(p, direction)
        next1 = pos
        newDirection = dir
    }
    if (this[next1] == WALL) {
        next1 = p
        newDirection = direction
    }
    return next1 to newDirection
}

private fun sideOf(pos: Point): Char {

    if (pos.x in 51..100 && pos.y in 1..50) return 'A'
    if (pos.x in 101..150 && pos.y in 1..50) return 'B'
    if (pos.x in 51..100 && pos.y in 51..100) return 'C'
    if (pos.x in 51..100 && pos.y in 101..150) return 'D'
    if (pos.x in 1..50 && pos.y in 101..150) return 'E'
    if (pos.x in 1..50 && pos.y in 151..200) return 'F'
    error("Side does not exist for $pos")
}

fun gotoNextSide(position: Point, direction: Direction): Pair<Point, Direction> {
    var nextDir = direction
    val side = sideOf(position)
    var nextPos = position
    val sideLength = 50
    if (side == 'A' && direction == UP) {
        nextDir = RIGHT
        nextPos = Point(1, 3 * sideLength + position.x - sideLength) // nextSide = F
    } else if (side == 'A' && direction == LEFT) {
        nextDir = RIGHT
        nextPos = Point(1, 2 * sideLength + (sideLength - position.y)) // nextSide = E
    } else if (side == 'B' && direction == UP) {
        nextDir = UP
        nextPos = Point(position.x - 2 * sideLength, 201) // nextSide = F
    } else if (side == 'B' && direction == RIGHT) {
        nextDir = LEFT
        nextPos = Point(101, (sideLength - position.y) + 2 * sideLength) // nextSide = D
    } else if (side == 'B' && direction == DOWN) {
        nextDir = LEFT
        nextPos = Point(101, sideLength + (position.x - 2 * sideLength)) // nextSide = C
    } else if (side == 'C' && direction == RIGHT) {
        nextDir = UP
        nextPos = Point((position.y - sideLength) + 2 * sideLength, sideLength) // nextSide = B
    } else if (side == 'C' && direction == LEFT) {
        nextDir = DOWN
        nextPos = Point(position.y - sideLength, 101) // nextSide = E
    } else if (side == 'E' && direction == LEFT) {
        nextDir = RIGHT
        nextPos = Point(51, sideLength - (position.y - 2 * sideLength)) // nextSide = 'A'
    } else if (side == 'E' && direction == UP) {
        nextDir = RIGHT
        nextPos = Point(51, sideLength + position.x) // nextSide = C
    } else if (side == 'D' && direction == DOWN) {
        nextDir = LEFT
        nextPos = Point(101, 3 * sideLength + (position.x - sideLength)) // nextSide = F
    } else if (side == 'D' && direction == RIGHT) {
        nextDir = LEFT
        nextPos = Point(151, sideLength - (position.y - sideLength * 2)) // nextSide = B
    } else if (side == 'F' && direction == RIGHT) {
        nextDir = UP
        nextPos = Point((position.y - 3 * sideLength) + sideLength, 151) // nextSide = D
    } else if (side == 'F' && direction == LEFT) {
        nextDir = DOWN
        nextPos = Point(sideLength + (position.y - 3 * sideLength), 1) // nextSide = 'A'
    } else if (side == 'F' && direction == DOWN) {
        nextDir = DOWN
        nextPos = Point(position.x + 2 * sideLength, 1) // nextSide = B
    }
    return nextPos to nextDir
}

enum class Direction(val facing: Int) {
    UP(3), DOWN(1), RIGHT(0), LEFT(2);

    fun right() = when (this) {
        UP -> RIGHT
        DOWN -> LEFT
        RIGHT -> DOWN
        LEFT -> UP
    }

    fun left() = when (this) {
        UP -> LEFT
        DOWN -> RIGHT
        RIGHT -> UP
        LEFT -> DOWN
    }
}

Compiled from "day22.kt"
public final class day22.Day22Kt {
  public static final char WALL;

  public static final char OPEN;

  public static final void main();
    Code:
       0: ldc           #8                  // String main/day22/Day22
       2: invokestatic  #14                 // Method UtilsKt.readInput:(Ljava/lang/String;)Ljava/util/List;
       5: astore_0
       6: aload_0
       7: invokestatic  #18                 // Method part1:(Ljava/util/List;)I
      10: istore_1
      11: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      14: iload_1
      15: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      18: aload_0
      19: invokestatic  #33                 // Method part2:(Ljava/util/List;)I
      22: istore_1
      23: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      26: iload_1
      27: invokevirtual #30                 // Method java/io/PrintStream.println:(I)V
      30: return

  public static final int part1(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #38                 // String input
       3: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #48                 // Method parseBoard:(Ljava/util/List;)Ljava/util/Map;
      10: astore_1
      11: aload_0
      12: invokestatic  #52                 // Method readDirections:(Ljava/util/List;)Ljava/lang/String;
      15: astore_2
      16: aconst_null
      17: astore_3
      18: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
      21: astore_3
      22: aconst_null
      23: astore        4
      25: aload_1
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         5
      33: astore        7
      35: new           #60                 // class java/util/LinkedHashMap
      38: dup
      39: invokespecial #63                 // Method java/util/LinkedHashMap."<init>":()V
      42: checkcast     #65                 // class java/util/Map
      45: astore        8
      47: iconst_0
      48: istore        9
      50: aload         7
      52: invokeinterface #69,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      57: invokeinterface #75,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      62: astore        10
      64: aload         10
      66: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      71: ifeq          143
      74: aload         10
      76: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      81: checkcast     #87                 // class java/util/Map$Entry
      84: astore        11
      86: aload         11
      88: astore        12
      90: iconst_0
      91: istore        13
      93: aload         12
      95: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     100: checkcast     #92                 // class Point
     103: invokevirtual #96                 // Method Point.getY:()I
     106: iconst_1
     107: if_icmpne     114
     110: iconst_1
     111: goto          115
     114: iconst_0
     115: ifeq          64
     118: aload         8
     120: aload         11
     122: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     127: aload         11
     129: invokeinterface #99,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     134: invokeinterface #103,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     139: pop
     140: goto          64
     143: aload         8
     145: nop
     146: invokeinterface #69,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     151: checkcast     #105                // class java/lang/Iterable
     154: astore        6
     156: aload         6
     158: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     163: astore        7
     165: aload         7
     167: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     172: ifne          183
     175: new           #108                // class java/util/NoSuchElementException
     178: dup
     179: invokespecial #109                // Method java/util/NoSuchElementException."<init>":()V
     182: athrow
     183: aload         7
     185: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     190: astore        8
     192: aload         7
     194: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     199: ifne          207
     202: aload         8
     204: goto          293
     207: aload         8
     209: checkcast     #87                 // class java/util/Map$Entry
     212: astore        9
     214: iconst_0
     215: istore        10
     217: aload         9
     219: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     224: checkcast     #92                 // class Point
     227: invokevirtual #112                // Method Point.getX:()I
     230: istore        9
     232: aload         7
     234: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     239: astore        10
     241: aload         10
     243: checkcast     #87                 // class java/util/Map$Entry
     246: astore        11
     248: iconst_0
     249: istore        12
     251: aload         11
     253: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     258: checkcast     #92                 // class Point
     261: invokevirtual #112                // Method Point.getX:()I
     264: istore        11
     266: iload         9
     268: iload         11
     270: if_icmple     281
     273: aload         10
     275: astore        8
     277: iload         11
     279: istore        9
     281: aload         7
     283: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     288: ifne          232
     291: aload         8
     293: checkcast     #87                 // class java/util/Map$Entry
     296: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     301: astore        4
     303: iconst_0
     304: istore        5
     306: iload         5
     308: aload_2
     309: invokevirtual #117                // Method java/lang/String.length:()I
     312: if_icmpge     453
     315: ldc           #119                // String
     317: astore        6
     319: iload         5
     321: aload_2
     322: invokevirtual #117                // Method java/lang/String.length:()I
     325: if_icmpge     372
     328: aload_2
     329: iload         5
     331: invokevirtual #123                // Method java/lang/String.charAt:(I)C
     334: invokestatic  #129                // Method java/lang/Character.isDigit:(C)Z
     337: ifeq          372
     340: new           #131                // class java/lang/StringBuilder
     343: dup
     344: invokespecial #132                // Method java/lang/StringBuilder."<init>":()V
     347: aload         6
     349: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     352: aload_2
     353: iload         5
     355: invokevirtual #123                // Method java/lang/String.charAt:(I)C
     358: invokevirtual #139                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     361: invokevirtual #143                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     364: astore        6
     366: iinc          5, 1
     369: goto          319
     372: aload         6
     374: invokestatic  #149                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     377: istore        7
     379: iconst_0
     380: istore        8
     382: iload         8
     384: iload         7
     386: if_icmpge     415
     389: iload         8
     391: istore        9
     393: iconst_0
     394: istore        10
     396: aload_1
     397: aload         4
     399: checkcast     #92                 // class Point
     402: aload_3
     403: invokestatic  #153                // Method nextTileFrom:(Ljava/util/Map;LPoint;Lday22/Direction;)LPoint;
     406: astore        4
     408: nop
     409: iinc          8, 1
     412: goto          382
     415: iload         5
     417: aload_2
     418: invokevirtual #117                // Method java/lang/String.length:()I
     421: if_icmpge     306
     424: aload_2
     425: iload         5
     427: invokevirtual #123                // Method java/lang/String.charAt:(I)C
     430: bipush        76
     432: if_icmpne     442
     435: aload_3
     436: invokevirtual #157                // Method day22/Direction.left:()Lday22/Direction;
     439: goto          446
     442: aload_3
     443: invokevirtual #160                // Method day22/Direction.right:()Lday22/Direction;
     446: astore_3
     447: iinc          5, 1
     450: goto          306
     453: aload         4
     455: checkcast     #92                 // class Point
     458: invokevirtual #96                 // Method Point.getY:()I
     461: sipush        1000
     464: imul
     465: aload         4
     467: checkcast     #92                 // class Point
     470: invokevirtual #112                // Method Point.getX:()I
     473: iconst_4
     474: imul
     475: iadd
     476: aload_3
     477: invokevirtual #163                // Method day22/Direction.getFacing:()I
     480: iadd
     481: ireturn

  public static final int part2(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #38                 // String input
       3: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokestatic  #48                 // Method parseBoard:(Ljava/util/List;)Ljava/util/Map;
      10: astore_1
      11: aload_0
      12: invokestatic  #52                 // Method readDirections:(Ljava/util/List;)Ljava/lang/String;
      15: astore_2
      16: aconst_null
      17: astore_3
      18: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
      21: astore_3
      22: aconst_null
      23: astore        4
      25: aload_1
      26: astore        5
      28: iconst_0
      29: istore        6
      31: aload         5
      33: astore        7
      35: new           #60                 // class java/util/LinkedHashMap
      38: dup
      39: invokespecial #63                 // Method java/util/LinkedHashMap."<init>":()V
      42: checkcast     #65                 // class java/util/Map
      45: astore        8
      47: iconst_0
      48: istore        9
      50: aload         7
      52: invokeinterface #69,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      57: invokeinterface #75,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      62: astore        10
      64: aload         10
      66: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      71: ifeq          143
      74: aload         10
      76: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      81: checkcast     #87                 // class java/util/Map$Entry
      84: astore        11
      86: aload         11
      88: astore        12
      90: iconst_0
      91: istore        13
      93: aload         12
      95: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     100: checkcast     #92                 // class Point
     103: invokevirtual #96                 // Method Point.getY:()I
     106: iconst_1
     107: if_icmpne     114
     110: iconst_1
     111: goto          115
     114: iconst_0
     115: ifeq          64
     118: aload         8
     120: aload         11
     122: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     127: aload         11
     129: invokeinterface #99,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     134: invokeinterface #103,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     139: pop
     140: goto          64
     143: aload         8
     145: nop
     146: invokeinterface #69,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     151: checkcast     #105                // class java/lang/Iterable
     154: astore        6
     156: aload         6
     158: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     163: astore        7
     165: aload         7
     167: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     172: ifne          183
     175: new           #108                // class java/util/NoSuchElementException
     178: dup
     179: invokespecial #109                // Method java/util/NoSuchElementException."<init>":()V
     182: athrow
     183: aload         7
     185: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     190: astore        8
     192: aload         7
     194: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     199: ifne          207
     202: aload         8
     204: goto          293
     207: aload         8
     209: checkcast     #87                 // class java/util/Map$Entry
     212: astore        9
     214: iconst_0
     215: istore        10
     217: aload         9
     219: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     224: checkcast     #92                 // class Point
     227: invokevirtual #112                // Method Point.getX:()I
     230: istore        9
     232: aload         7
     234: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     239: astore        10
     241: aload         10
     243: checkcast     #87                 // class java/util/Map$Entry
     246: astore        11
     248: iconst_0
     249: istore        12
     251: aload         11
     253: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     258: checkcast     #92                 // class Point
     261: invokevirtual #112                // Method Point.getX:()I
     264: istore        11
     266: iload         9
     268: iload         11
     270: if_icmple     281
     273: aload         10
     275: astore        8
     277: iload         11
     279: istore        9
     281: aload         7
     283: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     288: ifne          232
     291: aload         8
     293: checkcast     #87                 // class java/util/Map$Entry
     296: invokeinterface #90,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     301: astore        4
     303: iconst_0
     304: istore        5
     306: iload         5
     308: aload_2
     309: invokevirtual #117                // Method java/lang/String.length:()I
     312: if_icmpge     480
     315: ldc           #119                // String
     317: astore        6
     319: iload         5
     321: aload_2
     322: invokevirtual #117                // Method java/lang/String.length:()I
     325: if_icmpge     372
     328: aload_2
     329: iload         5
     331: invokevirtual #123                // Method java/lang/String.charAt:(I)C
     334: invokestatic  #129                // Method java/lang/Character.isDigit:(C)Z
     337: ifeq          372
     340: new           #131                // class java/lang/StringBuilder
     343: dup
     344: invokespecial #132                // Method java/lang/StringBuilder."<init>":()V
     347: aload         6
     349: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     352: aload_2
     353: iload         5
     355: invokevirtual #123                // Method java/lang/String.charAt:(I)C
     358: invokevirtual #139                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     361: invokevirtual #143                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     364: astore        6
     366: iinc          5, 1
     369: goto          319
     372: aload         6
     374: invokestatic  #149                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     377: istore        7
     379: iconst_0
     380: istore        8
     382: iload         8
     384: iload         7
     386: if_icmpge     442
     389: iload         8
     391: istore        9
     393: iconst_0
     394: istore        10
     396: aload_1
     397: aload         4
     399: checkcast     #92                 // class Point
     402: aload_3
     403: invokestatic  #191                // Method nextTileOnCubeFrom:(Ljava/util/Map;LPoint;Lday22/Direction;)Lkotlin/Pair;
     406: astore        11
     408: aload         11
     410: invokevirtual #196                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     413: checkcast     #92                 // class Point
     416: astore        12
     418: aload         11
     420: invokevirtual #199                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     423: checkcast     #54                 // class day22/Direction
     426: astore        13
     428: aload         12
     430: astore        4
     432: aload         13
     434: astore_3
     435: nop
     436: iinc          8, 1
     439: goto          382
     442: iload         5
     444: aload_2
     445: invokevirtual #117                // Method java/lang/String.length:()I
     448: if_icmpge     306
     451: aload_2
     452: iload         5
     454: invokevirtual #123                // Method java/lang/String.charAt:(I)C
     457: bipush        76
     459: if_icmpne     469
     462: aload_3
     463: invokevirtual #157                // Method day22/Direction.left:()Lday22/Direction;
     466: goto          473
     469: aload_3
     470: invokevirtual #160                // Method day22/Direction.right:()Lday22/Direction;
     473: astore_3
     474: iinc          5, 1
     477: goto          306
     480: aload         4
     482: checkcast     #92                 // class Point
     485: invokevirtual #96                 // Method Point.getY:()I
     488: sipush        1000
     491: imul
     492: aload         4
     494: checkcast     #92                 // class Point
     497: invokevirtual #112                // Method Point.getX:()I
     500: iconst_4
     501: imul
     502: iadd
     503: aload_3
     504: invokevirtual #163                // Method day22/Direction.getFacing:()I
     507: iadd
     508: ireturn

  public static final java.util.Map<Point, java.lang.Character> parseBoard(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #208                // String <this>
       3: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #60                 // class java/util/LinkedHashMap
       9: dup
      10: invokespecial #63                 // Method java/util/LinkedHashMap."<init>":()V
      13: checkcast     #65                 // class java/util/Map
      16: astore_1
      17: aload_0
      18: checkcast     #105                // class java/lang/Iterable
      21: astore_2
      22: iconst_0
      23: istore_3
      24: new           #210                // class java/util/ArrayList
      27: dup
      28: invokespecial #211                // Method java/util/ArrayList."<init>":()V
      31: astore        4
      33: aload_2
      34: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      39: astore        5
      41: aload         5
      43: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      48: ifeq          104
      51: aload         5
      53: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      58: astore        6
      60: aload         6
      62: checkcast     #114                // class java/lang/String
      65: astore        7
      67: iconst_0
      68: istore        8
      70: aload         7
      72: checkcast     #213                // class java/lang/CharSequence
      75: invokestatic  #219                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      78: ifne          85
      81: iconst_1
      82: goto          86
      85: iconst_0
      86: nop
      87: ifne          93
      90: goto          104
      93: aload         4
      95: aload         6
      97: invokevirtual #223                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     100: pop
     101: goto          41
     104: aload         4
     106: checkcast     #187                // class java/util/List
     109: checkcast     #105                // class java/lang/Iterable
     112: astore_2
     113: nop
     114: iconst_0
     115: istore_3
     116: aload_2
     117: astore        4
     119: new           #210                // class java/util/ArrayList
     122: dup
     123: aload_2
     124: bipush        10
     126: invokestatic  #229                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     129: invokespecial #231                // Method java/util/ArrayList."<init>":(I)V
     132: checkcast     #233                // class java/util/Collection
     135: astore        5
     137: iconst_0
     138: istore        6
     140: iconst_0
     141: istore        7
     143: aload         4
     145: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     150: astore        8
     152: aload         8
     154: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     159: ifeq          384
     162: aload         8
     164: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     169: astore        9
     171: aload         5
     173: iload         7
     175: iinc          7, 1
     178: istore        10
     180: iload         10
     182: ifge          188
     185: invokestatic  #236                // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
     188: iload         10
     190: aload         9
     192: checkcast     #114                // class java/lang/String
     195: astore        11
     197: istore        12
     199: astore        27
     201: iconst_0
     202: istore        13
     204: aload         11
     206: checkcast     #213                // class java/lang/CharSequence
     209: astore        14
     211: iconst_0
     212: istore        15
     214: aload         14
     216: astore        16
     218: new           #210                // class java/util/ArrayList
     221: dup
     222: aload         14
     224: invokeinterface #237,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     229: invokespecial #231                // Method java/util/ArrayList."<init>":(I)V
     232: checkcast     #233                // class java/util/Collection
     235: astore        17
     237: iconst_0
     238: istore        18
     240: iconst_0
     241: istore        19
     243: iconst_0
     244: istore        20
     246: iload         20
     248: aload         16
     250: invokeinterface #237,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     255: if_icmpge     365
     258: aload         16
     260: iload         20
     262: invokeinterface #238,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
     267: istore        21
     269: aload         17
     271: iload         19
     273: iinc          19, 1
     276: iload         21
     278: istore        22
     280: istore        23
     282: astore        24
     284: iconst_0
     285: istore        25
     287: iload         22
     289: lookupswitch  { // 2
                    35: 316
                    46: 316
               default: 347
          }
     316: iload         22
     318: invokestatic  #242                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     321: astore        26
     323: aload_1
     324: new           #92                 // class Point
     327: dup
     328: iload         23
     330: iconst_1
     331: iadd
     332: iload         12
     334: iconst_1
     335: iadd
     336: invokespecial #245                // Method Point."<init>":(II)V
     339: aload         26
     341: invokeinterface #103,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     346: pop
     347: nop
     348: aload         24
     350: getstatic     #251                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     353: invokeinterface #252,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     358: pop
     359: iinc          20, 1
     362: goto          246
     365: aload         17
     367: checkcast     #187                // class java/util/List
     370: nop
     371: nop
     372: aload         27
     374: swap
     375: invokeinterface #252,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     380: pop
     381: goto          152
     384: aload         5
     386: checkcast     #187                // class java/util/List
     389: nop
     390: pop
     391: aload_1
     392: areturn

  public static final java.lang.String readDirections(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #208                // String <this>
       3: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: astore_1
       8: iconst_0
       9: istore_2
      10: aload_1
      11: invokeinterface #279,  1          // InterfaceMethod java/util/List.isEmpty:()Z
      16: ifne          84
      19: aload_1
      20: aload_1
      21: invokeinterface #282,  1          // InterfaceMethod java/util/List.size:()I
      26: invokeinterface #286,  2          // InterfaceMethod java/util/List.listIterator:(I)Ljava/util/ListIterator;
      31: astore_3
      32: aload_3
      33: invokeinterface #291,  1          // InterfaceMethod java/util/ListIterator.hasPrevious:()Z
      38: ifeq          84
      41: aload_3
      42: invokeinterface #294,  1          // InterfaceMethod java/util/ListIterator.previous:()Ljava/lang/Object;
      47: checkcast     #114                // class java/lang/String
      50: astore        4
      52: iconst_0
      53: istore        5
      55: aload         4
      57: checkcast     #213                // class java/lang/CharSequence
      60: invokestatic  #219                // Method kotlin/text/StringsKt.isBlank:(Ljava/lang/CharSequence;)Z
      63: ifne          32
      66: aload_1
      67: checkcast     #105                // class java/lang/Iterable
      70: aload_3
      71: invokeinterface #297,  1          // InterfaceMethod java/util/ListIterator.nextIndex:()I
      76: iconst_1
      77: iadd
      78: invokestatic  #301                // Method kotlin/collections/CollectionsKt.take:(Ljava/lang/Iterable;I)Ljava/util/List;
      81: goto          87
      84: invokestatic  #305                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
      87: invokestatic  #309                // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      90: checkcast     #114                // class java/lang/String
      93: areturn

  public static final Point nextTileFrom(java.util.Map<Point, java.lang.Character>, Point, day22.Direction);
    Code:
       0: aload_0
       1: ldc           #208                // String <this>
       3: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc_w         #318                // String p
      10: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aload_2
      14: ldc_w         #320                // String direction
      17: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      20: aload_2
      21: getstatic     #326                // Field day22/Day22Kt$WhenMappings.$EnumSwitchMapping$0:[I
      24: swap
      25: invokevirtual #329                // Method day22/Direction.ordinal:()I
      28: iaload
      29: tableswitch   { // 1 to 4
                     1: 60
                     2: 400
                     3: 740
                     4: 1080
               default: 1420
          }
      60: new           #92                 // class Point
      63: dup
      64: aload_1
      65: invokevirtual #112                // Method Point.getX:()I
      68: aload_1
      69: invokevirtual #96                 // Method Point.getY:()I
      72: iconst_1
      73: isub
      74: invokespecial #245                // Method Point."<init>":(II)V
      77: astore_3
      78: aload_0
      79: aload_3
      80: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      85: checkcast     #125                // class java/lang/Character
      88: bipush        35
      90: istore        4
      92: dup
      93: ifnonnull     100
      96: pop
      97: goto          110
     100: invokevirtual #337                // Method java/lang/Character.charValue:()C
     103: iload         4
     105: if_icmpne     110
     108: aload_1
     109: astore_3
     110: aload_0
     111: aload_3
     112: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     117: ifnonnull     364
     120: aload_0
     121: invokeinterface #340,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     126: checkcast     #105                // class java/lang/Iterable
     129: astore        4
     131: iconst_0
     132: istore        5
     134: aload         4
     136: astore        6
     138: new           #210                // class java/util/ArrayList
     141: dup
     142: invokespecial #211                // Method java/util/ArrayList."<init>":()V
     145: checkcast     #233                // class java/util/Collection
     148: astore        7
     150: iconst_0
     151: istore        8
     153: aload         6
     155: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     160: astore        9
     162: aload         9
     164: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     169: ifeq          224
     172: aload         9
     174: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     179: astore        10
     181: aload         10
     183: checkcast     #92                 // class Point
     186: astore        11
     188: iconst_0
     189: istore        12
     191: aload         11
     193: invokevirtual #112                // Method Point.getX:()I
     196: aload_1
     197: invokevirtual #112                // Method Point.getX:()I
     200: if_icmpne     207
     203: iconst_1
     204: goto          208
     207: iconst_0
     208: ifeq          162
     211: aload         7
     213: aload         10
     215: invokeinterface #252,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     220: pop
     221: goto          162
     224: aload         7
     226: checkcast     #187                // class java/util/List
     229: nop
     230: checkcast     #105                // class java/lang/Iterable
     233: astore        4
     235: nop
     236: iconst_0
     237: istore        5
     239: aload         4
     241: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     246: astore        6
     248: aload         6
     250: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     255: ifne          266
     258: new           #108                // class java/util/NoSuchElementException
     261: dup
     262: invokespecial #109                // Method java/util/NoSuchElementException."<init>":()V
     265: athrow
     266: aload         6
     268: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     273: astore        7
     275: aload         6
     277: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     282: ifne          290
     285: aload         7
     287: goto          360
     290: aload         7
     292: checkcast     #92                 // class Point
     295: astore        8
     297: iconst_0
     298: istore        9
     300: aload         8
     302: invokevirtual #96                 // Method Point.getY:()I
     305: istore        8
     307: aload         6
     309: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     314: astore        9
     316: aload         9
     318: checkcast     #92                 // class Point
     321: astore        10
     323: iconst_0
     324: istore        11
     326: aload         10
     328: invokevirtual #96                 // Method Point.getY:()I
     331: istore        10
     333: iload         8
     335: iload         10
     337: if_icmpge     348
     340: aload         9
     342: astore        7
     344: iload         10
     346: istore        8
     348: aload         6
     350: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     355: ifne          307
     358: aload         7
     360: checkcast     #92                 // class Point
     363: astore_3
     364: aload_0
     365: aload_3
     366: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     371: checkcast     #125                // class java/lang/Character
     374: bipush        35
     376: istore        4
     378: dup
     379: ifnonnull     386
     382: pop
     383: goto          396
     386: invokevirtual #337                // Method java/lang/Character.charValue:()C
     389: iload         4
     391: if_icmpne     396
     394: aload_1
     395: astore_3
     396: aload_3
     397: goto          1428
     400: new           #92                 // class Point
     403: dup
     404: aload_1
     405: invokevirtual #112                // Method Point.getX:()I
     408: aload_1
     409: invokevirtual #96                 // Method Point.getY:()I
     412: iconst_1
     413: iadd
     414: invokespecial #245                // Method Point."<init>":(II)V
     417: astore_3
     418: aload_0
     419: aload_3
     420: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     425: checkcast     #125                // class java/lang/Character
     428: bipush        35
     430: istore        4
     432: dup
     433: ifnonnull     440
     436: pop
     437: goto          450
     440: invokevirtual #337                // Method java/lang/Character.charValue:()C
     443: iload         4
     445: if_icmpne     450
     448: aload_1
     449: astore_3
     450: aload_0
     451: aload_3
     452: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     457: ifnonnull     704
     460: aload_0
     461: invokeinterface #340,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     466: checkcast     #105                // class java/lang/Iterable
     469: astore        4
     471: iconst_0
     472: istore        5
     474: aload         4
     476: astore        6
     478: new           #210                // class java/util/ArrayList
     481: dup
     482: invokespecial #211                // Method java/util/ArrayList."<init>":()V
     485: checkcast     #233                // class java/util/Collection
     488: astore        7
     490: iconst_0
     491: istore        8
     493: aload         6
     495: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     500: astore        9
     502: aload         9
     504: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     509: ifeq          564
     512: aload         9
     514: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     519: astore        10
     521: aload         10
     523: checkcast     #92                 // class Point
     526: astore        11
     528: iconst_0
     529: istore        12
     531: aload         11
     533: invokevirtual #112                // Method Point.getX:()I
     536: aload_1
     537: invokevirtual #112                // Method Point.getX:()I
     540: if_icmpne     547
     543: iconst_1
     544: goto          548
     547: iconst_0
     548: ifeq          502
     551: aload         7
     553: aload         10
     555: invokeinterface #252,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     560: pop
     561: goto          502
     564: aload         7
     566: checkcast     #187                // class java/util/List
     569: nop
     570: checkcast     #105                // class java/lang/Iterable
     573: astore        4
     575: nop
     576: iconst_0
     577: istore        5
     579: aload         4
     581: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     586: astore        6
     588: aload         6
     590: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     595: ifne          606
     598: new           #108                // class java/util/NoSuchElementException
     601: dup
     602: invokespecial #109                // Method java/util/NoSuchElementException."<init>":()V
     605: athrow
     606: aload         6
     608: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     613: astore        7
     615: aload         6
     617: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     622: ifne          630
     625: aload         7
     627: goto          700
     630: aload         7
     632: checkcast     #92                 // class Point
     635: astore        8
     637: iconst_0
     638: istore        9
     640: aload         8
     642: invokevirtual #96                 // Method Point.getY:()I
     645: istore        8
     647: aload         6
     649: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     654: astore        9
     656: aload         9
     658: checkcast     #92                 // class Point
     661: astore        10
     663: iconst_0
     664: istore        11
     666: aload         10
     668: invokevirtual #96                 // Method Point.getY:()I
     671: istore        10
     673: iload         8
     675: iload         10
     677: if_icmple     688
     680: aload         9
     682: astore        7
     684: iload         10
     686: istore        8
     688: aload         6
     690: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     695: ifne          647
     698: aload         7
     700: checkcast     #92                 // class Point
     703: astore_3
     704: aload_0
     705: aload_3
     706: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     711: checkcast     #125                // class java/lang/Character
     714: bipush        35
     716: istore        4
     718: dup
     719: ifnonnull     726
     722: pop
     723: goto          736
     726: invokevirtual #337                // Method java/lang/Character.charValue:()C
     729: iload         4
     731: if_icmpne     736
     734: aload_1
     735: astore_3
     736: aload_3
     737: goto          1428
     740: new           #92                 // class Point
     743: dup
     744: aload_1
     745: invokevirtual #112                // Method Point.getX:()I
     748: iconst_1
     749: iadd
     750: aload_1
     751: invokevirtual #96                 // Method Point.getY:()I
     754: invokespecial #245                // Method Point."<init>":(II)V
     757: astore_3
     758: aload_0
     759: aload_3
     760: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     765: checkcast     #125                // class java/lang/Character
     768: bipush        35
     770: istore        4
     772: dup
     773: ifnonnull     780
     776: pop
     777: goto          790
     780: invokevirtual #337                // Method java/lang/Character.charValue:()C
     783: iload         4
     785: if_icmpne     790
     788: aload_1
     789: astore_3
     790: aload_0
     791: aload_3
     792: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     797: ifnonnull     1044
     800: aload_0
     801: invokeinterface #340,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     806: checkcast     #105                // class java/lang/Iterable
     809: astore        4
     811: iconst_0
     812: istore        5
     814: aload         4
     816: astore        6
     818: new           #210                // class java/util/ArrayList
     821: dup
     822: invokespecial #211                // Method java/util/ArrayList."<init>":()V
     825: checkcast     #233                // class java/util/Collection
     828: astore        7
     830: iconst_0
     831: istore        8
     833: aload         6
     835: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     840: astore        9
     842: aload         9
     844: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     849: ifeq          904
     852: aload         9
     854: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     859: astore        10
     861: aload         10
     863: checkcast     #92                 // class Point
     866: astore        11
     868: iconst_0
     869: istore        12
     871: aload         11
     873: invokevirtual #96                 // Method Point.getY:()I
     876: aload_1
     877: invokevirtual #96                 // Method Point.getY:()I
     880: if_icmpne     887
     883: iconst_1
     884: goto          888
     887: iconst_0
     888: ifeq          842
     891: aload         7
     893: aload         10
     895: invokeinterface #252,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     900: pop
     901: goto          842
     904: aload         7
     906: checkcast     #187                // class java/util/List
     909: nop
     910: checkcast     #105                // class java/lang/Iterable
     913: astore        4
     915: nop
     916: iconst_0
     917: istore        5
     919: aload         4
     921: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     926: astore        6
     928: aload         6
     930: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     935: ifne          946
     938: new           #108                // class java/util/NoSuchElementException
     941: dup
     942: invokespecial #109                // Method java/util/NoSuchElementException."<init>":()V
     945: athrow
     946: aload         6
     948: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     953: astore        7
     955: aload         6
     957: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     962: ifne          970
     965: aload         7
     967: goto          1040
     970: aload         7
     972: checkcast     #92                 // class Point
     975: astore        8
     977: iconst_0
     978: istore        9
     980: aload         8
     982: invokevirtual #112                // Method Point.getX:()I
     985: istore        8
     987: aload         6
     989: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     994: astore        9
     996: aload         9
     998: checkcast     #92                 // class Point
    1001: astore        10
    1003: iconst_0
    1004: istore        11
    1006: aload         10
    1008: invokevirtual #112                // Method Point.getX:()I
    1011: istore        10
    1013: iload         8
    1015: iload         10
    1017: if_icmple     1028
    1020: aload         9
    1022: astore        7
    1024: iload         10
    1026: istore        8
    1028: aload         6
    1030: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1035: ifne          987
    1038: aload         7
    1040: checkcast     #92                 // class Point
    1043: astore_3
    1044: aload_0
    1045: aload_3
    1046: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1051: checkcast     #125                // class java/lang/Character
    1054: bipush        35
    1056: istore        4
    1058: dup
    1059: ifnonnull     1066
    1062: pop
    1063: goto          1076
    1066: invokevirtual #337                // Method java/lang/Character.charValue:()C
    1069: iload         4
    1071: if_icmpne     1076
    1074: aload_1
    1075: astore_3
    1076: aload_3
    1077: goto          1428
    1080: new           #92                 // class Point
    1083: dup
    1084: aload_1
    1085: invokevirtual #112                // Method Point.getX:()I
    1088: iconst_1
    1089: isub
    1090: aload_1
    1091: invokevirtual #96                 // Method Point.getY:()I
    1094: invokespecial #245                // Method Point."<init>":(II)V
    1097: astore_3
    1098: aload_0
    1099: aload_3
    1100: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1105: checkcast     #125                // class java/lang/Character
    1108: bipush        35
    1110: istore        4
    1112: dup
    1113: ifnonnull     1120
    1116: pop
    1117: goto          1130
    1120: invokevirtual #337                // Method java/lang/Character.charValue:()C
    1123: iload         4
    1125: if_icmpne     1130
    1128: aload_1
    1129: astore_3
    1130: aload_0
    1131: aload_3
    1132: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1137: ifnonnull     1384
    1140: aload_0
    1141: invokeinterface #340,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
    1146: checkcast     #105                // class java/lang/Iterable
    1149: astore        4
    1151: iconst_0
    1152: istore        5
    1154: aload         4
    1156: astore        6
    1158: new           #210                // class java/util/ArrayList
    1161: dup
    1162: invokespecial #211                // Method java/util/ArrayList."<init>":()V
    1165: checkcast     #233                // class java/util/Collection
    1168: astore        7
    1170: iconst_0
    1171: istore        8
    1173: aload         6
    1175: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1180: astore        9
    1182: aload         9
    1184: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1189: ifeq          1244
    1192: aload         9
    1194: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1199: astore        10
    1201: aload         10
    1203: checkcast     #92                 // class Point
    1206: astore        11
    1208: iconst_0
    1209: istore        12
    1211: aload         11
    1213: invokevirtual #96                 // Method Point.getY:()I
    1216: aload_1
    1217: invokevirtual #96                 // Method Point.getY:()I
    1220: if_icmpne     1227
    1223: iconst_1
    1224: goto          1228
    1227: iconst_0
    1228: ifeq          1182
    1231: aload         7
    1233: aload         10
    1235: invokeinterface #252,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1240: pop
    1241: goto          1182
    1244: aload         7
    1246: checkcast     #187                // class java/util/List
    1249: nop
    1250: checkcast     #105                // class java/lang/Iterable
    1253: astore        4
    1255: nop
    1256: iconst_0
    1257: istore        5
    1259: aload         4
    1261: invokeinterface #106,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1266: astore        6
    1268: aload         6
    1270: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1275: ifne          1286
    1278: new           #108                // class java/util/NoSuchElementException
    1281: dup
    1282: invokespecial #109                // Method java/util/NoSuchElementException."<init>":()V
    1285: athrow
    1286: aload         6
    1288: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1293: astore        7
    1295: aload         6
    1297: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1302: ifne          1310
    1305: aload         7
    1307: goto          1380
    1310: aload         7
    1312: checkcast     #92                 // class Point
    1315: astore        8
    1317: iconst_0
    1318: istore        9
    1320: aload         8
    1322: invokevirtual #112                // Method Point.getX:()I
    1325: istore        8
    1327: aload         6
    1329: invokeinterface #85,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1334: astore        9
    1336: aload         9
    1338: checkcast     #92                 // class Point
    1341: astore        10
    1343: iconst_0
    1344: istore        11
    1346: aload         10
    1348: invokevirtual #112                // Method Point.getX:()I
    1351: istore        10
    1353: iload         8
    1355: iload         10
    1357: if_icmpge     1368
    1360: aload         9
    1362: astore        7
    1364: iload         10
    1366: istore        8
    1368: aload         6
    1370: invokeinterface #81,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1375: ifne          1327
    1378: aload         7
    1380: checkcast     #92                 // class Point
    1383: astore_3
    1384: aload_0
    1385: aload_3
    1386: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
    1391: checkcast     #125                // class java/lang/Character
    1394: bipush        35
    1396: istore        4
    1398: dup
    1399: ifnonnull     1406
    1402: pop
    1403: goto          1416
    1406: invokevirtual #337                // Method java/lang/Character.charValue:()C
    1409: iload         4
    1411: if_icmpne     1416
    1414: aload_1
    1415: astore_3
    1416: aload_3
    1417: goto          1428
    1420: new           #342                // class kotlin/NoWhenBranchMatchedException
    1423: dup
    1424: invokespecial #343                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
    1427: athrow
    1428: areturn

  public static final kotlin.Pair<Point, day22.Direction> nextTileOnCubeFrom(java.util.Map<Point, java.lang.Character>, Point, day22.Direction);
    Code:
       0: aload_0
       1: ldc           #208                // String <this>
       3: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc_w         #318                // String p
      10: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aload_2
      14: ldc_w         #320                // String direction
      17: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      20: aload_2
      21: getstatic     #326                // Field day22/Day22Kt$WhenMappings.$EnumSwitchMapping$0:[I
      24: swap
      25: invokevirtual #329                // Method day22/Direction.ordinal:()I
      28: iaload
      29: tableswitch   { // 1 to 4
                     1: 60
                     2: 86
                     3: 112
                     4: 138
               default: 164
          }
      60: aload_0
      61: new           #92                 // class Point
      64: dup
      65: aload_1
      66: invokevirtual #112                // Method Point.getX:()I
      69: aload_1
      70: invokevirtual #96                 // Method Point.getY:()I
      73: iconst_1
      74: isub
      75: invokespecial #245                // Method Point."<init>":(II)V
      78: aload_1
      79: aload_2
      80: invokestatic  #368                // Method nextPositionAndDirection:(Ljava/util/Map;LPoint;LPoint;Lday22/Direction;)Lkotlin/Pair;
      83: goto          172
      86: aload_0
      87: new           #92                 // class Point
      90: dup
      91: aload_1
      92: invokevirtual #112                // Method Point.getX:()I
      95: aload_1
      96: invokevirtual #96                 // Method Point.getY:()I
      99: iconst_1
     100: iadd
     101: invokespecial #245                // Method Point."<init>":(II)V
     104: aload_1
     105: aload_2
     106: invokestatic  #368                // Method nextPositionAndDirection:(Ljava/util/Map;LPoint;LPoint;Lday22/Direction;)Lkotlin/Pair;
     109: goto          172
     112: aload_0
     113: new           #92                 // class Point
     116: dup
     117: aload_1
     118: invokevirtual #112                // Method Point.getX:()I
     121: iconst_1
     122: iadd
     123: aload_1
     124: invokevirtual #96                 // Method Point.getY:()I
     127: invokespecial #245                // Method Point."<init>":(II)V
     130: aload_1
     131: aload_2
     132: invokestatic  #368                // Method nextPositionAndDirection:(Ljava/util/Map;LPoint;LPoint;Lday22/Direction;)Lkotlin/Pair;
     135: goto          172
     138: aload_0
     139: new           #92                 // class Point
     142: dup
     143: aload_1
     144: invokevirtual #112                // Method Point.getX:()I
     147: iconst_1
     148: isub
     149: aload_1
     150: invokevirtual #96                 // Method Point.getY:()I
     153: invokespecial #245                // Method Point."<init>":(II)V
     156: aload_1
     157: aload_2
     158: invokestatic  #368                // Method nextPositionAndDirection:(Ljava/util/Map;LPoint;LPoint;Lday22/Direction;)Lkotlin/Pair;
     161: goto          172
     164: new           #342                // class kotlin/NoWhenBranchMatchedException
     167: dup
     168: invokespecial #343                // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     171: athrow
     172: areturn

  private static final kotlin.Pair<Point, day22.Direction> nextPositionAndDirection(java.util.Map<Point, java.lang.Character>, Point, Point, day22.Direction);
    Code:
       0: aload_1
       1: astore        4
       3: aload_3
       4: astore        5
       6: aload_0
       7: aload         4
       9: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      14: checkcast     #125                // class java/lang/Character
      17: bipush        35
      19: istore        6
      21: dup
      22: ifnonnull     29
      25: pop
      26: goto          40
      29: invokevirtual #337                // Method java/lang/Character.charValue:()C
      32: iload         6
      34: if_icmpne     40
      37: aload_2
      38: astore        4
      40: aload_0
      41: aload         4
      43: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      48: ifnonnull     86
      51: aload_2
      52: aload_3
      53: invokestatic  #374                // Method gotoNextSide:(LPoint;Lday22/Direction;)Lkotlin/Pair;
      56: astore        6
      58: aload         6
      60: invokevirtual #196                // Method kotlin/Pair.component1:()Ljava/lang/Object;
      63: checkcast     #92                 // class Point
      66: astore        7
      68: aload         6
      70: invokevirtual #199                // Method kotlin/Pair.component2:()Ljava/lang/Object;
      73: checkcast     #54                 // class day22/Direction
      76: astore        8
      78: aload         7
      80: astore        4
      82: aload         8
      84: astore        5
      86: aload_0
      87: aload         4
      89: invokeinterface #333,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      94: checkcast     #125                // class java/lang/Character
      97: bipush        35
      99: istore        6
     101: dup
     102: ifnonnull     109
     105: pop
     106: goto          123
     109: invokevirtual #337                // Method java/lang/Character.charValue:()C
     112: iload         6
     114: if_icmpne     123
     117: aload_2
     118: astore        4
     120: aload_3
     121: astore        5
     123: aload         4
     125: aload         5
     127: invokestatic  #380                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     130: areturn

  private static final char sideOf(Point);
    Code:
       0: aload_0
       1: invokevirtual #112                // Method Point.getX:()I
       4: istore_1
       5: bipush        51
       7: iload_1
       8: if_icmpgt     25
      11: iload_1
      12: bipush        101
      14: if_icmpge     21
      17: iconst_1
      18: goto          26
      21: iconst_0
      22: goto          26
      25: iconst_0
      26: ifeq          60
      29: aload_0
      30: invokevirtual #96                 // Method Point.getY:()I
      33: istore_1
      34: iconst_1
      35: iload_1
      36: if_icmpgt     53
      39: iload_1
      40: bipush        51
      42: if_icmpge     49
      45: iconst_1
      46: goto          54
      49: iconst_0
      50: goto          54
      53: iconst_0
      54: ifeq          60
      57: bipush        65
      59: ireturn
      60: aload_0
      61: invokevirtual #112                // Method Point.getX:()I
      64: istore_1
      65: bipush        101
      67: iload_1
      68: if_icmpgt     86
      71: iload_1
      72: sipush        151
      75: if_icmpge     82
      78: iconst_1
      79: goto          87
      82: iconst_0
      83: goto          87
      86: iconst_0
      87: ifeq          121
      90: aload_0
      91: invokevirtual #96                 // Method Point.getY:()I
      94: istore_1
      95: iconst_1
      96: iload_1
      97: if_icmpgt     114
     100: iload_1
     101: bipush        51
     103: if_icmpge     110
     106: iconst_1
     107: goto          115
     110: iconst_0
     111: goto          115
     114: iconst_0
     115: ifeq          121
     118: bipush        66
     120: ireturn
     121: aload_0
     122: invokevirtual #112                // Method Point.getX:()I
     125: istore_1
     126: bipush        51
     128: iload_1
     129: if_icmpgt     146
     132: iload_1
     133: bipush        101
     135: if_icmpge     142
     138: iconst_1
     139: goto          147
     142: iconst_0
     143: goto          147
     146: iconst_0
     147: ifeq          182
     150: aload_0
     151: invokevirtual #96                 // Method Point.getY:()I
     154: istore_1
     155: bipush        51
     157: iload_1
     158: if_icmpgt     175
     161: iload_1
     162: bipush        101
     164: if_icmpge     171
     167: iconst_1
     168: goto          176
     171: iconst_0
     172: goto          176
     175: iconst_0
     176: ifeq          182
     179: bipush        67
     181: ireturn
     182: aload_0
     183: invokevirtual #112                // Method Point.getX:()I
     186: istore_1
     187: bipush        51
     189: iload_1
     190: if_icmpgt     207
     193: iload_1
     194: bipush        101
     196: if_icmpge     203
     199: iconst_1
     200: goto          208
     203: iconst_0
     204: goto          208
     207: iconst_0
     208: ifeq          244
     211: aload_0
     212: invokevirtual #96                 // Method Point.getY:()I
     215: istore_1
     216: bipush        101
     218: iload_1
     219: if_icmpgt     237
     222: iload_1
     223: sipush        151
     226: if_icmpge     233
     229: iconst_1
     230: goto          238
     233: iconst_0
     234: goto          238
     237: iconst_0
     238: ifeq          244
     241: bipush        68
     243: ireturn
     244: aload_0
     245: invokevirtual #112                // Method Point.getX:()I
     248: istore_1
     249: iconst_1
     250: iload_1
     251: if_icmpgt     268
     254: iload_1
     255: bipush        51
     257: if_icmpge     264
     260: iconst_1
     261: goto          269
     264: iconst_0
     265: goto          269
     268: iconst_0
     269: ifeq          305
     272: aload_0
     273: invokevirtual #96                 // Method Point.getY:()I
     276: istore_1
     277: bipush        101
     279: iload_1
     280: if_icmpgt     298
     283: iload_1
     284: sipush        151
     287: if_icmpge     294
     290: iconst_1
     291: goto          299
     294: iconst_0
     295: goto          299
     298: iconst_0
     299: ifeq          305
     302: bipush        69
     304: ireturn
     305: aload_0
     306: invokevirtual #112                // Method Point.getX:()I
     309: istore_1
     310: iconst_1
     311: iload_1
     312: if_icmpgt     329
     315: iload_1
     316: bipush        51
     318: if_icmpge     325
     321: iconst_1
     322: goto          330
     325: iconst_0
     326: goto          330
     329: iconst_0
     330: ifeq          367
     333: aload_0
     334: invokevirtual #96                 // Method Point.getY:()I
     337: istore_1
     338: sipush        151
     341: iload_1
     342: if_icmpgt     360
     345: iload_1
     346: sipush        201
     349: if_icmpge     356
     352: iconst_1
     353: goto          361
     356: iconst_0
     357: goto          361
     360: iconst_0
     361: ifeq          367
     364: bipush        70
     366: ireturn
     367: new           #387                // class java/lang/IllegalStateException
     370: dup
     371: new           #131                // class java/lang/StringBuilder
     374: dup
     375: invokespecial #132                // Method java/lang/StringBuilder."<init>":()V
     378: ldc_w         #389                // String Side does not exist for
     381: invokevirtual #136                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     384: aload_0
     385: invokevirtual #392                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     388: invokevirtual #143                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     391: invokevirtual #393                // Method java/lang/Object.toString:()Ljava/lang/String;
     394: invokespecial #396                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     397: athrow

  public static final kotlin.Pair<Point, day22.Direction> gotoNextSide(Point, day22.Direction);
    Code:
       0: aload_0
       1: ldc_w         #398                // String position
       4: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #320                // String direction
      11: invokestatic  #44                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_1
      15: astore_2
      16: aload_0
      17: invokestatic  #400                // Method sideOf:(LPoint;)C
      20: istore_3
      21: aload_0
      22: astore        4
      24: bipush        50
      26: istore        5
      28: iload_3
      29: bipush        65
      31: if_icmpne     70
      34: aload_1
      35: getstatic     #403                // Field day22/Direction.UP:Lday22/Direction;
      38: if_acmpne     70
      41: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
      44: astore_2
      45: new           #92                 // class Point
      48: dup
      49: iconst_1
      50: iconst_3
      51: iload         5
      53: imul
      54: aload_0
      55: invokevirtual #112                // Method Point.getX:()I
      58: iadd
      59: iload         5
      61: isub
      62: invokespecial #245                // Method Point."<init>":(II)V
      65: astore        4
      67: goto          610
      70: iload_3
      71: bipush        65
      73: if_icmpne     112
      76: aload_1
      77: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
      80: if_acmpne     112
      83: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
      86: astore_2
      87: new           #92                 // class Point
      90: dup
      91: iconst_1
      92: iconst_2
      93: iload         5
      95: imul
      96: iload         5
      98: aload_0
      99: invokevirtual #96                 // Method Point.getY:()I
     102: isub
     103: iadd
     104: invokespecial #245                // Method Point."<init>":(II)V
     107: astore        4
     109: goto          610
     112: iload_3
     113: bipush        66
     115: if_icmpne     153
     118: aload_1
     119: getstatic     #403                // Field day22/Direction.UP:Lday22/Direction;
     122: if_acmpne     153
     125: getstatic     #403                // Field day22/Direction.UP:Lday22/Direction;
     128: astore_2
     129: new           #92                 // class Point
     132: dup
     133: aload_0
     134: invokevirtual #112                // Method Point.getX:()I
     137: iconst_2
     138: iload         5
     140: imul
     141: isub
     142: sipush        201
     145: invokespecial #245                // Method Point."<init>":(II)V
     148: astore        4
     150: goto          610
     153: iload_3
     154: bipush        66
     156: if_icmpne     196
     159: aload_1
     160: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
     163: if_acmpne     196
     166: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     169: astore_2
     170: new           #92                 // class Point
     173: dup
     174: bipush        101
     176: iload         5
     178: aload_0
     179: invokevirtual #96                 // Method Point.getY:()I
     182: isub
     183: iconst_2
     184: iload         5
     186: imul
     187: iadd
     188: invokespecial #245                // Method Point."<init>":(II)V
     191: astore        4
     193: goto          610
     196: iload_3
     197: bipush        66
     199: if_icmpne     239
     202: aload_1
     203: getstatic     #409                // Field day22/Direction.DOWN:Lday22/Direction;
     206: if_acmpne     239
     209: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     212: astore_2
     213: new           #92                 // class Point
     216: dup
     217: bipush        101
     219: iload         5
     221: aload_0
     222: invokevirtual #112                // Method Point.getX:()I
     225: iconst_2
     226: iload         5
     228: imul
     229: isub
     230: iadd
     231: invokespecial #245                // Method Point."<init>":(II)V
     234: astore        4
     236: goto          610
     239: iload_3
     240: bipush        67
     242: if_icmpne     282
     245: aload_1
     246: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
     249: if_acmpne     282
     252: getstatic     #403                // Field day22/Direction.UP:Lday22/Direction;
     255: astore_2
     256: new           #92                 // class Point
     259: dup
     260: aload_0
     261: invokevirtual #96                 // Method Point.getY:()I
     264: iload         5
     266: isub
     267: iconst_2
     268: iload         5
     270: imul
     271: iadd
     272: iload         5
     274: invokespecial #245                // Method Point."<init>":(II)V
     277: astore        4
     279: goto          610
     282: iload_3
     283: bipush        67
     285: if_icmpne     320
     288: aload_1
     289: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     292: if_acmpne     320
     295: getstatic     #409                // Field day22/Direction.DOWN:Lday22/Direction;
     298: astore_2
     299: new           #92                 // class Point
     302: dup
     303: aload_0
     304: invokevirtual #96                 // Method Point.getY:()I
     307: iload         5
     309: isub
     310: bipush        101
     312: invokespecial #245                // Method Point."<init>":(II)V
     315: astore        4
     317: goto          610
     320: iload_3
     321: bipush        69
     323: if_icmpne     363
     326: aload_1
     327: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     330: if_acmpne     363
     333: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
     336: astore_2
     337: new           #92                 // class Point
     340: dup
     341: bipush        51
     343: iload         5
     345: aload_0
     346: invokevirtual #96                 // Method Point.getY:()I
     349: iconst_2
     350: iload         5
     352: imul
     353: isub
     354: isub
     355: invokespecial #245                // Method Point."<init>":(II)V
     358: astore        4
     360: goto          610
     363: iload_3
     364: bipush        69
     366: if_icmpne     401
     369: aload_1
     370: getstatic     #403                // Field day22/Direction.UP:Lday22/Direction;
     373: if_acmpne     401
     376: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
     379: astore_2
     380: new           #92                 // class Point
     383: dup
     384: bipush        51
     386: iload         5
     388: aload_0
     389: invokevirtual #112                // Method Point.getX:()I
     392: iadd
     393: invokespecial #245                // Method Point."<init>":(II)V
     396: astore        4
     398: goto          610
     401: iload_3
     402: bipush        68
     404: if_icmpne     444
     407: aload_1
     408: getstatic     #409                // Field day22/Direction.DOWN:Lday22/Direction;
     411: if_acmpne     444
     414: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     417: astore_2
     418: new           #92                 // class Point
     421: dup
     422: bipush        101
     424: iconst_3
     425: iload         5
     427: imul
     428: aload_0
     429: invokevirtual #112                // Method Point.getX:()I
     432: iload         5
     434: isub
     435: iadd
     436: invokespecial #245                // Method Point."<init>":(II)V
     439: astore        4
     441: goto          610
     444: iload_3
     445: bipush        68
     447: if_icmpne     488
     450: aload_1
     451: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
     454: if_acmpne     488
     457: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     460: astore_2
     461: new           #92                 // class Point
     464: dup
     465: sipush        151
     468: iload         5
     470: aload_0
     471: invokevirtual #96                 // Method Point.getY:()I
     474: iload         5
     476: iconst_2
     477: imul
     478: isub
     479: isub
     480: invokespecial #245                // Method Point."<init>":(II)V
     483: astore        4
     485: goto          610
     488: iload_3
     489: bipush        70
     491: if_icmpne     532
     494: aload_1
     495: getstatic     #58                 // Field day22/Direction.RIGHT:Lday22/Direction;
     498: if_acmpne     532
     501: getstatic     #403                // Field day22/Direction.UP:Lday22/Direction;
     504: astore_2
     505: new           #92                 // class Point
     508: dup
     509: aload_0
     510: invokevirtual #96                 // Method Point.getY:()I
     513: iconst_3
     514: iload         5
     516: imul
     517: isub
     518: iload         5
     520: iadd
     521: sipush        151
     524: invokespecial #245                // Method Point."<init>":(II)V
     527: astore        4
     529: goto          610
     532: iload_3
     533: bipush        70
     535: if_icmpne     574
     538: aload_1
     539: getstatic     #406                // Field day22/Direction.LEFT:Lday22/Direction;
     542: if_acmpne     574
     545: getstatic     #409                // Field day22/Direction.DOWN:Lday22/Direction;
     548: astore_2
     549: new           #92                 // class Point
     552: dup
     553: iload         5
     555: aload_0
     556: invokevirtual #96                 // Method Point.getY:()I
     559: iconst_3
     560: iload         5
     562: imul
     563: isub
     564: iadd
     565: iconst_1
     566: invokespecial #245                // Method Point."<init>":(II)V
     569: astore        4
     571: goto          610
     574: iload_3
     575: bipush        70
     577: if_icmpne     610
     580: aload_1
     581: getstatic     #409                // Field day22/Direction.DOWN:Lday22/Direction;
     584: if_acmpne     610
     587: getstatic     #409                // Field day22/Direction.DOWN:Lday22/Direction;
     590: astore_2
     591: new           #92                 // class Point
     594: dup
     595: aload_0
     596: invokevirtual #112                // Method Point.getX:()I
     599: iconst_2
     600: iload         5
     602: imul
     603: iadd
     604: iconst_1
     605: invokespecial #245                // Method Point."<init>":(II)V
     608: astore        4
     610: aload         4
     612: aload_2
     613: invokestatic  #380                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     616: areturn

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

Compiled from "day22.kt"
public final class day22.Day22Kt$WhenMappings {
  public static final int[] $EnumSwitchMapping$0;

  static {};
    Code:
       0: invokestatic  #14                 // Method day22/Direction.values:()[Lday22/Direction;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field day22/Direction.UP:Lday22/Direction;
      12: invokevirtual #22                 // Method day22/Direction.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field day22/Direction.DOWN:Lday22/Direction;
      26: invokevirtual #22                 // Method day22/Direction.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field day22/Direction.RIGHT:Lday22/Direction;
      40: invokevirtual #22                 // Method day22/Direction.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: nop
      50: aload_0
      51: getstatic     #31                 // Field day22/Direction.LEFT:Lday22/Direction;
      54: invokevirtual #22                 // Method day22/Direction.ordinal:()I
      57: iconst_4
      58: iastore
      59: goto          63
      62: astore_1
      63: aload_0
      64: putstatic     #35                 // Field $EnumSwitchMapping$0:[I
      67: return
    Exception table:
       from    to  target type
           7    17    20   Class java/lang/NoSuchFieldError
          21    31    34   Class java/lang/NoSuchFieldError
          35    45    48   Class java/lang/NoSuchFieldError
          49    59    62   Class java/lang/NoSuchFieldError
}