package com.company

import java.util.*
import kotlin.collections.ArrayList

val D1 = 1.0
val D2 = Math.sqrt(2.0)
val p = 1/1000

fun aStarSearch(start: Pair<Int, Int>, goal: Pair<Int, Int>, map: HashMap<Pair<Int, Int>, Int>): ArrayList<Pair<Int, Int>> {
    val failure = ArrayList<Pair<Int, Int>>()

    // set of node already evaluated
    val closedSet = HashSet<Pair<Int, Int>>()

    // set of currently discovered nodes
    var openSet = ArrayList<Pair<Int, Int>>()
    openSet.add(start)

    val cameFrom = HashMap<Pair<Int, Int>, Pair<Int, Int>>()

    val gScore = HashMap<Pair<Int, Int>, Double>()
    val fScore = HashMap<Pair<Int, Int>, Double>()

    for (pos: Pair<Int, Int> in map.keys) {
        if (pos.first == start.first && pos.second == start.second)
            continue

        gScore[pos] = Double.NEGATIVE_INFINITY
        fScore[pos] = Double.NEGATIVE_INFINITY
    }

    gScore[start] = 0.0
    fScore[start] = -1 * heuristicCostEstimate(start, start, goal)

    var current: Pair<Int, Int>
    var result: Pair<Pair<Int, Int>, ArrayList<Pair<Int, Int>>>
    var neighbors: ArrayList<Pair<Int, Int>>
    var tempGScore: Double

    while (!openSet.isEmpty()) {
        result = getNextNode(openSet, fScore)
        current = result.first
        openSet = result.second

        if (current.first == goal.first && current.second == goal.second) {
            return reconstructPath(cameFrom, current)
        }

        openSet = removeNode(openSet, current, fScore)
        closedSet.add(current)

        neighbors = getNeighbors(current, map)
        for (neighbor: Pair<Int, Int> in neighbors) {
            // Ignore the neighbor which is already evaluated.
            if (closedSet.contains(neighbor))
                continue

            // Discover a new node
            if (!openSet.contains(neighbor))
                openSet = insertNode(openSet, neighbor, fScore)

            // The distance from start to a neighbor
            tempGScore = gScore[current]!! + Math.sqrt(0.0 + (current.first - neighbor.first) * (current.first - neighbor.first) + (current.second - neighbor.second) * (current.second - neighbor.second))
            if (tempGScore >= gScore[neighbor]!!)
                continue

            // This path is the best until now. Record it!
            cameFrom[neighbor] = current
            gScore[neighbor] = tempGScore
            fScore[neighbor] = -1 * (gScore[neighbor]!! + heuristicCostEstimate(neighbor, start, goal))
        }
    }

    return failure
}

fun heuristicCostEstimate(pos: Pair<Int, Int>, start: Pair<Int, Int>, goal: Pair<Int, Int>, option: Int = 0): Double {
    val dx = (goal.first - pos.first).toDouble()
    val dy = Math.abs(goal.second - pos.second).toDouble()

    val result = when(option) {
        1 -> D1 * (dx + dy)
        2 -> D1 * Math.max(dx, dy) + (D2 - 1) * Math.min(dx, dy)
        3 -> D1 * Math.sqrt((dx * dx) + (dy * dy))                 // euclidean distance
        else -> D1 * (dx + dy) + (D2 - 2 * D1) * Math.min(dx, dy)  // octile distance
    }

    // Method 1 to break tie:
    return result * (1.0 + p)

    // Method 2 to break tie:
    //val cross = Math.abs(dx * (start.first - goal.first) - dy * (start.second - goal.second))
    //return result + cross * p
}

fun findNextNode(openSet: HashSet<Pair<Int, Int>>, fScore: HashMap<Pair<Int, Int>, Double>): Pair<Int, Int> {
    if (openSet.isEmpty()) {
        return Pair(0, 0)
    }

    if (openSet.size == 1) {
        return openSet.elementAt(0)
    }

    var lowScore = Double.MAX_VALUE
    var nextNode = openSet.elementAt(0)

    for (node: Pair<Int, Int> in openSet) {
        if (fScore[node]!! < lowScore) {
            lowScore = fScore[node]!!
            nextNode = node
        }
    }

    return nextNode
}

fun insertNode(openSet: ArrayList<Pair<Int, Int>>, node: Pair<Int, Int>, fScore: HashMap<Pair<Int, Int>, Double>): ArrayList<Pair<Int, Int>> {
    openSet.add(node)

    var child = openSet.size - 1
    var parent = (child - 1) / 2
    var temp: Pair<Int, Int>

    while (child != 0 && fScore[openSet[child]]!! > fScore[openSet[parent]]!!) {
        temp = openSet[child]
        openSet[child] = openSet[parent]
        openSet[parent] = temp

        child = parent
        parent = (parent - 1) / 2
    }

    return openSet
}

fun removeNode(openSet: ArrayList<Pair<Int, Int>>, node: Pair<Int, Int>, fScore: HashMap<Pair<Int, Int>, Double>): ArrayList<Pair<Int, Int>> {
    openSet.remove(node)
    return buildMaxHeap(openSet, fScore)
}

fun getNextNode(openSet: ArrayList<Pair<Int, Int>>, fScore: HashMap<Pair<Int, Int>, Double>): Pair<Pair<Int, Int>, ArrayList<Pair<Int, Int>>> {
    val nextNode = Pair(openSet[0].first, openSet[0].second)

    val newSet: ArrayList<Pair<Int, Int>>
    if (openSet.size == 1) {
        newSet = openSet
    } else {
        // replacing the first node with the last node.
        openSet[0] = openSet.removeAt(openSet.size-1)

        // heapify the remaining array-list
        newSet = buildMaxHeap(openSet, fScore)
    }

    return Pair(nextNode, newSet)
}

fun buildMaxHeap(openSet: ArrayList<Pair<Int, Int>>, fScore: HashMap<Pair<Int, Int>, Double>): ArrayList<Pair<Int, Int>> {
    var middle = openSet.size / 2 - 1
    var heapSet = openSet

    while (middle >= 0) {
        heapSet = heapifyArray(heapSet, fScore, middle, openSet.size - 1)
        middle -= 1
    }

    return heapSet
}

