import java.io.*
fun print_day_22() {
    val yellow = "\u001B[33m"
    val reset = "\u001b[0m"
    val green = "\u001B[32m"
    println(yellow + "-".repeat(25) + "Advent of Code - Day 22" + "-".repeat(25) + reset)
    println(green)
    val process = Runtime.getRuntime().exec("figlet Reactor Reboot -c -f small")
    val reader = BufferedReader(InputStreamReader(process.inputStream))
    reader.forEachLine { println(it) }
    println(reset)
    println(yellow + "-".repeat(33) + "Output" + "-".repeat(33) + reset + "\n")
}
fun main() {
    print_day_22()
    Day22().part1()
    Day22().part2()
    println("\n" + "\u001B[33m" + "=".repeat(72) + "\u001b[0m" + "\n")
}

fun String.toRange(): IntRange = this.split("..").let { IntRange(it[0].toInt(), it[1].toInt()) }

class Day22 {
    fun String.toRange(): IntRange = this.split("..").let { IntRange(it[0].toInt(), it[1].toInt()) }

    data class Point3D(val x: Int, val y: Int, val z: Int)
    data class Cube(val xAxis: IntRange, val yAxis: IntRange, val zAxis: IntRange) {
        fun cubicVolume() = 1L * this.xAxis.count() * this.yAxis.count() * this.zAxis.count()
        fun overlaps(that: Cube) =
                (this.xAxis.first <= that.xAxis.last && this.xAxis.last >= that.xAxis.first) &&
                        (this.yAxis.first <= that.yAxis.last &&
                                this.yAxis.last >= that.yAxis.first) &&
                        (this.zAxis.first <= that.zAxis.last && this.zAxis.last >= that.zAxis.first)
        fun intersect(that: Cube) =
                if (!overlaps(that)) null
                else
                        Cube(
                                maxOf(this.xAxis.first, that.xAxis.first)..minOf(
                                                this.xAxis.last,
                                                that.xAxis.last
                                        ),
                                maxOf(this.yAxis.first, that.yAxis.first)..minOf(
                                                this.yAxis.last,
                                                that.yAxis.last
                                        ),
                                maxOf(this.zAxis.first, that.zAxis.first)..minOf(
                                                this.zAxis.last,
                                                that.zAxis.last
                                        )
                        )
    }
    data class Cuboid(val cube: Cube, val on: Boolean) {
        fun intersect(other: Cuboid) =
                if (this.cube.overlaps(other.cube)) Cuboid(this.cube.intersect(other.cube)!!, !on)
                else null
    }

    private val cubes =
            File("../Input/day22.txt").readLines().map {
                val on = it.split(" ").first() == "on"
                val cube =
                        it.split(" ").last().split(",").let {
                            Cube(
                                    it[0].drop(2).toRange(),
                                    it[1].drop(2).toRange(),
                                    it[2].drop(2).toRange()
                            )
                        }
                Cuboid(cube, on)
            }

    fun part1() {
        val region = Cube(-50..50, -50..50, -50..50)
        val onCubes = mutableSetOf<Point3D>()
        cubes.forEach {
            val (cube, on) = it
            if (cube.overlaps(region)) {
                cube.xAxis.forEach { x ->
                    cube.yAxis.forEach { y ->
                        cube.zAxis.forEach { z ->
                            if (on) onCubes.add(Point3D(x, y, z))
                            else onCubes.remove(Point3D(x, y, z))
                        }
                    }
                }
            }
        }

        println("Puzzle 1: " + onCubes.size)
    }

    fun part2() {
        fun findIntersections(a: Cube, b: Cube): Cube? = if (a.overlaps(b)) a.intersect(b) else null
        val volumes = mutableListOf<Cuboid>()

        cubes.forEach { cube ->
            volumes.addAll(
                    volumes.mapNotNull { other ->
                        findIntersections(cube.cube, other.cube)?.let { Cuboid(it, !other.on) }
                    }
            )
            if (cube.on) volumes.add(cube)
        }

        println("Puzzle 2: " + volumes.sumOf { it.cube.cubicVolume() * (if (it.on) 1 else -1) })
    }
}

