package me.olegthelilfix.leetcoding.old

data class RomanNumber(val letter: String, val value: Int)
val numberOrder : List<RomanNumber> = listOf(
        RomanNumber("M", 1000),
        RomanNumber("CM", 900),
        RomanNumber("D", 500),
        RomanNumber("CD", 400),
        RomanNumber("C", 100),
        RomanNumber("XC", 90),
        RomanNumber("L", 50),
        RomanNumber("XL", 40),
        RomanNumber("X", 10),
        RomanNumber("IX", 9),
        RomanNumber("V", 5),
        RomanNumber("IV", 4),
        RomanNumber("I", 1),
)

fun intToRoman(num: Int): String {
    var result = ""
    var buffer = num
    var letterIndex = 0
    var romanNumber = numberOrder[letterIndex++]

    while (buffer > 0) {
        if((buffer - romanNumber.value) < 0) {
            romanNumber = numberOrder[letterIndex++]
        }
        else {
            buffer -= romanNumber.value
            result += romanNumber.letter
        }
    }

    return result
}

val letters = mapOf(
        "M" to 1000,
        "CM" to 900,
        "D" to 500,
        "CD" to 400,
        "C" to 100,
        "XC" to 90,
        "L" to 50,
        "XL" to 40,
        "X" to 10,
        "IX" to 9,
        "V" to 5,
        "IV" to 4,
        "I" to 1
)

fun romanToInt(s: String): Int {
    var i = 0
    var result = 0

    while (i < s.length) {
        val l1 = letters[s[i].toString()] ?: 0
        var l2 = 0

        if (i < s.length - 1 && letters.containsKey(s[i].toString() + s[i+1].toString())) {
            l2 = letters[s[i].toString() + s[i+1].toString()] ?: 0
            i++
        }

        result += if (l1 > l2) l1 else l2

        i++
    }

    return result
}

fun main() {
    println(romanToInt("IV"))
    for (i in 1 .. 10000) {
        val n = intToRoman(i)
        val n2 = romanToInt(n)

        if (n2 != i) {
            println("$i!=$n2")
        }
    }
}

Compiled from "IntegerToRoman.kt"
public final class me.olegthelilfix.leetcoding.old.IntegerToRomanKt {
  private static final java.util.List<me.olegthelilfix.leetcoding.old.RomanNumber> numberOrder;

  private static final java.util.Map<java.lang.String, java.lang.Integer> letters;

  public static final java.util.List<me.olegthelilfix.leetcoding.old.RomanNumber> getNumberOrder();
    Code:
       0: getstatic     #12                 // Field numberOrder:Ljava/util/List;
       3: areturn

  public static final java.lang.String intToRoman(int);
    Code:
       0: ldc           #16                 // String
       2: astore_1
       3: iload_0
       4: istore_2
       5: iconst_0
       6: istore_3
       7: getstatic     #12                 // Field numberOrder:Ljava/util/List;
      10: iload_3
      11: iinc          3, 1
      14: invokeinterface #22,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      19: checkcast     #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      22: astore        4
      24: iload_2
      25: ifle          92
      28: iload_2
      29: aload         4
      31: invokevirtual #28                 // Method me/olegthelilfix/leetcoding/old/RomanNumber.getValue:()I
      34: isub
      35: ifge          58
      38: getstatic     #12                 // Field numberOrder:Ljava/util/List;
      41: iload_3
      42: iinc          3, 1
      45: invokeinterface #22,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      50: checkcast     #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      53: astore        4
      55: goto          24
      58: iload_2
      59: aload         4
      61: invokevirtual #28                 // Method me/olegthelilfix/leetcoding/old/RomanNumber.getValue:()I
      64: isub
      65: istore_2
      66: new           #30                 // class java/lang/StringBuilder
      69: dup
      70: invokespecial #34                 // Method java/lang/StringBuilder."<init>":()V
      73: aload_1
      74: invokevirtual #38                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      77: aload         4
      79: invokevirtual #42                 // Method me/olegthelilfix/leetcoding/old/RomanNumber.getLetter:()Ljava/lang/String;
      82: invokevirtual #38                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      85: invokevirtual #45                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      88: astore_1
      89: goto          24
      92: aload_1
      93: areturn

  public static final java.util.Map<java.lang.String, java.lang.Integer> getLetters();
    Code:
       0: getstatic     #62                 // Field letters:Ljava/util/Map;
       3: areturn

