package boti996.lileto.tests.helpers

// Lileto null value
internal const val liletoNullValue = "-"

/**
 * Alias for simple testcases.
 * [Pair]'s first element is a [String] in Lileto language.
 * [Pair]'s second element is the expected result [String].
 */
internal typealias testcase = Pair<String, String>
internal typealias testcases = List<testcase>

internal fun testcase.getKeyType() = this.first::class
internal fun testcase.getValueType() = this.second::class

/**
 * Store the literals of Lileto brackets
 * @param literals opening and closing characters
 */
internal enum class BracketType(private val literals: Pair<Char, Char>) {
    TEXT(Pair('"', '"')),
    TEMPLATE(Pair('<', '>')),
    SPECIAL_CHAR(Pair('$', '$')),
    COMMAND(Pair('!', '!')),
    CONTAINER(Pair('[', ']')),
    COMMENT(Pair('.', '.'));

    fun open() = "{${literals.first}"
    fun close() = "${literals.second}}"
}

/**
 * Store the literals of Lileto special characters
 * @param values Lileto literal and the resolved values
 */
internal enum class SpecialCharacter(private val values: Pair<String, Char>) {
    ENTER       (Pair("e", '\n')),
    TAB         (Pair("t", '\t')),
    SPACE       (Pair("s", ' ')),
    O_R_BRACKET (Pair("orb", '(')),
    C_R_BBRACKET(Pair("crb", ')')),
    EQUALS_SIGN (Pair("eq", '=')),
    PLUS_SIGN   (Pair("pl", '+')),
    O_C_BRACKET (Pair("ocb", '{')),
    C_C_BRACKET (Pair("ccb", '}')),
    POINT       (Pair("pe", '.')),
    COMMA       (Pair("co", ',')),
    SEMICOLON   (Pair("sc", ';')),
    COLON       (Pair("cl", ':')),
    VBAR        (Pair("pi", '|')),
    LT_SIGN     (Pair("ls", '<')),
    GT_SIGN     (Pair("gt", '>')),
    QUESTION_M  (Pair("qm", '?')),
    EXCLAM_M    (Pair("dm", '!'));

    fun literal() = values.first
    fun character() = values.second.toString()
}

/**
 * Store bracket with it's content
 * @param bracket type of bracket
 */
internal data class BracketWithContent(val bracket: BracketType, val content: Any) {
    fun open() = bracket.open()
    fun close() = bracket.close()
}

/**
 * Convert an [Array] of [BracketType] and [Any] type of content
 * into a [List] of [BracketWithContent]
 * @param brackets data to convert
 */
internal fun bracketListOf(brackets: List<Pair<BracketType, Any>>)
        : List<BracketWithContent> = brackets.map {
    BracketWithContent(
        bracket = it.first,
        content = it.second
    )
}

/**
 * Concatenate a [List] of [Any] type of data into a [String] and return it in [Pair] with the expected [String]
 * @param input data to concatenate in Lileto language format
 * @param expected expected output of Lileto in plain text
 */
internal fun buildTestCaseEntry(input: List<Any>,
                                expected: String)
        : testcase {

    return Pair(input.joinToString(separator = ""), expected)
}

Compiled from "DataHelpers.kt"
public final class boti996.lileto.tests.helpers.DataHelpersKt {
  public static final java.lang.String liletoNullValue;

