package com.eharrison.game.tdcreator

import java.util.PriorityQueue
import java.util.ArrayList

typealias Neighbors<Node> = (Node) -> List<Node>
typealias Cost<Node> = (Node, Node) -> Double
typealias Exclude<Node> = (Node) -> Boolean
typealias Heuristic<Node> = (Node, Node) -> Double

fun <Node> aStar(
    start: Node,
    goal: Node,
    neighbors: Neighbors<Node>,
    cost: Cost<Node> = { _, _ -> 1.0 },
    exclude: Exclude<Node> = { _ -> false },
    heuristic: Heuristic<Node> = { _, _ -> 0.0 } // Dijkstra's algorithm, only for positive costs
): List<Node> {
    val closedSet = mutableSetOf<Node>() // The set of nodes already evaluated.
    val cameFrom = mutableMapOf<Node, Node>() // The map of navigated nodes.

    val gScore = mutableMapOf<Node, Double>() // Cost from start along best known path.
    gScore[start] = 0.0

    // Estimated total cost from start to goal through y.
    val fScore = mutableMapOf<Node, Double>()
    fScore[start] = heuristic(start, goal)

    // The set of tentative nodes to be evaluated, initially containing the start node
    val openSet = PriorityQueue<Node> {o1, o2 ->
        when {
            fScore[o1] ?: Double.MAX_VALUE < fScore[o2] ?: Double.MAX_VALUE -> -1
            fScore[o2] ?: Double.MAX_VALUE < fScore[o1] ?: Double.MAX_VALUE -> 1
            else -> 0
        }
    }
    openSet.add(start)

    while (openSet.isNotEmpty()) {
        val current = openSet.poll()!!
        if (current == goal) {
            return reconstructPath(cameFrom, goal)
        }

        closedSet.add(current)
        for (neighbor in neighbors(current)) {
            if (closedSet.contains(neighbor) || exclude(neighbor)) {
                continue // Ignore the neighbor which is already evaluated or shouldn't be.
            }

            val tentativeGScore = gScore[current]!! + cost(current, neighbor) // Cost of this path.
            if (!openSet.contains(neighbor)) {
                openSet.add(neighbor) // Discovered a new node
            }
            else if (tentativeGScore >= gScore[neighbor]!!) {
                continue // Found worse path, ignore.
            }

            // This path is the best until now. Record it!
            cameFrom[neighbor] = current
            gScore[neighbor] = tentativeGScore
            val estimatedFScore = tentativeGScore + heuristic(neighbor, goal)
            fScore[neighbor] = estimatedFScore
        }
    }

    return emptyList()
}

private fun <Node> reconstructPath(
    cameFrom: Map<Node, Node>,
    current: Node?
): List<Node> {
    var cur = current
    val totalPath = ArrayList<Node>()

    while (cur != null) {
        val previous = cur
        cur = cameFrom[cur]
        if (cur != null) {
            totalPath.add(previous)
        }
    }
    totalPath.reverse()
    return totalPath
}

Compiled from "AStar.kt"
public final class com.eharrison.game.tdcreator.AStarKt {
  public static final <Node> java.util.List<Node> aStar(Node, Node, kotlin.jvm.functions.Function1<? super Node, ? extends java.util.List<? extends Node>>, kotlin.jvm.functions.Function2<? super Node, ? super Node, java.lang.Double>, kotlin.jvm.functions.Function1<? super Node, java.lang.Boolean>, kotlin.jvm.functions.Function2<? super Node, ? super Node, java.lang.Double>);
    Code:
       0: aload_2
       1: ldc           #10                 // String neighbors
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_3
       7: ldc           #18                 // String cost
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload         4
      14: ldc           #20                 // String exclude
      16: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      19: aload         5
      21: ldc           #22                 // String heuristic
      23: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      26: new           #24                 // class java/util/LinkedHashSet
      29: dup
      30: invokespecial #28                 // Method java/util/LinkedHashSet."<init>":()V
      33: checkcast     #30                 // class java/util/Set
      36: astore        6
      38: new           #32                 // class java/util/LinkedHashMap
      41: dup
      42: invokespecial #33                 // Method java/util/LinkedHashMap."<init>":()V
      45: checkcast     #35                 // class java/util/Map
      48: astore        7
      50: new           #32                 // class java/util/LinkedHashMap
      53: dup
      54: invokespecial #33                 // Method java/util/LinkedHashMap."<init>":()V
      57: checkcast     #35                 // class java/util/Map
      60: astore        8
      62: aload         8
      64: aload_0
      65: dconst_0
      66: invokestatic  #41                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
      69: invokeinterface #45,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      74: pop
      75: new           #32                 // class java/util/LinkedHashMap
      78: dup
      79: invokespecial #33                 // Method java/util/LinkedHashMap."<init>":()V
      82: checkcast     #35                 // class java/util/Map
      85: astore        9
      87: aload         9
      89: aload_0
      90: aload         5
      92: aload_0
      93: aload_1
      94: invokeinterface #50,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
      99: invokeinterface #45,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     104: pop
     105: new           #52                 // class java/util/PriorityQueue
     108: dup
     109: aload         9
     111: invokedynamic #70,  0             // InvokeDynamic #0:invoke:(Ljava/util/Map;)Lkotlin/jvm/functions/Function2;
     116: invokedynamic #81,  0             // InvokeDynamic #1:compare:(Lkotlin/jvm/functions/Function2;)Ljava/util/Comparator;
     121: invokespecial #84                 // Method java/util/PriorityQueue."<init>":(Ljava/util/Comparator;)V
     124: astore        10
     126: aload         10
     128: aload_0
     129: invokevirtual #88                 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z
     132: pop
     133: aload         10
     135: checkcast     #90                 // class java/util/Collection
     138: invokeinterface #94,  1           // InterfaceMethod java/util/Collection.isEmpty:()Z
     143: ifne          150
     146: iconst_1
     147: goto          151
     150: iconst_0
     151: ifeq          422
     154: aload         10
     156: invokevirtual #98                 // Method java/util/PriorityQueue.poll:()Ljava/lang/Object;
     159: dup
     160: invokestatic  #102                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     163: astore        11
     165: aload         11
     167: aload_1
     168: invokestatic  #106                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     171: ifeq          181
     174: aload         7
     176: aload_1
     177: invokestatic  #110                // Method reconstructPath:(Ljava/util/Map;Ljava/lang/Object;)Ljava/util/List;
     180: areturn
     181: aload         6
     183: aload         11
     185: invokeinterface #111,  2          // InterfaceMethod java/util/Set.add:(Ljava/lang/Object;)Z
     190: pop
     191: aload_2
     192: aload         11
     194: invokeinterface #116,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     199: checkcast     #118                // class java/util/List
     202: invokeinterface #122,  1          // InterfaceMethod java/util/List.iterator:()Ljava/util/Iterator;
     207: astore        12
     209: aload         12
     211: invokeinterface #127,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     216: ifeq          133
     219: aload         12
     221: invokeinterface #130,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     226: astore        13
     228: aload         6
     230: aload         13
     232: invokeinterface #133,  2          // InterfaceMethod java/util/Set.contains:(Ljava/lang/Object;)Z
     237: ifne          258
     240: aload         4
     242: aload         13
     244: invokeinterface #116,  2          // InterfaceMethod kotlin/jvm/functions/Function1.invoke:(Ljava/lang/Object;)Ljava/lang/Object;
     249: checkcast     #135                // class java/lang/Boolean
     252: invokevirtual #138                // Method java/lang/Boolean.booleanValue:()Z
     255: ifeq          261
     258: goto          209
     261: aload         8
     263: aload         11
     265: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     270: dup
     271: invokestatic  #102                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     274: checkcast     #143                // class java/lang/Number
     277: invokevirtual #147                // Method java/lang/Number.doubleValue:()D
     280: aload_3
     281: aload         11
     283: aload         13
     285: invokeinterface #50,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     290: checkcast     #143                // class java/lang/Number
     293: invokevirtual #147                // Method java/lang/Number.doubleValue:()D
     296: dadd
     297: dstore        14
     299: aload         10
     301: aload         13
     303: invokevirtual #148                // Method java/util/PriorityQueue.contains:(Ljava/lang/Object;)Z
     306: ifne          320
     309: aload         10
     311: aload         13
     313: invokevirtual #88                 // Method java/util/PriorityQueue.add:(Ljava/lang/Object;)Z
     316: pop
     317: goto          348
     320: dload         14
     322: aload         8
     324: aload         13
     326: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
     331: dup
     332: invokestatic  #102                // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     335: checkcast     #143                // class java/lang/Number
     338: invokevirtual #147                // Method java/lang/Number.doubleValue:()D
     341: dcmpl
     342: iflt          348
     345: goto          209
     348: aload         7
     350: aload         13
     352: aload         11
     354: invokeinterface #45,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     359: pop
     360: dload         14
     362: invokestatic  #41                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     365: astore        17
     367: aload         8
     369: aload         13
     371: aload         17
     373: invokeinterface #45,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     378: pop
     379: dload         14
     381: aload         5
     383: aload         13
     385: aload_1
     386: invokeinterface #50,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     391: checkcast     #143                // class java/lang/Number
     394: invokevirtual #147                // Method java/lang/Number.doubleValue:()D
     397: dadd
     398: dstore        16
     400: dload         16
     402: invokestatic  #41                 // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
     405: astore        18
     407: aload         9
     409: aload         13
     411: aload         18
     413: invokeinterface #45,  3           // InterfaceMethod java/util/Map.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     418: pop
     419: goto          209
     422: invokestatic  #154                // Method kotlin/collections/CollectionsKt.emptyList:()Ljava/util/List;
     425: areturn