  public static final int romanToInt(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #66                 // String s
       3: invokestatic  #72                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore_1
       8: iconst_0
       9: istore_2
      10: iload_1
      11: aload_0
      12: invokevirtual #75                 // Method java/lang/String.length:()I
      15: if_icmpge     179
      18: getstatic     #62                 // Field letters:Ljava/util/Map;
      21: aload_0
      22: iload_1
      23: invokevirtual #79                 // Method java/lang/String.charAt:(I)C
      26: invokestatic  #83                 // Method java/lang/String.valueOf:(C)Ljava/lang/String;
      29: invokeinterface #88,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      34: checkcast     #90                 // class java/lang/Integer
      37: dup
      38: ifnull        47
      41: invokevirtual #93                 // Method java/lang/Integer.intValue:()I
      44: goto          49
      47: pop
      48: iconst_0
      49: istore_3
      50: iconst_0
      51: istore        4
      53: iload_1
      54: aload_0
      55: invokevirtual #75                 // Method java/lang/String.length:()I
      58: iconst_1
      59: isub
      60: if_icmpge     158
      63: getstatic     #62                 // Field letters:Ljava/util/Map;
      66: new           #30                 // class java/lang/StringBuilder
      69: dup
      70: invokespecial #34                 // Method java/lang/StringBuilder."<init>":()V
      73: aload_0
      74: iload_1
      75: invokevirtual #79                 // Method java/lang/String.charAt:(I)C
      78: invokevirtual #96                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      81: aload_0
      82: iload_1
      83: iconst_1
      84: iadd
      85: invokevirtual #79                 // Method java/lang/String.charAt:(I)C
      88: invokevirtual #96                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      91: invokevirtual #45                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      94: invokeinterface #100,  2          // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      99: ifeq          158
     102: getstatic     #62                 // Field letters:Ljava/util/Map;
     105: new           #30                 // class java/lang/StringBuilder
     108: dup
     109: invokespecial #34                 // Method java/lang/StringBuilder."<init>":()V
     112: aload_0
     113: iload_1
     114: invokevirtual #79                 // Method java/lang/String.charAt:(I)C
     117: invokevirtual #96                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     120: aload_0
     121: iload_1
     122: iconst_1
     123: iadd
     124: invokevirtual #79                 // Method java/lang/String.charAt:(I)C
     127: invokevirtual #96                 // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     130: invokevirtual #45                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     133: invokeinterface #88,  2           // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     138: checkcast     #90                 // class java/lang/Integer
     141: dup
     142: ifnull        151
     145: invokevirtual #93                 // Method java/lang/Integer.intValue:()I
     148: goto          153
     151: pop
     152: iconst_0
     153: istore        4
     155: iinc          1, 1
     158: iload_2
     159: iload_3
     160: iload         4
     162: if_icmple     169
     165: iload_3
     166: goto          171
     169: iload         4
     171: iadd
     172: istore_2
     173: iinc          1, 1
     176: goto          10
     179: iload_2
     180: ireturn

  public static final void main();
    Code:
       0: ldc           #106                // String IV
       2: invokestatic  #108                // Method romanToInt:(Ljava/lang/String;)I
       5: istore_0
       6: getstatic     #114                // Field java/lang/System.out:Ljava/io/PrintStream;
       9: iload_0
      10: invokevirtual #120                // Method java/io/PrintStream.println:(I)V
      13: iconst_1
      14: istore_0
      15: iload_0
      16: sipush        10001
      19: if_icmpge     73
      22: iload_0
      23: invokestatic  #122                // Method intToRoman:(I)Ljava/lang/String;
      26: astore_1
      27: aload_1
      28: invokestatic  #108                // Method romanToInt:(Ljava/lang/String;)I
      31: istore_2
      32: iload_2
      33: iload_0
      34: if_icmpeq     67
      37: new           #30                 // class java/lang/StringBuilder
      40: dup
      41: invokespecial #34                 // Method java/lang/StringBuilder."<init>":()V
      44: iload_0
      45: invokevirtual #125                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      48: ldc           #127                // String !=
      50: invokevirtual #38                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      53: iload_2
      54: invokevirtual #125                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      57: invokevirtual #45                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      60: getstatic     #114                // Field java/lang/System.out:Ljava/io/PrintStream;
      63: swap
      64: invokevirtual #130                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      67: iinc          0, 1
      70: goto          15
      73: return

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

  static {};
    Code:
       0: bipush        13
       2: anewarray     #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
       5: astore_0
       6: aload_0
       7: iconst_0
       8: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      11: dup
      12: ldc           #140                // String M
      14: sipush        1000
      17: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
      20: aastore
      21: aload_0
      22: iconst_1
      23: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      26: dup
      27: ldc           #145                // String CM
      29: sipush        900
      32: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
      35: aastore
      36: aload_0
      37: iconst_2
      38: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      41: dup
      42: ldc           #147                // String D
      44: sipush        500
      47: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
      50: aastore
      51: aload_0
      52: iconst_3
      53: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      56: dup
      57: ldc           #149                // String CD
      59: sipush        400
      62: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
      65: aastore
      66: aload_0
      67: iconst_4
      68: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      71: dup
      72: ldc           #151                // String C
      74: bipush        100
      76: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
      79: aastore
      80: aload_0
      81: iconst_5
      82: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
      85: dup
      86: ldc           #153                // String XC
      88: bipush        90
      90: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
      93: aastore
      94: aload_0
      95: bipush        6
      97: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     100: dup
     101: ldc           #155                // String L
     103: bipush        50
     105: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     108: aastore
     109: aload_0
     110: bipush        7
     112: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     115: dup
     116: ldc           #157                // String XL
     118: bipush        40
     120: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     123: aastore
     124: aload_0
     125: bipush        8
     127: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     130: dup
     131: ldc           #159                // String X
     133: bipush        10
     135: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     138: aastore
     139: aload_0
     140: bipush        9
     142: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     145: dup
     146: ldc           #161                // String IX
     148: bipush        9
     150: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     153: aastore
     154: aload_0
     155: bipush        10
     157: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     160: dup
     161: ldc           #163                // String V
     163: iconst_5
     164: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     167: aastore
     168: aload_0
     169: bipush        11
     171: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     174: dup
     175: ldc           #106                // String IV
     177: iconst_4
     178: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     181: aastore
     182: aload_0
     183: bipush        12
     185: new           #24                 // class me/olegthelilfix/leetcoding/old/RomanNumber
     188: dup
     189: ldc           #164                // String I
     191: iconst_1
     192: invokespecial #143                // Method me/olegthelilfix/leetcoding/old/RomanNumber."<init>":(Ljava/lang/String;I)V
     195: aastore
     196: aload_0
     197: invokestatic  #170                // Method kotlin/collections/CollectionsKt.listOf:([Ljava/lang/Object;)Ljava/util/List;
     200: putstatic     #12                 // Field numberOrder:Ljava/util/List;
     203: bipush        13
     205: anewarray     #172                // class kotlin/Pair
     208: astore_0
     209: aload_0
     210: iconst_0
     211: ldc           #140                // String M
     213: sipush        1000
     216: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     219: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     222: aastore
     223: aload_0
     224: iconst_1
     225: ldc           #145                // String CM
     227: sipush        900
     230: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     233: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     236: aastore
     237: aload_0
     238: iconst_2
     239: ldc           #147                // String D
     241: sipush        500
     244: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     247: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     250: aastore
     251: aload_0
     252: iconst_3
     253: ldc           #149                // String CD
     255: sipush        400
     258: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     261: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     264: aastore
     265: aload_0
     266: iconst_4
     267: ldc           #151                // String C
     269: bipush        100
     271: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     274: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     277: aastore
     278: aload_0
     279: iconst_5
     280: ldc           #153                // String XC
     282: bipush        90
     284: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     287: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     290: aastore
     291: aload_0
     292: bipush        6
     294: ldc           #155                // String L
     296: bipush        50
     298: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     301: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     304: aastore
     305: aload_0
     306: bipush        7
     308: ldc           #157                // String XL
     310: bipush        40
     312: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     315: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     318: aastore
     319: aload_0
     320: bipush        8
     322: ldc           #159                // String X
     324: bipush        10
     326: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     329: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     332: aastore
     333: aload_0
     334: bipush        9
     336: ldc           #161                // String IX
     338: bipush        9
     340: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     343: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     346: aastore
     347: aload_0
     348: bipush        10
     350: ldc           #163                // String V
     352: iconst_5
     353: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     356: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     359: aastore
     360: aload_0
     361: bipush        11
     363: ldc           #106                // String IV
     365: iconst_4
     366: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     369: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     372: aastore
     373: aload_0
     374: bipush        12
     376: ldc           #164                // String I
     378: iconst_1
     379: invokestatic  #175                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     382: invokestatic  #181                // Method kotlin/TuplesKt.to:(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
     385: aastore
     386: aload_0
     387: invokestatic  #187                // Method kotlin/collections/MapsKt.mapOf:([Lkotlin/Pair;)Ljava/util/Map;
     390: putstatic     #62                 // Field letters:Ljava/util/Map;
     393: return
}


package converter

import java.math.BigDecimal
import java.math.BigInteger
import java.util.*
import kotlin.math.pow

fun main() {
    val scanner = Scanner(System.`in`)
    while (true) {
        print("Enter two numbers in format: {source base} {target base} (To quit type /exit) ")
        when (val input1 = scanner.nextLine()) {
            "/exit" -> return
            else -> {
                val split = input1.split(" ")
                val sourceBase = split[0].toBigInteger()
                val targetBase = split[1].toBigInteger()
                loop@ while (true) {
                    print("Enter number in base $sourceBase to convert to base $targetBase (To go back type /back) ")
                    when(val input2 = scanner.nextLine()) {
                        "/back" -> break@loop
                        else -> {
                            val decimal: BigDecimal = if (sourceBase != BigInteger.TEN) converter(input2, sourceBase).toBigDecimal() else input2.toBigDecimal()
                            val target = if (targetBase == BigInteger.TEN) decimal else converter(decimal, targetBase, input2.contains("."))
                            println("Conversion result: $target\n")
                        }
                    }
                }
            }
        }
    }
}

fun converter(source: String, sourceBase: BigInteger): String {
    var sum = BigDecimal.ZERO
    val integer: String
    val fraction: String
    if (source.contains(".")) {
        val split = source.split(".")
        integer = split[0]
        fraction = split[1]
    } else {
        integer = source
        fraction = ""
    }
    // Integer part
    val reversed = integer.reversed()
    for (i in reversed.indices) {
        sum += if (reversed[i].isDigit())
            reversed[i].toString().toBigDecimal() * sourceBase.toBigDecimal().pow(i)
        else
            (10 + reversed[i].code - 'a'.code).toBigDecimal() * sourceBase.toBigDecimal().pow(i)
    }
    // Fractional part
    val sourceBaseDecimal = sourceBase.toDouble()
    var fractionSum = 0.0
    for (i in fraction.indices) {
        fractionSum += if (fraction[i].isDigit())
            fraction[i].toString().toDouble() / sourceBaseDecimal.pow(i + 1)
        else
            (10 + fraction[i].code - 'a'.code).toDouble() / sourceBaseDecimal.pow(i + 1)
    }
    return (sum + fractionSum.toBigDecimal()).toString()
}

fun converter(base10: BigDecimal, target: BigInteger, contains: Boolean) : String {
    var resultInteger = ""
    var resultFraction = ""
    val split = base10.toString().split(".")
    val integer = split[0].toBigInteger()
    // Integer part
    var remaining = integer
    while (remaining >= target) {
        resultInteger += convert((remaining % target).toInt())
        remaining /= target
    }
    resultInteger += convert(remaining.toInt())
    // Fraction part
    var ctr = 0
    var fraction = base10 - integer.toBigDecimal()
    if (contains) println(fraction)
    while (fraction > BigDecimal.ZERO) {
        if (ctr == 10) break
        val remainingDecimal = fraction * target.toBigDecimal()
        fraction = remainingDecimal - remainingDecimal.toInt().toBigDecimal()
        resultFraction += convert(remainingDecimal.toInt())
        ctr++
    }
    while (contains && resultFraction.length < 5) {
        // padding
        resultFraction += 0
    }
    return if
            (!contains) resultInteger.reversed()
    else resultInteger.reversed() + if (resultFraction.isNotEmpty()) ".${resultFraction.substring(0, 5)}" else ".00000"
}

fun convert(value: Int): String {
    return if (value < 10) value.toString()
    else ('a'.code + (value-10)).toChar().toString()
}

Compiled from "Main.kt"
public final class converter.MainKt {
  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: nop
      12: ldc           #20                 // String Enter two numbers in format: {source base} {target base} (To quit type /exit)
      14: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
      17: swap
      18: invokevirtual #30                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
      21: aload_0
      22: invokevirtual #34                 // Method java/util/Scanner.nextLine:()Ljava/lang/String;
      25: astore_1
      26: aload_1
      27: ldc           #36                 // String /exit
      29: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifeq          36
      35: return
      36: aload_1
      37: invokestatic  #45                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      40: aload_1
      41: checkcast     #47                 // class java/lang/CharSequence
      44: iconst_1
      45: anewarray     #49                 // class java/lang/String
      48: astore_3
      49: aload_3
      50: iconst_0
      51: ldc           #51                 // String
      53: aastore
      54: aload_3
      55: iconst_0
      56: iconst_0
      57: bipush        6
      59: aconst_null
      60: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      63: astore_2
      64: new           #59                 // class java/math/BigInteger
      67: dup
      68: aload_2
      69: iconst_0
      70: invokeinterface #65,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      75: checkcast     #49                 // class java/lang/String
      78: invokespecial #68                 // Method java/math/BigInteger."<init>":(Ljava/lang/String;)V
      81: astore_3
      82: new           #59                 // class java/math/BigInteger
      85: dup
      86: aload_2
      87: iconst_1
      88: invokeinterface #65,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      93: checkcast     #49                 // class java/lang/String
      96: invokespecial #68                 // Method java/math/BigInteger."<init>":(Ljava/lang/String;)V
      99: astore        4
     101: nop
     102: new           #70                 // class java/lang/StringBuilder
     105: dup
     106: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     109: ldc           #74                 // String Enter number in base
     111: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     114: aload_3
     115: invokevirtual #81                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     118: ldc           #83                 // String  to convert to base
     120: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     123: aload         4
     125: invokevirtual #81                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     128: ldc           #85                 // String  (To go back type /back)
     130: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     133: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     136: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
     139: swap
     140: invokevirtual #30                 // Method java/io/PrintStream.print:(Ljava/lang/Object;)V
     143: aload_0
     144: invokevirtual #34                 // Method java/util/Scanner.nextLine:()Ljava/lang/String;
     147: astore        5
     149: aload         5
     151: ldc           #90                 // String /back
     153: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     156: ifne          11
     159: aload_3
     160: getstatic     #94                 // Field java/math/BigInteger.TEN:Ljava/math/BigInteger;
     163: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     166: ifne          190
     169: new           #96                 // class java/math/BigDecimal
     172: dup
     173: aload         5
     175: invokestatic  #45                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     178: aload         5
     180: aload_3
     181: invokestatic  #100                // Method converter:(Ljava/lang/String;Ljava/math/BigInteger;)Ljava/lang/String;
     184: invokespecial #101                // Method java/math/BigDecimal."<init>":(Ljava/lang/String;)V
     187: goto          204
     190: new           #96                 // class java/math/BigDecimal
     193: dup
     194: aload         5
     196: invokestatic  #45                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     199: aload         5
     201: invokespecial #101                // Method java/math/BigDecimal."<init>":(Ljava/lang/String;)V
     204: astore        6
     206: aload         4
     208: getstatic     #94                 // Field java/math/BigInteger.TEN:Ljava/math/BigInteger;
     211: invokestatic  #42                 // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     214: ifeq          222
     217: aload         6
     219: goto          245
     222: aload         6
     224: aload         4
     226: aload         5
     228: checkcast     #47                 // class java/lang/CharSequence
     231: ldc           #103                // String .
     233: checkcast     #47                 // class java/lang/CharSequence
     236: iconst_0
     237: iconst_2
     238: aconst_null
     239: invokestatic  #107                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
     242: invokestatic  #110                // Method converter:(Ljava/math/BigDecimal;Ljava/math/BigInteger;Z)Ljava/lang/String;
     245: astore        7
     247: new           #70                 // class java/lang/StringBuilder
     250: dup
     251: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     254: ldc           #112                // String Conversion result:
     256: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     259: aload         7
     261: invokevirtual #81                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     264: bipush        10
     266: invokevirtual #115                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     269: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     272: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
     275: swap
     276: invokevirtual #118                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     279: goto          101

