package net.sinceat.aoc2020.day17

fun main() {
    run {
        var grid = Grid(readInput("testinput.txt") { x, y -> GridPoint3d(x, y, 0) }, ::drawGrid3d)
        (1 .. 6).forEach {
            grid = grid.evolve()
        }
        println(grid.countActive())
        println()
    }
    run {
        var grid = Grid(readInput("input.txt") { x, y -> GridPoint3d(x, y, 0) }, ::drawGrid3d)
        (1 .. 6).forEach {
            grid = grid.evolve()
        }
        println(grid.countActive())
        println()
    }
    run {
        var grid = Grid(readInput("testinput.txt") { x, y -> GridPoint4d(x, y, 0, 0) }, ::drawGrid4d)
        (1 .. 6).forEach {
            grid = grid.evolve()
        }
        println(grid.countActive())
        println()
    }
    run {
        var grid = Grid(readInput("input.txt") { x, y -> GridPoint4d(x, y, 0, 0) }, ::drawGrid4d)
        (1 .. 6).forEach {
            grid = grid.evolve()
        }
        println(grid.countActive())
        println()
    }
}

fun <T> readInput(fileName: String, mapper: (Int, Int) -> T): Map<T, Char> {
    return ClassLoader.getSystemResourceAsStream(fileName)!!.bufferedReader().useLines { lines ->
        lines.filter(String::isNotEmpty).flatMapIndexed { yIndex, line ->
            line.toCharArray().mapIndexed { xIndex, char -> if (char == '#') mapper(xIndex, yIndex) else null }.filterNotNull()
        }.associateWith { '#' }
    }
}

fun <T : GridPoint<T>> Grid<T>.evolve(): Grid<T> {
    val allActive = data.filterValues { it == '#' }.keys
    val remainingActive = allActive.filter { gridPoint ->
        gridPoint.neighbors().filter { it in allActive }.count() in 2 .. 3
    }
    val goingActive = allActive.flatMap { activeNeighbor ->
        val inactiveNeighbors = activeNeighbor.neighbors().filter { it !in allActive }
        inactiveNeighbors.map { inactiveNeighbor -> Pair(inactiveNeighbor, activeNeighbor) }
    }.groupBy { it.first }
        .mapValues { (_, pairs) -> pairs.map { it.second }.distinct().count() }
        .filterValues { it == 3 }
        .keys
    return Grid((remainingActive + goingActive).associateWith { '#' }, formatter)
}

fun <T : GridPoint<T>> Grid<T>.countActive(): Int {
    return data.size
}

fun drawGrid3d(data: Map<GridPoint3d, Char>) = buildString {
    if (data.isEmpty()) {
        return ""
    }
    val xs = data.keys.map(GridPoint3d::x)
    val ys = data.keys.map(GridPoint3d::y)
    val zs = data.keys.map(GridPoint3d::z)
    val xRange = xs.minOrNull()!! .. xs.maxOrNull()!!
    val yRange = ys.minOrNull()!! .. ys.maxOrNull()!!
    val zRange = zs.minOrNull()!! .. zs.maxOrNull()!!
    for (z in zRange) {
        appendLine("z=$z")
        for (y in yRange) {
            for (x in xRange) {
                append(data[GridPoint3d(x, y, z)] ?: '.')
            }
            appendLine()
        }
        appendLine()
    }
}

fun drawGrid4d(data: Map<GridPoint4d, Char>) = buildString {
    if (data.isEmpty()) {
        return ""
    }
    val xs = data.keys.map(GridPoint4d::x)
    val ys = data.keys.map(GridPoint4d::y)
    val zs = data.keys.map(GridPoint4d::z)
    val ws = data.keys.map(GridPoint4d::w)
    val xRange = xs.minOrNull()!! .. xs.maxOrNull()!!
    val yRange = ys.minOrNull()!! .. ys.maxOrNull()!!
    val zRange = zs.minOrNull()!! .. zs.maxOrNull()!!
    val wRange = ws.minOrNull()!! .. ws.maxOrNull()!!
    for (w in wRange) {
        for (z in zRange) {
            appendLine("z=$z,w=$w")
            for (y in yRange) {
                for (x in xRange) {
                    append(data[GridPoint4d(x, y, z, w)] ?: '.')
                }
                appendLine()
            }
            appendLine()
        }
    }
}

interface GridPoint<T : GridPoint<T>> {

    fun neighbors(): List<T>

    operator fun compareTo(other: T): Int
}

data class GridPoint3d(val x: Int, val y: Int, val z: Int) : GridPoint<GridPoint3d> {

    override fun neighbors(): List<GridPoint3d> {
        return sequence {
            for (nx in (x - 1) .. (x + 1)) {
                for (ny in (y - 1) .. (y + 1)) {
                    for (nz in (z - 1) .. (z + 1)) {
                        if (nx == x && ny == y && nz == z) {
                            continue
                        }
                        yield(GridPoint3d(nx, ny, nz))
                    }
                }
            }
        }.toList()
    }

    override fun compareTo(other: GridPoint3d): Int {
        val xCmp = x.compareTo(other.x)
        if (xCmp != 0) {
            return xCmp
        }
        val yCmp = y.compareTo(other.y)
        if (yCmp != 0) {
            return yCmp
        }
        return z.compareTo(other.z)
    }
}

data class GridPoint4d(val x: Int, val y: Int, val z: Int, val w: Int) : GridPoint<GridPoint4d> {

    override fun neighbors(): List<GridPoint4d> {
        return sequence {
            for (nx in (x - 1) .. (x + 1)) {
                for (ny in (y - 1) .. (y + 1)) {
                    for (nz in (z - 1) .. (z + 1)) {
                        for (nw in (w - 1) .. (w + 1)) {
                            if (nx == x && ny == y && nz == z && nw == w) {
                                continue
                            }
                            yield(GridPoint4d(nx, ny, nz, nw))
                        }
                    }
                }
            }
        }.toList()
    }

    override fun compareTo(other: GridPoint4d): Int {
        val cmp3d = reduce().compareTo(other.reduce())
        if (cmp3d != 0) return cmp3d
        return w.compareTo(other.w)
    }

    private fun reduce(): GridPoint3d = GridPoint3d(x, y, z)
}

class Grid<T : GridPoint<T>>(val data: Map<T, Char>, val formatter: (Map<T, Char>) -> String) {

    override fun toString(): String = formatter(data)
}