  public static java.util.List aStar$default(java.lang.Object, java.lang.Object, kotlin.jvm.functions.Function1, kotlin.jvm.functions.Function2, kotlin.jvm.functions.Function1, kotlin.jvm.functions.Function2, int, java.lang.Object);
    Code:
       0: iload         6
       2: bipush        8
       4: iand
       5: ifeq          14
       8: invokedynamic #184,  0            // InvokeDynamic #2:invoke:()Lkotlin/jvm/functions/Function2;
      13: astore_3
      14: iload         6
      16: bipush        16
      18: iand
      19: ifeq          29
      22: invokedynamic #194,  0            // InvokeDynamic #3:invoke:()Lkotlin/jvm/functions/Function1;
      27: astore        4
      29: iload         6
      31: bipush        32
      33: iand
      34: ifeq          44
      37: invokedynamic #199,  0            // InvokeDynamic #4:invoke:()Lkotlin/jvm/functions/Function2;
      42: astore        5
      44: aload_0
      45: aload_1
      46: aload_2
      47: aload_3
      48: aload         4
      50: aload         5
      52: invokestatic  #201                // Method aStar:(Ljava/lang/Object;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)Ljava/util/List;
      55: areturn

  private static final <Node> java.util.List<Node> reconstructPath(java.util.Map<Node, ? extends Node>, Node);
    Code:
       0: aload_1
       1: astore_2
       2: new           #204                // class java/util/ArrayList
       5: dup
       6: invokespecial #205                // Method java/util/ArrayList."<init>":()V
       9: astore_3
      10: aload_2
      11: ifnull        39
      14: aload_2
      15: astore        4
      17: aload_0
      18: aload_2
      19: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      24: astore_2
      25: aload_2
      26: ifnull        10
      29: aload_3
      30: aload         4
      32: invokevirtual #206                // Method java/util/ArrayList.add:(Ljava/lang/Object;)Z
      35: pop
      36: goto          10
      39: aload_3
      40: checkcast     #118                // class java/util/List
      43: invokestatic  #210                // Method kotlin/collections/CollectionsKt.reverse:(Ljava/util/List;)V
      46: aload_3
      47: checkcast     #118                // class java/util/List
      50: areturn

  private static final double aStar$lambda$0(java.lang.Object, java.lang.Object);
    Code:
       0: dconst_1
       1: dreturn

  private static final boolean aStar$lambda$1(java.lang.Object);
    Code:
       0: iconst_0
       1: ireturn

  private static final double aStar$lambda$2(java.lang.Object, java.lang.Object);
    Code:
       0: dconst_0
       1: dreturn

  private static final int aStar$lambda$3(java.util.Map, java.lang.Object, java.lang.Object);
    Code:
       0: nop
       1: aload_0
       2: aload_1
       3: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #37                 // class java/lang/Double
      11: dup
      12: ifnull        21
      15: invokevirtual #215                // Method java/lang/Double.doubleValue:()D
      18: goto          25
      21: pop
      22: ldc2_w        #216                // double 1.7976931348623157E308d
      25: aload_0
      26: aload_2
      27: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      32: checkcast     #37                 // class java/lang/Double
      35: dup
      36: ifnull        45
      39: invokevirtual #215                // Method java/lang/Double.doubleValue:()D
      42: goto          49
      45: pop
      46: ldc2_w        #216                // double 1.7976931348623157E308d
      49: dcmpg
      50: ifge          57
      53: iconst_m1
      54: goto          114
      57: aload_0
      58: aload_2
      59: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      64: checkcast     #37                 // class java/lang/Double
      67: dup
      68: ifnull        77
      71: invokevirtual #215                // Method java/lang/Double.doubleValue:()D
      74: goto          81
      77: pop
      78: ldc2_w        #216                // double 1.7976931348623157E308d
      81: aload_0
      82: aload_1
      83: invokeinterface #141,  2          // InterfaceMethod java/util/Map.get:(Ljava/lang/Object;)Ljava/lang/Object;
      88: checkcast     #37                 // class java/lang/Double
      91: dup
      92: ifnull        101
      95: invokevirtual #215                // Method java/lang/Double.doubleValue:()D
      98: goto          105
     101: pop
     102: ldc2_w        #216                // double 1.7976931348623157E308d
     105: dcmpg
     106: ifge          113
     109: iconst_1
     110: goto          114
     113: iconst_0
     114: ireturn

  private static final int aStar$lambda$4(kotlin.jvm.functions.Function2, java.lang.Object, java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: aload_2
       3: invokeinterface #50,  3           // InterfaceMethod kotlin/jvm/functions/Function2.invoke:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
       8: checkcast     #143                // class java/lang/Number
      11: invokevirtual #224                // Method java/lang/Number.intValue:()I
      14: ireturn
}


package io.tohuwabohu.calc

import kotlin.math.pow
import kotlin.math.round

/**
 * Calculation of basic metabolic rate (BMR) and total daily energy expenditure (TDEE) based on the Harris-Benedict
 * formula.
 */
data class Tdee(
    val age: Number,
    val sex: CalculationSex,
    val weight: Number,
    val height: Number,
    val activityLevel: Number,
    val weeklyDifference: Number,
    val calculationGoal: CalculationGoal
) {
    val bmr = when (sex) {
        CalculationSex.MALE -> {
            round(66 + (13.7 * weight.toFloat()) + (5 * height.toFloat()) - (6.8 * age.toFloat()))
        }

        CalculationSex.FEMALE -> {
            round(655 + (9.6 * weight.toFloat()) + (1.8 * height.toFloat()) - (4.7 * age.toFloat()))
        }
    }

    val tdee = round(activityLevel.toFloat() * bmr)

    val deficit = weeklyDifference.toFloat() / 10 * 7000 / 7

    val target: Float = when (calculationGoal) {
        CalculationGoal.GAIN -> {
            tdee.toFloat() + deficit
        }

        CalculationGoal.LOSS -> {
            tdee.toFloat() - deficit;
        }
    }

    val bmi: Float = round(weight.toFloat() / ((height.toFloat() / 100).pow(2)))

    val bmiCategory: BmiCategory  = when (sex) {
        CalculationSex.FEMALE -> {
            when (bmi) {
                in 0f..18f -> BmiCategory.UNDERWEIGHT
                in 19f..24f -> BmiCategory.STANDARD_WEIGHT
                in 25f..30f -> BmiCategory.OVERWEIGHT
                in 31f..40f -> BmiCategory.OBESE
                else -> BmiCategory.SEVERELY_OBESE
            }
        }

        CalculationSex.MALE -> {
            when (bmi) {
                in 0f..19f -> BmiCategory.UNDERWEIGHT
                in 20f..25f -> BmiCategory.STANDARD_WEIGHT
                in 26f..30f -> BmiCategory.OVERWEIGHT
                in 31f..40f -> BmiCategory.OBESE
                else -> BmiCategory.SEVERELY_OBESE
            }
        }
    }

    val targetBmi = when (age) {
        in 19..24 -> arrayOf(19,24)
        in 25..34 -> arrayOf(20,25)
        in 35..44 -> arrayOf(21,26)
        in 45..54 -> arrayOf(22,27)
        in 55..64 -> arrayOf(23,28)
        else -> arrayOf(24,29)
    }

    val targetWeight = round(((targetBmi[0] + targetBmi[1]).toFloat() / 2) * (height.toFloat() / 100).pow(2))

    val durationDays = when (calculationGoal) {
        CalculationGoal.GAIN -> {
            (targetWeight - weight.toFloat()) * 7000 / deficit
        }

        CalculationGoal.LOSS -> {
            (weight.toFloat() - targetWeight) * 7000 / deficit
        }
    }
}

enum class CalculationGoal {
    GAIN,
    LOSS
}

enum class CalculationSex {
    MALE,
    FEMALE
}

enum class BmiCategory {
    UNDERWEIGHT,
    STANDARD_WEIGHT,
    OVERWEIGHT,
    OBESE,
    SEVERELY_OBESE,
}

Compiled from "Tdee.kt"
public final class io.tohuwabohu.calc.Tdee$WhenMappings {
  public static final int[] $EnumSwitchMapping$0;

  public static final int[] $EnumSwitchMapping$1;

