@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun cosh ( x : Double ) : Double

= nativeMath . cosh ( x )

/**
 * Computes the hyperbolic cosine of the value [x].
 *
 * Special cases:
 * - `cosh(NaN)` is `NaN`
 * - `cosh(+Inf|-Inf)` is `+Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun tanh ( x : Double ) : Double

= nativeMath . tanh ( x )

/**
 * Computes the hyperbolic tangent of the value [x].
 *
 * Special cases:
 * - `tanh(NaN)` is `NaN`
 * - `tanh(+Inf)` is `1.0`
 * - `tanh(-Inf)` is `-1.0`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun asinh ( x : Double ) : Double

= <EOL> when { <EOL> x >= + taylor_n_bound -> <EOL> if ( x > upper_taylor_n_bound ) { <EOL> if ( x > upper_taylor_2_bound ) { <EOL> nativeMath . log ( x ) + LN2 <EOL> } else { <EOL> nativeMath . log ( x * <NUM_LIT:2> + ( <NUM_LIT:1> / ( x * <NUM_LIT:2> ) ) ) <EOL> } <EOL> } else { <EOL> nativeMath . log ( x + nativeMath . sqrt ( x * x + <NUM_LIT:1> ) ) <EOL> } <EOL> x <= - taylor_n_bound -> - asinh ( - x ) <EOL> else -> { <EOL> var result = x ; <EOL> if ( nativeMath . abs ( x ) >= taylor_2_bound ) { <EOL> result -= ( x * x * x ) / <NUM_LIT:6> <EOL> } <EOL> result <EOL> } <EOL> }

/**
 * Computes the inverse hyperbolic sine of the value [x].
 *
 * The returned value is `y` such that `sinh(y) == x`.
 *
 * Special cases:
 * - `asinh(NaN)` is `NaN`
 * - `asinh(+Inf)` is `+Inf`
 * - `asinh(-Inf)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun acosh ( x : Double ) : Double

= <EOL> when { <EOL> x < <NUM_LIT:1> -> Double . NaN <EOL> x > upper_taylor_2_bound -> <EOL> nativeMath . log ( x ) + LN2 <EOL> x - <NUM_LIT:1> >= taylor_n_bound -> <EOL> nativeMath . log ( x + nativeMath . sqrt ( x * x - <NUM_LIT:1> ) ) <EOL> else -> { <EOL> val y = nativeMath . sqrt ( x - <NUM_LIT:1> ) <EOL> var result = y <EOL> if ( y >= taylor_2_bound ) { <EOL> result -= ( y * y * y ) / <NUM_LIT:12> <EOL> } <EOL> nativeMath . sqrt ( <NUM_LIT:2.0> ) * result <EOL> } <EOL> }

/**
 * Computes the inverse hyperbolic cosine of the value [x].
 *
 * The returned value is positive `y` such that `cosh(y) == x`.
 *
 * Special cases:
 * - `acosh(NaN)` is `NaN`
 * - `acosh(x)` is `NaN` when `x < 1`
 * - `acosh(+Inf)` is `+Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun atanh ( x : Double ) : Double

{ <EOL> if ( nativeMath . abs ( x ) < taylor_n_bound ) { <EOL> var result = x <EOL> if ( nativeMath . abs ( x ) > taylor_2_bound ) { <EOL> result += ( x * x * x ) / <NUM_LIT:3> <EOL> } <EOL> return result <EOL> } <EOL> return nativeMath . log ( ( <NUM_LIT:1> + x ) / ( <NUM_LIT:1> - x ) ) / <NUM_LIT:2> <EOL> }

/**
 * Computes the inverse hyperbolic tangent of the value [x].
 *
 * The returned value is `y` such that `tanh(y) == x`.
 *
 * Special cases:
 * - `tanh(NaN)` is `NaN`
 * - `tanh(x)` is `NaN` when `x > 1` or `x < -1`
 * - `tanh(1.0)` is `+Inf`
 * - `tanh(-1.0)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun hypot ( x : Double , y : Double ) : Double

= nativeMath . hypot ( x , y )

/**
 * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.
 *
 * Special cases:
 * - returns `+Inf` if any of arguments is infinite
 * - returns `NaN` if any of arguments is `NaN` and the other is not infinite
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sqrt ( x : Double ) : Double

= nativeMath . sqrt ( x )

/**
 * Computes the positive square root of the value [x].
 *
 * Special cases:
 * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun exp ( x : Double ) : Double

= nativeMath . exp ( x )

/**
 * Computes Euler's number `e` raised to the power of the value [x].
 *
 * Special cases:
 * - `exp(NaN)` is `NaN`
 * - `exp(+Inf)` is `+Inf`
 * - `exp(-Inf)` is `0.0`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun expm1 ( x : Double ) : Double

= nativeMath . expm1 ( x )

/**
 * Computes `exp(x) - 1`.
 *
 * This function can be implemented to produce more precise result for [x] near zero.
 *
 * Special cases:
 * - `expm1(NaN)` is `NaN`
 * - `expm1(+Inf)` is `+Inf`
 * - `expm1(-Inf)` is `-1.0`
 *
 * @see [exp] function.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun log ( x : Double , base : Double ) : Double

{ <EOL> if ( base <= <NUM_LIT:0.0> || base == <NUM_LIT:1.0> ) return Double . NaN <EOL> return nativeMath . log ( x ) / nativeMath . log ( base ) <EOL> }

/**
 * Computes the logarithm of the value [x] to the given [base].
 *
 * Special cases:
 * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`
 * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`
 * - `log(+Inf, +Inf)` is `NaN`
 * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`
 * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`
 *
 * See also logarithm functions for common fixed bases: [ln], [log10] and [log2].
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun ln ( x : Double ) : Double

= nativeMath . log ( x )

/**
 * Computes the natural logarithm (base `E`) of the value [x].
 *
 * Special cases:
 * - `ln(NaN)` is `NaN`
 * - `ln(x)` is `NaN` when `x < 0.0`
 * - `ln(+Inf)` is `+Inf`
 * - `ln(0.0)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun log10 ( x : Double ) : Double

= nativeMath . log10 ( x )

/**
 * Computes the common logarithm (base 10) of the value [x].
 *
 * @see [ln] function for special cases.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun log2 ( x : Double ) : Double

= nativeMath . log ( x ) / LN2

/**
 * Computes the binary logarithm (base 2) of the value [x].
 *
 * @see [ln] function for special cases.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun ln1p ( x : Double ) : Double

= nativeMath . log1p ( x )

/**
 * Computes `ln(x + 1)`.
 *
 * This function can be implemented to produce more precise result for [x] near zero.
 *
 * Special cases:
 * - `ln1p(NaN)` is `NaN`
 * - `ln1p(x)` is `NaN` where `x < -1.0`
 * - `ln1p(-1.0)` is `-Inf`
 * - `ln1p(+Inf)` is `+Inf`
 *
 * @see [ln] function
 * @see [expm1] function
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun ceil ( x : Double ) : Double

= nativeMath . ceil ( x )

/**
 * Rounds the given value [x] to an integer towards positive infinity.

 * @return the smallest double value that is greater than or equal to the given value [x] and is a mathematical integer.
 *
 * Special cases:
 * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun floor ( x : Double ) : Double

= nativeMath . floor ( x )

/**
 * Rounds the given value [x] to an integer towards negative infinity.

 * @return the largest double value that is smaller than or equal to the given value [x] and is a mathematical integer.
 *
 * Special cases:
 * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun truncate ( x : Double ) : Double

= when { <EOL> x . isNaN ( ) || x . isInfinite ( ) -> x <EOL> x > <NUM_LIT:0> -> floor ( x ) <EOL> else -> ceil ( x ) <EOL> }

/**
 * Rounds the given value [x] to an integer towards zero.
 *
 * @return the value [x] having its fractional part truncated.
 *
 * Special cases:
 * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun round ( x : Double ) : Double

= nativeMath . rint ( x )

/**
 * Rounds the given value [x] towards the closest integer with ties rounded towards even integer.
 *
 * Special cases:
 * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun abs ( x : Double ) : Double

= nativeMath . abs ( x )

/**
 * Returns the absolute value of the given value [x].
 *
 * Special cases:
 * - `abs(NaN)` is `NaN`
 *
 * @see absoluteValue extension property for [Double]
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sign ( x : Double ) : Double

= nativeMath . signum ( x )

/**
 * Returns the sign of the given value [x]:
 * - `-1.0` if the value is negative,
 * - zero if the value is zero,
 * - `1.0` if the value is positive
 *
 * Special case:
 * - `sign(NaN)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun min ( a : Double , b : Double ) : Double

= nativeMath . min ( a , b )

/**
 * Returns the smaller of two values.
 *
 * If either value is `NaN`, then the result is `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun max ( a : Double , b : Double ) : Double

= nativeMath . max ( a , b )

/**
 * Returns the greater of two values.
 *
 * If either value is `NaN`, then the result is `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> @ InlineOnly <EOL> public actual inline fun cbrt ( x : Double ) : Double

= nativeMath . cbrt ( x )

/**
 * Returns the cube root of [x]. For any `x`, `cbrt(-x) == -cbrt(x)`;
 * that is, the cube root of a negative value is the negative of the cube root
 * of that value's magnitude. Special cases:
 *
 * Special cases:
 * - If the argument is `NaN`, then the result is `NaN`.
 * - If the argument is infinite, then the result is an infinity with the same sign as the argument.
 * - If the argument is zero, then the result is a zero with the same sign as the argument.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . pow ( x : Double ) : Double

= nativeMath . pow ( this , x )

/**
 * Raises this value to the power [x].
 *
 * Special cases:
 * - `b.pow(0.0)` is `1.0`
 * - `b.pow(1.0) == b`
 * - `b.pow(NaN)` is `NaN`
 * - `NaN.pow(x)` is `NaN` for `x != 0.0`
 * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`
 * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . pow ( n : Int ) : Double

= nativeMath . pow ( this , n . toDouble ( ) )

/**
 * Raises this value to the integer power [n].
 *
 * See the other overload of [pow] for details.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public inline fun Double . IEEErem ( divisor : Double ) : Double

= nativeMath . IEEEremainder ( this , divisor )

/**
 * Computes the remainder of division of this value by the [divisor] value according to the IEEE 754 standard.
 *
 * The result is computed as `r = this - (q * divisor)` where `q` is the quotient of division rounded to the nearest integer,
 * `q = round(this / other)`.
 *
 * Special cases:
 * - `x.IEEErem(y)` is `NaN`, when `x` is `NaN` or `y` is `NaN` or `x` is `+Inf|-Inf` or `y` is zero.
 * - `x.IEEErem(y) == x` when `x` is finite and `y` is infinite.
 *
 * @see round
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . withSign ( sign : Double ) : Double

= nativeMath . copySign ( this , sign )

/**
 * Returns this value with the sign bit same as of the [sign] value.
 *
 * If [sign] is `NaN` the sign of the result is undefined.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . withSign ( sign : Int ) : Double

= nativeMath . copySign ( this , sign . toDouble ( ) )

/**
 * Returns this value with the sign bit same as of the [sign] value.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . nextUp ( ) : Double

= nativeMath . nextUp ( this )

/**
 * Returns the [Double] value nearest to this value in direction of positive infinity.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . nextDown ( ) : Double

= nativeMath . nextAfter ( this , Double . NEGATIVE_INFINITY )

/**
 * Returns the [Double] value nearest to this value in direction of negative infinity.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Double . nextTowards ( to : Double ) : Double

= nativeMath . nextAfter ( this , to )

/**
 * Returns the [Double] value nearest to this value in direction from this value towards the value [to].
 *
 * Special cases:
 * - `x.nextTowards(y)` is `NaN` if either `x` or `y` are `NaN`
 * - `x.nextTowards(x) == x`
 *
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun Double . roundToInt ( ) : Int

= when { <EOL> isNaN ( ) -> throw IllegalArgumentException ( "<STR_LIT>" ) <EOL> this > Int . MAX_VALUE -> Int . MAX_VALUE <EOL> this < Int . MIN_VALUE -> Int . MIN_VALUE <EOL> else -> nativeMath . round ( this ) . toInt ( ) <EOL> }

/**
 * Rounds this [Double] value to the nearest integer and converts the result to [Int].
 * Ties are rounded towards positive infinity.
 *
 * Special cases:
 * - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`
 * - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`
 *
 * @throws IllegalArgumentException when this value is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun Double . roundToLong ( ) : Long

= <EOL> if ( isNaN ( ) ) throw IllegalArgumentException ( "<STR_LIT>" ) else nativeMath . round ( this )

/**
 * Rounds this [Double] value to the nearest integer and converts the result to [Long].
 * Ties are rounded towards positive infinity.
 *
 * Special cases:
 * - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`
 * - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`
 *
 * @throws IllegalArgumentException when this value is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sin ( x : Float ) : Float

= nativeMath . sin ( x . toDouble ( ) ) . toFloat ( )

/** Computes the sine of the angle [x] given in radians.
 *
 * Special cases:
 * - `sin(NaN|+Inf|-Inf)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun cos ( x : Float ) : Float

= nativeMath . cos ( x . toDouble ( ) ) . toFloat ( )

/** Computes the cosine of the angle [x] given in radians.
 *
 * Special cases:
 * - `cos(NaN|+Inf|-Inf)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun tan ( x : Float ) : Float

= nativeMath . tan ( x . toDouble ( ) ) . toFloat ( )

/** Computes the tangent of the angle [x] given in radians.
 *
 * Special cases:
 * - `tan(NaN|+Inf|-Inf)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun asin ( x : Float ) : Float

= nativeMath . asin ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the arc sine of the value [x];
 * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
 *
 * Special cases:
 * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun acos ( x : Float ) : Float

= nativeMath . acos ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the arc cosine of the value [x];
 * the returned value is an angle in the range from `0.0` to `PI` radians.
 *
 * Special cases:
 * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun atan ( x : Float ) : Float

= nativeMath . atan ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the arc tangent of the value [x];
 * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.
 *
 * Special cases:
 * - `atan(NaN)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun atan2 ( y : Float , x : Float ) : Float

= nativeMath . atan2 ( y . toDouble ( ) , x . toDouble ( ) ) . toFloat ( )

/**
 * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond
 * to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];
 * the returned value is an angle in the range from `-PI` to `PI` radians.
 *
 * Special cases:
 * - `atan2(0.0, 0.0)` is `0.0`
 * - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`
 * - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`
 * - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`
 * - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`
 * - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`
 * - `atan2(+Inf, x)` is `PI/2` for finite `x`y
 * - `atan2(-Inf, x)` is `-PI/2` for finite `x`
 * - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sinh ( x : Float ) : Float

= nativeMath . sinh ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the hyperbolic sine of the value [x].
 *
 * Special cases:
 * - `sinh(NaN)` is `NaN`
 * - `sinh(+Inf)` is `+Inf`
 * - `sinh(-Inf)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun cosh ( x : Float ) : Float

= nativeMath . cosh ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the hyperbolic cosine of the value [x].
 *
 * Special cases:
 * - `cosh(NaN)` is `NaN`
 * - `cosh(+Inf|-Inf)` is `+Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun tanh ( x : Float ) : Float

= nativeMath . tanh ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the hyperbolic tangent of the value [x].
 *
 * Special cases:
 * - `tanh(NaN)` is `NaN`
 * - `tanh(+Inf)` is `1.0`
 * - `tanh(-Inf)` is `-1.0`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun asinh ( x : Float ) : Float

= asinh ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the inverse hyperbolic sine of the value [x].
 *
 * The returned value is `y` such that `sinh(y) == x`.
 *
 * Special cases:
 * - `asinh(NaN)` is `NaN`
 * - `asinh(+Inf)` is `+Inf`
 * - `asinh(-Inf)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun acosh ( x : Float ) : Float

= acosh ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the inverse hyperbolic cosine of the value [x].
 *
 * The returned value is positive `y` such that `cosh(y) == x`.
 *
 * Special cases:
 * - `acosh(NaN)` is `NaN`
 * - `acosh(x)` is `NaN` when `x < 1`
 * - `acosh(+Inf)` is `+Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun atanh ( x : Float ) : Float

= atanh ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the inverse hyperbolic tangent of the value [x].
 *
 * The returned value is `y` such that `tanh(y) == x`.
 *
 * Special cases:
 * - `tanh(NaN)` is `NaN`
 * - `tanh(x)` is `NaN` when `x > 1` or `x < -1`
 * - `tanh(1.0)` is `+Inf`
 * - `tanh(-1.0)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun hypot ( x : Float , y : Float ) : Float

= nativeMath . hypot ( x . toDouble ( ) , y . toDouble ( ) ) . toFloat ( )

/**
 * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.
 *
 * Special cases:
 * - returns `+Inf` if any of arguments is infinite
 * - returns `NaN` if any of arguments is `NaN` and the other is not infinite
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sqrt ( x : Float ) : Float

= nativeMath . sqrt ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the positive square root of the value [x].
 *
 * Special cases:
 * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun exp ( x : Float ) : Float

= nativeMath . exp ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes Euler's number `e` raised to the power of the value [x].
 *
 * Special cases:
 * - `exp(NaN)` is `NaN`
 * - `exp(+Inf)` is `+Inf`
 * - `exp(-Inf)` is `0.0`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun expm1 ( x : Float ) : Float

= nativeMath . expm1 ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes `exp(x) - 1`.
 *
 * This function can be implemented to produce more precise result for [x] near zero.
 *
 * Special cases:
 * - `expm1(NaN)` is `NaN`
 * - `expm1(+Inf)` is `+Inf`
 * - `expm1(-Inf)` is `-1.0`
 *
 * @see [exp] function.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun log ( x : Float , base : Float ) : Float

{ <EOL> if ( base <= <NUM_LIT> || base == <NUM_LIT> ) return Float . NaN <EOL> return ( nativeMath . log ( x . toDouble ( ) ) / nativeMath . log ( base . toDouble ( ) ) ) . toFloat ( ) <EOL> }

/**
 * Computes the logarithm of the value [x] to the given [base].
 *
 * Special cases:
 * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`
 * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`
 * - `log(+Inf, +Inf)` is `NaN`
 * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`
 * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`
 *
 * See also logarithm functions for common fixed bases: [ln], [log10] and [log2].
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun ln ( x : Float ) : Float

= nativeMath . log ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the natural logarithm (base `E`) of the value [x].
 *
 * Special cases:
 * - `ln(NaN)` is `NaN`
 * - `ln(x)` is `NaN` when `x < 0.0`
 * - `ln(+Inf)` is `+Inf`
 * - `ln(0.0)` is `-Inf`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun log10 ( x : Float ) : Float

= nativeMath . log10 ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes the common logarithm (base 10) of the value [x].
 *
 * @see [ln] function for special cases.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun log2 ( x : Float ) : Float

= ( nativeMath . log ( x . toDouble ( ) ) / LN2 ) . toFloat ( )

/**
 * Computes the binary logarithm (base 2) of the value [x].
 *
 * @see [ln] function for special cases.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun ln1p ( x : Float ) : Float

= nativeMath . log1p ( x . toDouble ( ) ) . toFloat ( )

/**
 * Computes `ln(x + 1)`.
 *
 * This function can be implemented to produce more precise result for [x] near zero.
 *
 * Special cases:
 * - `ln1p(NaN)` is `NaN`
 * - `ln1p(x)` is `NaN` where `x < -1.0`
 * - `ln1p(-1.0)` is `-Inf`
 * - `ln1p(+Inf)` is `+Inf`
 *
 * @see [ln] function
 * @see [expm1] function
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun ceil ( x : Float ) : Float

= nativeMath . ceil ( x . toDouble ( ) ) . toFloat ( )

/**
 * Rounds the given value [x] to an integer towards positive infinity.

 * @return the smallest Float value that is greater than or equal to the given value [x] and is a mathematical integer.
 *
 * Special cases:
 * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun floor ( x : Float ) : Float

= nativeMath . floor ( x . toDouble ( ) ) . toFloat ( )

/**
 * Rounds the given value [x] to an integer towards negative infinity.

 * @return the largest Float value that is smaller than or equal to the given value [x] and is a mathematical integer.
 *
 * Special cases:
 * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun truncate ( x : Float ) : Float

= when { <EOL> x . isNaN ( ) || x . isInfinite ( ) -> x <EOL> x > <NUM_LIT:0> -> floor ( x ) <EOL> else -> ceil ( x ) <EOL> }

/**
 * Rounds the given value [x] to an integer towards zero.
 *
 * @return the value [x] having its fractional part truncated.
 *
 * Special cases:
 * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun round ( x : Float ) : Float

= nativeMath . rint ( x . toDouble ( ) ) . toFloat ( )

/**
 * Rounds the given value [x] towards the closest integer with ties rounded towards even integer.
 *
 * Special cases:
 * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun abs ( x : Float ) : Float

= nativeMath . abs ( x )

/**
 * Returns the absolute value of the given value [x].
 *
 * Special cases:
 * - `abs(NaN)` is `NaN`
 *
 * @see absoluteValue extension property for [Float]
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun sign ( x : Float ) : Float

= nativeMath . signum ( x )

/**
 * Returns the sign of the given value [x]:
 * - `-1.0` if the value is negative,
 * - zero if the value is zero,
 * - `1.0` if the value is positive
 *
 * Special case:
 * - `sign(NaN)` is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun min ( a : Float , b : Float ) : Float

= nativeMath . min ( a , b )

/**
 * Returns the smaller of two values.
 *
 * If either value is `NaN`, then the result is `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun max ( a : Float , b : Float ) : Float

= nativeMath . max ( a , b )

/**
 * Returns the greater of two values.
 *
 * If either value is `NaN`, then the result is `NaN`.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalStdlibApi :: class ) <EOL> @ InlineOnly <EOL> public actual inline fun cbrt ( x : Float ) : Float

= nativeMath . cbrt ( x . toDouble ( ) ) . toFloat ( )

/**
 * Returns the cube root of [x]. For any `x`, `cbrt(-x) == -cbrt(x)`;
 * that is, the cube root of a negative value is the negative of the cube root
 * of that value's magnitude. Special cases:
 *
 * Special cases:
 * - If the argument is `NaN`, then the result is `NaN`.
 * - If the argument is infinite, then the result is an infinity with the same sign as the argument.
 * - If the argument is zero, then the result is a zero with the same sign as the argument.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Float . pow ( x : Float ) : Float

= nativeMath . pow ( this . toDouble ( ) , x . toDouble ( ) ) . toFloat ( )

/**
 * Raises this value to the power [x].
 *
 * Special cases:
 * - `b.pow(0.0)` is `1.0`
 * - `b.pow(1.0) == b`
 * - `b.pow(NaN)` is `NaN`
 * - `NaN.pow(x)` is `NaN` for `x != 0.0`
 * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`
 * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Float . pow ( n : Int ) : Float

= nativeMath . pow ( this . toDouble ( ) , n . toDouble ( ) ) . toFloat ( )

/**
 * Raises this value to the integer power [n].
 *
 * See the other overload of [pow] for details.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public inline fun Float . IEEErem ( divisor : Float ) : Float

= nativeMath . IEEEremainder ( this . toDouble ( ) , divisor . toDouble ( ) ) . toFloat ( )

/**
 * Computes the remainder of division of this value by the [divisor] value according to the IEEE 754 standard.
 *
 * The result is computed as `r = this - (q * divisor)` where `q` is the quotient of division rounded to the nearest integer,
 * `q = round(this / other)`.
 *
 * Special cases:
 * - `x.IEEErem(y)` is `NaN`, when `x` is `NaN` or `y` is `NaN` or `x` is `+Inf|-Inf` or `y` is zero.
 * - `x.IEEErem(y) == x` when `x` is finite and `y` is infinite.
 *
 * @see round
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Float . withSign ( sign : Float ) : Float

= nativeMath . copySign ( this , sign )

/**
 * Returns this value with the sign bit same as of the [sign] value.
 *
 * If [sign] is `NaN` the sign of the result is undefined.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun Float . withSign ( sign : Int ) : Float

= nativeMath . copySign ( this , sign . toFloat ( ) )

/**
 * Returns this value with the sign bit same as of the [sign] value.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public inline fun Float . nextUp ( ) : Float

= nativeMath . nextUp ( this )

/**
 * Returns the [Float] value nearest to this value in direction of positive infinity.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public inline fun Float . nextDown ( ) : Float

= nativeMath . nextAfter ( this , Double . NEGATIVE_INFINITY )

/**
 * Returns the [Float] value nearest to this value in direction of negative infinity.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public inline fun Float . nextTowards ( to : Float ) : Float

= nativeMath . nextAfter ( this , to . toDouble ( ) )

/**
 * Returns the [Float] value nearest to this value in direction from this value towards the value [to].
 *
 * Special cases:
 * - `x.nextTowards(y)` is `NaN` if either `x` or `y` are `NaN`
 * - `x.nextTowards(x) == x`
 *
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun Float . roundToInt ( ) : Int

= <EOL> if ( isNaN ( ) ) throw IllegalArgumentException ( "<STR_LIT>" ) else nativeMath . round ( this )

/**
 * Rounds this [Float] value to the nearest integer and converts the result to [Int].
 * Ties are rounded towards positive infinity.
 *
 * Special cases:
 * - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`
 * - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`
 *
 * @throws IllegalArgumentException when this value is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> public actual fun Float . roundToLong ( ) : Long

= toDouble ( ) . roundToLong ( )

/**
 * Rounds this [Float] value to the nearest integer and converts the result to [Long].
 * Ties are rounded towards positive infinity.
 *
 * Special cases:
 * - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`
 * - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`
 *
 * @throws IllegalArgumentException when this value is `NaN`
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun abs ( n : Int ) : Int

= nativeMath . abs ( n )

/**
 * Returns the absolute value of the given value [n].
 *
 * Special cases:
 * - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow
 *
 * @see absoluteValue extension property for [Int]
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun min ( a : Int , b : Int ) : Int

= nativeMath . min ( a , b )

/**
 * Returns the smaller of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun max ( a : Int , b : Int ) : Int

= nativeMath . max ( a , b )

/**
 * Returns the greater of two values.
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun abs ( n : Long ) : Long

= nativeMath . abs ( n )

/**
 * Returns the absolute value of the given value [n].
 *
 * Special cases:
 * - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow
 *
 * @see absoluteValue extension property for [Long]
 */


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun min ( a : Long , b : Long ) : Long