fun heapifyArray(openSet: ArrayList<Pair<Int, Int>>, fScore: HashMap<Pair<Int, Int>, Double>, root: Int, last: Int): ArrayList<Pair<Int, Int>> {
    val left = 2 * root + 1
    val right = left + 1
    var largest = root
    val temp: Pair<Int, Int>

    if (left <= last && fScore[openSet[left]]!! > fScore[openSet[largest]]!!)
        largest = left

    if (right <= last && fScore[openSet[right]]!! > fScore[openSet[largest]]!!)
        largest = right

    return when (largest != root) {
        true -> {
            temp = openSet[largest]
            openSet[largest] = openSet[root]
            openSet[root] = temp
            heapifyArray(openSet, fScore, largest, last)  //return value
        }
        else -> {
            openSet        //return value
        }
    }
}

fun reconstructPath(cameFrom: HashMap<Pair<Int, Int>, Pair<Int, Int>>, current: Pair<Int, Int>): ArrayList<Pair<Int, Int>> {
    val path = ArrayList<Pair<Int, Int>>()
    path.add(current)

    var pos = current
    while (cameFrom.containsKey(pos)) {
        pos = cameFrom[pos]!!
        path.add(pos)
    }

    return path
}

fun getNeighbors(current: Pair<Int, Int>, map: HashMap<Pair<Int, Int>, Int>): ArrayList<Pair<Int, Int>> {
    var neighbor: Pair<Int, Int>
    val neighbors: ArrayList<Pair<Int, Int>> = ArrayList()

    for (i in -1..1) {
        for (j in -1..1) {
            if (i == 0 && j == 0)
                continue

            neighbor = Pair(current.first + i, current.second + j)
            if (map.containsKey(neighbor) && map[neighbor] == 1) {
                neighbors.add(neighbor)
            }
        }
    }

    return neighbors
}

Compiled from "AStar.kt"
public final class com.company.AStarKt {
  private static final double D1;

  private static final double D2;

  private static final int p;

  public static final double getD1();
    Code:
       0: getstatic     #10                 // Field D1:D
       3: dreturn

  public static final double getD2();
    Code:
       0: getstatic     #14                 // Field D2:D
       3: dreturn

