package iii_conventions

import iii_conventions.TimeInterval.*

data class MyDate(val year: Int, val month: Int, val dayOfMonth: Int) {
    fun nextDay(): MyDate = this + DAY

    operator fun compareTo(other: MyDate): Int {
        if (this.year == other.year) {
            if (this.month == other.month) {
                return this.dayOfMonth.compareTo(other.dayOfMonth)
            } else {
                return this.month.compareTo(other.month)
            }
        } else {
            return this.year.compareTo(other.year)
        }
    }

    operator fun rangeTo(other: MyDate): DateRange {
        return DateRange(this, other)
    }

    operator fun plus(ti: TimeInterval): MyDate {
        return this.plus(RepeatedTimeInterval(ti))
    }

    operator fun plus(ti: RepeatedTimeInterval): MyDate {

        fun addDays(myDate: MyDate, days: Int): MyDate {
            fun isLeapYear(year: Int): Boolean = year % 4 == 0

            fun loop(md: MyDate, toadd: Int, added: Int): MyDate {
                val remainingDays = when(md.month) {
                    0,2,4,6,7,9,11 -> 31 - md.dayOfMonth
                    1 -> if (isLeapYear(md.year)) 29 - md.dayOfMonth else 28 - md.dayOfMonth
                    else -> 30 - md.dayOfMonth
                }

                return when {
                    toadd == 0 -> md
                    toadd <= remainingDays -> md.copy(dayOfMonth = md.dayOfMonth + toadd)
                    month < 11 -> loop(md.copy(month = md.month + 1, dayOfMonth = 1), toadd - remainingDays - 1, added + remainingDays + 1)
                    else -> loop(md.copy(year = md.year + 1, month = 0, dayOfMonth = 1), toadd - remainingDays - 1, added + remainingDays + 1)
                }
            }

            return loop(myDate, days, 0)
        }

        fun addYear(n: Int): MyDate = this.copy(year = year + 1 * n)

        return when(ti.timeInterval) {
            DAY -> addDays(this, 1 * ti.times)
            WEEK -> addDays(this, 7 * ti.times)
            YEAR -> addYear(ti.times)
        }
    }
}

enum class TimeInterval {
    DAY,
    WEEK,
    YEAR;

    operator fun times(n: Int): RepeatedTimeInterval = RepeatedTimeInterval(this, n)
}

data class RepeatedTimeInterval(val timeInterval: TimeInterval, val times: Int = 1)

class DateRange(val start: MyDate, val endInclusive: MyDate) : Iterable<MyDate> {
    override fun iterator(): Iterator<MyDate> {
        fun loop(collection: Collection<MyDate>, start: MyDate, end: MyDate): Iterator<MyDate> {
            return when {
                start < end -> loop(collection.plus(start), start.nextDay(), end)
                start == end -> collection.plus(start).iterator()
                else -> collection.iterator()
            }
        }

        return loop(ArrayList(), start, endInclusive)
    }

    operator fun contains(myDate : MyDate) : Boolean {
        return myDate >= start && myDate <= endInclusive
    }
}

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

  static {};
    Code:
       0: invokestatic  #14                 // Method iii_conventions/TimeInterval.values:()[Liii_conventions/TimeInterval;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field iii_conventions/TimeInterval.DAY:Liii_conventions/TimeInterval;
      12: invokevirtual #22                 // Method iii_conventions/TimeInterval.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field iii_conventions/TimeInterval.WEEK:Liii_conventions/TimeInterval;
      26: invokevirtual #22                 // Method iii_conventions/TimeInterval.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: nop
      36: aload_0
      37: getstatic     #28                 // Field iii_conventions/TimeInterval.YEAR:Liii_conventions/TimeInterval;
      40: invokevirtual #22                 // Method iii_conventions/TimeInterval.ordinal:()I
      43: iconst_3
      44: iastore
      45: goto          49
      48: astore_1
      49: aload_0
      50: putstatic     #32                 // Field $EnumSwitchMapping$0:[I
      53: return
    Exception table:
       from    to  target type
           7    17    20   Class java/lang/NoSuchFieldError
          21    31    34   Class java/lang/NoSuchFieldError
          35    45    48   Class java/lang/NoSuchFieldError
}

Compiled from "MyDate.kt"
public final class iii_conventions.MyDate {
  private final int year;

  private final int month;

  private final int dayOfMonth;