Compiled from "App.kt"
public final class net.sinceat.aoc2020.day17.AppKt {
  public static final void main();
    Code:
       0: iconst_0
       1: istore_0
       2: aconst_null
       3: astore_1
       4: new           #8                  // class net/sinceat/aoc2020/day17/Grid
       7: dup
       8: ldc           #10                 // String testinput.txt
      10: invokedynamic #30,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function2;
      15: invokestatic  #34                 // Method readInput:(Ljava/lang/String;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
      18: getstatic     #40                 // Field net/sinceat/aoc2020/day17/AppKt$main$1$grid$2.INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$1$grid$2;
      21: checkcast     #42                 // class kotlin/jvm/functions/Function1
      24: invokespecial #46                 // Method net/sinceat/aoc2020/day17/Grid."<init>":(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
      27: astore_1
      28: new           #48                 // class kotlin/ranges/IntRange
      31: dup
      32: iconst_1
      33: bipush        6
      35: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
      38: checkcast     #53                 // class java/lang/Iterable
      41: astore_2
      42: iconst_0
      43: istore_3
      44: aload_2
      45: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      50: astore        4
      52: aload         4
      54: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      59: ifeq          89
      62: aload         4
      64: checkcast     #65                 // class kotlin/collections/IntIterator
      67: invokevirtual #69                 // Method kotlin/collections/IntIterator.nextInt:()I
      70: istore        5
      72: iload         5
      74: istore        6
      76: iconst_0
      77: istore        7
      79: aload_1
      80: invokestatic  #73                 // Method evolve:(Lnet/sinceat/aoc2020/day17/Grid;)Lnet/sinceat/aoc2020/day17/Grid;
      83: astore_1
      84: nop
      85: nop
      86: goto          52
      89: nop
      90: aload_1
      91: invokestatic  #77                 // Method countActive:(Lnet/sinceat/aoc2020/day17/Grid;)I
      94: istore_2
      95: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
      98: iload_2
      99: invokevirtual #89                 // Method java/io/PrintStream.println:(I)V
     102: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     105: invokevirtual #91                 // Method java/io/PrintStream.println:()V
     108: nop
     109: nop
     110: iconst_0
     111: istore_0
     112: aconst_null
     113: astore_1
     114: new           #8                  // class net/sinceat/aoc2020/day17/Grid
     117: dup
     118: ldc           #93                 // String input.txt
     120: invokedynamic #98,  0             // InvokeDynamic #1:invoke:()Lkotlin/jvm/functions/Function2;
     125: invokestatic  #34                 // Method readInput:(Ljava/lang/String;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
     128: getstatic     #103                // Field net/sinceat/aoc2020/day17/AppKt$main$2$grid$2.INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$2$grid$2;
     131: checkcast     #42                 // class kotlin/jvm/functions/Function1
     134: invokespecial #46                 // Method net/sinceat/aoc2020/day17/Grid."<init>":(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
     137: astore_1
     138: new           #48                 // class kotlin/ranges/IntRange
     141: dup
     142: iconst_1
     143: bipush        6
     145: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     148: checkcast     #53                 // class java/lang/Iterable
     151: astore_2
     152: iconst_0
     153: istore_3
     154: aload_2
     155: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     160: astore        4
     162: aload         4
     164: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     169: ifeq          199
     172: aload         4
     174: checkcast     #65                 // class kotlin/collections/IntIterator
     177: invokevirtual #69                 // Method kotlin/collections/IntIterator.nextInt:()I
     180: istore        5
     182: iload         5
     184: istore        6
     186: iconst_0
     187: istore        7
     189: aload_1
     190: invokestatic  #73                 // Method evolve:(Lnet/sinceat/aoc2020/day17/Grid;)Lnet/sinceat/aoc2020/day17/Grid;
     193: astore_1
     194: nop
     195: nop
     196: goto          162
     199: nop
     200: aload_1
     201: invokestatic  #77                 // Method countActive:(Lnet/sinceat/aoc2020/day17/Grid;)I
     204: istore_2
     205: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     208: iload_2
     209: invokevirtual #89                 // Method java/io/PrintStream.println:(I)V
     212: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     215: invokevirtual #91                 // Method java/io/PrintStream.println:()V
     218: nop
     219: nop
     220: iconst_0
     221: istore_0
     222: aconst_null
     223: astore_1
     224: new           #8                  // class net/sinceat/aoc2020/day17/Grid
     227: dup
     228: ldc           #10                 // String testinput.txt
     230: invokedynamic #111,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;
     235: invokestatic  #34                 // Method readInput:(Ljava/lang/String;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
     238: getstatic     #116                // Field net/sinceat/aoc2020/day17/AppKt$main$3$grid$2.INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$3$grid$2;
     241: checkcast     #42                 // class kotlin/jvm/functions/Function1
     244: invokespecial #46                 // Method net/sinceat/aoc2020/day17/Grid."<init>":(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
     247: astore_1
     248: new           #48                 // class kotlin/ranges/IntRange
     251: dup
     252: iconst_1
     253: bipush        6
     255: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     258: checkcast     #53                 // class java/lang/Iterable
     261: astore_2
     262: iconst_0
     263: istore_3
     264: aload_2
     265: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     270: astore        4
     272: aload         4
     274: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     279: ifeq          309
     282: aload         4
     284: checkcast     #65                 // class kotlin/collections/IntIterator
     287: invokevirtual #69                 // Method kotlin/collections/IntIterator.nextInt:()I
     290: istore        5
     292: iload         5
     294: istore        6
     296: iconst_0
     297: istore        7
     299: aload_1
     300: invokestatic  #73                 // Method evolve:(Lnet/sinceat/aoc2020/day17/Grid;)Lnet/sinceat/aoc2020/day17/Grid;
     303: astore_1
     304: nop
     305: nop
     306: goto          272
     309: nop
     310: aload_1
     311: invokestatic  #77                 // Method countActive:(Lnet/sinceat/aoc2020/day17/Grid;)I
     314: istore_2
     315: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     318: iload_2
     319: invokevirtual #89                 // Method java/io/PrintStream.println:(I)V
     322: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     325: invokevirtual #91                 // Method java/io/PrintStream.println:()V
     328: nop
     329: nop
     330: iconst_0
     331: istore_0
     332: aconst_null
     333: astore_1
     334: new           #8                  // class net/sinceat/aoc2020/day17/Grid
     337: dup
     338: ldc           #93                 // String input.txt
     340: invokedynamic #121,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function2;
     345: invokestatic  #34                 // Method readInput:(Ljava/lang/String;Lkotlin/jvm/functions/Function2;)Ljava/util/Map;
     348: getstatic     #126                // Field net/sinceat/aoc2020/day17/AppKt$main$4$grid$2.INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$4$grid$2;
     351: checkcast     #42                 // class kotlin/jvm/functions/Function1
     354: invokespecial #46                 // Method net/sinceat/aoc2020/day17/Grid."<init>":(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
     357: astore_1
     358: new           #48                 // class kotlin/ranges/IntRange
     361: dup
     362: iconst_1
     363: bipush        6
     365: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     368: checkcast     #53                 // class java/lang/Iterable
     371: astore_2
     372: iconst_0
     373: istore_3
     374: aload_2
     375: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     380: astore        4
     382: aload         4
     384: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     389: ifeq          419
     392: aload         4
     394: checkcast     #65                 // class kotlin/collections/IntIterator
     397: invokevirtual #69                 // Method kotlin/collections/IntIterator.nextInt:()I
     400: istore        5
     402: iload         5
     404: istore        6
     406: iconst_0
     407: istore        7
     409: aload_1
     410: invokestatic  #73                 // Method evolve:(Lnet/sinceat/aoc2020/day17/Grid;)Lnet/sinceat/aoc2020/day17/Grid;
     413: astore_1
     414: nop
     415: nop
     416: goto          382
     419: nop
     420: aload_1
     421: invokestatic  #77                 // Method countActive:(Lnet/sinceat/aoc2020/day17/Grid;)I
     424: istore_2
     425: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     428: iload_2
     429: invokevirtual #89                 // Method java/io/PrintStream.println:(I)V
     432: getstatic     #83                 // Field java/lang/System.out:Ljava/io/PrintStream;
     435: invokevirtual #91                 // Method java/io/PrintStream.println:()V
     438: nop
     439: nop
     440: return