  static {};
    Code:
       0: invokestatic  #14                 // Method io/tohuwabohu/calc/CalculationSex.values:()[Lio/tohuwabohu/calc/CalculationSex;
       3: arraylength
       4: newarray       int
       6: astore_0
       7: nop
       8: aload_0
       9: getstatic     #18                 // Field io/tohuwabohu/calc/CalculationSex.MALE:Lio/tohuwabohu/calc/CalculationSex;
      12: invokevirtual #22                 // Method io/tohuwabohu/calc/CalculationSex.ordinal:()I
      15: iconst_1
      16: iastore
      17: goto          21
      20: astore_1
      21: nop
      22: aload_0
      23: getstatic     #25                 // Field io/tohuwabohu/calc/CalculationSex.FEMALE:Lio/tohuwabohu/calc/CalculationSex;
      26: invokevirtual #22                 // Method io/tohuwabohu/calc/CalculationSex.ordinal:()I
      29: iconst_2
      30: iastore
      31: goto          35
      34: astore_1
      35: aload_0
      36: putstatic     #29                 // Field $EnumSwitchMapping$0:[I
      39: invokestatic  #34                 // Method io/tohuwabohu/calc/CalculationGoal.values:()[Lio/tohuwabohu/calc/CalculationGoal;
      42: arraylength
      43: newarray       int
      45: astore_0
      46: nop
      47: aload_0
      48: getstatic     #38                 // Field io/tohuwabohu/calc/CalculationGoal.GAIN:Lio/tohuwabohu/calc/CalculationGoal;
      51: invokevirtual #39                 // Method io/tohuwabohu/calc/CalculationGoal.ordinal:()I
      54: iconst_1
      55: iastore
      56: goto          60
      59: astore_1
      60: nop
      61: aload_0
      62: getstatic     #42                 // Field io/tohuwabohu/calc/CalculationGoal.LOSS:Lio/tohuwabohu/calc/CalculationGoal;
      65: invokevirtual #39                 // Method io/tohuwabohu/calc/CalculationGoal.ordinal:()I
      68: iconst_2
      69: iastore
      70: goto          74
      73: astore_1
      74: aload_0
      75: putstatic     #45                 // Field $EnumSwitchMapping$1:[I
      78: return
    Exception table:
       from    to  target type
           7    17    20   Class java/lang/NoSuchFieldError
          21    31    34   Class java/lang/NoSuchFieldError
          46    56    59   Class java/lang/NoSuchFieldError
          60    70    73   Class java/lang/NoSuchFieldError
}

Compiled from "Tdee.kt"
public final class io.tohuwabohu.calc.Tdee {
  private final java.lang.Number age;

  private final io.tohuwabohu.calc.CalculationSex sex;

  private final java.lang.Number weight;

  private final java.lang.Number height;

  private final java.lang.Number activityLevel;

  private final java.lang.Number weeklyDifference;

  private final io.tohuwabohu.calc.CalculationGoal calculationGoal;

  private final double bmr;

  private final double tdee;

  private final float deficit;

  private final float target;

  private final float bmi;

  private final io.tohuwabohu.calc.BmiCategory bmiCategory;

  private final java.lang.Integer[] targetBmi;

  private final float targetWeight;

  private final float durationDays;