Compiled from "day22.kt"
public final class Day22Kt {
  public static final void print_day_22();
    Code:
       0: ldc           #8                  // String \u001b[33m
       2: astore_0
       3: ldc           #10                 // String \u001b[0m
       5: astore_1
       6: ldc           #12                 // String \u001b[32m
       8: astore_2
       9: new           #14                 // class java/lang/StringBuilder
      12: dup
      13: invokespecial #17                 // Method java/lang/StringBuilder."<init>":()V
      16: aload_0
      17: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      20: ldc           #23                 // String -
      22: checkcast     #25                 // class java/lang/CharSequence
      25: bipush        25
      27: invokestatic  #31                 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
      30: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      33: ldc           #33                 // String Advent of Code - Day 22
      35: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      38: ldc           #23                 // String -
      40: checkcast     #25                 // class java/lang/CharSequence
      43: bipush        25
      45: invokestatic  #31                 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
      48: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      51: aload_1
      52: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      55: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      58: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      61: swap
      62: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      65: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      68: aload_2
      69: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      72: invokestatic  #55                 // Method java/lang/Runtime.getRuntime:()Ljava/lang/Runtime;
      75: ldc           #57                 // String figlet Reactor Reboot -c -f small
      77: invokevirtual #61                 // Method java/lang/Runtime.exec:(Ljava/lang/String;)Ljava/lang/Process;
      80: astore_3
      81: new           #63                 // class java/io/BufferedReader
      84: dup
      85: new           #65                 // class java/io/InputStreamReader
      88: dup
      89: aload_3
      90: invokevirtual #71                 // Method java/lang/Process.getInputStream:()Ljava/io/InputStream;
      93: invokespecial #74                 // Method java/io/InputStreamReader."<init>":(Ljava/io/InputStream;)V
      96: checkcast     #76                 // class java/io/Reader
      99: invokespecial #79                 // Method java/io/BufferedReader."<init>":(Ljava/io/Reader;)V
     102: astore        4
     104: aload         4
     106: checkcast     #76                 // class java/io/Reader
     109: invokedynamic #98,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
     114: invokestatic  #104                // Method kotlin/io/TextStreamsKt.forEachLine:(Ljava/io/Reader;Lkotlin/jvm/functions/Function1;)V
     117: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     120: aload_1
     121: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     124: new           #14                 // class java/lang/StringBuilder
     127: dup
     128: invokespecial #17                 // Method java/lang/StringBuilder."<init>":()V
     131: aload_0
     132: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     135: ldc           #23                 // String -
     137: checkcast     #25                 // class java/lang/CharSequence
     140: bipush        33
     142: invokestatic  #31                 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
     145: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     148: ldc           #106                // String Output
     150: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     153: ldc           #23                 // String -
     155: checkcast     #25                 // class java/lang/CharSequence
     158: bipush        33
     160: invokestatic  #31                 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
     163: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     166: aload_1
     167: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     170: bipush        10
     172: invokevirtual #109                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     175: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     178: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
     181: swap
     182: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     185: return

  public static final void main();
    Code:
       0: invokestatic  #120                // Method print_day_22:()V
       3: new           #122                // class Day22
       6: dup
       7: invokespecial #123                // Method Day22."<init>":()V
      10: invokevirtual #126                // Method Day22.part1:()V
      13: new           #122                // class Day22
      16: dup
      17: invokespecial #123                // Method Day22."<init>":()V
      20: invokevirtual #129                // Method Day22.part2:()V
      23: new           #14                 // class java/lang/StringBuilder
      26: dup
      27: invokespecial #17                 // Method java/lang/StringBuilder."<init>":()V
      30: ldc           #131                // String \n\u001b[33m
      32: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      35: ldc           #133                // String =
      37: checkcast     #25                 // class java/lang/CharSequence
      40: bipush        72
      42: invokestatic  #31                 // Method kotlin/text/StringsKt.repeat:(Ljava/lang/CharSequence;I)Ljava/lang/String;
      45: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      48: ldc           #135                // String \u001b[0m\n
      50: invokevirtual #21                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      53: invokevirtual #37                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      56: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
      59: swap
      60: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      63: return