  public static final java.lang.String converter(java.lang.String, java.math.BigInteger);
    Code:
       0: aload_0
       1: ldc           #134                // String source
       3: invokestatic  #138                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #139                // String sourceBase
       9: invokestatic  #138                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: getstatic     #142                // Field java/math/BigDecimal.ZERO:Ljava/math/BigDecimal;
      15: astore_2
      16: aconst_null
      17: astore_3
      18: aconst_null
      19: astore        4
      21: aload_0
      22: checkcast     #47                 // class java/lang/CharSequence
      25: ldc           #103                // String .
      27: checkcast     #47                 // class java/lang/CharSequence
      30: iconst_0
      31: iconst_2
      32: aconst_null
      33: invokestatic  #107                // Method kotlin/text/StringsKt.contains$default:(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z
      36: ifeq          95
      39: aload_0
      40: checkcast     #47                 // class java/lang/CharSequence
      43: iconst_1
      44: anewarray     #49                 // class java/lang/String
      47: astore        6
      49: aload         6
      51: iconst_0
      52: ldc           #103                // String .
      54: aastore
      55: aload         6
      57: iconst_0
      58: iconst_0
      59: bipush        6
      61: aconst_null
      62: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      65: astore        5
      67: aload         5
      69: iconst_0
      70: invokeinterface #65,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      75: checkcast     #49                 // class java/lang/String
      78: astore_3
      79: aload         5
      81: iconst_1
      82: invokeinterface #65,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      87: checkcast     #49                 // class java/lang/String
      90: astore        4
      92: goto          101
      95: aload_0
      96: astore_3
      97: ldc           #144                // String
      99: astore        4
     101: aload_3
     102: checkcast     #47                 // class java/lang/CharSequence
     105: invokestatic  #148                // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     108: invokevirtual #149                // Method java/lang/Object.toString:()Ljava/lang/String;
     111: astore        5
     113: iconst_0
     114: istore        6
     116: aload         5
     118: checkcast     #47                 // class java/lang/CharSequence
     121: invokeinterface #153,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     126: istore        7
     128: iload         6
     130: iload         7
     132: if_icmpge     291
     135: aload_2
     136: astore        8
     138: aload         8
     140: invokestatic  #45                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     143: aload         8
     145: astore        8
     147: aload         5
     149: iload         6
     151: invokevirtual #157                // Method java/lang/String.charAt:(I)C
     154: invokestatic  #163                // Method java/lang/Character.isDigit:(C)Z
     157: ifeq          213
     160: new           #96                 // class java/math/BigDecimal
     163: dup
     164: aload         5
     166: iload         6
     168: invokevirtual #157                // Method java/lang/String.charAt:(I)C
     171: invokestatic  #167                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     174: invokespecial #101                // Method java/math/BigDecimal."<init>":(Ljava/lang/String;)V
     177: astore        9
     179: new           #96                 // class java/math/BigDecimal
     182: dup
     183: aload_1
     184: invokespecial #170                // Method java/math/BigDecimal."<init>":(Ljava/math/BigInteger;)V
     187: iload         6
     189: invokevirtual #174                // Method java/math/BigDecimal.pow:(I)Ljava/math/BigDecimal;
     192: dup
     193: ldc           #176                // String pow(...)
     195: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     198: aload         9
     200: swap
     201: invokevirtual #183                // Method java/math/BigDecimal.multiply:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     204: dup
     205: ldc           #185                // String multiply(...)
     207: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     210: goto          269
     213: bipush        10
     215: aload         5
     217: iload         6
     219: invokevirtual #157                // Method java/lang/String.charAt:(I)C
     222: iadd
     223: bipush        97
     225: isub
     226: i2l
     227: invokestatic  #188                // Method java/math/BigDecimal.valueOf:(J)Ljava/math/BigDecimal;
     230: dup
     231: ldc           #190                // String valueOf(...)
     233: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     236: astore        9
     238: new           #96                 // class java/math/BigDecimal
     241: dup
     242: aload_1
     243: invokespecial #170                // Method java/math/BigDecimal."<init>":(Ljava/math/BigInteger;)V
     246: iload         6
     248: invokevirtual #174                // Method java/math/BigDecimal.pow:(I)Ljava/math/BigDecimal;
     251: dup
     252: ldc           #176                // String pow(...)
     254: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     257: aload         9
     259: swap
     260: invokevirtual #183                // Method java/math/BigDecimal.multiply:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     263: dup
     264: ldc           #185                // String multiply(...)
     266: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     269: astore        9
     271: aload         8
     273: aload         9
     275: invokevirtual #193                // Method java/math/BigDecimal.add:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     278: dup
     279: ldc           #195                // String add(...)
     281: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     284: astore_2
     285: iinc          6, 1
     288: goto          128
     291: aload_1
     292: invokevirtual #199                // Method java/math/BigInteger.doubleValue:()D
     295: dstore        6
     297: dconst_0
     298: dstore        8
     300: iconst_0
     301: istore        10
     303: aload         4
     305: checkcast     #47                 // class java/lang/CharSequence
     308: invokeinterface #153,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     313: istore        11
     315: iload         10
     317: iload         11
     319: if_icmpge     398
     322: dload         8
     324: aload         4
     326: iload         10
     328: invokevirtual #157                // Method java/lang/String.charAt:(I)C
     331: invokestatic  #163                // Method java/lang/Character.isDigit:(C)Z
     334: ifeq          364
     337: aload         4
     339: iload         10
     341: invokevirtual #157                // Method java/lang/String.charAt:(I)C
     344: invokestatic  #167                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
     347: invokestatic  #205                // Method java/lang/Double.parseDouble:(Ljava/lang/String;)D
     350: dload         6
     352: iload         10
     354: iconst_1
     355: iadd
     356: i2d
     357: invokestatic  #210                // Method java/lang/Math.pow:(DD)D
     360: ddiv
     361: goto          389
     364: bipush        10
     366: aload         4
     368: iload         10
     370: invokevirtual #157                // Method java/lang/String.charAt:(I)C
     373: iadd
     374: bipush        97
     376: isub
     377: i2d
     378: dload         6
     380: iload         10
     382: iconst_1
     383: iadd
     384: i2d
     385: invokestatic  #210                // Method java/lang/Math.pow:(DD)D
     388: ddiv
     389: dadd
     390: dstore        8
     392: iinc          10, 1
     395: goto          315
     398: aload_2
     399: astore        11
     401: aload         11
     403: invokestatic  #45                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     406: aload         11
     408: astore        11
     410: new           #96                 // class java/math/BigDecimal
     413: dup
     414: dload         8
     416: invokestatic  #213                // Method java/lang/String.valueOf:(D)Ljava/lang/String;
     419: invokespecial #101                // Method java/math/BigDecimal."<init>":(Ljava/lang/String;)V
     422: astore        12
     424: aload         11
     426: aload         12
     428: invokevirtual #193                // Method java/math/BigDecimal.add:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     431: dup
     432: ldc           #195                // String add(...)
     434: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     437: invokevirtual #214                // Method java/math/BigDecimal.toString:()Ljava/lang/String;
     440: dup
     441: ldc           #216                // String toString(...)
     443: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     446: areturn