= nativeMath . min ( a , b )


@ SinceKotlin ( "<STR_LIT:1.2>" ) <EOL> @ InlineOnly <EOL> public actual inline fun max ( a : Long , b : Long ) : Long

= nativeMath . max ( a , b )


@ InlineOnly <EOL> public inline fun bytes ( builderAction : BytesHexFormat . Builder . ( ) -> Unit )

{ <EOL> bytes . builderAction ( ) <EOL> }

/**
 * Provides a scope for configuring the [HexFormat.bytes] format options.
 *
 * See [BytesHexFormat.Builder] for default values of the options.
 */


@ InlineOnly <EOL> public inline fun number ( builderAction : NumberHexFormat . Builder . ( ) -> Unit )

{ <EOL> number . builderAction ( ) <EOL> }

/**
 * Provides a scope for configuring the [HexFormat.number] format options.
 *
 * See [NumberHexFormat.Builder] for default values of the options.
 */


@ ExperimentalStdlibApi <EOL> @ SinceKotlin ( "<STR_LIT:1.9>" ) <EOL> @ InlineOnly <EOL> public inline fun HexFormat ( builderAction : HexFormat . Builder . ( ) -> Unit ) : HexFormat

{ <EOL> return HexFormat . Builder ( ) . apply ( builderAction ) . build ( ) <EOL> }