  public static final <T> java.util.Map<T, java.lang.Character> readInput(java.lang.String, kotlin.jvm.functions.Function2<? super java.lang.Integer, ? super java.lang.Integer, ? extends T>);
    Code:
       0: aload_0
       1: ldc           #148                // String fileName
       3: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #156                // String mapper
       9: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokestatic  #162                // Method java/lang/ClassLoader.getSystemResourceAsStream:(Ljava/lang/String;)Ljava/io/InputStream;
      16: dup
      17: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      20: astore_2
      21: getstatic     #172                // Field kotlin/text/Charsets.UTF_8:Ljava/nio/charset/Charset;
      24: astore_3
      25: new           #174                // class java/io/InputStreamReader
      28: dup
      29: aload_2
      30: aload_3
      31: invokespecial #177                // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
      34: checkcast     #179                // class java/io/Reader
      37: astore        4
      39: sipush        8192
      42: istore        5
      44: aload         4
      46: instanceof    #181                // class java/io/BufferedReader
      49: ifeq          60
      52: aload         4
      54: checkcast     #181                // class java/io/BufferedReader
      57: goto          71
      60: new           #181                // class java/io/BufferedReader
      63: dup
      64: aload         4
      66: iload         5
      68: invokespecial #184                // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
      71: checkcast     #179                // class java/io/Reader
      74: astore_2
      75: nop
      76: iconst_0
      77: istore_3
      78: aload_2
      79: astore        4
      81: sipush        8192
      84: istore        5
      86: aload         4
      88: instanceof    #181                // class java/io/BufferedReader
      91: ifeq          102
      94: aload         4
      96: checkcast     #181                // class java/io/BufferedReader
      99: goto          113
     102: new           #181                // class java/io/BufferedReader
     105: dup
     106: aload         4
     108: iload         5
     110: invokespecial #184                // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;I)V
     113: checkcast     #186                // class java/io/Closeable
     116: astore        4
     118: aconst_null
     119: astore        5
     121: nop
     122: aload         4
     124: checkcast     #181                // class java/io/BufferedReader
     127: astore        6
     129: iconst_0
     130: istore        7
     132: aload         6
     134: invokestatic  #192                // Method kotlin/io/TextStreamsKt.lineSequence:(Ljava/io/BufferedReader;)Lkotlin/sequences/Sequence;
     137: astore        8
     139: iconst_0
     140: istore        9
     142: aload         8
     144: getstatic     #197                // Field net/sinceat/aoc2020/day17/AppKt$readInput$1$1.INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$readInput$1$1;
     147: checkcast     #42                 // class kotlin/jvm/functions/Function1
     150: invokestatic  #203                // Method kotlin/sequences/SequencesKt.filter:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
     153: aload_1
     154: invokedynamic #213,  0            // InvokeDynamic #4:invoke:(Lkotlin/jvm/functions/Function2;)Lkotlin/jvm/functions/Function2;
     159: invokestatic  #217                // Method kotlin/sequences/SequencesKt.flatMapIndexedIterable:(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function2;)Lkotlin/sequences/Sequence;
     162: astore        10
     164: nop
     165: iconst_0
     166: istore        11
     168: new           #219                // class java/util/LinkedHashMap
     171: dup
     172: invokespecial #221                // Method java/util/LinkedHashMap."<init>":()V
     175: astore        12
     177: aload         10
     179: astore        13
     181: iconst_0
     182: istore        14
     184: aload         13
     186: invokeinterface #224,  1          // InterfaceMethod kotlin/sequences/Sequence.iterator:()Ljava/util/Iterator;
     191: astore        15
     193: aload         15
     195: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     200: ifeq          252
     203: aload         15
     205: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     210: astore        16
     212: aload         12
     214: checkcast     #230                // class java/util/Map
     217: aload         16
     219: aload         16
     221: astore        17
     223: astore        18
     225: astore        19
     227: iconst_0
     228: istore        20
     230: bipush        35
     232: invokestatic  #236                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     235: astore        21
     237: aload         19
     239: aload         18
     241: aload         21
     243: invokeinterface #239,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     248: pop
     249: goto          193
     252: aload         12
     254: checkcast     #230                // class java/util/Map
     257: nop
     258: nop
     259: astore        6
     261: aload         4
     263: aload         5
     265: invokestatic  #245                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     268: aload         6
     270: goto          294
     273: astore        7
     275: aload         7
     277: astore        5
     279: aload         7
     281: athrow
     282: astore        7
     284: aload         4
     286: aload         5
     288: invokestatic  #245                // Method kotlin/io/CloseableKt.closeFinally:(Ljava/io/Closeable;Ljava/lang/Throwable;)V
     291: aload         7
     293: athrow
     294: nop
     295: areturn
    Exception table:
       from    to  target type
         121   261   273   Class java/lang/Throwable
         121   261   282   any
         273   282   282   any
         282   284   282   any