  public static final java.lang.String converter(java.math.BigDecimal, java.math.BigInteger, boolean);
    Code:
       0: aload_0
       1: ldc           #226                // String base10
       3: invokestatic  #138                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #227                // String target
       9: invokestatic  #138                // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: ldc           #144                // String
      14: astore_3
      15: ldc           #144                // String
      17: astore        4
      19: aload_0
      20: invokevirtual #214                // Method java/math/BigDecimal.toString:()Ljava/lang/String;
      23: dup
      24: ldc           #216                // String toString(...)
      26: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      29: checkcast     #47                 // class java/lang/CharSequence
      32: iconst_1
      33: anewarray     #49                 // class java/lang/String
      36: astore        6
      38: aload         6
      40: iconst_0
      41: ldc           #103                // String .
      43: aastore
      44: aload         6
      46: iconst_0
      47: iconst_0
      48: bipush        6
      50: aconst_null
      51: invokestatic  #57                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
      54: astore        5
      56: new           #59                 // class java/math/BigInteger
      59: dup
      60: aload         5
      62: iconst_0
      63: invokeinterface #65,  2           // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
      68: checkcast     #49                 // class java/lang/String
      71: invokespecial #68                 // Method java/math/BigInteger."<init>":(Ljava/lang/String;)V
      74: astore        6
      76: aload         6
      78: astore        7
      80: aload         7
      82: aload_1
      83: invokevirtual #231                // Method java/math/BigInteger.compareTo:(Ljava/math/BigInteger;)I
      86: iflt          142
      89: new           #70                 // class java/lang/StringBuilder
      92: dup
      93: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
      96: aload_3
      97: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     100: aload         7
     102: aload_1
     103: invokevirtual #235                // Method java/math/BigInteger.remainder:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
     106: dup
     107: ldc           #237                // String remainder(...)
     109: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     112: invokevirtual #240                // Method java/math/BigInteger.intValue:()I
     115: invokestatic  #244                // Method convert:(I)Ljava/lang/String;
     118: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     121: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     124: astore_3
     125: aload         7
     127: aload_1
     128: invokevirtual #247                // Method java/math/BigInteger.divide:(Ljava/math/BigInteger;)Ljava/math/BigInteger;
     131: dup
     132: ldc           #249                // String divide(...)
     134: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     137: astore        7
     139: goto          80
     142: new           #70                 // class java/lang/StringBuilder
     145: dup
     146: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     149: aload_3
     150: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     153: aload         7
     155: invokevirtual #240                // Method java/math/BigInteger.intValue:()I
     158: invokestatic  #244                // Method convert:(I)Ljava/lang/String;
     161: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     164: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     167: astore_3
     168: iconst_0
     169: istore        8
     171: nop
     172: aload_0
     173: new           #96                 // class java/math/BigDecimal
     176: dup
     177: aload         6
     179: invokespecial #170                // Method java/math/BigDecimal."<init>":(Ljava/math/BigInteger;)V
     182: invokevirtual #252                // Method java/math/BigDecimal.subtract:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     185: dup
     186: ldc           #254                // String subtract(...)
     188: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     191: astore        9
     193: iload_2
     194: ifeq          205
     197: getstatic     #24                 // Field java/lang/System.out:Ljava/io/PrintStream;
     200: aload         9
     202: invokevirtual #118                // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
     205: aload         9
     207: getstatic     #142                // Field java/math/BigDecimal.ZERO:Ljava/math/BigDecimal;
     210: invokevirtual #257                // Method java/math/BigDecimal.compareTo:(Ljava/math/BigDecimal;)I
     213: ifle          307
     216: iload         8
     218: bipush        10
     220: if_icmpeq     307
     223: nop
     224: aload         9
     226: new           #96                 // class java/math/BigDecimal
     229: dup
     230: aload_1
     231: invokespecial #170                // Method java/math/BigDecimal."<init>":(Ljava/math/BigInteger;)V
     234: invokevirtual #183                // Method java/math/BigDecimal.multiply:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     237: dup
     238: ldc           #185                // String multiply(...)
     240: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     243: astore        10
     245: aload         10
     247: aload         10
     249: invokevirtual #258                // Method java/math/BigDecimal.intValue:()I
     252: i2l
     253: invokestatic  #188                // Method java/math/BigDecimal.valueOf:(J)Ljava/math/BigDecimal;
     256: dup
     257: ldc           #190                // String valueOf(...)
     259: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     262: invokevirtual #252                // Method java/math/BigDecimal.subtract:(Ljava/math/BigDecimal;)Ljava/math/BigDecimal;
     265: dup
     266: ldc           #254                // String subtract(...)
     268: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     271: astore        9
     273: new           #70                 // class java/lang/StringBuilder
     276: dup
     277: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     280: aload         4
     282: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     285: aload         10
     287: invokevirtual #258                // Method java/math/BigDecimal.intValue:()I
     290: invokestatic  #244                // Method convert:(I)Ljava/lang/String;
     293: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     296: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     299: astore        4
     301: iinc          8, 1
     304: goto          205
     307: iload_2
     308: ifeq          345
     311: aload         4
     313: invokevirtual #259                // Method java/lang/String.length:()I
     316: iconst_5
     317: if_icmpge     345
     320: new           #70                 // class java/lang/StringBuilder
     323: dup
     324: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     327: aload         4
     329: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     332: bipush        48
     334: invokevirtual #115                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     337: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     340: astore        4
     342: goto          307
     345: iload_2
     346: ifne          362
     349: aload_3
     350: checkcast     #47                 // class java/lang/CharSequence
     353: invokestatic  #148                // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     356: invokevirtual #149                // Method java/lang/Object.toString:()Ljava/lang/String;
     359: goto          447
     362: new           #70                 // class java/lang/StringBuilder
     365: dup
     366: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     369: aload_3
     370: checkcast     #47                 // class java/lang/CharSequence
     373: invokestatic  #148                // Method kotlin/text/StringsKt.reversed:(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
     376: invokevirtual #149                // Method java/lang/Object.toString:()Ljava/lang/String;
     379: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     382: aload         4
     384: checkcast     #47                 // class java/lang/CharSequence
     387: invokeinterface #153,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     392: ifle          399
     395: iconst_1
     396: goto          400
     399: iconst_0
     400: ifeq          438
     403: new           #70                 // class java/lang/StringBuilder
     406: dup
     407: invokespecial #72                 // Method java/lang/StringBuilder."<init>":()V
     410: bipush        46
     412: invokevirtual #115                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     415: aload         4
     417: iconst_0
     418: iconst_5
     419: invokevirtual #263                // Method java/lang/String.substring:(II)Ljava/lang/String;
     422: dup
     423: ldc_w         #265                // String substring(...)
     426: invokestatic  #179                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
     429: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     432: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     435: goto          441
     438: ldc_w         #267                // String .00000
     441: invokevirtual #78                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     444: invokevirtual #88                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     447: areturn