  public io.tohuwabohu.calc.Tdee(java.lang.Number, io.tohuwabohu.calc.CalculationSex, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, io.tohuwabohu.calc.CalculationGoal);
    Code:
       0: aload_1
       1: ldc           #9                  // String age
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String sex
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #19                 // String weight
      15: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload         4
      20: ldc           #21                 // String height
      22: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      25: aload         5
      27: ldc           #23                 // String activityLevel
      29: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      32: aload         6
      34: ldc           #25                 // String weeklyDifference
      36: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      39: aload         7
      41: ldc           #27                 // String calculationGoal
      43: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      46: aload_0
      47: invokespecial #30                 // Method java/lang/Object."<init>":()V
      50: aload_0
      51: aload_1
      52: putfield      #33                 // Field age:Ljava/lang/Number;
      55: aload_0
      56: aload_2
      57: putfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      60: aload_0
      61: aload_3
      62: putfield      #38                 // Field weight:Ljava/lang/Number;
      65: aload_0
      66: aload         4
      68: putfield      #40                 // Field height:Ljava/lang/Number;
      71: aload_0
      72: aload         5
      74: putfield      #42                 // Field activityLevel:Ljava/lang/Number;
      77: aload_0
      78: aload         6
      80: putfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
      83: aload_0
      84: aload         7
      86: putfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
      89: aload_0
      90: aload_0
      91: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      94: getstatic     #53                 // Field io/tohuwabohu/calc/Tdee$WhenMappings.$EnumSwitchMapping$0:[I
      97: swap
      98: invokevirtual #59                 // Method io/tohuwabohu/calc/CalculationSex.ordinal:()I
     101: iaload
     102: tableswitch   { // 1 to 2
                     1: 124
                     2: 171
               default: 220
          }
     124: bipush        66
     126: i2d
     127: ldc2_w        #60                 // double 13.7d
     130: aload_0
     131: getfield      #38                 // Field weight:Ljava/lang/Number;
     134: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     137: f2d
     138: dmul
     139: dadd
     140: iconst_5
     141: i2f
     142: aload_0
     143: getfield      #40                 // Field height:Ljava/lang/Number;
     146: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     149: fmul
     150: f2d
     151: dadd
     152: ldc2_w        #68                 // double 6.8d
     155: aload_0
     156: getfield      #33                 // Field age:Ljava/lang/Number;
     159: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     162: f2d
     163: dmul
     164: dsub
     165: invokestatic  #75                 // Method java/lang/Math.rint:(D)D
     168: goto          228
     171: sipush        655
     174: i2d
     175: ldc2_w        #76                 // double 9.6d
     178: aload_0
     179: getfield      #38                 // Field weight:Ljava/lang/Number;
     182: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     185: f2d
     186: dmul
     187: dadd
     188: ldc2_w        #78                 // double 1.8d
     191: aload_0
     192: getfield      #40                 // Field height:Ljava/lang/Number;
     195: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     198: f2d
     199: dmul
     200: dadd
     201: ldc2_w        #80                 // double 4.7d
     204: aload_0
     205: getfield      #33                 // Field age:Ljava/lang/Number;
     208: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     211: f2d
     212: dmul
     213: dsub
     214: invokestatic  #75                 // Method java/lang/Math.rint:(D)D
     217: goto          228
     220: new           #83                 // class kotlin/NoWhenBranchMatchedException
     223: dup
     224: invokespecial #84                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     227: athrow
     228: putfield      #88                 // Field bmr:D
     231: aload_0
     232: aload_0
     233: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
     236: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     239: f2d
     240: aload_0
     241: getfield      #88                 // Field bmr:D
     244: dmul
     245: invokestatic  #75                 // Method java/lang/Math.rint:(D)D
     248: putfield      #91                 // Field tdee:D
     251: aload_0
     252: aload_0
     253: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
     256: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     259: bipush        10
     261: i2f
     262: fdiv
     263: sipush        7000
     266: i2f
     267: fmul
     268: bipush        7
     270: i2f
     271: fdiv
     272: putfield      #95                 // Field deficit:F
     275: aload_0
     276: aload_0
     277: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
     280: getstatic     #98                 // Field io/tohuwabohu/calc/Tdee$WhenMappings.$EnumSwitchMapping$1:[I
     283: swap
     284: invokevirtual #101                // Method io/tohuwabohu/calc/CalculationGoal.ordinal:()I
     287: iaload
     288: tableswitch   { // 1 to 2
                     1: 312
                     2: 325
               default: 338
          }
     312: aload_0
     313: getfield      #91                 // Field tdee:D
     316: d2f
     317: aload_0
     318: getfield      #95                 // Field deficit:F
     321: fadd
     322: goto          346
     325: aload_0
     326: getfield      #91                 // Field tdee:D
     329: d2f
     330: aload_0
     331: getfield      #95                 // Field deficit:F
     334: fsub
     335: goto          346
     338: new           #83                 // class kotlin/NoWhenBranchMatchedException
     341: dup
     342: invokespecial #84                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     345: athrow
     346: putfield      #104                // Field target:F
     349: aload_0
     350: aload_0
     351: getfield      #38                 // Field weight:Ljava/lang/Number;
     354: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     357: aload_0
     358: getfield      #40                 // Field height:Ljava/lang/Number;
     361: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
     364: bipush        100
     366: i2f
     367: fdiv
     368: f2d
     369: iconst_2
     370: i2d
     371: invokestatic  #108                // Method java/lang/Math.pow:(DD)D
     374: d2f
     375: fdiv
     376: f2d
     377: invokestatic  #75                 // Method java/lang/Math.rint:(D)D
     380: d2f
     381: putfield      #111                // Field bmi:F
     384: aload_0
     385: aload_0
     386: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
     389: getstatic     #53                 // Field io/tohuwabohu/calc/Tdee$WhenMappings.$EnumSwitchMapping$0:[I
     392: swap
     393: invokevirtual #59                 // Method io/tohuwabohu/calc/CalculationSex.ordinal:()I
     396: iaload
     397: tableswitch   { // 1 to 2
                     1: 567
                     2: 420
               default: 714
          }
     420: aload_0
     421: getfield      #111                // Field bmi:F
     424: fstore        10
     426: fconst_0
     427: fload         10
     429: fcmpg
     430: ifgt          449
     433: fload         10
     435: ldc           #112                // float 18.0f
     437: fcmpg
     438: ifgt          445
     441: iconst_1
     442: goto          450
     445: iconst_0
     446: goto          450
     449: iconst_0
     450: ifeq          459
     453: getstatic     #118                // Field io/tohuwabohu/calc/BmiCategory.UNDERWEIGHT:Lio/tohuwabohu/calc/BmiCategory;
     456: goto          722
     459: ldc           #119                // float 19.0f
     461: fload         10
     463: fcmpg
     464: ifgt          483
     467: fload         10
     469: ldc           #120                // float 24.0f
     471: fcmpg
     472: ifgt          479
     475: iconst_1
     476: goto          484
     479: iconst_0
     480: goto          484
     483: iconst_0
     484: ifeq          493
     487: getstatic     #123                // Field io/tohuwabohu/calc/BmiCategory.STANDARD_WEIGHT:Lio/tohuwabohu/calc/BmiCategory;
     490: goto          722
     493: ldc           #124                // float 25.0f
     495: fload         10
     497: fcmpg
     498: ifgt          517
     501: fload         10
     503: ldc           #125                // float 30.0f
     505: fcmpg
     506: ifgt          513
     509: iconst_1
     510: goto          518
     513: iconst_0
     514: goto          518
     517: iconst_0
     518: ifeq          527
     521: getstatic     #128                // Field io/tohuwabohu/calc/BmiCategory.OVERWEIGHT:Lio/tohuwabohu/calc/BmiCategory;
     524: goto          722
     527: ldc           #129                // float 31.0f
     529: fload         10
     531: fcmpg
     532: ifgt          551
     535: fload         10
     537: ldc           #130                // float 40.0f
     539: fcmpg
     540: ifgt          547
     543: iconst_1
     544: goto          552
     547: iconst_0
     548: goto          552
     551: iconst_0
     552: ifeq          561
     555: getstatic     #133                // Field io/tohuwabohu/calc/BmiCategory.OBESE:Lio/tohuwabohu/calc/BmiCategory;
     558: goto          722
     561: getstatic     #136                // Field io/tohuwabohu/calc/BmiCategory.SEVERELY_OBESE:Lio/tohuwabohu/calc/BmiCategory;
     564: goto          722
     567: aload_0
     568: getfield      #111                // Field bmi:F
     571: fstore        10
     573: fconst_0
     574: fload         10
     576: fcmpg
     577: ifgt          596
     580: fload         10
     582: ldc           #119                // float 19.0f
     584: fcmpg
     585: ifgt          592
     588: iconst_1
     589: goto          597
     592: iconst_0
     593: goto          597
     596: iconst_0
     597: ifeq          606
     600: getstatic     #118                // Field io/tohuwabohu/calc/BmiCategory.UNDERWEIGHT:Lio/tohuwabohu/calc/BmiCategory;
     603: goto          722
     606: ldc           #137                // float 20.0f
     608: fload         10
     610: fcmpg
     611: ifgt          630
     614: fload         10
     616: ldc           #124                // float 25.0f
     618: fcmpg
     619: ifgt          626
     622: iconst_1
     623: goto          631
     626: iconst_0
     627: goto          631
     630: iconst_0
     631: ifeq          640
     634: getstatic     #123                // Field io/tohuwabohu/calc/BmiCategory.STANDARD_WEIGHT:Lio/tohuwabohu/calc/BmiCategory;
     637: goto          722
     640: ldc           #138                // float 26.0f
     642: fload         10
     644: fcmpg
     645: ifgt          664
     648: fload         10
     650: ldc           #125                // float 30.0f
     652: fcmpg
     653: ifgt          660
     656: iconst_1
     657: goto          665
     660: iconst_0
     661: goto          665
     664: iconst_0
     665: ifeq          674
     668: getstatic     #128                // Field io/tohuwabohu/calc/BmiCategory.OVERWEIGHT:Lio/tohuwabohu/calc/BmiCategory;
     671: goto          722
     674: ldc           #129                // float 31.0f
     676: fload         10
     678: fcmpg
     679: ifgt          698
     682: fload         10
     684: ldc           #130                // float 40.0f
     686: fcmpg
     687: ifgt          694
     690: iconst_1
     691: goto          699
     694: iconst_0
     695: goto          699
     698: iconst_0
     699: ifeq          708
     702: getstatic     #133                // Field io/tohuwabohu/calc/BmiCategory.OBESE:Lio/tohuwabohu/calc/BmiCategory;
     705: goto          722
     708: getstatic     #136                // Field io/tohuwabohu/calc/BmiCategory.SEVERELY_OBESE:Lio/tohuwabohu/calc/BmiCategory;
     711: goto          722
     714: new           #83                 // class kotlin/NoWhenBranchMatchedException
     717: dup
     718: invokespecial #84                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
     721: athrow
     722: putfield      #141                // Field bmiCategory:Lio/tohuwabohu/calc/BmiCategory;
     725: aload_0
     726: aload_0
     727: getfield      #33                 // Field age:Ljava/lang/Number;
     730: astore        8
     732: new           #143                // class kotlin/ranges/IntRange
     735: dup
     736: bipush        19
     738: bipush        24
     740: invokespecial #146                // Method kotlin/ranges/IntRange."<init>":(II)V
     743: checkcast     #148                // class java/lang/Iterable
     746: aload         8
     748: invokestatic  #154                // Method kotlin/collections/CollectionsKt.contains:(Ljava/lang/Iterable;Ljava/lang/Object;)Z
     751: ifeq          783
     754: iconst_2
     755: anewarray     #156                // class java/lang/Integer
     758: astore        9
     760: aload         9
     762: iconst_0
     763: bipush        19
     765: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     768: aastore
     769: aload         9
     771: iconst_1
     772: bipush        24
     774: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     777: aastore
     778: aload         9
     780: goto          1013
     783: new           #143                // class kotlin/ranges/IntRange
     786: dup
     787: bipush        25
     789: bipush        34
     791: invokespecial #146                // Method kotlin/ranges/IntRange."<init>":(II)V
     794: checkcast     #148                // class java/lang/Iterable
     797: aload         8
     799: invokestatic  #154                // Method kotlin/collections/CollectionsKt.contains:(Ljava/lang/Iterable;Ljava/lang/Object;)Z
     802: ifeq          834
     805: iconst_2
     806: anewarray     #156                // class java/lang/Integer
     809: astore        9
     811: aload         9
     813: iconst_0
     814: bipush        20
     816: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     819: aastore
     820: aload         9
     822: iconst_1
     823: bipush        25
     825: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     828: aastore
     829: aload         9
     831: goto          1013
     834: new           #143                // class kotlin/ranges/IntRange
     837: dup
     838: bipush        35
     840: bipush        44
     842: invokespecial #146                // Method kotlin/ranges/IntRange."<init>":(II)V
     845: checkcast     #148                // class java/lang/Iterable
     848: aload         8
     850: invokestatic  #154                // Method kotlin/collections/CollectionsKt.contains:(Ljava/lang/Iterable;Ljava/lang/Object;)Z
     853: ifeq          885
     856: iconst_2
     857: anewarray     #156                // class java/lang/Integer
     860: astore        9
     862: aload         9
     864: iconst_0
     865: bipush        21
     867: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     870: aastore
     871: aload         9
     873: iconst_1
     874: bipush        26
     876: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     879: aastore
     880: aload         9
     882: goto          1013
     885: new           #143                // class kotlin/ranges/IntRange
     888: dup
     889: bipush        45
     891: bipush        54
     893: invokespecial #146                // Method kotlin/ranges/IntRange."<init>":(II)V
     896: checkcast     #148                // class java/lang/Iterable
     899: aload         8
     901: invokestatic  #154                // Method kotlin/collections/CollectionsKt.contains:(Ljava/lang/Iterable;Ljava/lang/Object;)Z
     904: ifeq          936
     907: iconst_2
     908: anewarray     #156                // class java/lang/Integer
     911: astore        9
     913: aload         9
     915: iconst_0
     916: bipush        22
     918: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     921: aastore
     922: aload         9
     924: iconst_1
     925: bipush        27
     927: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     930: aastore
     931: aload         9
     933: goto          1013
     936: new           #143                // class kotlin/ranges/IntRange
     939: dup
     940: bipush        55
     942: bipush        64
     944: invokespecial #146                // Method kotlin/ranges/IntRange."<init>":(II)V
     947: checkcast     #148                // class java/lang/Iterable
     950: aload         8
     952: invokestatic  #154                // Method kotlin/collections/CollectionsKt.contains:(Ljava/lang/Iterable;Ljava/lang/Object;)Z
     955: ifeq          987
     958: iconst_2
     959: anewarray     #156                // class java/lang/Integer
     962: astore        9
     964: aload         9
     966: iconst_0
     967: bipush        23
     969: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     972: aastore
     973: aload         9
     975: iconst_1
     976: bipush        28
     978: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     981: aastore
     982: aload         9
     984: goto          1013
     987: iconst_2
     988: anewarray     #156                // class java/lang/Integer
     991: astore        9
     993: aload         9
     995: iconst_0
     996: bipush        24
     998: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1001: aastore
    1002: aload         9
    1004: iconst_1
    1005: bipush        29
    1007: invokestatic  #160                // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    1010: aastore
    1011: aload         9
    1013: putfield      #164                // Field targetBmi:[Ljava/lang/Integer;
    1016: aload_0
    1017: aload_0
    1018: getfield      #164                // Field targetBmi:[Ljava/lang/Integer;
    1021: iconst_0
    1022: aaload
    1023: invokevirtual #167                // Method java/lang/Integer.intValue:()I
    1026: aload_0
    1027: getfield      #164                // Field targetBmi:[Ljava/lang/Integer;
    1030: iconst_1
    1031: aaload
    1032: invokevirtual #167                // Method java/lang/Integer.intValue:()I
    1035: iadd
    1036: i2f
    1037: iconst_2
    1038: i2f
    1039: fdiv
    1040: aload_0
    1041: getfield      #40                 // Field height:Ljava/lang/Number;
    1044: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
    1047: bipush        100
    1049: i2f
    1050: fdiv
    1051: f2d
    1052: iconst_2
    1053: i2d
    1054: invokestatic  #108                // Method java/lang/Math.pow:(DD)D
    1057: d2f
    1058: fmul
    1059: f2d
    1060: invokestatic  #75                 // Method java/lang/Math.rint:(D)D
    1063: d2f
    1064: putfield      #170                // Field targetWeight:F
    1067: aload_0
    1068: aload_0
    1069: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
    1072: getstatic     #98                 // Field io/tohuwabohu/calc/Tdee$WhenMappings.$EnumSwitchMapping$1:[I
    1075: swap
    1076: invokevirtual #101                // Method io/tohuwabohu/calc/CalculationGoal.ordinal:()I
    1079: iaload
    1080: tableswitch   { // 1 to 2
                     1: 1104
                     2: 1129
               default: 1154
          }
    1104: aload_0
    1105: getfield      #170                // Field targetWeight:F
    1108: aload_0
    1109: getfield      #38                 // Field weight:Ljava/lang/Number;
    1112: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
    1115: fsub
    1116: sipush        7000
    1119: i2f
    1120: fmul
    1121: aload_0
    1122: getfield      #95                 // Field deficit:F
    1125: fdiv
    1126: goto          1162
    1129: aload_0
    1130: getfield      #38                 // Field weight:Ljava/lang/Number;
    1133: invokevirtual #67                 // Method java/lang/Number.floatValue:()F
    1136: aload_0
    1137: getfield      #170                // Field targetWeight:F
    1140: fsub
    1141: sipush        7000
    1144: i2f
    1145: fmul
    1146: aload_0
    1147: getfield      #95                 // Field deficit:F
    1150: fdiv
    1151: goto          1162
    1154: new           #83                 // class kotlin/NoWhenBranchMatchedException
    1157: dup
    1158: invokespecial #84                 // Method kotlin/NoWhenBranchMatchedException."<init>":()V
    1161: athrow
    1162: putfield      #173                // Field durationDays:F
    1165: return

