// Generated from "arithmeticexpressions/ArithmeticExpressions.java"
@file:Suppress(
 "ALWAYS_NULL",
 "PARAMETER_NAME_CHANGED_ON_OVERRIDE",
 "SENSELESS_COMPARISON",
 "UNCHECKED_CAST",
 "UNNECESSARY_LATEINIT",
 "UNNECESSARY_NOT_NULL_ASSERTION",
 "UNREACHABLE_CODE",
 "UNUSED_ANONYMOUS_PARAMETER",
 "UNUSED_PARAMETER",
 "UNUSED_VARIABLE",
 "USELESS_CAST",
 "VARIABLE_IN_SINGLETON_WITHOUT_THREAD_LOCAL",
 "VARIABLE_WITH_REDUNDANT_INITIALIZER",
 "REDUNDANT_ELSE_IN_WHEN")

package arithmeticexpressions

import javaemul.lang.*
import java.lang.Long
import kotlin.Any
import kotlin.Array
import kotlin.Boolean
import kotlin.BooleanArray
import kotlin.Byte
import kotlin.Char
import kotlin.Double
import kotlin.Float
import kotlin.Int
import kotlin.IntArray
import kotlin.LongArray
import kotlin.Short
import kotlin.ShortArray
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmField
import kotlin.jvm.JvmStatic
import kotlin.run

open class ArithmeticExpressions {
 open fun testCoercions() {
  var b: Byte = 1L.toByte()
  var c: Char = 1L.toInt().toChar()
  var s: Short = 1L.toShort()
  var i: Int = 1L.toInt()
  var f: Float = 1L.toFloat()
  var d: Double = 1L.toDouble()
  b = 9223372036854775807L.toByte()
  c = 9223372036854775807L.toInt().toChar()
  s = 9223372036854775807L.toShort()
  i = 9223372036854775807L.toInt()
  f = 9223372036854775807L.toFloat()
  d = 9223372036854775807L.toDouble()
  val o: Any = c
  s = (o as Char).code.toShort()
 }

 open fun testPrimitives() {
  var a: Int = 10
  val b: Int = run {
   val ___value: Int = a
   a = a + 1
   ___value
  }
  val c: Int = run {
   val ___value_1: Int = a
   a = a - 1
   ___value_1
  }
  val d: Int = run {
   a = a + 1
   a
  }
  val e: Int = run {
   a = a - 1
   a
  }
  val f: Int = - a
  val g: Int = + a
  val h: Int = a.inv()
  val i: Int = 1 + 1 + 2 - 5
  val j: Int = (1 + 2) * (3 + 4)
  val p: Int = 1 / 2 * 3 % 4
  val r: Int = - (-2147483647 - 1)
  val t: Int = - - - 1
  val u: Int = + + + 1
  val v: Int = - + - 1
  val w: Int = 5 - - 4
  var k: Boolean = !(1 + 2 + 3 == 4)
  val l: Boolean = 1 + 2 != 4
  val m: Boolean = Long.MAX_VALUE.toDouble() != 9.223372036854778E18
  val o: Double = ((5 + 1) / 2).toDouble() - 0.0
  a = a.shl(
   31L.toInt(),
  )
  a = a.shl(
   1L.toInt(),
  )
  a = (a.toLong() + 1L).toInt()
  a = (a.toLong() / 1L).toInt()
  a = (a.toDouble() + java.lang.Double.MAX_VALUE).toInt()
  k = k.or(true)
  var s: Short = 10.toShort()
  k = run {
   s = (s.toInt() + 1).toShort()
   s
  }.toInt() == 10
  var q: Int = 3.shr(2)
  q = 3.ushr(2)
  val x: Byte = ((a.toShort().toInt() + b.toShort().toByte().toInt()) * c.toByte().toShort().toInt()).toByte()
  val y: Char = 'y'
  val z: kotlin.Long? = 121L
  k = y.code.toLong() == z!!.toLong()
 }

 open fun testDoubleAssignments() {
  var a: Double = 1.0
  a = a + 2.0
  a = a - 3.0
  a = a * 4.0
  a = a / 5.0
  a = a % 6.0
 }

 @JvmField
 var bar: kotlin.Long = run {
  val ___value: kotlin.Long = ArithmeticExpressions.foo
  ArithmeticExpressions.foo = ArithmeticExpressions.foo + 1L
  ___value
 }

 open fun testCompoundArray() {
  val ints: IntArray? = null
  ints!![0] = ints!![0] + 1
  ints!![0] = ints!![0] - 1
  ints!![0] = ints!![0] * 1
  ints!![0] = ints!![0] / 1
  ints!![0] = ints!![0].and(1)
  ints!![0] = ints!![0].xor(1)
  ints!![0] = ints!![0].or(1)
  ints!![0] = ints!![0] % 1
  ints!![0] = ints!![0].shl(1)
  ints!![0] = ints!![0].shr(1)
  ints!![0] = ints!![0].ushr(1)
  ints!![0] = ints!![0] + 1
  ints!![0] = ints!![0] + 1
  var i: Int = 0
  val ___array: IntArray? = ints
  val ___index: Int = run {
   val ___value: Int = i
   i = i + 1
   ___value
  }
  val ___array_1: IntArray? = ___array
  val ___index_1: Int = ___index
  val ___value_1: Int = ___array!![___index] + 1
  ___array_1!![___index_1] = ___value_1
  val ___array_2: IntArray? = ints
  val ___index_2: Int = run {
   i = i + 1
   i
  }
  val ___array_3: IntArray? = ___array_2
  val ___index_3: Int = ___index_2
  val ___value_2: Int = ___array_2!![___index_2] + 1
  ___array_3!![___index_3] = ___value_2
  val ___array_4: IntArray? = ints
  val ___index_4: Int = run {
   val ___value_3: Int = i
   i = i + 1
   ___value_3
  }
  val ___array_5: IntArray? = ___array_4
  val ___index_5: Int = ___index_4
  val ___value_4: Int = ___array_4!![___index_4] / 1
  ___array_5!![___index_5] = ___value_4
  val longs: LongArray? = null
  longs!![0] = longs!![0] + 1L
  longs!![0] = longs!![0] - 1L
  longs!![0] = longs!![0] - 1L
  val ___array_6: LongArray? = ArithmeticExpressions.getLongArray()
  val ___index_6: Int = 0
  val ___array_7: LongArray? = ___array_6
  val ___index_7: Int = ___index_6
  val ___value_5: kotlin.Long = ___array_6!![___index_6] + 1L
  ___array_7!![___index_7] = ___value_5
  val booleans: BooleanArray? = null
  booleans!![0] = booleans!![0].or(true)
  val strings: Array<String?>? = null
  strings!![0] = "" + strings!![0] + null
  val shorts: ShortArray? = null
  val b: Boolean = run {
   val ___array_8: ShortArray? = shorts
   val ___index_8: Int = 0
   val ___value_6: Short = (shorts!![0].toInt() + 1).toShort()
   ___array_8!![___index_8] = ___value_6
   ___value_6
  }.toInt() == 10
 }