  public static final <T extends net.sinceat.aoc2020.day17.GridPoint<T>> net.sinceat.aoc2020.day17.Grid<T> evolve(net.sinceat.aoc2020.day17.Grid<T>);
    Code:
       0: aload_0
       1: ldc_w         #275                // String <this>
       4: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #279                // Method net/sinceat/aoc2020/day17/Grid.getData:()Ljava/util/Map;
      11: astore_2
      12: iconst_0
      13: istore_3
      14: new           #219                // class java/util/LinkedHashMap
      17: dup
      18: invokespecial #221                // Method java/util/LinkedHashMap."<init>":()V
      21: astore        4
      23: aload_2
      24: invokeinterface #283,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      29: invokeinterface #286,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      34: astore        5
      36: aload         5
      38: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      43: ifeq          114
      46: aload         5
      48: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      53: checkcast     #288                // class java/util/Map$Entry
      56: astore        6
      58: aload         6
      60: invokeinterface #291,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      65: checkcast     #232                // class java/lang/Character
      68: invokevirtual #295                // Method java/lang/Character.charValue:()C
      71: istore        7
      73: iconst_0
      74: istore        8
      76: iload         7
      78: bipush        35
      80: if_icmpne     87
      83: iconst_1
      84: goto          88
      87: iconst_0
      88: ifeq          36
      91: aload         4
      93: aload         6
      95: invokeinterface #298,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     100: aload         6
     102: invokeinterface #291,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     107: invokevirtual #299                // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     110: pop
     111: goto          36
     114: aload         4
     116: checkcast     #230                // class java/util/Map
     119: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     124: astore_1
     125: aload_1
     126: checkcast     #53                 // class java/lang/Iterable
     129: astore_3
     130: iconst_0
     131: istore        4
     133: aload_3
     134: astore        5
     136: new           #304                // class java/util/ArrayList
     139: dup
     140: invokespecial #305                // Method java/util/ArrayList."<init>":()V
     143: checkcast     #307                // class java/util/Collection
     146: astore        6
     148: iconst_0
     149: istore        7
     151: aload         5
     153: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     158: astore        8
     160: aload         8
     162: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     167: ifeq          338
     170: aload         8
     172: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     177: astore        9
     179: aload         9
     181: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
     184: astore        10
     186: iconst_0
     187: istore        11
     189: aload         10
     191: invokeinterface #313,  1          // InterfaceMethod net/sinceat/aoc2020/day17/GridPoint.neighbors:()Ljava/util/List;
     196: checkcast     #53                 // class java/lang/Iterable
     199: astore        12
     201: iconst_0
     202: istore        13
     204: aload         12
     206: astore        14
     208: new           #304                // class java/util/ArrayList
     211: dup
     212: invokespecial #305                // Method java/util/ArrayList."<init>":()V
     215: checkcast     #307                // class java/util/Collection
     218: astore        15
     220: iconst_0
     221: istore        16
     223: aload         14
     225: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     230: astore        17
     232: aload         17
     234: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     239: ifeq          285
     242: aload         17
     244: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     249: astore        18
     251: aload         18
     253: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
     256: astore        19
     258: iconst_0
     259: istore        20
     261: aload_1
     262: aload         19
     264: invokeinterface #317,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     269: ifeq          232
     272: aload         15
     274: aload         18
     276: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     281: pop
     282: goto          232
     285: aload         15
     287: checkcast     #322                // class java/util/List
     290: nop
     291: checkcast     #307                // class java/util/Collection
     294: invokeinterface #325,  1          // InterfaceMethod java/util/Collection.size:()I
     299: istore        21
     301: iconst_2
     302: iload         21
     304: if_icmpgt     321
     307: iload         21
     309: iconst_4
     310: if_icmpge     317
     313: iconst_1
     314: goto          322
     317: iconst_0
     318: goto          322
     321: iconst_0
     322: ifeq          160
     325: aload         6
     327: aload         9
     329: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     334: pop
     335: goto          160
     338: aload         6
     340: checkcast     #322                // class java/util/List
     343: nop
     344: astore_2
     345: aload_1
     346: checkcast     #53                 // class java/lang/Iterable
     349: astore        4
     351: iconst_0
     352: istore        5
     354: aload         4
     356: astore        6
     358: new           #304                // class java/util/ArrayList
     361: dup
     362: invokespecial #305                // Method java/util/ArrayList."<init>":()V
     365: checkcast     #307                // class java/util/Collection
     368: astore        7
     370: iconst_0
     371: istore        8
     373: aload         6
     375: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     380: astore        9
     382: aload         9
     384: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     389: ifeq          647
     392: aload         9
     394: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     399: astore        10
     401: aload         10
     403: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
     406: astore        11
     408: iconst_0
     409: istore        12
     411: aload         11
     413: invokeinterface #313,  1          // InterfaceMethod net/sinceat/aoc2020/day17/GridPoint.neighbors:()Ljava/util/List;
     418: checkcast     #53                 // class java/lang/Iterable
     421: astore        13
     423: iconst_0
     424: istore        14
     426: aload         13
     428: astore        15
     430: new           #304                // class java/util/ArrayList
     433: dup
     434: invokespecial #305                // Method java/util/ArrayList."<init>":()V
     437: checkcast     #307                // class java/util/Collection
     440: astore        16
     442: iconst_0
     443: istore        17
     445: aload         15
     447: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     452: astore        18
     454: aload         18
     456: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     461: ifeq          515
     464: aload         18
     466: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     471: astore        19
     473: aload         19
     475: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
     478: astore        20
     480: iconst_0
     481: istore        21
     483: aload_1
     484: aload         20
     486: invokeinterface #317,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     491: ifne          498
     494: iconst_1
     495: goto          499
     498: iconst_0
     499: ifeq          454
     502: aload         16
     504: aload         19
     506: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     511: pop
     512: goto          454
     515: aload         16
     517: checkcast     #322                // class java/util/List
     520: nop
     521: astore        22
     523: aload         22
     525: checkcast     #53                 // class java/lang/Iterable
     528: astore        13
     530: iconst_0
     531: istore        14
     533: aload         13
     535: astore        15
     537: new           #304                // class java/util/ArrayList
     540: dup
     541: aload         13
     543: bipush        10
     545: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     548: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     551: checkcast     #307                // class java/util/Collection
     554: astore        16
     556: iconst_0
     557: istore        17
     559: aload         15
     561: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     566: astore        18
     568: aload         18
     570: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     575: ifeq          624
     578: aload         18
     580: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     585: astore        19
     587: aload         16
     589: aload         19
     591: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
     594: astore        20
     596: astore        23
     598: iconst_0
     599: istore        21
     601: new           #335                // class kotlin/Pair
     604: dup
     605: aload         20
     607: aload         11
     609: invokespecial #338                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     612: aload         23
     614: swap
     615: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     620: pop
     621: goto          568
     624: aload         16
     626: checkcast     #322                // class java/util/List
     629: nop
     630: checkcast     #53                 // class java/lang/Iterable
     633: nop
     634: astore        11
     636: aload         7
     638: aload         11
     640: invokestatic  #342                // Method kotlin/collections/CollectionsKt.addAll:(Ljava/util/Collection;Ljava/lang/Iterable;)Z
     643: pop
     644: goto          382
     647: aload         7
     649: checkcast     #322                // class java/util/List
     652: nop
     653: checkcast     #53                 // class java/lang/Iterable
     656: astore        4
     658: nop
     659: iconst_0
     660: istore        5
     662: aload         4
     664: astore        6
     666: new           #219                // class java/util/LinkedHashMap
     669: dup
     670: invokespecial #221                // Method java/util/LinkedHashMap."<init>":()V
     673: checkcast     #230                // class java/util/Map
     676: astore        7
     678: iconst_0
     679: istore        8
     681: aload         6
     683: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     688: astore        9
     690: aload         9
     692: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     697: ifeq          805
     700: aload         9
     702: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     707: astore        10
     709: aload         10
     711: checkcast     #335                // class kotlin/Pair
     714: astore        11
     716: iconst_0
     717: istore        12
     719: aload         11
     721: invokevirtual #345                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     724: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
     727: astore        13
     729: aload         7
     731: astore        14
     733: iconst_0
     734: istore        15
     736: aload         14
     738: aload         13
     740: invokeinterface #349,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     745: astore        16
     747: aload         16
     749: ifnonnull     784
     752: iconst_0
     753: istore        17
     755: new           #304                // class java/util/ArrayList
     758: dup
     759: invokespecial #305                // Method java/util/ArrayList."<init>":()V
     762: checkcast     #322                // class java/util/List
     765: astore        17
     767: aload         14
     769: aload         13
     771: aload         17
     773: invokeinterface #239,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     778: pop
     779: aload         17
     781: goto          786
     784: aload         16
     786: nop
     787: checkcast     #322                // class java/util/List
     790: astore        11
     792: aload         11
     794: aload         10
     796: invokeinterface #350,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     801: pop
     802: goto          690
     805: aload         7
     807: nop
     808: astore        4
     810: nop
     811: iconst_0
     812: istore        5
     814: aload         4
     816: astore        6
     818: new           #219                // class java/util/LinkedHashMap
     821: dup
     822: aload         4
     824: invokeinterface #351,  1          // InterfaceMethod java/util/Map.size:()I
     829: invokestatic  #357                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
     832: invokespecial #358                // Method java/util/LinkedHashMap."<init>":(I)V
     835: checkcast     #230                // class java/util/Map
     838: astore        7
     840: iconst_0
     841: istore        8
     843: aload         6
     845: invokeinterface #283,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     850: checkcast     #53                 // class java/lang/Iterable
     853: astore        9
     855: iconst_0
     856: istore        10
     858: aload         9
     860: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     865: astore        11
     867: aload         11
     869: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     874: ifeq          1075
     877: aload         11
     879: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     884: astore        12
     886: aload         7
     888: aload         12
     890: checkcast     #288                // class java/util/Map$Entry
     893: astore        13
     895: astore        14
     897: iconst_0
     898: istore        15
     900: aload         13
     902: invokeinterface #298,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     907: aload         14
     909: swap
     910: aload         12
     912: checkcast     #288                // class java/util/Map$Entry
     915: astore        16
     917: astore        30
     919: astore        29
     921: iconst_0
     922: istore        17
     924: aload         16
     926: invokeinterface #291,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     931: checkcast     #322                // class java/util/List
     934: astore        18
     936: aload         18
     938: checkcast     #53                 // class java/lang/Iterable
     941: astore        19
     943: iconst_0
     944: istore        20
     946: aload         19
     948: astore        21
     950: new           #304                // class java/util/ArrayList
     953: dup
     954: aload         19
     956: bipush        10
     958: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     961: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     964: checkcast     #307                // class java/util/Collection
     967: astore        22
     969: iconst_0
     970: istore        23
     972: aload         21
     974: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     979: astore        24
     981: aload         24
     983: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     988: ifeq          1034
     991: aload         24
     993: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     998: astore        25
    1000: aload         22
    1002: aload         25
    1004: checkcast     #335                // class kotlin/Pair
    1007: astore        26
    1009: astore        27
    1011: iconst_0
    1012: istore        28
    1014: aload         26
    1016: invokevirtual #361                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
    1019: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
    1022: aload         27
    1024: swap
    1025: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
    1030: pop
    1031: goto          981
    1034: aload         22
    1036: checkcast     #322                // class java/util/List
    1039: nop
    1040: checkcast     #53                 // class java/lang/Iterable
    1043: invokestatic  #365                // Method kotlin/collections/CollectionsKt.distinct:(Ljava/lang/Iterable;)Ljava/util/List;
    1046: checkcast     #307                // class java/util/Collection
    1049: invokeinterface #325,  1          // InterfaceMethod java/util/Collection.size:()I
    1054: nop
    1055: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1058: astore        31
    1060: aload         29
    1062: aload         30
    1064: aload         31
    1066: invokeinterface #239,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1071: pop
    1072: goto          867
    1075: aload         7
    1077: nop
    1078: nop
    1079: astore        4
    1081: nop
    1082: iconst_0
    1083: istore        5
    1085: new           #219                // class java/util/LinkedHashMap
    1088: dup
    1089: invokespecial #221                // Method java/util/LinkedHashMap."<init>":()V
    1092: astore        6
    1094: aload         4
    1096: invokeinterface #283,  1          // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
    1101: invokeinterface #286,  1          // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
    1106: astore        7
    1108: aload         7
    1110: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1115: ifeq          1185
    1118: aload         7
    1120: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1125: checkcast     #288                // class java/util/Map$Entry
    1128: astore        8
    1130: aload         8
    1132: invokeinterface #291,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    1137: checkcast     #372                // class java/lang/Number
    1140: invokevirtual #375                // Method java/lang/Number.intValue:()I
    1143: istore        9
    1145: iconst_0
    1146: istore        10
    1148: iload         9
    1150: iconst_3
    1151: if_icmpne     1158
    1154: iconst_1
    1155: goto          1159
    1158: iconst_0
    1159: ifeq          1108
    1162: aload         6
    1164: aload         8
    1166: invokeinterface #298,  1          // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
    1171: aload         8
    1173: invokeinterface #291,  1          // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
    1178: invokevirtual #299                // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1181: pop
    1182: goto          1108
    1185: aload         6
    1187: checkcast     #230                // class java/util/Map
    1190: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
    1195: astore_3
    1196: aload_2
    1197: checkcast     #307                // class java/util/Collection
    1200: aload_3
    1201: checkcast     #53                 // class java/lang/Iterable
    1204: invokestatic  #379                // Method kotlin/collections/CollectionsKt.plus:(Ljava/util/Collection;Ljava/lang/Iterable;)Ljava/util/List;
    1207: checkcast     #53                 // class java/lang/Iterable
    1210: astore        4
    1212: iconst_0
    1213: istore        5
    1215: new           #219                // class java/util/LinkedHashMap
    1218: dup
    1219: aload         4
    1221: bipush        10
    1223: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
    1226: invokestatic  #357                // Method kotlin/collections/MapsKt.mapCapacity:(I)I
    1229: bipush        16
    1231: invokestatic  #385                // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
    1234: invokespecial #358                // Method java/util/LinkedHashMap."<init>":(I)V
    1237: astore        6
    1239: aload         4
    1241: astore        7
    1243: iconst_0
    1244: istore        8
    1246: aload         7
    1248: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
    1253: astore        9
    1255: aload         9
    1257: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
    1262: ifeq          1317
    1265: aload         9
    1267: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
    1272: astore        10
    1274: aload         6
    1276: checkcast     #230                // class java/util/Map
    1279: aload         10
    1281: aload         10
    1283: checkcast     #309                // class net/sinceat/aoc2020/day17/GridPoint
    1286: astore        11
    1288: astore        32
    1290: astore        31
    1292: iconst_0
    1293: istore        12
    1295: bipush        35
    1297: invokestatic  #236                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
    1300: astore        33
    1302: aload         31
    1304: aload         32
    1306: aload         33
    1308: invokeinterface #239,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    1313: pop
    1314: goto          1255
    1317: aload         6
    1319: checkcast     #230                // class java/util/Map
    1322: nop
    1323: aload_0
    1324: invokevirtual #389                // Method net/sinceat/aoc2020/day17/Grid.getFormatter:()Lkotlin/jvm/functions/Function1;
    1327: astore        34
    1329: astore        35
    1331: new           #8                  // class net/sinceat/aoc2020/day17/Grid
    1334: dup
    1335: aload         35
    1337: aload         34
    1339: invokespecial #46                 // Method net/sinceat/aoc2020/day17/Grid."<init>":(Ljava/util/Map;Lkotlin/jvm/functions/Function1;)V
    1342: areturn

