### C API Hello World Example Source: https://github.com/webassembly/binaryen/wiki/Compiling-to-WebAssembly-with-Binaryen A basic C API example demonstrating how to create a simple WebAssembly module. This serves as a starting point for understanding the Binaryen C API usage. ```C #include #include int main() { // Create a new module BinaryenModuleRef module = BinaryenModuleCreate(); // Define a simple function type: void () -> void BinaryenType params = BinaryenTypeCreate(NULL, 0); BinaryenType results = BinaryenTypeCreate(NULL, 0); BinaryenType funcType = BinaryenAddFunctionType(module, "myFuncType", results, params); // Create the function body: a simple return statement BinaryenExpressionRef body = BinaryenNop(module); BinaryenAddFunction(module, "myFunc", funcType, body); // Add an export for the function BinaryenAddExport(module, "myExport", "myFunc"); // Validate the module if (BinaryenModuleValidate(module)) { printf("Module is valid.\n"); } else { printf("Module is invalid.\n"); } // Print the module (for debugging) char* output = BinaryenModulePrint(module); printf("Module IR:\n%s\n", output); free(output); // Dispose the module BinaryenModuleDispose(module); return 0; } ``` -------------------------------- ### WebAssembly Binaryen: Spectest Print Example Source: https://github.com/webassembly/binaryen/blob/main/test/example/c-api-kitchen-sink.txt Demonstrates printing an i32 constant using the 'spectest' import and a start function. ```wat (module (type $0 (func (param i32))) (type $1 (func)) (import "spectest" "print" (func $print-i32 (param i32))) (start $starter) (func $starter (call $print-i32 (i32.const 1234) ) ) ) ``` -------------------------------- ### WebAssembly: Module with Drop and Start Source: https://github.com/webassembly/binaryen/blob/main/test/passes/remove-unused-nonfunction-module-elements_all-features.txt This WebAssembly module includes a 'start' function that executes a function named 'starter'. The 'starter' function pushes an i32 constant and then drops it, demonstrating basic value manipulation. ```wasm (module (type $0 (func)) (start $starter) (func $starter (type $0) (drop (i32.const 0) ) ) ) ``` -------------------------------- ### WebAssembly Module Structure Source: https://github.com/webassembly/binaryen/blob/main/test/example/c-api-kitchen-sink.txt Provides a comprehensive example of a WebAssembly module, including type definitions, imports, globals, memory, data segments, tables, elements, tags, exports, and a start function. ```WebAssembly (module (type $0 (array (mut i8))) (type $1 (struct (field (mut i32)))) (type $2 (func (param i32 i64 f32 f64) (result i32))) (type $3 (array (mut funcref))) (type $4 (array (mut i16))) (type $5 (func (param i32))) (type $6 (func (param i32 f64) (result f32))) (type $7 (func)) (import "module" "base" (func $an-imported (type $6) (param i32 f64) (result f32))) (global $a-global i32 (i32.const 7)) (global $a-mutable-global (mut f32) (f32.const 7.5)) (global $i8Array-global (mut (ref null $0)) (array.new_default $0 (i32.const 0) )) (global $i16Array-global (mut (ref null $4)) (array.new_default $4 (i32.const 0) )) (global $funcArray-global (mut (ref null $3)) (array.new $3 (ref.null nofunc) (i32.const 0) )) (global $i32Struct-global (mut (ref null $1)) (struct.new_default $1)) (global $string-global (mut stringref) (string.const "")) (memory $0 1 256 shared) (data $0 (i32.const 10) "hello, world") (data $1 "I am passive") (data $2 "data segment 2") (data $seg (i32.const 0) "data segment 3") (table $tab 0 100 funcref) (table $0 1 1 funcref) (elem $0 (table $0) (i32.const 0) func $kitchen()sinker) (elem $passive func $kitchen()sinker) (tag $a-tag (type $5) (param i32)) (export "mem" (memory $0)) (export "kitchen_sinker" (func $kitchen()sinker)) (start $starter) (func $kitchen()sinker (type $2) (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) (local $5 externref) (local $6 f32) (block $the-body (result i32) (block $the-nothing (drop (block $the-value (result i32) (drop (i32.clz (i32.const -10) ) ) (drop (i64.ctz (i64.const -22) ) ) (drop (i32.popcnt (i32.const -10) ) ) (drop (f32.neg (f32.const -33.61199951171875) ) ) (drop (f64.abs (f64.const -9005.841) ) ) (drop (f32.ceil (f32.const -33.61199951171875) ) ) (drop (f64.floor (f64.const -9005.841) ) ) (drop (f32.trunc (f32.const -33.61199951171875) ) ) (drop (f32.nearest (f32.const -33.61199951171875) ) ) (drop (f64.sqrt (f64.const -9005.841) ) ) (drop (i32.eqz (i32.const -10) ) ) (drop (i64.extend_i32_s (i32.const -10) ) ) (drop (i64.extend_i32_u (i32.const -10) ) ) (drop (i32.wrap_i64 (i64.const -22) ) ) (drop (i32.trunc_f32_s (f32.const -33.61199951171875) ) ) (drop (i64.trunc_f32_s (f32.const -33.61199951171875) ) ) (drop (i32.trunc_f32_u (f32.const -33.61199951171875) ) ) (drop (i64.trunc_f32_u (f32.const -33.61199951171875) ) ) (drop (i32.trunc_f64_s (f64.const -9005.841) ) ) (drop (i64.trunc_f64_s (f64.const -9005.841) ) ) (drop (i32.trunc_f64_u (f64.const -9005.841) ) ) (drop (i64.trunc_f64_u (f64.const -9005.841) ) ) (drop (i32.trunc_sat_f32_s ``` -------------------------------- ### WebAssembly Module with Start Function and Exports Source: https://github.com/webassembly/binaryen/blob/main/test/passes/func-metrics.txt This snippet illustrates a WebAssembly module with a start function and an exported function 'a'. It includes metrics for exports, functions, imports, and the start function, detailing the number of calls to an imported function. ```WebAssembly (module (type $0 (func)) (import "env" "waka" (func $waka)) (export "a" (func $func_a)) (start $func_a) (func $func_a (call $waka) (call $waka) (call $waka) (call $waka) (call $waka) ) ) ``` -------------------------------- ### WebAssembly Parameter and Local Variable Usage Source: https://github.com/webassembly/binaryen/blob/main/test/passes/rse_all-features.txt Shows different ways parameters and local variables are used within WebAssembly functions, including setting, getting, and dropping their values, and how parameter usage can be optimized. ```WebAssembly (func $later-param-use (type $1) (param $x i32) (local.set $x (i32.const 0) ) (drop (i32.const 0) ) ) (func $diff-value (type $1) (param $x i32) (local $a i32) (local.set $x (i32.const 0) ) (local.set $x (i32.const 1) ) (drop (i32.const 1) ) (local.set $a (i32.const 1) ) (drop (i32.const 1) ) (local.set $a (i32.const 0) ) ) (func $copy (type $0) (local $x i32) (local $y i32) (local.set $x (i32.const 1) ) (local.set $y (local.get $x) ) (drop (i32.const 1) ) (local.set $x (i32.const 2) ) (if (i32.const 1) (then (nop) ) (else (nop) ) ) (local.set $y (local.get $x) ) (drop (i32.const 2) ) (if (i32.const 1) (then (nop) ) (else (nop) ) ) (drop (i32.const 2) ) (local.set $x (i32.const 3) ) (local.set $y (i32.const 3) ) (drop (local.get $x) ) ) (func $param-unique (type $1) (param $x i32) (local $a i32) (local.set $a (local.get $x) ) (drop (local.get $x) ) (local.set $x (i32.eqz (i32.const 9999) ) ) (local.set $a (local.get $x) ) (drop (local.get $x) ) ) (func $set-unique (type $0) (local $x i32) (local $y i32) (local.set $x (i32.eqz (i32.const 123) ) ) (local.set $y (local.get $x) ) (drop (local.get $x) ) (local.set $x (i32.eqz (i32.const 456) ) ) (local.set $y (local.get $x) ) (drop (local.get $x) ) (local.set $x (i32.eqz (i32.const 789) ) ) (if (i32.const 1) (then (nop) ) (else (nop) ) ) (local.set $y (local.get $x) ) (drop (local.get $x) ) (local.set $x (i32.eqz (i32.const 1000) ) ) (local.set $y (local.get $x) ) (if (i32.const 1) (then (nop) ) (else (nop) ) ) (drop (local.get $x) ) ) (func $identical_complex (type $1) (param $x i32) (local $y i32) (local.set $y (local.get $x) ) (drop (local.get $x) ) (drop (local.get $x) ) (drop (local.get $x) ) (drop (local.get $y) ) (drop (local.get $y) ) ) ``` -------------------------------- ### WebAssembly Spectest Print Example Source: https://github.com/webassembly/binaryen/blob/main/test/binaryen.js/kitchen-sink.js.txt This WebAssembly module imports a 'print' function from the 'spectest' module and calls it with a constant value during its start execution. It demonstrates basic import and start functionality. ```wasm (module (type $0 (func (param i32))) (type $1 (func)) (import "spectest" "print" (func $print-i32 (param i32))) (start $starter) (func $starter (call $print-i32 (i32.const 1234) ) ) ) ``` -------------------------------- ### WebAssembly Module with Start Function and Imports Source: https://github.com/webassembly/binaryen/blob/main/test/passes/func-metrics.txt This snippet shows a WebAssembly module that imports a function 'waka' and designates a start function. It provides metrics for functions, imports, and the start function, highlighting the call count to the imported function. ```WebAssembly (module (type $0 (func)) (import "env" "waka" (func $waka)) (start $func_a) (func $func_a (call $waka) (call $waka) (call $waka) (call $waka) (call $waka) ) ) ``` -------------------------------- ### WebAssembly Basic Operations Source: https://github.com/webassembly/binaryen/blob/main/test/passes/ssa_enable-threads.txt Demonstrates fundamental WebAssembly operations including type declarations, global variable initialization, and local variable manipulation (get, set, drop) for various data types (i32, f32, i64, f64). ```WebAssembly (module (type $0 (func (param i32))) (type $1 (func (result i32))) (type $2 (func)) (global $global$0 (mut i32) (i32.const 1)) (func $basics (param $x i32) (local $y i32) (local $z f32) (local $w i64) (local $t f64) (local $5 i32) (local $6 f64) (local $7 f64) (drop (local.get $x) ) (drop (i32.const 0) ) (drop (f32.const 0) ) (drop (i64.const 0) ) (drop (f64.const 0) ) (local.set $5 (i32.const 100) ) (drop (local.get $5) ) (local.set $6 (f64.const 2) ) (drop (local.get $6) ) (local.set $7 (f64.const 33) ) (drop (local.get $7) ) (drop (local.get $7) ) ) ) ``` -------------------------------- ### WebAssembly: Basic Loop with Local Variables Source: https://github.com/webassembly/binaryen/blob/main/test/passes/ssa_enable-threads.txt Demonstrates a basic loop structure in WebAssembly using Binaryen syntax. It involves setting and getting local variables, and using `br_if` for loop control. ```WebAssembly (func $loop2-zeroinit (local $x i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (drop (i32.const 0) ) (loop $moar (drop (local.get $4) ) (local.set $1 (i32.const 1) ) (drop (local.get $1) ) (local.set $2 (local.tee $4 (i32.const 123) ) ) (drop (local.get $2) ) (br_if $moar (i32.const 2) ) (drop (local.get $2) ) (local.set $3 (i32.const 3) ) (drop (local.get $3) ) ) (drop (local.get $3) ) ) ``` -------------------------------- ### WebAssembly Select Instruction Examples Source: https://github.com/webassembly/binaryen/blob/main/test/passes/remove-unused-brs_enable-multivalue.txt Demonstrates the usage of the `select` instruction in WebAssembly for conditional value selection. It shows how to choose between two values based on a condition, including examples with arithmetic operations. ```WebAssembly (func $selectify (param $x i32) (drop (select (i32.mul (i32.const 2) (i32.const 3) ) (i32.mul (i32.const 2) (i32.const 3) ) (i32.eq (local.get $x) (i32.const 1) ) ) ) (drop (select (i32.add (i32.const 2) (i32.const 3) ) (i32.add (i32.const 2) (i32.const 3) ) (i32.eq (local.get $x) (i32.const 1) ) ) ) ) ``` ```WebAssembly (func $selectify-even-with-condition-side-effects (param $0 i32) (drop (select (i32.const 1) (i32.const 0) (i32.rem_s (local.get $0) (i32.const 2) ) ) ) ) ``` -------------------------------- ### WebAssembly Br Table Overlapping Start Example Source: https://github.com/webassembly/binaryen/blob/main/test/passes/remove-unused-brs_enable-multivalue.txt Shows a 'br_table' instruction where the initial branches overlap, demonstrating the handling of overlapping conditions at the beginning of a multi-way branch in WebAssembly. ```WebAssembly (func $br-to-table-overlap-start (param $a i32) (block $x (block $y (block $z (br_if $x (i32.eq (local.get $a) (i32.const 0) ) ) (br_if $y (i32.eq (local.get $a) (i32.const 0) ) ) (br_if $z (i32.eq (local.get $a) (i32.const 1) ) ) (unreachable) ) (unreachable) ) (unreachable) ) (unreachable) ) ``` -------------------------------- ### WebAssembly Binaryen: Module with Memory, Data, Table, and Exports Source: https://github.com/webassembly/binaryen/blob/main/test/example/c-api-kitchen-sink.txt A comprehensive WebAssembly module example showcasing memory, data segments, tables, exports, and functions. ```wat (module (type $0 (func)) (global $a-global i32 (i32.const 125)) (memory $0 1 256) (data $0 (i32.const 10) "hello, world") (data $1 (global.get $a-global) "segment data 2") (table $0 1 1 funcref) (elem $0 (i32.const 0) $fn0 $fn1 $fn2) (export "export0" (func $fn0)) (export "export1" (func $fn1)) (export "export2" (func $fn2)) (export "mem" (memory $0)) (func $fn0 (nop) ) (func $fn1 (nop) ) (func $fn2 (nop) ) ) ``` -------------------------------- ### Setup Dependencies Source: https://github.com/webassembly/binaryen/wiki/Fuzzing Installs necessary dependencies for Binaryen, such as the Spidermonkey JS shell (mozjs), V8 JS shell (d8), and WABT. The script can install specific dependencies or all of them. ```bash ./third_party/setup.py [mozjs|v8|wabt|all] ``` -------------------------------- ### WebAssembly: Memory Initialization and Loading Source: https://github.com/webassembly/binaryen/blob/main/test/passes/simplify-locals_all-features_disable-exception-handling.txt Shows how to initialize a memory segment with data and then load values from that memory. Uses 'memory.init' and 'i32.load'. ```WebAssembly (func $memory-init-load (type $0) (local $x i32) (local.set $x (i32.load (i32.const 0) ) ) (memory.init $0 (i32.const 0) (i32.const 0) (i32.const 5) ) (drop (local.get $x) ) ) ``` -------------------------------- ### WebAssembly: Execute main function Source: https://github.com/webassembly/binaryen/blob/main/test/passes/ignore_missing_func_dwarf.bin.txt This snippet shows the `main` function in WebAssembly, which serves as the entry point. It takes two i32 parameters and returns an i32. The function calls `__original_main` and returns its result. ```WebAssembly (func $main (param $0 i32) (param $1 i32) (result i32) (local $2 i32) ;; code offset: 0xd9 (local.set $2 ;; code offset: 0xd7 (call $__original_main) ) ;; code offset: 0xdd (return ;; code offset: 0xdb (local.get $2) ) ) ``` -------------------------------- ### WebAssembly Loop with Local Variable Tee and Get Source: https://github.com/webassembly/binaryen/blob/main/test/passes/licm.txt Shows a WebAssembly function that gets a local variable, then enters a loop where it uses `local.tee` to set another local variable (`$y`) and `local.get` to retrieve `$x`. This highlights complex local variable manipulation. ```WebAssembly (module (type $0 (func)) (func $loop12 (local $x i32) (local $y i32) (drop (local.get $x) ) (loop $loop (nop) (br_if $loop (local.tee $y (i32.const 2) ) ) ) ) ) ``` -------------------------------- ### WebAssembly Binaryen: Block and Branching Source: https://github.com/webassembly/binaryen/blob/main/test/example/c-api-kitchen-sink.txt Demonstrates the use of blocks and branching instructions like 'br' for control flow within WebAssembly code using Binaryen. ```wat (block (call $check (i32.const 4) ) (block (br $block$6$break) ) ) ) (else (br $block$6$break) ) ) ) (block (call $check (i32.const 5) ) (block (drop (i32.const 40) ) (br $block$7$break) ) ) ) ) (block (call $check (i32.const 6) ) ) ) ) ``` -------------------------------- ### Looping Constructs in WAT Source: https://github.com/webassembly/binaryen/blob/main/test/passes/interesting-pass-mix.txt Demonstrates different ways to implement loops in WAT using the 'loop' and 'br' instructions. Includes examples of infinite loops with breaks and conditional breaks. ```wat (module (type $0 (func (param i32))) (func $trivial) (func $loops (param $0 i32) (if (local.get $0) (then (loop $shape$2$continue (call $trivial) (br $shape$2$continue) ) ) ) (loop $shape$4$continue (call $trivial) (if (local.get $0) (then (br $shape$4$continue) ) ) ) (loop $shape$6$continue (call $trivial) (if (local.get $0) (then (br $shape$6$continue) ) ) ) ) ) ``` -------------------------------- ### WebAssembly Memory Size Operation Source: https://github.com/webassembly/binaryen/blob/main/test/passes/remove-unused-nonfunction-module-elements_all-features.txt Demonstrates how to get the current size of the WebAssembly linear memory. This function returns the number of memory pages. ```WebAssembly (module (type $0 (func (result i32))) (memory $0 23 256) (export "user" (func $user)) (func $user (type $0) (result i32) (memory.size) ) ) ``` -------------------------------- ### WebAssembly Function Reference Export Source: https://github.com/webassembly/binaryen/blob/main/test/passes/fuzz-exec_all-features.txt This snippet defines a WebAssembly module that exports a function reference. It uses `ref.func` to get a reference to the function itself and returns it. ```wasm (module (type $0 (func (result funcref))) (elem declare func $func) (export "func" (func $func)) (func $func (type $0) (result funcref) (ref.func $func) ) ) ``` -------------------------------- ### WebAssembly: Basic Control Flow and Locals Source: https://github.com/webassembly/binaryen/blob/main/test/passes/simplify-locals-nostructure.txt Demonstrates basic WebAssembly instructions like local variable manipulation (local.get, local.set, local.tee), conditional execution (if-then-else), block structures, and drop operations. It includes examples of conditional logic and block-based value retrieval. ```WebAssembly (module (type $0 (func)) (type $1 (func (param i32 i32) (result f64))) (type $2 (func (param i32) (result i32))) (memory $0 1) (func $contrast (local $x i32) (local $y i32) (local $z i32) (local $a i32) (local $b i32) (nop) (if (local.tee $x (i32.const 1) ) (then (nop) ) ) (if (local.get $x) (then (nop) ) ) (nop) (drop (if (result i32) (i32.const 2) (then (i32.const 3) ) (else (i32.const 4) ) ) ) (nop) (drop (block (result i32) (i32.const 5) ) ) (if (i32.const 6) (then (local.set $a (i32.const 7) ) ) (else (local.set $a (i32.const 8) ) ) ) (drop (local.get $a) ) (block $val (if (i32.const 10) (then (local.set $b (i32.const 11) ) (br $val) ) ) (local.set $b (i32.const 12) ) ) (drop (local.get $b) ) ) (func $no-unreachable (local $x i32) (unreachable) ) (func $implicit-trap-and-global-effects (local $var$0 i32) (local.set $var$0 (i32.trunc_f64_u (f64.const -nan:0xfffffffffffc3) ) ) (f32.store align=1 (i32.const 22) (f32.const 154) ) (drop (local.get $var$0) ) ) (func $implicit-trap-and-local-effects (local $var$0 i32) (local $other i32) (nop) (local.set $other (i32.const 100) ) (drop (i32.trunc_f64_u (f64.const -nan:0xfffffffffffc3) ) ) (if (i32.const 1) (then (drop (local.get $other) ) ) ) ) (func $multi-pass-get-equivs-right (param $var$0 i32) (param $var$1 i32) (result f64) (local $var$2 i32) (nop) (i32.store (local.get $var$0) (i32.const 1) ) (f64.promote_f32 (f32.load (local.get $var$0) ) ) ) (func $if-value-structure-equivalent (param $x i32) (result i32) (local $y i32) (if (i32.const 1) (then (local.set $x (i32.const 2) ) ) (else (nop) (nop) ) ) (local.get $x) ) ) ``` -------------------------------- ### Setup RPATH for Executable/Library (CMake) Source: https://github.com/webassembly/binaryen/blob/main/CMakeLists.txt Configures the RPATH for a target based on the operating system (Apple, Unix). It sets the install name directory for macOS and the RPATH for Linux/FreeBSD/DragonFly. ```cmake function(binaryen_setup_rpath name) if(CMAKE_INSTALL_RPATH) return() endif() if(APPLE) set(_install_name_dir INSTALL_NAME_DIR "@rpath") set(_install_rpath "@loader_path/../lib") elseif(UNIX) set(_install_rpath "$ORIGIN/../lib") if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)") set_property(TARGET ${name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-z,origin ") endif() else() return() endif() set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH On INSTALL_RPATH "${_install_rpath}" ${_install_name_dir}) endfunction() ``` -------------------------------- ### WebAssembly Binaryen: Stacky-Help Function (Linear) Source: https://github.com/webassembly/binaryen/blob/main/test/passes/O3_print-stack-ir.txt This snippet presents an alternative, more linear syntax for the 'stacky-help' function in WebAssembly Binaryen. It achieves a similar outcome to the structured version but with a flatter instruction sequence. ```WebAssembly (module (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (param $0 i32) (result i32) i32.const 0 call $stacky-help i32.const 1 call $stacky-help i32.const 2 call $stacky-help drop i32.eqz i32.add ) ) ``` -------------------------------- ### WebAssembly Global Variable Access in Loop Source: https://github.com/webassembly/binaryen/blob/main/test/passes/licm.txt Demonstrates accessing a global variable ('glob') within a loop in WebAssembly. It gets the global value, drops it, and uses it as a loop condition. ```wasm (func $global (local $x i32) (local.set $x (global.get $glob) ) (drop (local.get $x) ) (loop $loop (nop) (nop) (br_if $loop (local.get $x) ) ) ) ``` -------------------------------- ### WebAssembly Binaryen: Stacky-Help Function (Structured) Source: https://github.com/webassembly/binaryen/blob/main/test/passes/O3_print-stack-ir.txt This snippet demonstrates the 'stacky-help' function in WebAssembly Binaryen using a more structured, block-based syntax. It includes type definitions, exports, and the function's logic with nested calls and control flow. ```WebAssembly (module (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (param $0 i32) (result i32) (i32.add (call $stacky-help (i32.const 0) ) (block (result i32) (local.set $0 (call $stacky-help (i32.const 1) ) ) (drop (call $stacky-help (i32.const 2) ) ) (i32.eqz (local.get $0) ) ) ) ) ) ``` -------------------------------- ### WebAssembly Module with Table and Element Initialization Source: https://github.com/webassembly/binaryen/blob/main/test/example/module-splitting.txt Shows a WebAssembly module that imports a table and initializes it with function references using the `elem` instruction. This sets up the table for indirect calls. ```wasm (module (type $0 (func)) (import "primary" "%table_1" (table $0 3 funcref)) (elem $0 (i32.const 0) $foo $bar $quux) (func $bar (type $0) (nop) ) (func $foo (type $0) (nop) ) (func $quux (type $0) (nop) ) ) ``` -------------------------------- ### WebAssembly Complex Loop with Blocks and Locals Source: https://github.com/webassembly/binaryen/blob/main/test/passes/licm.txt A complex WebAssembly function involving a loop, nested blocks, local variable manipulation (set and get), and constants. It returns an i64 value. ```wasm (func $fuzz1 (result i64) (local $var$1 i64) (drop (block (result i32) (local.set $var$1 (block $label$5 (result i64) (local.set $var$1 (i64.const -29585) ) (i64.const -70) ) ) (loop $label$4 (result i32) (nop) (i32.const 1) ) ) ) (loop $label$1 (result i64) (block $label$2 (block $label$3 (nop) (br $label$2) ) (unreachable) ) (local.get $var$1) ) ) ```