Switch

Status: implemented

export default node => {
    switch (node[0]) {
        case "array": case "object": { return "container"; }
        case "string": { return "text"; }
        default: { throw ["unknown", node[0]]; }
    }
};
  • switch (discriminant) { case label: block … default: block } is a statement of a block body, standing where a const may, that the compiler reads as a chain of guards over one shared value (bodies and guards). The discriminant is any expression, evaluated once, eagerly, where the statement stands, as JavaScript evaluates it before any label. In the terminating function-body form, a case is one or more labels, each case, any expression and :, and then a block — the guard's own: any number of statements and then the one statement every block ends with, a return, a throw, a terminal unconditional loop, or a switch with a default, whose every branch ends so in turn — so every case terminates and none falls through into the next. The labels are evaluated where they stand, in source order, each only when every label before it did not match, as JavaScript evaluates them; a match is strict equality, ===, as JavaScript's is, so NaN matches no label and an object matches itself alone; and the first match wins. default: is optional and last, a clause of its own with no label stacked on it; its block runs when no label matched. Outside loop bodies, with a default, the switch is the body's terminating statement, and nothing follows it: a statement after it is unreachable, as one after a return is. Without one, the statements after the switch, up to and including the body's own terminator, are what runs when no label matched — exactly as the statements after a guard run when its condition is falsy. No ; follows the }, as none follows a guard's. This is the one form: braces around every case block, no fallthrough from a block into the next case, default last, at least one case, and the statement in a function body or loop body. Outside loops, cases keep the terminating form above and refuse break. Further forms are steps of a plan, additive on this one (spec/todo/3230-switch.md).

  • The terminating form outside loop bodies is syntactic sugar and adds no node: switch (e) { case a: case b: B1 case c: B2 } rest denotes d === a || d === b ? (() => B1)() : d === c ? (() => B2)() : (() => rest)(), where d is the discriminant's value, shared as a body const is — one node however many labels read it, evaluated where the statement stands whether or not a label is reached, so that switch (null.x) { case 1: { return 2; } } throws here as in JavaScript — and each block and the statements after the switch are the body of a parameterless function called where it stands, inlined as a guard's arms are. A default block is the last alternate in place of rest. The || over a stacked group evaluates the second label only when the first did not match, which is JavaScript's order, and the ?: chain nests as a chain of guards nests, so a hand-written chain of guards over a const of the discriminant, const d = e; if (d === a || d === b) { B1 } if (d === c) { B2 } rest, is the same graph and the same hash — and so is the conditional spelled out, e === a ? 1 : 2 for a switch of one case and one label, the discriminant then one node read once. The ===, || and ?: nodes are the operators the language has; nothing is added to the EDAG, its validators, interpreters or hash.

  • The writers never spell switch: the FunctionalScript output spells the conditional, a const of the discriminant where more than one test reads it, and an arm that holds a const or a throw as the block opened at the operand; the EDAG output carries conditionals; and the Rust output tests the discriminant with strict_eq and uses the shared conditional and loop preparation. Round-tripping through the writer keeps the graph, not the text, as a guard's round trip does.

  • Scoping is the guard's. A case block, and the default block, is a block of JavaScript's own: it may bind what the body has bound or read, shadowing it. The statements after a switch without default are the body's one block with the ones before it, so a name that block has bound — a parameter, a const before the switch — may not be bound again there (duplicate id), and neither may a word that block has already read from an enclosing scope, in a statement before the switch, in the discriminant, in a label or in a case block (capture shadowed), since in JavaScript every such read would have named the later const before its declaration (bodies and guards).

  • Inside loop bodies and their conditional arms, a switch may instead finish a case with break or continue, including from a nested conditional. A break exits that switch and resumes following statements with the case's current outer variable values. A continue retests the nearest enclosing loop. Nested switches own their breaks; nested loops own both transfers. Returns finish the owning function and throws propagate as elsewhere. Every path in a case must exit explicitly; reaching the closing brace and falling into the next case remains refused. An unmatched switch without default resumes normally with unchanged state. Following statements after a switch with default are allowed in loop bodies, since a case may break. The discriminant, label order, stacked-label short circuit and case scopes follow the same rules as terminating switches. All source checks still run after an exit, while its following computations are skipped. This also applies inside module loops; direct module switches remain a follow-up. See loops for an executable example.

  • Refusals. Programs JavaScript admits that are refused rather than read another way (DESIGN.md §10):

    • A case block that does not terminate, case 1: { const x = 1; }, is refused. In JavaScript the statements fall through into the next case, which is the mistake switch is known for, a forgotten break; the block rule prevents it the way the guard's does, by requiring every branch to say where it ends.
    • A case without braces, case 1: return 1;, refused at the return: a declaration written there lives in the scope of the whole switch in JavaScript, visible to every case and in its temporal dead zone for the ones before it, the statement's other known mistake; the braces make each block's scope its own. The brace-less single return is a follow-up.
    • break outside loop-body switches, refused as the word it is: with terminating blocks there is nothing for it to do, and a break that continues with the statements after the switch is a follow-up.
    • A default that is not last, refused at the default: JavaScript admits it anywhere, with the same meaning once every branch terminates, so the position says nothing, and last is the one spelling.
    • A label stacked with the default, case a: default: { … } refused at the default and default: case a: { … } at the case: JavaScript reads the two as one clause, whose block runs on a and on no match alike, so the label can never change which block runs and is written only by mistake; its one effect, that a is evaluated on the way, is what an unused const spells on purpose. Admitting the clause as the default whose block the label's test shares is a follow-up.
    • A switch with no case, switch (e) {}, refused at its }, and one with a default alone, refused at the default: either is the block it abbreviates, a const nothing reads and then the statements, which the language spells as that, and a switch that tests nothing is what deleting the last case leaves behind. Admitting both as that block is a follow-up.
    • A statement after a terminal function-body switch that has a default, refused at the statement: unreachable, as one after return is.
    • A ; after the }: the empty statement, refused as it is after a guard's } (module structure).
    • A switch directly at module level remains a follow-up. Switches inside module loops use the loop-body rules above.

    Duplicate labels, case 1: … case 1: …, are not refused: JavaScript admits them, the second is unreachable, and telling two labels apart in general is analysis the compiler does not do; the first wins, as in JavaScript.

Examples

The compiler demo offers Switch and Loop with switch in module.f.js, with their real outputs.

The demo on this page runs sample.f.js, this page's example as a function of one number — a terminating switch with a shared case, and a default that throws — with every output fjs compile makes of it: the expression graph (EDAG), the Rust and the WebAssembly that Rust builds to. Its Run button calls the default export with 0, 1, 2 and 3, as JavaScript and as WebAssembly, and shows what each call returned or threw.

const kinds = ["array", "object", "string"];
export default (...a) => {
    switch (kinds[Number(a[0])]) {
        case "array": case "object": { return "container"; }
        case "string": { return "text"; }
        default: { throw ["unknown", a[0]]; }
    }
};

Reference

Demo

In FunctionalScript

fjs compile accepts this module, and it runs as JavaScript and as WebAssembly alike.

A FunctionalScript module and what fjs compile makes of it: the expression graph it lowers to, the Rust it compiles to on the NaNVM runtime, and the WebAssembly that Rust builds to. Run calls its default export with 0, then 1, then 2, then 3, first as the JavaScript it already is and then as WebAssembly, and shows what each call returned or threw and how long one call takes, timed over 1000 calls.

FunctionalScript source:

/**
 * The example of [`README.md`](./README.md) (Switch) as a function of one
 * number, for the page's WASM demo: a terminating `switch` with a shared
 * `case`, and a `default` that throws.
 *
 * @module
 */