  public final java.lang.Number getAge();
    Code:
       0: aload_0
       1: getfield      #33                 // Field age:Ljava/lang/Number;
       4: areturn

  public final io.tohuwabohu.calc.CalculationSex getSex();
    Code:
       0: aload_0
       1: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
       4: areturn

  public final java.lang.Number getWeight();
    Code:
       0: aload_0
       1: getfield      #38                 // Field weight:Ljava/lang/Number;
       4: areturn

  public final java.lang.Number getHeight();
    Code:
       0: aload_0
       1: getfield      #40                 // Field height:Ljava/lang/Number;
       4: areturn

  public final java.lang.Number getActivityLevel();
    Code:
       0: aload_0
       1: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
       4: areturn

  public final java.lang.Number getWeeklyDifference();
    Code:
       0: aload_0
       1: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
       4: areturn

  public final io.tohuwabohu.calc.CalculationGoal getCalculationGoal();
    Code:
       0: aload_0
       1: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
       4: areturn

  public final double getBmr();
    Code:
       0: aload_0
       1: getfield      #88                 // Field bmr:D
       4: dreturn

  public final double getTdee();
    Code:
       0: aload_0
       1: getfield      #91                 // Field tdee:D
       4: dreturn

  public final float getDeficit();
    Code:
       0: aload_0
       1: getfield      #95                 // Field deficit:F
       4: freturn

  public final float getTarget();
    Code:
       0: aload_0
       1: getfield      #104                // Field target:F
       4: freturn

  public final float getBmi();
    Code:
       0: aload_0
       1: getfield      #111                // Field bmi:F
       4: freturn

  public final io.tohuwabohu.calc.BmiCategory getBmiCategory();
    Code:
       0: aload_0
       1: getfield      #141                // Field bmiCategory:Lio/tohuwabohu/calc/BmiCategory;
       4: areturn

  public final java.lang.Integer[] getTargetBmi();
    Code:
       0: aload_0
       1: getfield      #164                // Field targetBmi:[Ljava/lang/Integer;
       4: areturn

  public final float getTargetWeight();
    Code:
       0: aload_0
       1: getfield      #170                // Field targetWeight:F
       4: freturn

  public final float getDurationDays();
    Code:
       0: aload_0
       1: getfield      #173                // Field durationDays:F
       4: freturn

  public final java.lang.Number component1();
    Code:
       0: aload_0
       1: getfield      #33                 // Field age:Ljava/lang/Number;
       4: areturn

  public final io.tohuwabohu.calc.CalculationSex component2();
    Code:
       0: aload_0
       1: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
       4: areturn

  public final java.lang.Number component3();
    Code:
       0: aload_0
       1: getfield      #38                 // Field weight:Ljava/lang/Number;
       4: areturn

  public final java.lang.Number component4();
    Code:
       0: aload_0
       1: getfield      #40                 // Field height:Ljava/lang/Number;
       4: areturn

  public final java.lang.Number component5();
    Code:
       0: aload_0
       1: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
       4: areturn

  public final java.lang.Number component6();
    Code:
       0: aload_0
       1: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
       4: areturn

  public final io.tohuwabohu.calc.CalculationGoal component7();
    Code:
       0: aload_0
       1: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
       4: areturn

  public final io.tohuwabohu.calc.Tdee copy(java.lang.Number, io.tohuwabohu.calc.CalculationSex, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, io.tohuwabohu.calc.CalculationGoal);
    Code:
       0: aload_1
       1: ldc           #9                  // String age
       3: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #17                 // String sex
       9: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_3
      13: ldc           #19                 // String weight
      15: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      18: aload         4
      20: ldc           #21                 // String height
      22: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      25: aload         5
      27: ldc           #23                 // String activityLevel
      29: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      32: aload         6
      34: ldc           #25                 // String weeklyDifference
      36: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      39: aload         7
      41: ldc           #27                 // String calculationGoal
      43: invokestatic  #15                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      46: new           #2                  // class io/tohuwabohu/calc/Tdee
      49: dup
      50: aload_1
      51: aload_2
      52: aload_3
      53: aload         4
      55: aload         5
      57: aload         6
      59: aload         7
      61: invokespecial #209                // Method "<init>":(Ljava/lang/Number;Lio/tohuwabohu/calc/CalculationSex;Ljava/lang/Number;Ljava/lang/Number;Ljava/lang/Number;Ljava/lang/Number;Lio/tohuwabohu/calc/CalculationGoal;)V
      64: areturn

  public static io.tohuwabohu.calc.Tdee copy$default(io.tohuwabohu.calc.Tdee, java.lang.Number, io.tohuwabohu.calc.CalculationSex, java.lang.Number, java.lang.Number, java.lang.Number, java.lang.Number, io.tohuwabohu.calc.CalculationGoal, int, java.lang.Object);
    Code:
       0: iload         8
       2: iconst_1
       3: iand
       4: ifeq          12
       7: aload_0
       8: getfield      #33                 // Field age:Ljava/lang/Number;
      11: astore_1
      12: iload         8
      14: iconst_2
      15: iand
      16: ifeq          24
      19: aload_0
      20: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      23: astore_2
      24: iload         8
      26: iconst_4
      27: iand
      28: ifeq          36
      31: aload_0
      32: getfield      #38                 // Field weight:Ljava/lang/Number;
      35: astore_3
      36: iload         8
      38: bipush        8
      40: iand
      41: ifeq          50
      44: aload_0
      45: getfield      #40                 // Field height:Ljava/lang/Number;
      48: astore        4
      50: iload         8
      52: bipush        16
      54: iand
      55: ifeq          64
      58: aload_0
      59: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
      62: astore        5
      64: iload         8
      66: bipush        32
      68: iand
      69: ifeq          78
      72: aload_0
      73: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
      76: astore        6
      78: iload         8
      80: bipush        64
      82: iand
      83: ifeq          92
      86: aload_0
      87: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
      90: astore        7
      92: aload_0
      93: aload_1
      94: aload_2
      95: aload_3
      96: aload         4
      98: aload         5
     100: aload         6
     102: aload         7
     104: invokevirtual #213                // Method copy:(Ljava/lang/Number;Lio/tohuwabohu/calc/CalculationSex;Ljava/lang/Number;Ljava/lang/Number;Ljava/lang/Number;Ljava/lang/Number;Lio/tohuwabohu/calc/CalculationGoal;)Lio/tohuwabohu/calc/Tdee;
     107: areturn

  public java.lang.String toString();
    Code:
       0: new           #217                // class java/lang/StringBuilder
       3: dup
       4: invokespecial #218                // Method java/lang/StringBuilder."<init>":()V
       7: ldc           #220                // String Tdee(age=
       9: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      12: aload_0
      13: getfield      #33                 // Field age:Ljava/lang/Number;
      16: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      19: ldc           #229                // String , sex=
      21: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      24: aload_0
      25: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      28: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      31: ldc           #231                // String , weight=
      33: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      36: aload_0
      37: getfield      #38                 // Field weight:Ljava/lang/Number;
      40: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      43: ldc           #233                // String , height=
      45: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      48: aload_0
      49: getfield      #40                 // Field height:Ljava/lang/Number;
      52: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      55: ldc           #235                // String , activityLevel=
      57: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      60: aload_0
      61: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
      64: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      67: ldc           #237                // String , weeklyDifference=
      69: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      72: aload_0
      73: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
      76: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      79: ldc           #239                // String , calculationGoal=
      81: invokevirtual #224                // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
      84: aload_0
      85: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
      88: invokevirtual #227                // Method java/lang/StringBuilder.append:(Ljava/lang/Object;)Ljava/lang/StringBuilder;
      91: bipush        41
      93: invokevirtual #242                // Method java/lang/StringBuilder.append:(C)Ljava/lang/StringBuilder;
      96: invokevirtual #244                // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
      99: areturn