  public static final kotlin.reflect.KClass<? extends java.lang.String> getKeyType(kotlin.Pair<java.lang.String, java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #22                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      10: invokevirtual #26                 // Method java/lang/Object.getClass:()Ljava/lang/Class;
      13: invokestatic  #32                 // Method kotlin/jvm/internal/Reflection.getOrCreateKotlinClass:(Ljava/lang/Class;)Lkotlin/reflect/KClass;
      16: areturn

  public static final kotlin.reflect.KClass<? extends java.lang.String> getValueType(kotlin.Pair<java.lang.String, java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #38                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      10: invokevirtual #26                 // Method java/lang/Object.getClass:()Ljava/lang/Class;
      13: invokestatic  #32                 // Method kotlin/jvm/internal/Reflection.getOrCreateKotlinClass:(Ljava/lang/Class;)Lkotlin/reflect/KClass;
      16: areturn

  public static final java.util.List<boti996.lileto.tests.helpers.BracketWithContent> bracketListOf(java.util.List<? extends kotlin.Pair<? extends boti996.lileto.tests.helpers.BracketType, ? extends java.lang.Object>>);
    Code:
       0: aload_0
       1: ldc           #44                 // String brackets
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: checkcast     #46                 // class java/lang/Iterable
      10: astore_1
      11: iconst_0
      12: istore_2
      13: aload_1
      14: astore_3
      15: new           #48                 // class java/util/ArrayList
      18: dup
      19: aload_1
      20: bipush        10
      22: invokestatic  #54                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      25: invokespecial #58                 // Method java/util/ArrayList."<init>":(I)V
      28: checkcast     #60                 // class java/util/Collection
      31: astore        4
      33: iconst_0
      34: istore        5
      36: aload_3
      37: invokeinterface #64,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      42: astore        6
      44: aload         6
      46: invokeinterface #70,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      51: ifeq          110
      54: aload         6
      56: invokeinterface #73,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      61: astore        7
      63: aload         4
      65: aload         7
      67: checkcast     #18                 // class kotlin/Pair
      70: astore        8
      72: astore        10
      74: iconst_0
      75: istore        9
      77: new           #75                 // class boti996/lileto/tests/helpers/BracketWithContent
      80: dup
      81: aload         8
      83: invokevirtual #22                 // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
      86: checkcast     #77                 // class boti996/lileto/tests/helpers/BracketType
      89: aload         8
      91: invokevirtual #38                 // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
      94: invokespecial #80                 // Method boti996/lileto/tests/helpers/BracketWithContent."<init>":(Lboti996/lileto/tests/helpers/BracketType;Ljava/lang/Object;)V
      97: nop
      98: aload         10
     100: swap
     101: invokeinterface #84,  2           // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     106: pop
     107: goto          44
     110: aload         4
     112: checkcast     #86                 // class java/util/List
     115: nop
     116: areturn

  public static final kotlin.Pair<java.lang.String, java.lang.String> buildTestCaseEntry(java.util.List<? extends java.lang.Object>, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #104                // String input
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #106                // String expected
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #18                 // class kotlin/Pair
      15: dup
      16: aload_0
      17: checkcast     #46                 // class java/lang/Iterable
      20: ldc           #108                // String
      22: checkcast     #110                // class java/lang/CharSequence
      25: aconst_null
      26: aconst_null
      27: iconst_0
      28: aconst_null
      29: aconst_null
      30: bipush        62
      32: aconst_null
      33: invokestatic  #114                // Method kotlin/collections/CollectionsKt.joinToString$default:(Ljava/lang/Iterable;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String;
      36: aload_1
      37: invokespecial #117                // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
      40: areturn
}


package org.gnit.cpsd

import kotlin.math.*

/**
 * [Reference](https://stackoverflow.com/questions/3694380/calculating-distance-between-two-points-using-latitude-longitude)
 *
 * Calculate distance between two points in latitude and longitude taking
 * into account height difference. If you are not interested in height
 * difference pass 0.0. Uses Haversine method as its base.
 *
 * lat1, lon1 Start point lat2, lon2 End point el1 Start altitude in meters
 * el2 End altitude in meters
 * @returns Distance in Meters
 */
fun distanceOf(
    lat1: Double, lat2: Double, lng1: Double,
    lng2: Double, el1: Double, el2: Double
): Double {
    val R = 6371 // Radius of the earth
    val latDistance = Math.toRadians(lat2 - lat1)
    val lonDistance = Math.toRadians(lng2 - lng1)
    val a = (sin(latDistance / 2) * sin(latDistance / 2)
            + (cos(Math.toRadians(lat1)) * cos(Math.toRadians(lat2))
            * sin(lonDistance / 2) * sin(lonDistance / 2)))
    val c = 2 * atan2(sqrt(a), sqrt(1 - a))
    var distance = R * c * 1000 // convert to meters
    val height = el1 - el2
    distance = distance.pow(2.0) + height.pow(2.0)
    return sqrt(distance)
}

/**
 * [Reference](https://gis.stackexchange.com/questions/15545/calculating-coordinates-of-square-x-miles-from-center-point)
 * @param lat latitude of center coordinate for square polygon
 * @param lng longitude of center coordinate for square polygon
 * @param side length of the side of square in meters
 * @return array of 5 coordinates to draw square polygon with GeoJson, order of corner is SW->SE->NE->NW->SW
 */
fun squareOf(lat: Double, lng: Double, side: Double): Array<Array<Double>> {

    val dLat = side / (111 * 1000) // Latitudinal or north-south distance in degrees
    val dLng = dLat / cos(Math.toRadians(lat)) // Longitudinal or east-west distance in degrees

    val nLat = dLat / 2
    val nLng = dLng / 2

    val lat1 = lat - nLat
    val lng1 = lng - nLng

    val lat2 = lat - nLat
    val lng2 = lng + nLng

    val lat3 = lat + nLat
    val lng3 = lng + nLng

    val lat4 = lat + nLat
    val lng4 = lng - nLng

    return arrayOf(
        arrayOf(lng1, lat1),
        arrayOf(lng2, lat2),
        arrayOf(lng3, lat3),
        arrayOf(lng4, lat4),
        arrayOf(lng1, lat1)
    )
}

/**
 * @param latNE latitude of first geo polygon coordinate which is north-east corner
 * @param lngNE longitude of first geo polygon coordinate which is north-east corner
 * @param latSW latitude of third geo polygon coordinate which is south-west corner
 * @param lngSW longitude of third geo polygon coordinate which is south-west corner
 * @return array of Double representing (latitude, longitude) of center of the square
 */
fun centerOf(latNE: Double, lngNE: Double, latSW: Double, lngSW: Double): Array<Double> = arrayOf(
    (latNE + latSW) * 0.5, (lngNE + lngSW) * 0.5
)

Compiled from "GeoCalculation.kt"
public final class org.gnit.cpsd.GeoCalculationKt {
  public static final double distanceOf(double, double, double, double, double, double);
    Code:
       0: sipush        6371
       3: istore        12
       5: dload_2
       6: dload_0
       7: dsub
       8: invokestatic  #12                 // Method java/lang/Math.toRadians:(D)D
      11: dstore        13
      13: dload         6
      15: dload         4
      17: dsub
      18: invokestatic  #12                 // Method java/lang/Math.toRadians:(D)D
      21: dstore        15
      23: dload         13
      25: iconst_2
      26: i2d
      27: ddiv
      28: invokestatic  #15                 // Method java/lang/Math.sin:(D)D
      31: dload         13
      33: iconst_2
      34: i2d
      35: ddiv
      36: invokestatic  #15                 // Method java/lang/Math.sin:(D)D
      39: dmul
      40: dload_0
      41: invokestatic  #12                 // Method java/lang/Math.toRadians:(D)D
      44: invokestatic  #18                 // Method java/lang/Math.cos:(D)D
      47: dload_2
      48: invokestatic  #12                 // Method java/lang/Math.toRadians:(D)D
      51: invokestatic  #18                 // Method java/lang/Math.cos:(D)D
      54: dmul
      55: dload         15
      57: iconst_2
      58: i2d
      59: ddiv
      60: invokestatic  #15                 // Method java/lang/Math.sin:(D)D
      63: dmul
      64: dload         15
      66: iconst_2
      67: i2d
      68: ddiv
      69: invokestatic  #15                 // Method java/lang/Math.sin:(D)D
      72: dmul
      73: dadd
      74: dstore        17
      76: iconst_2
      77: i2d
      78: dload         17
      80: invokestatic  #21                 // Method java/lang/Math.sqrt:(D)D
      83: iconst_1
      84: i2d
      85: dload         17
      87: dsub
      88: invokestatic  #21                 // Method java/lang/Math.sqrt:(D)D
      91: invokestatic  #25                 // Method java/lang/Math.atan2:(DD)D
      94: dmul
      95: dstore        19
      97: iload         12
      99: i2d
     100: dload         19
     102: dmul
     103: sipush        1000
     106: i2d
     107: dmul
     108: dstore        21
     110: dload         8
     112: dload         10
     114: dsub
     115: dstore        23
     117: dload         21
     119: ldc2_w        #26                 // double 2.0d
     122: invokestatic  #30                 // Method java/lang/Math.pow:(DD)D
     125: dload         23
     127: ldc2_w        #26                 // double 2.0d
     130: invokestatic  #30                 // Method java/lang/Math.pow:(DD)D
     133: dadd
     134: dstore        21
     136: dload         21
     138: invokestatic  #21                 // Method java/lang/Math.sqrt:(D)D
     141: dreturn

  public static final java.lang.Double[][] squareOf(double, double, double);
    Code:
       0: dload         4
       2: ldc           #49                 // int 111000
       4: i2d
       5: ddiv
       6: dstore        6
       8: dload         6
      10: dload_0
      11: invokestatic  #12                 // Method java/lang/Math.toRadians:(D)D
      14: invokestatic  #18                 // Method java/lang/Math.cos:(D)D
      17: ddiv
      18: dstore        8
      20: dload         6
      22: iconst_2
      23: i2d
      24: ddiv
      25: dstore        10
      27: dload         8
      29: iconst_2
      30: i2d
      31: ddiv
      32: dstore        12
      34: dload_0
      35: dload         10
      37: dsub
      38: dstore        14
      40: dload_2
      41: dload         12
      43: dsub
      44: dstore        16
      46: dload_0
      47: dload         10
      49: dsub
      50: dstore        18
      52: dload_2
      53: dload         12
      55: dadd
      56: dstore        20
      58: dload_0
      59: dload         10
      61: dadd
      62: dstore        22
      64: dload_2
      65: dload         12
      67: dadd
      68: dstore        24
      70: dload_0
      71: dload         10
      73: dadd
      74: dstore        26
      76: dload_2
      77: dload         12
      79: dsub
      80: dstore        28
      82: iconst_5
      83: anewarray     #51                 // class "[Ljava/lang/Double;"
      86: astore        30
      88: aload         30
      90: iconst_0
      91: iconst_2
      92: anewarray     #53                 // class java/lang/Double
      95: astore        31
      97: aload         31
      99: iconst_0
     100: dload         16
     102: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     105: aastore
     106: aload         31
     108: iconst_1
     109: dload         14
     111: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     114: aastore
     115: aload         31
     117: aastore
     118: aload         30
     120: iconst_1
     121: iconst_2
     122: anewarray     #53                 // class java/lang/Double
     125: astore        31
     127: aload         31
     129: iconst_0
     130: dload         20
     132: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     135: aastore
     136: aload         31
     138: iconst_1
     139: dload         18
     141: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     144: aastore
     145: aload         31
     147: aastore
     148: aload         30
     150: iconst_2
     151: iconst_2
     152: anewarray     #53                 // class java/lang/Double
     155: astore        31
     157: aload         31
     159: iconst_0
     160: dload         24
     162: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     165: aastore
     166: aload         31
     168: iconst_1
     169: dload         22
     171: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     174: aastore
     175: aload         31
     177: aastore
     178: aload         30
     180: iconst_3
     181: iconst_2
     182: anewarray     #53                 // class java/lang/Double
     185: astore        31
     187: aload         31
     189: iconst_0
     190: dload         28
     192: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     195: aastore
     196: aload         31
     198: iconst_1
     199: dload         26
     201: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     204: aastore
     205: aload         31
     207: aastore
     208: aload         30
     210: iconst_4
     211: iconst_2
     212: anewarray     #53                 // class java/lang/Double
     215: astore        31
     217: aload         31
     219: iconst_0
     220: dload         16
     222: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     225: aastore
     226: aload         31
     228: iconst_1
     229: dload         14
     231: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     234: aastore
     235: aload         31
     237: aastore
     238: aload         30
     240: areturn

  public static final java.lang.Double[] centerOf(double, double, double, double);
    Code:
       0: iconst_2
       1: anewarray     #53                 // class java/lang/Double
       4: astore        8
       6: aload         8
       8: iconst_0
       9: dload_0
      10: dload         4
      12: dadd
      13: ldc2_w        #71                 // double 0.5d
      16: dmul
      17: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      20: aastore
      21: aload         8
      23: iconst_1
      24: dload_2
      25: dload         6
      27: dadd
      28: ldc2_w        #71                 // double 0.5d
      31: dmul
      32: invokestatic  #57                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      35: aastore
      36: aload         8
      38: areturn
}


package com.thedevadventure.roverkata

import java.util.*

fun main() {
    val scanner = Scanner(System.`in`)
//    Get and validate the plateau
    println("Please enter the dimensions of your plateau starting with the size of X?")
    val plateauDimensionsX = scanner.nextInt()
    println("And the size of Y?")
    val plateauDimensionsY = scanner.nextInt()
    val marsTerrain = Plateau(plateauDimensionsX, plateauDimensionsY)
    validatePlateau(marsTerrain)

//    Get and validate the locations of the rovers
    println("Please enter the first rovers coordinates, starting with X hitting enter and then Y...")
    val firstRoverLocation = Location(scanner.nextInt(), scanner.nextInt())
    val firstRoverCommands = getRoverCommands(scanner)

    println("Please enter the second rovers coordinates, starting with X hitting enter and then Y...")
    val secondRoverLocation = Location(scanner.nextInt(), scanner.nextInt())
    val secondRoverCommands = getRoverCommands(scanner)

    validateTheRoverHasLanded(marsTerrain, firstRoverLocation)
    validateTheRoverHasLanded(marsTerrain, secondRoverLocation)
    explore(marsTerrain, firstRoverLocation, firstRoverCommands)
    explore(marsTerrain, secondRoverLocation, secondRoverCommands)
    checkIntersections(
        explore(marsTerrain, firstRoverLocation, firstRoverCommands),
        explore(marsTerrain, secondRoverLocation, secondRoverCommands)
    )
}

fun validatePlateau(plateauDimensions: Plateau): Boolean {
    if (plateauDimensions.X > 0 && plateauDimensions.Y > 0) {
        println("Thank you for passing a valid plateau...")
        return true
    } else {
        throw Exception("Invalid plateau passed both your inputs should be larger than 0!")
    }
}

fun validateTheRoverHasLanded(plateau: Plateau, location: Location): Boolean {
    if ((location.X > plateau.X || location.X < 0) || (location.Y > plateau.Y || location.Y < 0)) {
        throw Exception("Mission failed... The rover missed the target!")
    } else {
        println("Rover has been located on the plateau, good job!")
        return true
    }
}

fun validateRoverCommands(commands: String): Instructions {
    if (!commands.uppercase().all { it.isLetter().and(it == 'N' || it == 'S' || it == 'W' || it == 'E') }) {
        throw Exception("Computer says No!")
    }
    val roverCommands = Instructions(commands.uppercase())
    println("Commands received: ${roverCommands.roverCommands}...")
    return roverCommands
}

fun getRoverCommands(scanner: Scanner): Instructions {
    println("Please enter the command sequence for the first rover... valid inputs are limited to N, E, W, and S! ")
    val roverCommands = scanner.next()
    return validateRoverCommands(roverCommands)
}

fun explore(plateau: Plateau, startingLocation: Location, roverInstructions: Instructions): MutableList<Location> {
    val instructions = roverInstructions.roverCommands.map { it }
    val pathPoints = mutableListOf<Location>()
    var currentLocation = startingLocation
    pathPoints.add(startingLocation)
    for (instruction in instructions) {
        val result = move(instruction, currentLocation)
        isValidRoverPosition(result, plateau)
        pathPoints.add(result)
        currentLocation = result
    }
    return pathPoints
}

fun move(input: Char, location: Location): Location {
    return when (input.uppercaseChar()) {
        'N' -> increaseY(location)
        'E' -> increaseX(location)
        'S' -> decreaseY(location)
        'W' -> decreaseX(location)
        else -> location
    }
}

fun isValidRoverPosition(currentLocation: Location, plateau: Plateau): Boolean {
    if ((currentLocation.X > plateau.X || currentLocation.X < 0) || (currentLocation.Y > plateau.Y || currentLocation.Y < 0)) {
        throw Exception("Mission failed... The rover was lost at $currentLocation...")
    } else return true
}

fun increaseX(location: Location): Location {
    return Location(location.X + 1, location.Y)
}

fun increaseY(location: Location): Location {
    return Location(location.X, location.Y + 1)
}

fun decreaseX(location: Location): Location {
    return Location(location.X - 1, location.Y)
}

fun decreaseY(location: Location): Location {
    return Location(location.X, location.Y - 1)
}

fun checkIntersections(pathPoints1: List<Location>, pathPoints2: List<Location>): MutableList<Location> {
    val intersections = pathPoints1.intersect(pathPoints2.toSet()).toMutableList()
    if (intersections.isEmpty()) {
        throw Exception("No Intersections found...")
    } else {
        println("Intersection point are: $intersections")
    }
    return intersections
}

data class Plateau(val X: Int, val Y: Int)
data class Location(val X: Int, val Y: Int)
data class Instructions(val roverCommands: String)

Compiled from "RoverKata.kt"
public final class com.thedevadventure.roverkata.RoverKataKt {
  public static final void main();
    Code:
       0: new           #8                  // class java/util/Scanner
       3: dup
       4: getstatic     #14                 // Field java/lang/System.in:Ljava/io/InputStream;
       7: invokespecial #18                 // Method java/util/Scanner."<init>":(Ljava/io/InputStream;)V
      10: astore_0
      11: ldc           #20                 // String Please enter the dimensions of your plateau starting with the size of X?
      13: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      16: swap
      17: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      20: aload_0
      21: invokevirtual #34                 // Method java/util/Scanner.nextInt:()I
      24: istore_1
      25: ldc           #36                 // String And the size of Y?
      27: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      30: swap
      31: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      34: aload_0
      35: invokevirtual #34                 // Method java/util/Scanner.nextInt:()I
      38: istore_2
      39: new           #38                 // class com/thedevadventure/roverkata/Plateau
      42: dup
      43: iload_1
      44: iload_2
      45: invokespecial #41                 // Method com/thedevadventure/roverkata/Plateau."<init>":(II)V
      48: astore_3
      49: aload_3
      50: invokestatic  #45                 // Method validatePlateau:(Lcom/thedevadventure/roverkata/Plateau;)Z
      53: pop
      54: ldc           #47                 // String Please enter the first rovers coordinates, starting with X hitting enter and then Y...
      56: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      59: swap
      60: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      63: new           #49                 // class com/thedevadventure/roverkata/Location
      66: dup
      67: aload_0
      68: invokevirtual #34                 // Method java/util/Scanner.nextInt:()I
      71: aload_0
      72: invokevirtual #34                 // Method java/util/Scanner.nextInt:()I
      75: invokespecial #50                 // Method com/thedevadventure/roverkata/Location."<init>":(II)V
      78: astore        4
      80: aload_0
      81: invokestatic  #54                 // Method getRoverCommands:(Ljava/util/Scanner;)Lcom/thedevadventure/roverkata/Instructions;
      84: astore        5
      86: ldc           #56                 // String Please enter the second rovers coordinates, starting with X hitting enter and then Y...
      88: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      91: swap
      92: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      95: new           #49                 // class com/thedevadventure/roverkata/Location
      98: dup
      99: aload_0
     100: invokevirtual #34                 // Method java/util/Scanner.nextInt:()I
     103: aload_0
     104: invokevirtual #34                 // Method java/util/Scanner.nextInt:()I
     107: invokespecial #50                 // Method com/thedevadventure/roverkata/Location."<init>":(II)V
     110: astore        6
     112: aload_0
     113: invokestatic  #54                 // Method getRoverCommands:(Ljava/util/Scanner;)Lcom/thedevadventure/roverkata/Instructions;
     116: astore        7
     118: aload_3
     119: aload         4
     121: invokestatic  #60                 // Method validateTheRoverHasLanded:(Lcom/thedevadventure/roverkata/Plateau;Lcom/thedevadventure/roverkata/Location;)Z
     124: pop
     125: aload_3
     126: aload         6
     128: invokestatic  #60                 // Method validateTheRoverHasLanded:(Lcom/thedevadventure/roverkata/Plateau;Lcom/thedevadventure/roverkata/Location;)Z
     131: pop
     132: aload_3
     133: aload         4
     135: aload         5
     137: invokestatic  #64                 // Method explore:(Lcom/thedevadventure/roverkata/Plateau;Lcom/thedevadventure/roverkata/Location;Lcom/thedevadventure/roverkata/Instructions;)Ljava/util/List;
     140: pop
     141: aload_3
     142: aload         6
     144: aload         7
     146: invokestatic  #64                 // Method explore:(Lcom/thedevadventure/roverkata/Plateau;Lcom/thedevadventure/roverkata/Location;Lcom/thedevadventure/roverkata/Instructions;)Ljava/util/List;
     149: pop
     150: aload_3
     151: aload         4
     153: aload         5
     155: invokestatic  #64                 // Method explore:(Lcom/thedevadventure/roverkata/Plateau;Lcom/thedevadventure/roverkata/Location;Lcom/thedevadventure/roverkata/Instructions;)Ljava/util/List;
     158: aload_3
     159: aload         6
     161: aload         7
     163: invokestatic  #64                 // Method explore:(Lcom/thedevadventure/roverkata/Plateau;Lcom/thedevadventure/roverkata/Location;Lcom/thedevadventure/roverkata/Instructions;)Ljava/util/List;
     166: invokestatic  #68                 // Method checkIntersections:(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
     169: pop
     170: return

  public static final boolean validatePlateau(com.thedevadventure.roverkata.Plateau);
    Code:
       0: aload_0
       1: ldc           #84                 // String plateauDimensions
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: invokevirtual #93                 // Method com/thedevadventure/roverkata/Plateau.getX:()I
      10: ifle          31
      13: aload_0
      14: invokevirtual #96                 // Method com/thedevadventure/roverkata/Plateau.getY:()I
      17: ifle          31
      20: ldc           #98                 // String Thank you for passing a valid plateau...
      22: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      25: swap
      26: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      29: iconst_1
      30: ireturn
      31: new           #100                // class java/lang/Exception
      34: dup
      35: ldc           #102                // String Invalid plateau passed both your inputs should be larger than 0!
      37: invokespecial #105                // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
      40: athrow

  public static final boolean validateTheRoverHasLanded(com.thedevadventure.roverkata.Plateau, com.thedevadventure.roverkata.Location);
    Code:
       0: aload_0
       1: ldc           #107                // String plateau
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #109                // String location
       9: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_1
      13: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      16: aload_0
      17: invokevirtual #93                 // Method com/thedevadventure/roverkata/Plateau.getX:()I
      20: if_icmpgt     48
      23: aload_1
      24: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      27: iflt          48
      30: aload_1
      31: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      34: aload_0
      35: invokevirtual #96                 // Method com/thedevadventure/roverkata/Plateau.getY:()I
      38: if_icmpgt     48
      41: aload_1
      42: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      45: ifge          58
      48: new           #100                // class java/lang/Exception
      51: dup
      52: ldc           #113                // String Mission failed... The rover missed the target!
      54: invokespecial #105                // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
      57: athrow
      58: ldc           #115                // String Rover has been located on the plateau, good job!
      60: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      63: swap
      64: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      67: iconst_1
      68: ireturn

  public static final com.thedevadventure.roverkata.Instructions validateRoverCommands(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #119                // String commands
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: getstatic     #125                // Field java/util/Locale.ROOT:Ljava/util/Locale;
      10: invokevirtual #131                // Method java/lang/String.toUpperCase:(Ljava/util/Locale;)Ljava/lang/String;
      13: dup
      14: ldc           #133                // String toUpperCase(...)
      16: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      19: checkcast     #138                // class java/lang/CharSequence
      22: astore_1
      23: iconst_0
      24: istore_2
      25: iconst_0
      26: istore_3
      27: iload_3
      28: aload_1
      29: invokeinterface #141,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      34: if_icmpge     105
      37: aload_1
      38: iload_3
      39: invokeinterface #145,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      44: istore        4
      46: iload         4
      48: istore        5
      50: iconst_0
      51: istore        6
      53: iload         5
      55: invokestatic  #151                // Method java/lang/Character.isLetter:(C)Z
      58: iload         5
      60: bipush        78
      62: if_icmpeq     86
      65: iload         5
      67: bipush        83
      69: if_icmpeq     86
      72: iload         5
      74: bipush        87
      76: if_icmpeq     86
      79: iload         5
      81: bipush        69
      83: if_icmpne     90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: iand
      92: ifne          99
      95: iconst_0
      96: goto          106
      99: iinc          3, 1
     102: goto          27
     105: iconst_1
     106: ifne          119
     109: new           #100                // class java/lang/Exception
     112: dup
     113: ldc           #153                // String Computer says No!
     115: invokespecial #105                // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
     118: athrow
     119: new           #155                // class com/thedevadventure/roverkata/Instructions
     122: dup
     123: aload_0
     124: getstatic     #125                // Field java/util/Locale.ROOT:Ljava/util/Locale;
     127: invokevirtual #131                // Method java/lang/String.toUpperCase:(Ljava/util/Locale;)Ljava/lang/String;
     130: dup
     131: ldc           #133                // String toUpperCase(...)
     133: invokestatic  #136                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     136: invokespecial #156                // Method com/thedevadventure/roverkata/Instructions."<init>":(Ljava/lang/String;)V
     139: astore_1
     140: new           #158                // class java/lang/StringBuilder
     143: dup
     144: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
     147: ldc           #162                // String Commands received:
     149: invokevirtual #166                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     152: aload_1
     153: invokevirtual #169                // Method com/thedevadventure/roverkata/Instructions.getRoverCommands:()Ljava/lang/String;
     156: invokevirtual #166                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     159: ldc           #171                // String ...
     161: invokevirtual #166                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     164: invokevirtual #174                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     167: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
     170: swap
     171: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     174: aload_1
     175: areturn

  public static final com.thedevadventure.roverkata.Instructions getRoverCommands(java.util.Scanner);
    Code:
       0: aload_0
       1: ldc           #184                // String scanner
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: ldc           #186                // String Please enter the command sequence for the first rover... valid inputs are limited to N, E, W, and S!
       8: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      11: swap
      12: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      15: aload_0
      16: invokevirtual #189                // Method java/util/Scanner.next:()Ljava/lang/String;
      19: astore_1
      20: aload_1
      21: invokestatic  #192                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      24: aload_1
      25: invokestatic  #194                // Method validateRoverCommands:(Ljava/lang/String;)Lcom/thedevadventure/roverkata/Instructions;
      28: areturn

  public static final java.util.List<com.thedevadventure.roverkata.Location> explore(com.thedevadventure.roverkata.Plateau, com.thedevadventure.roverkata.Location, com.thedevadventure.roverkata.Instructions);
    Code:
       0: aload_0
       1: ldc           #107                // String plateau
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #197                // String startingLocation
       9: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_2
      13: ldc           #199                // String roverInstructions
      15: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload_2
      19: invokevirtual #169                // Method com/thedevadventure/roverkata/Instructions.getRoverCommands:()Ljava/lang/String;
      22: checkcast     #138                // class java/lang/CharSequence
      25: astore        4
      27: iconst_0
      28: istore        5
      30: aload         4
      32: astore        6
      34: new           #201                // class java/util/ArrayList
      37: dup
      38: aload         4
      40: invokeinterface #141,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      45: invokespecial #204                // Method java/util/ArrayList."<init>":(I)V
      48: checkcast     #206                // class java/util/Collection
      51: astore        7
      53: iconst_0
      54: istore        8
      56: iconst_0
      57: istore        9
      59: iload         9
      61: aload         6
      63: invokeinterface #141,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      68: if_icmpge     113
      71: aload         6
      73: iload         9
      75: invokeinterface #145,  2          // InterfaceMethod java/lang/CharSequence.charAt:(I)C
      80: istore        10
      82: aload         7
      84: iload         10
      86: istore        11
      88: astore        13
      90: iconst_0
      91: istore        12
      93: iload         11
      95: invokestatic  #210                // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
      98: aload         13
     100: swap
     101: invokeinterface #214,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     106: pop
     107: iinc          9, 1
     110: goto          59
     113: aload         7
     115: checkcast     #216                // class java/util/List
     118: nop
     119: astore_3
     120: new           #201                // class java/util/ArrayList
     123: dup
     124: invokespecial #217                // Method java/util/ArrayList."<init>":()V
     127: checkcast     #216                // class java/util/List
     130: astore        4
     132: aload_1
     133: astore        5
     135: aload         4
     137: aload_1
     138: invokeinterface #218,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     143: pop
     144: aload_3
     145: invokeinterface #222,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     150: astore        6
     152: aload         6
     154: invokeinterface #228,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     159: ifeq          210
     162: aload         6
     164: invokeinterface #231,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     169: checkcast     #147                // class java/lang/Character
     172: invokevirtual #235                // Method java/lang/Character.charValue:()C
     175: istore        7
     177: iload         7
     179: aload         5
     181: invokestatic  #239                // Method move:(CLcom/thedevadventure/roverkata/Location;)Lcom/thedevadventure/roverkata/Location;
     184: astore        8
     186: aload         8
     188: aload_0
     189: invokestatic  #243                // Method isValidRoverPosition:(Lcom/thedevadventure/roverkata/Location;Lcom/thedevadventure/roverkata/Plateau;)Z
     192: pop
     193: aload         4
     195: aload         8
     197: invokeinterface #218,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     202: pop
     203: aload         8
     205: astore        5
     207: goto          152
     210: aload         4
     212: areturn

  public static final com.thedevadventure.roverkata.Location move(char, com.thedevadventure.roverkata.Location);
    Code:
       0: aload_1
       1: ldc           #109                // String location
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_0
       7: invokestatic  #260                // Method java/lang/Character.toUpperCase:(C)C
      10: lookupswitch  { // 4
                    69: 59
                    78: 52
                    83: 66
                    87: 73
               default: 80
          }
      52: aload_1
      53: invokestatic  #264                // Method increaseY:(Lcom/thedevadventure/roverkata/Location;)Lcom/thedevadventure/roverkata/Location;
      56: goto          81
      59: aload_1
      60: invokestatic  #267                // Method increaseX:(Lcom/thedevadventure/roverkata/Location;)Lcom/thedevadventure/roverkata/Location;
      63: goto          81
      66: aload_1
      67: invokestatic  #270                // Method decreaseY:(Lcom/thedevadventure/roverkata/Location;)Lcom/thedevadventure/roverkata/Location;
      70: goto          81
      73: aload_1
      74: invokestatic  #273                // Method decreaseX:(Lcom/thedevadventure/roverkata/Location;)Lcom/thedevadventure/roverkata/Location;
      77: goto          81
      80: aload_1
      81: areturn

  public static final boolean isValidRoverPosition(com.thedevadventure.roverkata.Location, com.thedevadventure.roverkata.Plateau);
    Code:
       0: aload_0
       1: ldc_w         #275                // String currentLocation
       4: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc           #107                // String plateau
      10: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      13: aload_0
      14: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      17: aload_1
      18: invokevirtual #93                 // Method com/thedevadventure/roverkata/Plateau.getX:()I
      21: if_icmpgt     49
      24: aload_0
      25: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      28: iflt          49
      31: aload_0
      32: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      35: aload_1
      36: invokevirtual #96                 // Method com/thedevadventure/roverkata/Plateau.getY:()I
      39: if_icmpgt     49
      42: aload_0
      43: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      46: ifge          82
      49: new           #100                // class java/lang/Exception
      52: dup
      53: new           #158                // class java/lang/StringBuilder
      56: dup
      57: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
      60: ldc_w         #277                // String Mission failed... The rover was lost at
      63: invokevirtual #166                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      66: aload_0
      67: invokevirtual #280                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      70: ldc           #171                // String ...
      72: invokevirtual #166                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      75: invokevirtual #174                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      78: invokespecial #105                // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
      81: athrow
      82: iconst_1
      83: ireturn

  public static final com.thedevadventure.roverkata.Location increaseX(com.thedevadventure.roverkata.Location);
    Code:
       0: aload_0
       1: ldc           #109                // String location
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #49                 // class com/thedevadventure/roverkata/Location
       9: dup
      10: aload_0
      11: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      14: iconst_1
      15: iadd
      16: aload_0
      17: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      20: invokespecial #50                 // Method com/thedevadventure/roverkata/Location."<init>":(II)V
      23: areturn

  public static final com.thedevadventure.roverkata.Location increaseY(com.thedevadventure.roverkata.Location);
    Code:
       0: aload_0
       1: ldc           #109                // String location
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #49                 // class com/thedevadventure/roverkata/Location
       9: dup
      10: aload_0
      11: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      14: aload_0
      15: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      18: iconst_1
      19: iadd
      20: invokespecial #50                 // Method com/thedevadventure/roverkata/Location."<init>":(II)V
      23: areturn

  public static final com.thedevadventure.roverkata.Location decreaseX(com.thedevadventure.roverkata.Location);
    Code:
       0: aload_0
       1: ldc           #109                // String location
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #49                 // class com/thedevadventure/roverkata/Location
       9: dup
      10: aload_0
      11: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      14: iconst_1
      15: isub
      16: aload_0
      17: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      20: invokespecial #50                 // Method com/thedevadventure/roverkata/Location."<init>":(II)V
      23: areturn

  public static final com.thedevadventure.roverkata.Location decreaseY(com.thedevadventure.roverkata.Location);
    Code:
       0: aload_0
       1: ldc           #109                // String location
       3: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: new           #49                 // class com/thedevadventure/roverkata/Location
       9: dup
      10: aload_0
      11: invokevirtual #110                // Method com/thedevadventure/roverkata/Location.getX:()I
      14: aload_0
      15: invokevirtual #111                // Method com/thedevadventure/roverkata/Location.getY:()I
      18: iconst_1
      19: isub
      20: invokespecial #50                 // Method com/thedevadventure/roverkata/Location."<init>":(II)V
      23: areturn

  public static final java.util.List<com.thedevadventure.roverkata.Location> checkIntersections(java.util.List<com.thedevadventure.roverkata.Location>, java.util.List<com.thedevadventure.roverkata.Location>);
    Code:
       0: aload_0
       1: ldc_w         #283                // String pathPoints1
       4: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       7: aload_1
       8: ldc_w         #285                // String pathPoints2
      11: invokestatic  #90                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      14: aload_0
      15: checkcast     #287                // class java/lang/Iterable
      18: aload_1
      19: checkcast     #287                // class java/lang/Iterable
      22: invokestatic  #293                // Method kotlin/collections/CollectionsKt.toSet:(Ljava/lang/Iterable;)Ljava/util/Set;
      25: checkcast     #287                // class java/lang/Iterable
      28: invokestatic  #297                // Method kotlin/collections/CollectionsKt.intersect:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/util/Set;
      31: checkcast     #206                // class java/util/Collection
      34: invokestatic  #301                // Method kotlin/collections/CollectionsKt.toMutableList:(Ljava/util/Collection;)Ljava/util/List;
      37: astore_2
      38: aload_2
      39: invokeinterface #304,  1          // InterfaceMethod java/util/List.isEmpty:()Z
      44: ifeq          58
      47: new           #100                // class java/lang/Exception
      50: dup
      51: ldc_w         #306                // String No Intersections found...
      54: invokespecial #105                // Method java/lang/Exception."<init>":(Ljava/lang/String;)V
      57: athrow
      58: new           #158                // class java/lang/StringBuilder
      61: dup
      62: invokespecial #160                // Method java/lang/StringBuilder."<init>":()V
      65: ldc_w         #308                // String Intersection point are:
      68: invokevirtual #166                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      71: aload_2
      72: invokevirtual #280                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      75: invokevirtual #174                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      78: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      81: swap
      82: invokevirtual #30                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      85: aload_2
      86: areturn

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


package com.dlight.algoguide.dsa.dynamic_programming.Longest_Common_Subsequence

import java.util.*

object lcs {
    @JvmStatic
    fun main(args: Array<String>) {
        val s1 = "abcde"
        val s2 = "ace"
        println("The Length of Longest Common Subsequence is " + longestCommonSubsequence(s1, s2))
    }

    private fun longestCommonSubsequence(s1: String, s2: String): Int {
        val n = s1.length
        val m = s2.length
        val dp = Array(n + 1) {
            IntArray(
                m + 1
            )
        }
        for (rows in dp) {
            Arrays.fill(rows, -1)
        }
        for (i in 0..n) {
            dp[i][0] = 0
        }
        for (i in 0..m) {
            dp[0][i] = 0
        }
        for (ind1 in 0..n) {
            for (ind2 in 0..m) {
                if (s1[ind1] == s2[ind2]) {
                    dp[ind1][ind2] = 1 + dp[ind1 - 1][ind2 - 1]
                } else {
                    dp[ind1][ind2] = Math.max(dp[ind1 - 1][ind2], dp[ind1][ind2 - 1])
                }
            }
        }
        return dp[n][m]
    }
}

Compiled from "lcs.kt"
public final class com.dlight.algoguide.dsa.dynamic_programming.Longest_Common_Subsequence.lcs {
  public static final com.dlight.algoguide.dsa.dynamic_programming.Longest_Common_Subsequence.lcs INSTANCE;

  private com.dlight.algoguide.dsa.dynamic_programming.Longest_Common_Subsequence.lcs();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public static final void main(java.lang.String[]);
    Code:
       0: aload_0
       1: ldc           #16                 // String args
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: ldc           #24                 // String abcde
       8: astore_1
       9: ldc           #26                 // String ace
      11: astore_2
      12: new           #28                 // class java/lang/StringBuilder
      15: dup
      16: invokespecial #29                 // Method java/lang/StringBuilder."<init>":()V
      19: ldc           #31                 // String The Length of Longest Common Subsequence is
      21: invokevirtual #35                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: getstatic     #38                 // Field INSTANCE:Lcom/dlight/algoguide/dsa/dynamic_programming/Longest_Common_Subsequence/lcs;
      27: aload_1
      28: aload_2
      29: invokespecial #42                 // Method longestCommonSubsequence:(Ljava/lang/String;Ljava/lang/String;)I
      32: invokevirtual #45                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      35: invokevirtual #49                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      38: getstatic     #55                 // Field java/lang/System.out:Ljava/io/PrintStream;
      41: swap
      42: invokevirtual #61                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      45: return

  private final int longestCommonSubsequence(java.lang.String, java.lang.String);
    Code:
       0: aload_1
       1: invokevirtual #71                 // Method java/lang/String.length:()I
       4: istore_3
       5: aload_2
       6: invokevirtual #71                 // Method java/lang/String.length:()I
       9: istore        4
      11: iconst_0
      12: istore        6
      14: iload_3
      15: iconst_1
      16: iadd
      17: istore        7
      19: iload         7
      21: anewarray     #73                 // class "[I"
      24: astore        8
      26: iload         6
      28: iload         7
      30: if_icmpge     54
      33: iload         6
      35: istore        9
      37: aload         8
      39: iload         9
      41: iload         4
      43: iconst_1
      44: iadd
      45: newarray       int
      47: aastore
      48: iinc          6, 1
      51: goto          26
      54: aload         8
      56: astore        5
      58: iconst_0
      59: istore        6
      61: aload         5
      63: checkcast     #75                 // class "[Ljava/lang/Object;"
      66: arraylength
      67: istore        7
      69: iload         6
      71: iload         7
      73: if_icmpge     95
      76: aload         5
      78: iload         6
      80: aaload
      81: astore        8
      83: aload         8
      85: iconst_m1
      86: invokestatic  #81                 // Method java/util/Arrays.fill:([II)V
      89: iinc          6, 1
      92: goto          69
      95: iconst_0
      96: istore        6
      98: iload         6
     100: iload_3
     101: if_icmpgt     124
     104: aload         5
     106: iload         6
     108: aaload
     109: iconst_0
     110: iconst_0
     111: iastore
     112: iload         6
     114: iload_3
     115: if_icmpeq     124
     118: iinc          6, 1
     121: goto          104
     124: iconst_0
     125: istore        6
     127: iload         6
     129: iload         4
     131: if_icmpgt     155
     134: aload         5
     136: iconst_0
     137: aaload
     138: iload         6
     140: iconst_0
     141: iastore
     142: iload         6
     144: iload         4
     146: if_icmpeq     155
     149: iinc          6, 1
     152: goto          134
     155: iconst_0
     156: istore        6
     158: iload         6
     160: iload_3
     161: if_icmpgt     270
     164: iconst_0
     165: istore        7
     167: iload         7
     169: iload         4
     171: if_icmpgt     258
     174: aload_1
     175: iload         6
     177: invokevirtual #85                 // Method java/lang/String.charAt:(I)C
     180: aload_2
     181: iload         7
     183: invokevirtual #85                 // Method java/lang/String.charAt:(I)C
     186: if_icmpne     214
     189: aload         5
     191: iload         6
     193: aaload
     194: iload         7
     196: iconst_1
     197: aload         5
     199: iload         6
     201: iconst_1
     202: isub
     203: aaload
     204: iload         7
     206: iconst_1
     207: isub
     208: iaload
     209: iadd
     210: iastore
     211: goto          245
     214: aload         5
     216: iload         6
     218: aaload
     219: iload         7
     221: aload         5
     223: iload         6
     225: iconst_1
     226: isub
     227: aaload
     228: iload         7
     230: iaload
     231: aload         5
     233: iload         6
     235: aaload
     236: iload         7
     238: iconst_1
     239: isub
     240: iaload
     241: invokestatic  #91                 // Method java/lang/Math.max:(II)I
     244: iastore
     245: iload         7
     247: iload         4
     249: if_icmpeq     258
     252: iinc          7, 1
     255: goto          174
     258: iload         6
     260: iload_3
     261: if_icmpeq     270
     264: iinc          6, 1
     267: goto          164
     270: aload         5
     272: iload_3
     273: aaload
     274: iload         4
     276: iaload
     277: ireturn

  static {};
    Code:
       0: new           #2                  // class com/dlight/algoguide/dsa/dynamic_programming/Longest_Common_Subsequence/lcs
       3: dup
       4: invokespecial #103                // Method "<init>":()V
       7: putstatic     #38                 // Field INSTANCE:Lcom/dlight/algoguide/dsa/dynamic_programming/Longest_Common_Subsequence/lcs;
      10: return
}


package com.dlight.algoguide.dsa.sorting.quick_sort

/**
 * Quick sort
 *
 * @constructor Create empty Quick sort
 */
class QuickSort {
    suspend fun quickSort(
        arr: IntArray, left: Int, right: Int) {
            /*First finding the partioning index using thepartion function */
        val index = partition (arr, left, right)
        if (left < index - 1)
        /*checking for better position left or right then performing thr sort*/
            quickSort(arr, left, index - 1)
        if (index < right )
            quickSort(arr, index, right)
    }
     /* This function takes last element as pivot, places
       the pivot element at its correct position in sorted
       array, and places all smaller (smaller than pivot)
       to left of pivot and all greater elements to right
       of pivot */
    private fun partition(arr: IntArray, left: Int, right: Int): Int {
        var left = left
        var right = right
        /* Pivot point */
        val pivot = arr[(left + right) / 2]
        while (left <= right) {
            while (arr[left] < pivot) left++
            while (arr[right] > pivot) right--
            if (left <= right) {
                swap(arr, left, right)
                left++
                right--
            }
        }
        return left
    }
    /*Swap function that helps in swaping the numbers */
    private fun swap(arr: IntArray, left: Int, right: Int) {
        val temp = arr [left]
        arr[left] = arr[right]
        arr[right] = temp
    }
}

Compiled from "QuickSort.kt"
final class com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort$quickSort$1 extends kotlin.coroutines.jvm.internal.ContinuationImpl {
  java.lang.Object L$0;

  int I$0;

  int I$1;

  java.lang.Object result;

  final com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort this$0;

  int label;

  com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort$quickSort$1(com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort, kotlin.coroutines.Continuation<? super com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort$quickSort$1>);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #33                 // Field this$0:Lcom/dlight/algoguide/dsa/sorting/quick_sort/QuickSort;
       5: aload_0
       6: aload_2
       7: invokespecial #36                 // Method kotlin/coroutines/jvm/internal/ContinuationImpl."<init>":(Lkotlin/coroutines/Continuation;)V
      10: return

  public final java.lang.Object invokeSuspend(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #47                 // Field result:Ljava/lang/Object;
       5: aload_0
       6: aload_0
       7: getfield      #50                 // Field label:I
      10: ldc           #51                 // int -2147483648
      12: ior
      13: putfield      #50                 // Field label:I
      16: aload_0
      17: getfield      #33                 // Field this$0:Lcom/dlight/algoguide/dsa/sorting/quick_sort/QuickSort;
      20: aconst_null
      21: iconst_0
      22: iconst_0
      23: aload_0
      24: checkcast     #53                 // class kotlin/coroutines/Continuation
      27: invokevirtual #58                 // Method com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort.quickSort:([IIILkotlin/coroutines/Continuation;)Ljava/lang/Object;
      30: areturn
}

Compiled from "QuickSort.kt"
public final class com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort {
  public com.dlight.algoguide.dsa.sorting.quick_sort.QuickSort();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final java.lang.Object quickSort(int[], int, int, kotlin.coroutines.Continuation<? super kotlin.Unit>);
    Code:
       0: aload         4
       2: instanceof    #17                 // class com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1
       5: ifeq          41
       8: aload         4
      10: checkcast     #17                 // class com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1
      13: astore        7
      15: aload         7
      17: getfield      #21                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.label:I
      20: ldc           #22                 // int -2147483648
      22: iand
      23: ifeq          41
      26: aload         7
      28: dup
      29: getfield      #21                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.label:I
      32: ldc           #22                 // int -2147483648
      34: isub
      35: putfield      #21                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.label:I
      38: goto          53
      41: new           #17                 // class com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1
      44: dup
      45: aload_0
      46: aload         4
      48: invokespecial #25                 // Method com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1."<init>":(Lcom/dlight/algoguide/dsa/sorting/quick_sort/QuickSort;Lkotlin/coroutines/Continuation;)V
      51: astore        7
      53: aload         7
      55: getfield      #29                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.result:Ljava/lang/Object;
      58: astore        6
      60: invokestatic  #35                 // Method kotlin/coroutines/intrinsics/IntrinsicsKt.getCOROUTINE_SUSPENDED:()Ljava/lang/Object;
      63: astore        8
      65: aload         7
      67: getfield      #21                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.label:I
      70: tableswitch   { // 0 to 2
                     0: 96
                     1: 164
                     2: 231
               default: 247
          }
      96: aload         6
      98: invokestatic  #41                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     101: aload_0
     102: aload_1
     103: iload_2
     104: iload_3
     105: invokespecial #45                 // Method partition:([III)I
     108: istore        5
     110: iload_2
     111: iload         5
     113: iconst_1
     114: isub
     115: if_icmpge     194
     118: aload_0
     119: aload_1
     120: iload_2
     121: iload         5
     123: iconst_1
     124: isub
     125: aload         7
     127: aload         7
     129: aload_1
     130: putfield      #48                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.L$0:Ljava/lang/Object;
     133: aload         7
     135: iload_3
     136: putfield      #51                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.I$0:I
     139: aload         7
     141: iload         5
     143: putfield      #54                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.I$1:I
     146: aload         7
     148: iconst_1
     149: putfield      #21                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.label:I
     152: invokevirtual #56                 // Method quickSort:([IIILkotlin/coroutines/Continuation;)Ljava/lang/Object;
     155: dup
     156: aload         8
     158: if_acmpne     193
     161: aload         8
     163: areturn
     164: aload         7
     166: getfield      #54                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.I$1:I
     169: istore        5
     171: aload         7
     173: getfield      #51                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.I$0:I
     176: istore_3
     177: aload         7
     179: getfield      #48                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.L$0:Ljava/lang/Object;
     182: checkcast     #58                 // class "[I"
     185: astore_1
     186: aload         6
     188: invokestatic  #41                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     191: aload         6
     193: pop
     194: iload         5
     196: iload_3
     197: if_icmpge     243
     200: aload_0
     201: aload_1
     202: iload         5
     204: iload_3
     205: aload         7
     207: aload         7
     209: aconst_null
     210: putfield      #48                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.L$0:Ljava/lang/Object;
     213: aload         7
     215: iconst_2
     216: putfield      #21                 // Field com/dlight/algoguide/dsa/sorting/quick_sort/QuickSort$quickSort$1.label:I
     219: invokevirtual #56                 // Method quickSort:([IIILkotlin/coroutines/Continuation;)Ljava/lang/Object;
     222: dup
     223: aload         8
     225: if_acmpne     238
     228: aload         8
     230: areturn
     231: aload         6
     233: invokestatic  #41                 // Method kotlin/ResultKt.throwOnFailure:(Ljava/lang/Object;)V
     236: aload         6
     238: pop
     239: getstatic     #64                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     242: areturn
     243: getstatic     #64                 // Field kotlin/Unit.INSTANCE:Lkotlin/Unit;
     246: areturn
     247: new           #66                 // class java/lang/IllegalStateException
     250: dup
     251: ldc           #68                 // String call to \'resume\' before \'invoke\' with coroutine
     253: invokespecial #71                 // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     256: athrow

  private final int partition(int[], int, int);
    Code:
       0: iload_2
       1: istore        4
       3: iload_3
       4: istore        5
       6: aload_1
       7: iload         4
       9: iload         5
      11: iadd
      12: iconst_2
      13: idiv
      14: iaload
      15: istore        6
      17: iload         4
      19: iload         5
      21: if_icmpgt     79
      24: aload_1
      25: iload         4
      27: iaload
      28: iload         6
      30: if_icmpge     39
      33: iinc          4, 1
      36: goto          24
      39: aload_1
      40: iload         5
      42: iaload
      43: iload         6
      45: if_icmple     54
      48: iinc          5, -1
      51: goto          39
      54: iload         4
      56: iload         5
      58: if_icmpgt     17
      61: aload_0
      62: aload_1
      63: iload         4
      65: iload         5
      67: invokespecial #85                 // Method swap:([III)V
      70: iinc          4, 1
      73: iinc          5, -1
      76: goto          17
      79: iload         4
      81: ireturn

  private final void swap(int[], int, int);
    Code:
       0: aload_1
       1: iload_2
       2: iaload
       3: istore        4
       5: aload_1
       6: iload_2
       7: aload_1
       8: iload_3
       9: iaload
      10: iastore
      11: aload_1
      12: iload_3
      13: iload         4
      15: iastore
      16: return
}


package algorithms.sorting.merge_sort

/**
 * Implementation of the merge sort algorithm for sorting a list of integers in ascending order.
 */
class MergeSort {

    /**
     * Recursively sorts the given list by dividing it into halves and merging them.
     *
     * @param array the list to sort
     * @return the sorted list
     */
    fun mergeSort(array: List<Int>): List<Int> {
        // Base case: if array has only one number, it is already sorted
        if (array.size == 1) {
            return array
        }
        // Divide the array into two halves and recursively sort each half
        val left = array.subList(0, array.size / 2)
        val right = array.subList(array.size / 2, array.size)
        return merge(mergeSort(left), mergeSort(right))
    }

    /**
     * Merges two sorted lists into a single sorted list.
     *
     * @param left the first sorted list
     * @param right the second sorted list
     * @return the merged sorted list
     */
    private fun merge(left: List<Int>, right: List<Int>): List<Int> {
        val result = ArrayList<Int>()
        var leftIndex = 0
        var rightIndex = 0
        // Iterate through both lists, comparing the numbers and adding the smaller one to the result list
        while (leftIndex < left.size && rightIndex < right.size) {
            if (left[leftIndex] < right[rightIndex]) {
                result.add(left[leftIndex])
                leftIndex++
            } else {
                result.add(right[rightIndex])
                rightIndex++
            }
        }
        // Add any remaining numbers from the left and right lists
        val leftRemaining = left.subList(leftIndex, left.size)
        val rightRemaining = right.subList(rightIndex, right.size)
        result.addAll(leftRemaining)
        result.addAll(rightRemaining)
        return result
    }
}

fun main() {

    val mergeSort = MergeSort()
    val numbers = ArrayList(listOf(99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0))
    println(mergeSort.mergeSort(numbers))
}

Compiled from "MergeSort.kt"
public final class algorithms.sorting.merge_sort.MergeSortKt {
  public static final void main();
    Code:
       0: new           #8                  // class algorithms/sorting/merge_sort/MergeSort
       3: dup
       4: invokespecial #11                 // Method algorithms/sorting/merge_sort/MergeSort."<init>":()V
       7: astore_0
       8: new           #13                 // class java/util/ArrayList
      11: dup
      12: bipush        11
      14: anewarray     #15                 // class java/lang/Integer
      17: astore_2
      18: aload_2
      19: iconst_0
      20: bipush        99
      22: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      25: aastore
      26: aload_2
      27: iconst_1
      28: bipush        44
      30: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      33: aastore
      34: aload_2
      35: iconst_2
      36: bipush        6
      38: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      41: aastore
      42: aload_2
      43: iconst_3
      44: iconst_2
      45: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      48: aastore
      49: aload_2
      50: iconst_4
      51: iconst_1
      52: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      55: aastore
      56: aload_2
      57: iconst_5
      58: iconst_5
      59: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      62: aastore
      63: aload_2
      64: bipush        6
      66: bipush        63
      68: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      71: aastore
      72: aload_2
      73: bipush        7
      75: bipush        87
      77: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      80: aastore
      81: aload_2
      82: bipush        8
      84: sipush        283
      87: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      90: aastore
      91: aload_2
      92: bipush        9
      94: iconst_4
      95: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      98: aastore
      99: aload_2
     100: bipush        10
     102: iconst_0
     103: invokestatic  #19                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     106: aastore
     107: aload_2
     108: invokestatic  #25                 // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     111: checkcast     #27                 // class java/util/Collection
     114: invokespecial #30                 // Method java/util/ArrayList."<init>":(Ljava/util/Collection;)V
     117: astore_1
     118: aload_0
     119: aload_1
     120: checkcast     #32                 // class java/util/List
     123: invokevirtual #36                 // Method algorithms/sorting/merge_sort/MergeSort.mergeSort:(Ljava/util/List;)Ljava/util/List;
     126: getstatic     #42                 // Field java/lang/System.out:Ljava/io/PrintStream;
     129: swap
     130: invokevirtual #48                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     133: return

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

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

  public final java.util.List<java.lang.Integer> mergeSort(java.util.List<java.lang.Integer>);
    Code:
       0: aload_1
       1: ldc           #16                 // String array
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
      12: iconst_1
      13: if_icmpne     18
      16: aload_1
      17: areturn
      18: aload_1
      19: iconst_0
      20: aload_1
      21: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
      26: iconst_2
      27: idiv
      28: invokeinterface #32,  3           // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      33: astore_2
      34: aload_1
      35: aload_1
      36: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
      41: iconst_2
      42: idiv
      43: aload_1
      44: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
      49: invokeinterface #32,  3           // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
      54: astore_3
      55: aload_0
      56: aload_0
      57: aload_2
      58: invokevirtual #34                 // Method mergeSort:(Ljava/util/List;)Ljava/util/List;
      61: aload_0
      62: aload_3
      63: invokevirtual #34                 // Method mergeSort:(Ljava/util/List;)Ljava/util/List;
      66: invokespecial #38                 // Method merge:(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
      69: areturn

  private final java.util.List<java.lang.Integer> merge(java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
    Code:
       0: new           #44                 // class java/util/ArrayList
       3: dup
       4: invokespecial #45                 // Method java/util/ArrayList."<init>":()V
       7: astore_3
       8: iconst_0
       9: istore        4
      11: iconst_0
      12: istore        5
      14: iload         4
      16: aload_1
      17: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
      22: if_icmpge     105
      25: iload         5
      27: aload_2
      28: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
      33: if_icmpge     105
      36: aload_1
      37: iload         4
      39: invokeinterface #49,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      44: checkcast     #51                 // class java/lang/Number
      47: invokevirtual #54                 // Method java/lang/Number.intValue:()I
      50: aload_2
      51: iload         5
      53: invokeinterface #49,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      58: checkcast     #51                 // class java/lang/Number
      61: invokevirtual #54                 // Method java/lang/Number.intValue:()I
      64: if_icmpge     86
      67: aload_3
      68: aload_1
      69: iload         4
      71: invokeinterface #49,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      76: invokevirtual #58                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      79: pop
      80: iinc          4, 1
      83: goto          14
      86: aload_3
      87: aload_2
      88: iload         5
      90: invokeinterface #49,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      95: invokevirtual #58                 // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      98: pop
      99: iinc          5, 1
     102: goto          14
     105: aload_1
     106: iload         4
     108: aload_1
     109: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
     114: invokeinterface #32,  3           // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     119: astore        6
     121: aload_2
     122: iload         5
     124: aload_2
     125: invokeinterface #28,  1           // InterfaceMethod java/util/List.size:()I
     130: invokeinterface #32,  3           // InterfaceMethod java/util/List.subList:(II)Ljava/util/List;
     135: astore        7
     137: aload_3
     138: aload         6
     140: checkcast     #60                 // class java/util/Collection
     143: invokevirtual #64                 // Method java/util/ArrayList.addAll:(Ljava/util/Collection;)Z
     146: pop
     147: aload_3
     148: aload         7
     150: checkcast     #60                 // class java/util/Collection
     153: invokevirtual #64                 // Method java/util/ArrayList.addAll:(Ljava/util/Collection;)Z
     156: pop
     157: aload_3
     158: checkcast     #24                 // class java/util/List
     161: areturn
}


package algorithms.sorting.quick_sort

/**
 * Implementation of the quick sort algorithm for sorting a list of integers in ascending order.
 */
class QuickSort {

    /**
     * Sorts an array of integers in ascending order using QuickSort algorithm.
     *
     * @param arr the array to be sorted.
     * @param low the starting index of the array.
     * @param high the ending index of the array.
     */
    fun quickSort(arr: IntArray, low: Int, high: Int) {
        if (low < high) {
            // Find partition index
            val pIndex = partition(arr, low, high)
            // Recursively sort elements before and after partition index
            quickSort(arr, low, pIndex - 1)
            quickSort(arr, pIndex + 1, high)
        }
    }

    /**
     * Partitions the array into two sub-arrays around the pivot element.
     *
     * @param arr the array to be partitioned.
     * @param low the starting index of the array.
     * @param high the ending index of the array.
     * @return the index of the pivot element after partitioning.
     */
    private fun partition(arr: IntArray, low: Int, high: Int): Int {
        val pivot = arr[high]
        var i = low - 1
        // Iterate through numbers from low to high-1
        for (j in low until high) {
            if (arr[j] <= pivot) {
                i++
                // Swap arr[i] and arr[j]
                val temp = arr[i]
                arr[i] = arr[j]
                arr[j] = temp
            }
        }
        // Place pivot at correct position in array
        val temp = arr[i + 1]
        arr[i + 1] = arr[high]
        arr[high] = temp
        // Return partition index
        return i + 1
    }

    /**
     * Prints the elements of the array.
     *
     * @param arr the array to be printed.
     */
    fun printArray(arr: IntArray) {
        for (value in arr) print("$value ")
        println()
    }
}

fun main() {

    val numbers = intArrayOf(99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0)
    val quickSort = QuickSort()
    quickSort.quickSort(numbers, 0, numbers.size - 1)
    quickSort.printArray(numbers)
}

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

  public final void quickSort(int[], int, int);
    Code:
       0: aload_1
       1: ldc           #15                 // String arr
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iload_2
       7: iload_3
       8: if_icmpge     40
      11: aload_0
      12: aload_1
      13: iload_2
      14: iload_3
      15: invokespecial #25                 // Method partition:([III)I
      18: istore        4
      20: aload_0
      21: aload_1
      22: iload_2
      23: iload         4
      25: iconst_1
      26: isub
      27: invokevirtual #27                 // Method quickSort:([III)V
      30: aload_0
      31: aload_1
      32: iload         4
      34: iconst_1
      35: iadd
      36: iload_3
      37: invokevirtual #27                 // Method quickSort:([III)V
      40: return

  private final int partition(int[], int, int);
    Code:
       0: aload_1
       1: iload_3
       2: iaload
       3: istore        4
       5: iload_2
       6: iconst_1
       7: isub
       8: istore        5
      10: iload_2
      11: istore        6
      13: iload         6
      15: iload_3
      16: if_icmpge     57
      19: aload_1
      20: iload         6
      22: iaload
      23: iload         4
      25: if_icmpgt     51
      28: iinc          5, 1
      31: aload_1
      32: iload         5
      34: iaload
      35: istore        7
      37: aload_1
      38: iload         5
      40: aload_1
      41: iload         6
      43: iaload
      44: iastore
      45: aload_1
      46: iload         6
      48: iload         7
      50: iastore
      51: iinc          6, 1
      54: goto          13
      57: aload_1
      58: iload         5
      60: iconst_1
      61: iadd
      62: iaload
      63: istore        6
      65: aload_1
      66: iload         5
      68: iconst_1
      69: iadd
      70: aload_1
      71: iload_3
      72: iaload
      73: iastore
      74: aload_1
      75: iload_3
      76: iload         6
      78: iastore
      79: iload         5
      81: iconst_1
      82: iadd
      83: ireturn

  public final void printArray(int[]);
    Code:
       0: aload_1
       1: ldc           #15                 // String arr
       3: invokestatic  #21                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_2
       8: aload_1
       9: arraylength
      10: istore_3
      11: iload_2
      12: iload_3
      13: if_icmpge     54
      16: aload_1
      17: iload_2
      18: iaload
      19: istore        4
      21: new           #40                 // class java/lang/StringBuilder
      24: dup
      25: invokespecial #41                 // Method java/lang/StringBuilder."<init>":()V
      28: iload         4
      30: invokevirtual #45                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      33: bipush        32
      35: invokevirtual #48                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      38: invokevirtual #52                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      41: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
      44: swap
      45: invokevirtual #64                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
      48: iinc          2, 1
      51: goto          11
      54: getstatic     #58                 // Field java/lang/System.out:Ljava/io/PrintStream;
      57: invokevirtual #67                 // Method java/io/PrintStream.println:()V
      60: return
}

Compiled from "QuickSort.kt"
public final class algorithms.sorting.quick_sort.QuickSortKt {
  public static final void main();
    Code:
       0: bipush        11
       2: newarray       int
       4: astore_1
       5: aload_1
       6: iconst_0
       7: bipush        99
       9: iastore
      10: aload_1
      11: iconst_1
      12: bipush        44
      14: iastore
      15: aload_1
      16: iconst_2
      17: bipush        6
      19: iastore
      20: aload_1
      21: iconst_3
      22: iconst_2
      23: iastore
      24: aload_1
      25: iconst_4
      26: iconst_1
      27: iastore
      28: aload_1
      29: iconst_5
      30: iconst_5
      31: iastore
      32: aload_1
      33: bipush        6
      35: bipush        63
      37: iastore
      38: aload_1
      39: bipush        7
      41: bipush        87
      43: iastore
      44: aload_1
      45: bipush        8
      47: sipush        283
      50: iastore
      51: aload_1
      52: bipush        9
      54: iconst_4
      55: iastore
      56: aload_1
      57: bipush        10
      59: iconst_0
      60: iastore
      61: aload_1
      62: astore_0
      63: new           #8                  // class algorithms/sorting/quick_sort/QuickSort
      66: dup
      67: invokespecial #11                 // Method algorithms/sorting/quick_sort/QuickSort."<init>":()V
      70: astore_1
      71: aload_1
      72: aload_0
      73: iconst_0
      74: aload_0
      75: arraylength
      76: iconst_1
      77: isub
      78: invokevirtual #15                 // Method algorithms/sorting/quick_sort/QuickSort.quickSort:([III)V
      81: aload_1
      82: aload_0
      83: invokevirtual #19                 // Method algorithms/sorting/quick_sort/QuickSort.printArray:([I)V
      86: return

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