/**
 * Builds a new [HexFormat] by configuring its format options using the specified [builderAction],
 * and returns the resulting format.
 *
 * The builder passed as a receiver to the [builderAction] is valid only inside that function.
 * Using it outside the function produces an unspecified behavior.
 */


@ JvmOverloads <EOL> public fun seconds ( timeout : Int , cancelOnTimeout : Boolean = false , enableCoroutineCreationStackTraces : Boolean = true ) : CoroutinesTimeoutExtension

= <EOL> CoroutinesTimeoutExtension ( enableCoroutineCreationStackTraces , timeout . toLong ( ) * <NUM_LIT> , cancelOnTimeout )

/**
 * Creates the [CoroutinesTimeoutExtension] extension with the given timeout in seconds.
 */


private fun initialize ( extensionContext : ExtensionContext )

{ <EOL> val store : ExtensionContext . Store = extensionContext . getStore ( ExtensionContext . Namespace . create ( CoroutinesTimeoutExtension :: class , extensionContext . uniqueId ) ) <EOL> synchronized ( store ) { <EOL> if ( store [ "<STR_LIT>" ] == null ) { <EOL> if ( ! tryPassDebugProbesOwnership ( ) ) { <EOL> DebugProbes . enableCreationStackTraces = enableCoroutineCreationStackTraces <EOL> DebugProbes . install ( ) <EOL> } <EOL> store . put ( "<STR_LIT>" , ExtensionContext . Store . CloseableResource { DebugProbes . uninstall ( ) } ) <EOL> } else if ( ! debugProbesOwnershipPassed . get ( ) ) { <EOL> if ( tryPassDebugProbesOwnership ( ) ) { <EOL> DebugProbes . uninstall ( ) <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Initialize this extension instance and/or the extension value store.
 *
 * It seems that the only way to reliably have JUnit5 clean up after its extensions is to put an instance of
 * [ExtensionContext.Store.CloseableResource] into the value store corresponding to the extension instance, which
 * means that [DebugProbes.uninstall] must be placed into the value store. [debugProbesOwnershipPassed] is `true`
 * if the call to [DebugProbes.install] performed in the constructor of the extension instance was matched with a
 * placing of [DebugProbes.uninstall] into the value store. We call the process of placing the cleanup procedure
 * "passing the ownership", as now JUnit5 (and not our code) has to worry about uninstalling the debug probes.
 *
 * However, extension instances can be reused with different value stores, and value stores can be reused across
 * extension instances. This leads to a tricky scheme of performing [DebugProbes.uninstall]:
 *
 * - If neither the ownership of this instance's [DebugProbes] was yet passed nor there is any cleanup procedure
 * stored, it means that we can just store our cleanup procedure, passing the ownership.
 * - If the ownership was not yet passed, but a cleanup procedure is already stored, we can't just replace it with
 * another one, as this would lead to imbalance between [DebugProbes.install] and [DebugProbes.uninstall].
 * Instead, we know that this extension context will at least outlive this use of this instance, so some debug
 * probes other than the ones from our constructor are already installed and won't be uninstalled during our
 * operation. We simply uninstall the debug probes that were installed in our constructor.
 * - If the ownership was passed, but the store is empty, it means that this test instance is reused and, possibly,
 * the debug probes installed in its constructor were already uninstalled. This means that we have to install them
 * anew and store an uninstaller.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalTime :: class ) <EOL> public fun DurationUnit . toTimeUnit ( ) : TimeUnit

= timeUnit

/**
 * Converts this [kotlin.time.DurationUnit][DurationUnit] enum value to the corresponding [java.util.concurrent.TimeUnit][java.util.concurrent.TimeUnit] value.
 */


@ SinceKotlin ( "<STR_LIT:1.8>" ) <EOL> @ WasExperimental ( ExperimentalTime :: class ) <EOL> public fun TimeUnit . toDurationUnit ( ) : DurationUnit

= when ( this ) { <EOL> TimeUnit . NANOSECONDS -> DurationUnit . NANOSECONDS <EOL> TimeUnit . MICROSECONDS -> DurationUnit . MICROSECONDS <EOL> TimeUnit . MILLISECONDS -> DurationUnit . MILLISECONDS <EOL> TimeUnit . SECONDS -> DurationUnit . SECONDS <EOL> TimeUnit . MINUTES -> DurationUnit . MINUTES <EOL> TimeUnit . HOURS -> DurationUnit . HOURS <EOL> TimeUnit . DAYS -> DurationUnit . DAYS <EOL> }

/**
 * Converts this [java.util.concurrent.TimeUnit][java.util.concurrent.TimeUnit] enum value to the corresponding [kotlin.time.DurationUnit][DurationUnit] value.
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun LinAlg . qr ( mat : MultiArray < Float , D2 > ) : Pair < D2Array < Float > , D2Array < Float > >

= this . linAlgEx . qrF ( mat )

/**
 * Returns QR decomposition of the float matrix
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Number > LinAlg . qr ( mat : MultiArray < T , D2 > ) : Pair < D2Array < Double > , D2Array < Double > >

= this . linAlgEx . qr ( mat )

/**
 * Returns QR decomposition of the numeric matrix
 */


@ JvmName ( "<STR_LIT>" ) <EOL> public fun < T : Complex > LinAlg . qr ( mat : MultiArray < T , D2 > ) : Pair < D2Array < T > , D2Array < T > >

= this . linAlgEx . qrC ( mat )

/**
 * Returns QR decomposition of the complex matrix
 */


fun runONNXAdditionalTraining ( modelType : ONNXModels . CVnoTop )

{ <EOL> val modelHub = ONNXModelHub ( cacheDirectory = File ( "<STR_LIT>" ) ) <EOL> val dogsVsCatsDatasetPath = dogsCatsSmallDatasetPath ( ) <EOL> modelHub . loadModel ( modelType ) . use { model -> <EOL> println ( model ) <EOL> val preprocessing = modelType . createPreprocessing ( model ) . onnx { onnxModel = model } <EOL> val dataset = OnFlyImageDataset . create ( File ( dogsVsCatsDatasetPath ) , FromFolders ( mapping = mapOf ( "<STR_LIT>" to <NUM_LIT:0> , "<STR_LIT>" to <NUM_LIT:1> ) ) , preprocessing ) . shuffle ( ) <EOL> val ( train , test ) = dataset . split ( TRAIN_TEST_SPLIT_RATIO ) <EOL> val topModel = Sequential . of ( Input ( model . outputShape [ <NUM_LIT:1> ] , model . outputShape [ <NUM_LIT:2> ] , model . outputShape [ <NUM_LIT:3> ] ) , GlobalAvgPool2D ( ) , Dense ( NUM_CLASSES , Activations . Linear , kernelInitializer = HeNormal ( <NUM_LIT> ) , biasInitializer = Zeros ( ) ) ) <EOL> topModel . use { <EOL> topModel . compile ( optimizer = Adam ( ) , loss = Losses . SOFT_MAX_CROSS_ENTROPY_WITH_LOGITS , metric = Metrics . ACCURACY ) <EOL> topModel . fit ( dataset = train , epochs = EPOCHS , batchSize = TRAINING_BATCH_SIZE ) <EOL> val accuracy = topModel . evaluate ( dataset = test , batchSize = TEST_BATCH_SIZE ) . metrics [ Metrics . ACCURACY ] <EOL> println ( "<STR_LIT>" ) <EOL> } <EOL> } <EOL> }

/**
 * This examples demonstrates the transfer learning concept on the Image Recognition model:
 * - Model configuration, model weights and labels are obtained from [ONNXModelHub].
 * - All layers, excluding the last [Dense], are added to the new Neural Network, its weights are frozen.
 * - ONNX frozen model is used as a preprocessing stage via `onnx` stage of the Image Preprocessing DSL.
 * - New Dense layers are added and initialized via defined initializers.
 * - Model is re-trained on [dogsCatsDatasetPath] dataset.
 *
 *
 * We use the preprocessing DSL to describe the dataset generation pipeline.
 * We demonstrate the workflow on the subset of Kaggle Cats vs Dogs binary classification dataset.
 */


fun createClass ( descriptor : ClassDescriptor , builder : ( IrClass ) -> Unit ) : IrClass

= <EOL> symbolTable . descriptorExtension . declareClass ( descriptor ) { <EOL> symbolTable . irFactory . createIrClassFromDescriptor ( SYNTHETIC_OFFSET , SYNTHETIC_OFFSET , IrDeclarationOrigin . IR_EXTERNAL_DECLARATION_STUB , it , descriptor ) <EOL> } . also { irClass -> <EOL> symbolTable . withScope ( irClass ) { <EOL> irClass . superTypes += descriptor . typeConstructor . supertypes . map { <EOL> it . toIrType ( ) <EOL> } <EOL> irClass . generateAnnotations ( ) <EOL> irClass . createParameterDeclarations ( ) <EOL> builder ( irClass ) <EOL> createFakeOverrides ( descriptor ) . forEach ( irClass :: addMember ) <EOL> } <EOL> }

/**
 * Declares [IrClass] instance from [descriptor] and populates it with
 * supertypes, <this> parameter declaration and fake overrides.
 * Additional elements are passed via [builder] callback.
 */


@ OptIn ( ObsoleteDescriptorBasedAPI :: class ) <EOL> internal fun IrSymbol . findCEnumDescriptor ( ) : ClassDescriptor ?

= <EOL> descriptor . findCEnumDescriptor ( )

/**
 * All enums that come from interop library implement CEnum interface.
 * This function checks that given symbol located in subtree of
 * CEnum inheritor.
 */


@ OptIn ( ObsoleteDescriptorBasedAPI :: class ) <EOL> internal fun IrSymbol . findCStructDescriptor ( ) : ClassDescriptor ?

= <EOL> descriptor . findCStructDescriptor ( )

/**
 * All structs that come from interop library inherit from CStructVar class.
 * This function checks that given symbol located in subtree of
 * CStructVar inheritor.
 */


public fun KtType . isArrayOrPrimitiveArray ( ) : Boolean

= <EOL> withValidityAssertion { analysisSession . typeInfoProvider . isArrayOrPrimitiveArray ( this ) }

/**
 * Returns whether the given [KtType] is an array or a primitive array type or not.
 */


public fun KtType . isNestedArray ( ) : Boolean

= withValidityAssertion { analysisSession . typeInfoProvider . isNestedArray ( this ) }

/**
 * Returns whether the given [KtType] is an array or a primitive array type and its element is also an array type or not.
 */


= if ( this in kotlinKeywords || this . contains ( "<STR_LIT:$>" ) ) { <EOL> "<STR_LIT>" <EOL> } else { <EOL> this . replace ( '<CHAR_LIT::>' , '<CHAR_LIT:_>' ) <EOL> }

/**
 * For this identifier constructs the string to be parsed by Kotlin as `SimpleName`
 * defined [here](https://kotlinlang.org/docs/reference/grammar.html#SimpleName).
 */


internal fun mangleSimple ( name : String ) : String

{ <EOL> val reserved = setOf ( "<STR_LIT>" ) <EOL> val postfix = "<STR_LIT>" <EOL> return if ( name in reserved ) <EOL> "<STR_LIT>" <EOL> else <EOL> name <EOL> }

/**
 * Yet another mangler, particularly to avoid secondary clash, e.g. when a property
 * in prototype (interface) is mangled and that will cause another clash in the class
 * which implements this interface.
 * Rationale: keep algorithm simple but use the mangling characters which are rare
 * in normal code, and keep mangling easy readable.
 */


fun String . quoteAsKotlinLiteral ( ) : KotlinExpression

= buildString { <EOL> append ( '<CHAR_LIT:">' ) <EOL> this@quoteAsKotlinLiteral . forEach { c -> <EOL> when ( c ) { <EOL> in charactersAllowedInKotlinStringLiterals -> append ( c ) <EOL> '<CHAR_LIT:$>' -> append ( "<STR_LIT>" ) <EOL> else -> append ( "<STR_LIT>" + "<STR_LIT>" . format ( c . code ) ) <EOL> } <EOL> } <EOL> append ( '<CHAR_LIT:">' ) <EOL> }

/**
 * Returns the expression to be parsed by Kotlin as string literal with given contents,
 * i.e. transforms `foo$bar` to `"foo\$bar"`.
 */


public fun < T > interceptContinuation ( continuation : Continuation < T > ) : Continuation < T >

/**
 * Returns continuation that wraps the original [continuation], thus intercepting all resumptions.
 * This function is invoked by coroutines framework when needed and the resulting continuations are
 * cached internally per each instance of the original [continuation].
 *
 * This function may simply return original [continuation] if it does not want to intercept this particular continuation.
 *
 * When the original [continuation] completes, coroutine framework invokes [releaseInterceptedContinuation]
 * with the resulting continuation if it was intercepted, that is if `interceptContinuation` had previously
 * returned a different continuation instance.
 */


public fun releaseInterceptedContinuation ( continuation : Continuation < * > )

{ <EOL> }

/**
 * Invoked for the continuation instance returned by [interceptContinuation] when the original
 * continuation completes and will not be used anymore. This function is invoked only if [interceptContinuation]
 * had returned a different continuation instance from the one it was invoked with.
 *
 * Default implementation does nothing.
 *
 * @param continuation Continuation instance returned by this interceptor's [interceptContinuation] invocation.
 */


fun isSuccessful ( ) : Boolean

/**
 * Returns `true` if constraint system has a solution (has no contradiction and has enough information to infer each registered type variable).
 */


fun hasContradiction ( ) : Boolean

/**
 * Return `true` if constraint system has no contradiction (it can be not successful because of the lack of information for a type variable).
 */


fun hasConflictingConstraints ( ) : Boolean

/**
 * Returns `true` if type constraints for some type variable are contradicting.
 *
 * For example, for `fun <R> foo(r: R, t: java.util.List<R>) {}` in invocation `foo(1, arrayList("s"))`
 * type variable `R` has two conflicting constraints:
 * - "R is a supertype of Int"
 * - "List<R> is a supertype of List<String>" which leads to "R is equal to String"
 */


fun hasViolatedUpperBound ( ) : Boolean

/**
 * Returns `true` if contradiction of type constraints comes from declared bounds for type parameters.
 *
 * For example, for `fun <R: Any> foo(r: R) {}` in invocation `foo(null)`
 * upper bounds `Any` for type parameter `R` is violated.
 *
 * It's the special case of 'hasConflictingConstraints' case.
 */


fun hasUnknownParameters ( ) : Boolean

/**
 * Returns `true` if there is no information for some registered type variable.
 *
 * For example, for `fun <E> newList()` in invocation `val nl = newList()`
 * there is no information to infer type variable `E`.
 */


fun hasParameterConstraintError ( ) : Boolean

/**
 * Returns `true` if some constraint cannot be processed because of type constructor mismatch.
 *
 * For example, for `fun <R> foo(t: List<R>) {}` in invocation `foo(hashSetOf("s"))`
 * there is type constructor mismatch: "HashSet<String> cannot be a subtype of List<R>".
 */


fun hasOnlyErrorsDerivedFrom ( kind : ConstraintPositionKind ) : Boolean

/**
 * Returns `true` if there is type constructor mismatch only in constraintPosition or
 * constraint system is successful without constraints from this position.
 */


fun hasErrorInConstrainingTypes ( ) : Boolean

/**
 * Returns `true` if there is an error in constraining types.
 * Is used not to generate type inference error if there was one in argument types.
 */


fun hasCannotCaptureTypesError ( ) : Boolean

/**
 * Returns `true` if a user type contains the type projection that cannot be captured.
 *
 * For example, for `fun <T> foo(t: Array<Array<T>>) {}`
 * in invocation `foo(array)` where `array` has type `Array<Array<out Int>>`.
 */


fun hasTypeInferenceIncorporationError ( ) : Boolean

/**
 * Returns `true` if there's an error in constraint system incorporation.
 */


public fun formatLine ( columnSeparator : String , columnWidths : List < Int > , rows : List < String > ) : String

{ <EOL> return columnWidths <EOL> . mapIndexed { index , columnWidth -> ( rows . getOrNull ( index ) ? : "<STR_LIT>" ) . padEnd ( columnWidth ) } <EOL> . joinToString ( separator = columnSeparator ) <EOL> }

/**
 * Format a list of strings to a single line with appropriate paddings for each column.
 * @param [columnSeparator] sequence of symbols to separate columns
 * @param [columnWidths] widths of all columns
 * @param [rows] list of strings to substitute to columns
 */


public fun formatTable ( sections : List < Section > , columnSeparator : String = "<STR_LIT:U+0020>" , lineSeparatorSymbol : Char = '<CHAR_LIT:_>' , thickLineSeparatorSymbol : Char = '<CHAR_LIT>' , ) : List < String >

{ <EOL> require ( sections . isNotEmpty ( ) ) { "<STR_LIT>" } <EOL> val sectionsWithColumns = sections . filterIsInstance < SectionWithColumns > ( ) <EOL> val columnsCount = sectionsWithColumns . maxOf { it . columnsCount } <EOL> val columnWidth = List ( columnsCount ) { column -> <EOL> sectionsWithColumns . maxOfOrNull { section -> section . columnWidth ( column ) } ? : <NUM_LIT:0> <EOL> } <EOL> val simpleSectionsWidth = sections . filterIsInstance < SimpleSection > ( ) . maxOfOrNull ( SimpleSection :: width ) ? : <NUM_LIT:0> <EOL> val sectionsWithColumnWidth = columnWidth . sum ( ) + <EOL> ( columnWidth . size - <NUM_LIT:1> ) . coerceAtLeast ( <NUM_LIT:0> ) * columnSeparator . length <EOL> val tableWidth = max ( simpleSectionsWidth , sectionsWithColumnWidth ) <EOL> val result = mutableListOf < String > ( ) <EOL> for ( section in sections ) { <EOL> val lines = when ( section ) { <EOL> is SimpleSection -> section . format ( tableWidth , lineSeparatorSymbol , thickLineSeparatorSymbol ) <EOL> is SectionWithColumns -> section . format ( columnWidth , tableWidth , columnSeparator , lineSeparatorSymbol , thickLineSeparatorSymbol ) <EOL> } <EOL> result . addAll ( lines ) <EOL> } <EOL> return result <EOL> }

/**
 * Pretty print table from multiple sections.
 * Each section consists of multiple rows, each row may consist of multiple lines.
 * Sections may or may not have columns.
 *
 * @see [Section]
 * @param [sections] list of sections to print
 * @param [columnSeparator] sequence of symbols to separate columns
 * @param [lineSeparatorSymbol] character that will be used to produce a string to separate rows.
 * @param [thickLineSeparatorSymbol] character that will be used to produce a string to separate sections.
 */


public fun format ( tableWidth : Int , lineSeparatorSymbol : Char = '<CHAR_LIT:_>' , thickLineSeparatorSymbol : Char = '<CHAR_LIT>' , ) : List < String >

{ <EOL> require ( tableWidth >= width ) { "<STR_LIT>" } <EOL> val thickLineSeparator = thickLineSeparatorSymbol . toString ( ) . repeat ( tableWidth ) <EOL> val lineSeparator = lineSeparatorSymbol . toString ( ) . repeat ( tableWidth ) <EOL> val result = mutableListOf < String > ( ) <EOL> result . add ( thickLineSeparator ) <EOL> result . addAll ( rows ) <EOL> result . add ( lineSeparator ) <EOL> return result <EOL> }

/**
 * Format section to a list of strings, properly aligned with other sections.
 * @param [tableWidth] required width of the section to be aligned with other sections of the table
 * @param [lineSeparatorSymbol] symbol to use for line separator
 * @param [thickLineSeparatorSymbol] symbol to use for thick line separator
 */


public fun columnWidth ( column : Int ) : Int

{ <EOL> return rows . maxOf { it . columnWidth ( column ) } <EOL> . coerceAtLeast ( columnNames . getOrNull ( column ) ? . length ? : <NUM_LIT:0> ) <EOL> }

/**
 * Calculate the width of the [column] in the section.
 * It is the maximum width of the column name and all the cells in the column.
 * If section has no column with the given index, returns 0.
 * @param [column] index of the column
 */


public fun format ( alignedColumnsWidths : List < Int > , tableWidth : Int , columnSeparator : String = "<STR_LIT:U+0020>" , lineSeparatorSymbol : Char = '<CHAR_LIT:_>' , thickLineSeparatorSymbol : Char = '<CHAR_LIT>' , ) : List < String >

{ <EOL> val lineSeparator = lineSeparatorSymbol . toString ( ) . repeat ( tableWidth ) <EOL> val thickLineSeparator = thickLineSeparatorSymbol . toString ( ) . repeat ( tableWidth ) <EOL> val result = mutableListOf < String > ( ) <EOL> result . add ( formatLine ( columnSeparator , alignedColumnsWidths , columnNames ) ) <EOL> result . add ( thickLineSeparator ) <EOL> rows . forEach { row -> <EOL> result . addAll ( row . format ( columnSeparator , alignedColumnsWidths ) ) <EOL> result . add ( lineSeparator ) <EOL> } <EOL> return result <EOL> }

/**
 * Format section to a list of strings, properly aligned with other sections.
 * @param [alignedColumnsWidths] required widths of all columns to be aligned with other sections of the table
 * @param [columnSeparator] sequence of symbols to separate columns
 * @param [lineSeparatorSymbol] symbol to use for line separator
 * @param [thickLineSeparatorSymbol] symbol to use for thick line separator
 */


{ <EOL> val cell = cells . getOrNull ( column ) ? : return <NUM_LIT:0> <EOL> return cell . width <EOL> }


public fun format ( columnSeparator : String , columnsWidths : List < Int > ) : List < String >

{ <EOL> return lines . map { line -> formatLine ( columnSeparator , columnsWidths , line ) } <EOL> }

/**
 * Format all lines of the row to fit the specified column widths.
 */


{ <EOL> if ( argumentsUsageNumber . isEmpty ( ) ) <EOL> return null <EOL> val ( currentDescriptor , usageNumber ) = argumentsUsageNumber . iterator ( ) . next ( ) <EOL> currentDescriptor . number ? . let { <EOL> if ( usageNumber + <NUM_LIT:1> >= currentDescriptor . number ) { <EOL> argumentsUsageNumber . remove ( currentDescriptor ) <EOL> } else { <EOL> argumentsUsageNumber [ currentDescriptor ] = usageNumber + <NUM_LIT:1> <EOL> } <EOL> } <EOL> return currentDescriptor . fullName <EOL> }

/**
 * Get next descriptor from queue.
 */


operator fun getValue ( thisRef : Any ? , property : KProperty < * > ) : T

= value

/** Provides the value for the delegated property getter. Returns the [value] property.
 * @throws IllegalStateException in case of accessing the value before [ArgParser.parse] method is called.
 */


operator fun setValue ( thisRef : Any ? , property : KProperty < * > , value : T )

{ <EOL> this . value = value <EOL> }

/** Sets the [value] to the [ArgumentValueDelegate.value] property from the delegated property setter.
 * This operation is possible only after command line arguments were parsed with [ArgParser.parse]
 * @throws IllegalStateException in case of resetting value before command line arguments are parsed.
 */


abstract fun execute ( )

/**
 * Execute action if subcommand was provided.
 */


fun < T : Any > option ( type : ArgType < T > , fullName : String ? = null , shortName : String ? = null , description : String ? = null , deprecatedWarning : String ? = null ) : SingleNullableOption < T >

{ <EOL> if ( prefixStyle == OptionPrefixStyle . GNU && shortName != null ) <EOL> require ( shortName . length == <NUM_LIT:1> ) { <EOL> """<STR_LIT>""" . trimIndent ( ) <EOL> } <EOL> val option = SingleNullableOption ( OptionDescriptor ( optionFullFormPrefix , optionShortFromPrefix , type , fullName , shortName , description , deprecatedWarning = deprecatedWarning ) , CLIEntityWrapper ( ) ) <EOL> option . owner . entity = option <EOL> declaredOptions . add ( option . owner ) <EOL> return option <EOL> }

/**
 * Declares a named option and returns an object which can be used to access the option value
 * after all arguments are parsed or to delegate a property for accessing the option value to.
 *
 * By default, the option supports only a single value, is optional, and has no default value,
 * therefore its value's type is `T?`.
 *
 * You can alter the option properties by chaining extensions for the option type on the returned object:
 * - [AbstractSingleOption.default] to provide a default value that is used when the option is not specified;
 * - [SingleNullableOption.required] to make the option non-optional;
 * - [AbstractSingleOption.delimiter] to allow specifying multiple values in one command line argument with a delimiter;
 * - [AbstractSingleOption.multiple] to allow specifying the option several times.
 *
 * @param type The type describing how to parse an option value from a string,
 * an instance of [ArgType], e.g. [ArgType.String] or [ArgType.Choice].
 * @param fullName the full name of the option, can be omitted if the option name is inferred
 * from the name of a property delegated to this option.
 * @param shortName the short name of the option, `null` if the option cannot be specified in a short form.
 * @param description the description of the option used when rendering the usage information.
 * @param deprecatedWarning the deprecation message for the option.
 * Specifying anything except `null` makes this option deprecated. The message is rendered in a help message and
 * issued as a warning when the option is encountered when parsing command line arguments.
 */


private fun inspectRequiredAndDefaultUsage ( )

{ <EOL> var previousArgument : ParsingValue < * , * > ? = null <EOL> arguments . forEach { ( _ , currentArgument ) -> <EOL> previousArgument ? . let { previous -> <EOL> if ( previous . descriptor . defaultValueSet ) { <EOL> if ( ! currentArgument . descriptor . defaultValueSet && currentArgument . descriptor . required ) { <EOL> error ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> } <EOL> if ( ! previous . descriptor . required ) { <EOL> if ( ! currentArgument . descriptor . defaultValueSet && currentArgument . descriptor . required ) { <EOL> error ( "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> } <EOL> } <EOL> previousArgument = currentArgument <EOL> } <EOL> }

/**
 * Check usage of required property for arguments.
 * Make sense only for several last arguments.
 */


fun < T : Any > argument ( type : ArgType < T > , fullName : String ? = null , description : String ? = null , deprecatedWarning : String ? = null ) : SingleArgument < T , DefaultRequiredType . Required >

{ <EOL> val argument = SingleArgument < T , DefaultRequiredType . Required > ( ArgDescriptor ( type , fullName , <NUM_LIT:1> , description , deprecatedWarning = deprecatedWarning ) , CLIEntityWrapper ( ) ) <EOL> argument . owner . entity = argument <EOL> declaredArguments . add ( argument . owner ) <EOL> return argument <EOL> }

/**
 * Declares an argument and returns an object which can be used to access the argument value
 * after all arguments are parsed or to delegate a property for accessing the argument value to.
 *
 * By default, the argument supports only a single value, is required, and has no default value,
 * therefore its value's type is `T`.
 *
 * You can alter the argument properties by chaining extensions for the argument type on the returned object:
 * - [AbstractSingleArgument.default] to provide a default value that is used when the argument is not specified;
 * - [SingleArgument.optional] to allow omitting the argument;
 * - [AbstractSingleArgument.multiple] to require the argument to have exactly the number of values specified;
 * - [AbstractSingleArgument.vararg] to allow specifying an unlimited number of values for the _last_ argument.
 *
 * @param type The type describing how to parse an option value from a string,
 * an instance of [ArgType], e.g. [ArgType.String] or [ArgType.Choice].
 * @param fullName the full name of the argument, can be omitted if the argument name is inferred
 * from the name of a property delegated to this argument.
 * @param description the description of the argument used when rendering the usage information.
 * @param deprecatedWarning the deprecation message for the argument.
 * Specifying anything except `null` makes this argument deprecated. The message is rendered in a help message and
 * issued as a warning when the argument is encountered when parsing command line arguments.
 */


@ ExperimentalCli <EOL> fun subcommands ( vararg subcommandsList : Subcommand )

{ <EOL> subcommandsList . forEach { <EOL> if ( it . name in subcommands ) { <EOL> error ( "<STR_LIT>" ) <EOL> } <EOL> it . prefixStyle = prefixStyle <EOL> it . useDefaultHelpShortName = useDefaultHelpShortName <EOL> it . strictSubcommandOptionsOrder = strictSubcommandOptionsOrder <EOL> fullCommandName . forEachIndexed { index , namePart -> <EOL> it . fullCommandName . add ( index , namePart ) <EOL> } <EOL> it . outputAndTerminate = outputAndTerminate <EOL> subcommands [ it . name ] = it <EOL> } <EOL> }

/**
 * Registers one or more subcommands.
 *
 * @param subcommandsList subcommands to add.
 */


private fun printError ( message : String ) : Nothing

{ <EOL> outputAndTerminate ( "<STR_LIT>" , <NUM_LIT> ) <EOL> }

/**
 * Outputs an error message adding the usage information after it.
 *
 * @param message error message.
 */


private fun saveAsArg ( arg : String , argumentsQueue : ArgumentsQueue ) : Boolean

{ <EOL> val name = argumentsQueue . pop ( ) <EOL> name ? . let { <EOL> val argumentValue = arguments [ name ] ! ! <EOL> argumentValue . descriptor . deprecatedWarning ? . let { printWarning ( it ) } <EOL> argumentValue . addValue ( arg ) <EOL> return true <EOL> } <EOL> return false <EOL> }

/**
 * Save value as argument value.
 *
 * @param arg string with argument value.
 * @param argumentsQueue queue with active argument descriptors.
 */


private fun treatAsArgument ( arg : String , argumentsQueue : ArgumentsQueue )

{ <EOL> if ( ! saveAsArg ( arg , argumentsQueue ) ) { <EOL> usedSubcommand ? . let { <EOL> ( if ( treatAsOption ) subcommandsOptions else subcommandsArguments ) . add ( arg ) <EOL> } ? : printError ( "<STR_LIT>" ) <EOL> } <EOL> }

/**
 * Treat value as argument value.
 *
 * @param arg string with argument value.
 * @param argumentsQueue queue with active argument descriptors.
 */


private fun < T : Any , U : Any > saveAsOption ( parsingValue : ParsingValue < T , U > , value : String )

{ <EOL> parsingValue . addValue ( value ) <EOL> }


private fun recognizeAndSaveOptionFullForm ( candidate : String , argIterator : Iterator < String > ) : Boolean

{ <EOL> if ( prefixStyle == OptionPrefixStyle . GNU && candidate == optionFullFormPrefix ) { <EOL> treatAsOption = false <EOL> return false <EOL> } <EOL> if ( ! candidate . startsWith ( optionFullFormPrefix ) ) <EOL> return false <EOL> val optionString = candidate . substring ( optionFullFormPrefix . length ) <EOL> val argValue = if ( prefixStyle == OptionPrefixStyle . GNU ) null else options [ optionString ] <EOL> if ( argValue != null ) { <EOL> saveStandardOptionForm ( argValue , argIterator ) <EOL> return true <EOL> } else { <EOL> if ( prefixStyle == OptionPrefixStyle . GNU ) { <EOL> if ( options [ optionString ] ? . descriptor ? . type ? . hasParameter == false ) { <EOL> saveOptionWithoutParameter ( options [ optionString ] ! ! ) <EOL> return true <EOL> } <EOL> val optionParts = optionString . split ( '<CHAR_LIT>' , limit = <NUM_LIT:2> ) <EOL> if ( optionParts . size != <NUM_LIT:2> ) <EOL> return false <EOL> if ( options [ optionParts [ <NUM_LIT:0> ] ] != null ) { <EOL> saveAsOption ( options [ optionParts [ <NUM_LIT:0> ] ] ! ! , optionParts [ <NUM_LIT:1> ] ) <EOL> return true <EOL> } <EOL> } <EOL> } <EOL> return false <EOL> }

/**
 * Try to recognize and save command line element as full form of option.
 *
 * @param candidate string with candidate in options.
 * @param argIterator iterator over command line arguments.
 */


internal fun saveOptionWithoutParameter ( argValue : ParsingValue < * , * > )

{ <EOL> if ( argValue . descriptor . fullName == "<STR_LIT>" ) { <EOL> usedSubcommand ? . let { <EOL> it . parse ( listOf ( "<STR_LIT>" ) ) <EOL> } <EOL> outputAndTerminate ( makeUsage ( ) , <NUM_LIT:0> ) <EOL> } <EOL> saveAsOption ( argValue , "<STR_LIT:true>" ) <EOL> }

/**
 * Save option without parameter.
 *
 * @param argValue argument value with all information about option.
 */


private fun saveStandardOptionForm ( argValue : ParsingValue < * , * > , argIterator : Iterator < String > )

{ <EOL> if ( argValue . descriptor . type . hasParameter ) { <EOL> if ( argIterator . hasNext ( ) ) { <EOL> saveAsOption ( argValue , argIterator . next ( ) ) <EOL> } else { <EOL> printError ( "<STR_LIT>" ) <EOL> } <EOL> } else { <EOL> saveOptionWithoutParameter ( argValue ) <EOL> } <EOL> }

/**
 * Save option described with standard separated form `--name value`.
 *
 * @param argValue argument value with all information about option.
 * @param argIterator iterator over command line arguments.
 */


private fun recognizeAndSaveOptionShortForm ( candidate : String , argIterator : Iterator < String > ) : Boolean

{ <EOL> if ( ! candidate . startsWith ( optionShortFromPrefix ) || optionFullFormPrefix != optionShortFromPrefix && candidate . startsWith ( optionFullFormPrefix ) ) return false <EOL> val option = candidate . substring ( optionShortFromPrefix . length ) <EOL> val argValue = shortNames [ option ] <EOL> if ( argValue != null ) { <EOL> saveStandardOptionForm ( argValue , argIterator ) <EOL> } else { <EOL> if ( prefixStyle != OptionPrefixStyle . GNU || option . isEmpty ( ) ) <EOL> return false <EOL> val firstOption = shortNames [ "<STR_LIT>" ] ? : return false <EOL> if ( firstOption . descriptor . type . hasParameter ) { <EOL> saveAsOption ( firstOption , option . substring ( <NUM_LIT:1> ) ) <EOL> } else { <EOL> val otherBooleanOptions = option . substring ( <NUM_LIT:1> ) <EOL> saveOptionWithoutParameter ( firstOption ) <EOL> for ( opt in otherBooleanOptions ) { <EOL> shortNames [ "<STR_LIT>" ] ? . let { <EOL> if ( it . descriptor . type . hasParameter ) { <EOL> printError ( "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" ) <EOL> } <EOL> } ? : printError ( "<STR_LIT>" ) <EOL> saveOptionWithoutParameter ( shortNames [ "<STR_LIT>" ] ! ! ) <EOL> } <EOL> } <EOL> } <EOL> return true <EOL> }

/**
 * Try to recognize and save command line element as short form of option.
 *
 * @param candidate string with candidate in options.
 * @param argIterator iterator over command line arguments.
 */


fun parse ( args : Array < out String > ) : ArgParserResult

= parse ( args . asList ( ) )

/**
 * Parses the provided array of command line arguments.
 * After a successful parsing, the options and arguments declared in this parser get their values and can be accessed
 * with the properties delegated to them.
 *
 * @param args the array with command line arguments.
 *
 * @return an [ArgParserResult] if all arguments were parsed successfully.
 * Otherwise, prints the usage information and terminates the program execution.
 * @throws IllegalStateException in case of attempt of calling parsing several times.
 */


{ <EOL> val result = StringBuilder ( ) <EOL> result . append ( "<STR_LIT>" ) <EOL> if ( subcommands . isNotEmpty ( ) ) { <EOL> result . append ( "<STR_LIT>" ) <EOL> subcommands . forEach { ( _ , subcommand ) -> <EOL> result . append ( subcommand . helpMessage ) <EOL> } <EOL> result . append ( "<STR_LIT:\n>" ) <EOL> } <EOL> if ( arguments . isNotEmpty ( ) ) { <EOL> result . append ( "<STR_LIT>" ) <EOL> arguments . forEach { <EOL> result . append ( it . value . descriptor . helpMessage ) <EOL> } <EOL> } <EOL> if ( options . isNotEmpty ( ) ) { <EOL> result . append ( "<STR_LIT>" ) <EOL> options . forEach { <EOL> result . append ( it . value . descriptor . helpMessage ) <EOL> } <EOL> } <EOL> return result . toString ( ) <EOL> }

/**
 * Creates a message with the usage information.
 */


internal fun printWarning ( message : String )

{ <EOL> println ( "<STR_LIT>" ) <EOL> }

/**
 * Output warning.
 *
 * @param message warning message.
 */


private fun jumpWithFinally ( targetTryDepth : Int , successor : CoroutineBlock , fromNode : JsNode )

{ <EOL> if ( targetTryDepth < tryStack . size ) { <EOL> val tryBlock = tryStack [ targetTryDepth ] <EOL> currentStatements += exceptionState ( tryBlock . catchBlock , fromNode ) <EOL> } <EOL> val relativeFinallyPath = relativeFinallyPath ( targetTryDepth ) <EOL> val fullPath = relativeFinallyPath + successor <EOL> if ( fullPath . size > <NUM_LIT:1> ) { <EOL> currentStatements += updateFinallyPath ( fullPath . drop ( <NUM_LIT:1> ) ) <EOL> } <EOL> currentStatements += state ( fullPath [ <NUM_LIT:0> ] , fromNode ) <EOL> }

/**
 * When we perform break, continue or return, we can leave try blocks, so we should update $exceptionHandler correspondingly.
 * Also, these try blocks can contain finally clauses, therefore we need to update $finallyPath as well.
 */


public fun getAllSymbols ( ) : Sequence < KtDeclarationSymbol >

= withValidityAssertion { <EOL> sequence { <EOL> yieldAll ( getCallableSymbols ( ) ) <EOL> yieldAll ( getClassifierSymbols ( ) ) <EOL> yieldAll ( getConstructors ( ) ) <EOL> } <EOL> }

/**
 * Return a sequence of all [KtDeclarationSymbol] which current scope contain
 */


public fun getCallableSymbols ( nameFilter : KtScopeNameFilter = { true } ) : Sequence < KtCallableSymbol >

/**
 * Return a sequence of [KtCallableSymbol] which current scope contain if declaration name matches [nameFilter].
 *
 * This function needs to retrieve a set of all possible names before processing the scope.
 * The overload with `names: Collection<Name>` should be used when the candidate name set is known.
 */


public fun getCallableSymbols ( names : Collection < Name > ) : Sequence < KtCallableSymbol >

/**
 * Return a sequence of [KtCallableSymbol] which current scope contain, if declaration name present in [names]
 *
 * This implementation is more optimal than the one with `nameFilter` and should be used when the candidate name set is known.
 */


public fun getCallableSymbols ( vararg names : Name ) : Sequence < KtCallableSymbol >

= <EOL> getCallableSymbols ( names . toList ( ) )

/**
 * Return a sequence of [KtCallableSymbol] which current scope contain, if declaration name present in [names]
 *
 * @see getCallableSymbols
 */


public fun getClassifierSymbols ( nameFilter : KtScopeNameFilter = { true } ) : Sequence < KtClassifierSymbol >

/**
 * Return a sequence of [KtClassifierSymbol] which current scope contain if classifier name matches [nameFilter]. The sequence includes:
 * nested classes, inner classes, nested type aliases for the class scope, and top-level classes and top-level type aliases for file scope.
 *
 * This function needs to retrieve a set of all possible names before processing the scope.
 * The overload with `names: Collection<Name>` should be used when the candidate name set is known.
 */


public fun getClassifierSymbols ( names : Collection < Name > ) : Sequence < KtClassifierSymbol >

/**
 * Return a sequence of [KtClassifierSymbol] which current scope contains, if classifier name present in [names].
 *
 * The sequence includes: nested classes, inner classes, nested type aliases for the class scope,
 * and top-level classes and top-level type aliases for file scope.
 *
 * This implementation is more optimal than the one with `nameFilter` and should be used when the candidate name set is known.
 */


public fun getClassifierSymbols ( vararg names : Name ) : Sequence < KtClassifierSymbol >

= <EOL> getClassifierSymbols ( names . toList ( ) )

/**
 * Return a sequence of [KtClassifierSymbol] which current scope contains, if classifier name present in [names].
 *
 * @see getClassifierSymbols
 */


public fun getConstructors ( ) : Sequence < KtConstructorSymbol >

/**
 * Return a sequence of [KtConstructorSymbol] which current scope contain
 */


public fun getPackageSymbols ( nameFilter : KtScopeNameFilter = { true } ) : Sequence < KtPackageSymbol >

/**
 * Return a sequence of [KtPackageSymbol] nested in current scope contain if package name matches [nameFilter]
 */


@ kotlin . jvm . JvmSynthetic <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslList < kotlin . String , FilesProxy > . add ( value : kotlin . String )

{ <EOL> _builder . addFiles ( value ) <EOL> }

/**
 * repeated string files = 1;
 * @param value The files to add.
 */


@ kotlin . jvm . JvmSynthetic <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> inline operator fun com . google . protobuf . kotlin . DslList < kotlin . String , FilesProxy > . plusAssign ( value : kotlin . String )

{ <EOL> add ( value ) <EOL> }


@ kotlin . jvm . JvmSynthetic <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslList < kotlin . String , FilesProxy > . addAll ( values : kotlin . collections . Iterable < kotlin . String > )

{ <EOL> _builder . addAllFiles ( values ) <EOL> }

/**
 * repeated string files = 1;
 * @param values The files to add.
 */


@ kotlin . jvm . JvmSynthetic <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:NOTHING_TO_INLINE>" ) <EOL> inline operator fun com . google . protobuf . kotlin . DslList < kotlin . String , FilesProxy > . plusAssign ( values : kotlin . collections . Iterable < kotlin . String > )

{ <EOL> addAll ( values ) <EOL> }


@ kotlin . jvm . JvmSynthetic <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> operator fun com . google . protobuf . kotlin . DslList < kotlin . String , FilesProxy > . set ( index : kotlin . Int , value : kotlin . String )

{ <EOL> _builder . setFiles ( index , value ) <EOL> }

/**
 * repeated string files = 1;
 * @param index The index to set the value at.
 * @param value The files to set.
 */


@ kotlin . jvm . JvmSynthetic <EOL> @ kotlin . jvm . JvmName ( "<STR_LIT>" ) <EOL> fun com . google . protobuf . kotlin . DslList < kotlin . String , FilesProxy > . clear ( )

{ <EOL> _builder . clearFiles ( ) <EOL> }


public fun < T : Any > JsReference < T > . get ( ) : T

{ <EOL> returnArgumentIfItIsKotlinAny ( ) <EOL> throw ClassCastException ( "<STR_LIT>" ) <EOL> }

/** Retrieve original Kotlin value from JsReference */


{ <EOL> @ Suppress ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> if ( capabilities == null || attributes == null ) { <EOL> return copy ( capabilities = capabilities ? : emptySet ( ) , attributes = attributes ? : IdeaKotlinBinaryAttributes ( ) ) <EOL> } <EOL> return this <EOL> }

/**
 * In order to keep java.io.Serializable implementation backwards compatible:
 * 'capabilities' was added in 1.9.20. If a binary produced before 1.9.20 gets deserialized, then 'capabilities'
 * will be 'null'. In this case we use the 'copy' function to provide an instance that will have an emptySet instead.
 */


@ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> fun copy ( buildId : String = this . buildId , projectPath : String = this . projectPath , projectName : String = this . projectName , ) : IdeaKotlinProjectCoordinates

{ <EOL> return if ( this . buildId != buildId ) { <EOL> IdeaKotlinProjectCoordinates ( buildId = buildId , projectPath = projectPath , projectName = projectName ) <EOL> } else { <EOL> IdeaKotlinProjectCoordinates ( buildName = buildName , buildPath = buildPath , projectPath = projectPath , projectName = projectName ) <EOL> } <EOL> }

/**
 * Keeping binary compatibility!
 */


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> operator fun component1 ( )

= buildId


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> operator fun component2 ( )

= projectPath


@ Deprecated ( "<STR_LIT>" , level = DeprecationLevel . ERROR ) <EOL> operator fun component3 ( )

= projectName


internal fun String . utf8Size ( startIndex : Int = <NUM_LIT:0> , endIndex : Int = length ) : Long

{ <EOL> checkBounds ( length , startIndex , endIndex ) <EOL> var result = <NUM_LIT:0L> <EOL> var i = startIndex <EOL> while ( i < endIndex ) { <EOL> val c = this [ i ] . code <EOL> if ( c < <NUM_LIT> ) { <EOL> result ++ <EOL> i ++ <EOL> } else if ( c < <NUM_LIT> ) { <EOL> result += <NUM_LIT:2> <EOL> i ++ <EOL> } else if ( c < <NUM_LIT> || c > <NUM_LIT> ) { <EOL> result += <NUM_LIT:3> <EOL> i ++ <EOL> } else { <EOL> val low = if ( i + <NUM_LIT:1> < endIndex ) this [ i + <NUM_LIT:1> ] . code else <NUM_LIT:0> <EOL> if ( c > <NUM_LIT> || low < <NUM_LIT> || low > <NUM_LIT> ) { <EOL> result ++ <EOL> i ++ <EOL> } else { <EOL> result += <NUM_LIT:4> <EOL> i += <NUM_LIT:2> <EOL> } <EOL> } <EOL> } <EOL> return result <EOL> }

/**
 * Returns the number of bytes used to encode the slice of `string` as UTF-8 when using [Sink.writeString].
 *
 * @param startIndex the index (inclusive) of the first character to encode, `0` by default.
 * @param endIndex the index (exclusive) of the character past the last character to encode, `string.length` by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of string indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.utf8SizeSample
 */


@ OptIn ( DelicateIoApi :: class ) <EOL> internal fun Sink . writeUtf8CodePoint ( codePoint : Int ) : Unit

= <EOL> writeToInternalBuffer { it . commonWriteUtf8CodePoint ( codePoint ) }

/**
 * Encodes [codePoint] in UTF-8 and writes it to this sink.
 *
 * @param codePoint the codePoint to be written.
 *
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.utf8CodePointSample
 */


@ OptIn ( DelicateIoApi :: class ) <EOL> public fun Sink . writeString ( string : String , startIndex : Int = <NUM_LIT:0> , endIndex : Int = string . length ) : Unit

= <EOL> writeToInternalBuffer { it . commonWriteUtf8 ( string , startIndex , endIndex ) }

/**
 * Encodes the characters at [startIndex] up to [endIndex] from [string] in UTF-8 and writes it to this sink.
 *
 * @param string the string to be encoded.
 * @param startIndex the index (inclusive) of the first character to encode, 0 by default.
 * @param endIndex the index (exclusive) of a character past to a last character to encode, `string.length` by default.
 *
 * @throws IndexOutOfBoundsException when [startIndex] or [endIndex] is out of range of [string] indices.
 * @throws IllegalArgumentException when `startIndex > endIndex`.
 * @throws IllegalStateException when the sink is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.writeUtf8Sample
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . readString ( ) : String

{ <EOL> var req : Long = Segment . SIZE . toLong ( ) <EOL> while ( request ( req ) ) { <EOL> req *= <NUM_LIT:2> <EOL> } <EOL> return buffer . commonReadUtf8 ( buffer . size ) <EOL> }

/**
 * Removes all bytes from this source, decodes them as UTF-8, and returns the string.
 *
 * Returns the empty string if this source is empty.
 *
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUtf8
 */


public fun Buffer . readString ( ) : String

{ <EOL> return commonReadUtf8 ( size ) <EOL> }

/**
 * Removes all bytes from this buffer, decodes them as UTF-8, and returns the string.
 *
 * Returns the empty string if this buffer is empty.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUtf8
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . readString ( byteCount : Long ) : String

{ <EOL> require ( byteCount ) <EOL> return buffer . commonReadUtf8 ( byteCount ) <EOL> }

/**
 * Removes [byteCount] bytes from this source, decodes them as UTF-8, and returns the string.
 *
 * @param byteCount the number of bytes to read from the source for string decoding.
 *
 * @throws IllegalArgumentException when [byteCount] is negative.
 * @throws EOFException when the source is exhausted before reading [byteCount] bytes from it.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUtf8
 */


@ OptIn ( InternalIoApi :: class ) <EOL> internal fun Source . readUtf8CodePoint ( ) : Int

{ <EOL> require ( <NUM_LIT:1> ) <EOL> val b0 = buffer [ <NUM_LIT:0> ] . toInt ( ) <EOL> when { <EOL> b0 and <NUM_LIT> == <NUM_LIT> -> require ( <NUM_LIT:2> ) <EOL> b0 and <NUM_LIT> == <NUM_LIT> -> require ( <NUM_LIT:3> ) <EOL> b0 and <NUM_LIT> == <NUM_LIT> -> require ( <NUM_LIT:4> ) <EOL> } <EOL> return buffer . commonReadUtf8CodePoint ( ) <EOL> }

/**
 * Removes and returns a single UTF-8 code point, reading between 1 and 4 bytes as necessary.
 *
 * If this source is exhausted before a complete code point can be read, this throws an
 * [EOFException] and consumes no input.
 *
 * If this source doesn't start with a properly-encoded UTF-8 code point, this method will remove
 * 1 or more non-UTF-8 bytes and return the replacement character (`U+fffd`). This covers encoding
 * problems (the input is not properly-encoded UTF-8), characters out of range (beyond the
 * `0x10ffff` limit of Unicode), code points for UTF-16 surrogates (`U+d800`..`U+dfff`) and overlong
 * encodings (such as `0xc080` for the NUL character in modified UTF-8).
 *
 * @throws EOFException when the source is exhausted before a complete code point can be read.
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readUtf8CodePointSample
 */


internal fun Buffer . readUtf8CodePoint ( ) : Int

{ <EOL> return this . commonReadUtf8CodePoint ( ) <EOL> }

/**
 * @see Source.readUtf8CodePoint
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . readLine ( ) : String ?

{ <EOL> if ( ! request ( <NUM_LIT:1> ) ) return null <EOL> var lfIndex = this . indexOf ( '<CHAR_LIT:\n>' . code . toByte ( ) ) <EOL> return when ( lfIndex ) { <EOL> - <NUM_LIT:1L> -> readString ( ) <EOL> <NUM_LIT:0L> -> { <EOL> skip ( <NUM_LIT:1> ) <EOL> "<STR_LIT>" <EOL> } <EOL> else -> { <EOL> var skipBytes = <NUM_LIT:1> <EOL> if ( buffer [ lfIndex - <NUM_LIT:1> ] == '<CHAR_LIT:\r>' . code . toByte ( ) ) { <EOL> lfIndex -= <NUM_LIT:1> <EOL> skipBytes += <NUM_LIT:1> <EOL> } <EOL> val string = readString ( lfIndex ) <EOL> skip ( skipBytes . toLong ( ) ) <EOL> string <EOL> } <EOL> } <EOL> }

/**
 * Removes and returns UTF-8 encoded characters up to but not including the next line break. A line break is
 * either `"\n"` or `"\r\n"`; these characters are not included in the result.
 *
 * On the end of the stream this method returns null. If the source doesn't end with a line break, then
 * an implicit line break is assumed. Null is returned once the source is exhausted.
 *
 * @throws IllegalStateException when the source is closed.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readLinesSample
 */


@ OptIn ( InternalIoApi :: class ) <EOL> public fun Source . readLineStrict ( limit : Long = Long . MAX_VALUE ) : String

{ <EOL> require ( limit >= <NUM_LIT:0> ) { "<STR_LIT>" } <EOL> require ( <NUM_LIT:1> ) <EOL> var lfIndex = indexOf ( '<CHAR_LIT:\n>' . code . toByte ( ) , startIndex = <NUM_LIT:0> , endIndex = limit ) <EOL> if ( lfIndex == <NUM_LIT:0L> ) { <EOL> skip ( <NUM_LIT:1> ) <EOL> return "<STR_LIT>" <EOL> } <EOL> if ( lfIndex > <NUM_LIT:0> ) { <EOL> var skipBytes = <NUM_LIT:1L> <EOL> if ( buffer [ lfIndex - <NUM_LIT:1> ] == '<CHAR_LIT:\r>' . code . toByte ( ) ) { <EOL> lfIndex -= <NUM_LIT:1> <EOL> skipBytes += <NUM_LIT:1> <EOL> } <EOL> val str = readString ( lfIndex ) <EOL> skip ( skipBytes ) <EOL> return str <EOL> } <EOL> if ( buffer . size < limit ) throw EOFException ( ) <EOL> if ( limit == Long . MAX_VALUE ) throw EOFException ( ) <EOL> if ( ! request ( limit + <NUM_LIT:1> ) ) throw EOFException ( ) <EOL> val b = buffer [ limit ] <EOL> if ( b == '<CHAR_LIT:\n>' . code . toByte ( ) ) { <EOL> val str = readString ( limit ) <EOL> skip ( <NUM_LIT:1> ) <EOL> return str <EOL> } <EOL> if ( b != '<CHAR_LIT:\r>' . code . toByte ( ) || ! request ( limit + <NUM_LIT:2> ) ) throw EOFException ( ) <EOL> if ( buffer [ limit + <NUM_LIT:1> ] != '<CHAR_LIT:\n>' . code . toByte ( ) ) throw EOFException ( ) <EOL> val res = readString ( limit ) <EOL> skip ( <NUM_LIT:2> ) <EOL> return res <EOL> }

/**
 * Removes and returns UTF-8 encoded characters up to but not including the next line break, throwing
 * [EOFException] if a line break was not encountered. A line break is either `"\n"` or `"\r\n"`;
 * these characters are not included in the result.
 *
 * The returned string will have at most [limit] UTF-8 bytes, and the maximum number of bytes
 * scanned is `limit + 2`. If `limit == 0` this will always throw an [EOFException] because no
 * bytes will be scanned.
 *
 * No bytes are discarded if the match fails.
 *
 * @param limit the maximum UTF-8 bytes constituting a returned string.
 *
 * @throws EOFException when the source does not contain a string consisting with at most [limit] bytes followed by
 * line break characters.
 * @throws IllegalStateException when the source is closed.
 * @throws IllegalArgumentException when [limit] is negative.
 *
 * @sample kotlinx.io.samples.KotlinxIoCoreCommonSamples.readLinesSample
 */


fun KtSimpleNameExpression . getQualifiedElement ( ) : KtElement

{ <EOL> val baseExpression = ( parent as? KtCallExpression ) ? : this <EOL> val parent = baseExpression . parent <EOL> return when ( parent ) { <EOL> is KtQualifiedExpression -> if ( parent . selectorExpression == baseExpression ) parent else baseExpression <EOL> is KtUserType -> if ( parent . referenceExpression == baseExpression ) parent else baseExpression <EOL> else -> baseExpression <EOL> } <EOL> }

/**
 * Returns enclosing qualifying element for given [[KtSimpleNameExpression]]
 * ([[KtQualifiedExpression]] or [[KtUserType]] or original expression)
 */


fun KtElement . getQualifiedElementSelector ( ) : KtElement ?

{ <EOL> return when ( this ) { <EOL> is KtSimpleNameExpression -> this <EOL> is KtCallExpression -> calleeExpression <EOL> is KtQualifiedExpression -> { <EOL> val selector = selectorExpression <EOL> ( selector as? KtCallExpression ) ? . calleeExpression ? : selector <EOL> } <EOL> is KtUserType -> referenceExpression <EOL> else -> null <EOL> } <EOL> }

/**
 * Returns rightmost selector of the qualified element (null if there is no such selector)
 */


fun StubBasedPsiElementBase < out KotlinClassOrObjectStub < out KtClassOrObject > > . getSuperNames ( ) : List < String >

{ <EOL> fun addSuperName ( result : MutableList < String > , referencedName : String ) { <EOL> result . add ( referencedName ) <EOL> val file = containingFile <EOL> if ( file is KtFile ) { <EOL> getImportedSimpleNameByImportAlias ( file , referencedName ) ? . let ( result :: add ) <EOL> } <EOL> } <EOL> require ( this is KtClassOrObject ) { "<STR_LIT>" } <EOL> val stub = stub <EOL> if ( stub != null ) { <EOL> return stub . getSuperNames ( ) <EOL> } <EOL> val specifiers = this . superTypeListEntries <EOL> if ( specifiers . isEmpty ( ) ) return Collections . emptyList ( ) <EOL> val result = ArrayList < String > ( ) <EOL> for ( specifier in specifiers ) { <EOL> val superType = specifier . typeAsUserType <EOL> if ( superType != null ) { <EOL> val referencedName = superType . referencedName <EOL> if ( referencedName != null ) { <EOL> addSuperName ( result , referencedName ) <EOL> } <EOL> } <EOL> } <EOL> return result <EOL> }

/**
 * Returns the list of unqualified names that are indexed as the superclass names of this class. For the names that might be imported
 * via an aliased import, includes both the original and the aliased name (reference resolution during inheritor search will sort this out).
 *
 * @return the list of possible superclass names
 */


fun KtSimpleNameExpression . isCallee ( ) : Boolean

{ <EOL> val parent = parent <EOL> return when ( parent ) { <EOL> is KtCallElement -> parent . calleeExpression == this <EOL> is KtBinaryExpression -> parent . operationReference == this <EOL> else -> { <EOL> val callElement = <EOL> getStrictParentOfType < KtUserType > ( ) <EOL> ? . getStrictParentOfType < KtTypeReference > ( ) <EOL> ? . getStrictParentOfType < KtConstructorCalleeExpression > ( ) <EOL> ? . getStrictParentOfType < KtCallElement > ( ) <EOL> if ( callElement != null ) { <EOL> val ktConstructorCalleeExpression = callElement . calleeExpression as? KtConstructorCalleeExpression <EOL> ( ktConstructorCalleeExpression ? . typeReference ? . typeElement as? KtUserType ) ? . referenceExpression == this <EOL> } else { <EOL> false <EOL> } <EOL> } <EOL> } <EOL> }

/**
 * Check expression might be a callee of call with the same name.
 * Note that 'this' in 'this(args)' isn't considered to be a callee, also 'name' is not a callee in 'name++'.
 */


internal abstract fun getOrBuildFirFor ( element : KtElement ) : FirElement ?

/**
 * Build [FirElement] node in its final resolved state for a requested element.
 *
 * Note: that it isn't always [BODY_RESOLVE][FirResolvePhase.BODY_RESOLVE]
 * as not all declarations have types/bodies/etc. to resolve.
 *
 * This operation could be time-consuming because it creates
 * [FileStructureElement][org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.FileStructureElement]
 * and may resolve non-local declarations into [BODY_RESOLVE][FirResolvePhase.BODY_RESOLVE] phase.
 *
 * Please use [getOrBuildFirFile] to get [FirFile] in undefined phase.
 *
 * @return associated [FirElement] in final resolved state if it exists.
 *
 * @see getOrBuildFirFile
 * @see org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.FirElementBuilder.getOrBuildFirFor
 */


internal abstract fun getOrBuildFirFile ( ktFile : KtFile ) : FirFile

/**
 * Get or build or get cached [FirFile] for requested file in undefined phase
 */


internal fun getDiagnostics ( element : KtElement , filter : DiagnosticCheckerFilter ) : List < KtPsiDiagnostic >

{ <EOL> return diagnosticProvider . getDiagnostics ( element , filter ) <EOL> }

/**
 * @see LLDiagnosticProvider.getDiagnostics
 */


internal fun collectDiagnosticsForFile ( ktFile : KtFile , filter : DiagnosticCheckerFilter ) : Collection < KtPsiDiagnostic >

{ <EOL> return diagnosticProvider . collectDiagnostics ( ktFile , filter ) <EOL> }

/**
 * @see LLDiagnosticProvider.collectDiagnostics
 */


fun declaresDefaultValue ( ) : Boolean

/**
 * @return true iff this parameter belongs to a declared function (not a fake override) and declares the default value,
 * i.e. explicitly specifies it in the function signature. Also see 'hasDefaultValue' extension in DescriptorUtils.kt
 */


override fun getOverriddenDescriptors ( ) : Collection < ValueParameterDescriptor >

/**
 * Parameter p1 overrides p2 iff
 * a) their respective owners (function declarations) f1 override f2
 * b) p1 and p2 have the same indices in the owners' parameter lists
 */


public fun NSOutputStream . asSink ( ) : RawSink

= OutputStreamSink ( this )

/**
 * Returns [RawSink] that writes to an output stream.
 *
 * Use [RawSink.buffered] to create a buffered sink from it.
 *
 * @sample kotlinx.io.samples.KotlinxIoSamplesApple.outputStreamAsSink
 */


public fun NSInputStream . asSource ( ) : RawSource

= NSInputStreamSource ( this )

/**
 * Returns [RawSource] that reads from an input stream.
 *
 * Use [RawSource.buffered] to create a buffered source from it.
 *
 * @sample kotlinx.io.samples.KotlinxIoSamplesApple.inputStreamAsSource
 */


protected abstract fun orderByDeclarationKind ( renderedDeclaration : RenderedDeclaration < * > ) : Int

/**
 * Determines the relative order of the given [renderedDeclaration] to put it upper or lower in the renderer's output.
 * The declarations of different kinds (ex: a class and a function) should always get a different order index.
 */


override fun orderByDeclarationKind ( renderedDeclaration : RenderedDeclaration < * > )

= <EOL> when ( renderedDeclaration . declaration ) { <EOL> is AbiClass -> <NUM_LIT:1> <EOL> is AbiProperty -> <NUM_LIT:2> <EOL> is AbiFunction -> <NUM_LIT:3> <EOL> else -> <NUM_LIT:4> <EOL> }

/**
 * When printing top-level declarations, the following order is used:
 * 1. classes
 * 2. properties
 * 3. functions
 */


= <EOL> when ( val declaration = renderedDeclaration . declaration ) { <EOL> is AbiProperty -> <NUM_LIT:1> <EOL> is AbiFunction -> if ( declaration . isConstructor ) <NUM_LIT:2> else <NUM_LIT:3> <EOL> is AbiClass -> <NUM_LIT:4> <EOL> is AbiEnumEntry -> <NUM_LIT:5> <EOL> }


public fun JsonPrimitive ( value : Boolean ? ) : JsonPrimitive

{ <EOL> if ( value == null ) return JsonNull <EOL> return JsonLiteral ( value , isString = false ) <EOL> }

/** Creates a [JsonPrimitive] from the given boolean. */


public fun JsonPrimitive ( value : Number ? ) : JsonPrimitive

/** Creates a [JsonPrimitive] from the given number. */


@ ExperimentalSerializationApi <EOL> public fun JsonPrimitive ( value : UByte ) : JsonPrimitive

= JsonPrimitive ( value . toULong ( ) )

/**
 * Creates a numeric [JsonPrimitive] from the given [UByte].
 *
 * The value will be encoded as a JSON number.
 */


@ ExperimentalSerializationApi <EOL> public fun JsonPrimitive ( value : UShort ) : JsonPrimitive

= JsonPrimitive ( value . toULong ( ) )

/**
 * Creates a numeric [JsonPrimitive] from the given [UShort].
 *
 * The value will be encoded as a JSON number.
 */


@ ExperimentalSerializationApi <EOL> public fun JsonPrimitive ( value : UInt ) : JsonPrimitive

= JsonPrimitive ( value . toULong ( ) )

/**
 * Creates a numeric [JsonPrimitive] from the given [UInt].
 *
 * The value will be encoded as a JSON number.
 */


@ SuppressAnimalSniffer <EOL> @ ExperimentalSerializationApi <EOL> public fun JsonPrimitive ( value : ULong ) : JsonPrimitive

= JsonUnquotedLiteral ( value . toString ( ) )

/**
 * Creates a numeric [JsonPrimitive] from the given [ULong].
 *
 * The value will be encoded as a JSON number.
 */


public fun JsonPrimitive ( value : String ? ) : JsonPrimitive

{ <EOL> if ( value == null ) return JsonNull <EOL> return JsonLiteral ( value , isString = true ) <EOL> }

/** Creates a [JsonPrimitive] from the given string. */


@ ExperimentalSerializationApi <EOL> @ Suppress ( "<STR_LIT:FunctionName>" , "<STR_LIT:UNUSED_PARAMETER>" ) <EOL> public fun JsonPrimitive ( value : Nothing ? ) : JsonNull

= JsonNull


@ ExperimentalSerializationApi <EOL> @ Suppress ( "<STR_LIT:FunctionName>" ) <EOL> public fun JsonUnquotedLiteral ( value : String ? ) : JsonPrimitive

{ <EOL> return when ( value ) { <EOL> null -> JsonNull <EOL> JsonNull . content -> throw JsonEncodingException ( "<STR_LIT>" ) <EOL> else -> JsonLiteral ( value , isString = false , coerceToInlineType = jsonUnquotedLiteralDescriptor ) <EOL> } <EOL> }

/**
 * Creates a [JsonPrimitive] from the given string, without surrounding it in quotes.
 *
 * This function is provided for encoding raw JSON values that cannot be encoded using the [JsonPrimitive] functions.
 * For example,
 *
 * * precise numeric values (avoiding floating-point precision errors associated with [Double] and [Float]),
 * * large numbers,
 * * or complex JSON objects.
 *
 * Be aware that it is possible to create invalid JSON using this function.
 *
 * Creating a literal unquoted value of `null` (as in, `value == "null"`) is forbidden. If you want to create
 * JSON null literal, use [JsonNull] object, otherwise, use [JsonPrimitive].
 *
 * @see JsonPrimitive is the preferred method for encoding JSON primitives.
 * @throws JsonEncodingException if `value == "null"`
 */


@ ObsoleteCoroutinesApi <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" ) <EOL> @ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" ) <EOL> public inline fun < E , R > BroadcastChannel < E > . consume ( block : ReceiveChannel < E > . ( ) -> R ) : R

{ <EOL> val channel = openSubscription ( ) <EOL> try { <EOL> return channel . block ( ) <EOL> } finally { <EOL> channel . cancel ( ) <EOL> } <EOL> }

/**
 * Opens subscription to this [BroadcastChannel] and makes sure that the given [block] consumes all elements
 * from it by always invoking [cancel][ReceiveChannel.cancel] after the execution of the block.
 *
 * **Note: This API is obsolete since 1.5.0 and deprecated for removal since 1.7.0**
 * It is replaced with [SharedFlow][kotlinx.coroutines.flow.SharedFlow].
 *
 * Safe to remove in 1.9.0 as was inline before.
 */


@ Deprecated ( level = DeprecationLevel . ERROR , message = "<STR_LIT>" ) <EOL> @ Suppress ( "<STR_LIT:DEPRECATION>" , "<STR_LIT:DEPRECATION_ERROR>" ) <EOL> public suspend inline fun < E > BroadcastChannel < E > . consumeEach ( action : ( E ) -> Unit ) : Unit

= <EOL> consume { <EOL> for ( element in this ) action ( element ) <EOL> }

/**
 * Subscribes to this [BroadcastChannel] and performs the specified action for each received element.
 *
 * **Note: This API is obsolete since 1.5.0 and deprecated for removal since 1.7.0**
 */


@ PublishedApi <EOL> internal fun consumesAll ( vararg channels : ReceiveChannel < * > ) : CompletionHandler

= <EOL> { cause : Throwable ? -> <EOL> var exception : Throwable ? = null <EOL> for ( channel in channels ) <EOL> try { <EOL> channel . cancelConsumed ( cause ) <EOL> } catch ( e : Throwable ) { <EOL> if ( exception == null ) { <EOL> exception = e <EOL> } else { <EOL> exception . addSuppressed ( e ) <EOL> } <EOL> } <EOL> exception ? . let { throw it } <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . elementAt ( index : Int ) : E

= consume { <EOL> if ( index < <NUM_LIT:0> ) <EOL> throw IndexOutOfBoundsException ( "<STR_LIT>" ) <EOL> var count = <NUM_LIT:0> <EOL> for ( element in this ) { <EOL> @ Suppress ( "<STR_LIT>" ) <EOL> if ( index == count ++ ) <EOL> return element <EOL> } <EOL> throw IndexOutOfBoundsException ( "<STR_LIT>" ) <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . elementAtOrNull ( index : Int ) : E ?

= <EOL> consume { <EOL> if ( index < <NUM_LIT:0> ) <EOL> return null <EOL> var count = <NUM_LIT:0> <EOL> for ( element in this ) { <EOL> if ( index == count ++ ) <EOL> return element <EOL> } <EOL> return null <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . first ( ) : E

= <EOL> consume { <EOL> val iterator = iterator ( ) <EOL> if ( ! iterator . hasNext ( ) ) <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> return iterator . next ( ) <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . firstOrNull ( ) : E ?

= <EOL> consume { <EOL> val iterator = iterator ( ) <EOL> if ( ! iterator . hasNext ( ) ) <EOL> return null <EOL> return iterator . next ( ) <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . indexOf ( element : E ) : Int

{ <EOL> var index = <NUM_LIT:0> <EOL> consumeEach { <EOL> if ( element == it ) <EOL> return index <EOL> index ++ <EOL> } <EOL> return - <NUM_LIT:1> <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . last ( ) : E

= <EOL> consume { <EOL> val iterator = iterator ( ) <EOL> if ( ! iterator . hasNext ( ) ) <EOL> throw NoSuchElementException ( "<STR_LIT>" ) <EOL> var last = iterator . next ( ) <EOL> while ( iterator . hasNext ( ) ) <EOL> last = iterator . next ( ) <EOL> return last <EOL> }


@ Deprecated ( message = "<STR_LIT>" , level = DeprecationLevel . HIDDEN ) <EOL> public suspend fun < E > ReceiveChannel < E > . lastIndexOf ( element : E ) : Int

{ <EOL> var lastIndex = - <NUM_LIT:1> <EOL> var index = <NUM_LIT:0> <EOL> consumeEach { <EOL> if ( element == it ) <EOL> lastIndex = index <EOL> index ++ <EOL> } <EOL> return lastIndex <EOL> }