const kinds = ["array", "object", "string"];
/** @type {(...a: readonly number[]) => unknown} */
export default (...a) => {
    switch (kinds[Number(a[0])]) {
        case "array": case "object": { return "container"; }
        case "string": { return "text"; }
        default: { throw ["unknown", a[0]]; }
    }
};

Expression graph (EDAG) that fjs compile lowers it to:

=>lengthframe 0body0[]?:[]012"array""object""string"?:condthenelse?:"container"?:?:condthenelse?:condthenelse==="text"throw===leftright."array"===leftright."object"===leftright."string"throwvalue.objidxframe 0Number[]01"unknown".Numberoperand.objidxrest0.objidxrest0

The same graph, as fjs compile writes it to a .edag.data.js file:

const $0=["rest"];const $1=[".",["frame",0],["Number",[".",$0,0]]];const $2=["===",$1,"array"];export default ["{}",[[":","default",["=>",0,[["[]",["array","object","string"]]],["?:",["?:",$2,$2,["===",$1,"object"]],"container",["?:",["===",$1,"string"],"text",["throw",["[]",["unknown",[".",$0,0]]]]]]]]]];

Rust that fjs compile writes from it, on the NaNVM runtime:

// @generated by `fjs compile`. Do not edit: recompile the source module instead.

use nanvm_lib::vm::unstable::{f64_any, strict_eq, string_any, string_key};
use nanvm_lib::vm::{Any, IStaticFunction, ToAny, ToArray, ToObject};

#[rustfmt::skip]
#[allow(clippy::if_same_then_else)]
pub fn module<A: IStaticFunction>(_runtime: Any<A>) -> Result<Any<A>, Any<A>> {
    let _b0: Any<A> = [string_any("array"), string_any("object"), string_any("string")].to_array().to_any();
    Ok([(string_key("default"), A::static_function(|_self, _args| {
        let _b768: Any<A> = _args.rest(0).to_any();
        let _b5: Any<A> = (Any::dot(A::frame(_self)[0].clone(), (Any::number((Any::dot(_b768.clone(), f64_any(0x0000000000000000)).end())?))?).end())?;
        if Any::<A>::to_boolean(&{
            let _b6: Any<A> = (strict_eq(_b5.clone(), string_any("array")))?;
            if Any::<A>::to_boolean(&_b6.clone()) { _b6.clone() } else { (strict_eq(_b5.clone(), string_any("object")))? }
        }) { Ok(string_any("container")) } else { if Any::<A>::to_boolean(&(strict_eq(_b5.clone(), string_any("string")))?) { Ok(string_any("text")) } else { Err([string_any("unknown"), (Any::dot(_b768.clone(), f64_any(0x0000000000000000)).end())?].to_array().to_any()) } }
    }, 0, [_b0.clone()].to_array(), Some("(...$1)=>{const $2=$0[Number($1[0])];return (()=>{const $3=$2===\"array\";return $3?$3:$2===\"object\";})()?\"container\":$2===\"string\"?\"text\":(()=>{throw [\"unknown\",$1[0]];})();}")).to_any())].to_object().to_any())
}