  public int hashCode();
    Code:
       0: aload_0
       1: getfield      #33                 // Field age:Ljava/lang/Number;
       4: invokevirtual #247                // Method java/lang/Number.hashCode:()I
       7: istore_1
       8: iload_1
       9: bipush        31
      11: imul
      12: aload_0
      13: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      16: invokevirtual #248                // Method io/tohuwabohu/calc/CalculationSex.hashCode:()I
      19: iadd
      20: istore_1
      21: iload_1
      22: bipush        31
      24: imul
      25: aload_0
      26: getfield      #38                 // Field weight:Ljava/lang/Number;
      29: invokevirtual #247                // Method java/lang/Number.hashCode:()I
      32: iadd
      33: istore_1
      34: iload_1
      35: bipush        31
      37: imul
      38: aload_0
      39: getfield      #40                 // Field height:Ljava/lang/Number;
      42: invokevirtual #247                // Method java/lang/Number.hashCode:()I
      45: iadd
      46: istore_1
      47: iload_1
      48: bipush        31
      50: imul
      51: aload_0
      52: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
      55: invokevirtual #247                // Method java/lang/Number.hashCode:()I
      58: iadd
      59: istore_1
      60: iload_1
      61: bipush        31
      63: imul
      64: aload_0
      65: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
      68: invokevirtual #247                // Method java/lang/Number.hashCode:()I
      71: iadd
      72: istore_1
      73: iload_1
      74: bipush        31
      76: imul
      77: aload_0
      78: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
      81: invokevirtual #249                // Method io/tohuwabohu/calc/CalculationGoal.hashCode:()I
      84: iadd
      85: istore_1
      86: iload_1
      87: ireturn

  public boolean equals(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: if_acmpne     7
       5: iconst_1
       6: ireturn
       7: aload_1
       8: instanceof    #2                  // class io/tohuwabohu/calc/Tdee
      11: ifne          16
      14: iconst_0
      15: ireturn
      16: aload_1
      17: checkcast     #2                  // class io/tohuwabohu/calc/Tdee
      20: astore_2
      21: aload_0
      22: getfield      #33                 // Field age:Ljava/lang/Number;
      25: aload_2
      26: getfield      #33                 // Field age:Ljava/lang/Number;
      29: invokestatic  #258                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      32: ifne          37
      35: iconst_0
      36: ireturn
      37: aload_0
      38: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      41: aload_2
      42: getfield      #36                 // Field sex:Lio/tohuwabohu/calc/CalculationSex;
      45: if_acmpeq     50
      48: iconst_0
      49: ireturn
      50: aload_0
      51: getfield      #38                 // Field weight:Ljava/lang/Number;
      54: aload_2
      55: getfield      #38                 // Field weight:Ljava/lang/Number;
      58: invokestatic  #258                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      61: ifne          66
      64: iconst_0
      65: ireturn
      66: aload_0
      67: getfield      #40                 // Field height:Ljava/lang/Number;
      70: aload_2
      71: getfield      #40                 // Field height:Ljava/lang/Number;
      74: invokestatic  #258                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      77: ifne          82
      80: iconst_0
      81: ireturn
      82: aload_0
      83: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
      86: aload_2
      87: getfield      #42                 // Field activityLevel:Ljava/lang/Number;
      90: invokestatic  #258                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
      93: ifne          98
      96: iconst_0
      97: ireturn
      98: aload_0
      99: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
     102: aload_2
     103: getfield      #44                 // Field weeklyDifference:Ljava/lang/Number;
     106: invokestatic  #258                // Method kotlin/jvm/internal/Intrinsics.areEqual:(Ljava/lang/Object;Ljava/lang/Object;)Z
     109: ifne          114
     112: iconst_0
     113: ireturn
     114: aload_0
     115: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
     118: aload_2
     119: getfield      #47                 // Field calculationGoal:Lio/tohuwabohu/calc/CalculationGoal;
     122: if_acmpeq     127
     125: iconst_0
     126: ireturn
     127: iconst_1
     128: ireturn
}


package com.ahmedzenhom.problem_solving.cf_892_2_b

var input =
        mutableListOf<String>( // Not to be included in your submitting
                "3",
                "2",
                "2",
                "1 2",
                "2",
                "4 3",
                "1",
                "3",
                "100 1 6",
                "3",
                "4",
                "1001 7 1007 5",
                "3",
                "8 11 6",
                "2",
                "2 9"
        )

fun readLine(): String? { // Not to be included in your submitting
    val line = input.firstOrNull()
    input.removeAt(0)
    return line
}

// You answer goes here

fun main() {
    val tests = readLine()?.toInt()!!
    repeat(tests) {
        val noOfarrays = readLine()?.toInt()!!
        val arrays = mutableListOf<List<Long>>()
        var minFirst = -1L
        var minSecond = Pair(-1L, -1L)

        for (i in 0 until noOfarrays) {
            readLine()
            val array = readLine()!!.split(" ").toList().map { it.toLong() }.sorted()
            arrays.add(array)
            val firstSmallest = array[0]
            if (minFirst == -1L || firstSmallest < minFirst) {
                minFirst = firstSmallest
            }
            val secondSmallest = array[1]
            if (minSecond.first == -1L || secondSmallest < minSecond.second) {
                minSecond = Pair(i.toLong(), secondSmallest)
            }
        }

        var sum = 0L
        for (i in 0 until noOfarrays) {
            sum += (if (i.toLong() != minSecond.first) arrays[i][1] else minFirst)
        }
        println(sum)
    }
}

Compiled from "CF_892_2_B.kt"
public final class com.ahmedzenhom.problem_solving.cf_892_2_b.CF_892_2_BKt {
  private static java.util.List<java.lang.String> input;

  public static final java.util.List<java.lang.String> getInput();
    Code:
       0: getstatic     #12                 // Field input:Ljava/util/List;
       3: areturn