 open fun testCompoundBoxedTypes() {
  var c: Int? = 1000
  var d: Int? = 10000
  d = d!!.toInt() + c!!.toInt()
  var i: Int = 43
  d = d!!.toInt() + i
  d = d!!.toInt().shl(i)
  i = i + c!!.toInt()
  var e: Int? = run {
   c = c!!.toInt() + 1
   c
  }
  e = run {
   c = c!!.toInt() + 1
   c
  }
  var e2: Double? = 100.0
  e2 = e2!!.toDouble() + 1.0
  var f: Int? = run {
   val ___value: Int? = c
   c = c!!.toInt() + 1
   ___value
  }
  f = run {
   val ___value_1: Int? = c
   c = c!!.toInt() + 1
   ___value_1
  }
  var b: Byte? = 0.toByte()
  b = (b!!.toByte().toInt() + 1).toByte()
  var ch: Char? = 'c'
  ch = (ch!!.toChar().code + 1).toChar()
  run {
   f = f!!.toInt() + 1
   f
  }!!.toInt()
  run {
   val ___value_2: Int? = f
   f = f!!.toInt() - 1
   ___value_2
  }!!.toInt()
  open class Ref<T> internal constructor() {
   @JvmField
   internal var field_pp_arithmeticexpressions: T? = null
  }
  val ref: Ref<Byte?>? = null
  ref!!.field_pp_arithmeticexpressions = (ref!!.field_pp_arithmeticexpressions!!.toByte().toInt() + 1).toByte()
  val n: Int = 1 + ref!!.field_pp_arithmeticexpressions!!.toByte().toInt()
 }

 @JvmField
 internal var intField_pp_arithmeticexpressions: kotlin.Long = 0L

 open fun testExtendedOperands() {
  var boxedInteger: Int? = 3
  var i: Int = 0
  var l: kotlin.Long = 0L
  var d: Double = 0.0
  l = (2 - boxedInteger!!.toInt()).toLong() - 2L
  l = 2.or(
   boxedInteger!!.toInt(),
  ).toLong().or(2L)
  l = 1000000L * l * 60L * 60L * 24L
  l = (24 * 60 * 60).toLong() * l * 1000000L
  d = run {
   l = run {
    i = 20
    i
   }.toLong()
   l
  }.toDouble()
  l = run {
   boxedInteger = run {
    i = 20
    i
   }
   boxedInteger
  }!!.toInt().toLong()
  l = (i + boxedInteger!!.toInt()).toLong() + l + 20L
  d = (20L + l).toDouble() + d
 }

 open fun testEffectivelyFinalVariableInAssignmentExpression(condition: Boolean) {
  var effectivelyFinal: kotlin.Long = 0L
  if (condition && run {
   effectivelyFinal = this.bar
   effectivelyFinal
  } != 0L) {
   val unused: kotlin.Long = effectivelyFinal
  }
 }

 companion object {
  private const val FLOAT_CONSTANT: Float = 1.1f

  private const val DOUBLE_CONSTANT: Double = 1.100000023841858

  private const val DOUBLE_CONSTANT_WITH_ARITHMETIC: Double = 2.200000047683716

  @JvmField
  var one: kotlin.Long = 1L

  @JvmField
  var foo: kotlin.Long = run {
   val ___value: kotlin.Long = ArithmeticExpressions.one
   ArithmeticExpressions.one = ArithmeticExpressions.one + 1L
   ___value
  }

  @JvmStatic
  private fun getLongArray(): LongArray? {
   return null
  }

  @JvmStatic
  private fun getInteger(): Int? {
   return null
  }

  @JvmStatic
  private fun testSideEffect() {
   val ___qualifier: ArithmeticExpressions? = ArithmeticExpressions.getWithSideEffect()
   val ___qualifier_1: ArithmeticExpressions? = ___qualifier
   val ___value: kotlin.Long = ___qualifier!!.intField_pp_arithmeticexpressions + 5L
   ___qualifier_1!!.intField_pp_arithmeticexpressions = ___value
  }

  @JvmStatic
  private fun getWithSideEffect(): ArithmeticExpressions? {
   return null
  }

  private var counter: kotlin.Long = 0L

  @JvmStatic
  private fun incrementCounter(): kotlin.Long {
   return run {
    val ___value: kotlin.Long = ArithmeticExpressions.counter + 1L
    ArithmeticExpressions.counter = ___value
    ___value
   }
  }
 }
}