WebAssembly text (WAT) of the functions compiled from this source, without the NaNVM runtime:

  (func $nanvm_demos::samples::switch_statement::module::<nanvm_lib::naive::Naive> (;664;) (type 1) (param i32 i32)
    (local i32 i32 i32 i32 i32 i32 i64)
    global.get $__stack_pointer
    i32.const 144
    i32.sub
    local.tee 2
    global.set $__stack_pointer
    local.get 2
    i32.const 0
    i32.store16 offset=32
    local.get 2
    i32.const 1066733
    i32.store offset=28
    local.get 2
    i32.const 1066728
    i32.store offset=24
    local.get 2
    i32.const 40
    i32.add
    local.get 2
    i32.const 24
    i32.add
    call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
    block ;; label = @1
      block ;; label = @2
        block ;; label = @3
          block ;; label = @4
            block ;; label = @5
              block ;; label = @6
                block ;; label = @7
                  block ;; label = @8
                    local.get 2
                    i32.load8_u offset=40
                    local.tee 3
                    i32.const 255
                    i32.ne
                    br_if 0 (;@8;)
                    local.get 2
                    i32.load offset=48
                    local.set 3
                    local.get 2
                    i32.load offset=44
                    local.set 4
                    local.get 2
                    i32.const 0
                    i32.store16 offset=32
                    local.get 2
                    i32.const 1066739
                    i32.store offset=28
                    local.get 2
                    i32.const 1066733
                    i32.store offset=24
                    local.get 2
                    i32.const 40
                    i32.add
                    local.get 2
                    i32.const 24
                    i32.add
                    call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                    local.get 2
                    i32.load8_u offset=40
                    local.tee 5
                    i32.const 255
                    i32.ne
                    br_if 1 (;@7;)
                    local.get 2
                    i32.load offset=48
                    local.set 5
                    local.get 2
                    i32.load offset=44
                    local.set 6
                    local.get 2
                    i32.const 0
                    i32.store16 offset=32
                    local.get 2
                    i32.const 1066745
                    i32.store offset=28
                    local.get 2
                    i32.const 1066739
                    i32.store offset=24
                    local.get 2
                    i32.const 40
                    i32.add
                    local.get 2
                    i32.const 24
                    i32.add
                    call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                    local.get 2
                    i32.load8_u offset=40
                    local.tee 7
                    i32.const 255
                    i32.ne
                    br_if 2 (;@6;)
                    local.get 2
                    i64.load offset=44 align=4
                    local.set 8
                    local.get 2
                    i32.const 0
                    i32.store8 offset=24
                    local.get 2
                    local.get 8
                    i64.store offset=84 align=4
                    local.get 2
                    i32.const 3
                    i32.store8 offset=80
                    local.get 2
                    local.get 5
                    i32.store offset=72
                    local.get 2
                    local.get 6
                    i32.store offset=68
                    local.get 2
                    i32.const 3
                    i32.store8 offset=64
                    local.get 2
                    local.get 3
                    i32.store offset=56
                    local.get 2
                    local.get 4
                    i32.store offset=52
                    local.get 2
                    i32.const 3
                    i32.store8 offset=48
                    local.get 2
                    i64.const 12884901888
                    i64.store offset=40
                    local.get 2
                    local.get 2
                    i32.const 24
                    i32.add
                    i32.store offset=96
                    local.get 2
                    i32.const 16
                    i32.add
                    local.get 2
                    i32.const 40
                    i32.add
                    call $"<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::array::iter::IntoIter<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, 3>, core::result::Result<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, ()>::Ok>, core::result::Result<core::convert::Infallible, ()>> as alloc::rc::ToRcSlice<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>::to_rc_slice"
                    local.get 2
                    local.get 2
                    i32.load offset=20
                    local.tee 4
                    i32.store offset=124
                    local.get 2
                    local.get 2
                    i32.load offset=16
                    local.tee 3
                    i32.store offset=120
                    block ;; label = @9
                      local.get 2
                      i32.load8_u offset=24
                      i32.const 1
                      i32.ne
                      br_if 0 (;@9;)
                      local.get 3
                      local.get 3
                      i32.load
                      i32.const -1
                      i32.add
                      local.tee 0
                      i32.store
                      local.get 0
                      br_if 8 (;@1;)
                      local.get 2
                      i32.const 120
                      i32.add
                      call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
                      br 8 (;@1;)
                    end
                    local.get 3
                    i32.eqz
                    br_if 7 (;@1;)
                    local.get 2
                    local.get 4
                    i32.store offset=32
                    local.get 2
                    local.get 3
                    i32.store offset=28
                    local.get 2
                    i32.const 6
                    i32.store8 offset=24
                    local.get 2
                    i32.const 0
                    i32.store16 offset=116
                    local.get 2
                    i32.const 1066422
                    i32.store offset=112
                    local.get 2
                    i32.const 1066415
                    i32.store offset=108
                    local.get 2
                    i32.const 40
                    i32.add
                    local.get 2
                    i32.const 108
                    i32.add
                    call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                    local.get 2
                    i32.load8_u offset=40
                    local.tee 5
                    i32.const 255
                    i32.ne
                    br_if 3 (;@5;)
                    local.get 2
                    i32.load offset=48
                    local.set 6
                    local.get 2
                    i32.load offset=44
                    local.set 7
                    local.get 3
                    local.get 3
                    i32.load
                    i32.const 1
                    i32.add
                    local.tee 5
                    i32.store
                    local.get 5
                    i32.eqz
                    br_if 4 (;@4;)
                    local.get 2
                    i32.const 0
                    i32.store8 offset=108
                    local.get 2
                    local.get 4
                    i64.extend_i32_u
                    i64.store offset=56
                    local.get 2
                    local.get 3
                    i32.store offset=52
                    local.get 2
                    i32.const 6
                    i32.store8 offset=48
                    local.get 2
                    i64.const 4294967296
                    i64.store offset=40
                    local.get 2
                    local.get 2
                    i32.const 108
                    i32.add
                    i32.store offset=64
                    local.get 2
                    i32.const 8
                    i32.add
                    local.get 2
                    i32.const 40
                    i32.add
                    call $"<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::array::iter::IntoIter<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, 1>, core::result::Result<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>, ()>::Ok>, core::result::Result<core::convert::Infallible, ()>> as alloc::rc::ToRcSlice<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>::to_rc_slice"
                    local.get 2
                    local.get 2
                    i32.load offset=12
                    local.tee 4
                    i32.store offset=124
                    local.get 2
                    local.get 2
                    i32.load offset=8
                    local.tee 3
                    i32.store offset=120
                    block ;; label = @9
                      local.get 2
                      i32.load8_u offset=108
                      i32.const 1
                      i32.ne
                      br_if 0 (;@9;)
                      local.get 3
                      local.get 3
                      i32.load
                      i32.const -1
                      i32.add
                      local.tee 0
                      i32.store
                      local.get 0
                      br_if 7 (;@2;)
                      local.get 2
                      i32.const 120
                      i32.add
                      call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
                      br 7 (;@2;)
                    end
                    local.get 3
                    i32.eqz
                    br_if 6 (;@2;)
                    i32.const 224
                    i32.const 0
                    local.get 3
                    local.get 4
                    i32.const 1066745
                    i32.const 173
                    call $"<nanvm_lib::naive::Naive as nanvm_lib::vm::internal::IVm>::static_function"
                    local.set 3
                    local.get 2
                    i32.const 0
                    i32.store8 offset=108
                    local.get 2
                    local.get 3
                    i32.store offset=60
                    local.get 2
                    i32.const 7
                    i32.store8 offset=56
                    local.get 2
                    local.get 6
                    i32.store offset=52
                    local.get 2
                    local.get 7
                    i32.store offset=48
                    local.get 2
                    i64.const 4294967296
                    i64.store offset=40
                    local.get 2
                    local.get 2
                    i32.const 108
                    i32.add
                    i32.store offset=72
                    local.get 2
                    local.get 2
                    i32.const 40
                    i32.add
                    call $"<core::iter::adapters::GenericShunt<core::iter::adapters::map::Map<core::array::iter::IntoIter<(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>), 1>, core::result::Result<(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>), ()>::Ok>, core::result::Result<core::convert::Infallible, ()>> as alloc::rc::ToRcSlice<(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>)>>::to_rc_slice"
                    local.get 2
                    local.get 2
                    i32.load offset=4
                    local.tee 4
                    i32.store offset=124
                    local.get 2
                    local.get 2
                    i32.load
                    local.tee 3
                    i32.store offset=120
                    block ;; label = @9
                      local.get 2
                      i32.load8_u offset=108
                      i32.const 1
                      i32.ne
                      br_if 0 (;@9;)
                      local.get 3
                      local.get 3
                      i32.load
                      i32.const -1
                      i32.add
                      local.tee 0
                      i32.store
                      local.get 0
                      br_if 6 (;@3;)
                      local.get 2
                      i32.const 120
                      i32.add
                      call $"<alloc::rc::Rc<[(nanvm_lib::vm::string::String<nanvm_lib::naive::Naive>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>)]>>::drop_slow"
                      br 6 (;@3;)
                    end
                    local.get 3
                    i32.eqz
                    br_if 5 (;@3;)
                    local.get 0
                    local.get 4
                    i32.store offset=16
                    local.get 0
                    local.get 3
                    i32.store offset=12
                    local.get 0
                    i32.const 5
                    i32.store8 offset=8
                    local.get 0
                    i64.const 0
                    i64.store
                    local.get 2
                    i32.const 24
                    i32.add
                    call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                    local.get 1
                    call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                    local.get 2
                    i32.const 144
                    i32.add
                    global.set $__stack_pointer
                    return
                  end
                  local.get 2
                  local.get 2
                  i32.load8_u offset=43
                  i32.store8 offset=123
                  local.get 2
                  local.get 2
                  i32.load16_u offset=41 align=1
                  i32.store16 offset=121 align=1
                  local.get 2
                  local.get 2
                  i32.load offset=52
                  i32.store offset=132
                  local.get 2
                  local.get 2
                  i64.load offset=44 align=4
                  i64.store offset=124 align=4
                  local.get 2
                  local.get 3
                  i32.store8 offset=120
                  i32.const 1057960
                  i32.const 43
                  local.get 2
                  i32.const 120
                  i32.add
                  i32.const 1057944
                  i32.const 1058004
                  call $core::result::unwrap_failed
                  unreachable
                end
                local.get 2
                local.get 2
                i32.load8_u offset=43
                i32.store8 offset=123
                local.get 2
                local.get 2
                i32.load16_u offset=41 align=1
                i32.store16 offset=121 align=1
                local.get 2
                local.get 2
                i32.load offset=52
                i32.store offset=132
                local.get 2
                local.get 2
                i64.load offset=44 align=4
                i64.store offset=124 align=4
                local.get 2
                local.get 5
                i32.store8 offset=120
                i32.const 1057960
                i32.const 43
                local.get 2
                i32.const 120
                i32.add
                i32.const 1057944
                i32.const 1058004
                call $core::result::unwrap_failed
                unreachable
              end
              local.get 2
              local.get 2
              i32.load8_u offset=43
              i32.store8 offset=123
              local.get 2
              local.get 2
              i32.load16_u offset=41 align=1
              i32.store16 offset=121 align=1
              local.get 2
              local.get 2
              i32.load offset=52
              i32.store offset=132
              local.get 2
              local.get 2
              i64.load offset=44 align=4
              i64.store offset=124 align=4
              local.get 2
              local.get 7
              i32.store8 offset=120
              i32.const 1057960
              i32.const 43
              local.get 2
              i32.const 120
              i32.add
              i32.const 1057944
              i32.const 1058004
              call $core::result::unwrap_failed
              unreachable
            end
            local.get 2
            local.get 2
            i32.load8_u offset=43
            i32.store8 offset=123
            local.get 2
            local.get 2
            i32.load16_u offset=41 align=1
            i32.store16 offset=121 align=1
            local.get 2
            local.get 2
            i32.load offset=52
            i32.store offset=132
            local.get 2
            local.get 2
            i64.load offset=44 align=4
            i64.store offset=124 align=4
            local.get 2
            local.get 5
            i32.store8 offset=120
            i32.const 1057960
            i32.const 43
            local.get 2
            i32.const 120
            i32.add
            i32.const 1057944
            i32.const 1058004
            call $core::result::unwrap_failed
          end
          unreachable
        end
        i32.const 1064316
        i32.const 43
        local.get 2
        i32.const 143
        i32.add
        i32.const 1064300
        i32.const 1064360
        call $core::result::unwrap_failed
        unreachable
      end
      i32.const 1064316
      i32.const 43
      local.get 2
      i32.const 143
      i32.add
      i32.const 1064300
      i32.const 1064360
      call $core::result::unwrap_failed
      unreachable
    end
    i32.const 1064316
    i32.const 43
    local.get 2
    i32.const 143
    i32.add
    i32.const 1064300
    i32.const 1064360
    call $core::result::unwrap_failed
    unreachable
  )
  (func $"<nanvm_demos::samples::switch_statement::module<nanvm_lib::naive::Naive>::{closure#0} as core::ops::function::FnOnce<(&nanvm_lib::naive::function::Function, nanvm_lib::vm::array::Array<nanvm_lib::naive::Naive>)>>::call_once" (;665;) (type 4) (param i32 i32 i32 i32)
    (local i32 i32 i64 i32 f64)
    global.get $__stack_pointer
    i32.const 304
    i32.sub
    local.tee 4
    global.set $__stack_pointer
    local.get 1
    i32.load
    local.set 1
    local.get 4
    local.get 3
    i32.store offset=28
    local.get 4
    local.get 2
    i32.store offset=24
    local.get 2
    local.get 2
    i32.load
    i32.const 1
    i32.add
    local.tee 5
    i32.store
    block ;; label = @1
      local.get 5
      i32.eqz
      br_if 0 (;@1;)
      local.get 4
      local.get 3
      i32.store offset=40
      local.get 4
      local.get 2
      i32.store offset=36
      local.get 4
      i32.const 6
      i32.store8 offset=32
      block ;; label = @2
        block ;; label = @3
          block ;; label = @4
            local.get 1
            i32.load offset=16
            i32.eqz
            br_if 0 (;@4;)
            block ;; label = @5
              block ;; label = @6
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      block ;; label = @10
                        block ;; label = @11
                          block ;; label = @12
                            local.get 1
                            i32.load offset=12
                            local.tee 1
                            i32.load8_u offset=8
                            local.tee 5
                            br_table 6 (;@6;) 6 (;@6;) 0 (;@12;) 1 (;@11;) 2 (;@10;) 3 (;@9;) 4 (;@8;) 5 (;@7;) 6 (;@6;)
                          end
                          local.get 1
                          i64.load offset=16
                          local.set 6
                          br 9 (;@2;)
                        end
                        local.get 1
                        i32.load offset=12
                        local.tee 3
                        local.get 3
                        i32.load
                        i32.const 1
                        i32.add
                        local.tee 7
                        i32.store
                        local.get 7
                        i32.eqz
                        br_if 9 (;@1;)
                        br 7 (;@3;)
                      end
                      local.get 1
                      i32.load offset=12
                      local.tee 3
                      local.get 3
                      i32.load
                      i32.const 1
                      i32.add
                      local.tee 7
                      i32.store
                      local.get 7
                      i32.eqz
                      br_if 8 (;@1;)
                      local.get 1
                      i64.load8_u offset=20
                      i64.const 32
                      i64.shl
                      local.get 1
                      i64.load32_u offset=16
                      i64.or
                      local.set 6
                      br 7 (;@2;)
                    end
                    local.get 1
                    i32.load offset=12
                    local.tee 3
                    local.get 3
                    i32.load
                    i32.const 1
                    i32.add
                    local.tee 7
                    i32.store
                    local.get 7
                    br_if 5 (;@3;)
                    br 7 (;@1;)
                  end
                  local.get 1
                  i32.load offset=12
                  local.tee 3
                  local.get 3
                  i32.load
                  i32.const 1
                  i32.add
                  local.tee 7
                  i32.store
                  local.get 7
                  br_if 4 (;@3;)
                  br 6 (;@1;)
                end
                local.get 1
                i32.load offset=12
                local.tee 3
                local.get 3
                i32.load
                i32.const 1
                i32.add
                local.tee 1
                i32.store
                local.get 1
                i32.eqz
                br_if 5 (;@1;)
                br 1 (;@5;)
              end
              local.get 1
              i32.load8_u offset=9
              local.set 1
            end
            br 2 (;@2;)
          end
          i32.const 0
          i32.const 0
          i32.const 1069140
          call $core::panicking::panic_bounds_check
          unreachable
        end
        local.get 1
        i64.load32_u offset=16
        local.set 6
      end
      local.get 4
      local.get 6
      i64.store offset=152
      local.get 4
      local.get 3
      i32.store offset=148
      local.get 4
      local.get 1
      i32.store8 offset=145
      local.get 4
      local.get 5
      i32.store8 offset=144
      block ;; label = @2
        block ;; label = @3
          block ;; label = @4
            block ;; label = @5
              block ;; label = @6
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      block ;; label = @10
                        block ;; label = @11
                          local.get 4
                          i32.load8_u offset=32
                          local.tee 1
                          br_table 6 (;@5;) 6 (;@5;) 0 (;@11;) 1 (;@10;) 2 (;@9;) 3 (;@8;) 4 (;@7;) 5 (;@6;) 6 (;@5;)
                        end
                        local.get 4
                        i64.load offset=40
                        local.set 6
                        br 8 (;@2;)
                      end
                      local.get 4
                      i32.load offset=36
                      local.tee 3
                      local.get 3
                      i32.load
                      i32.const 1
                      i32.add
                      local.tee 5
                      i32.store
                      local.get 5
                      i32.eqz
                      br_if 8 (;@1;)
                      br 6 (;@3;)
                    end
                    local.get 4
                    i32.load offset=36
                    local.tee 3
                    local.get 3
                    i32.load
                    i32.const 1
                    i32.add
                    local.tee 5
                    i32.store
                    local.get 5
                    i32.eqz
                    br_if 7 (;@1;)
                    local.get 4
                    i64.load8_u offset=44
                    i64.const 32
                    i64.shl
                    local.get 4
                    i64.load32_u offset=40
                    i64.or
                    local.set 6
                    br 6 (;@2;)
                  end
                  local.get 4
                  i32.load offset=36
                  local.tee 3
                  local.get 3
                  i32.load
                  i32.const 1
                  i32.add
                  local.tee 5
                  i32.store
                  local.get 5
                  i32.eqz
                  br_if 6 (;@1;)
                  br 4 (;@3;)
                end
                local.get 4
                i32.load offset=36
                local.tee 3
                local.get 3
                i32.load
                i32.const 1
                i32.add
                local.tee 5
                i32.store
                local.get 5
                i32.eqz
                br_if 5 (;@1;)
                br 3 (;@3;)
              end
              local.get 4
              i32.load offset=36
              local.tee 3
              local.get 3
              i32.load
              i32.const 1
              i32.add
              local.tee 5
              i32.store
              local.get 5
              i32.eqz
              br_if 4 (;@1;)
              br 1 (;@4;)
            end
            local.get 4
            i32.load8_u offset=33
            local.set 5
          end
          br 1 (;@2;)
        end
        local.get 4
        i64.load32_u offset=40
        local.set 6
      end
      local.get 4
      local.get 6
      i64.store offset=200
      local.get 4
      local.get 3
      i32.store offset=196
      local.get 4
      local.get 5
      i32.store8 offset=193
      local.get 4
      local.get 1
      i32.store8 offset=192
      local.get 4
      i64.const 0
      i64.store offset=264
      local.get 4
      i32.const 2
      i32.store8 offset=256
      local.get 4
      i32.const 160
      i32.add
      local.get 4
      i32.const 192
      i32.add
      local.get 4
      i32.const 256
      i32.add
      call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
      block ;; label = @2
        block ;; label = @3
          block ;; label = @4
            block ;; label = @5
              block ;; label = @6
                block ;; label = @7
                  local.get 4
                  i32.load8_u offset=160
                  i32.const 255
                  i32.ne
                  br_if 0 (;@7;)
                  local.get 0
                  local.get 4
                  i64.load offset=176
                  i64.store offset=16
                  local.get 0
                  local.get 4
                  i64.load offset=168
                  i64.store offset=8
                  local.get 0
                  i64.const 1
                  i64.store
                  local.get 4
                  i32.const 144
                  i32.add
                  call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                  br 1 (;@6;)
                end
                local.get 4
                local.get 4
                i64.load offset=184
                i64.store offset=280
                local.get 4
                local.get 4
                i64.load offset=176
                i64.store offset=272
                local.get 4
                local.get 4
                i64.load offset=168
                i64.store offset=264
                local.get 4
                local.get 4
                i64.load offset=160
                i64.store offset=256
                local.get 4
                i32.const 192
                i32.add
                local.get 4
                i32.const 256
                i32.add
                call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::own
                block ;; label = @7
                  block ;; label = @8
                    local.get 4
                    i32.load8_u offset=192
                    i32.const 255
                    i32.eq
                    br_if 0 (;@8;)
                    local.get 4
                    local.get 4
                    i64.load offset=200
                    i64.store offset=72
                    local.get 4
                    local.get 4
                    i64.load offset=192
                    i64.store offset=64
                    br 1 (;@7;)
                  end
                  local.get 4
                  i32.const 256
                  i32.store16 offset=64
                end
                local.get 4
                i32.const 256
                i32.add
                call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                local.get 4
                i32.const 272
                i32.add
                call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                local.get 4
                i32.const 224
                i32.add
                local.get 4
                i32.const 64
                i32.add
                call $<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::number
                local.get 4
                local.get 4
                i64.load offset=232
                i64.store offset=96
                local.get 4
                local.get 4
                i64.load offset=240
                i64.store offset=104
                block ;; label = @7
                  local.get 4
                  i64.load offset=224
                  i64.const 1
                  i64.ne
                  br_if 0 (;@7;)
                  local.get 0
                  local.get 4
                  i64.load offset=104
                  i64.store offset=16
                  local.get 0
                  local.get 4
                  i64.load offset=96
                  i64.store offset=8
                  local.get 0
                  i64.const 1
                  i64.store
                  local.get 4
                  i32.const 144
                  i32.add
                  call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                  br 1 (;@6;)
                end
                local.get 4
                local.get 4
                i64.load offset=104
                i64.store offset=88
                local.get 4
                local.get 4
                i64.load offset=96
                i64.store offset=80
                local.get 4
                i32.const 192
                i32.add
                local.get 4
                i32.const 144
                i32.add
                local.get 4
                i32.const 80
                i32.add
                call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                block ;; label = @7
                  local.get 4
                  i32.load8_u offset=192
                  i32.const 255
                  i32.ne
                  br_if 0 (;@7;)
                  local.get 0
                  local.get 4
                  i64.load offset=208
                  i64.store offset=16
                  local.get 0
                  local.get 4
                  i64.load offset=200
                  i64.store offset=8
                  local.get 0
                  i64.const 1
                  i64.store
                  br 1 (;@6;)
                end
                local.get 4
                local.get 4
                i64.load offset=216
                i64.store offset=280
                local.get 4
                local.get 4
                i64.load offset=208
                i64.store offset=272
                local.get 4
                local.get 4
                i64.load offset=200
                i64.store offset=264
                local.get 4
                local.get 4
                i64.load offset=192
                i64.store offset=256
                local.get 4
                i32.const 224
                i32.add
                local.get 4
                i32.const 256
                i32.add
                call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::own
                block ;; label = @7
                  block ;; label = @8
                    local.get 4
                    i32.load8_u offset=224
                    i32.const 255
                    i32.eq
                    br_if 0 (;@8;)
                    local.get 4
                    local.get 4
                    i64.load offset=232
                    i64.store offset=56
                    local.get 4
                    local.get 4
                    i64.load offset=224
                    i64.store offset=48
                    br 1 (;@7;)
                  end
                  local.get 4
                  i32.const 256
                  i32.store16 offset=48
                end
                local.get 4
                i32.const 256
                i32.add
                call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                local.get 4
                i32.const 272
                i32.add
                call $"#func693 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      block ;; label = @10
                        block ;; label = @11
                          block ;; label = @12
                            block ;; label = @13
                              block ;; label = @14
                                block ;; label = @15
                                  block ;; label = @16
                                    local.get 4
                                    i32.load8_u offset=48
                                    local.tee 1
                                    br_table 6 (;@10;) 6 (;@10;) 0 (;@16;) 1 (;@15;) 2 (;@14;) 3 (;@13;) 4 (;@12;) 5 (;@11;) 6 (;@10;)
                                  end
                                  local.get 4
                                  i64.load offset=56
                                  local.set 6
                                  br 8 (;@7;)
                                end
                                local.get 4
                                i32.load offset=52
                                local.tee 3
                                local.get 3
                                i32.load
                                i32.const 1
                                i32.add
                                local.tee 5
                                i32.store
                                local.get 5
                                i32.eqz
                                br_if 13 (;@1;)
                                br 6 (;@8;)
                              end
                              local.get 4
                              i32.load offset=52
                              local.tee 3
                              local.get 3
                              i32.load
                              i32.const 1
                              i32.add
                              local.tee 5
                              i32.store
                              local.get 5
                              i32.eqz
                              br_if 12 (;@1;)
                              local.get 4
                              i64.load8_u offset=60
                              i64.const 32
                              i64.shl
                              local.get 4
                              i64.load32_u offset=56
                              i64.or
                              local.set 6
                              br 6 (;@7;)
                            end
                            local.get 4
                            i32.load offset=52
                            local.tee 3
                            local.get 3
                            i32.load
                            i32.const 1
                            i32.add
                            local.tee 5
                            i32.store
                            local.get 5
                            i32.eqz
                            br_if 11 (;@1;)
                            br 4 (;@8;)
                          end
                          local.get 4
                          i32.load offset=52
                          local.tee 3
                          local.get 3
                          i32.load
                          i32.const 1
                          i32.add
                          local.tee 5
                          i32.store
                          local.get 5
                          i32.eqz
                          br_if 10 (;@1;)
                          br 3 (;@8;)
                        end
                        local.get 4
                        i32.load offset=52
                        local.tee 3
                        local.get 3
                        i32.load
                        i32.const 1
                        i32.add
                        local.tee 5
                        i32.store
                        local.get 5
                        i32.eqz
                        br_if 9 (;@1;)
                        br 1 (;@9;)
                      end
                      local.get 4
                      i32.load8_u offset=49
                      local.set 5
                    end
                    br 1 (;@7;)
                  end
                  local.get 4
                  i64.load32_u offset=56
                  local.set 6
                end
                local.get 4
                local.get 6
                i64.store offset=104
                local.get 4
                local.get 3
                i32.store offset=100
                local.get 4
                local.get 5
                i32.store8 offset=97
                local.get 4
                local.get 1
                i32.store8 offset=96
                local.get 4
                i32.const 0
                i32.store16 offset=152
                local.get 4
                i32.const 1066733
                i32.store offset=148
                local.get 4
                i32.const 1066728
                i32.store offset=144
                local.get 4
                i32.const 256
                i32.add
                local.get 4
                i32.const 144
                i32.add
                call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      block ;; label = @10
                        block ;; label = @11
                          block ;; label = @12
                            local.get 4
                            i32.load8_u offset=256
                            local.tee 3
                            i32.const 255
                            i32.ne
                            br_if 0 (;@12;)
                            local.get 4
                            local.get 4
                            i64.load offset=260 align=4
                            i64.store offset=228 align=4
                            local.get 4
                            i32.const 3
                            i32.store8 offset=224
                            local.get 4
                            i32.const 96
                            i32.add
                            local.get 4
                            i32.const 224
                            i32.add
                            call $"<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive> as core::cmp::PartialEq>::eq"
                            local.set 3
                            local.get 4
                            i32.const 224
                            i32.add
                            call $"#func272 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                            local.get 4
                            i32.const 96
                            i32.add
                            call $"#func272 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                            local.get 4
                            local.get 3
                            i32.store8 offset=145
                            local.get 4
                            i32.const 1
                            i32.store8 offset=144
                            local.get 4
                            local.get 3
                            i32.store8 offset=257
                            local.get 4
                            i32.const 1
                            i32.store8 offset=256
                            local.get 4
                            i32.const 256
                            i32.add
                            call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                            block ;; label = @13
                              local.get 3
                              br_if 0 (;@13;)
                              block ;; label = @14
                                block ;; label = @15
                                  block ;; label = @16
                                    block ;; label = @17
                                      block ;; label = @18
                                        block ;; label = @19
                                          block ;; label = @20
                                            block ;; label = @21
                                              local.get 4
                                              i32.load8_u offset=48
                                              local.tee 1
                                              br_table 6 (;@15;) 6 (;@15;) 0 (;@21;) 1 (;@20;) 2 (;@19;) 3 (;@18;) 4 (;@17;) 5 (;@16;) 6 (;@15;)
                                            end
                                            local.get 4
                                            i64.load offset=56
                                            local.set 6
                                            br 12 (;@8;)
                                          end
                                          local.get 4
                                          i32.load offset=52
                                          local.tee 3
                                          local.get 3
                                          i32.load
                                          i32.const 1
                                          i32.add
                                          local.tee 5
                                          i32.store
                                          local.get 5
                                          i32.eqz
                                          br_if 18 (;@1;)
                                          br 10 (;@9;)
                                        end
                                        local.get 4
                                        i32.load offset=52
                                        local.tee 3
                                        local.get 3
                                        i32.load
                                        i32.const 1
                                        i32.add
                                        local.tee 5
                                        i32.store
                                        local.get 5
                                        i32.eqz
                                        br_if 17 (;@1;)
                                        local.get 4
                                        i64.load8_u offset=60
                                        i64.const 32
                                        i64.shl
                                        local.get 4
                                        i64.load32_u offset=56
                                        i64.or
                                        local.set 6
                                        br 10 (;@8;)
                                      end
                                      local.get 4
                                      i32.load offset=52
                                      local.tee 3
                                      local.get 3
                                      i32.load
                                      i32.const 1
                                      i32.add
                                      local.tee 5
                                      i32.store
                                      local.get 5
                                      i32.eqz
                                      br_if 16 (;@1;)
                                      br 8 (;@9;)
                                    end
                                    local.get 4
                                    i32.load offset=52
                                    local.tee 3
                                    local.get 3
                                    i32.load
                                    i32.const 1
                                    i32.add
                                    local.tee 5
                                    i32.store
                                    local.get 5
                                    i32.eqz
                                    br_if 15 (;@1;)
                                    br 7 (;@9;)
                                  end
                                  local.get 4
                                  i32.load offset=52
                                  local.tee 3
                                  local.get 3
                                  i32.load
                                  i32.const 1
                                  i32.add
                                  local.tee 5
                                  i32.store
                                  local.get 5
                                  i32.eqz
                                  br_if 14 (;@1;)
                                  br 1 (;@14;)
                                end
                                local.get 4
                                i32.load8_u offset=49
                                local.set 5
                              end
                              br 5 (;@8;)
                            end
                            block ;; label = @13
                              block ;; label = @14
                                block ;; label = @15
                                  block ;; label = @16
                                    block ;; label = @17
                                      block ;; label = @18
                                        block ;; label = @19
                                          block ;; label = @20
                                            local.get 4
                                            i32.load8_u offset=144
                                            local.tee 1
                                            br_table 6 (;@14;) 6 (;@14;) 0 (;@20;) 1 (;@19;) 2 (;@18;) 3 (;@17;) 4 (;@16;) 5 (;@15;) 6 (;@14;)
                                          end
                                          local.get 4
                                          i64.load offset=152
                                          local.set 6
                                          br 9 (;@10;)
                                        end
                                        local.get 4
                                        i32.load offset=148
                                        local.tee 3
                                        local.get 3
                                        i32.load
                                        i32.const 1
                                        i32.add
                                        local.tee 5
                                        i32.store
                                        local.get 5
                                        i32.eqz
                                        br_if 17 (;@1;)
                                        br 7 (;@11;)
                                      end
                                      local.get 4
                                      i32.load offset=148
                                      local.tee 3
                                      local.get 3
                                      i32.load
                                      i32.const 1
                                      i32.add
                                      local.tee 5
                                      i32.store
                                      local.get 5
                                      i32.eqz
                                      br_if 16 (;@1;)
                                      local.get 4
                                      i64.load8_u offset=156
                                      i64.const 32
                                      i64.shl
                                      local.get 4
                                      i64.load32_u offset=152
                                      i64.or
                                      local.set 6
                                      br 7 (;@10;)
                                    end
                                    local.get 4
                                    i32.load offset=148
                                    local.tee 3
                                    local.get 3
                                    i32.load
                                    i32.const 1
                                    i32.add
                                    local.tee 5
                                    i32.store
                                    local.get 5
                                    i32.eqz
                                    br_if 15 (;@1;)
                                    br 5 (;@11;)
                                  end
                                  local.get 4
                                  i32.load offset=148
                                  local.tee 3
                                  local.get 3
                                  i32.load
                                  i32.const 1
                                  i32.add
                                  local.tee 5
                                  i32.store
                                  local.get 5
                                  i32.eqz
                                  br_if 14 (;@1;)
                                  br 4 (;@11;)
                                end
                                local.get 4
                                i32.load offset=148
                                local.tee 3
                                local.get 3
                                i32.load
                                i32.const 1
                                i32.add
                                local.tee 5
                                i32.store
                                local.get 5
                                i32.eqz
                                br_if 13 (;@1;)
                                br 1 (;@13;)
                              end
                              local.get 4
                              i32.load8_u offset=145
                              local.set 5
                            end
                            br 2 (;@10;)
                          end
                          local.get 4
                          local.get 4
                          i32.load8_u offset=259
                          i32.store8 offset=227
                          local.get 4
                          local.get 4
                          i32.load16_u offset=257 align=1
                          i32.store16 offset=225 align=1
                          local.get 4
                          local.get 4
                          i32.load offset=268
                          i32.store offset=236
                          local.get 4
                          local.get 4
                          i64.load offset=260 align=4
                          i64.store offset=228 align=4
                          local.get 4
                          local.get 3
                          i32.store8 offset=224
                          i32.const 1057960
                          i32.const 43
                          local.get 4
                          i32.const 224
                          i32.add
                          i32.const 1057944
                          i32.const 1058004
                          call $core::result::unwrap_failed
                          unreachable
                        end
                        local.get 4
                        i64.load32_u offset=152
                        local.set 6
                      end
                      local.get 4
                      local.get 6
                      i64.store offset=136
                      local.get 4
                      local.get 3
                      i32.store offset=132
                      local.get 4
                      local.get 5
                      i32.store8 offset=129
                      local.get 4
                      local.get 1
                      i32.store8 offset=128
                      br 2 (;@7;)
                    end
                    local.get 4
                    i64.load32_u offset=56
                    local.set 6
                  end
                  local.get 4
                  local.get 6
                  i64.store offset=104
                  local.get 4
                  local.get 3
                  i32.store offset=100
                  local.get 4
                  local.get 5
                  i32.store8 offset=97
                  local.get 4
                  local.get 1
                  i32.store8 offset=96
                  local.get 4
                  i32.const 0
                  i32.store16 offset=300
                  local.get 4
                  i32.const 1066739
                  i32.store offset=296
                  local.get 4
                  i32.const 1066733
                  i32.store offset=292
                  local.get 4
                  i32.const 256
                  i32.add
                  local.get 4
                  i32.const 292
                  i32.add
                  call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                  block ;; label = @8
                    local.get 4
                    i32.load8_u offset=256
                    local.tee 3
                    i32.const 255
                    i32.eq
                    br_if 0 (;@8;)
                    local.get 4
                    local.get 4
                    i32.load8_u offset=259
                    i32.store8 offset=227
                    local.get 4
                    local.get 4
                    i32.load16_u offset=257 align=1
                    i32.store16 offset=225 align=1
                    local.get 4
                    local.get 4
                    i32.load offset=268
                    i32.store offset=236
                    local.get 4
                    local.get 4
                    i64.load offset=260 align=4
                    i64.store offset=228 align=4
                    local.get 4
                    local.get 3
                    i32.store8 offset=224
                    i32.const 1057960
                    i32.const 43
                    local.get 4
                    i32.const 224
                    i32.add
                    i32.const 1057944
                    i32.const 1058004
                    call $core::result::unwrap_failed
                    unreachable
                  end
                  local.get 4
                  local.get 4
                  i64.load offset=260 align=4
                  i64.store offset=228 align=4
                  local.get 4
                  i32.const 3
                  i32.store8 offset=224
                  local.get 4
                  i32.const 96
                  i32.add
                  local.get 4
                  i32.const 224
                  i32.add
                  call $"<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive> as core::cmp::PartialEq>::eq"
                  local.set 3
                  local.get 4
                  i32.const 224
                  i32.add
                  call $"#func272 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                  local.get 4
                  i32.const 96
                  i32.add
                  call $"#func272 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                  local.get 4
                  local.get 3
                  i32.store8 offset=129
                  local.get 4
                  i32.const 1
                  i32.store8 offset=128
                end
                local.get 4
                i32.const 144
                i32.add
                call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                block ;; label = @7
                  block ;; label = @8
                    block ;; label = @9
                      block ;; label = @10
                        block ;; label = @11
                          block ;; label = @12
                            block ;; label = @13
                              block ;; label = @14
                                block ;; label = @15
                                  block ;; label = @16
                                    block ;; label = @17
                                      local.get 4
                                      i32.load8_u offset=128
                                      br_table 3 (;@14;) 4 (;@13;) 2 (;@15;) 5 (;@12;) 0 (;@17;) 1 (;@16;) 1 (;@16;) 1 (;@16;) 3 (;@14;)
                                    end
                                    local.get 4
                                    i32.load offset=136
                                    local.set 3
                                    local.get 4
                                    i32.const 128
                                    i32.add
                                    call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                                    local.get 3
                                    i32.eqz
                                    br_if 6 (;@10;)
                                    br 7 (;@9;)
                                  end
                                  local.get 4
                                  i32.const 128
                                  i32.add
                                  call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                                  br 6 (;@9;)
                                end
                                local.get 4
                                f64.load offset=136
                                local.tee 8
                                local.get 8
                                f64.eq
                                br_if 3 (;@11;)
                              end
                              local.get 4
                              i32.const 128
                              i32.add
                              call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                              br 3 (;@10;)
                            end
                            local.get 4
                            i32.load8_u offset=129
                            local.set 3
                            local.get 4
                            i32.const 128
                            i32.add
                            call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                            local.get 3
                            br_if 3 (;@9;)
                            br 2 (;@10;)
                          end
                          local.get 4
                          i32.load offset=136
                          local.set 3
                          local.get 4
                          i32.const 128
                          i32.add
                          call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                          local.get 3
                          i32.eqz
                          br_if 1 (;@10;)
                          br 2 (;@9;)
                        end
                        local.get 4
                        i32.const 128
                        i32.add
                        call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                        local.get 8
                        f64.const 0x0p+0 (;=0;)
                        f64.ne
                        br_if 1 (;@9;)
                      end
                      block ;; label = @10
                        block ;; label = @11
                          block ;; label = @12
                            block ;; label = @13
                              block ;; label = @14
                                block ;; label = @15
                                  block ;; label = @16
                                    block ;; label = @17
                                      local.get 4
                                      i32.load8_u offset=48
                                      local.tee 1
                                      br_table 6 (;@11;) 6 (;@11;) 0 (;@17;) 1 (;@16;) 2 (;@15;) 3 (;@14;) 4 (;@13;) 5 (;@12;) 6 (;@11;)
                                    end
                                    local.get 4
                                    i64.load offset=56
                                    local.set 6
                                    br 9 (;@7;)
                                  end
                                  local.get 4
                                  i32.load offset=52
                                  local.tee 3
                                  local.get 3
                                  i32.load
                                  i32.const 1
                                  i32.add
                                  local.tee 5
                                  i32.store
                                  local.get 5
                                  i32.eqz
                                  br_if 14 (;@1;)
                                  br 7 (;@8;)
                                end
                                local.get 4
                                i32.load offset=52
                                local.tee 3
                                local.get 3
                                i32.load
                                i32.const 1
                                i32.add
                                local.tee 5
                                i32.store
                                local.get 5
                                i32.eqz
                                br_if 13 (;@1;)
                                local.get 4
                                i64.load8_u offset=60
                                i64.const 32
                                i64.shl
                                local.get 4
                                i64.load32_u offset=56
                                i64.or
                                local.set 6
                                br 7 (;@7;)
                              end
                              local.get 4
                              i32.load offset=52
                              local.tee 3
                              local.get 3
                              i32.load
                              i32.const 1
                              i32.add
                              local.tee 5
                              i32.store
                              local.get 5
                              i32.eqz
                              br_if 12 (;@1;)
                              br 5 (;@8;)
                            end
                            local.get 4
                            i32.load offset=52
                            local.tee 3
                            local.get 3
                            i32.load
                            i32.const 1
                            i32.add
                            local.tee 5
                            i32.store
                            local.get 5
                            i32.eqz
                            br_if 11 (;@1;)
                            br 4 (;@8;)
                          end
                          local.get 4
                          i32.load offset=52
                          local.tee 3
                          local.get 3
                          i32.load
                          i32.const 1
                          i32.add
                          local.tee 5
                          i32.store
                          local.get 5
                          i32.eqz
                          br_if 10 (;@1;)
                          br 1 (;@10;)
                        end
                        local.get 4
                        i32.load8_u offset=49
                        local.set 5
                      end
                      br 2 (;@7;)
                    end
                    local.get 4
                    i32.const 0
                    i32.store16 offset=104
                    local.get 4
                    i32.const 1068025
                    i32.store offset=100
                    local.get 4
                    i32.const 1068016
                    i32.store offset=96
                    local.get 4
                    i32.const 256
                    i32.add
                    local.get 4
                    i32.const 96
                    i32.add
                    call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                    block ;; label = @9
                      local.get 4
                      i32.load8_u offset=256
                      local.tee 3
                      i32.const 255
                      i32.ne
                      br_if 0 (;@9;)
                      local.get 4
                      i32.load offset=264
                      local.set 1
                      local.get 4
                      i32.load offset=260
                      local.set 5
                      i64.const 0
                      local.set 6
                      i32.const 3
                      local.set 3
                      br 5 (;@4;)
                    end
                    local.get 4
                    local.get 4
                    i32.load8_u offset=259
                    i32.store8 offset=227
                    local.get 4
                    local.get 4
                    i32.load16_u offset=257 align=1
                    i32.store16 offset=225 align=1
                    local.get 4
                    local.get 4
                    i32.load offset=268
                    i32.store offset=236
                    local.get 4
                    local.get 4
                    i64.load offset=260 align=4
                    i64.store offset=228 align=4
                    local.get 4
                    local.get 3
                    i32.store8 offset=224
                    i32.const 1057960
                    i32.const 43
                    local.get 4
                    i32.const 224
                    i32.add
                    i32.const 1057944
                    i32.const 1058004
                    call $core::result::unwrap_failed
                    unreachable
                  end
                  local.get 4
                  i64.load32_u offset=56
                  local.set 6
                end
                local.get 4
                local.get 6
                i64.store offset=104
                local.get 4
                local.get 3
                i32.store offset=100
                local.get 4
                local.get 5
                i32.store8 offset=97
                local.get 4
                local.get 1
                i32.store8 offset=96
                local.get 4
                i32.const 0
                i32.store16 offset=152
                local.get 4
                i32.const 1066745
                i32.store offset=148
                local.get 4
                i32.const 1066739
                i32.store offset=144
                local.get 4
                i32.const 256
                i32.add
                local.get 4
                i32.const 144
                i32.add
                call $"core::iter::adapters::try_process::<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>, u16, core::result::Result<core::convert::Infallible, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>, <core::result::Result<alloc::rc::Rc<[u16]>, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as core::iter::traits::collect::FromIterator<core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>>>::from_iter<core::iter::adapters::map::Map<core::str::iter::EncodeUtf16, core::result::Result<u16, nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>::Ok>>::{closure#0}, alloc::rc::Rc<[u16]>>"
                block ;; label = @7
                  local.get 4
                  i32.load8_u offset=256
                  local.tee 3
                  i32.const 255
                  i32.eq
                  br_if 0 (;@7;)
                  local.get 4
                  local.get 4
                  i32.load8_u offset=259
                  i32.store8 offset=227
                  local.get 4
                  local.get 4
                  i32.load16_u offset=257 align=1
                  i32.store16 offset=225 align=1
                  local.get 4
                  local.get 4
                  i32.load offset=268
                  i32.store offset=236
                  local.get 4
                  local.get 4
                  i64.load offset=260 align=4
                  i64.store offset=228 align=4
                  local.get 4
                  local.get 3
                  i32.store8 offset=224
                  i32.const 1057960
                  i32.const 43
                  local.get 4
                  i32.const 224
                  i32.add
                  i32.const 1057944
                  i32.const 1058004
                  call $core::result::unwrap_failed
                  unreachable
                end
                local.get 4
                local.get 4
                i64.load offset=260 align=4
                i64.store offset=228 align=4
                i32.const 3
                local.set 3
                local.get 4
                i32.const 3
                i32.store8 offset=224
                local.get 4
                i32.const 96
                i32.add
                local.get 4
                i32.const 224
                i32.add
                call $"<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive> as core::cmp::PartialEq>::eq"
                local.set 1
                local.get 4
                i32.const 224
                i32.add
                call $"#func272 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                local.get 4
                i32.const 96
                i32.add
                call $"#func272 core::ptr::drop_glue::<nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>"
                local.get 4
                local.get 1
                i32.store8 offset=257
                local.get 4
                i32.const 1
                i32.store8 offset=256
                local.get 4
                i32.const 256
                i32.add
                call $"<nanvm_lib::naive::Naive as nanvm_lib::vm::internal::IVm>::with_unpacked::<bool, <nanvm_lib::vm::unpacked::Unpacked<nanvm_lib::naive::Naive>>::to_boolean>"
                local.set 1
                local.get 4
                i32.const 256
                i32.add
                call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                local.get 1
                br_if 1 (;@5;)
                local.get 4
                i32.const 16
                i32.add
                i32.const 1068005
                i32.const 7
                call $"<nanvm_lib::vm::string::String<nanvm_lib::naive::Naive> as core::convert::From<&str>>::from"
                local.get 4
                i32.const 3
                i32.store8 offset=128
                local.get 4
                local.get 4
                i64.load offset=16
                i64.store offset=132 align=4
                local.get 4
                i32.const 144
                i32.add
                local.get 4
                i32.const 32
                i32.add
                call $"#func683 <nanvm_lib::naive::Naive as core::clone::Clone>::clone"
                local.get 4
                i64.const 0
                i64.store offset=264
                local.get 4
                i32.const 2
                i32.store8 offset=256
                local.get 4
                i32.const 224
                i32.add
                local.get 4
                i32.const 144
                i32.add
                local.get 4
                i32.const 256
                i32.add
                call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::new
                block ;; label = @7
                  local.get 4
                  i32.load8_u offset=224
                  i32.const 255
                  i32.eq
                  br_if 0 (;@7;)
                  local.get 4
                  local.get 4
                  i64.load offset=248
                  i64.store offset=280
                  local.get 4
                  local.get 4
                  i64.load offset=240
                  i64.store offset=272
                  local.get 4
                  local.get 4
                  i64.load offset=232
                  i64.store offset=264
                  local.get 4
                  local.get 4
                  i64.load offset=224
                  i64.store offset=256
                  local.get 4
                  i32.const 112
                  i32.add
                  local.get 4
                  i32.const 256
                  i32.add
                  call $<nanvm_lib::vm::lambda::member::Member<nanvm_lib::naive::Naive>>::read
                  local.get 4
                  local.get 4
                  i64.load offset=128
                  i64.store offset=96
                  local.get 4
                  local.get 4
                  i64.load offset=136
                  i64.store offset=104
                  local.get 4
                  i32.const 8
                  i32.add
                  local.get 4
                  i32.const 96
                  i32.add
                  call $"<nanvm_lib::naive::container::Container<(), nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>> as nanvm_lib::vm::internal::icontainer::IContainer<nanvm_lib::naive::Naive>>::new_ok::<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>; 2]>"
                  local.get 4
                  i32.load offset=12
                  local.set 1
                  local.get 4
                  i32.load offset=8
                  local.set 5
                  i64.const 1
                  local.set 6
                  i32.const 6
                  local.set 3
                  br 3 (;@4;)
                end
                local.get 0
                local.get 4
                i64.load offset=240
                i64.store offset=16
                local.get 0
                local.get 4
                i64.load offset=232
                i64.store offset=8
                local.get 0
                i64.const 1
                i64.store
                local.get 4
                i32.const 128
                i32.add
                call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
                local.get 4
                i32.const 48
                i32.add
                call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
              end
              local.get 4
              i32.const 32
              i32.add
              call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
              local.get 2
              local.get 2
              i32.load
              i32.const -1
              i32.add
              local.tee 0
              i32.store
              local.get 0
              i32.eqz
              br_if 2 (;@3;)
              br 3 (;@2;)
            end
            local.get 4
            i32.const 1068012
            i32.const 4
            call $"<nanvm_lib::vm::string::String<nanvm_lib::naive::Naive> as core::convert::From<&str>>::from"
            i64.const 0
            local.set 6
            local.get 4
            i32.load offset=4
            local.set 1
            local.get 4
            i32.load
            local.set 5
          end
          local.get 0
          local.get 1
          i32.store offset=16
          local.get 0
          local.get 5
          i32.store offset=12
          local.get 0
          local.get 3
          i32.store8 offset=8
          local.get 0
          local.get 6
          i64.store
          local.get 4
          i32.const 48
          i32.add
          call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
          local.get 4
          i32.const 32
          i32.add
          call $"#func651 core::ptr::drop_glue::<nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>>"
          local.get 2
          local.get 2
          i32.load
          i32.const -1
          i32.add
          local.tee 0
          i32.store
          local.get 0
          br_if 1 (;@2;)
        end
        local.get 4
        i32.const 24
        i32.add
        call $"<alloc::rc::Rc<[nanvm_lib::vm::any::Any<nanvm_lib::naive::Naive>]>>::drop_slow"
      end
      local.get 4
      i32.const 304
      i32.add
      global.set $__stack_pointer
      return
    end
    unreachable
  )

Emergent Testing

Idle. Press Run to start the suite.

  • ./default-position/proof.f.mjs
  • ./proof.f.mjs