  public static final java.lang.String convert(int);
    Code:
       0: iload_0
       1: bipush        10
       3: if_icmpge     13
       6: iload_0
       7: invokestatic  #276                // Method java/lang/String.valueOf:(I)Ljava/lang/String;
      10: goto          24
      13: bipush        97
      15: iload_0
      16: bipush        10
      18: isub
      19: iadd
      20: i2c
      21: invokestatic  #167                // Method java/lang/String.valueOf:(C)Ljava/lang/String;
      24: areturn

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


package xyz.prpht.distributeamountbetweenslots

import kotlin.math.floor
import kotlin.random.Random

fun main() {
    repeat(0x10) {
        println(distribute(100, 5, 1, Random).joinToString("  ") { "%2d".format(it) })
    }
}

fun distribute(amount: Int, slots: Int, rollsNum: Int, random: Random): List<Int> {
    var leftAmount = amount
    return (slots downTo 1).map { leftSlots ->
        val slotAmount = random.generateSlotAmount(leftAmount, leftSlots, rollsNum)
        leftAmount -= slotAmount
        slotAmount
    }
}

private fun Random.generateSlotAmount(leftAmount: Int, leftSlots: Int, rollsNum: Int): Int {
    check(leftSlots > 0) { "Non-positive slots count: $leftSlots" }
    check(leftAmount > 0) { "Non-positive amount: $leftAmount" }
    check(leftAmount >= leftSlots) { "leftAmount ($leftAmount) is less than leftSlots ($leftSlots)" }

    if (leftSlots <= 1)
        return leftAmount

    if (leftAmount == leftSlots)
        return 1

    /**
     *  Magic formula ensures:
     *  1. Values distributed in `[1..(leftAmount-lestSlots+1)]` to guarantee that next `leftAmount >= next slotsAmount`.
     *  2. Estimation is `leftAmount/leftSlots`.
     *  3. Values are centered: those near `leftAmount/leftSlots` are more probable than values at the boundaries.
     *     Bigger `rollsNum` leads to more centered result.
     */
    val rollsSum = (0 until rollsNum).map { nextInt(1, leftAmount - leftSlots + 2) }.sum()
    return stochasticRound(2.0 * rollsSum / (rollsNum * leftSlots) + (leftSlots - 2.0) / leftSlots)
}

fun Random.stochasticRound(x: Double): Int {
    val floor = floor(x)
    var result = floor
    if (nextFloat() < (x - floor))
        result += 1
    return result.toInt()
}

Compiled from "Distributor.kt"
public final class xyz.prpht.distributeamountbetweenslots.DistributorKt {
  public static final void main();
    Code:
       0: bipush        16
       2: istore_0
       3: iconst_0
       4: istore_1
       5: iload_1
       6: iload_0
       7: if_icmpge     64
      10: iload_1
      11: istore_2
      12: iconst_0
      13: istore_3
      14: bipush        100
      16: iconst_5
      17: iconst_1
      18: getstatic     #12                 // Field kotlin/random/Random.Default:Lkotlin/random/Random$Default;
      21: checkcast     #8                  // class kotlin/random/Random
      24: invokestatic  #16                 // Method distribute:(IIILkotlin/random/Random;)Ljava/util/List;
      27: checkcast     #18                 // class java/lang/Iterable
      30: ldc           #20                 // String
      32: checkcast     #22                 // class java/lang/CharSequence
      35: aconst_null
      36: aconst_null
      37: iconst_0
      38: aconst_null
      39: invokedynamic #42,  0             // InvokeDynamic #0:invoke:()Lkotlin/jvm/functions/Function1;
      44: bipush        30
      46: aconst_null
      47: invokestatic  #48                 // 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;
      50: getstatic     #54                 // Field java/lang/System.out:Ljava/io/PrintStream;
      53: swap
      54: invokevirtual #60                 // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      57: nop
      58: iinc          1, 1
      61: goto          5
      64: return

  public static final java.util.List<java.lang.Integer> distribute(int, int, int, kotlin.random.Random);
    Code:
       0: aload_3
       1: ldc           #67                 // String random
       3: invokestatic  #73                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: iconst_0
       7: istore        4
       9: iload_0
      10: istore        4
      12: iload_1
      13: iconst_1
      14: invokestatic  #79                 // Method kotlin/ranges/RangesKt.downTo:(II)Lkotlin/ranges/IntProgression;
      17: checkcast     #18                 // class java/lang/Iterable
      20: astore        5
      22: iconst_0
      23: istore        6
      25: aload         5
      27: astore        7
      29: new           #81                 // class java/util/ArrayList
      32: dup
      33: aload         5
      35: bipush        10
      37: invokestatic  #85                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
      40: invokespecial #89                 // Method java/util/ArrayList."<init>":(I)V
      43: checkcast     #91                 // class java/util/Collection
      46: astore        8
      48: iconst_0
      49: istore        9
      51: aload         7
      53: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      58: astore        10
      60: aload         10
      62: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      67: ifeq          126
      70: aload         10
      72: checkcast     #103                // class kotlin/collections/IntIterator
      75: invokevirtual #107                // Method kotlin/collections/IntIterator.nextInt:()I
      78: istore        11
      80: aload         8
      82: iload         11
      84: istore        12
      86: astore        15
      88: iconst_0
      89: istore        13
      91: aload_3
      92: iload         4
      94: iload         12
      96: iload_2
      97: invokestatic  #111                // Method generateSlotAmount:(Lkotlin/random/Random;III)I
     100: istore        14
     102: iload         4
     104: iload         14
     106: isub
     107: istore        4
     109: iload         14
     111: invokestatic  #117                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     114: aload         15
     116: swap
     117: invokeinterface #121,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     122: pop
     123: goto          60
     126: aload         8
     128: checkcast     #123                // class java/util/List
     131: nop
     132: areturn