  public static final <T extends net.sinceat.aoc2020.day17.GridPoint<T>> int countActive(net.sinceat.aoc2020.day17.Grid<T>);
    Code:
       0: aload_0
       1: ldc_w         #275                // String <this>
       4: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokevirtual #279                // Method net/sinceat/aoc2020/day17/Grid.getData:()Ljava/util/Map;
      11: invokeinterface #351,  1          // InterfaceMethod java/util/Map.size:()I
      16: ireturn

  public static final java.lang.String drawGrid3d(java.util.Map<net.sinceat.aoc2020.day17.GridPoint3d, java.lang.Character>);
    Code:
       0: aload_0
       1: ldc_w         #462                // String data
       4: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #464                // class java/lang/StringBuilder
      10: dup
      11: invokespecial #465                // Method java/lang/StringBuilder."<init>":()V
      14: astore_1
      15: aload_1
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_0
      20: invokeinterface #468,  1          // InterfaceMethod java/util/Map.isEmpty:()Z
      25: ifeq          32
      28: ldc_w         #470                // String
      31: areturn
      32: aload_0
      33: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      38: checkcast     #53                 // class java/lang/Iterable
      41: astore        4
      43: iconst_0
      44: istore        5
      46: aload         4
      48: astore        6
      50: new           #304                // class java/util/ArrayList
      53: dup
      54: aload         4
      56: bipush        10
      58: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      61: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
      64: checkcast     #307                // class java/util/Collection
      67: astore        7
      69: iconst_0
      70: istore        8
      72: aload         6
      74: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      79: astore        9
      81: aload         9
      83: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      88: ifeq          134
      91: aload         9
      93: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      98: astore        10
     100: aload         7
     102: aload         10
     104: checkcast     #472                // class net/sinceat/aoc2020/day17/GridPoint3d
     107: astore        11
     109: astore        12
     111: iconst_0
     112: istore        13
     114: aload         11
     116: invokevirtual #475                // Method net/sinceat/aoc2020/day17/GridPoint3d.getX:()I
     119: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     122: aload         12
     124: swap
     125: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     130: pop
     131: goto          81
     134: aload         7
     136: checkcast     #322                // class java/util/List
     139: nop
     140: astore        14
     142: aload_0
     143: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     148: checkcast     #53                 // class java/lang/Iterable
     151: astore        5
     153: iconst_0
     154: istore        6
     156: aload         5
     158: astore        7
     160: new           #304                // class java/util/ArrayList
     163: dup
     164: aload         5
     166: bipush        10
     168: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     171: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     174: checkcast     #307                // class java/util/Collection
     177: astore        8
     179: iconst_0
     180: istore        9
     182: aload         7
     184: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     189: astore        10
     191: aload         10
     193: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     198: ifeq          244
     201: aload         10
     203: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     208: astore        11
     210: aload         8
     212: aload         11
     214: checkcast     #472                // class net/sinceat/aoc2020/day17/GridPoint3d
     217: astore        13
     219: astore        12
     221: iconst_0
     222: istore        15
     224: aload         13
     226: invokevirtual #478                // Method net/sinceat/aoc2020/day17/GridPoint3d.getY:()I
     229: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     232: aload         12
     234: swap
     235: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     240: pop
     241: goto          191
     244: aload         8
     246: checkcast     #322                // class java/util/List
     249: nop
     250: astore        4
     252: aload_0
     253: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     258: checkcast     #53                 // class java/lang/Iterable
     261: astore        6
     263: iconst_0
     264: istore        7
     266: aload         6
     268: astore        8
     270: new           #304                // class java/util/ArrayList
     273: dup
     274: aload         6
     276: bipush        10
     278: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     281: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     284: checkcast     #307                // class java/util/Collection
     287: astore        9
     289: iconst_0
     290: istore        10
     292: aload         8
     294: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     299: astore        11
     301: aload         11
     303: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     308: ifeq          354
     311: aload         11
     313: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     318: astore        13
     320: aload         9
     322: aload         13
     324: checkcast     #472                // class net/sinceat/aoc2020/day17/GridPoint3d
     327: astore        15
     329: astore        12
     331: iconst_0
     332: istore        16
     334: aload         15
     336: invokevirtual #481                // Method net/sinceat/aoc2020/day17/GridPoint3d.getZ:()I
     339: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     342: aload         12
     344: swap
     345: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     350: pop
     351: goto          301
     354: aload         9
     356: checkcast     #322                // class java/util/List
     359: nop
     360: astore        5
     362: new           #48                 // class kotlin/ranges/IntRange
     365: dup
     366: aload         14
     368: checkcast     #53                 // class java/lang/Iterable
     371: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     374: dup
     375: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     378: checkcast     #372                // class java/lang/Number
     381: invokevirtual #375                // Method java/lang/Number.intValue:()I
     384: aload         14
     386: checkcast     #53                 // class java/lang/Iterable
     389: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     392: dup
     393: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     396: checkcast     #372                // class java/lang/Number
     399: invokevirtual #375                // Method java/lang/Number.intValue:()I
     402: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     405: astore        6
     407: new           #48                 // class kotlin/ranges/IntRange
     410: dup
     411: aload         4
     413: checkcast     #53                 // class java/lang/Iterable
     416: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     419: dup
     420: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     423: checkcast     #372                // class java/lang/Number
     426: invokevirtual #375                // Method java/lang/Number.intValue:()I
     429: aload         4
     431: checkcast     #53                 // class java/lang/Iterable
     434: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     437: dup
     438: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     441: checkcast     #372                // class java/lang/Number
     444: invokevirtual #375                // Method java/lang/Number.intValue:()I
     447: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     450: astore        7
     452: new           #48                 // class kotlin/ranges/IntRange
     455: dup
     456: aload         5
     458: checkcast     #53                 // class java/lang/Iterable
     461: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     464: dup
     465: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     468: checkcast     #372                // class java/lang/Number
     471: invokevirtual #375                // Method java/lang/Number.intValue:()I
     474: aload         5
     476: checkcast     #53                 // class java/lang/Iterable
     479: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     482: dup
     483: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     486: checkcast     #372                // class java/lang/Number
     489: invokevirtual #375                // Method java/lang/Number.intValue:()I
     492: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     495: astore        8
     497: aload         8
     499: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     502: istore        9
     504: aload         8
     506: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     509: istore        10
     511: iload         9
     513: iload         10
     515: if_icmpgt     684
     518: aload_2
     519: new           #464                // class java/lang/StringBuilder
     522: dup
     523: invokespecial #465                // Method java/lang/StringBuilder."<init>":()V
     526: ldc_w         #495                // String z=
     529: invokevirtual #499                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     532: iload         9
     534: invokevirtual #502                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     537: invokevirtual #506                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     540: invokevirtual #499                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     543: bipush        10
     545: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     548: pop
     549: aload         7
     551: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     554: istore        11
     556: aload         7
     558: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     561: istore        13
     563: iload         11
     565: iload         13
     567: if_icmpgt     664
     570: aload         6
     572: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     575: istore        15
     577: aload         6
     579: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     582: istore        16
     584: iload         15
     586: iload         16
     588: if_icmpgt     644
     591: aload_2
     592: aload_0
     593: new           #472                // class net/sinceat/aoc2020/day17/GridPoint3d
     596: dup
     597: iload         15
     599: iload         11
     601: iload         9
     603: invokespecial #512                // Method net/sinceat/aoc2020/day17/GridPoint3d."<init>":(III)V
     606: invokeinterface #349,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     611: checkcast     #232                // class java/lang/Character
     614: dup
     615: ifnull        624
     618: invokevirtual #295                // Method java/lang/Character.charValue:()C
     621: goto          627
     624: pop
     625: bipush        46
     627: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     630: pop
     631: iload         15
     633: iload         16
     635: if_icmpeq     644
     638: iinc          15, 1
     641: goto          591
     644: aload_2
     645: bipush        10
     647: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     650: pop
     651: iload         11
     653: iload         13
     655: if_icmpeq     664
     658: iinc          11, 1
     661: goto          570
     664: aload_2
     665: bipush        10
     667: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     670: pop
     671: iload         9
     673: iload         10
     675: if_icmpeq     684
     678: iinc          9, 1
     681: goto          518
     684: nop
     685: aload_1
     686: invokevirtual #506                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     689: areturn