  public iii_conventions.MyDate(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 year:I
       9: aload_0
      10: iload_2
      11: putfield      #16                 // Field month:I
      14: aload_0
      15: iload_3
      16: putfield      #19                 // Field dayOfMonth:I
      19: return

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

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

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

  public final iii_conventions.MyDate nextDay();
    Code:
       0: aload_0
       1: getstatic     #34                 // Field iii_conventions/TimeInterval.DAY:Liii_conventions/TimeInterval;
       4: invokevirtual #38                 // Method plus:(Liii_conventions/TimeInterval;)Liii_conventions/MyDate;
       7: areturn

  public final int compareTo(iii_conventions.MyDate);
    Code:
       0: aload_1
       1: ldc           #42                 // String other
       3: invokestatic  #48                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getfield      #13                 // Field year:I
      10: aload_1
      11: getfield      #13                 // Field year:I
      14: if_icmpne     52
      17: aload_0
      18: getfield      #16                 // Field month:I
      21: aload_1
      22: getfield      #16                 // Field month:I
      25: if_icmpne     40
      28: aload_0
      29: getfield      #19                 // Field dayOfMonth:I
      32: aload_1
      33: getfield      #19                 // Field dayOfMonth:I
      36: invokestatic  #52                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      39: ireturn
      40: aload_0
      41: getfield      #16                 // Field month:I
      44: aload_1
      45: getfield      #16                 // Field month:I
      48: invokestatic  #52                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      51: ireturn
      52: aload_0
      53: getfield      #13                 // Field year:I
      56: aload_1
      57: getfield      #13                 // Field year:I
      60: invokestatic  #52                 // Method kotlin/jvm/internal/Intrinsics.compare:(II)I
      63: ireturn

  public final iii_conventions.DateRange rangeTo(iii_conventions.MyDate);
    Code:
       0: aload_1
       1: ldc           #42                 // String other
       3: invokestatic  #48                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #56                 // class iii_conventions/DateRange
       9: dup
      10: aload_0
      11: aload_1
      12: invokespecial #59                 // Method iii_conventions/DateRange."<init>":(Liii_conventions/MyDate;Liii_conventions/MyDate;)V
      15: areturn

  public final iii_conventions.MyDate plus(iii_conventions.TimeInterval);
    Code:
       0: aload_1
       1: ldc           #61                 // String ti
       3: invokestatic  #48                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: new           #63                 // class iii_conventions/RepeatedTimeInterval
      10: dup
      11: aload_1
      12: iconst_0
      13: iconst_2
      14: aconst_null
      15: invokespecial #66                 // Method iii_conventions/RepeatedTimeInterval."<init>":(Liii_conventions/TimeInterval;IILkotlin/jvm/internal/DefaultConstructorMarker;)V
      18: invokevirtual #69                 // Method plus:(Liii_conventions/RepeatedTimeInterval;)Liii_conventions/MyDate;
      21: areturn

  public final iii_conventions.MyDate plus(iii_conventions.RepeatedTimeInterval);
    Code:
       0: aload_1
       1: ldc           #61                 // String ti
       3: invokestatic  #48                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokevirtual #73                 // Method iii_conventions/RepeatedTimeInterval.getTimeInterval:()Liii_conventions/TimeInterval;
      10: getstatic     #79                 // Field iii_conventions/MyDate$WhenMappings.$EnumSwitchMapping$0:[I
      13: swap
      14: invokevirtual #82                 // Method iii_conventions/TimeInterval.ordinal:()I
      17: iaload
      18: tableswitch   { // 1 to 3
                     1: 44
                     2: 58
                     3: 73
               default: 84
          }
      44: aload_0
      45: aload_0
      46: iconst_1
      47: aload_1
      48: invokevirtual #85                 // Method iii_conventions/RepeatedTimeInterval.getTimes:()I
      51: imul
      52: invokestatic  #89                 // Method plus$addDays:(Liii_conventions/MyDate;Liii_conventions/MyDate;I)Liii_conventions/MyDate;
      55: goto          92
      58: aload_0
      59: aload_0
      60: bipush        7
      62: aload_1
      63: invokevirtual #85                 // Method iii_conventions/RepeatedTimeInterval.getTimes:()I
      66: imul
      67: invokestatic  #89                 // Method plus$addDays:(Liii_conventions/MyDate;Liii_conventions/MyDate;I)Liii_conventions/MyDate;
      70: goto          92
      73: aload_0
      74: aload_1
      75: invokevirtual #85                 // Method iii_conventions/RepeatedTimeInterval.getTimes:()I
      78: invokestatic  #93                 // Method plus$addYear:(Liii_conventions/MyDate;I)Liii_conventions/MyDate;
      81: goto          92
      84: new           #95                 // class kotlin/NoWhenBranchMatchedException
      87: dup
      88: invokespecial #96                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
      91: athrow
      92: areturn

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

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

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

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

  public static iii_conventions.MyDate copy$default(iii_conventions.MyDate, 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 year:I
      11: istore_1
      12: iload         4
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field month:I
      23: istore_2
      24: iload         4
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #19                 // Field dayOfMonth:I
      35: istore_3
      36: aload_0
      37: iload_1
      38: iload_2
      39: iload_3
      40: invokevirtual #108                // Method copy:(III)Liii_conventions/MyDate;
      43: areturn

  public java.lang.String toString();
    Code:
       0: new           #112                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #113                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #115                // String MyDate(year=
       9: invokevirtual #119                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #13                 // Field year:I
      16: invokevirtual #122                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      19: ldc           #124                // String , month=
      21: invokevirtual #119                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #16                 // Field month:I
      28: invokevirtual #122                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: ldc           #126                // String , dayOfMonth=
      33: invokevirtual #119                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #19                 // Field dayOfMonth:I
      40: invokevirtual #122                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #129                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #131                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #13                 // Field year:I
       4: invokestatic  #137                // 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 month:I
      16: invokestatic  #137                // 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 dayOfMonth:I
      29: invokestatic  #137                // 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 iii_conventions/MyDate
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class iii_conventions/MyDate
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field year:I
      25: aload_2
      26: getfield      #13                 // Field year:I
      29: if_icmpeq     34
      32: iconst_0
      33: ireturn
      34: aload_0
      35: getfield      #16                 // Field month:I
      38: aload_2
      39: getfield      #16                 // Field month:I
      42: if_icmpeq     47
      45: iconst_0
      46: ireturn
      47: aload_0
      48: getfield      #19                 // Field dayOfMonth:I
      51: aload_2
      52: getfield      #19                 // Field dayOfMonth:I
      55: if_icmpeq     60
      58: iconst_0
      59: ireturn
      60: iconst_1
      61: ireturn

  private static final boolean plus$addDays$isLeapYear(int);
    Code:
       0: iload_0
       1: iconst_4
       2: irem
       3: ifne          10
       6: iconst_1
       7: goto          11
      10: iconst_0
      11: ireturn

  private static final iii_conventions.MyDate plus$addDays$loop(iii_conventions.MyDate, iii_conventions.MyDate, int, int);
    Code:
       0: aload_1
       1: getfield      #16                 // Field month:I
       4: tableswitch   { // 0 to 11
                     0: 68
                     1: 78
                     2: 68
                     3: 108
                     4: 68
                     5: 108
                     6: 68
                     7: 68
                     8: 108
                     9: 68
                    10: 108
                    11: 68
               default: 108
          }
      68: bipush        31
      70: aload_1
      71: getfield      #19                 // Field dayOfMonth:I
      74: isub
      75: goto          115
      78: aload_1
      79: getfield      #13                 // Field year:I
      82: invokestatic  #148                // Method plus$addDays$isLeapYear:(I)Z
      85: ifeq          98
      88: bipush        29
      90: aload_1
      91: getfield      #19                 // Field dayOfMonth:I
      94: isub
      95: goto          115
      98: bipush        28
     100: aload_1
     101: getfield      #19                 // Field dayOfMonth:I
     104: isub
     105: goto          115
     108: bipush        30
     110: aload_1
     111: getfield      #19                 // Field dayOfMonth:I
     114: isub
     115: istore        4
     117: nop
     118: iload_2
     119: ifne          126
     122: aload_1
     123: goto          219
     126: iload_2
     127: iload         4
     129: if_icmpgt     149
     132: aload_1
     133: iconst_0
     134: iconst_0
     135: aload_1
     136: getfield      #19                 // Field dayOfMonth:I
     139: iload_2
     140: iadd
     141: iconst_3
     142: aconst_null
     143: invokestatic  #150                // Method copy$default:(Liii_conventions/MyDate;IIIILjava/lang/Object;)Liii_conventions/MyDate;
     146: goto          219
     149: aload_0
     150: getfield      #16                 // Field month:I
     153: bipush        11
     155: if_icmpge     191
     158: aload_0
     159: aload_1
     160: iconst_0
     161: aload_1
     162: getfield      #16                 // Field month:I
     165: iconst_1
     166: iadd
     167: iconst_1
     168: iconst_1
     169: aconst_null
     170: invokestatic  #150                // Method copy$default:(Liii_conventions/MyDate;IIIILjava/lang/Object;)Liii_conventions/MyDate;
     173: iload_2
     174: iload         4
     176: isub
     177: iconst_1
     178: isub
     179: iload_3
     180: iload         4
     182: iadd
     183: iconst_1
     184: iadd
     185: invokestatic  #152                // Method plus$addDays$loop:(Liii_conventions/MyDate;Liii_conventions/MyDate;II)Liii_conventions/MyDate;
     188: goto          219
     191: aload_0
     192: aload_1
     193: aload_1
     194: getfield      #13                 // Field year:I
     197: iconst_1
     198: iadd
     199: iconst_0
     200: iconst_1
     201: invokevirtual #108                // Method copy:(III)Liii_conventions/MyDate;
     204: iload_2
     205: iload         4
     207: isub
     208: iconst_1
     209: isub
     210: iload_3
     211: iload         4
     213: iadd
     214: iconst_1
     215: iadd
     216: invokestatic  #152                // Method plus$addDays$loop:(Liii_conventions/MyDate;Liii_conventions/MyDate;II)Liii_conventions/MyDate;
     219: areturn

  private static final iii_conventions.MyDate plus$addDays(iii_conventions.MyDate, iii_conventions.MyDate, int);
    Code:
       0: aload_0
       1: aload_1
       2: iload_2
       3: iconst_0
       4: invokestatic  #152                // Method plus$addDays$loop:(Liii_conventions/MyDate;Liii_conventions/MyDate;II)Liii_conventions/MyDate;
       7: areturn

  private static final iii_conventions.MyDate plus$addYear(iii_conventions.MyDate, int);
    Code:
       0: aload_0
       1: aload_0
       2: getfield      #13                 // Field year:I
       5: iconst_1
       6: iload_1
       7: imul
       8: iadd
       9: iconst_0
      10: iconst_0
      11: bipush        6
      13: aconst_null
      14: invokestatic  #150                // Method copy$default:(Liii_conventions/MyDate;IIIILjava/lang/Object;)Liii_conventions/MyDate;
      17: areturn
}


package com.pr0gramm.app.services

/**
 * A simple graph of double values.
 */
data class Graph(val firstX: Double, val lastX: Double, val points: List<Graph.Point>) {

    constructor(points: List<Graph.Point>) : this(points.first().x, points.last().x, points)

    val range = firstX.rangeTo(lastX)

    val first get() = points.first()

    val last get() = points.last()

    val isEmpty: Boolean
        get() = points.isEmpty()

    val maxValue: Double
        get() {
            return points.maxOf { it.y }
        }

    val minValue: Double
        get() {
            return points.minOf { it.y }
        }

    operator fun get(idx: Int): Point {
        return points[idx]
    }

    data class Point(val x: Double, val y: Double)

    fun sampleEquidistant(steps: Int, start: Double = range.start, end: Double = range.endInclusive): Graph {
        return Graph((0 until steps).map { idx ->
            // the x position that is at the sampling point
            val x = start + (end - start) * idx / (steps - 1)
            val y = valueAt(x)

            Point(x, y)
        })
    }

    fun valueAt(x: Double): Double {
        // find first point that is right of our query point.
        val largerIndex = points.indexOfFirst { it.x >= x }

        if (largerIndex == -1) {
            // we did not found a point that is right of x, so we take the value of the
            // right most point we know.
            return last.y
        }

        if (largerIndex == 0) {
            // the left-most point is already right of x, so take value of the first point.
            return first.y
        }

        // get points a and b.
        val a = points[largerIndex - 1]
        val b = points[largerIndex]

        // interpolate the value at x between a.x and b.x using m as the ascend
        val m = (b.y - a.y) / (b.x - a.x)
        return a.y + m * (x - a.x)
    }
}

fun <T> optimizeValuesBy(values: List<T>, get: (T) -> Double): List<T> {
    return values.filterIndexed { idx, value ->
        val v = get(value)
        idx == 0 || idx == values.size - 1 || get(values[idx - 1]) != v || v != get(values[idx + 1])
    }
}

Compiled from "Graph.kt"
public final class com.pr0gramm.app.services.Graph$Point {
  private final double x;

  private final double y;

  public com.pr0gramm.app.services.Graph$Point(double, double);
    Code:
       0: aload_0
       1: invokespecial #9                  // Method java/lang/Object."<init>":()V
       4: aload_0
       5: dload_1
       6: putfield      #13                 // Field x:D
       9: aload_0
      10: dload_3
      11: putfield      #16                 // Field y:D
      14: return

  public final double getX();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:D
       4: dreturn

  public final double getY();
    Code:
       0: aload_0
       1: getfield      #16                 // Field y:D
       4: dreturn

  public final double component1();
    Code:
       0: aload_0
       1: getfield      #13                 // Field x:D
       4: dreturn

  public final double component2();
    Code:
       0: aload_0
       1: getfield      #16                 // Field y:D
       4: dreturn

  public final com.pr0gramm.app.services.Graph$Point copy(double, double);
    Code:
       0: new           #2                  // class com/pr0gramm/app/services/Graph$Point
       3: dup
       4: dload_1
       5: dload_3
       6: invokespecial #28                 // Method "<init>":(DD)V
       9: areturn

  public static com.pr0gramm.app.services.Graph$Point copy$default(com.pr0gramm.app.services.Graph$Point, double, double, int, java.lang.Object);
    Code:
       0: iload         5
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #13                 // Field x:D
      11: dstore_1
      12: iload         5
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #16                 // Field y:D
      23: dstore_3
      24: aload_0
      25: dload_1
      26: dload_3
      27: invokevirtual #32                 // Method copy:(DD)Lcom/pr0gramm/app/services/Graph$Point;
      30: areturn

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

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

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class com/pr0gramm/app/services/Graph$Point
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/pr0gramm/app/services/Graph$Point
      20: astore_2
      21: aload_0
      22: getfield      #13                 // Field x:D
      25: aload_2
      26: getfield      #13                 // Field x:D
      29: invokestatic  #69                 // Method java/lang/Double.compare:(DD)I
      32: ifeq          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #16                 // Field y:D
      41: aload_2
      42: getfield      #16                 // Field y:D
      45: invokestatic  #69                 // Method java/lang/Double.compare:(DD)I
      48: ifeq          53
      51: iconst_0
      52: ireturn
      53: iconst_1
      54: ireturn
}

Compiled from "Graph.kt"
public final class com.pr0gramm.app.services.Graph {
  private final double firstX;

  private final double lastX;

  private final java.util.List<com.pr0gramm.app.services.Graph$Point> points;

  private final kotlin.ranges.ClosedFloatingPointRange<java.lang.Double> range;

  public com.pr0gramm.app.services.Graph(double, double, java.util.List<com.pr0gramm.app.services.Graph$Point>);
    Code:
       0: aload         5
       2: ldc           #10                 // String points
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_0
       8: invokespecial #19                 // Method java/lang/Object."<init>":()V
      11: aload_0
      12: dload_1
      13: putfield      #23                 // Field firstX:D
      16: aload_0
      17: dload_3
      18: putfield      #26                 // Field lastX:D
      21: aload_0
      22: aload         5
      24: putfield      #29                 // Field points:Ljava/util/List;
      27: aload_0
      28: aload_0
      29: getfield      #23                 // Field firstX:D
      32: aload_0
      33: getfield      #26                 // Field lastX:D
      36: invokestatic  #35                 // Method kotlin/ranges/RangesKt.rangeTo:(DD)Lkotlin/ranges/ClosedFloatingPointRange;
      39: putfield      #39                 // Field range:Lkotlin/ranges/ClosedFloatingPointRange;
      42: return

  public final double getFirstX();
    Code:
       0: aload_0
       1: getfield      #23                 // Field firstX:D
       4: dreturn

  public final double getLastX();
    Code:
       0: aload_0
       1: getfield      #26                 // Field lastX:D
       4: dreturn

  public final java.util.List<com.pr0gramm.app.services.Graph$Point> getPoints();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: areturn

  public com.pr0gramm.app.services.Graph(java.util.List<com.pr0gramm.app.services.Graph$Point>);
    Code:
       0: aload_1
       1: ldc           #10                 // String points
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: aload_1
       8: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
      11: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      14: invokevirtual #60                 // Method com/pr0gramm/app/services/Graph$Point.getX:()D
      17: aload_1
      18: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
      21: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      24: invokevirtual #60                 // Method com/pr0gramm/app/services/Graph$Point.getX:()D
      27: aload_1
      28: invokespecial #65                 // Method "<init>":(DDLjava/util/List;)V
      31: return

  public final kotlin.ranges.ClosedFloatingPointRange<java.lang.Double> getRange();
    Code:
       0: aload_0
       1: getfield      #39                 // Field range:Lkotlin/ranges/ClosedFloatingPointRange;
       4: areturn

  public final com.pr0gramm.app.services.Graph$Point getFirst();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: invokestatic  #55                 // Method kotlin/collections/CollectionsKt.first:(Ljava/util/List;)Ljava/lang/Object;
       7: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      10: areturn

  public final com.pr0gramm.app.services.Graph$Point getLast();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: invokestatic  #63                 // Method kotlin/collections/CollectionsKt.last:(Ljava/util/List;)Ljava/lang/Object;
       7: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      10: areturn

  public final boolean isEmpty();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: invokeinterface #77,  1           // InterfaceMethod java/util/List.isEmpty:()Z
       9: ireturn

  public final double getMaxValue();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: checkcast     #80                 // class java/lang/Iterable
       7: invokeinterface #84,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      12: astore_1
      13: aload_1
      14: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      19: ifne          30
      22: new           #91                 // class java/util/NoSuchElementException
      25: dup
      26: invokespecial #92                 // Method java/util/NoSuchElementException."<init>":()V
      29: athrow
      30: aload_1
      31: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      39: astore_2
      40: iconst_0
      41: istore_3
      42: aload_2
      43: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
      46: dstore        4
      48: aload_1
      49: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          90
      57: aload_1
      58: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      66: astore        6
      68: iconst_0
      69: istore        7
      71: aload         6
      73: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
      76: dstore        8
      78: dload         4
      80: dload         8
      82: invokestatic  #105                // Method java/lang/Math.max:(DD)D
      85: dstore        4
      87: goto          48
      90: dload         4
      92: dreturn

  public final double getMinValue();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: checkcast     #80                 // class java/lang/Iterable
       7: invokeinterface #84,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      12: astore_1
      13: aload_1
      14: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      19: ifne          30
      22: new           #91                 // class java/util/NoSuchElementException
      25: dup
      26: invokespecial #92                 // Method java/util/NoSuchElementException."<init>":()V
      29: athrow
      30: aload_1
      31: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      36: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      39: astore_2
      40: iconst_0
      41: istore_3
      42: aload_2
      43: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
      46: dstore        4
      48: aload_1
      49: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      54: ifeq          90
      57: aload_1
      58: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      63: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      66: astore        6
      68: iconst_0
      69: istore        7
      71: aload         6
      73: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
      76: dstore        8
      78: dload         4
      80: dload         8
      82: invokestatic  #113                // Method java/lang/Math.min:(DD)D
      85: dstore        4
      87: goto          48
      90: dload         4
      92: dreturn

  public final com.pr0gramm.app.services.Graph$Point get(int);
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: iload_1
       5: invokeinterface #119,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      10: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      13: areturn

  public final com.pr0gramm.app.services.Graph sampleEquidistant(int, double, double);
    Code:
       0: iconst_0
       1: iload_1
       2: invokestatic  #126                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
       5: checkcast     #80                 // class java/lang/Iterable
       8: astore        6
      10: iconst_0
      11: istore        7
      13: aload         6
      15: astore        8
      17: new           #128                // class java/util/ArrayList
      20: dup
      21: aload         6
      23: bipush        10
      25: invokestatic  #132                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      28: invokespecial #135                // Method java/util/ArrayList."<init>":(I)V
      31: checkcast     #137                // class java/util/Collection
      34: astore        9
      36: iconst_0
      37: istore        10
      39: aload         8
      41: invokeinterface #84,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      46: astore        11
      48: aload         11
      50: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      55: ifeq          127
      58: aload         11
      60: checkcast     #139                // class kotlin/collections/IntIterator
      63: invokevirtual #143                // Method kotlin/collections/IntIterator.nextInt:()I
      66: istore        12
      68: aload         9
      70: iload         12
      72: istore        13
      74: astore        19
      76: iconst_0
      77: istore        14
      79: dload_2
      80: dload         4
      82: dload_2
      83: dsub
      84: iload         13
      86: i2d
      87: dmul
      88: iload_1
      89: iconst_1
      90: isub
      91: i2d
      92: ddiv
      93: dadd
      94: dstore        15
      96: aload_0
      97: dload         15
      99: invokevirtual #147                // Method valueAt:(D)D
     102: dstore        17
     104: new           #57                 // class com/pr0gramm/app/services/Graph$Point
     107: dup
     108: dload         15
     110: dload         17
     112: invokespecial #150                // Method com/pr0gramm/app/services/Graph$Point."<init>":(DD)V
     115: aload         19
     117: swap
     118: invokeinterface #154,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     123: pop
     124: goto          48
     127: aload         9
     129: checkcast     #75                 // class java/util/List
     132: nop
     133: astore        20
     135: new           #2                  // class com/pr0gramm/app/services/Graph
     138: dup
     139: aload         20
     141: invokespecial #156                // Method "<init>":(Ljava/util/List;)V
     144: areturn

  public static com.pr0gramm.app.services.Graph sampleEquidistant$default(com.pr0gramm.app.services.Graph, int, double, double, int, java.lang.Object);
    Code:
       0: iload         6
       2: iconst_2
       3: iand
       4: ifeq          23
       7: aload_0
       8: getfield      #39                 // Field range:Lkotlin/ranges/ClosedFloatingPointRange;
      11: invokeinterface #178,  1          // InterfaceMethod kotlin/ranges/ClosedFloatingPointRange.getStart:()Ljava/lang/Comparable;
      16: checkcast     #180                // class java/lang/Number
      19: invokevirtual #183                // Method java/lang/Number.doubleValue:()D
      22: dstore_2
      23: iload         6
      25: iconst_4
      26: iand
      27: ifeq          47
      30: aload_0
      31: getfield      #39                 // Field range:Lkotlin/ranges/ClosedFloatingPointRange;
      34: invokeinterface #186,  1          // InterfaceMethod kotlin/ranges/ClosedFloatingPointRange.getEndInclusive:()Ljava/lang/Comparable;
      39: checkcast     #180                // class java/lang/Number
      42: invokevirtual #183                // Method java/lang/Number.doubleValue:()D
      45: dstore        4
      47: aload_0
      48: iload_1
      49: dload_2
      50: dload         4
      52: invokevirtual #188                // Method sampleEquidistant:(IDD)Lcom/pr0gramm/app/services/Graph;
      55: areturn

  public final double valueAt(double);
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: astore        4
       6: iconst_0
       7: istore        5
       9: iconst_0
      10: istore        6
      12: aload         4
      14: invokeinterface #189,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
      19: astore        7
      21: aload         7
      23: invokeinterface #89,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      28: ifeq          79
      31: aload         7
      33: invokeinterface #96,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      38: astore        8
      40: aload         8
      42: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
      45: astore        9
      47: iconst_0
      48: istore        10
      50: aload         9
      52: invokevirtual #60                 // Method com/pr0gramm/app/services/Graph$Point.getX:()D
      55: dload_1
      56: dcmpl
      57: iflt          64
      60: iconst_1
      61: goto          65
      64: iconst_0
      65: ifeq          73
      68: iload         6
      70: goto          80
      73: iinc          6, 1
      76: goto          21
      79: iconst_m1
      80: istore_3
      81: iload_3
      82: iconst_m1
      83: if_icmpne     94
      86: aload_0
      87: invokevirtual #191                // Method getLast:()Lcom/pr0gramm/app/services/Graph$Point;
      90: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
      93: dreturn
      94: iload_3
      95: ifne          106
      98: aload_0
      99: invokevirtual #193                // Method getFirst:()Lcom/pr0gramm/app/services/Graph$Point;
     102: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
     105: dreturn
     106: aload_0
     107: getfield      #29                 // Field points:Ljava/util/List;
     110: iload_3
     111: iconst_1
     112: isub
     113: invokeinterface #119,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     118: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
     121: astore        4
     123: aload_0
     124: getfield      #29                 // Field points:Ljava/util/List;
     127: iload_3
     128: invokeinterface #119,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     133: checkcast     #57                 // class com/pr0gramm/app/services/Graph$Point
     136: astore        5
     138: aload         5
     140: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
     143: aload         4
     145: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
     148: dsub
     149: aload         5
     151: invokevirtual #60                 // Method com/pr0gramm/app/services/Graph$Point.getX:()D
     154: aload         4
     156: invokevirtual #60                 // Method com/pr0gramm/app/services/Graph$Point.getX:()D
     159: dsub
     160: ddiv
     161: dstore        6
     163: aload         4
     165: invokevirtual #99                 // Method com/pr0gramm/app/services/Graph$Point.getY:()D
     168: dload         6
     170: dload_1
     171: aload         4
     173: invokevirtual #60                 // Method com/pr0gramm/app/services/Graph$Point.getX:()D
     176: dsub
     177: dmul
     178: dadd
     179: dreturn

  public final double component1();
    Code:
       0: aload_0
       1: getfield      #23                 // Field firstX:D
       4: dreturn

  public final double component2();
    Code:
       0: aload_0
       1: getfield      #26                 // Field lastX:D
       4: dreturn

  public final java.util.List<com.pr0gramm.app.services.Graph$Point> component3();
    Code:
       0: aload_0
       1: getfield      #29                 // Field points:Ljava/util/List;
       4: areturn

  public final com.pr0gramm.app.services.Graph copy(double, double, java.util.List<com.pr0gramm.app.services.Graph$Point>);
    Code:
       0: aload         5
       2: ldc           #10                 // String points
       4: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: new           #2                  // class com/pr0gramm/app/services/Graph
      10: dup
      11: dload_1
      12: dload_3
      13: aload         5
      15: invokespecial #65                 // Method "<init>":(DDLjava/util/List;)V
      18: areturn

  public static com.pr0gramm.app.services.Graph copy$default(com.pr0gramm.app.services.Graph, double, double, java.util.List, int, java.lang.Object);
    Code:
       0: iload         6
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #23                 // Field firstX:D
      11: dstore_1
      12: iload         6
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #26                 // Field lastX:D
      23: dstore_3
      24: iload         6
      26: iconst_4
      27: iand
      28: ifeq          37
      31: aload_0
      32: getfield      #29                 // Field points:Ljava/util/List;
      35: astore        5
      37: aload_0
      38: dload_1
      39: dload_3
      40: aload         5
      42: invokevirtual #213                // Method copy:(DDLjava/util/List;)Lcom/pr0gramm/app/services/Graph;
      45: areturn

  public java.lang.String toString();
    Code:
       0: new           #217                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #218                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #220                // String Graph(firstX=
       9: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #23                 // Field firstX:D
      16: invokevirtual #227                // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
      19: ldc           #229                // String , lastX=
      21: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #26                 // Field lastX:D
      28: invokevirtual #227                // Method java/lang/StringBuilder.append:(D)Ljava/lang/StringBuilder;
      31: ldc           #231                // String , points=
      33: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #29                 // Field points:Ljava/util/List;
      40: invokevirtual #234                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: bipush        41
      45: invokevirtual #237                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      48: invokevirtual #239                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      51: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #23                 // Field firstX:D
       4: invokestatic  #245                // Method java/lang/Double.hashCode:(D)I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #26                 // Field lastX:D
      16: invokestatic  #245                // Method java/lang/Double.hashCode:(D)I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #29                 // Field points:Ljava/util/List;
      29: invokevirtual #247                // Method java/lang/Object.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 com/pr0gramm/app/services/Graph
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class com/pr0gramm/app/services/Graph
      20: astore_2
      21: aload_0
      22: getfield      #23                 // Field firstX:D
      25: aload_2
      26: getfield      #23                 // Field firstX:D
      29: invokestatic  #254                // Method java/lang/Double.compare:(DD)I
      32: ifeq          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #26                 // Field lastX:D
      41: aload_2
      42: getfield      #26                 // Field lastX:D
      45: invokestatic  #254                // Method java/lang/Double.compare:(DD)I
      48: ifeq          53
      51: iconst_0
      52: ireturn
      53: aload_0
      54: getfield      #29                 // Field points:Ljava/util/List;
      57: aload_2
      58: getfield      #29                 // Field points:Ljava/util/List;
      61: invokestatic  #258                // 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 "Graph.kt"
public final class com.pr0gramm.app.services.GraphKt {
  public static final <T> java.util.List<T> optimizeValuesBy(java.util.List<? extends T>, kotlin.jvm.functions.Function1<? super T, java.lang.Double>);
    Code:
       0: aload_0
       1: ldc           #10                 // String values
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #18                 // String get
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: checkcast     #20                 // class java/lang/Iterable
      16: astore_2
      17: iconst_0
      18: istore_3
      19: aload_2
      20: astore        4
      22: new           #22                 // class java/util/ArrayList
      25: dup
      26: invokespecial #26                 // Method java/util/ArrayList."<init>":()V
      29: checkcast     #28                 // class java/util/Collection
      32: astore        5
      34: iconst_0
      35: istore        6
      37: aload         4
      39: astore        7
      41: iconst_0
      42: istore        8
      44: iconst_0
      45: istore        9
      47: aload         7
      49: invokeinterface #32,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      54: astore        10
      56: aload         10
      58: invokeinterface #38,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      63: ifeq          241
      66: aload         10
      68: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      73: astore        11
      75: iload         9
      77: iinc          9, 1
      80: istore        12
      82: iload         12
      84: ifge          90
      87: invokestatic  #47                 // Method kotlin/collections/CollectionsKt.throwIndexOverflow:()V
      90: iload         12
      92: aload         11
      94: astore        13
      96: istore        14
      98: iconst_0
      99: istore        15
     101: iload         14
     103: aload         13
     105: astore        16
     107: istore        17
     109: iconst_0
     110: istore        18
     112: aload_1
     113: aload         16
     115: invokeinterface #53,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     120: checkcast     #55                 // class java/lang/Number
     123: invokevirtual #59                 // Method java/lang/Number.doubleValue:()D
     126: dstore        19
     128: iload         17
     130: ifeq          218
     133: iload         17
     135: aload_0
     136: invokeinterface #65,  1           // InterfaceMethod java/util/List.size:()I
     141: iconst_1
     142: isub
     143: if_icmpeq     218
     146: aload_1
     147: aload_0
     148: iload         17
     150: iconst_1
     151: isub
     152: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     157: invokeinterface #53,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     162: checkcast     #55                 // class java/lang/Number
     165: invokevirtual #59                 // Method java/lang/Number.doubleValue:()D
     168: dload         19
     170: dcmpg
     171: ifne          178
     174: iconst_1
     175: goto          179
     178: iconst_0
     179: ifeq          218
     182: dload         19
     184: aload_1
     185: aload_0
     186: iload         17
     188: iconst_1
     189: iadd
     190: invokeinterface #68,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     195: invokeinterface #53,  2           // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     200: checkcast     #55                 // class java/lang/Number
     203: invokevirtual #59                 // Method java/lang/Number.doubleValue:()D
     206: dcmpg
     207: ifne          214
     210: iconst_1
     211: goto          215
     214: iconst_0
     215: ifne          222
     218: iconst_1
     219: goto          223
     222: iconst_0
     223: ifeq          236
     226: aload         5
     228: aload         13
     230: invokeinterface #72,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     235: pop
     236: nop
     237: nop
     238: goto          56
     241: nop
     242: aload         5
     244: checkcast     #61                 // class java/util/List
     247: nop
     248: areturn
}


package task_13

import java.io.File
import java.lang.RuntimeException

class App {
    fun solveFirst(input: String): Int {
        val tiles = HashMap<Point, Tile>()

        val computer = IntcodeComputer(input)

        while (!computer.isHalt) {
            val x = computer.run()
            val y = computer.run()
            val tileId = computer.run()

            tiles[Point(x.toInt(), y.toInt())] = Tile.of(tileId.toInt())
        }

        return tiles.filterValues { it == Tile.BLOCK }.size
    }

    //TODO pretty bad code
    fun solveSecond(input: String): Long {
        val tiles = HashMap<Point, Tile>()

        val computer = IntcodeComputer(input)
        computer.state[0] = 2 //add coins

        var score = 0L

        while (!computer.isHalt) {
            val x = computer.run()
            val y = computer.run()
            val tileId = computer.run()

            if (isScoreOutput(x, y)) {
                score = tileId
            } else {
                tiles[Point(x.toInt(), y.toInt())] = Tile.of(tileId.toInt())
            }

            val (paddleFound, paddlePos) = get(tiles, Tile.HORIZONTAL_PADDLE)
            val (ballFound, ballPos) = get(tiles, Tile.BALL)

            if (paddleFound && ballFound) {
                when {
                    ballPos.x < paddlePos.x -> {
                        setInput(computer, -1)
                    }
                    ballPos.x > paddlePos.x -> {
                        setInput(computer, 1)
                    }
                    else -> {
                        setInput(computer, 0)
                    }
                }
            }
        }

        return score
    }

    private fun setInput(computer: IntcodeComputer, input: Int) {
        if (computer.inputValues.size < 1) {
            computer.addInput(input.toLong())
        } else {
            computer.inputValues[0] = input.toLong()
        }
    }

    private fun get(tiles: HashMap<Point, Tile>, tileToFind: Tile): Pair<Boolean, Point> {
        for ((point, tile) in tiles) {
            if (tile == tileToFind) {
                return Pair(true, point)
            }
        }

        return Pair(false, Point(-1, -1))
    }

    private fun printTiles(tiles: HashMap<Point, Tile>) {
        val minX = tiles.minBy { it.key.x }!!.key.x
        val maxX = tiles.maxBy { it.key.x }!!.key.x
        val minY = tiles.minBy { it.key.y }!!.key.y
        val maxY = tiles.maxBy { it.key.y }!!.key.y

        for (y in minY..maxY) {
            for (x in minX..maxX) {
                val tile = tiles[Point(x, y)]
                if (tile != null) {
                    print(tile.symbol)
                }
            }

            println()
        }
    }

    private fun isScoreOutput(x: Long, y: Long) = x == -1L && y == 0L
}

enum class Tile(val symbol: Char) {
    EMPTY(' '),
    WALL('#'),
    BLOCK('█'),
    HORIZONTAL_PADDLE('P'),
    BALL('O');

    companion object {
        fun of(id: Int): Tile {
            return when (id) {
                0 -> EMPTY
                1 -> WALL
                2 -> BLOCK
                3 -> HORIZONTAL_PADDLE
                4 -> BALL
                else -> throw RuntimeException("unknown tile id $id")
            }
        }
    }

}

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

class IntcodeComputer(input: String) {
    var isHalt = false

    var state = getStateByInput(input)
    private var ptr = 0

    private var relativeBase = 0

    private val extendedMemory = HashMap<Int, Long>()

    var inputValues = mutableListOf<Long>()
    private var outputValue = 0L

    fun addInput(vararg input: Long): IntcodeComputer {
        input.forEach { inputValues.add(it) }
        return this
    }

    fun run(stopAtOutput: Boolean = true): Long {
        var ptrInc = 0

        while (true) {
            var finished = false
            isHalt = false
            val num = state[ptr]

            var opcode = num
            var firstOperandMode = Mode.POSITION
            var secondOperandMode = Mode.POSITION
            var thirdOperandMode = Mode.POSITION

            if (num.specifiesParamMode()) {
                val parameterModes = num.toString()
                opcode = parameterModes[parameterModes.length - 1].toString().toLong()
                firstOperandMode = getOperandMode(parameterModes, parameterModes.length - 3)
                secondOperandMode = getOperandMode(parameterModes, parameterModes.length - 4)
                thirdOperandMode = getOperandMode(parameterModes, parameterModes.length - 5)
            }

            when (opcode) {
                1L -> {
                    ptrInc = opcodeAdd(firstOperandMode, secondOperandMode, thirdOperandMode)
                }
                2L -> {
                    ptrInc = opcodeMult(firstOperandMode, secondOperandMode, thirdOperandMode)
                }
                3L -> {
                    ptrInc = opcodeSaveTo(firstOperandMode, getInput(inputValues))
                }
                4L -> {
                    val result = opcodeGetFrom(firstOperandMode)
                    outputValue = result.first
                    ptrInc = result.second

                    if (stopAtOutput) finished = true
                }
                5L -> {
                    ptr = opcodeJumpIfTrue(firstOperandMode, secondOperandMode)
                    ptrInc = 0
                }
                6L -> {
                    ptr = opcodeJumpIfFalse(firstOperandMode, secondOperandMode)
                    ptrInc = 0
                }
                7L -> {
                    ptrInc = opcodeLessThan(firstOperandMode, secondOperandMode, thirdOperandMode)
                }
                8L -> {
                    ptrInc = opcodeEquals(firstOperandMode, secondOperandMode, thirdOperandMode)
                }
                9L -> {
                    ptrInc = opcodeAdjustRelativeBase(firstOperandMode)
                }
                99L -> {
                    isHalt = true
                }
                else -> {
                    println("unknown value of $num")
                }
            }

            ptr += ptrInc
            if (finished || isHalt) break
        }

        return outputValue
    }

    private fun getInput(inputValues: MutableList<Long>): Long {
        val result = inputValues[0]

        inputValues.removeAt(0)

        return result
    }

    private fun getOperandMode(parameterModes: String, index: Int): Mode {
        return if (index < 0) {
            Mode.POSITION
        } else {
            Mode.of(parameterModes[index])
        }
    }

    fun Long.specifiesParamMode(): Boolean {
        return this > 99
    }

    fun opcodeAdd(firstOperand: Mode, secondOperand: Mode, thirdOperandMode: Mode): Int {
        val first = get(firstOperand, ptr + 1)
        val second = get(secondOperand, ptr + 2)
        val resultPtr = getIndex(thirdOperandMode, ptr + 3)

        setByIndex(resultPtr, first + second)

        return 4
    }

    fun opcodeMult(firstOperand: Mode, secondOperand: Mode, thirdOperandMode: Mode): Int {
        val first = get(firstOperand, ptr + 1)
        val second = get(secondOperand, ptr + 2)
        val resultPtr = getIndex(thirdOperandMode, ptr + 3)

        setByIndex(resultPtr, first * second)

        return 4
    }

    fun opcodeSaveTo(firstOperand: Mode, input: Long): Int {
        val resultPtr = getIndex(firstOperand, ptr + 1)

        setByIndex(resultPtr, input)

        return 2
    }

    fun opcodeGetFrom(firstOperandMode: Mode): Pair<Long, Int> {
        val result = get(firstOperandMode, ptr + 1)
        //getByIndex(relativeBase + getByIndex(index).toInt())

        return Pair(result, 2)
    }

    fun opcodeJumpIfTrue(firstOperand: Mode, secondOperand: Mode): Int {
        val first = get(firstOperand, ptr + 1)
        val second = get(secondOperand, ptr + 2)

        return if (first != 0L) {
            second.toInt()
        } else {
            ptr + 3
        }
    }

    fun opcodeJumpIfFalse(firstOperand: Mode, secondOperand: Mode): Int {
        val first = get(firstOperand, ptr + 1)
        val second = get(secondOperand, ptr + 2)

        return if (first == 0L) {
            second.toInt()
        } else {
            ptr + 3
        }
    }

    fun opcodeLessThan(firstOperand: Mode, secondOperand: Mode, thirdOperandMode: Mode): Int {
        val first = get(firstOperand, ptr + 1)
        val second = get(secondOperand, ptr + 2)
        val resultPtr = getIndex(thirdOperandMode, ptr + 3)

        setByIndex(resultPtr, if (first < second) 1 else 0)

        return 4
    }

    fun opcodeEquals(firstOperand: Mode, secondOperand: Mode, thirdOperandMode: Mode): Int {
        val first = get(firstOperand, ptr + 1)
        val second = get(secondOperand, ptr + 2)
        val resultPtr = getIndex(thirdOperandMode, ptr + 3)

        setByIndex(resultPtr, if (first == second) 1 else 0)

        return 4
    }

    fun opcodeAdjustRelativeBase(firstOperand: Mode): Int {
        val first = get(firstOperand, ptr + 1)

        relativeBase += first.toInt()

        return 2
    }

    private fun getStateByInput(input: String) = input.split(',').map { it.toLong() }.toMutableList()

    fun get(operand: Mode, ptr: Int): Long {
        return when (operand) {
            Mode.POSITION -> getPositionMode(ptr)
            Mode.IMMEDIATE -> getImmediateMode(ptr)
            Mode.RELATIVE -> getRelativeMode(ptr, relativeBase)
        }
    }

    fun getIndex(operand: Mode, ptr: Int): Int {
        return when (operand) {
            Mode.POSITION -> getByIndex(ptr).toInt()
            Mode.RELATIVE -> relativeBase + getByIndex(ptr).toInt()
            else -> throw RuntimeException("Can't use $operand to get address to write")
        }
    }

    fun getPositionMode(index: Int): Long = getByIndex(getByIndex(index).toInt())
    fun getImmediateMode(index: Int): Long = getByIndex(index)
    fun getRelativeMode(index: Int, relativeBase: Int): Long = getByIndex(relativeBase + getByIndex(index).toInt())

    fun getByIndex(index: Int): Long {
        if (index >= state.size) {
            return extendedMemory.getOrDefault(index, 0)
        }

        return state[index]
    }

    fun setByIndex(index: Int, value: Long) {
        if (index >= state.size) {
            extendedMemory[index] = value
        } else {
            state[index] = value
        }
    }

    enum class Mode {
        POSITION, IMMEDIATE, RELATIVE;

        companion object {
            fun of(value: Char): Mode {
                return when (value) {
                    '0' -> POSITION
                    '1' -> IMMEDIATE
                    '2' -> RELATIVE
                    else -> throw RuntimeException("Unknown mode value of $value")
                }
            }
        }
    }

}

fun main() {
    val app = App()
    val input = File("input.txt").readLines()[0]

    println(app.solveFirst(input))
    println(app.solveSecond(input))
}

Compiled from "App.kt"
public final class task_13.AppKt {
  public static final void main();
    Code:
       0: new           #8                  // class task_13/App
       3: dup
       4: invokespecial #11                 // Method task_13/App."<init>":()V
       7: astore_0
       8: new           #13                 // class java/io/File
      11: dup
      12: ldc           #15                 // String input.txt
      14: invokespecial #18                 // Method java/io/File."<init>":(Ljava/lang/String;)V
      17: aconst_null
      18: iconst_1
      19: aconst_null
      20: invokestatic  #24                 // Method kotlin/io/FilesKt.readLines$default:(Ljava/io/File;Ljava/nio/charset/Charset;ILjava/lang/Object;)Ljava/util/List;
      23: iconst_0
      24: invokeinterface #30,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      29: checkcast     #32                 // class java/lang/String
      32: astore_1
      33: aload_0
      34: aload_1
      35: invokevirtual #36                 // Method task_13/App.solveFirst:(Ljava/lang/String;)I
      38: istore_2
      39: getstatic     #42                 // Field java/lang/System.out:Ljava/io/PrintStream;
      42: iload_2
      43: invokevirtual #48                 // Method java/io/PrintStream.println:(I)V
      46: aload_0
      47: aload_1
      48: invokevirtual #52                 // Method task_13/App.solveSecond:(Ljava/lang/String;)J
      51: lstore_2
      52: getstatic     #42                 // Field java/lang/System.out:Ljava/io/PrintStream;
      55: lload_2
      56: invokevirtual #55                 // Method java/io/PrintStream.println:(J)V
      59: return

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

Compiled from "App.kt"
public final class task_13.App {
  public task_13.App();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final int solveFirst(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #23                 // class java/util/HashMap
       9: dup
      10: invokespecial #24                 // Method java/util/HashMap."<init>":()V
      13: astore_2
      14: new           #26                 // class task_13/IntcodeComputer
      17: dup
      18: aload_1
      19: invokespecial #29                 // Method task_13/IntcodeComputer."<init>":(Ljava/lang/String;)V
      22: astore_3
      23: aload_3
      24: invokevirtual #33                 // Method task_13/IntcodeComputer.isHalt:()Z
      27: ifne          92
      30: aload_3
      31: iconst_0
      32: iconst_1
      33: aconst_null
      34: invokestatic  #37                 // Method task_13/IntcodeComputer.run$default:(Ltask_13/IntcodeComputer;ZILjava/lang/Object;)J
      37: lstore        4
      39: aload_3
      40: iconst_0
      41: iconst_1
      42: aconst_null
      43: invokestatic  #37                 // Method task_13/IntcodeComputer.run$default:(Ltask_13/IntcodeComputer;ZILjava/lang/Object;)J
      46: lstore        6
      48: aload_3
      49: iconst_0
      50: iconst_1
      51: aconst_null
      52: invokestatic  #37                 // Method task_13/IntcodeComputer.run$default:(Ltask_13/IntcodeComputer;ZILjava/lang/Object;)J
      55: lstore        8
      57: aload_2
      58: checkcast     #39                 // class java/util/Map
      61: new           #41                 // class task_13/Point
      64: dup
      65: lload         4
      67: l2i
      68: lload         6
      70: l2i
      71: invokespecial #44                 // Method task_13/Point."<init>":(II)V
      74: getstatic     #50                 // Field task_13/Tile.Companion:Ltask_13/Tile$Companion;
      77: lload         8
      79: l2i
      80: invokevirtual #56                 // Method task_13/Tile$Companion.of:(I)Ltask_13/Tile;
      83: invokeinterface #60,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      88: pop
      89: goto          23
      92: aload_2
      93: checkcast     #39                 // class java/util/Map
      96: astore        4
      98: iconst_0
      99: istore        5
     101: new           #62                 // class java/util/LinkedHashMap
     104: dup
     105: invokespecial #63                 // Method java/util/LinkedHashMap."<init>":()V
     108: astore        6
     110: aload         4
     112: invokeinterface #67,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     117: invokeinterface #73,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
     122: astore        7
     124: aload         7
     126: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     131: ifeq          200
     134: aload         7
     136: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     141: checkcast     #84                 // class java/util/Map$Entry
     144: astore        8
     146: aload         8
     148: invokeinterface #87,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     153: checkcast     #46                 // class task_13/Tile
     156: astore        9
     158: iconst_0
     159: istore        10
     161: aload         9
     163: getstatic     #91                 // Field task_13/Tile.BLOCK:Ltask_13/Tile;
     166: if_acmpne     173
     169: iconst_1
     170: goto          174
     173: iconst_0
     174: ifeq          124
     177: aload         6
     179: aload         8
     181: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     186: aload         8
     188: invokeinterface #87,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     193: invokevirtual #95                 // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     196: pop
     197: goto          124
     200: aload         6
     202: checkcast     #39                 // class java/util/Map
     205: invokeinterface #99,  1           // InterfaceMethod java/util/Map.size:()I
     210: ireturn

  public final long solveSecond(java.lang.String);
    Code:
       0: aload_1
       1: ldc           #15                 // String input
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #23                 // class java/util/HashMap
       9: dup
      10: invokespecial #24                 // Method java/util/HashMap."<init>":()V
      13: astore_2
      14: new           #26                 // class task_13/IntcodeComputer
      17: dup
      18: aload_1
      19: invokespecial #29                 // Method task_13/IntcodeComputer."<init>":(Ljava/lang/String;)V
      22: astore_3
      23: aload_3
      24: invokevirtual #126                // Method task_13/IntcodeComputer.getState:()Ljava/util/List;
      27: iconst_0
      28: ldc2_w        #127                // long 2l
      31: invokestatic  #134                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      34: invokeinterface #140,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
      39: pop
      40: lconst_0
      41: lstore        4
      43: aload_3
      44: invokevirtual #33                 // Method task_13/IntcodeComputer.isHalt:()Z
      47: ifne          257
      50: aload_3
      51: iconst_0
      52: iconst_1
      53: aconst_null
      54: invokestatic  #37                 // Method task_13/IntcodeComputer.run$default:(Ltask_13/IntcodeComputer;ZILjava/lang/Object;)J
      57: lstore        6
      59: aload_3
      60: iconst_0
      61: iconst_1
      62: aconst_null
      63: invokestatic  #37                 // Method task_13/IntcodeComputer.run$default:(Ltask_13/IntcodeComputer;ZILjava/lang/Object;)J
      66: lstore        8
      68: aload_3
      69: iconst_0
      70: iconst_1
      71: aconst_null
      72: invokestatic  #37                 // Method task_13/IntcodeComputer.run$default:(Ltask_13/IntcodeComputer;ZILjava/lang/Object;)J
      75: lstore        10
      77: aload_0
      78: lload         6
      80: lload         8
      82: invokespecial #144                // Method isScoreOutput:(JJ)Z
      85: ifeq          95
      88: lload         10
      90: lstore        4
      92: goto          127
      95: aload_2
      96: checkcast     #39                 // class java/util/Map
      99: new           #41                 // class task_13/Point
     102: dup
     103: lload         6
     105: l2i
     106: lload         8
     108: l2i
     109: invokespecial #44                 // Method task_13/Point."<init>":(II)V
     112: getstatic     #50                 // Field task_13/Tile.Companion:Ltask_13/Tile$Companion;
     115: lload         10
     117: l2i
     118: invokevirtual #56                 // Method task_13/Tile$Companion.of:(I)Ltask_13/Tile;
     121: invokeinterface #60,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     126: pop
     127: aload_0
     128: aload_2
     129: getstatic     #147                // Field task_13/Tile.HORIZONTAL_PADDLE:Ltask_13/Tile;
     132: invokespecial #151                // Method get:(Ljava/util/HashMap;Ltask_13/Tile;)Lkotlin/Pair;
     135: astore        12
     137: aload         12
     139: invokevirtual #156                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     142: checkcast     #158                // class java/lang/Boolean
     145: invokevirtual #161                // Method java/lang/Boolean.booleanValue:()Z
     148: istore        13
     150: aload         12
     152: invokevirtual #164                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     155: checkcast     #41                 // class task_13/Point
     158: astore        14
     160: aload_0
     161: aload_2
     162: getstatic     #167                // Field task_13/Tile.BALL:Ltask_13/Tile;
     165: invokespecial #151                // Method get:(Ljava/util/HashMap;Ltask_13/Tile;)Lkotlin/Pair;
     168: astore        15
     170: aload         15
     172: invokevirtual #156                // Method kotlin/Pair.component1:()Ljava/lang/Object;
     175: checkcast     #158                // class java/lang/Boolean
     178: invokevirtual #161                // Method java/lang/Boolean.booleanValue:()Z
     181: istore        16
     183: aload         15
     185: invokevirtual #164                // Method kotlin/Pair.component2:()Ljava/lang/Object;
     188: checkcast     #41                 // class task_13/Point
     191: astore        17
     193: iload         13
     195: ifeq          43
     198: iload         16
     200: ifeq          43
     203: nop
     204: aload         17
     206: invokevirtual #170                // Method task_13/Point.getX:()I
     209: aload         14
     211: invokevirtual #170                // Method task_13/Point.getX:()I
     214: if_icmpge     226
     217: aload_0
     218: aload_3
     219: iconst_m1
     220: invokespecial #174                // Method setInput:(Ltask_13/IntcodeComputer;I)V
     223: goto          43
     226: aload         17
     228: invokevirtual #170                // Method task_13/Point.getX:()I
     231: aload         14
     233: invokevirtual #170                // Method task_13/Point.getX:()I
     236: if_icmple     248
     239: aload_0
     240: aload_3
     241: iconst_1
     242: invokespecial #174                // Method setInput:(Ltask_13/IntcodeComputer;I)V
     245: goto          43
     248: aload_0
     249: aload_3
     250: iconst_0
     251: invokespecial #174                // Method setInput:(Ltask_13/IntcodeComputer;I)V
     254: goto          43
     257: lload         4
     259: lreturn

  private final void setInput(task_13.IntcodeComputer, int);
    Code:
       0: aload_1
       1: invokevirtual #184                // Method task_13/IntcodeComputer.getInputValues:()Ljava/util/List;
       4: invokeinterface #185,  1          // InterfaceMethod java/util/List.size:()I
       9: iconst_1
      10: if_icmpge     31
      13: aload_1
      14: iconst_1
      15: newarray       long
      17: astore_3
      18: aload_3
      19: iconst_0
      20: iload_2
      21: i2l
      22: lastore
      23: aload_3
      24: invokevirtual #189                // Method task_13/IntcodeComputer.addInput:([J)Ltask_13/IntcodeComputer;
      27: pop
      28: goto          47
      31: aload_1
      32: invokevirtual #184                // Method task_13/IntcodeComputer.getInputValues:()Ljava/util/List;
      35: iconst_0
      36: iload_2
      37: i2l
      38: invokestatic  #134                // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      41: invokeinterface #140,  3          // InterfaceMethod java/util/List.set:(ILjava/lang/Object;)Ljava/lang/Object;
      46: pop
      47: return

  private final kotlin.Pair<java.lang.Boolean, task_13.Point> get(java.util.HashMap<task_13.Point, task_13.Tile>, task_13.Tile);
    Code:
       0: aload_1
       1: checkcast     #39                 // class java/util/Map
       4: invokeinterface #67,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
       9: invokeinterface #73,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      14: astore_3
      15: aload_3
      16: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      21: ifeq          79
      24: aload_3
      25: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      30: checkcast     #84                 // class java/util/Map$Entry
      33: astore        4
      35: aload         4
      37: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      42: checkcast     #41                 // class task_13/Point
      45: astore        5
      47: aload         4
      49: invokeinterface #87,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
      54: checkcast     #46                 // class task_13/Tile
      57: astore        6
      59: aload         6
      61: aload_2
      62: if_acmpne     15
      65: new           #153                // class kotlin/Pair
      68: dup
      69: iconst_1
      70: invokestatic  #193                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      73: aload         5
      75: invokespecial #196                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      78: areturn
      79: new           #153                // class kotlin/Pair
      82: dup
      83: iconst_0
      84: invokestatic  #193                // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean;
      87: new           #41                 // class task_13/Point
      90: dup
      91: iconst_m1
      92: iconst_m1
      93: invokespecial #44                 // Method task_13/Point."<init>":(II)V
      96: invokespecial #196                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      99: areturn

  private final void printTiles(java.util.HashMap<task_13.Point, task_13.Tile>);
    Code:
       0: aload_1
       1: checkcast     #39                 // class java/util/Map
       4: invokeinterface #67,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
       9: checkcast     #204                // class java/lang/Iterable
      12: astore        4
      14: aload         4
      16: invokeinterface #205,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      21: astore        5
      23: aload         5
      25: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      30: ifne          41
      33: new           #207                // class java/util/NoSuchElementException
      36: dup
      37: invokespecial #208                // Method java/util/NoSuchElementException."<init>":()V
      40: athrow
      41: aload         5
      43: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      48: astore        6
      50: aload         5
      52: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      57: ifne          65
      60: aload         6
      62: goto          151
      65: aload         6
      67: checkcast     #84                 // class java/util/Map$Entry
      70: astore        7
      72: iconst_0
      73: istore        8
      75: aload         7
      77: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      82: checkcast     #41                 // class task_13/Point
      85: invokevirtual #170                // Method task_13/Point.getX:()I
      88: istore        7
      90: aload         5
      92: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      97: astore        8
      99: aload         8
     101: checkcast     #84                 // class java/util/Map$Entry
     104: astore        9
     106: iconst_0
     107: istore        10
     109: aload         9
     111: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     116: checkcast     #41                 // class task_13/Point
     119: invokevirtual #170                // Method task_13/Point.getX:()I
     122: istore        9
     124: iload         7
     126: iload         9
     128: if_icmple     139
     131: aload         8
     133: astore        6
     135: iload         9
     137: istore        7
     139: aload         5
     141: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     146: ifne          90
     149: aload         6
     151: checkcast     #84                 // class java/util/Map$Entry
     154: dup
     155: invokestatic  #212                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     158: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     163: checkcast     #41                 // class task_13/Point
     166: invokevirtual #170                // Method task_13/Point.getX:()I
     169: istore_2
     170: aload_1
     171: checkcast     #39                 // class java/util/Map
     174: invokeinterface #67,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     179: checkcast     #204                // class java/lang/Iterable
     182: astore        5
     184: aload         5
     186: invokeinterface #205,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     191: astore        6
     193: aload         6
     195: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     200: ifne          211
     203: new           #207                // class java/util/NoSuchElementException
     206: dup
     207: invokespecial #208                // Method java/util/NoSuchElementException."<init>":()V
     210: athrow
     211: aload         6
     213: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     218: astore        7
     220: aload         6
     222: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     227: ifne          235
     230: aload         7
     232: goto          321
     235: aload         7
     237: checkcast     #84                 // class java/util/Map$Entry
     240: astore        8
     242: iconst_0
     243: istore        9
     245: aload         8
     247: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     252: checkcast     #41                 // class task_13/Point
     255: invokevirtual #170                // Method task_13/Point.getX:()I
     258: istore        8
     260: aload         6
     262: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     267: astore        9
     269: aload         9
     271: checkcast     #84                 // class java/util/Map$Entry
     274: astore        10
     276: iconst_0
     277: istore        11
     279: aload         10
     281: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     286: checkcast     #41                 // class task_13/Point
     289: invokevirtual #170                // Method task_13/Point.getX:()I
     292: istore        10
     294: iload         8
     296: iload         10
     298: if_icmpge     309
     301: aload         9
     303: astore        7
     305: iload         10
     307: istore        8
     309: aload         6
     311: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     316: ifne          260
     319: aload         7
     321: checkcast     #84                 // class java/util/Map$Entry
     324: dup
     325: invokestatic  #212                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     328: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     333: checkcast     #41                 // class task_13/Point
     336: invokevirtual #170                // Method task_13/Point.getX:()I
     339: istore_3
     340: aload_1
     341: checkcast     #39                 // class java/util/Map
     344: invokeinterface #67,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     349: checkcast     #204                // class java/lang/Iterable
     352: astore        6
     354: aload         6
     356: invokeinterface #205,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     361: astore        7
     363: aload         7
     365: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     370: ifne          381
     373: new           #207                // class java/util/NoSuchElementException
     376: dup
     377: invokespecial #208                // Method java/util/NoSuchElementException."<init>":()V
     380: athrow
     381: aload         7
     383: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     388: astore        8
     390: aload         7
     392: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     397: ifne          405
     400: aload         8
     402: goto          491
     405: aload         8
     407: checkcast     #84                 // class java/util/Map$Entry
     410: astore        9
     412: iconst_0
     413: istore        10
     415: aload         9
     417: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     422: checkcast     #41                 // class task_13/Point
     425: invokevirtual #215                // Method task_13/Point.getY:()I
     428: istore        9
     430: aload         7
     432: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     437: astore        10
     439: aload         10
     441: checkcast     #84                 // class java/util/Map$Entry
     444: astore        11
     446: iconst_0
     447: istore        12
     449: aload         11
     451: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     456: checkcast     #41                 // class task_13/Point
     459: invokevirtual #215                // Method task_13/Point.getY:()I
     462: istore        11
     464: iload         9
     466: iload         11
     468: if_icmple     479
     471: aload         10
     473: astore        8
     475: iload         11
     477: istore        9
     479: aload         7
     481: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     486: ifne          430
     489: aload         8
     491: checkcast     #84                 // class java/util/Map$Entry
     494: dup
     495: invokestatic  #212                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     498: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     503: checkcast     #41                 // class task_13/Point
     506: invokevirtual #215                // Method task_13/Point.getY:()I
     509: istore        4
     511: aload_1
     512: checkcast     #39                 // class java/util/Map
     515: invokeinterface #67,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
     520: checkcast     #204                // class java/lang/Iterable
     523: astore        7
     525: aload         7
     527: invokeinterface #205,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     532: astore        8
     534: aload         8
     536: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     541: ifne          552
     544: new           #207                // class java/util/NoSuchElementException
     547: dup
     548: invokespecial #208                // Method java/util/NoSuchElementException."<init>":()V
     551: athrow
     552: aload         8
     554: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     559: astore        9
     561: aload         8
     563: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     568: ifne          576
     571: aload         9
     573: goto          662
     576: aload         9
     578: checkcast     #84                 // class java/util/Map$Entry
     581: astore        10
     583: iconst_0
     584: istore        11
     586: aload         10
     588: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     593: checkcast     #41                 // class task_13/Point
     596: invokevirtual #215                // Method task_13/Point.getY:()I
     599: istore        10
     601: aload         8
     603: invokeinterface #82,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     608: astore        11
     610: aload         11
     612: checkcast     #84                 // class java/util/Map$Entry
     615: astore        12
     617: iconst_0
     618: istore        13
     620: aload         12
     622: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     627: checkcast     #41                 // class task_13/Point
     630: invokevirtual #215                // Method task_13/Point.getY:()I
     633: istore        12
     635: iload         10
     637: iload         12
     639: if_icmpge     650
     642: aload         11
     644: astore        9
     646: iload         12
     648: istore        10
     650: aload         8
     652: invokeinterface #78,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     657: ifne          601
     660: aload         9
     662: checkcast     #84                 // class java/util/Map$Entry
     665: dup
     666: invokestatic  #212                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     669: invokeinterface #94,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     674: checkcast     #41                 // class task_13/Point
     677: invokevirtual #215                // Method task_13/Point.getY:()I
     680: istore        5
     682: iload         4
     684: istore        6
     686: iload         6
     688: iload         5
     690: if_icmpgt     773
     693: iload_2
     694: istore        7
     696: iload         7
     698: iload_3
     699: if_icmpgt     754
     702: aload_1
     703: new           #41                 // class task_13/Point
     706: dup
     707: iload         7
     709: iload         6
     711: invokespecial #44                 // Method task_13/Point."<init>":(II)V
     714: invokevirtual #218                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     717: checkcast     #46                 // class task_13/Tile
     720: astore        8
     722: aload         8
     724: ifnull        742
     727: aload         8
     729: invokevirtual #222                // Method task_13/Tile.getSymbol:()C
     732: istore        9
     734: getstatic     #228                // Field java/lang/System.out:Ljava/io/PrintStream;
     737: iload         9
     739: invokevirtual #234                // Method java/io/PrintStream.print:(C)V
     742: iload         7
     744: iload_3
     745: if_icmpeq     754
     748: iinc          7, 1
     751: goto          702
     754: getstatic     #228                // Field java/lang/System.out:Ljava/io/PrintStream;
     757: invokevirtual #237                // Method java/io/PrintStream.println:()V
     760: iload         6
     762: iload         5
     764: if_icmpeq     773
     767: iinc          6, 1
     770: goto          693
     773: return

  private final boolean isScoreOutput(long, long);
    Code:
       0: lload_1
       1: ldc2_w        #246                // long -1l
       4: lcmp
       5: ifne          18
       8: lload_3
       9: lconst_0
      10: lcmp
      11: ifne          18
      14: iconst_1
      15: goto          19
      18: iconst_0
      19: ireturn
}