  public static final void setInput(java.util.List<java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #17                 // String <set-?>
       3: invokestatic  #23                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: putstatic     #12                 // Field input:Ljava/util/List;
      10: return

  public static final java.lang.String readLine();
    Code:
       0: getstatic     #12                 // Field input:Ljava/util/List;
       3: invokestatic  #32                 // Method kotlin/collections/CollectionsKt.firstOrNull:(Ljava/util/List;)Ljava/lang/Object;
       6: checkcast     #34                 // class java/lang/String
       9: astore_0
      10: getstatic     #12                 // Field input:Ljava/util/List;
      13: iconst_0
      14: invokeinterface #40,  2           // InterfaceMethod java/util/List.remove:(I)Ljava/lang/Object;
      19: pop
      20: aload_0
      21: areturn

  public static final void main();
    Code:
       0: invokestatic  #46                 // Method readLine:()Ljava/lang/String;
       3: dup
       4: ifnull        16
       7: invokestatic  #52                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      10: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      13: goto          18
      16: pop
      17: aconst_null
      18: dup
      19: invokestatic  #60                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      22: invokevirtual #64                 // Method java/lang/Integer.intValue:()I
      25: istore_0
      26: iconst_0
      27: istore_1
      28: iload_1
      29: iload_0
      30: if_icmpge     475
      33: iload_1
      34: istore_2
      35: iconst_0
      36: istore_3
      37: invokestatic  #46                 // Method readLine:()Ljava/lang/String;
      40: dup
      41: ifnull        53
      44: invokestatic  #52                 // Method java/lang/Integer.parseInt:(Ljava/lang/String;)I
      47: invokestatic  #56                 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      50: goto          55
      53: pop
      54: aconst_null
      55: dup
      56: invokestatic  #60                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
      59: invokevirtual #64                 // Method java/lang/Integer.intValue:()I
      62: istore        4
      64: new           #66                 // class java/util/ArrayList
      67: dup
      68: invokespecial #69                 // Method java/util/ArrayList."<init>":()V
      71: checkcast     #36                 // class java/util/List
      74: astore        5
      76: ldc2_w        #70                 // long -1l
      79: lstore        6
      81: new           #73                 // class kotlin/Pair
      84: dup
      85: ldc2_w        #70                 // long -1l
      88: invokestatic  #78                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      91: ldc2_w        #70                 // long -1l
      94: invokestatic  #78                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      97: invokespecial #81                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     100: astore        8
     102: iconst_0
     103: istore        9
     105: iload         9
     107: iload         4
     109: if_icmpge     389
     112: invokestatic  #46                 // Method readLine:()Ljava/lang/String;
     115: pop
     116: invokestatic  #46                 // Method readLine:()Ljava/lang/String;
     119: dup
     120: invokestatic  #60                 // Method kotlin/jvm/internal/Intrinsics.checkNotNull:(Ljava/lang/Object;)V
     123: checkcast     #83                 // class java/lang/CharSequence
     126: iconst_1
     127: anewarray     #34                 // class java/lang/String
     130: astore        10
     132: aload         10
     134: iconst_0
     135: ldc           #85                 // String
     137: aastore
     138: aload         10
     140: iconst_0
     141: iconst_0
     142: bipush        6
     144: aconst_null
     145: invokestatic  #91                 // Method kotlin/text/StringsKt.split$default:(Ljava/lang/CharSequence;[Ljava/lang/String;ZIILjava/lang/Object;)Ljava/util/List;
     148: checkcast     #93                 // class java/lang/Iterable
     151: invokestatic  #97                 // Method kotlin/collections/CollectionsKt.toList:(Ljava/lang/Iterable;)Ljava/util/List;
     154: checkcast     #93                 // class java/lang/Iterable
     157: astore        10
     159: iconst_0
     160: istore        11
     162: aload         10
     164: astore        12
     166: new           #66                 // class java/util/ArrayList
     169: dup
     170: aload         10
     172: bipush        10
     174: invokestatic  #101                // Method kotlin/collections/CollectionsKt.collectionSizeOrDefault:(Ljava/lang/Iterable;I)I
     177: invokespecial #104                // Method java/util/ArrayList."<init>":(I)V
     180: checkcast     #106                // class java/util/Collection
     183: astore        13
     185: iconst_0
     186: istore        14
     188: aload         12
     190: invokeinterface #110,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
     195: astore        15
     197: aload         15
     199: invokeinterface #116,  1          // InterfaceMethod java/util/Iterator.hasNext:()Z
     204: ifeq          251
     207: aload         15
     209: invokeinterface #120,  1          // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
     214: astore        16
     216: aload         13
     218: aload         16
     220: checkcast     #34                 // class java/lang/String
     223: astore        17
     225: astore        18
     227: iconst_0
     228: istore        19
     230: aload         17
     232: invokestatic  #124                // Method java/lang/Long.parseLong:(Ljava/lang/String;)J
     235: nop
     236: invokestatic  #78                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     239: aload         18
     241: swap
     242: invokeinterface #128,  2          // InterfaceMethod java/util/Collection.add:(Ljava/lang/Object;)Z
     247: pop
     248: goto          197
     251: aload         13
     253: checkcast     #36                 // class java/util/List
     256: nop
     257: checkcast     #93                 // class java/lang/Iterable
     260: invokestatic  #131                // Method kotlin/collections/CollectionsKt.sorted:(Ljava/lang/Iterable;)Ljava/util/List;
     263: astore        20
     265: aload         5
     267: aload         20
     269: invokeinterface #132,  2          // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
     274: pop
     275: aload         20
     277: iconst_0
     278: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     283: checkcast     #137                // class java/lang/Number
     286: invokevirtual #141                // Method java/lang/Number.longValue:()J
     289: lstore        21
     291: lload         6
     293: ldc2_w        #70                 // long -1l
     296: lcmp
     297: ifeq          308
     300: lload         21
     302: lload         6
     304: lcmp
     305: ifge          312
     308: lload         21
     310: lstore        6
     312: aload         20
     314: iconst_1
     315: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     320: checkcast     #137                // class java/lang/Number
     323: invokevirtual #141                // Method java/lang/Number.longValue:()J
     326: lstore        23
     328: aload         8
     330: invokevirtual #144                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     333: checkcast     #137                // class java/lang/Number
     336: invokevirtual #141                // Method java/lang/Number.longValue:()J
     339: ldc2_w        #70                 // long -1l
     342: lcmp
     343: ifeq          363
     346: lload         23
     348: aload         8
     350: invokevirtual #147                // Method kotlin/Pair.getSecond:()Ljava/lang/Object;
     353: checkcast     #137                // class java/lang/Number
     356: invokevirtual #141                // Method java/lang/Number.longValue:()J
     359: lcmp
     360: ifge          383
     363: new           #73                 // class kotlin/Pair
     366: dup
     367: iload         9
     369: i2l
     370: invokestatic  #78                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     373: lload         23
     375: invokestatic  #78                 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
     378: invokespecial #81                 // Method kotlin/Pair."<init>":(Ljava/lang/Object;Ljava/lang/Object;)V
     381: astore        8
     383: iinc          9, 1
     386: goto          105
     389: lconst_0
     390: lstore        25
     392: iconst_0
     393: istore        10
     395: iload         10
     397: iload         4
     399: if_icmpge     460
     402: lload         25
     404: iload         10
     406: i2l
     407: aload         8
     409: invokevirtual #144                // Method kotlin/Pair.getFirst:()Ljava/lang/Object;
     412: checkcast     #137                // class java/lang/Number
     415: invokevirtual #141                // Method java/lang/Number.longValue:()J
     418: lcmp
     419: ifeq          449
     422: aload         5
     424: iload         10
     426: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     431: checkcast     #36                 // class java/util/List
     434: iconst_1
     435: invokeinterface #135,  2          // InterfaceMethod java/util/List.get:(I)Ljava/lang/Object;
     440: checkcast     #137                // class java/lang/Number
     443: invokevirtual #141                // Method java/lang/Number.longValue:()J
     446: goto          451
     449: lload         6
     451: ladd
     452: lstore        25
     454: iinc          10, 1
     457: goto          395
     460: getstatic     #153                // Field java/lang/System.out:Ljava/io/PrintStream;
     463: lload         25
     465: invokevirtual #159                // Method java/io/PrintStream.println:(J)V
     468: nop
     469: iinc          1, 1
     472: goto          28
     475: return

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

  static {};
    Code:
       0: bipush        16
       2: anewarray     #34                 // class java/lang/String
       5: astore_0
       6: aload_0
       7: iconst_0
       8: ldc           #192                // String 3
      10: aastore
      11: aload_0
      12: iconst_1
      13: ldc           #194                // String 2
      15: aastore
      16: aload_0
      17: iconst_2
      18: ldc           #194                // String 2
      20: aastore
      21: aload_0
      22: iconst_3
      23: ldc           #196                // String 1 2
      25: aastore
      26: aload_0
      27: iconst_4
      28: ldc           #194                // String 2
      30: aastore
      31: aload_0
      32: iconst_5
      33: ldc           #198                // String 4 3
      35: aastore
      36: aload_0
      37: bipush        6
      39: ldc           #200                // String 1
      41: aastore
      42: aload_0
      43: bipush        7
      45: ldc           #192                // String 3
      47: aastore
      48: aload_0
      49: bipush        8
      51: ldc           #202                // String 100 1 6
      53: aastore
      54: aload_0
      55: bipush        9
      57: ldc           #192                // String 3
      59: aastore
      60: aload_0
      61: bipush        10
      63: ldc           #204                // String 4
      65: aastore
      66: aload_0
      67: bipush        11
      69: ldc           #206                // String 1001 7 1007 5
      71: aastore
      72: aload_0
      73: bipush        12
      75: ldc           #192                // String 3
      77: aastore
      78: aload_0
      79: bipush        13
      81: ldc           #208                // String 8 11 6
      83: aastore
      84: aload_0
      85: bipush        14
      87: ldc           #194                // String 2
      89: aastore
      90: aload_0
      91: bipush        15
      93: ldc           #210                // String 2 9
      95: aastore
      96: aload_0
      97: invokestatic  #214                // Method kotlin/collections/CollectionsKt.mutableListOf:([Ljava/lang/Object;)Ljava/util/List;
     100: putstatic     #12                 // Field input:Ljava/util/List;
     103: return
}


package com.minhiew.translation

object Analyzer {
    fun compare(androidStrings: Map<String, String>, iosStrings: Map<String, String>): LocalizationReport {
        return LocalizationReport(
            uniqueAndroidStrings = androidStrings.filterForKeysNotPresentIn(iosStrings),
            uniqueIosStrings = iosStrings.filterForKeysNotPresentIn(androidStrings),
            commonAndroidStrings = androidStrings.filterForMatchingKeysIn(iosStrings),
            commonIosStrings = iosStrings.filterForMatchingKeysIn(androidStrings)
        )
    }
}

data class LocalizationReport(
    val uniqueAndroidStrings: Map<String, String>,
    val uniqueIosStrings: Map<String, String>,
    val commonAndroidStrings: Map<String, String>,
    val commonIosStrings: Map<String, String>,
) {
    //returns the common key to string comparison between ios and android
    val stringComparisons: Map<String, StringComparison> = commonAndroidStrings.entries.associate {
        val key = it.key
        val androidValue: String = it.value
        val iosValue: String = commonIosStrings[key] ?: ""

        key to StringComparison(
            key = key,
            androidValue = androidValue,
            iosValue = iosValue
        )
    }

    val differences: List<StringComparison> = stringComparisons.values.filterNot { it.isExactMatch }

    val exactMatches: List<StringComparison> = stringComparisons.values.filter { it.isExactMatch }

    val caseInsensitiveMatches: List<StringComparison> = stringComparisons.values.filter { it.isCaseInsensitiveMatch }

    val mismatchedPlaceholders: List<StringComparison> = differences.filter { it.hasMismatchedPlaceholders }
}

data class StringComparison(
    val key: String,
    val androidValue: String,
    val iosValue: String,
) {
    val isExactMatch: Boolean = androidValue == iosValue
    val isCaseInsensitiveMatch = !isExactMatch && androidValue.lowercase() == iosValue.lowercase()

    val iosPlaceholderCount: Int = iosValue.placeholderCount()
    val androidPlaceholderCount: Int = androidValue.placeholderCount()
    val hasMismatchedPlaceholders = iosPlaceholderCount != androidPlaceholderCount
}

//returns the keys within this map that do not belong to the other map
fun Map<String, String>.filterForKeysNotPresentIn(other: Map<String, String>): Map<String, String> =
    this.filterKeys { !other.containsKey(it) }

fun Map<String, String>.filterForMatchingKeysIn(other: Map<String, String>): Map<String, String> =
    this.filterKeys { other.containsKey(it) }

//calculates the total number of occurrences of placeholders
fun String.placeholderCount(): Int = totalOccurrence(input = this, placeholders = setOf("%@", "%d", "%s", "%f", "\$@", "\$d", "\$s", "\$f"))

private fun totalOccurrence(input: String, placeholders: Set<String>): Int {
    return placeholders.fold(initial = 0) { acc, placeholder ->
        acc + input.numberOfOccurrence(placeholder)
    }
}

private fun String.numberOfOccurrence(substring: String): Int {
    var count = 0
    var index = this.indexOf(substring, startIndex = 0, ignoreCase = true)
    while (index > -1) {
        count += 1
        index = this.indexOf(substring, startIndex = index + 1, ignoreCase = true)
    }
    return count
}

Compiled from "Analyzer.kt"
public final class com.minhiew.translation.Analyzer {
  public static final com.minhiew.translation.Analyzer INSTANCE;