  public static final java.lang.String drawGrid4d(java.util.Map<net.sinceat.aoc2020.day17.GridPoint4d, java.lang.Character>);
    Code:
       0: aload_0
       1: ldc_w         #462                // String data
       4: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #464                // class java/lang/StringBuilder
      10: dup
      11: invokespecial #465                // Method java/lang/StringBuilder."<init>":()V
      14: astore_1
      15: aload_1
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_0
      20: invokeinterface #468,  1          // InterfaceMethod java/util/Map.isEmpty:()Z
      25: ifeq          32
      28: ldc_w         #470                // String
      31: areturn
      32: aload_0
      33: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
      38: checkcast     #53                 // class java/lang/Iterable
      41: astore        4
      43: iconst_0
      44: istore        5
      46: aload         4
      48: astore        6
      50: new           #304                // class java/util/ArrayList
      53: dup
      54: aload         4
      56: bipush        10
      58: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      61: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
      64: checkcast     #307                // class java/util/Collection
      67: astore        7
      69: iconst_0
      70: istore        8
      72: aload         6
      74: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      79: astore        9
      81: aload         9
      83: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      88: ifeq          134
      91: aload         9
      93: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      98: astore        10
     100: aload         7
     102: aload         10
     104: checkcast     #534                // class net/sinceat/aoc2020/day17/GridPoint4d
     107: astore        11
     109: astore        12
     111: iconst_0
     112: istore        13
     114: aload         11
     116: invokevirtual #535                // Method net/sinceat/aoc2020/day17/GridPoint4d.getX:()I
     119: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     122: aload         12
     124: swap
     125: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     130: pop
     131: goto          81
     134: aload         7
     136: checkcast     #322                // class java/util/List
     139: nop
     140: astore        14
     142: aload_0
     143: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     148: checkcast     #53                 // class java/lang/Iterable
     151: astore        5
     153: iconst_0
     154: istore        6
     156: aload         5
     158: astore        7
     160: new           #304                // class java/util/ArrayList
     163: dup
     164: aload         5
     166: bipush        10
     168: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     171: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     174: checkcast     #307                // class java/util/Collection
     177: astore        8
     179: iconst_0
     180: istore        9
     182: aload         7
     184: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     189: astore        10
     191: aload         10
     193: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     198: ifeq          244
     201: aload         10
     203: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     208: astore        11
     210: aload         8
     212: aload         11
     214: checkcast     #534                // class net/sinceat/aoc2020/day17/GridPoint4d
     217: astore        13
     219: astore        12
     221: iconst_0
     222: istore        15
     224: aload         13
     226: invokevirtual #536                // Method net/sinceat/aoc2020/day17/GridPoint4d.getY:()I
     229: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     232: aload         12
     234: swap
     235: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     240: pop
     241: goto          191
     244: aload         8
     246: checkcast     #322                // class java/util/List
     249: nop
     250: astore        4
     252: aload_0
     253: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     258: checkcast     #53                 // class java/lang/Iterable
     261: astore        6
     263: iconst_0
     264: istore        7
     266: aload         6
     268: astore        8
     270: new           #304                // class java/util/ArrayList
     273: dup
     274: aload         6
     276: bipush        10
     278: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     281: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     284: checkcast     #307                // class java/util/Collection
     287: astore        9
     289: iconst_0
     290: istore        10
     292: aload         8
     294: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     299: astore        11
     301: aload         11
     303: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     308: ifeq          354
     311: aload         11
     313: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     318: astore        13
     320: aload         9
     322: aload         13
     324: checkcast     #534                // class net/sinceat/aoc2020/day17/GridPoint4d
     327: astore        15
     329: astore        12
     331: iconst_0
     332: istore        16
     334: aload         15
     336: invokevirtual #537                // Method net/sinceat/aoc2020/day17/GridPoint4d.getZ:()I
     339: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     342: aload         12
     344: swap
     345: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     350: pop
     351: goto          301
     354: aload         9
     356: checkcast     #322                // class java/util/List
     359: nop
     360: astore        5
     362: aload_0
     363: invokeinterface #302,  1          // InterfaceMethod java/util/Map.keySet:()Ljava/util/Set;
     368: checkcast     #53                 // class java/lang/Iterable
     371: astore        7
     373: iconst_0
     374: istore        8
     376: aload         7
     378: astore        9
     380: new           #304                // class java/util/ArrayList
     383: dup
     384: aload         7
     386: bipush        10
     388: invokestatic  #331                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     391: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
     394: checkcast     #307                // class java/util/Collection
     397: astore        10
     399: iconst_0
     400: istore        11
     402: aload         9
     404: invokeinterface #57,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     409: astore        13
     411: aload         13
     413: invokeinterface #63,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     418: ifeq          464
     421: aload         13
     423: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     428: astore        15
     430: aload         10
     432: aload         15
     434: checkcast     #534                // class net/sinceat/aoc2020/day17/GridPoint4d
     437: astore        16
     439: astore        12
     441: iconst_0
     442: istore        17
     444: aload         16
     446: invokevirtual #540                // Method net/sinceat/aoc2020/day17/GridPoint4d.getW:()I
     449: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     452: aload         12
     454: swap
     455: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     460: pop
     461: goto          411
     464: aload         10
     466: checkcast     #322                // class java/util/List
     469: nop
     470: astore        6
     472: new           #48                 // class kotlin/ranges/IntRange
     475: dup
     476: aload         14
     478: checkcast     #53                 // class java/lang/Iterable
     481: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     484: dup
     485: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     488: checkcast     #372                // class java/lang/Number
     491: invokevirtual #375                // Method java/lang/Number.intValue:()I
     494: aload         14
     496: checkcast     #53                 // class java/lang/Iterable
     499: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     502: dup
     503: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     506: checkcast     #372                // class java/lang/Number
     509: invokevirtual #375                // Method java/lang/Number.intValue:()I
     512: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     515: astore        7
     517: new           #48                 // class kotlin/ranges/IntRange
     520: dup
     521: aload         4
     523: checkcast     #53                 // class java/lang/Iterable
     526: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     529: dup
     530: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     533: checkcast     #372                // class java/lang/Number
     536: invokevirtual #375                // Method java/lang/Number.intValue:()I
     539: aload         4
     541: checkcast     #53                 // class java/lang/Iterable
     544: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     547: dup
     548: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     551: checkcast     #372                // class java/lang/Number
     554: invokevirtual #375                // Method java/lang/Number.intValue:()I
     557: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     560: astore        8
     562: new           #48                 // class kotlin/ranges/IntRange
     565: dup
     566: aload         5
     568: checkcast     #53                 // class java/lang/Iterable
     571: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     574: dup
     575: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     578: checkcast     #372                // class java/lang/Number
     581: invokevirtual #375                // Method java/lang/Number.intValue:()I
     584: aload         5
     586: checkcast     #53                 // class java/lang/Iterable
     589: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     592: dup
     593: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     596: checkcast     #372                // class java/lang/Number
     599: invokevirtual #375                // Method java/lang/Number.intValue:()I
     602: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     605: astore        9
     607: new           #48                 // class kotlin/ranges/IntRange
     610: dup
     611: aload         6
     613: checkcast     #53                 // class java/lang/Iterable
     616: invokestatic  #485                // Method kotlin/collections/CollectionsKt.minOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     619: dup
     620: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     623: checkcast     #372                // class java/lang/Number
     626: invokevirtual #375                // Method java/lang/Number.intValue:()I
     629: aload         6
     631: checkcast     #53                 // class java/lang/Iterable
     634: invokestatic  #488                // Method kotlin/collections/CollectionsKt.maxOrNull:(Ljava/lang/Iterable;)Ljava/lang/Comparable;
     637: dup
     638: invokestatic  #166                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     641: checkcast     #372                // class java/lang/Number
     644: invokevirtual #375                // Method java/lang/Number.intValue:()I
     647: invokespecial #51                 // Method kotlin/ranges/IntRange."<init>":(II)V
     650: astore        10
     652: aload         10
     654: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     657: istore        11
     659: aload         10
     661: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     664: istore        13
     666: iload         11
     668: iload         13
     670: if_icmpgt     886
     673: aload         9
     675: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     678: istore        15
     680: aload         9
     682: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     685: istore        16
     687: iload         15
     689: iload         16
     691: if_icmpgt     873
     694: aload_2
     695: new           #464                // class java/lang/StringBuilder
     698: dup
     699: invokespecial #465                // Method java/lang/StringBuilder."<init>":()V
     702: ldc_w         #495                // String z=
     705: invokevirtual #499                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     708: iload         15
     710: invokevirtual #502                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     713: ldc_w         #542                // String ,w=
     716: invokevirtual #499                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     719: iload         11
     721: invokevirtual #502                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     724: invokevirtual #506                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     727: invokevirtual #499                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     730: bipush        10
     732: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     735: pop
     736: aload         8
     738: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     741: istore        17
     743: aload         8
     745: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     748: istore        18
     750: iload         17
     752: iload         18
     754: if_icmpgt     853
     757: aload         7
     759: invokevirtual #490                // Method kotlin/ranges/IntRange.getFirst:()I
     762: istore        19
     764: aload         7
     766: invokevirtual #493                // Method kotlin/ranges/IntRange.getLast:()I
     769: istore        20
     771: iload         19
     773: iload         20
     775: if_icmpgt     833
     778: aload_2
     779: aload_0
     780: new           #534                // class net/sinceat/aoc2020/day17/GridPoint4d
     783: dup
     784: iload         19
     786: iload         17
     788: iload         15
     790: iload         11
     792: invokespecial #545                // Method net/sinceat/aoc2020/day17/GridPoint4d."<init>":(IIII)V
     795: invokeinterface #349,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     800: checkcast     #232                // class java/lang/Character
     803: dup
     804: ifnull        813
     807: invokevirtual #295                // Method java/lang/Character.charValue:()C
     810: goto          816
     813: pop
     814: bipush        46
     816: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     819: pop
     820: iload         19
     822: iload         20
     824: if_icmpeq     833
     827: iinc          19, 1
     830: goto          778
     833: aload_2
     834: bipush        10
     836: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     839: pop
     840: iload         17
     842: iload         18
     844: if_icmpeq     853
     847: iinc          17, 1
     850: goto          757
     853: aload_2
     854: bipush        10
     856: invokevirtual #509                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     859: pop
     860: iload         15
     862: iload         16
     864: if_icmpeq     873
     867: iinc          15, 1
     870: goto          694
     873: iload         11
     875: iload         13
     877: if_icmpeq     886
     880: iinc          11, 1
     883: goto          673
     886: nop
     887: aload_1
     888: invokevirtual #506                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     891: areturn

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