  public static final kotlin.ranges.IntRange toRange(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #140                // String <this>
       3: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #25                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #148                // class java/lang/String
      14: astore_1
      15: aload_1
      16: iconst_0
      17: ldc           #150                // String ..
      19: aastore
      20: aload_1
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #154                // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: astore_2
      30: iconst_0
      31: istore_3
      32: new           #156                // class kotlin/ranges/IntRange
      35: dup
      36: aload_2
      37: iconst_0
      38: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      43: checkcast     #148                // class java/lang/String
      46: invokestatic  #168                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      49: aload_2
      50: iconst_1
      51: invokeinterface #162,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      56: checkcast     #148                // class java/lang/String
      59: invokestatic  #168                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      62: invokespecial #171                // Method kotlin/ranges/IntRange."<init>":(II)V
      65: nop
      66: areturn

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

  private static final kotlin.Unit print_day_22$lambda$0(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #182                // String it
       3: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: getstatic     #43                 // Field java/lang/System.out:Ljava/io/PrintStream;
       9: aload_0
      10: invokevirtual #49                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      13: getstatic     #188                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
      16: areturn
}

Compiled from "day22.kt"
public final class Day22$Cube {
  private final kotlin.ranges.IntRange xAxis;

  private final kotlin.ranges.IntRange yAxis;

  private final kotlin.ranges.IntRange zAxis;

  public Day22$Cube(kotlin.ranges.IntRange, kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_1
       1: ldc           #9                  // String xAxis
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String yAxis
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #19                 // String zAxis
      15: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: invokespecial #22                 // Method java/lang/Object."<init>":()V
      22: aload_0
      23: aload_1
      24: putfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      27: aload_0
      28: aload_2
      29: putfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      32: aload_0
      33: aload_3
      34: putfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      37: return

  public final kotlin.ranges.IntRange getXAxis();
    Code:
       0: aload_0
       1: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
       4: areturn

  public final kotlin.ranges.IntRange getYAxis();
    Code:
       0: aload_0
       1: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
       4: areturn

  public final kotlin.ranges.IntRange getZAxis();
    Code:
       0: aload_0
       1: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
       4: areturn

  public final long cubicVolume();
    Code:
       0: lconst_1
       1: aload_0
       2: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
       5: checkcast     #39                 // class java/lang/Iterable
       8: invokestatic  #45                 // Method kotlin/collections/CollectionsKt.count:(Ljava/lang/Iterable;)I
      11: i2l
      12: lmul
      13: aload_0
      14: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      17: checkcast     #39                 // class java/lang/Iterable
      20: invokestatic  #45                 // Method kotlin/collections/CollectionsKt.count:(Ljava/lang/Iterable;)I
      23: i2l
      24: lmul
      25: aload_0
      26: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      29: checkcast     #39                 // class java/lang/Iterable
      32: invokestatic  #45                 // Method kotlin/collections/CollectionsKt.count:(Ljava/lang/Iterable;)I
      35: i2l
      36: lmul
      37: lreturn

  public final boolean overlaps(Day22$Cube);
    Code:
       0: aload_1
       1: ldc           #49                 // String that
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      10: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      13: aload_1
      14: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      17: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      20: if_icmpgt     112
      23: aload_0
      24: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      27: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      30: aload_1
      31: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      34: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      37: if_icmplt     112
      40: aload_0
      41: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      44: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      47: aload_1
      48: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      51: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      54: if_icmpgt     112
      57: aload_0
      58: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      61: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      64: aload_1
      65: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      68: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      71: if_icmplt     112
      74: aload_0
      75: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      78: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      81: aload_1
      82: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      85: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      88: if_icmpgt     112
      91: aload_0
      92: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      95: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      98: aload_1
      99: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
     102: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
     105: if_icmplt     112
     108: iconst_1
     109: goto          113
     112: iconst_0
     113: ireturn

  public final Day22$Cube intersect(Day22$Cube);
    Code:
       0: aload_1
       1: ldc           #49                 // String that
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokevirtual #63                 // Method overlaps:(LDay22$Cube;)Z
      11: ifne          18
      14: aconst_null
      15: goto          151
      18: new           #2                  // class Day22$Cube
      21: dup
      22: new           #51                 // class kotlin/ranges/IntRange
      25: dup
      26: aload_0
      27: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      30: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      33: aload_1
      34: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      37: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      40: invokestatic  #69                 // Method java/lang/Math.max:(II)I
      43: nop
      44: aload_0
      45: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      48: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      51: aload_1
      52: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      55: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      58: invokestatic  #72                 // Method java/lang/Math.min:(II)I
      61: invokespecial #75                 // Method kotlin/ranges/IntRange."<init>":(II)V
      64: new           #51                 // class kotlin/ranges/IntRange
      67: dup
      68: aload_0
      69: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      72: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      75: aload_1
      76: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      79: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
      82: invokestatic  #69                 // Method java/lang/Math.max:(II)I
      85: nop
      86: aload_0
      87: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      90: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
      93: aload_1
      94: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      97: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
     100: invokestatic  #72                 // Method java/lang/Math.min:(II)I
     103: invokespecial #75                 // Method kotlin/ranges/IntRange."<init>":(II)V
     106: new           #51                 // class kotlin/ranges/IntRange
     109: dup
     110: aload_0
     111: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
     114: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
     117: aload_1
     118: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
     121: invokevirtual #55                 // Method kotlin/ranges/IntRange.getFirst:()I
     124: invokestatic  #69                 // Method java/lang/Math.max:(II)I
     127: nop
     128: aload_0
     129: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
     132: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
     135: aload_1
     136: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
     139: invokevirtual #58                 // Method kotlin/ranges/IntRange.getLast:()I
     142: invokestatic  #72                 // Method java/lang/Math.min:(II)I
     145: invokespecial #75                 // Method kotlin/ranges/IntRange."<init>":(II)V
     148: invokespecial #77                 // Method "<init>":(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)V
     151: areturn

  public final kotlin.ranges.IntRange component1();
    Code:
       0: aload_0
       1: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
       4: areturn

  public final kotlin.ranges.IntRange component2();
    Code:
       0: aload_0
       1: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
       4: areturn

  public final kotlin.ranges.IntRange component3();
    Code:
       0: aload_0
       1: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
       4: areturn

  public final Day22$Cube copy(kotlin.ranges.IntRange, kotlin.ranges.IntRange, kotlin.ranges.IntRange);
    Code:
       0: aload_1
       1: ldc           #9                  // String xAxis
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String yAxis
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #19                 // String zAxis
      15: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #2                  // class Day22$Cube
      21: dup
      22: aload_1
      23: aload_2
      24: aload_3
      25: invokespecial #77                 // Method "<init>":(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)V
      28: areturn

  public static Day22$Cube copy$default(Day22$Cube, kotlin.ranges.IntRange, kotlin.ranges.IntRange, kotlin.ranges.IntRange, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      11: astore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      23: astore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      35: astore_3
      36: aload_0
      37: aload_1
      38: aload_2
      39: aload_3
      40: invokevirtual #86                 // Method copy:(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)LDay22$Cube;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #90                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #91                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #93                 // String Cube(xAxis=
       9: invokevirtual #97                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      16: invokevirtual #100                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #102                // String , yAxis=
      21: invokevirtual #97                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      28: invokevirtual #100                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: ldc           #104                // String , zAxis=
      33: invokevirtual #97                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      40: invokevirtual #100                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #107                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #109                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
       4: invokevirtual #112                // Method kotlin/ranges/IntRange.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      16: invokevirtual #112                // Method kotlin/ranges/IntRange.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      29: invokevirtual #112                // Method kotlin/ranges/IntRange.hashCode:()I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day22$Cube
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day22$Cube
      20: astore_2
      21: aload_0
      22: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      25: aload_2
      26: getfield      #25                 // Field xAxis:Lkotlin/ranges/IntRange;
      29: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      41: aload_2
      42: getfield      #27                 // Field yAxis:Lkotlin/ranges/IntRange;
      45: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      48: ifne          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      57: aload_2
      58: getfield      #29                 // Field zAxis:Lkotlin/ranges/IntRange;
      61: invokestatic  #120                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      64: ifne          69
      67: iconst_0
      68: ireturn
      69: iconst_1
      70: ireturn
}

Compiled from "day22.kt"
public final class Day22 {
  private final java.util.List<Day22$Cuboid> cubes;

  public Day22();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: new           #10                 // class java/io/File
       8: dup
       9: ldc           #12                 // String ../Input/day22.txt
      11: invokespecial #15                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      14: aconst_null
      15: iconst_1
      16: aconst_null
      17: invokestatic  #21                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      20: checkcast     #23                 // class java/lang/Iterable
      23: astore_1
      24: astore        15
      26: iconst_0
      27: istore_2
      28: aload_1
      29: astore_3
      30: new           #25                 // class java/util/ArrayList
      33: dup
      34: aload_1
      35: bipush        10
      37: invokestatic  #31                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      40: invokespecial #34                 // Method java/util/ArrayList."<init>":(I)V
      43: checkcast     #36                 // class java/util/Collection
      46: astore        4
      48: iconst_0
      49: istore        5
      51: aload_3
      52: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      57: astore        6
      59: aload         6
      61: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      66: ifeq          280
      69: aload         6
      71: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      76: astore        7
      78: aload         4
      80: aload         7
      82: checkcast     #52                 // class java/lang/String
      85: astore        8
      87: astore        16
      89: iconst_0
      90: istore        9
      92: aload         8
      94: checkcast     #54                 // class java/lang/CharSequence
      97: iconst_1
      98: anewarray     #52                 // class java/lang/String
     101: astore        10
     103: aload         10
     105: iconst_0
     106: ldc           #56                 // String
     108: aastore
     109: aload         10
     111: iconst_0
     112: iconst_0
     113: bipush        6
     115: aconst_null
     116: invokestatic  #62                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     119: invokestatic  #66                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
     122: ldc           #68                 // String on
     124: invokestatic  #74                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     127: istore        11
     129: aload         8
     131: checkcast     #54                 // class java/lang/CharSequence
     134: iconst_1
     135: anewarray     #52                 // class java/lang/String
     138: astore        12
     140: aload         12
     142: iconst_0
     143: ldc           #56                 // String
     145: aastore
     146: aload         12
     148: iconst_0
     149: iconst_0
     150: bipush        6
     152: aconst_null
     153: invokestatic  #62                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     156: invokestatic  #77                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
     159: checkcast     #54                 // class java/lang/CharSequence
     162: iconst_1
     163: anewarray     #52                 // class java/lang/String
     166: astore        12
     168: aload         12
     170: iconst_0
     171: ldc           #79                 // String ,
     173: aastore
     174: aload         12
     176: iconst_0
     177: iconst_0
     178: bipush        6
     180: aconst_null
     181: invokestatic  #62                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     184: astore        13
     186: iconst_0
     187: istore        14
     189: new           #81                 // class Day22$Cube
     192: dup
     193: aload_0
     194: aload         13
     196: iconst_0
     197: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     202: checkcast     #52                 // class java/lang/String
     205: iconst_2
     206: invokestatic  #91                 // Method kotlin/text/StringsKt.drop:(Ljava/lang/String;I)Ljava/lang/String;
     209: invokevirtual #95                 // Method toRange:(Ljava/lang/String;)Lkotlin/ranges/IntRange;
     212: aload_0
     213: aload         13
     215: iconst_1
     216: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     221: checkcast     #52                 // class java/lang/String
     224: iconst_2
     225: invokestatic  #91                 // Method kotlin/text/StringsKt.drop:(Ljava/lang/String;I)Ljava/lang/String;
     228: invokevirtual #95                 // Method toRange:(Ljava/lang/String;)Lkotlin/ranges/IntRange;
     231: aload_0
     232: aload         13
     234: iconst_2
     235: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     240: checkcast     #52                 // class java/lang/String
     243: iconst_2
     244: invokestatic  #91                 // Method kotlin/text/StringsKt.drop:(Ljava/lang/String;I)Ljava/lang/String;
     247: invokevirtual #95                 // Method toRange:(Ljava/lang/String;)Lkotlin/ranges/IntRange;
     250: invokespecial #98                 // Method Day22$Cube."<init>":(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)V
     253: nop
     254: nop
     255: astore        10
     257: new           #100                // class Day22$Cuboid
     260: dup
     261: aload         10
     263: iload         11
     265: invokespecial #103                // Method Day22$Cuboid."<init>":(LDay22$Cube;Z)V
     268: aload         16
     270: swap
     271: invokeinterface #107,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     276: pop
     277: goto          59
     280: aload         4
     282: checkcast     #83                 // class java/util/List
     285: nop
     286: aload         15
     288: swap
     289: putfield      #111                // Field cubes:Ljava/util/List;
     292: return

  public final kotlin.ranges.IntRange toRange(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #133                // String <this>
       3: invokestatic  #137                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: checkcast     #54                 // class java/lang/CharSequence
      10: iconst_1
      11: anewarray     #52                 // class java/lang/String
      14: astore_2
      15: aload_2
      16: iconst_0
      17: ldc           #139                // String ..
      19: aastore
      20: aload_2
      21: iconst_0
      22: iconst_0
      23: bipush        6
      25: aconst_null
      26: invokestatic  #62                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      29: astore_3
      30: iconst_0
      31: istore        4
      33: new           #141                // class kotlin/ranges/IntRange
      36: dup
      37: aload_3
      38: iconst_0
      39: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      44: checkcast     #52                 // class java/lang/String
      47: invokestatic  #147                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      50: aload_3
      51: iconst_1
      52: invokeinterface #87,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      57: checkcast     #52                 // class java/lang/String
      60: invokestatic  #147                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      63: invokespecial #150                // Method kotlin/ranges/IntRange."<init>":(II)V
      66: nop
      67: areturn

  public final void part1();
    Code:
       0: new           #81                 // class Day22$Cube
       3: dup
       4: new           #141                // class kotlin/ranges/IntRange
       7: dup
       8: bipush        -50
      10: bipush        50
      12: invokespecial #150                // Method kotlin/ranges/IntRange."<init>":(II)V
      15: new           #141                // class kotlin/ranges/IntRange
      18: dup
      19: bipush        -50
      21: bipush        50
      23: invokespecial #150                // Method kotlin/ranges/IntRange."<init>":(II)V
      26: new           #141                // class kotlin/ranges/IntRange
      29: dup
      30: bipush        -50
      32: bipush        50
      34: invokespecial #150                // Method kotlin/ranges/IntRange."<init>":(II)V
      37: invokespecial #98                 // Method Day22$Cube."<init>":(Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;Lkotlin/ranges/IntRange;)V
      40: astore_1
      41: new           #155                // class java/util/LinkedHashSet
      44: dup
      45: invokespecial #156                // Method java/util/LinkedHashSet."<init>":()V
      48: checkcast     #158                // class java/util/Set
      51: astore_2
      52: aload_0
      53: getfield      #111                // Field cubes:Ljava/util/List;
      56: checkcast     #23                 // class java/lang/Iterable
      59: astore_3
      60: iconst_0
      61: istore        4
      63: aload_3
      64: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      69: astore        5
      71: aload         5
      73: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      78: ifeq          340
      81: aload         5
      83: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      88: astore        6
      90: aload         6
      92: checkcast     #100                // class Day22$Cuboid
      95: astore        7
      97: iconst_0
      98: istore        8
     100: aload         7
     102: invokevirtual #162                // Method Day22$Cuboid.component1:()LDay22$Cube;
     105: astore        9
     107: aload         7
     109: invokevirtual #165                // Method Day22$Cuboid.component2:()Z
     112: istore        10
     114: aload         9
     116: aload_1
     117: invokevirtual #169                // Method Day22$Cube.overlaps:(LDay22$Cube;)Z
     120: ifeq          335
     123: aload         9
     125: invokevirtual #173                // Method Day22$Cube.getXAxis:()Lkotlin/ranges/IntRange;
     128: checkcast     #23                 // class java/lang/Iterable
     131: astore        11
     133: iconst_0
     134: istore        12
     136: aload         11
     138: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     143: astore        13
     145: aload         13
     147: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     152: ifeq          334
     155: aload         13
     157: checkcast     #175                // class kotlin/collections/IntIterator
     160: invokevirtual #179                // Method kotlin/collections/IntIterator.nextInt:()I
     163: istore        14
     165: iload         14
     167: istore        15
     169: iconst_0
     170: istore        16
     172: aload         9
     174: invokevirtual #182                // Method Day22$Cube.getYAxis:()Lkotlin/ranges/IntRange;
     177: checkcast     #23                 // class java/lang/Iterable
     180: astore        17
     182: iconst_0
     183: istore        18
     185: aload         17
     187: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     192: astore        19
     194: aload         19
     196: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     201: ifeq          328
     204: aload         19
     206: checkcast     #175                // class kotlin/collections/IntIterator
     209: invokevirtual #179                // Method kotlin/collections/IntIterator.nextInt:()I
     212: istore        20
     214: iload         20
     216: istore        21
     218: iconst_0
     219: istore        22
     221: aload         9
     223: invokevirtual #185                // Method Day22$Cube.getZAxis:()Lkotlin/ranges/IntRange;
     226: checkcast     #23                 // class java/lang/Iterable
     229: astore        23
     231: iconst_0
     232: istore        24
     234: aload         23
     236: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     241: astore        25
     243: aload         25
     245: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     250: ifeq          322
     253: aload         25
     255: checkcast     #175                // class kotlin/collections/IntIterator
     258: invokevirtual #179                // Method kotlin/collections/IntIterator.nextInt:()I
     261: istore        26
     263: iload         26
     265: istore        27
     267: iconst_0
     268: istore        28
     270: iload         10
     272: ifeq          297
     275: aload_2
     276: new           #187                // class Day22$Point3D
     279: dup
     280: iload         15
     282: iload         21
     284: iload         27
     286: invokespecial #190                // Method Day22$Point3D."<init>":(III)V
     289: invokeinterface #191,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     294: goto          316
     297: aload_2
     298: new           #187                // class Day22$Point3D
     301: dup
     302: iload         15
     304: iload         21
     306: iload         27
     308: invokespecial #190                // Method Day22$Point3D."<init>":(III)V
     311: invokeinterface #194,  2          // InterfaceMethod java/util/Set.remove:(Ljava/lang/Object;)Z
     316: pop
     317: nop
     318: nop
     319: goto          243
     322: nop
     323: nop
     324: nop
     325: goto          194
     328: nop
     329: nop
     330: nop
     331: goto          145
     334: nop
     335: nop
     336: nop
     337: goto          71
     340: nop
     341: new           #196                // class java/lang/StringBuilder
     344: dup
     345: invokespecial #197                // Method java/lang/StringBuilder."<init>":()V
     348: ldc           #199                // String Puzzle 1:
     350: invokevirtual #203                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     353: aload_2
     354: invokeinterface #206,  1          // InterfaceMethod java/util/Set.size:()I
     359: invokevirtual #209                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     362: invokevirtual #213                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     365: getstatic     #219                // Field java/lang/System.out:Ljava/io/PrintStream;
     368: swap
     369: invokevirtual #225                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     372: return

  public final void part2();
    Code:
       0: new           #25                 // class java/util/ArrayList
       3: dup
       4: invokespecial #241                // Method java/util/ArrayList."<init>":()V
       7: checkcast     #83                 // class java/util/List
      10: astore_1
      11: aload_0
      12: getfield      #111                // Field cubes:Ljava/util/List;
      15: checkcast     #23                 // class java/lang/Iterable
      18: astore_2
      19: iconst_0
      20: istore_3
      21: aload_2
      22: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      27: astore        4
      29: aload         4
      31: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      36: ifeq          258
      39: aload         4
      41: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      46: astore        5
      48: aload         5
      50: checkcast     #100                // class Day22$Cuboid
      53: astore        6
      55: iconst_0
      56: istore        7
      58: aload_1
      59: aload_1
      60: checkcast     #23                 // class java/lang/Iterable
      63: astore        8
      65: astore        9
      67: iconst_0
      68: istore        10
      70: aload         8
      72: astore        11
      74: new           #25                 // class java/util/ArrayList
      77: dup
      78: invokespecial #241                // Method java/util/ArrayList."<init>":()V
      81: checkcast     #36                 // class java/util/Collection
      84: astore        12
      86: iconst_0
      87: istore        13
      89: aload         11
      91: astore        14
      93: iconst_0
      94: istore        15
      96: aload         14
      98: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     103: astore        16
     105: aload         16
     107: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     112: ifeq          217
     115: aload         16
     117: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     122: astore        17
     124: aload         17
     126: astore        18
     128: iconst_0
     129: istore        19
     131: aload         18
     133: checkcast     #100                // class Day22$Cuboid
     136: astore        20
     138: iconst_0
     139: istore        21
     141: aload         6
     143: invokevirtual #244                // Method Day22$Cuboid.getCube:()LDay22$Cube;
     146: aload         20
     148: invokevirtual #244                // Method Day22$Cuboid.getCube:()LDay22$Cube;
     151: invokestatic  #248                // Method part2$findIntersections:(LDay22$Cube;LDay22$Cube;)LDay22$Cube;
     154: dup
     155: ifnull        188
     158: astore        22
     160: iconst_0
     161: istore        23
     163: new           #100                // class Day22$Cuboid
     166: dup
     167: aload         22
     169: aload         20
     171: invokevirtual #251                // Method Day22$Cuboid.getOn:()Z
     174: ifne          181
     177: iconst_1
     178: goto          182
     181: iconst_0
     182: invokespecial #103                // Method Day22$Cuboid."<init>":(LDay22$Cube;Z)V
     185: goto          190
     188: pop
     189: aconst_null
     190: dup
     191: ifnull        212
     194: astore        24
     196: iconst_0
     197: istore        25
     199: aload         12
     201: aload         24
     203: invokeinterface #107,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     208: pop
     209: goto          213
     212: pop
     213: nop
     214: goto          105
     217: nop
     218: aload         12
     220: checkcast     #83                 // class java/util/List
     223: nop
     224: aload         9
     226: swap
     227: checkcast     #36                 // class java/util/Collection
     230: invokeinterface #255,  2          // InterfaceMethod java/util/List.addAll:(Ljava/util/Collection;)Z
     235: pop
     236: aload         6
     238: invokevirtual #251                // Method Day22$Cuboid.getOn:()Z
     241: ifeq          253
     244: aload_1
     245: aload         6
     247: invokeinterface #256,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     252: pop
     253: nop
     254: nop
     255: goto          29
     258: nop
     259: new           #196                // class java/lang/StringBuilder
     262: dup
     263: invokespecial #197                // Method java/lang/StringBuilder."<init>":()V
     266: ldc_w         #258                // String Puzzle 2:
     269: invokevirtual #203                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     272: aload_1
     273: checkcast     #23                 // class java/lang/Iterable
     276: astore_2
     277: astore        26
     279: lconst_0
     280: lstore_3
     281: aload_2
     282: invokeinterface #40,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     287: astore        5
     289: aload         5
     291: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     296: ifeq          355
     299: aload         5
     301: invokeinterface #50,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     306: astore        6
     308: lload_3
     309: aload         6
     311: checkcast     #100                // class Day22$Cuboid
     314: astore        7
     316: lstore        27
     318: iconst_0
     319: istore        8
     321: aload         7
     323: invokevirtual #244                // Method Day22$Cuboid.getCube:()LDay22$Cube;
     326: invokevirtual #262                // Method Day22$Cube.cubicVolume:()J
     329: aload         7
     331: invokevirtual #251                // Method Day22$Cuboid.getOn:()Z
     334: ifeq          341
     337: iconst_1
     338: goto          342
     341: iconst_m1
     342: i2l
     343: lmul
     344: lstore        29
     346: lload         27
     348: lload         29
     350: ladd
     351: lstore_3
     352: goto          289
     355: lload_3
     356: lstore        27
     358: aload         26
     360: lload         27
     362: invokevirtual #265                // Method java/lang/StringBuilder.append:(J)Ljava/lang/StringBuilder;
     365: invokevirtual #213                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     368: getstatic     #219                // Field java/lang/System.out:Ljava/io/PrintStream;
     371: swap
     372: invokevirtual #225                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     375: return

  private static final Day22$Cube part2$findIntersections(Day22$Cube, Day22$Cube);
    Code:
       0: aload_0
       1: aload_1
       2: invokevirtual #169                // Method Day22$Cube.overlaps:(LDay22$Cube;)Z
       5: ifeq          16
       8: aload_0
       9: aload_1
      10: invokevirtual #285                // Method Day22$Cube.intersect:(LDay22$Cube;)LDay22$Cube;
      13: goto          17
      16: aconst_null
      17: areturn
}

Compiled from "day22.kt"
public final class Day22$Point3D {
  private final int x;

  private final int y;

  private final int z;

  public Day22$Point3D(int, int, int);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: iload_1
       6: putfield      #13                 // Field x:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field y:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field z:I
      19: return

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

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

  public final int getZ();
    Code:
       0: aload_0
       1: getfield      #19                 // Field z:I
       4: ireturn

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

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

  public final int component3();
    Code:
       0: aload_0
       1: getfield      #19                 // Field z:I
       4: ireturn

  public final Day22$Point3D copy(int, int, int);
    Code:
       0: new           #2                  // class Day22$Point3D
       3: dup
       4: iload_1
       5: iload_2
       6: iload_3
       7: invokespecial #33                 // Method "<init>":(III)V
      10: areturn

  public static Day22$Point3D copy$default(Day22$Point3D, int, int, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field x:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field y:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field z:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: iload_3
      40: invokevirtual #37                 // Method copy:(III)LDay22$Point3D;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #41                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #42                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #44                 // String Point3D(x=
       9: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field x:I
      16: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #53                 // String , y=
      21: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field y:I
      28: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #55                 // String , z=
      33: invokevirtual #48                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field z:I
      40: invokevirtual #51                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #58                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #60                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:I
       4: invokestatic  #66                 // Method java/lang/Integer.hashCode:(I)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #16                 // Field y:I
      16: invokestatic  #66                 // Method java/lang/Integer.hashCode:(I)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #19                 // Field z:I
      29: invokestatic  #66                 // Method java/lang/Integer.hashCode:(I)I
      32: iadd
      33: istore_1
      34: iload_1
      35: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day22$Point3D
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day22$Point3D
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field x:I
      25: aload_2
      26: getfield      #13                 // Field x:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field y:I
      38: aload_2
      39: getfield      #16                 // Field y:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field z:I
      51: aload_2
      52: getfield      #19                 // Field z:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: iconst_1
      61: ireturn
}

Compiled from "day22.kt"
public final class Day22$Cuboid {
  private final Day22$Cube cube;

  private final boolean on;

  public Day22$Cuboid(Day22$Cube, boolean);
    Code:
       0: aload_1
       1: ldc           #9                  // String cube
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokespecial #18                 // Method java/lang/Object."<init>":()V
      10: aload_0
      11: aload_1
      12: putfield      #21                 // Field cube:LDay22$Cube;
      15: aload_0
      16: iload_2
      17: putfield      #25                 // Field on:Z
      20: return

  public final Day22$Cube getCube();
    Code:
       0: aload_0
       1: getfield      #21                 // Field cube:LDay22$Cube;
       4: areturn

  public final boolean getOn();
    Code:
       0: aload_0
       1: getfield      #25                 // Field on:Z
       4: ireturn

  public final Day22$Cuboid intersect(Day22$Cuboid);
    Code:
       0: aload_1
       1: ldc           #36                 // String other
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #21                 // Field cube:LDay22$Cube;
      10: aload_1
      11: getfield      #21                 // Field cube:LDay22$Cube;
      14: invokevirtual #42                 // Method Day22$Cube.overlaps:(LDay22$Cube;)Z
      17: ifeq          57
      20: new           #2                  // class Day22$Cuboid
      23: dup
      24: aload_0
      25: getfield      #21                 // Field cube:LDay22$Cube;
      28: aload_1
      29: getfield      #21                 // Field cube:LDay22$Cube;
      32: invokevirtual #45                 // Method Day22$Cube.intersect:(LDay22$Cube;)LDay22$Cube;
      35: dup
      36: invokestatic  #49                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      39: aload_0
      40: getfield      #25                 // Field on:Z
      43: ifne          50
      46: iconst_1
      47: goto          51
      50: iconst_0
      51: invokespecial #51                 // Method "<init>":(LDay22$Cube;Z)V
      54: goto          58
      57: aconst_null
      58: areturn

  public final Day22$Cube component1();
    Code:
       0: aload_0
       1: getfield      #21                 // Field cube:LDay22$Cube;
       4: areturn

  public final boolean component2();
    Code:
       0: aload_0
       1: getfield      #25                 // Field on:Z
       4: ireturn

  public final Day22$Cuboid copy(Day22$Cube, boolean);
    Code:
       0: aload_1
       1: ldc           #9                  // String cube
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #2                  // class Day22$Cuboid
       9: dup
      10: aload_1
      11: iload_2
      12: invokespecial #51                 // Method "<init>":(LDay22$Cube;Z)V
      15: areturn

  public static Day22$Cuboid copy$default(Day22$Cuboid, Day22$Cube, boolean, int, java.lang.Object);
    Code:
       0: iload_3
       1: iconst_1
       2: iand
       3: ifeq          11
       6: aload_0
       7: getfield      #21                 // Field cube:LDay22$Cube;
      10: astore_1
      11: iload_3
      12: iconst_2
      13: iand
      14: ifeq          22
      17: aload_0
      18: getfield      #25                 // Field on:Z
      21: istore_2
      22: aload_0
      23: aload_1
      24: iload_2
      25: invokevirtual #59                 // Method copy:(LDay22$Cube;Z)LDay22$Cuboid;
      28: areturn

  public java.lang.String toString();
    Code:
       0: new           #63                 // class java/lang/StringBuilder
       3: dup
       4: invokespecial #64                 // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #66                 // String Cuboid(cube=
       9: invokevirtual #70                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #21                 // Field cube:LDay22$Cube;
      16: invokevirtual #73                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #75                 // String , on=
      21: invokevirtual #70                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #25                 // Field on:Z
      28: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Z)Ljava/lang/StringBuilder;
      31: bipush        41
      33: invokevirtual #81                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      36: invokevirtual #83                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      39: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #21                 // Field cube:LDay22$Cube;
       4: invokevirtual #87                 // Method Day22$Cube.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #25                 // Field on:Z
      16: invokestatic  #92                 // Method java/lang/Boolean.hashCode:(Z)I
      19: iadd
      20: istore_1
      21: iload_1
      22: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class Day22$Cuboid
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class Day22$Cuboid
      20: astore_2
      21: aload_0
      22: getfield      #21                 // Field cube:LDay22$Cube;
      25: aload_2
      26: getfield      #21                 // Field cube:LDay22$Cube;
      29: invokestatic  #100                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #25                 // Field on:Z
      41: aload_2
      42: getfield      #25                 // Field on:Z
      45: if_icmpeq     50
      48: iconst_0
      49: ireturn
      50: iconst_1
      51: ireturn
}