// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND_WITHOUT_CHECK: JS

<!NO_TAIL_CALLS_FOUND!>tailrec fun test(counter : Int) : Int<!> {
    if (counter == 0) return 0

    try {
        return <!TAIL_RECURSION_IN_TRY_IS_NOT_SUPPORTED!>test<!>(counter - 1)
    } catch (any : Throwable) {
        return -1
    }
}

fun box() : String = if (test(3) == 0) "OK" else "FAIL"