  private static final net.sinceat.aoc2020.day17.GridPoint3d main$lambda$2$lambda$0(int, int);
    Code:
       0: new           #472                // class net/sinceat/aoc2020/day17/GridPoint3d
       3: dup
       4: iload_0
       5: iload_1
       6: iconst_0
       7: invokespecial #512                // Method net/sinceat/aoc2020/day17/GridPoint3d."<init>":(III)V
      10: areturn

  private static final net.sinceat.aoc2020.day17.GridPoint3d main$lambda$5$lambda$3(int, int);
    Code:
       0: new           #472                // class net/sinceat/aoc2020/day17/GridPoint3d
       3: dup
       4: iload_0
       5: iload_1
       6: iconst_0
       7: invokespecial #512                // Method net/sinceat/aoc2020/day17/GridPoint3d."<init>":(III)V
      10: areturn

  private static final net.sinceat.aoc2020.day17.GridPoint4d main$lambda$8$lambda$6(int, int);
    Code:
       0: new           #534                // class net/sinceat/aoc2020/day17/GridPoint4d
       3: dup
       4: iload_0
       5: iload_1
       6: iconst_0
       7: iconst_0
       8: invokespecial #545                // Method net/sinceat/aoc2020/day17/GridPoint4d."<init>":(IIII)V
      11: areturn

  private static final net.sinceat.aoc2020.day17.GridPoint4d main$lambda$11$lambda$9(int, int);
    Code:
       0: new           #534                // class net/sinceat/aoc2020/day17/GridPoint4d
       3: dup
       4: iload_0
       5: iload_1
       6: iconst_0
       7: iconst_0
       8: invokespecial #545                // Method net/sinceat/aoc2020/day17/GridPoint4d."<init>":(IIII)V
      11: areturn

  private static final java.lang.Iterable readInput$lambda$15$lambda$13(kotlin.jvm.functions.Function2, int, java.lang.String);
    Code:
       0: aload_2
       1: ldc_w         #562                // String line
       4: invokestatic  #154                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_2
       8: invokevirtual #566                // Method java/lang/String.toCharArray:()[C
      11: dup
      12: ldc_w         #568                // String toCharArray(...)
      15: invokestatic  #571                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      18: astore_3
      19: nop
      20: iconst_0
      21: istore        4
      23: aload_3
      24: astore        5
      26: new           #304                // class java/util/ArrayList
      29: dup
      30: aload_3
      31: arraylength
      32: invokespecial #333                // Method java/util/ArrayList."<init>":(I)V
      35: checkcast     #307                // class java/util/Collection
      38: astore        6
      40: iconst_0
      41: istore        7
      43: iconst_0
      44: istore        8
      46: iconst_0
      47: istore        9
      49: aload         5
      51: arraylength
      52: istore        10
      54: iload         9
      56: iload         10
      58: if_icmpge     127
      61: aload         5
      63: iload         9
      65: caload
      66: istore        11
      68: aload         6
      70: iload         8
      72: iinc          8, 1
      75: iload         11
      77: istore        12
      79: istore        13
      81: astore        15
      83: iconst_0
      84: istore        14
      86: iload         12
      88: bipush        35
      90: if_icmpne     111
      93: aload_0
      94: iload         13
      96: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      99: iload_1
     100: invokestatic  #370                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     103: invokeinterface #573,  3          // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     108: goto          112
     111: aconst_null
     112: aload         15
     114: swap
     115: invokeinterface #320,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     120: pop
     121: iinc          9, 1
     124: goto          54
     127: aload         6
     129: checkcast     #322                // class java/util/List
     132: nop
     133: checkcast     #53                 // class java/lang/Iterable
     136: invokestatic  #576                // Method kotlin/collections/CollectionsKt.filterNotNull:(Ljava/lang/Iterable;)Ljava/util/List;
     139: checkcast     #53                 // class java/lang/Iterable
     142: areturn
}