  private static final int generateSlotAmount(kotlin.random.Random, int, int, int);
    Code:
       0: iload_2
       1: ifle          8
       4: iconst_1
       5: goto          9
       8: iconst_0
       9: ifne          49
      12: iconst_0
      13: istore        5
      15: new           #141                // class java/lang/StringBuilder
      18: dup
      19: invokespecial #143                // Method java/lang/StringBuilder."<init>":()V
      22: ldc           #145                // String Non-positive slots count:
      24: invokevirtual #149                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      27: iload_2
      28: invokevirtual #152                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      31: invokevirtual #156                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      34: astore        5
      36: new           #158                // class java/lang/IllegalStateException
      39: dup
      40: aload         5
      42: invokevirtual #159                // Method java/lang/Object.toString:()Ljava/lang/String;
      45: invokespecial #162                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      48: athrow
      49: iload_1
      50: ifle          57
      53: iconst_1
      54: goto          58
      57: iconst_0
      58: ifne          98
      61: iconst_0
      62: istore        5
      64: new           #141                // class java/lang/StringBuilder
      67: dup
      68: invokespecial #143                // Method java/lang/StringBuilder."<init>":()V
      71: ldc           #164                // String Non-positive amount:
      73: invokevirtual #149                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      76: iload_1
      77: invokevirtual #152                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
      80: invokevirtual #156                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      83: astore        5
      85: new           #158                // class java/lang/IllegalStateException
      88: dup
      89: aload         5
      91: invokevirtual #159                // Method java/lang/Object.toString:()Ljava/lang/String;
      94: invokespecial #162                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
      97: athrow
      98: iload_1
      99: iload_2
     100: if_icmplt     107
     103: iconst_1
     104: goto          108
     107: iconst_0
     108: ifne          162
     111: iconst_0
     112: istore        5
     114: new           #141                // class java/lang/StringBuilder
     117: dup
     118: invokespecial #143                // Method java/lang/StringBuilder."<init>":()V
     121: ldc           #166                // String leftAmount (
     123: invokevirtual #149                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     126: iload_1
     127: invokevirtual #152                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     130: ldc           #168                // String ) is less than leftSlots (
     132: invokevirtual #149                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     135: iload_2
     136: invokevirtual #152                // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
     139: bipush        41
     141: invokevirtual #171                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
     144: invokevirtual #156                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     147: astore        5
     149: new           #158                // class java/lang/IllegalStateException
     152: dup
     153: aload         5
     155: invokevirtual #159                // Method java/lang/Object.toString:()Ljava/lang/String;
     158: invokespecial #162                // Method java/lang/IllegalStateException."<init>":(Ljava/lang/String;)V
     161: athrow
     162: iload_2
     163: iconst_1
     164: if_icmpgt     169
     167: iload_1
     168: ireturn
     169: iload_1
     170: iload_2
     171: if_icmpne     176
     174: iconst_1
     175: ireturn
     176: iconst_0
     177: iload_3
     178: invokestatic  #175                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     181: checkcast     #18                 // class java/lang/Iterable
     184: astore        5
     186: iconst_0
     187: istore        6
     189: aload         5
     191: astore        7
     193: new           #81                 // class java/util/ArrayList
     196: dup
     197: aload         5
     199: bipush        10
     201: invokestatic  #85                 // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     204: invokespecial #89                 // Method java/util/ArrayList."<init>":(I)V
     207: checkcast     #91                 // class java/util/Collection
     210: astore        8
     212: iconst_0
     213: istore        9
     215: aload         7
     217: invokeinterface #95,  1           // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     222: astore        10
     224: aload         10
     226: invokeinterface #101,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     231: ifeq          280
     234: aload         10
     236: checkcast     #103                // class kotlin/collections/IntIterator
     239: invokevirtual #107                // Method kotlin/collections/IntIterator.nextInt:()I
     242: istore        11
     244: aload         8
     246: iload         11
     248: istore        12
     250: astore        14
     252: iconst_0
     253: istore        13
     255: aload_0
     256: iconst_1
     257: iload_1
     258: iload_2
     259: isub
     260: iconst_2
     261: iadd
     262: invokevirtual #178                // Method kotlin/random/Random.nextInt:(II)I
     265: invokestatic  #117                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     268: aload         14
     270: swap
     271: invokeinterface #121,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     276: pop
     277: goto          224
     280: aload         8
     282: checkcast     #123                // class java/util/List
     285: nop
     286: checkcast     #18                 // class java/lang/Iterable
     289: invokestatic  #182                // Method kotlin/collections/CollectionsKt.sumOfInt:(Ljava/lang/Iterable;)I
     292: istore        4
     294: aload_0
     295: ldc2_w        #183                // double 2.0d
     298: iload         4
     300: i2d
     301: dmul
     302: iload_3
     303: iload_2
     304: imul
     305: i2d
     306: ddiv
     307: iload_2
     308: i2d
     309: ldc2_w        #183                // double 2.0d
     312: dsub
     313: iload_2
     314: i2d
     315: ddiv
     316: dadd
     317: invokestatic  #188                // Method stochasticRound:(Lkotlin/random/Random;D)I
     320: ireturn

  public static final int stochasticRound(kotlin.random.Random, double);
    Code:
       0: aload_0
       1: ldc           #196                // String <this>
       3: invokestatic  #73                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: dload_1
       7: invokestatic  #202                // Method java/lang/Math.floor:(D)D
      10: dstore_3
      11: dload_3
      12: dstore        5
      14: aload_0
      15: invokevirtual #206                // Method kotlin/random/Random.nextFloat:()F
      18: f2d
      19: dload_1
      20: dload_3
      21: dsub
      22: dcmpg
      23: ifge          33
      26: dload         5
      28: iconst_1
      29: i2d
      30: dadd
      31: dstore        5
      33: dload         5
      35: d2i
      36: ireturn

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