  public static final int getP();
    Code:
       0: getstatic     #20                 // Field p:I
       3: ireturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> aStarSearch(kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #26                 // String start
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #34                 // String goal
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #36                 // String map
      15: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: new           #38                 // class java/util/ArrayList
      21: dup
      22: invokespecial #42                 // Method java/util/ArrayList."<init>":()V
      25: astore_3
      26: new           #44                 // class java/util/HashSet
      29: dup
      30: invokespecial #45                 // Method java/util/HashSet."<init>":()V
      33: astore        4
      35: new           #38                 // class java/util/ArrayList
      38: dup
      39: invokespecial #42                 // Method java/util/ArrayList."<init>":()V
      42: astore        5
      44: aload         5
      46: aload_0
      47: invokevirtual #49                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      50: pop
      51: new           #51                 // class java/util/HashMap
      54: dup
      55: invokespecial #52                 // Method java/util/HashMap."<init>":()V
      58: astore        6
      60: new           #51                 // class java/util/HashMap
      63: dup
      64: invokespecial #52                 // Method java/util/HashMap."<init>":()V
      67: astore        7
      69: new           #51                 // class java/util/HashMap
      72: dup
      73: invokespecial #52                 // Method java/util/HashMap."<init>":()V
      76: astore        8
      78: aload_2
      79: invokevirtual #56                 // Method java/util/HashMap.keySet:()Ljava/util/Set;
      82: invokeinterface #62,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      87: astore        9
      89: aload         9
      91: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      96: ifeq          209
      99: aload         9
     101: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     106: dup
     107: ldc           #74                 // String next(...)
     109: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     112: checkcast     #79                 // class kotlin/Pair
     115: astore        10
     117: aload         10
     119: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     122: checkcast     #84                 // class java/lang/Number
     125: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     128: aload_0
     129: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     132: checkcast     #84                 // class java/lang/Number
     135: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     138: if_icmpne     168
     141: aload         10
     143: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     146: checkcast     #84                 // class java/lang/Number
     149: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     152: aload_0
     153: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     156: checkcast     #84                 // class java/lang/Number
     159: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     162: if_icmpne     168
     165: goto          89
     168: aload         7
     170: checkcast     #92                 // class java/util/Map
     173: aload         10
     175: ldc2_w        #93                 // double -Infinityd
     178: invokestatic  #100                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     181: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     186: pop
     187: aload         8
     189: checkcast     #92                 // class java/util/Map
     192: aload         10
     194: ldc2_w        #93                 // double -Infinityd
     197: invokestatic  #100                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     200: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     205: pop
     206: goto          89
     209: aload         7
     211: checkcast     #92                 // class java/util/Map
     214: aload_0
     215: dconst_0
     216: invokestatic  #100                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     219: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     224: pop
     225: aload         8
     227: checkcast     #92                 // class java/util/Map
     230: aload_0
     231: iconst_m1
     232: i2d
     233: aload_0
     234: aload_0
     235: aload_1
     236: iconst_0
     237: bipush        8
     239: aconst_null
     240: invokestatic  #108                // Method heuristicCostEstimate$default:(Lkotlin/Pair;Lkotlin/Pair;Lkotlin/Pair;IILjava/lang/Object;)D
     243: dmul
     244: invokestatic  #100                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     247: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     252: pop
     253: aconst_null
     254: astore        9
     256: aconst_null
     257: astore        10
     259: aconst_null
     260: astore        11
     262: dconst_0
     263: dstore        12
     265: aload         5
     267: invokevirtual #111                // Method java/util/ArrayList.isEmpty:()Z
     270: ifne          696
     273: aload         5
     275: aload         8
     277: invokestatic  #115                // Method getNextNode:(Ljava/util/ArrayList;Ljava/util/HashMap;)Lkotlin/Pair;
     280: astore        10
     282: aload         10
     284: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     287: checkcast     #79                 // class kotlin/Pair
     290: astore        9
     292: aload         10
     294: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     297: checkcast     #38                 // class java/util/ArrayList
     300: astore        5
     302: aload         9
     304: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     307: checkcast     #84                 // class java/lang/Number
     310: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     313: aload_1
     314: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     317: checkcast     #84                 // class java/lang/Number
     320: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     323: if_icmpne     358
     326: aload         9
     328: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     331: checkcast     #84                 // class java/lang/Number
     334: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     337: aload_1
     338: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     341: checkcast     #84                 // class java/lang/Number
     344: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     347: if_icmpne     358
     350: aload         6
     352: aload         9
     354: invokestatic  #119                // Method reconstructPath:(Ljava/util/HashMap;Lkotlin/Pair;)Ljava/util/ArrayList;
     357: areturn
     358: aload         5
     360: aload         9
     362: aload         8
     364: invokestatic  #123                // Method removeNode:(Ljava/util/ArrayList;Lkotlin/Pair;Ljava/util/HashMap;)Ljava/util/ArrayList;
     367: astore        5
     369: aload         4
     371: aload         9
     373: invokevirtual #124                // Method java/util/HashSet.add:(Ljava/lang/Object;)Z
     376: pop
     377: aload         9
     379: aload_2
     380: invokestatic  #128                // Method getNeighbors:(Lkotlin/Pair;Ljava/util/HashMap;)Ljava/util/ArrayList;
     383: astore        11
     385: aload         11
     387: invokevirtual #129                // Method java/util/ArrayList.iterator:()Ljava/util/Iterator;
     390: dup
     391: ldc           #131                // String iterator(...)
     393: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     396: astore        14
     398: aload         14
     400: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     405: ifeq          265
     408: aload         14
     410: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     415: dup
     416: ldc           #74                 // String next(...)
     418: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     421: checkcast     #79                 // class kotlin/Pair
     424: astore        15
     426: aload         4
     428: aload         15
     430: invokevirtual #134                // Method java/util/HashSet.contains:(Ljava/lang/Object;)Z
     433: ifeq          439
     436: goto          398
     439: aload         5
     441: aload         15
     443: invokevirtual #135                // Method java/util/ArrayList.contains:(Ljava/lang/Object;)Z
     446: ifne          460
     449: aload         5
     451: aload         15
     453: aload         8
     455: invokestatic  #138                // Method insertNode:(Ljava/util/ArrayList;Lkotlin/Pair;Ljava/util/HashMap;)Ljava/util/ArrayList;
     458: astore        5
     460: aload         7
     462: aload         9
     464: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     467: dup
     468: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     471: checkcast     #84                 // class java/lang/Number
     474: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     477: dconst_0
     478: aload         9
     480: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     483: checkcast     #84                 // class java/lang/Number
     486: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     489: aload         15
     491: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     494: checkcast     #84                 // class java/lang/Number
     497: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     500: isub
     501: aload         9
     503: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     506: checkcast     #84                 // class java/lang/Number
     509: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     512: aload         15
     514: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     517: checkcast     #84                 // class java/lang/Number
     520: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     523: isub
     524: imul
     525: i2d
     526: dadd
     527: aload         9
     529: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     532: checkcast     #84                 // class java/lang/Number
     535: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     538: aload         15
     540: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     543: checkcast     #84                 // class java/lang/Number
     546: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     549: isub
     550: aload         9
     552: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     555: checkcast     #84                 // class java/lang/Number
     558: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     561: aload         15
     563: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     566: checkcast     #84                 // class java/lang/Number
     569: invokevirtual #87                 // Method java/lang/Number.intValue:()I
     572: isub
     573: imul
     574: i2d
     575: dadd
     576: invokestatic  #155                // Method java/lang/Math.sqrt:(D)D
     579: dadd
     580: dstore        12
     582: dload         12
     584: aload         7
     586: aload         15
     588: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     591: dup
     592: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     595: checkcast     #84                 // class java/lang/Number
     598: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     601: dcmpl
     602: iflt          608
     605: goto          398
     608: aload         6
     610: checkcast     #92                 // class java/util/Map
     613: aload         15
     615: aload         9
     617: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     622: pop
     623: dload         12
     625: invokestatic  #100                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     628: astore        16
     630: aload         7
     632: checkcast     #92                 // class java/util/Map
     635: aload         15
     637: aload         16
     639: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     644: pop
     645: aload         8
     647: checkcast     #92                 // class java/util/Map
     650: aload         15
     652: iconst_m1
     653: i2d
     654: aload         7
     656: aload         15
     658: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     661: dup
     662: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     665: checkcast     #84                 // class java/lang/Number
     668: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     671: aload         15
     673: aload_0
     674: aload_1
     675: iconst_0
     676: bipush        8
     678: aconst_null
     679: invokestatic  #108                // Method heuristicCostEstimate$default:(Lkotlin/Pair;Lkotlin/Pair;Lkotlin/Pair;IILjava/lang/Object;)D
     682: dadd
     683: dmul
     684: invokestatic  #100                // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     687: invokeinterface #104,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     692: pop
     693: goto          398
     696: aload_3
     697: areturn

  public static final double heuristicCostEstimate(kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, int);
    Code:
       0: aload_0
       1: ldc           #175                // String pos
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #26                 // String start
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #34                 // String goal
      15: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_2
      19: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      22: checkcast     #84                 // class java/lang/Number
      25: invokevirtual #87                 // Method java/lang/Number.intValue:()I
      28: aload_0
      29: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      32: checkcast     #84                 // class java/lang/Number
      35: invokevirtual #87                 // Method java/lang/Number.intValue:()I
      38: isub
      39: i2d
      40: dstore        4
      42: aload_2
      43: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      46: checkcast     #84                 // class java/lang/Number
      49: invokevirtual #87                 // Method java/lang/Number.intValue:()I
      52: aload_0
      53: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      56: checkcast     #84                 // class java/lang/Number
      59: invokevirtual #87                 // Method java/lang/Number.intValue:()I
      62: isub
      63: invokestatic  #179                // Method java/lang/Math.abs:(I)I
      66: i2d
      67: dstore        6
      69: iload_3
      70: tableswitch   { // 1 to 3
                     1: 96
                     2: 108
                     3: 137
               default: 158
          }
      96: getstatic     #10                 // Field D1:D
      99: dload         4
     101: dload         6
     103: dadd
     104: dmul
     105: goto          186
     108: getstatic     #10                 // Field D1:D
     111: dload         4
     113: dload         6
     115: invokestatic  #183                // Method java/lang/Math.max:(DD)D
     118: dmul
     119: getstatic     #14                 // Field D2:D
     122: iconst_1
     123: i2d
     124: dsub
     125: dload         4
     127: dload         6
     129: invokestatic  #186                // Method java/lang/Math.min:(DD)D
     132: dmul
     133: dadd
     134: goto          186
     137: getstatic     #10                 // Field D1:D
     140: dload         4
     142: dload         4
     144: dmul
     145: dload         6
     147: dload         6
     149: dmul
     150: dadd
     151: invokestatic  #155                // Method java/lang/Math.sqrt:(D)D
     154: dmul
     155: goto          186
     158: getstatic     #10                 // Field D1:D
     161: dload         4
     163: dload         6
     165: dadd
     166: dmul
     167: getstatic     #14                 // Field D2:D
     170: iconst_2
     171: i2d
     172: getstatic     #10                 // Field D1:D
     175: dmul
     176: dsub
     177: dload         4
     179: dload         6
     181: invokestatic  #186                // Method java/lang/Math.min:(DD)D
     184: dmul
     185: dadd
     186: dstore        8
     188: dload         8
     190: dconst_1
     191: getstatic     #20                 // Field p:I
     194: i2d
     195: dadd
     196: dmul
     197: dreturn

  public static double heuristicCostEstimate$default(kotlin.Pair, kotlin.Pair, kotlin.Pair, int, int, java.lang.Object);
    Code:
       0: iload         4
       2: bipush        8
       4: iand
       5: ifeq          10
       8: iconst_0
       9: istore_3
      10: aload_0
      11: aload_1
      12: aload_2
      13: iload_3
      14: invokestatic  #191                // Method heuristicCostEstimate:(Lkotlin/Pair;Lkotlin/Pair;Lkotlin/Pair;I)D
      17: dreturn

  public static final kotlin.Pair<java.lang.Integer, java.lang.Integer> findNextNode(java.util.HashSet<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Double>);
    Code:
       0: aload_0
       1: ldc           #195                // String openSet
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #196                // String fScore
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokevirtual #197                // Method java/util/HashSet.isEmpty:()Z
      16: ifeq          35
      19: new           #79                 // class kotlin/Pair
      22: dup
      23: iconst_0
      24: invokestatic  #202                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      27: iconst_0
      28: invokestatic  #202                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      31: invokespecial #205                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      34: areturn
      35: aload_0
      36: invokevirtual #208                // Method java/util/HashSet.size:()I
      39: iconst_1
      40: if_icmpne     55
      43: aload_0
      44: checkcast     #210                // class java/lang/Iterable
      47: iconst_0
      48: invokestatic  #216                // Method kotlin/collections/CollectionsKt.elementAt:(Ljava/lang/Iterable;I)Ljava/lang/Object;
      51: checkcast     #79                 // class kotlin/Pair
      54: areturn
      55: ldc2_w        #217                // double 1.7976931348623157E308d
      58: dstore_2
      59: aload_0
      60: checkcast     #210                // class java/lang/Iterable
      63: iconst_0
      64: invokestatic  #216                // Method kotlin/collections/CollectionsKt.elementAt:(Ljava/lang/Iterable;I)Ljava/lang/Object;
      67: checkcast     #79                 // class kotlin/Pair
      70: astore        4
      72: aload_0
      73: invokevirtual #219                // Method java/util/HashSet.iterator:()Ljava/util/Iterator;
      76: dup
      77: ldc           #131                // String iterator(...)
      79: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      82: astore        5
      84: aload         5
      86: invokeinterface #68,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      91: ifeq          157
      94: aload         5
      96: invokeinterface #72,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     101: dup
     102: ldc           #74                 // String next(...)
     104: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     107: checkcast     #79                 // class kotlin/Pair
     110: astore        6
     112: aload_1
     113: aload         6
     115: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     118: dup
     119: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     122: checkcast     #84                 // class java/lang/Number
     125: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     128: dload_2
     129: dcmpg
     130: ifge          84
     133: aload_1
     134: aload         6
     136: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     139: dup
     140: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     143: checkcast     #84                 // class java/lang/Number
     146: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     149: dstore_2
     150: aload         6
     152: astore        4
     154: goto          84
     157: aload         4
     159: areturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> insertNode(java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Double>);
    Code:
       0: aload_0
       1: ldc           #195                // String openSet
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #224                // String node
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #196                // String fScore
      15: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: aload_1
      20: invokevirtual #49                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      23: pop
      24: aload_0
      25: invokevirtual #225                // Method java/util/ArrayList.size:()I
      28: iconst_1
      29: isub
      30: istore_3
      31: iload_3
      32: iconst_1
      33: isub
      34: iconst_2
      35: idiv
      36: istore        4
      38: aconst_null
      39: astore        5
      41: iload_3
      42: ifeq          139
      45: aload_2
      46: aload_0
      47: iload_3
      48: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      51: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      54: dup
      55: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      58: checkcast     #84                 // class java/lang/Number
      61: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
      64: aload_2
      65: aload_0
      66: iload         4
      68: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      71: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      74: dup
      75: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      78: checkcast     #84                 // class java/lang/Number
      81: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
      84: dcmpl
      85: ifle          139
      88: aload_0
      89: iload_3
      90: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      93: dup
      94: ldc           #230                // String get(...)
      96: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      99: checkcast     #79                 // class kotlin/Pair
     102: astore        5
     104: aload_0
     105: iload_3
     106: aload_0
     107: iload         4
     109: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     112: invokevirtual #234                // Method java/util/ArrayList.set:(ILjava/lang/Object;)Ljava/lang/Object;
     115: pop
     116: aload_0
     117: iload         4
     119: aload         5
     121: invokevirtual #234                // Method java/util/ArrayList.set:(ILjava/lang/Object;)Ljava/lang/Object;
     124: pop
     125: iload         4
     127: istore_3
     128: iload         4
     130: iconst_1
     131: isub
     132: iconst_2
     133: idiv
     134: istore        4
     136: goto          41
     139: aload_0
     140: areturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> removeNode(java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Double>);
    Code:
       0: aload_0
       1: ldc           #195                // String openSet
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #224                // String node
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #196                // String fScore
      15: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_0
      19: aload_1
      20: invokevirtual #240                // Method java/util/ArrayList.remove:(Ljava/lang/Object;)Z
      23: pop
      24: aload_0
      25: aload_2
      26: invokestatic  #244                // Method buildMaxHeap:(Ljava/util/ArrayList;Ljava/util/HashMap;)Ljava/util/ArrayList;
      29: areturn

  public static final kotlin.Pair<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>>> getNextNode(java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Double>);
    Code:
       0: aload_0
       1: ldc           #195                // String openSet
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #196                // String fScore
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #79                 // class kotlin/Pair
      15: dup
      16: aload_0
      17: iconst_0
      18: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      21: checkcast     #79                 // class kotlin/Pair
      24: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      27: aload_0
      28: iconst_0
      29: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      32: checkcast     #79                 // class kotlin/Pair
      35: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      38: invokespecial #205                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      41: astore_2
      42: aconst_null
      43: astore_3
      44: aload_0
      45: invokevirtual #225                // Method java/util/ArrayList.size:()I
      48: iconst_1
      49: if_icmpne     57
      52: aload_0
      53: astore_3
      54: goto          79
      57: aload_0
      58: iconst_0
      59: aload_0
      60: aload_0
      61: invokevirtual #225                // Method java/util/ArrayList.size:()I
      64: iconst_1
      65: isub
      66: invokevirtual #247                // Method java/util/ArrayList.remove:(I)Ljava/lang/Object;
      69: invokevirtual #234                // Method java/util/ArrayList.set:(ILjava/lang/Object;)Ljava/lang/Object;
      72: pop
      73: aload_0
      74: aload_1
      75: invokestatic  #244                // Method buildMaxHeap:(Ljava/util/ArrayList;Ljava/util/HashMap;)Ljava/util/ArrayList;
      78: astore_3
      79: new           #79                 // class kotlin/Pair
      82: dup
      83: aload_2
      84: aload_3
      85: invokespecial #205                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      88: areturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> buildMaxHeap(java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Double>);
    Code:
       0: aload_0
       1: ldc           #195                // String openSet
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #196                // String fScore
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: invokevirtual #225                // Method java/util/ArrayList.size:()I
      16: iconst_2
      17: idiv
      18: iconst_1
      19: isub
      20: istore_2
      21: aload_0
      22: astore_3
      23: iload_2
      24: iflt          46
      27: aload_3
      28: aload_1
      29: iload_2
      30: aload_0
      31: invokevirtual #225                // Method java/util/ArrayList.size:()I
      34: iconst_1
      35: isub
      36: invokestatic  #253                // Method heapifyArray:(Ljava/util/ArrayList;Ljava/util/HashMap;II)Ljava/util/ArrayList;
      39: astore_3
      40: iinc          2, -1
      43: goto          23
      46: aload_3
      47: areturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> heapifyArray(java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Double>, int, int);
    Code:
       0: aload_0
       1: ldc           #195                // String openSet
       3: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #196                // String fScore
       9: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: iconst_2
      13: iload_2
      14: imul
      15: iconst_1
      16: iadd
      17: istore        4
      19: iload         4
      21: iconst_1
      22: iadd
      23: istore        5
      25: iload_2
      26: istore        6
      28: aconst_null
      29: astore        7
      31: iload         4
      33: iload_3
      34: if_icmpgt     85
      37: aload_1
      38: aload_0
      39: iload         4
      41: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      44: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      47: dup
      48: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      51: checkcast     #84                 // class java/lang/Number
      54: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
      57: aload_1
      58: aload_0
      59: iload         6
      61: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      64: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      67: dup
      68: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      71: checkcast     #84                 // class java/lang/Number
      74: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
      77: dcmpl
      78: ifle          85
      81: iload         4
      83: istore        6
      85: iload         5
      87: iload_3
      88: if_icmpgt     139
      91: aload_1
      92: aload_0
      93: iload         5
      95: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
      98: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     101: dup
     102: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     105: checkcast     #84                 // class java/lang/Number
     108: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     111: aload_1
     112: aload_0
     113: iload         6
     115: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     118: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     121: dup
     122: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     125: checkcast     #84                 // class java/lang/Number
     128: invokevirtual #149                // Method java/lang/Number.doubleValue:()D
     131: dcmpl
     132: ifle          139
     135: iload         5
     137: istore        6
     139: iload         6
     141: iload_2
     142: if_icmpeq     149
     145: iconst_1
     146: goto          150
     149: iconst_0
     150: iconst_1
     151: if_icmpne     202
     154: aload_0
     155: iload         6
     157: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     160: dup
     161: ldc           #230                // String get(...)
     163: invokestatic  #77                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     166: checkcast     #79                 // class kotlin/Pair
     169: astore        7
     171: aload_0
     172: iload         6
     174: aload_0
     175: iload_2
     176: invokevirtual #228                // Method java/util/ArrayList.get:(I)Ljava/lang/Object;
     179: invokevirtual #234                // Method java/util/ArrayList.set:(ILjava/lang/Object;)Ljava/lang/Object;
     182: pop
     183: aload_0
     184: iload_2
     185: aload         7
     187: invokevirtual #234                // Method java/util/ArrayList.set:(ILjava/lang/Object;)Ljava/lang/Object;
     190: pop
     191: aload_0
     192: aload_1
     193: iload         6
     195: iload_3
     196: invokestatic  #253                // Method heapifyArray:(Ljava/util/ArrayList;Ljava/util/HashMap;II)Ljava/util/ArrayList;
     199: goto          203
     202: aload_0
     203: areturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> reconstructPath(java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, kotlin.Pair<java.lang.Integer, java.lang.Integer>>, kotlin.Pair<java.lang.Integer, java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc_w         #263                // String cameFrom
       4: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #264                // String current
      11: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: new           #38                 // class java/util/ArrayList
      17: dup
      18: invokespecial #42                 // Method java/util/ArrayList."<init>":()V
      21: astore_2
      22: aload_2
      23: aload_1
      24: invokevirtual #49                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      27: pop
      28: aload_1
      29: astore_3
      30: aload_0
      31: aload_3
      32: invokevirtual #267                // Method java/util/HashMap.containsKey:(Ljava/lang/Object;)Z
      35: ifeq          60
      38: aload_0
      39: aload_3
      40: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
      43: dup
      44: invokestatic  #146                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      47: checkcast     #79                 // class kotlin/Pair
      50: astore_3
      51: aload_2
      52: aload_3
      53: invokevirtual #49                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      56: pop
      57: goto          30
      60: aload_2
      61: areturn

  public static final java.util.ArrayList<kotlin.Pair<java.lang.Integer, java.lang.Integer>> getNeighbors(kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.util.HashMap<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc_w         #264                // String current
       4: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc           #36                 // String map
      10: invokestatic  #32                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aconst_null
      14: astore_2
      15: new           #38                 // class java/util/ArrayList
      18: dup
      19: invokespecial #42                 // Method java/util/ArrayList."<init>":()V
      22: astore_3
      23: iconst_m1
      24: istore        4
      26: iload         4
      28: iconst_2
      29: if_icmpge     147
      32: iconst_m1
      33: istore        5
      35: iload         5
      37: iconst_2
      38: if_icmpge     141
      41: iload         4
      43: ifne          54
      46: iload         5
      48: ifne          54
      51: goto          135
      54: new           #79                 // class kotlin/Pair
      57: dup
      58: aload_0
      59: invokevirtual #82                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      62: checkcast     #84                 // class java/lang/Number
      65: invokevirtual #87                 // Method java/lang/Number.intValue:()I
      68: iload         4
      70: iadd
      71: invokestatic  #202                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      74: aload_0
      75: invokevirtual #90                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      78: checkcast     #84                 // class java/lang/Number
      81: invokevirtual #87                 // Method java/lang/Number.intValue:()I
      84: iload         5
      86: iadd
      87: invokestatic  #202                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      90: invokespecial #205                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      93: astore_2
      94: aload_1
      95: aload_2
      96: invokevirtual #267                // Method java/util/HashMap.containsKey:(Ljava/lang/Object;)Z
      99: ifeq          135
     102: aload_1
     103: aload_2
     104: invokevirtual #142                // Method java/util/HashMap.get:(Ljava/lang/Object;)Ljava/lang/Object;
     107: checkcast     #199                // class java/lang/Integer
     110: iconst_1
     111: istore        6
     113: dup
     114: ifnonnull     121
     117: pop
     118: goto          135
     121: invokevirtual #270                // Method java/lang/Integer.intValue:()I
     124: iload         6
     126: if_icmpne     135
     129: aload_3
     130: aload_2
     131: invokevirtual #49                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
     134: pop
     135: iinc          5, 1
     138: goto          35
     141: iinc          4, 1
     144: goto          26
     147: aload_3
     148: areturn

  static {};
    Code:
       0: dconst_1
       1: putstatic     #10                 // Field D1:D
       4: ldc2_w        #274                // double 2.0d
       7: invokestatic  #155                // Method java/lang/Math.sqrt:(D)D
      10: putstatic     #14                 // Field D2:D
      13: return
}


package day3

import java.io.File

fun computeGearRatio(maybeGearPosition: Pair<Int, Int>, numbers: MutableMap<Pair<Int, Int>, Int>): Int {
    val neighbourNumbers = listOf(
        maybeGearPosition.first to maybeGearPosition.second -1,
        maybeGearPosition.first + 1 to maybeGearPosition.second -1,
        maybeGearPosition.first - 1 to maybeGearPosition.second -1,
        maybeGearPosition.first to maybeGearPosition.second +1,
        maybeGearPosition.first + 1 to maybeGearPosition.second +1,
        maybeGearPosition.first - 1 to maybeGearPosition.second +1,
        maybeGearPosition.first + 1 to maybeGearPosition.second,
        maybeGearPosition.first - 1 to maybeGearPosition.second
    ).mapNotNull { numbers[it] }.toSet()

    return if (neighbourNumbers.size == 2) {
        neighbourNumbers.reduce(Int::times)
    } else {
        0
    }
}

fun main() {
    val inputFileName = "day3/input.txt"
    val numbers: MutableMap<Pair<Int, Int>, Int> = mutableMapOf()
    val hopefullyGears: MutableList<Pair<Int, Int>> = mutableListOf()
    var lineNumber = 0

    File(inputFileName).forEachLine {
        var number = ""
        var digitsIndices = mutableListOf<Pair<Int, Int>>()
        it.forEachIndexed { index, c ->
            if (c.isDigit()) {
                number += c.toString()
                digitsIndices.add(lineNumber to index)
            } else if(number != "") {
                digitsIndices.forEach {digitIndex ->
                    numbers[digitIndex] = number.toInt()
                }
                number = ""
                digitsIndices = mutableListOf()
            }

            if (c == '*') {
                hopefullyGears.add(lineNumber to index)
            }
        }

        if(number != "") {
            digitsIndices.forEach {digitIndex ->
                numbers[digitIndex] = number.toInt()
            }
            number = ""
            digitsIndices = mutableListOf()
        }

        ++lineNumber
    }

    println(hopefullyGears.sumOf { computeGearRatio(it, numbers) })
}

Compiled from "part2.kt"
public final class day3.Part2Kt {
  public static final int computeGearRatio(kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.util.Map<kotlin.Pair<java.lang.Integer, java.lang.Integer>, java.lang.Integer>);
    Code:
       0: aload_0
       1: ldc           #10                 // String maybeGearPosition
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #18                 // String numbers
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: bipush        8
      14: anewarray     #20                 // class kotlin/Pair
      17: astore_3
      18: aload_3
      19: iconst_0
      20: aload_0
      21: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      24: aload_0
      25: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      28: checkcast     #29                 // class java/lang/Number
      31: invokevirtual #33                 // Method java/lang/Number.intValue:()I
      34: iconst_1
      35: isub
      36: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      39: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      42: aastore
      43: aload_3
      44: iconst_1
      45: aload_0
      46: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      49: checkcast     #29                 // class java/lang/Number
      52: invokevirtual #33                 // Method java/lang/Number.intValue:()I
      55: iconst_1
      56: iadd
      57: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      60: aload_0
      61: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      64: checkcast     #29                 // class java/lang/Number
      67: invokevirtual #33                 // Method java/lang/Number.intValue:()I
      70: iconst_1
      71: isub
      72: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      75: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
      78: aastore
      79: aload_3
      80: iconst_2
      81: aload_0
      82: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      85: checkcast     #29                 // class java/lang/Number
      88: invokevirtual #33                 // Method java/lang/Number.intValue:()I
      91: iconst_1
      92: isub
      93: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      96: aload_0
      97: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     100: checkcast     #29                 // class java/lang/Number
     103: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     106: iconst_1
     107: isub
     108: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     111: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     114: aastore
     115: aload_3
     116: iconst_3
     117: aload_0
     118: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     121: aload_0
     122: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     125: checkcast     #29                 // class java/lang/Number
     128: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     131: iconst_1
     132: iadd
     133: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     136: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     139: aastore
     140: aload_3
     141: iconst_4
     142: aload_0
     143: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     146: checkcast     #29                 // class java/lang/Number
     149: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     152: iconst_1
     153: iadd
     154: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     157: aload_0
     158: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     161: checkcast     #29                 // class java/lang/Number
     164: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     167: iconst_1
     168: iadd
     169: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     172: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     175: aastore
     176: aload_3
     177: iconst_5
     178: aload_0
     179: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     182: checkcast     #29                 // class java/lang/Number
     185: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     188: iconst_1
     189: isub
     190: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     193: aload_0
     194: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     197: checkcast     #29                 // class java/lang/Number
     200: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     203: iconst_1
     204: iadd
     205: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     208: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     211: aastore
     212: aload_3
     213: bipush        6
     215: aload_0
     216: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     219: checkcast     #29                 // class java/lang/Number
     222: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     225: iconst_1
     226: iadd
     227: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     230: aload_0
     231: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     234: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     237: aastore
     238: aload_3
     239: bipush        7
     241: aload_0
     242: invokevirtual #24                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     245: checkcast     #29                 // class java/lang/Number
     248: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     251: iconst_1
     252: isub
     253: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     256: aload_0
     257: invokevirtual #27                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     260: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     263: aastore
     264: aload_3
     265: invokestatic  #51                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     268: checkcast     #53                 // class java/lang/Iterable
     271: astore_3
     272: nop
     273: iconst_0
     274: istore        4
     276: aload_3
     277: astore        5
     279: new           #55                 // class java/util/ArrayList
     282: dup
     283: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
     286: checkcast     #61                 // class java/util/Collection
     289: astore        6
     291: iconst_0
     292: istore        7
     294: aload         5
     296: astore        8
     298: iconst_0
     299: istore        9
     301: aload         8
     303: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     308: astore        10
     310: aload         10
     312: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     317: ifeq          384
     320: aload         10
     322: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     327: astore        11
     329: aload         11
     331: astore        12
     333: iconst_0
     334: istore        13
     336: aload         12
     338: checkcast     #20                 // class kotlin/Pair
     341: astore        14
     343: iconst_0
     344: istore        15
     346: aload_1
     347: aload         14
     349: invokeinterface #80,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     354: checkcast     #35                 // class java/lang/Integer
     357: dup
     358: ifnull        379
     361: astore        16
     363: iconst_0
     364: istore        17
     366: aload         6
     368: aload         16
     370: invokeinterface #84,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     375: pop
     376: goto          380
     379: pop
     380: nop
     381: goto          310
     384: nop
     385: aload         6
     387: checkcast     #86                 // class java/util/List
     390: nop
     391: checkcast     #53                 // class java/lang/Iterable
     394: invokestatic  #90                 // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
     397: astore_2
     398: aload_2
     399: invokeinterface #95,  1           // InterfaceMethod java/util/Set.size:()I
     404: iconst_2
     405: if_icmpne     515
     408: aload_2
     409: checkcast     #53                 // class java/lang/Iterable
     412: astore_3
     413: iconst_0
     414: istore        4
     416: aload_3
     417: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     422: astore        5
     424: aload         5
     426: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     431: ifne          444
     434: new           #97                 // class java/lang/UnsupportedOperationException
     437: dup
     438: ldc           #99                 // String Empty collection can\'t be reduced.
     440: invokespecial #102                // Method java/lang/UnsupportedOperationException."<init>":(Ljava/lang/String;)V
     443: athrow
     444: aload         5
     446: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     451: astore        6
     453: aload         5
     455: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     460: ifeq          504
     463: aload         6
     465: aload         5
     467: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     472: checkcast     #29                 // class java/lang/Number
     475: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     478: istore        7
     480: checkcast     #29                 // class java/lang/Number
     483: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     486: istore        8
     488: iconst_0
     489: istore        9
     491: iload         8
     493: iload         7
     495: imul
     496: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     499: astore        6
     501: goto          453
     504: aload         6
     506: checkcast     #29                 // class java/lang/Number
     509: invokevirtual #33                 // Method java/lang/Number.intValue:()I
     512: goto          516
     515: iconst_0
     516: ireturn

  public static final void main();
    Code:
       0: ldc           #135                // String day3/input.txt
       2: astore_0
       3: new           #137                // class java/util/LinkedHashMap
       6: dup
       7: invokespecial #138                // Method java/util/LinkedHashMap."<init>":()V
      10: checkcast     #76                 // class java/util/Map
      13: astore_1
      14: new           #55                 // class java/util/ArrayList
      17: dup
      18: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
      21: checkcast     #86                 // class java/util/List
      24: astore_2
      25: new           #140                // class kotlin/jvm/internal/Ref$IntRef
      28: dup
      29: invokespecial #141                // Method kotlin/jvm/internal/Ref$IntRef."<init>":()V
      32: astore_3
      33: new           #143                // class java/io/File
      36: dup
      37: aload_0
      38: invokespecial #144                // Method java/io/File."<init>":(Ljava/lang/String;)V
      41: aconst_null
      42: aload_3
      43: aload_2
      44: aload_1
      45: invokedynamic #163,  0            // InvokeDynamic #0:invoke:(Lkotlin/jvm/internal/Ref$IntRef;Ljava/util/List;Ljava/util/Map;)Lkotlin/jvm/functions/Function1;
      50: iconst_1
      51: aconst_null
      52: invokestatic  #169                // Method kotlin/io/FilesKt.forEachLine$default:(Ljava/io/File;Ljava/nio/charset/Charset;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
      55: aload_2
      56: checkcast     #53                 // class java/lang/Iterable
      59: astore        4
      61: iconst_0
      62: istore        5
      64: aload         4
      66: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      71: astore        6
      73: aload         6
      75: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      80: ifeq          124
      83: aload         6
      85: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      90: astore        7
      92: iload         5
      94: aload         7
      96: checkcast     #20                 // class kotlin/Pair
      99: astore        8
     101: istore        10
     103: iconst_0
     104: istore        9
     106: aload         8
     108: aload_1
     109: invokestatic  #171                // Method computeGearRatio:(Lkotlin/Pair;Ljava/util/Map;)I
     112: istore        11
     114: iload         10
     116: iload         11
     118: iadd
     119: istore        5
     121: goto          73
     124: iload         5
     126: istore        4
     128: getstatic     #177                // Field java/lang/System.out:Ljava/io/PrintStream;
     131: iload         4
     133: invokevirtual #183                // Method java/io/PrintStream.println:(I)V
     136: return

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

  private static final kotlin.Unit main$lambda$4(kotlin.jvm.internal.Ref$IntRef, java.util.List, java.util.Map, java.lang.String);
    Code:
       0: aload_3
       1: ldc           #198                // String it
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aconst_null
       7: astore        4
       9: ldc           #200                // String
      11: astore        4
      13: aconst_null
      14: astore        5
      16: new           #55                 // class java/util/ArrayList
      19: dup
      20: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
      23: checkcast     #86                 // class java/util/List
      26: astore        5
      28: aload_3
      29: checkcast     #202                // class java/lang/CharSequence
      32: astore        6
      34: iconst_0
      35: istore        7
      37: iconst_0
      38: istore        8
      40: iconst_0
      41: istore        9
      43: iload         9
      45: aload         6
      47: invokeinterface #205,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      52: if_icmpge     271
      55: aload         6
      57: iload         9
      59: invokeinterface #209,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      64: istore        10
      66: iload         8
      68: iinc          8, 1
      71: iload         10
      73: istore        11
      75: istore        12
      77: iconst_0
      78: istore        13
      80: iload         11
      82: invokestatic  #215                // Method java/lang/Character.isDigit:(C)Z
      85: ifeq          136
      88: new           #217                // class java/lang/StringBuilder
      91: dup
      92: invokespecial #218                // Method java/lang/StringBuilder."<init>":()V
      95: aload         4
      97: invokevirtual #222                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     100: iload         11
     102: invokevirtual #225                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     105: invokevirtual #229                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     108: astore        4
     110: aload         5
     112: aload_0
     113: getfield      #232                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     116: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     119: iload         12
     121: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     124: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     127: invokeinterface #233,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     132: pop
     133: goto          234
     136: aload         4
     138: ldc           #200                // String
     140: invokestatic  #237                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     143: ifne          234
     146: aload         5
     148: checkcast     #53                 // class java/lang/Iterable
     151: astore        14
     153: iconst_0
     154: istore        15
     156: aload         14
     158: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     163: astore        16
     165: aload         16
     167: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     172: ifeq          217
     175: aload         16
     177: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     182: astore        17
     184: aload         17
     186: checkcast     #20                 // class kotlin/Pair
     189: astore        18
     191: iconst_0
     192: istore        19
     194: nop
     195: aload_2
     196: aload         18
     198: aload         4
     200: invokestatic  #241                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     203: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     206: invokeinterface #245,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     211: pop
     212: nop
     213: nop
     214: goto          165
     217: nop
     218: ldc           #200                // String
     220: astore        4
     222: new           #55                 // class java/util/ArrayList
     225: dup
     226: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
     229: checkcast     #86                 // class java/util/List
     232: astore        5
     234: iload         11
     236: bipush        42
     238: if_icmpne     263
     241: aload_1
     242: aload_0
     243: getfield      #232                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     246: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     249: iload         12
     251: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     254: invokestatic  #45                 // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     257: invokeinterface #233,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     262: pop
     263: nop
     264: nop
     265: iinc          9, 1
     268: goto          43
     271: nop
     272: aload         4
     274: ldc           #200                // String
     276: invokestatic  #237                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     279: ifne          370
     282: aload         5
     284: checkcast     #53                 // class java/lang/Iterable
     287: astore        6
     289: iconst_0
     290: istore        7
     292: aload         6
     294: invokeinterface #65,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     299: astore        8
     301: aload         8
     303: invokeinterface #71,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
     308: ifeq          353
     311: aload         8
     313: invokeinterface #74,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     318: astore        9
     320: aload         9
     322: checkcast     #20                 // class kotlin/Pair
     325: astore        10
     327: iconst_0
     328: istore        11
     330: nop
     331: aload_2
     332: aload         10
     334: aload         4
     336: invokestatic  #241                // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
     339: invokestatic  #39                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     342: invokeinterface #245,  3          // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     347: pop
     348: nop
     349: nop
     350: goto          301
     353: nop
     354: ldc           #200                // String
     356: astore        4
     358: new           #55                 // class java/util/ArrayList
     361: dup
     362: invokespecial #59                 // Method java/util/ArrayList."<init>":()V
     365: checkcast     #86                 // class java/util/List
     368: astore        5
     370: aload_0
     371: aload_0
     372: getfield      #232                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     375: iconst_1
     376: iadd
     377: putfield      #232                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     380: aload_0
     381: getfield      #232                // Field kotlin/jvm/internal/Ref$IntRef.element:I
     384: pop
     385: getstatic     #251                // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     388: areturn
}