Compiled from "App.kt"
final class net.sinceat.aoc2020.day17.AppKt$main$1$grid$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.Map<net.sinceat.aoc2020.day17.GridPoint3d, ? extends java.lang.Character>, java.lang.String> {
  public static final net.sinceat.aoc2020.day17.AppKt$main$1$grid$2 INSTANCE;

  net.sinceat.aoc2020.day17.AppKt$main$1$grid$2();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class net/sinceat/aoc2020/day17/AppKt
       4: ldc           #13                 // String drawGrid3d
       6: ldc           #15                 // String drawGrid3d(Ljava/util/Map;)Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke(java.util.Map<net.sinceat.aoc2020.day17.GridPoint3d, java.lang.Character>);
    Code:
       0: aload_1
       1: ldc           #25                 // String p0
       3: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #33                 // Method net/sinceat/aoc2020/day17/AppKt.drawGrid3d:(Ljava/util/Map;)Ljava/lang/String;
      10: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #37                 // class java/util/Map
       5: invokevirtual #39                 // Method invoke:(Ljava/util/Map;)Ljava/lang/String;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class net/sinceat/aoc2020/day17/AppKt$main$1$grid$2
       3: dup
       4: invokespecial #44                 // Method "<init>":()V
       7: putstatic     #47                 // Field INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$1$grid$2;
      10: return
}

Compiled from "App.kt"
final class net.sinceat.aoc2020.day17.AppKt$main$2$grid$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.Map<net.sinceat.aoc2020.day17.GridPoint3d, ? extends java.lang.Character>, java.lang.String> {
  public static final net.sinceat.aoc2020.day17.AppKt$main$2$grid$2 INSTANCE;

  net.sinceat.aoc2020.day17.AppKt$main$2$grid$2();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class net/sinceat/aoc2020/day17/AppKt
       4: ldc           #13                 // String drawGrid3d
       6: ldc           #15                 // String drawGrid3d(Ljava/util/Map;)Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke(java.util.Map<net.sinceat.aoc2020.day17.GridPoint3d, java.lang.Character>);
    Code:
       0: aload_1
       1: ldc           #25                 // String p0
       3: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #33                 // Method net/sinceat/aoc2020/day17/AppKt.drawGrid3d:(Ljava/util/Map;)Ljava/lang/String;
      10: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #37                 // class java/util/Map
       5: invokevirtual #39                 // Method invoke:(Ljava/util/Map;)Ljava/lang/String;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class net/sinceat/aoc2020/day17/AppKt$main$2$grid$2
       3: dup
       4: invokespecial #44                 // Method "<init>":()V
       7: putstatic     #47                 // Field INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$2$grid$2;
      10: return
}

Compiled from "App.kt"
final class net.sinceat.aoc2020.day17.AppKt$readInput$1$1 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.lang.String, java.lang.Boolean> {
  public static final net.sinceat.aoc2020.day17.AppKt$readInput$1$1 INSTANCE;

  net.sinceat.aoc2020.day17.AppKt$readInput$1$1();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class kotlin/text/StringsKt
       4: ldc           #13                 // String isNotEmpty
       6: ldc           #15                 // String isNotEmpty(Ljava/lang/CharSequence;)Z
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.Boolean invoke(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #24                 // String p0
       3: invokestatic  #30                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #32                 // class java/lang/CharSequence
      10: invokeinterface #36,  1           // InterfaceMethod java/lang/CharSequence.length:()I
      15: ifle          22
      18: iconst_1
      19: goto          23
      22: iconst_0
      23: invokestatic  #42                 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      26: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #46                 // class java/lang/String
       5: invokevirtual #48                 // Method invoke:(Ljava/lang/String;)Ljava/lang/Boolean;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class net/sinceat/aoc2020/day17/AppKt$readInput$1$1
       3: dup
       4: invokespecial #53                 // Method "<init>":()V
       7: putstatic     #56                 // Field INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$readInput$1$1;
      10: return
}

Compiled from "App.kt"
final class net.sinceat.aoc2020.day17.AppKt$main$4$grid$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.Map<net.sinceat.aoc2020.day17.GridPoint4d, ? extends java.lang.Character>, java.lang.String> {
  public static final net.sinceat.aoc2020.day17.AppKt$main$4$grid$2 INSTANCE;

  net.sinceat.aoc2020.day17.AppKt$main$4$grid$2();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class net/sinceat/aoc2020/day17/AppKt
       4: ldc           #13                 // String drawGrid4d
       6: ldc           #15                 // String drawGrid4d(Ljava/util/Map;)Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke(java.util.Map<net.sinceat.aoc2020.day17.GridPoint4d, java.lang.Character>);
    Code:
       0: aload_1
       1: ldc           #25                 // String p0
       3: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #33                 // Method net/sinceat/aoc2020/day17/AppKt.drawGrid4d:(Ljava/util/Map;)Ljava/lang/String;
      10: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #37                 // class java/util/Map
       5: invokevirtual #39                 // Method invoke:(Ljava/util/Map;)Ljava/lang/String;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class net/sinceat/aoc2020/day17/AppKt$main$4$grid$2
       3: dup
       4: invokespecial #44                 // Method "<init>":()V
       7: putstatic     #47                 // Field INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$4$grid$2;
      10: return
}

Compiled from "App.kt"
final class net.sinceat.aoc2020.day17.AppKt$main$3$grid$2 extends kotlin.jvm.internal.FunctionReferenceImpl implements kotlin.jvm.functions.Function1<java.util.Map<net.sinceat.aoc2020.day17.GridPoint4d, ? extends java.lang.Character>, java.lang.String> {
  public static final net.sinceat.aoc2020.day17.AppKt$main$3$grid$2 INSTANCE;

  net.sinceat.aoc2020.day17.AppKt$main$3$grid$2();
    Code:
       0: aload_0
       1: iconst_1
       2: ldc           #11                 // class net/sinceat/aoc2020/day17/AppKt
       4: ldc           #13                 // String drawGrid4d
       6: ldc           #15                 // String drawGrid4d(Ljava/util/Map;)Ljava/lang/String;
       8: iconst_1
       9: invokespecial #18                 // Method kotlin/jvm/internal/FunctionReferenceImpl."<init>":(ILjava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V
      12: return

  public final java.lang.String invoke(java.util.Map<net.sinceat.aoc2020.day17.GridPoint4d, java.lang.Character>);
    Code:
       0: aload_1
       1: ldc           #25                 // String p0
       3: invokestatic  #31                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokestatic  #33                 // Method net/sinceat/aoc2020/day17/AppKt.drawGrid4d:(Ljava/util/Map;)Ljava/lang/String;
      10: areturn

  public java.lang.Object invoke(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: checkcast     #37                 // class java/util/Map
       5: invokevirtual #39                 // Method invoke:(Ljava/util/Map;)Ljava/lang/String;
       8: areturn

  static {};
    Code:
       0: new           #2                  // class net/sinceat/aoc2020/day17/AppKt$main$3$grid$2
       3: dup
       4: invokespecial #44                 // Method "<init>":()V
       7: putstatic     #47                 // Field INSTANCE:Lnet/sinceat/aoc2020/day17/AppKt$main$3$grid$2;
      10: return
}