  private static final java.lang.CharSequence main$lambda$1$lambda$0(int);
    Code:
       0: ldc           #217                // String %2d
       2: astore_1
       3: iconst_1
       4: anewarray     #4                  // class java/lang/Object
       7: astore_2
       8: aload_2
       9: iconst_0
      10: iload_0
      11: invokestatic  #117                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      14: aastore
      15: aload_2
      16: astore_2
      17: aload_1
      18: aload_2
      19: aload_2
      20: arraylength
      21: invokestatic  #223                // Method java/util/Arrays.copyOf:([Ljava/lang/Object;I)[Ljava/lang/Object;
      24: invokestatic  #229                // Method java/lang/String.format:(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
      27: dup
      28: ldc           #231                // String format(...)
      30: invokestatic  #234                // Method kotlin/jvm/internal/Intrinsics.checkNotNullExpressionValue:(Ljava/lang/Object;Ljava/lang/String;)V
      33: checkcast     #22                 // class java/lang/CharSequence
      36: areturn
}


package com.resnik.intel.similarity

import java.util.*

fun String.lcs(other: String): String {
    val numArray = Array(this.length + 1) { IntArray(other.length + 1) { 0 } }
    for (i in 1 until this.length + 1) {
        val c1 = this[i - 1]
        for (j in 1 until other.length + 1) {
            val c2 = other[j - 1]
            if (c1 == c2) {
                numArray[i][j] = numArray[i - 1][j - 1] + 1;
            } else {
                numArray[i][j] = numArray[i - 1][j].coerceAtLeast(numArray[i][j - 1])
            }
        }
    }
    val retStack = Stack<Char>()
    var i = numArray.size - 1
    var j = numArray[0].size - 1
    var currNum = numArray[i][j]
    while (currNum != 0) {
        when {
            numArray[i - 1][j] == currNum -> {
                i--
            }
            numArray[i][j - 1] == currNum -> {
                j--
            }
            numArray[i - 1][j - 1] != currNum -> {
                i--
                j--
                retStack.push(this[i])
            }
        }
        currNum = numArray[i][j]
    }
    var retString: String = ""
    while (!retStack.isEmpty()) {
        retString += retStack.pop()
    }
    return retString
}

fun String.lcsSimilarity(other: String): Double =
    this.lcs(other).length.toDouble() / this.length.coerceAtLeast(other.length)

fun String.jaro(other: String): Double {
    if (this.isEmpty() && other.isEmpty()) return 1.0
    val maxMatchDistance = this.length.coerceAtLeast(other.length) / 2 - 1
    val thisMatchArray = BooleanArray(this.length)
    val otherMatchArray = BooleanArray(other.length)
    var matches = 0
    for (i in this.indices) {
        val start = 0.coerceAtLeast(i - maxMatchDistance)
        val end = (i + maxMatchDistance + 1).coerceAtMost(other.length)
        (start until end).find { j -> !otherMatchArray[j] && this[i] == other[j] }?.let {
            thisMatchArray[i] = true
            otherMatchArray[it] = true
            matches++
        }
    }
    if (matches == 0) return 0.0
    var t = 0.0
    var k = 0
    (this.indices).filter { thisMatchArray[it] }.forEach { i ->
        while (!otherMatchArray[k]) k++
        if (this[i] != other[k]) t += 0.5
        k++
    }

    val m = matches.toDouble()
    return (m / this.length + m / other.length + (m - t) / m) / 3.0
}

fun String.jaroWinkler(other: String, scalingFactor: Double = 0.1): Double {
    val sJ = this.jaro(other)
    if (sJ <= 0.7) return sJ
    val prefix = (0 until this.length.coerceAtMost(other.length))
        .count { this[it] == other[it] }
        .coerceAtMost(4)
        .toDouble()
    println(prefix)
    return sJ + scalingFactor * prefix * (1.0 - sJ)
}

Compiled from "Extensions.kt"
public final class com.resnik.intel.similarity.ExtensionsKt {
  public static final java.lang.String lcs(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #9                  // String <this>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #17                 // String other
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: iconst_0
      13: istore_3
      14: aload_0
      15: invokevirtual #23                 // Method java/lang/String.length:()I
      18: iconst_1
      19: iadd
      20: istore        4
      22: iload         4
      24: anewarray     #25                 // class "[I"
      27: astore        5
      29: iload_3
      30: iload         4
      32: if_icmpge     99
      35: iload_3
      36: istore        6
      38: aload         5
      40: iload         6
      42: iconst_0
      43: istore        7
      45: aload_1
      46: invokevirtual #23                 // Method java/lang/String.length:()I
      49: iconst_1
      50: iadd
      51: istore        8
      53: iload         8
      55: newarray       int
      57: astore        9
      59: istore        12
      61: astore        11
      63: iload         7
      65: iload         8
      67: if_icmpge     86
      70: iload         7
      72: istore        10
      74: aload         9
      76: iload         10
      78: iconst_0
      79: iastore
      80: iinc          7, 1
      83: goto          63
      86: aload         11
      88: iload         12
      90: aload         9
      92: aastore
      93: iinc          3, 1
      96: goto          29
      99: aload         5
     101: astore_2
     102: iconst_1
     103: istore_3
     104: aload_0
     105: invokevirtual #23                 // Method java/lang/String.length:()I
     108: iconst_1
     109: iadd
     110: istore        4
     112: iload_3
     113: iload         4
     115: if_icmpge     220
     118: aload_0
     119: iload_3
     120: iconst_1
     121: isub
     122: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     125: istore        5
     127: iconst_1
     128: istore        6
     130: aload_1
     131: invokevirtual #23                 // Method java/lang/String.length:()I
     134: iconst_1
     135: iadd
     136: istore        7
     138: iload         6
     140: iload         7
     142: if_icmpge     214
     145: aload_1
     146: iload         6
     148: iconst_1
     149: isub
     150: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     153: istore        8
     155: iload         5
     157: iload         8
     159: if_icmpne     183
     162: aload_2
     163: iload_3
     164: aaload
     165: iload         6
     167: aload_2
     168: iload_3
     169: iconst_1
     170: isub
     171: aaload
     172: iload         6
     174: iconst_1
     175: isub
     176: iaload
     177: iconst_1
     178: iadd
     179: iastore
     180: goto          208
     183: aload_2
     184: iload_3
     185: aaload
     186: iload         6
     188: aload_2
     189: iload_3
     190: iconst_1
     191: isub
     192: aaload
     193: iload         6
     195: iaload
     196: aload_2
     197: iload_3
     198: aaload
     199: iload         6
     201: iconst_1
     202: isub
     203: iaload
     204: invokestatic  #35                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     207: iastore
     208: iinc          6, 1
     211: goto          138
     214: iinc          3, 1
     217: goto          112
     220: new           #37                 // class java/util/Stack
     223: dup
     224: invokespecial #41                 // Method java/util/Stack."<init>":()V
     227: astore_3
     228: aload_2
     229: checkcast     #43                 // class "[Ljava/lang/Object;"
     232: arraylength
     233: iconst_1
     234: isub
     235: istore        4
     237: aload_2
     238: iconst_0
     239: aaload
     240: arraylength
     241: iconst_1
     242: isub
     243: istore        5
     245: aload_2
     246: iload         4
     248: aaload
     249: iload         5
     251: iaload
     252: istore        6
     254: iload         6
     256: ifeq          348
     259: nop
     260: aload_2
     261: iload         4
     263: iconst_1
     264: isub
     265: aaload
     266: iload         5
     268: iaload
     269: iload         6
     271: if_icmpne     280
     274: iinc          4, -1
     277: goto          336
     280: aload_2
     281: iload         4
     283: aaload
     284: iload         5
     286: iconst_1
     287: isub
     288: iaload
     289: iload         6
     291: if_icmpne     300
     294: iinc          5, -1
     297: goto          336
     300: aload_2
     301: iload         4
     303: iconst_1
     304: isub
     305: aaload
     306: iload         5
     308: iconst_1
     309: isub
     310: iaload
     311: iload         6
     313: if_icmpeq     336
     316: iinc          4, -1
     319: iinc          5, -1
     322: aload_3
     323: aload_0
     324: iload         4
     326: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     329: invokestatic  #49                 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character;
     332: invokevirtual #53                 // Method java/util/Stack.push:(Ljava/lang/Object;)Ljava/lang/Object;
     335: pop
     336: aload_2
     337: iload         4
     339: aaload
     340: iload         5
     342: iaload
     343: istore        6
     345: goto          254
     348: ldc           #55                 // String
     350: astore        7
     352: aload_3
     353: invokevirtual #59                 // Method java/util/Stack.isEmpty:()Z
     356: ifne          386
     359: new           #61                 // class java/lang/StringBuilder
     362: dup
     363: invokespecial #62                 // Method java/lang/StringBuilder."<init>":()V
     366: aload         7
     368: invokevirtual #66                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
     371: aload_3
     372: invokevirtual #70                 // Method java/util/Stack.pop:()Ljava/lang/Object;
     375: invokevirtual #73                 // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
     378: invokevirtual #77                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
     381: astore        7
     383: goto          352
     386: aload         7
     388: areturn

  public static final double lcsSimilarity(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #9                  // String <this>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #17                 // String other
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokestatic  #96                 // Method lcs:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
      17: invokevirtual #23                 // Method java/lang/String.length:()I
      20: i2d
      21: aload_0
      22: invokevirtual #23                 // Method java/lang/String.length:()I
      25: aload_1
      26: invokevirtual #23                 // Method java/lang/String.length:()I
      29: invokestatic  #35                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      32: i2d
      33: ddiv
      34: dreturn

  public static final double jaro(java.lang.String, java.lang.String);
    Code:
       0: aload_0
       1: ldc           #9                  // String <this>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #17                 // String other
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: checkcast     #100                // class java/lang/CharSequence
      16: invokeinterface #101,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      21: ifne          28
      24: iconst_1
      25: goto          29
      28: iconst_0
      29: ifeq          54
      32: aload_1
      33: checkcast     #100                // class java/lang/CharSequence
      36: invokeinterface #101,  1          // InterfaceMethod java/lang/CharSequence.length:()I
      41: ifne          48
      44: iconst_1
      45: goto          49
      48: iconst_0
      49: ifeq          54
      52: dconst_1
      53: dreturn
      54: aload_0
      55: invokevirtual #23                 // Method java/lang/String.length:()I
      58: aload_1
      59: invokevirtual #23                 // Method java/lang/String.length:()I
      62: invokestatic  #35                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
      65: iconst_2
      66: idiv
      67: iconst_1
      68: isub
      69: istore_2
      70: aload_0
      71: invokevirtual #23                 // Method java/lang/String.length:()I
      74: newarray       boolean
      76: astore_3
      77: aload_1
      78: invokevirtual #23                 // Method java/lang/String.length:()I
      81: newarray       boolean
      83: astore        4
      85: iconst_0
      86: istore        5
      88: iconst_0
      89: istore        6
      91: aload_0
      92: checkcast     #100                // class java/lang/CharSequence
      95: invokeinterface #101,  1          // InterfaceMethod java/lang/CharSequence.length:()I
     100: istore        7
     102: iload         6
     104: iload         7
     106: if_icmpge     277
     109: iconst_0
     110: iload         6
     112: iload_2
     113: isub
     114: invokestatic  #35                 // Method kotlin/ranges/RangesKt.coerceAtLeast:(II)I
     117: istore        8
     119: iload         6
     121: iload_2
     122: iadd
     123: iconst_1
     124: iadd
     125: aload_1
     126: invokevirtual #23                 // Method java/lang/String.length:()I
     129: invokestatic  #104                // Method kotlin/ranges/RangesKt.coerceAtMost:(II)I
     132: istore        9
     134: iload         8
     136: iload         9
     138: invokestatic  #108                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
     141: checkcast     #110                // class java/lang/Iterable
     144: astore        12
     146: aload         12
     148: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     153: astore        13
     155: aload         13
     157: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     162: ifeq          223
     165: aload         13
     167: invokeinterface #122,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     172: astore        14
     174: aload         14
     176: checkcast     #124                // class java/lang/Number
     179: invokevirtual #127                // Method java/lang/Number.intValue:()I
     182: istore        15
     184: iconst_0
     185: istore        16
     187: aload         4
     189: iload         15
     191: baload
     192: ifne          214
     195: aload_0
     196: iload         6
     198: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     201: aload_1
     202: iload         15
     204: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     207: if_icmpne     214
     210: iconst_1
     211: goto          215
     214: iconst_0
     215: ifeq          155
     218: aload         14
     220: goto          224
     223: aconst_null
     224: checkcast     #129                // class java/lang/Integer
     227: dup
     228: ifnull        269
     231: checkcast     #124                // class java/lang/Number
     234: invokevirtual #127                // Method java/lang/Number.intValue:()I
     237: istore        12
     239: iconst_0
     240: istore        13
     242: aload_3
     243: iload         6
     245: iconst_1
     246: bastore
     247: aload         4
     249: iload         12
     251: iconst_1
     252: bastore
     253: iload         5
     255: istore        14
     257: iload         14
     259: iconst_1
     260: iadd
     261: istore        5
     263: iload         14
     265: pop
     266: goto          271
     269: pop
     270: nop
     271: iinc          6, 1
     274: goto          102
     277: iload         5
     279: ifne          284
     282: dconst_0
     283: dreturn
     284: dconst_0
     285: dstore        17
     287: iconst_0
     288: istore        7
     290: aload_0
     291: checkcast     #100                // class java/lang/CharSequence
     294: invokestatic  #135                // Method kotlin/text/StringsKt.getIndices:(Ljava/lang/CharSequence;)Lkotlin/ranges/IntRange;
     297: checkcast     #110                // class java/lang/Iterable
     300: astore        8
     302: iconst_0
     303: istore        9
     305: aload         8
     307: astore        10
     309: new           #137                // class java/util/ArrayList
     312: dup
     313: invokespecial #138                // Method java/util/ArrayList."<init>":()V
     316: checkcast     #140                // class java/util/Collection
     319: astore        11
     321: iconst_0
     322: istore        12
     324: aload         10
     326: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     331: astore        13
     333: aload         13
     335: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     340: ifeq          385
     343: aload         13
     345: invokeinterface #122,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     350: astore        14
     352: aload         14
     354: checkcast     #124                // class java/lang/Number
     357: invokevirtual #127                // Method java/lang/Number.intValue:()I
     360: istore        15
     362: iconst_0
     363: istore        16
     365: aload_3
     366: iload         15
     368: baload
     369: ifeq          333
     372: aload         11
     374: aload         14
     376: invokeinterface #144,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     381: pop
     382: goto          333
     385: aload         11
     387: checkcast     #146                // class java/util/List
     390: nop
     391: checkcast     #110                // class java/lang/Iterable
     394: astore        8
     396: nop
     397: iconst_0
     398: istore        9
     400: aload         8
     402: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     407: astore        10
     409: aload         10
     411: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     416: ifeq          492
     419: aload         10
     421: invokeinterface #122,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     426: astore        11
     428: aload         11
     430: checkcast     #124                // class java/lang/Number
     433: invokevirtual #127                // Method java/lang/Number.intValue:()I
     436: istore        12
     438: iconst_0
     439: istore        13
     441: aload         4
     443: iload         7
     445: baload
     446: ifne          458
     449: iload         7
     451: iconst_1
     452: iadd
     453: istore        7
     455: goto          441
     458: aload_0
     459: iload         12
     461: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     464: aload_1
     465: iload         7
     467: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     470: if_icmpeq     481
     473: dload         17
     475: ldc2_w        #147                // double 0.5d
     478: dadd
     479: dstore        17
     481: iload         7
     483: iconst_1
     484: iadd
     485: istore        7
     487: nop
     488: nop
     489: goto          409
     492: nop
     493: iload         5
     495: i2d
     496: dstore        8
     498: dload         8
     500: aload_0
     501: invokevirtual #23                 // Method java/lang/String.length:()I
     504: i2d
     505: ddiv
     506: dload         8
     508: aload_1
     509: invokevirtual #23                 // Method java/lang/String.length:()I
     512: i2d
     513: ddiv
     514: dadd
     515: dload         8
     517: dload         17
     519: dsub
     520: dload         8
     522: ddiv
     523: dadd
     524: ldc2_w        #149                // double 3.0d
     527: ddiv
     528: dreturn

  public static final double jaroWinkler(java.lang.String, java.lang.String, double);
    Code:
       0: aload_0
       1: ldc           #9                  // String <this>
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #17                 // String other
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: aload_1
      14: invokestatic  #184                // Method jaro:(Ljava/lang/String;Ljava/lang/String;)D
      17: dstore        4
      19: dload         4
      21: ldc2_w        #185                // double 0.7d
      24: dcmpg
      25: ifgt          31
      28: dload         4
      30: dreturn
      31: iconst_0
      32: aload_0
      33: invokevirtual #23                 // Method java/lang/String.length:()I
      36: aload_1
      37: invokevirtual #23                 // Method java/lang/String.length:()I
      40: invokestatic  #104                // Method kotlin/ranges/RangesKt.coerceAtMost:(II)I
      43: invokestatic  #108                // Method kotlin/ranges/RangesKt.until:(II)Lkotlin/ranges/IntRange;
      46: checkcast     #110                // class java/lang/Iterable
      49: astore        8
      51: nop
      52: iconst_0
      53: istore        9
      55: aload         8
      57: instanceof    #140                // class java/util/Collection
      60: ifeq          80
      63: aload         8
      65: checkcast     #140                // class java/util/Collection
      68: invokeinterface #187,  1          // InterfaceMethod java/util/Collection.isEmpty:()Z
      73: ifeq          80
      76: iconst_0
      77: goto          158
      80: iconst_0
      81: istore        10
      83: aload         8
      85: invokeinterface #114,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      90: astore        11
      92: aload         11
      94: invokeinterface #119,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
      99: ifeq          156
     102: aload         11
     104: checkcast     #189                // class kotlin/collections/IntIterator
     107: invokevirtual #192                // Method kotlin/collections/IntIterator.nextInt:()I
     110: istore        12
     112: iload         12
     114: istore        13
     116: iconst_0
     117: istore        14
     119: aload_0
     120: iload         13
     122: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     125: aload_1
     126: iload         13
     128: invokevirtual #29                 // Method java/lang/String.charAt:(I)C
     131: if_icmpne     138
     134: iconst_1
     135: goto          139
     138: iconst_0
     139: ifeq          92
     142: iinc          10, 1
     145: iload         10
     147: ifge          92
     150: invokestatic  #197                // Method kotlin/collections/CollectionsKt.throwCountOverflow:()V
     153: goto          92
     156: iload         10
     158: iconst_4
     159: invokestatic  #104                // Method kotlin/ranges/RangesKt.coerceAtMost:(II)I
     162: i2d
     163: dstore        6
     165: getstatic     #203                // Field java/lang/System.out:Ljava/io/PrintStream;
     168: dload         6
     170: invokevirtual #209                // Method java/io/PrintStream.println:(D)V
     173: dload         4
     175: dload_2
     176: dload         6
     178: dmul
     179: dconst_1
     180: dload         4
     182: dsub
     183: dmul
     184: dadd
     185: dreturn

  public static double jaroWinkler$default(java.lang.String, java.lang.String, double, int, java.lang.Object);
    Code:
       0: iload         4
       2: iconst_2
       3: iand
       4: ifeq          11
       7: ldc2_w        #220                // double 0.1d
      10: dstore_2
      11: aload_0
      12: aload_1
      13: dload_2
      14: invokestatic  #223                // Method jaroWinkler:(Ljava/lang/String;Ljava/lang/String;D)D
      17: dreturn
}