  private com.minhiew.translation.Analyzer();
    Code:
       0: aload_0
       1: invokespecial #8                  // Method java/lang/Object."<init>":()V
       4: return

  public final com.minhiew.translation.LocalizationReport compare(java.util.Map<java.lang.String, java.lang.String>, java.util.Map<java.lang.String, java.lang.String>);
    Code:
       0: aload_1
       1: ldc           #16                 // String androidStrings
       3: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_2
       7: ldc           #24                 // String iosStrings
       9: invokestatic  #22                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: new           #26                 // class com/minhiew/translation/LocalizationReport
      15: dup
      16: aload_1
      17: aload_2
      18: invokestatic  #32                 // Method com/minhiew/translation/AnalyzerKt.filterForKeysNotPresentIn:(Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
      21: aload_2
      22: aload_1
      23: invokestatic  #32                 // Method com/minhiew/translation/AnalyzerKt.filterForKeysNotPresentIn:(Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
      26: aload_1
      27: aload_2
      28: invokestatic  #35                 // Method com/minhiew/translation/AnalyzerKt.filterForMatchingKeysIn:(Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
      31: aload_2
      32: aload_1
      33: invokestatic  #35                 // Method com/minhiew/translation/AnalyzerKt.filterForMatchingKeysIn:(Ljava/util/Map;Ljava/util/Map;)Ljava/util/Map;
      36: invokespecial #38                 // Method com/minhiew/translation/LocalizationReport."<init>":(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;)V
      39: areturn

  static {};
    Code:
       0: new           #2                  // class com/minhiew/translation/Analyzer
       3: dup
       4: invokespecial #41                 // Method "<init>":()V
       7: putstatic     #44                 // Field INSTANCE:Lcom/minhiew/translation/Analyzer;
      10: return
}

Compiled from "Analyzer.kt"
public final class com.minhiew.translation.AnalyzerKt {
  public static final java.util.Map<java.lang.String, java.lang.String> filterForKeysNotPresentIn(java.util.Map<java.lang.String, java.lang.String>, java.util.Map<java.lang.String, java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #18                 // String other
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: astore_2
      14: iconst_0
      15: istore_3
      16: new           #20                 // class java/util/LinkedHashMap
      19: dup
      20: invokespecial #24                 // Method java/util/LinkedHashMap."<init>":()V
      23: astore        4
      25: aload_2
      26: invokeinterface #30,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      31: invokeinterface #36,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      36: astore        5
      38: aload         5
      40: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          117
      48: aload         5
      50: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: checkcast     #48                 // class java/util/Map$Entry
      58: astore        6
      60: aload         6
      62: invokeinterface #51,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      67: checkcast     #53                 // class java/lang/String
      70: astore        7
      72: iconst_0
      73: istore        8
      75: aload_1
      76: aload         7
      78: invokeinterface #57,  2           // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      83: ifne          90
      86: iconst_1
      87: goto          91
      90: iconst_0
      91: ifeq          38
      94: aload         4
      96: aload         6
      98: invokeinterface #51,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
     103: aload         6
     105: invokeinterface #60,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     110: invokevirtual #64                 // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     113: pop
     114: goto          38
     117: aload         4
     119: checkcast     #26                 // class java/util/Map
     122: areturn

  public static final java.util.Map<java.lang.String, java.lang.String> filterForMatchingKeysIn(java.util.Map<java.lang.String, java.lang.String>, java.util.Map<java.lang.String, java.lang.String>);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_1
       7: ldc           #18                 // String other
       9: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
      12: aload_0
      13: astore_2
      14: iconst_0
      15: istore_3
      16: new           #20                 // class java/util/LinkedHashMap
      19: dup
      20: invokespecial #24                 // Method java/util/LinkedHashMap."<init>":()V
      23: astore        4
      25: aload_2
      26: invokeinterface #30,  1           // InterfaceMethod java/util/Map.entrySet:()Ljava/util/Set;
      31: invokeinterface #36,  1           // InterfaceMethod java/util/Set.iterator:()Ljava/util/Iterator;
      36: astore        5
      38: aload         5
      40: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      45: ifeq          109
      48: aload         5
      50: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      55: checkcast     #48                 // class java/util/Map$Entry
      58: astore        6
      60: aload         6
      62: invokeinterface #51,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      67: checkcast     #53                 // class java/lang/String
      70: astore        7
      72: iconst_0
      73: istore        8
      75: aload_1
      76: aload         7
      78: invokeinterface #57,  2           // InterfaceMethod java/util/Map.containsKey:(Ljava/lang/Object;)Z
      83: ifeq          38
      86: aload         4
      88: aload         6
      90: invokeinterface #51,  1           // InterfaceMethod java/util/Map$Entry.getKey:()Ljava/lang/Object;
      95: aload         6
      97: invokeinterface #60,  1           // InterfaceMethod java/util/Map$Entry.getValue:()Ljava/lang/Object;
     102: invokevirtual #64                 // Method java/util/LinkedHashMap.put:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
     105: pop
     106: goto          38
     109: aload         4
     111: checkcast     #26                 // class java/util/Map
     114: areturn

  public static final int placeholderCount(java.lang.String);
    Code:
       0: aload_0
       1: ldc           #10                 // String <this>
       3: invokestatic  #16                 // Method kotlin/jvm/internal/Intrinsics.checkNotNullParameter:(Ljava/lang/Object;Ljava/lang/String;)V
       6: aload_0
       7: bipush        8
       9: anewarray     #53                 // class java/lang/String
      12: astore_1
      13: aload_1
      14: iconst_0
      15: ldc           #83                 // String %@
      17: aastore
      18: aload_1
      19: iconst_1
      20: ldc           #85                 // String %d
      22: aastore
      23: aload_1
      24: iconst_2
      25: ldc           #87                 // String %s
      27: aastore
      28: aload_1
      29: iconst_3
      30: ldc           #89                 // String %f
      32: aastore
      33: aload_1
      34: iconst_4
      35: ldc           #91                 // String $@
      37: aastore
      38: aload_1
      39: iconst_5
      40: ldc           #93                 // String $d
      42: aastore
      43: aload_1
      44: bipush        6
      46: ldc           #95                 // String $s
      48: aastore
      49: aload_1
      50: bipush        7
      52: ldc           #97                 // String $f
      54: aastore
      55: aload_1
      56: invokestatic  #103                // Method kotlin/collections/SetsKt.setOf:([Ljava/lang/Object;)Ljava/util/Set;
      59: invokestatic  #107                // Method totalOccurrence:(Ljava/lang/String;Ljava/util/Set;)I
      62: ireturn

  private static final int totalOccurrence(java.lang.String, java.util.Set<java.lang.String>);
    Code:
       0: aload_1
       1: checkcast     #111                // class java/lang/Iterable
       4: astore_2
       5: iconst_0
       6: istore_3
       7: iconst_0
       8: istore        4
      10: iload_3
      11: istore        5
      13: aload_2
      14: invokeinterface #112,  1          // InterfaceMethod java/lang/Iterable.iterator:()Ljava/util/Iterator;
      19: astore        6
      21: aload         6
      23: invokeinterface #42,  1           // InterfaceMethod java/util/Iterator.hasNext:()Z
      28: ifeq          68
      31: aload         6
      33: invokeinterface #46,  1           // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object;
      38: astore        7
      40: iload         5
      42: aload         7
      44: checkcast     #53                 // class java/lang/String
      47: astore        8
      49: istore        9
      51: iconst_0
      52: istore        10
      54: iload         9
      56: aload_0
      57: aload         8
      59: invokestatic  #116                // Method numberOfOccurrence:(Ljava/lang/String;Ljava/lang/String;)I
      62: iadd
      63: istore        5
      65: goto          21
      68: iload         5
      70: ireturn

  private static final int numberOfOccurrence(java.lang.String, java.lang.String);
    Code:
       0: iconst_0
       1: istore_2
       2: aload_0
       3: checkcast     #131                // class java/lang/CharSequence
       6: aload_1
       7: iconst_0
       8: iconst_1
       9: invokestatic  #137                // Method kotlin/text/StringsKt.indexOf:(Ljava/lang/CharSequence;Ljava/lang/String;IZ)I
      12: istore_3
      13: iload_3
      14: iconst_m1
      15: if_icmple     37
      18: iinc          2, 1
      21: aload_0
      22: checkcast     #131                // class java/lang/CharSequence
      25: aload_1
      26: iload_3
      27: iconst_1
      28: iadd
      29: iconst_1
      30: invokestatic  #137                // Method kotlin/text/StringsKt.indexOf:(Ljava/lang/CharSequence;Ljava/lang/String;IZ)I
      33: istore_3
      34: goto          13
      37: iload_2
      38: ireturn
}