From 466680d3e1330301fd4f25536f7c6aeda0c09eec Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 24 May 2024 06:50:27 +0300 Subject: [PATCH] chore: restore the `miden_sdk_account_test` source code and extract the basic wallet rust sdk test --- .../miden_sdk_account_test.hir | 2533 ++++++++++++++++- .../miden_sdk_account_test.wat | 1847 +++++++++++- .../rust_sdk_basic_wallet.hir | 279 ++ .../rust_sdk_basic_wallet.masm | 802 ++++++ .../rust_sdk_basic_wallet.wat | 174 ++ tests/integration/src/cargo_proj/mod.rs | 6 +- tests/integration/src/compiler_test.rs | 34 +- .../src/rust_masm_tests/components.rs | 4 +- .../src/rust_masm_tests/rust_sdk.rs | 77 +- .../rust-sdk/account-test/src/lib.rs | 101 +- 10 files changed, 5791 insertions(+), 66 deletions(-) create mode 100644 tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.hir create mode 100644 tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.masm create mode 100644 tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.wat diff --git a/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.hir b/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.hir index e7815bee1..fe0889730 100644 --- a/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.hir +++ b/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.hir @@ -1,11 +1,20 @@ (component ;; Component Imports + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt)))) (#miden:prelude/std_crypto_dsa #rpo_falcon512_verify) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt felt felt felt felt felt felt felt felt felt)))) (#miden:prelude/std_mem #pipe_double_words_to_memory) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (result felt felt felt felt felt)))) (#miden:prelude/std_mem #pipe_words_to_memory) (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)))) (#miden:tx_kernel/account #add_asset) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (result felt)))) (#miden:tx_kernel/account #get_id) (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)))) (#miden:tx_kernel/account #remove_asset) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (result i32 felt)))) (#miden:tx_kernel/note #get_inputs) (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt)))) (#miden:tx_kernel/tx #create_note) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt felt felt felt felt)))) (#std::crypto_hashes #blake3_hash_2to1) ;; Modules (module #miden_sdk_account_test + ;; Data Segments + (data (mut) (offset 1048576) 0x7e2f73646b2f7072656c7564652f7372632f7374646c69622f63727970746f2f6861736865732e727300000000001000290000008b000000280000000000100029000000d100000028000000) + ;; Constants (const (id 0) 0x00100000) @@ -13,48 +22,1930 @@ (global (export #__stack_pointer) (id 0) (type i32) (const 0)) ;; Functions - (func (export #receive_asset) (param i32) + (func (export #< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop) + (param i32) (block 0 (param v0 i32) (let (v1 i32) (const.i32 0)) (let (v2 i32) (global.load i32 (global.symbol #__stack_pointer))) - (let (v3 i32) (const.i32 32)) + (let (v3 i32) (const.i32 16)) (let (v4 i32) (sub.wrapping v2 v3)) (let (v5 (ptr i32)) (global.symbol #__stack_pointer)) (store v5 v4) - (call #miden_sdk_tx_kernel::add_asset v4 v0) - (let (v6 i32) (const.i32 32)) - (let (v7 i32) (add.wrapping v4 v6)) + (let (v6 u32) (cast v0)) + (let (v7 (ptr i32)) (inttoptr v6)) + (let (v8 i32) (load v7)) + (let (v9 u32) (cast v8)) + (let (v10 (ptr i32)) (inttoptr v9)) + (let (v11 i32) (load v10)) + (let (v12 u32) (cast v4)) + (let (v13 u32) (add.checked v12 12)) + (let (v14 (ptr i32)) (inttoptr v13)) + (store v14 v11) + (let (v15 u32) (cast v8)) + (let (v16 u32) (add.checked v15 8)) + (let (v17 (ptr i32)) (inttoptr v16)) + (let (v18 i32) (load v17)) + (let (v19 u32) (cast v4)) + (let (v20 u32) (add.checked v19 8)) + (let (v21 (ptr i32)) (inttoptr v20)) + (store v21 v18) + (let (v22 i32) (const.i32 8)) + (let (v23 i32) (add.wrapping v4 v22)) + (call # as core::ops::drop::Drop>::drop v23) + (let (v24 i32) (const.i32 16)) + (let (v25 i32) (add.wrapping v4 v24)) + (let (v26 (ptr i32)) (global.symbol #__stack_pointer)) + (store v26 v25) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export # as core::ops::drop::Drop>::drop) + (param i32) + (block 0 (param v0 i32) + (let (v1 i32) (const.i32 0)) + (let (v2 u32) (cast v0)) + (let (v3 (ptr i32)) (inttoptr v2)) + (let (v4 i32) (load v3)) + (let (v5 i1) (eq v4 0)) + (let (v6 i32) (cast v5)) + (let (v7 i1) (neq v6 0)) + (condbr v7 (block 2) (block 3))) + + (block 1 + (ret)) + + (block 2 + (br (block 1))) + + (block 3 + (let (v8 u32) (cast v0)) + (let (v9 u32) (add.checked v8 4)) + (let (v10 (ptr i32)) (inttoptr v9)) + (let (v11 i32) (load v10)) + (let (v12 i32) (const.i32 3)) + (let (v13 i32) (shl.wrapping v4 v12)) + (let (v14 i32) (const.i32 8)) + (call #__rust_dealloc v11 v13 v14) + (br (block 2))) + ) + + (func (export #core::alloc::global::GlobalAlloc::alloc_zeroed) + (param i32) (param i32) (param i32) (result i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (let (v4 i32) (call #::alloc v0 v1 v2)) + (let (v5 i1) (eq v4 0)) + (let (v6 i32) (cast v5)) + (let (v7 i1) (neq v6 0)) + (condbr v7 (block 2 v4) (block 3))) + + (block 1 (param v3 i32) + (ret v3)) + + (block 2 (param v9 i32) + (br (block 1 v9))) + + (block 3 + (let (v8 i32) (const.i32 0)) + (assert.eq 0 v8) + (br (block 2 v4))) + ) + + (func (export #__rust_dealloc) (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (let (v3 i32) (const.i32 1048652)) + (call #::dealloc v3 v0 v2 v1) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export # as core::ops::drop::Drop>::drop) + (param i32) + (block 0 (param v0 i32) + (let (v1 i32) (const.i32 0)) + (let (v2 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v3 i32) (const.i32 16)) + (let (v4 i32) (sub.wrapping v2 v3)) + (let (v5 (ptr i32)) (global.symbol #__stack_pointer)) + (store v5 v4) + (let (v6 u32) (cast v4)) + (let (v7 u32) (add.checked v6 12)) + (let (v8 (ptr i32)) (inttoptr v7)) + (store v8 v0) + (let (v9 i32) (const.i32 12)) + (let (v10 i32) (add.wrapping v4 v9)) + (call #< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop v10) + (let (v11 i32) (const.i32 16)) + (let (v12 i32) (add.wrapping v4 v11)) + (let (v13 (ptr i32)) (global.symbol #__stack_pointer)) + (store v13 v12) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #get_wallet_magic_number) (result felt) + (block 0 + (let (v1 felt) (const.felt 0)) + (let (v2 felt) (call #miden_sdk_tx_kernel::get_id)) + (let (v3 i64) (const.i64 42)) + (let (v4 felt) (cast v3)) + (let (v5 felt) (add.unchecked v4 v2)) + (br (block 1 v5))) + + (block 1 (param v0 felt) + (ret v0)) + ) + + (func (export #test_add_asset) (result felt) + (block 0 + (let (v1 i32) (const.i32 0)) + (let (v2 felt) (const.felt 0)) + (let (v3 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v4 i32) (const.i32 64)) + (let (v5 i32) (sub.wrapping v3 v4)) + (let (v6 (ptr i32)) (global.symbol #__stack_pointer)) + (store v6 v5) + (let (v7 i64) (const.i64 1)) + (let (v8 felt) (cast v7)) + (let (v9 i64) (const.i64 2)) + (let (v10 felt) (cast v9)) + (let (v11 i64) (const.i64 3)) + (let (v12 felt) (cast v11)) + (let (v13 i64) (const.i64 4)) + (let (v14 felt) (cast v13)) + (let (v15 u32) (cast v5)) + (let (v16 u32) (add.checked v15 24)) + (let (v17 (ptr felt)) (inttoptr v16)) + (store v17 v14) + (let (v18 u32) (cast v5)) + (let (v19 u32) (add.checked v18 16)) + (let (v20 (ptr felt)) (inttoptr v19)) + (store v20 v12) + (let (v21 u32) (cast v5)) + (let (v22 u32) (add.checked v21 8)) + (let (v23 (ptr felt)) (inttoptr v22)) + (store v23 v10) + (let (v24 u32) (cast v5)) + (let (v25 (ptr felt)) (inttoptr v24)) + (store v25 v8) + (let (v26 i32) (const.i32 32)) + (let (v27 i32) (add.wrapping v5 v26)) + (call #miden_sdk_tx_kernel::add_asset v27 v5) + (let (v28 u32) (cast v5)) + (let (v29 u32) (add.checked v28 32)) + (let (v30 (ptr felt)) (inttoptr v29)) + (let (v31 felt) (load v30)) + (let (v32 i32) (const.i32 64)) + (let (v33 i32) (add.wrapping v5 v32)) + (let (v34 (ptr i32)) (global.symbol #__stack_pointer)) + (store v34 v33) + (br (block 1 v31))) + + (block 1 (param v0 felt) + (ret v0)) + ) + + (func (export #test_felt_ops_smoke) + (param felt) (param felt) (result felt) + (block 0 (param v0 felt) (param v1 felt) + (let (v3 i64) (const.i64 0)) + (let (v4 i64) (cast v0)) + (let (v5 i1) (gt v0 v1)) + (let (v6 i32) (cast v5)) + (let (v7 i1) (neq v6 0)) + (condbr v7 (block 7) (block 8))) + + (block 1 (param v2 felt) + (ret v2)) + + (block 2 + (let (v41 felt) (neg v0)) + (br (block 1 v41))) + + (block 3 + (assert.eq v1 v0) + (let (v39 felt) (cast v4)) + (let (v40 felt) (add.unchecked v0 v39)) + (ret v40)) + + (block 4 + (let (v38 felt) (div.unchecked v1 v0)) + (ret v38)) + + (block 5 + (let (v36 felt) (pow2 v0)) + (let (v37 felt) (mul.unchecked v36 v1)) + (ret v37)) + + (block 6 + (let (v34 felt) (exp v0 v1)) + (let (v35 felt) (sub.unchecked v34 v1)) + (ret v35)) + + (block 7 + (let (v32 felt) (inv v0)) + (let (v33 felt) (add.unchecked v32 v1)) + (ret v33)) + + (block 8 + (let (v8 i1) (lt v1 v0)) + (let (v9 i32) (cast v8)) + (let (v10 i1) (neq v9 0)) + (condbr v10 (block 6) (block 9))) + + (block 9 + (let (v11 i1) (lte v1 v0)) + (let (v12 i32) (cast v11)) + (let (v13 i1) (neq v12 0)) + (condbr v13 (block 5) (block 10))) + + (block 10 + (let (v14 i1) (gte v0 v1)) + (let (v15 i32) (cast v14)) + (let (v16 i1) (neq v15 0)) + (condbr v16 (block 4) (block 11))) + + (block 11 + (let (v17 i1) (eq v0 v1)) + (let (v18 i32) (cast v17)) + (let (v19 i32) (const.i32 1)) + (let (v20 i1) (eq v18 v19)) + (let (v21 i32) (cast v20)) + (let (v22 i1) (neq v21 0)) + (condbr v22 (block 3) (block 12))) + + (block 12 + (let (v23 i1) (eq v0 v1)) + (let (v24 i32) (cast v23)) + (let (v25 i32) (const.i32 1)) + (let (v26 i1) (neq v24 v25)) + (let (v27 i32) (cast v26)) + (let (v28 i1) (neq v27 0)) + (condbr v28 (block 2) (block 13))) + + (block 13 + (let (v29 i1) (is_odd v1)) + (let (v30 i32) (cast v29)) + (let (v31 i1) (neq v30 0)) + (condbr v31 (block 14) (block 15))) + + (block 14 + (assert.eq 1 v0) + (ret v1)) + + (block 15 + (assert.eq 0 v1) + (ret v0)) + ) + + (func (export #note_script) (result felt) + (block 0 + (let (v1 i32) (const.i32 0)) + (let (v2 felt) (const.felt 0)) + (let (v3 i32) (const.i32 0)) + (let (v4 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v5 i32) (const.i32 16)) + (let (v6 i32) (sub.wrapping v4 v5)) + (let (v7 (ptr i32)) (global.symbol #__stack_pointer)) + (store v7 v6) + (let (v8 i64) (const.i64 0)) + (let (v9 felt) (cast v8)) + (call #miden_sdk_tx_kernel::get_inputs v6) + (let (v10 u32) (cast v6)) + (let (v11 (ptr i32)) (inttoptr v10)) + (let (v12 i32) (load v11)) + (let (v13 u32) (cast v6)) + (let (v14 u32) (add.checked v13 4)) + (let (v15 (ptr i32)) (inttoptr v14)) + (let (v16 i32) (load v15)) + (let (v17 u32) (cast v6)) + (let (v18 u32) (add.checked v17 8)) + (let (v19 (ptr i32)) (inttoptr v18)) + (let (v20 i32) (load v19)) + (let (v21 i32) (const.i32 3)) + (let (v22 i32) (shl.wrapping v20 v21)) + (let (v23 i32) (add.wrapping v16 v22)) + (let (v24 u32) (cast v6)) + (let (v25 u32) (add.checked v24 12)) + (let (v26 (ptr i32)) (inttoptr v25)) + (store v26 v23) + (let (v27 u32) (cast v6)) + (let (v28 u32) (add.checked v27 8)) + (let (v29 (ptr i32)) (inttoptr v28)) + (store v29 v12) + (let (v30 u32) (cast v6)) + (let (v31 (ptr i32)) (inttoptr v30)) + (store v31 v16) + (br (block 2 v22 v6 v23 v9 v16))) + + (block 1 (param v0 felt)) + + (block 2 + (param v33 i32) + (param v35 i32) + (param v36 i32) + (param v43 felt) + (param v46 i32) + (let (v34 i1) (neq v33 0)) + (condbr v34 (block 4) (block 5))) + + (block 3 (param v32 felt)) + + (block 4 + (let (v44 i32) (const.i32 -8)) + (let (v45 i32) (add.wrapping v33 v44)) + (let (v47 u32) (cast v46)) + (let (v48 (ptr felt)) (inttoptr v47)) + (let (v49 felt) (load v48)) + (let (v50 felt) (add.unchecked v43 v49)) + (let (v51 i32) (const.i32 8)) + (let (v52 i32) (add.wrapping v46 v51)) + (br (block 2 v45 v35 v36 v50 v52))) + + (block 5 + (let (v37 u32) (cast v35)) + (let (v38 u32) (add.checked v37 4)) + (let (v39 (ptr i32)) (inttoptr v38)) + (store v39 v36) + (call # as core::ops::drop::Drop>::drop v35) + (let (v40 i32) (const.i32 16)) + (let (v41 i32) (add.wrapping v35 v40)) + (let (v42 (ptr i32)) (global.symbol #__stack_pointer)) + (store v42 v41) + (ret v43)) + ) + + (func (export #test_blake3_hash_1to1) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v2 i32) (const.i32 0)) + (let (v3 felt) (const.felt 0)) + (let (v4 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v5 i32) (const.i32 240)) + (let (v6 i32) (sub.wrapping v4 v5)) + (let (v7 (ptr i32)) (global.symbol #__stack_pointer)) + (store v7 v6) + (let (v8 i32) (const.i32 0)) + (let (v9 i64) (const.i64 0)) + (let (v10 felt) (cast v9)) + (br (block 2 v8 v6 v1 v0 v10))) + + (block 1) + + (block 2 + (param v11 i32) + (param v155 i32) + (param v156 i32) + (param v159 i32) + (param v205 felt) + (let (v12 i32) (const.i32 64)) + (let (v13 i1) (neq v11 v12)) + (let (v14 i32) (cast v13)) + (let (v15 i1) (neq v14 0)) + (condbr v15 (block 4) (block 5))) + + (block 3) + + (block 4 + (let (v202 i32) (const.i32 8)) + (let (v203 i32) (add.wrapping v155 v202)) + (let (v204 i32) (add.wrapping v203 v11)) + (let (v206 u32) (cast v204)) + (let (v207 (ptr felt)) (inttoptr v206)) + (store v207 v205) + (let (v208 i32) (const.i32 8)) + (let (v209 i32) (add.wrapping v11 v208)) + (br (block 2 v209 v155 v156 v159 v205))) + + (block 5 + (let (v16 i32) (const.i32 0)) + (br (block 7 v16 v155 v156 v159))) + + (block 6 + (let (v160 u32) (cast v119)) + (let (v161 u32) (add.checked v160 200)) + (let (v162 (ptr i64)) (inttoptr v161)) + (let (v163 i64) (load v162)) + (let (v164 u32) (cast v157)) + (let (v165 (ptr i64)) (inttoptr v164)) + (store v165 v163) + (let (v166 i32) (const.i32 24)) + (let (v167 i32) (add.wrapping v157 v166)) + (let (v168 i32) (const.i32 200)) + (let (v169 i32) (add.wrapping v119 v168)) + (let (v170 i32) (const.i32 24)) + (let (v171 i32) (add.wrapping v169 v170)) + (let (v172 u32) (cast v171)) + (let (v173 (ptr i64)) (inttoptr v172)) + (let (v174 i64) (load v173)) + (let (v175 u32) (cast v167)) + (let (v176 (ptr i64)) (inttoptr v175)) + (store v176 v174) + (let (v177 i32) (const.i32 16)) + (let (v178 i32) (add.wrapping v157 v177)) + (let (v179 i32) (const.i32 200)) + (let (v180 i32) (add.wrapping v119 v179)) + (let (v181 i32) (const.i32 16)) + (let (v182 i32) (add.wrapping v180 v181)) + (let (v183 u32) (cast v182)) + (let (v184 (ptr i64)) (inttoptr v183)) + (let (v185 i64) (load v184)) + (let (v186 u32) (cast v178)) + (let (v187 (ptr i64)) (inttoptr v186)) + (store v187 v185) + (let (v188 i32) (const.i32 8)) + (let (v189 i32) (add.wrapping v157 v188)) + (let (v190 i32) (const.i32 200)) + (let (v191 i32) (add.wrapping v119 v190)) + (let (v192 i32) (const.i32 8)) + (let (v193 i32) (add.wrapping v191 v192)) + (let (v194 u32) (cast v193)) + (let (v195 (ptr i64)) (inttoptr v194)) + (let (v196 i64) (load v195)) + (let (v197 u32) (cast v189)) + (let (v198 (ptr i64)) (inttoptr v197)) + (store v198 v196) + (let (v199 i32) (const.i32 240)) + (let (v200 i32) (add.wrapping v119 v199)) + (let (v201 (ptr i32)) (global.symbol #__stack_pointer)) + (store v201 v200) + (ret)) + + (block 7 + (param v17 i32) + (param v22 i32) + (param v143 i32) + (param v158 i32) + (let (v18 i32) (const.i32 64)) + (let (v19 i1) (neq v17 v18)) + (let (v20 i32) (cast v19)) + (let (v21 i1) (neq v20 0)) + (condbr v21 (block 9) (block 10))) + + (block 8) + + (block 9 + (let (v140 i32) (const.i32 8)) + (let (v141 i32) (add.wrapping v22 v140)) + (let (v142 i32) (add.wrapping v141 v17)) + (let (v144 u32) (cast v143)) + (let (v145 (ptr u32)) (inttoptr v144)) + (let (v146 u32) (load v145)) + (let (v147 i64) (zext v146)) + (let (v148 felt) (cast v147)) + (let (v149 u32) (cast v142)) + (let (v150 (ptr felt)) (inttoptr v149)) + (store v150 v148) + (let (v151 i32) (const.i32 8)) + (let (v152 i32) (add.wrapping v17 v151)) + (let (v153 i32) (const.i32 4)) + (let (v154 i32) (add.wrapping v143 v153)) + (br (block 7 v152 v22 v154 v158))) + + (block 10 + (let (v23 u32) (cast v22)) + (let (v24 u32) (add.checked v23 8)) + (let (v25 (ptr felt)) (inttoptr v24)) + (let (v26 felt) (load v25)) + (let (v27 u32) (cast v22)) + (let (v28 u32) (add.checked v27 16)) + (let (v29 (ptr felt)) (inttoptr v28)) + (let (v30 felt) (load v29)) + (let (v31 u32) (cast v22)) + (let (v32 u32) (add.checked v31 24)) + (let (v33 (ptr felt)) (inttoptr v32)) + (let (v34 felt) (load v33)) + (let (v35 u32) (cast v22)) + (let (v36 u32) (add.checked v35 32)) + (let (v37 (ptr felt)) (inttoptr v36)) + (let (v38 felt) (load v37)) + (let (v39 u32) (cast v22)) + (let (v40 u32) (add.checked v39 40)) + (let (v41 (ptr felt)) (inttoptr v40)) + (let (v42 felt) (load v41)) + (let (v43 u32) (cast v22)) + (let (v44 u32) (add.checked v43 48)) + (let (v45 (ptr felt)) (inttoptr v44)) + (let (v46 felt) (load v45)) + (let (v47 u32) (cast v22)) + (let (v48 u32) (add.checked v47 56)) + (let (v49 (ptr felt)) (inttoptr v48)) + (let (v50 felt) (load v49)) + (let (v51 u32) (cast v22)) + (let (v52 u32) (add.checked v51 64)) + (let (v53 (ptr felt)) (inttoptr v52)) + (let (v54 felt) (load v53)) + (let (v55 i32) (const.i32 72)) + (let (v56 i32) (add.wrapping v22 v55)) + (let [(v57 felt) (v58 felt) (v59 felt) (v60 felt) (v61 felt) (v62 felt) (v63 felt) (v64 felt)] (call (#std::crypto_hashes #blake3_hash_1to1) v26 v30 v34 v38 v42 v46 v50 v54)) + (let (v65 u32) (cast v56)) + (let (v66 (ptr felt)) (inttoptr v65)) + (store v66 v57) + (let (v67 u32) (add.checked v65 8)) + (let (v68 (ptr felt)) (inttoptr v67)) + (store v68 v58) + (let (v69 u32) (add.checked v65 16)) + (let (v70 (ptr felt)) (inttoptr v69)) + (store v70 v59) + (let (v71 u32) (add.checked v65 24)) + (let (v72 (ptr felt)) (inttoptr v71)) + (store v72 v60) + (let (v73 u32) (add.checked v65 32)) + (let (v74 (ptr felt)) (inttoptr v73)) + (store v74 v61) + (let (v75 u32) (add.checked v65 40)) + (let (v76 (ptr felt)) (inttoptr v75)) + (store v76 v62) + (let (v77 u32) (add.checked v65 48)) + (let (v78 (ptr felt)) (inttoptr v77)) + (store v78 v63) + (let (v79 u32) (add.checked v65 56)) + (let (v80 (ptr felt)) (inttoptr v79)) + (store v80 v64) + (let (v81 i32) (const.i32 136)) + (let (v82 i32) (add.wrapping v22 v81)) + (let (v83 i32) (const.i32 72)) + (let (v84 i32) (add.wrapping v22 v83)) + (let (v85 i32) (const.i32 64)) + (let (v86 u32) (cast v82)) + (let (v87 (ptr u8)) (inttoptr v86)) + (let (v88 u32) (cast v84)) + (let (v89 (ptr u8)) (inttoptr v88)) + (memcpy v89 v87 v85) + (let (v90 i32) (const.i32 224)) + (let (v91 i32) (add.wrapping v22 v90)) + (let (v92 i64) (const.i64 0)) + (let (v93 u32) (cast v91)) + (let (v94 (ptr i64)) (inttoptr v93)) + (store v94 v92) + (let (v95 i32) (const.i32 216)) + (let (v96 i32) (add.wrapping v22 v95)) + (let (v97 i64) (const.i64 0)) + (let (v98 u32) (cast v96)) + (let (v99 (ptr i64)) (inttoptr v98)) + (store v99 v97) + (let (v100 i32) (const.i32 200)) + (let (v101 i32) (add.wrapping v22 v100)) + (let (v102 i32) (const.i32 8)) + (let (v103 i32) (add.wrapping v101 v102)) + (let (v104 i64) (const.i64 0)) + (let (v105 u32) (cast v103)) + (let (v106 (ptr i64)) (inttoptr v105)) + (store v106 v104) + (let (v107 i64) (const.i64 0)) + (let (v108 u32) (cast v22)) + (let (v109 u32) (add.checked v108 200)) + (let (v110 (ptr i64)) (inttoptr v109)) + (store v110 v107) + (let (v111 i32) (const.i32 136)) + (let (v112 i32) (add.wrapping v22 v111)) + (let (v113 i32) (const.i32 0)) + (br (block 11 v113 v22 v112 v158))) + + (block 11 + (param v114 i32) + (param v119 i32) + (param v120 i32) + (param v157 i32) + (let (v115 i32) (const.i32 32)) + (let (v116 i1) (eq v114 v115)) + (let (v117 i32) (cast v116)) + (let (v118 i1) (neq v117 0)) + (condbr v118 (block 6) (block 13))) + + (block 12) + + (block 13 + (let (v121 u32) (cast v120)) + (let (v122 (ptr felt)) (inttoptr v121)) + (let (v123 felt) (load v122)) + (let (v124 i64) (cast v123)) + (let (v125 u32) (cast v119)) + (let (v126 u32) (add.checked v125 232)) + (let (v127 (ptr i64)) (inttoptr v126)) + (store v127 v124) + (let (v128 i32) (const.i32 200)) + (let (v129 i32) (add.wrapping v119 v128)) + (let (v130 i32) (add.wrapping v129 v114)) + (let (v131 i32) (const.i32 4)) + (let (v132 i32) (const.i32 232)) + (let (v133 i32) (add.wrapping v119 v132)) + (let (v134 i32) (const.i32 4)) + (let (v135 i32) (const.i32 1048620)) + (call #core::slice::::copy_from_slice v130 v131 v133 v134 v135) + (let (v136 i32) (const.i32 4)) + (let (v137 i32) (add.wrapping v114 v136)) + (let (v138 i32) (const.i32 8)) + (let (v139 i32) (add.wrapping v120 v138)) + (br (block 11 v137 v119 v139 v157))) + ) + + (func (export #test_blake3_hash_2to1) + (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (let (v3 i32) (const.i32 0)) + (let (v4 felt) (const.felt 0)) + (let (v5 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v6 i32) (const.i32 432)) + (let (v7 i32) (sub.wrapping v5 v6)) (let (v8 (ptr i32)) (global.symbol #__stack_pointer)) (store v8 v7) + (let (v9 i32) (const.i32 0)) + (let (v10 i64) (const.i64 0)) + (let (v11 felt) (cast v10)) + (br (block 2 v9 v7 v2 v0 v1 v11))) + + (block 1) + + (block 2 + (param v12 i32) + (param v275 i32) + (param v276 i32) + (param v277 i32) + (param v278 i32) + (param v282 felt) + (let (v13 i32) (const.i32 64)) + (let (v14 i1) (neq v12 v13)) + (let (v15 i32) (cast v14)) + (let (v16 i1) (neq v15 0)) + (condbr v16 (block 4) (block 5))) + + (block 3) + + (block 4 + (let (v279 i32) (const.i32 8)) + (let (v280 i32) (add.wrapping v275 v279)) + (let (v281 i32) (add.wrapping v280 v12)) + (let (v283 u32) (cast v281)) + (let (v284 (ptr felt)) (inttoptr v283)) + (store v284 v282) + (let (v285 i32) (const.i32 8)) + (let (v286 i32) (add.wrapping v12 v285)) + (br (block 2 v286 v275 v276 v277 v278 v282))) + + (block 5 + (let (v17 i32) (const.i32 0)) + (br (block 6 v17 v275 v276 v277 v278))) + + (block 6 + (param v18 i32) + (param v257 i32) + (param v258 i32) + (param v259 i32) + (param v263 i32) + (let (v19 i32) (const.i32 64)) + (let (v20 i1) (neq v18 v19)) + (let (v21 i32) (cast v20)) + (let (v22 i1) (neq v21 0)) + (condbr v22 (block 8) (block 9))) + + (block 7) + + (block 8 + (let (v260 i32) (const.i32 8)) + (let (v261 i32) (add.wrapping v257 v260)) + (let (v262 i32) (add.wrapping v261 v18)) + (let (v264 u32) (cast v263)) + (let (v265 (ptr u32)) (inttoptr v264)) + (let (v266 u32) (load v265)) + (let (v267 i64) (zext v266)) + (let (v268 felt) (cast v267)) + (let (v269 u32) (cast v262)) + (let (v270 (ptr felt)) (inttoptr v269)) + (store v270 v268) + (let (v271 i32) (const.i32 8)) + (let (v272 i32) (add.wrapping v18 v271)) + (let (v273 i32) (const.i32 4)) + (let (v274 i32) (add.wrapping v263 v273)) + (br (block 6 v272 v257 v258 v259 v274))) + + (block 9 + (let (v23 i32) (const.i32 0)) + (let (v24 i64) (const.i64 0)) + (let (v25 felt) (cast v24)) + (br (block 10 v23 v257 v258 v259 v25))) + + (block 10 + (param v26 i32) + (param v202 i32) + (param v203 i32) + (param v206 i32) + (param v252 felt) + (let (v27 i32) (const.i32 64)) + (let (v28 i1) (neq v26 v27)) + (let (v29 i32) (cast v28)) + (let (v30 i1) (neq v29 0)) + (condbr v30 (block 12) (block 13))) + + (block 11) + + (block 12 + (let (v249 i32) (const.i32 72)) + (let (v250 i32) (add.wrapping v202 v249)) + (let (v251 i32) (add.wrapping v250 v26)) + (let (v253 u32) (cast v251)) + (let (v254 (ptr felt)) (inttoptr v253)) + (store v254 v252) + (let (v255 i32) (const.i32 8)) + (let (v256 i32) (add.wrapping v26 v255)) + (br (block 10 v256 v202 v203 v206 v252))) + + (block 13 + (let (v31 i32) (const.i32 0)) + (br (block 15 v31 v202 v203 v206))) + + (block 14 + (let (v207 u32) (cast v166)) + (let (v208 u32) (add.checked v207 392)) + (let (v209 (ptr i64)) (inttoptr v208)) + (let (v210 i64) (load v209)) + (let (v211 u32) (cast v204)) + (let (v212 (ptr i64)) (inttoptr v211)) + (store v212 v210) + (let (v213 i32) (const.i32 24)) + (let (v214 i32) (add.wrapping v204 v213)) + (let (v215 i32) (const.i32 392)) + (let (v216 i32) (add.wrapping v166 v215)) + (let (v217 i32) (const.i32 24)) + (let (v218 i32) (add.wrapping v216 v217)) + (let (v219 u32) (cast v218)) + (let (v220 (ptr i64)) (inttoptr v219)) + (let (v221 i64) (load v220)) + (let (v222 u32) (cast v214)) + (let (v223 (ptr i64)) (inttoptr v222)) + (store v223 v221) + (let (v224 i32) (const.i32 16)) + (let (v225 i32) (add.wrapping v204 v224)) + (let (v226 i32) (const.i32 392)) + (let (v227 i32) (add.wrapping v166 v226)) + (let (v228 i32) (const.i32 16)) + (let (v229 i32) (add.wrapping v227 v228)) + (let (v230 u32) (cast v229)) + (let (v231 (ptr i64)) (inttoptr v230)) + (let (v232 i64) (load v231)) + (let (v233 u32) (cast v225)) + (let (v234 (ptr i64)) (inttoptr v233)) + (store v234 v232) + (let (v235 i32) (const.i32 8)) + (let (v236 i32) (add.wrapping v204 v235)) + (let (v237 i32) (const.i32 392)) + (let (v238 i32) (add.wrapping v166 v237)) + (let (v239 i32) (const.i32 8)) + (let (v240 i32) (add.wrapping v238 v239)) + (let (v241 u32) (cast v240)) + (let (v242 (ptr i64)) (inttoptr v241)) + (let (v243 i64) (load v242)) + (let (v244 u32) (cast v236)) + (let (v245 (ptr i64)) (inttoptr v244)) + (store v245 v243) + (let (v246 i32) (const.i32 432)) + (let (v247 i32) (add.wrapping v166 v246)) + (let (v248 (ptr i32)) (global.symbol #__stack_pointer)) + (store v248 v247) + (ret)) + + (block 15 + (param v32 i32) + (param v37 i32) + (param v190 i32) + (param v205 i32) + (let (v33 i32) (const.i32 64)) + (let (v34 i1) (neq v32 v33)) + (let (v35 i32) (cast v34)) + (let (v36 i1) (neq v35 0)) + (condbr v36 (block 17) (block 18))) + + (block 16) + + (block 17 + (let (v187 i32) (const.i32 72)) + (let (v188 i32) (add.wrapping v37 v187)) + (let (v189 i32) (add.wrapping v188 v32)) + (let (v191 u32) (cast v190)) + (let (v192 (ptr u32)) (inttoptr v191)) + (let (v193 u32) (load v192)) + (let (v194 i64) (zext v193)) + (let (v195 felt) (cast v194)) + (let (v196 u32) (cast v189)) + (let (v197 (ptr felt)) (inttoptr v196)) + (store v197 v195) + (let (v198 i32) (const.i32 8)) + (let (v199 i32) (add.wrapping v32 v198)) + (let (v200 i32) (const.i32 4)) + (let (v201 i32) (add.wrapping v190 v200)) + (br (block 15 v199 v37 v201 v205))) + + (block 18 + (let (v38 u32) (cast v37)) + (let (v39 u32) (add.checked v38 8)) + (let (v40 (ptr felt)) (inttoptr v39)) + (let (v41 felt) (load v40)) + (let (v42 u32) (cast v37)) + (let (v43 u32) (add.checked v42 16)) + (let (v44 (ptr felt)) (inttoptr v43)) + (let (v45 felt) (load v44)) + (let (v46 u32) (cast v37)) + (let (v47 u32) (add.checked v46 24)) + (let (v48 (ptr felt)) (inttoptr v47)) + (let (v49 felt) (load v48)) + (let (v50 u32) (cast v37)) + (let (v51 u32) (add.checked v50 32)) + (let (v52 (ptr felt)) (inttoptr v51)) + (let (v53 felt) (load v52)) + (let (v54 u32) (cast v37)) + (let (v55 u32) (add.checked v54 40)) + (let (v56 (ptr felt)) (inttoptr v55)) + (let (v57 felt) (load v56)) + (let (v58 u32) (cast v37)) + (let (v59 u32) (add.checked v58 48)) + (let (v60 (ptr felt)) (inttoptr v59)) + (let (v61 felt) (load v60)) + (let (v62 u32) (cast v37)) + (let (v63 u32) (add.checked v62 56)) + (let (v64 (ptr felt)) (inttoptr v63)) + (let (v65 felt) (load v64)) + (let (v66 u32) (cast v37)) + (let (v67 u32) (add.checked v66 64)) + (let (v68 (ptr felt)) (inttoptr v67)) + (let (v69 felt) (load v68)) + (let (v70 u32) (cast v37)) + (let (v71 u32) (add.checked v70 72)) + (let (v72 (ptr felt)) (inttoptr v71)) + (let (v73 felt) (load v72)) + (let (v74 u32) (cast v37)) + (let (v75 u32) (add.checked v74 80)) + (let (v76 (ptr felt)) (inttoptr v75)) + (let (v77 felt) (load v76)) + (let (v78 u32) (cast v37)) + (let (v79 u32) (add.checked v78 88)) + (let (v80 (ptr felt)) (inttoptr v79)) + (let (v81 felt) (load v80)) + (let (v82 u32) (cast v37)) + (let (v83 u32) (add.checked v82 96)) + (let (v84 (ptr felt)) (inttoptr v83)) + (let (v85 felt) (load v84)) + (let (v86 u32) (cast v37)) + (let (v87 u32) (add.checked v86 104)) + (let (v88 (ptr felt)) (inttoptr v87)) + (let (v89 felt) (load v88)) + (let (v90 u32) (cast v37)) + (let (v91 u32) (add.checked v90 112)) + (let (v92 (ptr felt)) (inttoptr v91)) + (let (v93 felt) (load v92)) + (let (v94 u32) (cast v37)) + (let (v95 u32) (add.checked v94 120)) + (let (v96 (ptr felt)) (inttoptr v95)) + (let (v97 felt) (load v96)) + (let (v98 u32) (cast v37)) + (let (v99 u32) (add.checked v98 128)) + (let (v100 (ptr felt)) (inttoptr v99)) + (let (v101 felt) (load v100)) + (let (v102 i32) (const.i32 136)) + (let (v103 i32) (add.wrapping v37 v102)) + (let [(v104 felt) (v105 felt) (v106 felt) (v107 felt) (v108 felt) (v109 felt) (v110 felt) (v111 felt)] (call (#std::crypto_hashes #blake3_hash_2to1) v41 v45 v49 v53 v57 v61 v65 v69 v73 v77 v81 v85 v89 v93 v97 v101)) + (let (v112 u32) (cast v103)) + (let (v113 (ptr felt)) (inttoptr v112)) + (store v113 v104) + (let (v114 u32) (add.checked v112 8)) + (let (v115 (ptr felt)) (inttoptr v114)) + (store v115 v105) + (let (v116 u32) (add.checked v112 16)) + (let (v117 (ptr felt)) (inttoptr v116)) + (store v117 v106) + (let (v118 u32) (add.checked v112 24)) + (let (v119 (ptr felt)) (inttoptr v118)) + (store v119 v107) + (let (v120 u32) (add.checked v112 32)) + (let (v121 (ptr felt)) (inttoptr v120)) + (store v121 v108) + (let (v122 u32) (add.checked v112 40)) + (let (v123 (ptr felt)) (inttoptr v122)) + (store v123 v109) + (let (v124 u32) (add.checked v112 48)) + (let (v125 (ptr felt)) (inttoptr v124)) + (store v125 v110) + (let (v126 u32) (add.checked v112 56)) + (let (v127 (ptr felt)) (inttoptr v126)) + (store v127 v111) + (let (v128 i32) (const.i32 264)) + (let (v129 i32) (add.wrapping v37 v128)) + (let (v130 i32) (const.i32 136)) + (let (v131 i32) (add.wrapping v37 v130)) + (let (v132 i32) (const.i32 128)) + (let (v133 u32) (cast v129)) + (let (v134 (ptr u8)) (inttoptr v133)) + (let (v135 u32) (cast v131)) + (let (v136 (ptr u8)) (inttoptr v135)) + (memcpy v136 v134 v132) + (let (v137 i32) (const.i32 416)) + (let (v138 i32) (add.wrapping v37 v137)) + (let (v139 i64) (const.i64 0)) + (let (v140 u32) (cast v138)) + (let (v141 (ptr i64)) (inttoptr v140)) + (store v141 v139) + (let (v142 i32) (const.i32 408)) + (let (v143 i32) (add.wrapping v37 v142)) + (let (v144 i64) (const.i64 0)) + (let (v145 u32) (cast v143)) + (let (v146 (ptr i64)) (inttoptr v145)) + (store v146 v144) + (let (v147 i32) (const.i32 392)) + (let (v148 i32) (add.wrapping v37 v147)) + (let (v149 i32) (const.i32 8)) + (let (v150 i32) (add.wrapping v148 v149)) + (let (v151 i64) (const.i64 0)) + (let (v152 u32) (cast v150)) + (let (v153 (ptr i64)) (inttoptr v152)) + (store v153 v151) + (let (v154 i64) (const.i64 0)) + (let (v155 u32) (cast v37)) + (let (v156 u32) (add.checked v155 392)) + (let (v157 (ptr i64)) (inttoptr v156)) + (store v157 v154) + (let (v158 i32) (const.i32 264)) + (let (v159 i32) (add.wrapping v37 v158)) + (let (v160 i32) (const.i32 0)) + (br (block 19 v160 v37 v159 v205))) + + (block 19 + (param v161 i32) + (param v166 i32) + (param v167 i32) + (param v204 i32) + (let (v162 i32) (const.i32 32)) + (let (v163 i1) (eq v161 v162)) + (let (v164 i32) (cast v163)) + (let (v165 i1) (neq v164 0)) + (condbr v165 (block 14) (block 21))) + + (block 20) + + (block 21 + (let (v168 u32) (cast v167)) + (let (v169 (ptr felt)) (inttoptr v168)) + (let (v170 felt) (load v169)) + (let (v171 i64) (cast v170)) + (let (v172 u32) (cast v166)) + (let (v173 u32) (add.checked v172 424)) + (let (v174 (ptr i64)) (inttoptr v173)) + (store v174 v171) + (let (v175 i32) (const.i32 392)) + (let (v176 i32) (add.wrapping v166 v175)) + (let (v177 i32) (add.wrapping v176 v161)) + (let (v178 i32) (const.i32 4)) + (let (v179 i32) (const.i32 424)) + (let (v180 i32) (add.wrapping v166 v179)) + (let (v181 i32) (const.i32 4)) + (let (v182 i32) (const.i32 1048636)) + (call #core::slice::::copy_from_slice v177 v178 v180 v181 v182) + (let (v183 i32) (const.i32 4)) + (let (v184 i32) (add.wrapping v161 v183)) + (let (v185 i32) (const.i32 8)) + (let (v186 i32) (add.wrapping v167 v185)) + (br (block 19 v184 v166 v186 v204))) + ) + + (func (export #test_rpo_falcon512_verify) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v2 u32) (cast v0)) + (let (v3 (ptr felt)) (inttoptr v2)) + (let (v4 felt) (load v3)) + (let (v5 u32) (cast v0)) + (let (v6 u32) (add.checked v5 8)) + (let (v7 (ptr felt)) (inttoptr v6)) + (let (v8 felt) (load v7)) + (let (v9 u32) (cast v0)) + (let (v10 u32) (add.checked v9 16)) + (let (v11 (ptr felt)) (inttoptr v10)) + (let (v12 felt) (load v11)) + (let (v13 u32) (cast v0)) + (let (v14 u32) (add.checked v13 24)) + (let (v15 (ptr felt)) (inttoptr v14)) + (let (v16 felt) (load v15)) + (let (v17 u32) (cast v1)) + (let (v18 (ptr felt)) (inttoptr v17)) + (let (v19 felt) (load v18)) + (let (v20 u32) (cast v1)) + (let (v21 u32) (add.checked v20 8)) + (let (v22 (ptr felt)) (inttoptr v21)) + (let (v23 felt) (load v22)) + (let (v24 u32) (cast v1)) + (let (v25 u32) (add.checked v24 16)) + (let (v26 (ptr felt)) (inttoptr v25)) + (let (v27 felt) (load v26)) + (let (v28 u32) (cast v1)) + (let (v29 u32) (add.checked v28 24)) + (let (v30 (ptr felt)) (inttoptr v29)) + (let (v31 felt) (load v30)) + (call (#miden:prelude/std_crypto_dsa #rpo_falcon512_verify) v4 v8 v12 v16 v19 v23 v27 v31) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_pipe_words_to_memory) (param i32) (param felt) + (block 0 (param v0 i32) (param v1 felt) + (call #miden_prelude::stdlib::mem::pipe_words_to_memory v0 v1) (br (block 1))) (block 1 (ret)) ) - (func (export #send_asset) - (param i32) (param felt) (param felt) (param i32) + (func (export #test_pipe_double_words_to_memory) + (param i32) (param felt) + (block 0 (param v0 i32) (param v1 felt) + (call #miden_prelude::stdlib::mem::pipe_double_words_to_memory v0 v1) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_remove_asset) (param i32) (result felt) + (block 0 (param v0 i32) + (let (v2 i32) (const.i32 0)) + (let (v3 felt) (const.felt 0)) + (let (v4 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v5 i32) (const.i32 32)) + (let (v6 i32) (sub.wrapping v4 v5)) + (let (v7 (ptr i32)) (global.symbol #__stack_pointer)) + (store v7 v6) + (call #miden_sdk_tx_kernel::remove_asset v6 v0) + (let (v8 u32) (cast v6)) + (let (v9 (ptr felt)) (inttoptr v8)) + (let (v10 felt) (load v9)) + (let (v11 i32) (const.i32 32)) + (let (v12 i32) (add.wrapping v6 v11)) + (let (v13 (ptr i32)) (global.symbol #__stack_pointer)) + (store v13 v12) + (br (block 1 v10))) + + (block 1 (param v1 felt) + (ret v1)) + ) + + (func (export #test_create_note) + (param i32) (param felt) (param felt) (param i32) (result felt) (block 0 (param v0 i32) (param v1 felt) (param v2 felt) (param v3 i32) + (let (v5 felt) (call #miden_sdk_tx_kernel::create_note v0 v1 v2 v3)) + (br (block 1 v5))) + + (block 1 (param v4 felt) + (ret v4)) + ) + + (func (export #__rust_alloc) (param i32) (param i32) (result i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v3 i32) (const.i32 1048652)) + (let (v4 i32) (call #::alloc v3 v1 v0)) + (br (block 1 v4))) + + (block 1 (param v2 i32) + (ret v2)) + ) + + (func (export #__rust_alloc_zeroed) (param i32) (param i32) (result i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v3 i32) (const.i32 1048652)) + (let (v4 i32) (call #core::alloc::global::GlobalAlloc::alloc_zeroed v3 v1 v0)) + (br (block 1 v4))) + + (block 1 (param v2 i32) + (ret v2)) + ) + + (func (export #wee_alloc::neighbors::Neighbors::remove) + (param i32) + (block 0 (param v0 i32) + (let (v1 i32) (const.i32 0)) + (let (v2 u32) (cast v0)) + (let (v3 (ptr i32)) (inttoptr v2)) + (let (v4 i32) (load v3)) + (let (v5 i32) (const.i32 2)) + (let (v6 i32) (band v4 v5)) + (let (v7 i1) (neq v6 0)) + (condbr v7 (block 2 v0 v4) (block 3))) + + (block 1 + (ret)) + + (block 2 (param v32 i32) (param v47 i32) + (let (v33 u32) (cast v32)) + (let (v34 u32) (add.checked v33 4)) + (let (v35 (ptr i32)) (inttoptr v34)) + (let (v36 i32) (load v35)) + (let (v37 i32) (const.i32 -4)) + (let (v38 i32) (band v36 v37)) + (let (v39 i1) (eq v38 0)) + (let (v40 i32) (cast v39)) + (let (v41 i1) (neq v40 0)) + (condbr v41 (block 5 v32 v36 v47) (block 6))) + + (block 3 + (let (v8 i32) (const.i32 -4)) + (let (v9 i32) (band v4 v8)) + (let (v10 i1) (eq v9 0)) + (let (v11 i32) (cast v10)) + (let (v12 i1) (neq v11 0)) + (condbr v12 (block 2 v0 v4) (block 4))) + + (block 4 + (let (v13 u32) (cast v9)) + (let (v14 u32) (add.checked v13 4)) + (let (v15 (ptr i32)) (inttoptr v14)) + (let (v16 i32) (load v15)) + (let (v17 i32) (const.i32 3)) + (let (v18 i32) (band v16 v17)) + (let (v19 u32) (cast v0)) + (let (v20 u32) (add.checked v19 4)) + (let (v21 (ptr i32)) (inttoptr v20)) + (let (v22 i32) (load v21)) + (let (v23 i32) (const.i32 -4)) + (let (v24 i32) (band v22 v23)) + (let (v25 i32) (bor v18 v24)) + (let (v26 u32) (cast v9)) + (let (v27 u32) (add.checked v26 4)) + (let (v28 (ptr i32)) (inttoptr v27)) + (store v28 v25) + (let (v29 u32) (cast v0)) + (let (v30 (ptr i32)) (inttoptr v29)) + (let (v31 i32) (load v30)) + (br (block 2 v0 v31))) + + (block 5 (param v60 i32) (param v61 i32) (param v67 i32) + (let (v62 i32) (const.i32 3)) + (let (v63 i32) (band v61 v62)) + (let (v64 u32) (cast v60)) + (let (v65 u32) (add.checked v64 4)) + (let (v66 (ptr i32)) (inttoptr v65)) + (store v66 v63) + (let (v68 i32) (const.i32 3)) + (let (v69 i32) (band v67 v68)) + (let (v70 u32) (cast v60)) + (let (v71 (ptr i32)) (inttoptr v70)) + (store v71 v69) + (br (block 1))) + + (block 6 + (let (v42 u32) (cast v38)) + (let (v43 (ptr i32)) (inttoptr v42)) + (let (v44 i32) (load v43)) + (let (v45 i32) (const.i32 3)) + (let (v46 i32) (band v44 v45)) + (let (v48 i32) (const.i32 -4)) + (let (v49 i32) (band v47 v48)) + (let (v50 i32) (bor v46 v49)) + (let (v51 u32) (cast v38)) + (let (v52 (ptr i32)) (inttoptr v51)) + (store v52 v50) + (let (v53 u32) (cast v32)) + (let (v54 u32) (add.checked v53 4)) + (let (v55 (ptr i32)) (inttoptr v54)) + (let (v56 i32) (load v55)) + (let (v57 u32) (cast v32)) + (let (v58 (ptr i32)) (inttoptr v57)) + (let (v59 i32) (load v58)) + (br (block 5 v32 v56 v59))) + ) + + (func (export #::new_cell_for_free_list) + (param i32) (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) + (let (v4 i32) (const.i32 2)) + (let (v5 i32) (shl.wrapping v2 v4)) + (let (v6 i32) (const.i32 3)) + (let (v7 i32) (shl.wrapping v3 v6)) + (let (v8 i32) (const.i32 512)) + (let (v9 i32) (add.wrapping v7 v8)) + (let (v10 u32) (cast v5)) + (let (v11 u32) (cast v9)) + (let (v12 i1) (gt v10 v11)) + (let (v13 i32) (cast v12)) + (let (v14 i1) (neq v13 0)) + (let (v15 i32) (select v14 v5 v9)) + (let (v16 i32) (const.i32 65543)) + (let (v17 i32) (add.wrapping v15 v16)) + (let (v18 i32) (const.i32 16)) + (let (v19 u32) (cast v17)) + (let (v20 u32) (cast v18)) + (let (v21 u32) (shr.wrapping v19 v20)) + (let (v22 i32) (cast v21)) + (let (v23 u32) (cast v22)) + (let (v24 i32) (memory.grow v23)) + (let (v25 i32) (const.i32 -1)) + (let (v26 i1) (neq v24 v25)) + (let (v27 i32) (cast v26)) + (let (v28 i1) (neq v27 0)) + (condbr v28 (block 3) (block 4))) + + (block 1 + (ret)) + + (block 2 (param v45 i32) (param v46 i32) (param v50 i32) + (let (v47 u32) (cast v45)) + (let (v48 u32) (add.checked v47 4)) + (let (v49 (ptr i32)) (inttoptr v48)) + (store v49 v46) + (let (v51 u32) (cast v45)) + (let (v52 (ptr i32)) (inttoptr v51)) + (store v52 v50) + (br (block 1))) + + (block 3 + (let (v31 i32) (const.i32 16)) + (let (v32 i32) (shl.wrapping v24 v31)) + (let (v33 i64) (const.i64 0)) + (let (v34 u32) (cast v32)) + (let (v35 u32) (add.checked v34 4)) + (let (v36 (ptr i64)) (inttoptr v35)) + (store v36 v33) + (let (v37 i32) (const.i32 -65536)) + (let (v38 i32) (band v17 v37)) + (let (v39 i32) (add.wrapping v32 v38)) + (let (v40 i32) (const.i32 2)) + (let (v41 i32) (bor v39 v40)) + (let (v42 u32) (cast v32)) + (let (v43 (ptr i32)) (inttoptr v42)) + (store v43 v41) + (let (v44 i32) (const.i32 0)) + (br (block 2 v0 v32 v44))) + + (block 4 + (let (v29 i32) (const.i32 1)) + (let (v30 i32) (const.i32 0)) + (br (block 2 v0 v30 v29))) + ) + + (func (export #wee_alloc::alloc_first_fit) + (param i32) (param i32) (param i32) (result i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (let (v4 i32) (const.i32 0)) + (let (v5 i32) (const.i32 -1)) + (let (v6 i32) (add.wrapping v1 v5)) + (let (v7 i32) (const.i32 0)) + (let (v8 i32) (const.i32 0)) + (let (v9 i32) (sub.wrapping v8 v1)) + (let (v10 i32) (const.i32 2)) + (let (v11 i32) (shl.wrapping v0 v10)) + (let (v12 u32) (cast v2)) + (let (v13 (ptr i32)) (inttoptr v12)) + (let (v14 i32) (load v13)) + (br (block 2 v14 v11 v9 v6 v2 v7))) + + (block 1 (param v3 i32)) + + (block 2 + (param v16 i32) + (param v181 i32) + (param v184 i32) + (param v187 i32) + (param v190 i32) + (param v209 i32) + (let (v17 i1) (eq v16 0)) + (let (v18 i32) (cast v17)) + (let (v19 i1) (neq v18 0)) + (condbr v19 (block 5 v209) (block 6))) + + (block 3 (param v15 i32)) + + (block 4 + (param v210 i32) + (param v211 i32) + (param v214 i32) + (param v215 i32) + (param v216 i32) + (param v217 i32) + (let (v212 u32) (cast v210)) + (let (v213 (ptr i32)) (inttoptr v212)) + (store v213 v211) + (br (block 2 v211 v214 v215 v216 v210 v217))) + + (block 5 (param v208 i32) + (ret v208)) + + (block 6 + (br (block 9 v16 v181 v184 v187 v190 v209))) + + (block 7 (param v200 i32) (param v201 i32) + (let (v202 i32) (const.i32 1)) + (let (v203 i32) (bor v201 v202)) + (let (v204 u32) (cast v200)) + (let (v205 (ptr i32)) (inttoptr v204)) + (store v205 v203) + (let (v206 i32) (const.i32 8)) + (let (v207 i32) (add.wrapping v200 v206)) + (br (block 5 v207))) + + (block 8 + (let (v191 i32) (const.i32 -3)) + (let (v192 i32) (band v127 v191)) + (let (v193 u32) (cast v108)) + (let (v194 (ptr i32)) (inttoptr v193)) + (store v194 v192) + (let (v195 u32) (cast v106)) + (let (v196 (ptr i32)) (inttoptr v195)) + (let (v197 i32) (load v196)) + (let (v198 i32) (const.i32 2)) + (let (v199 i32) (bor v197 v198)) + (br (block 7 v106 v199))) + + (block 9 + (param v20 i32) + (param v36 i32) + (param v45 i32) + (param v52 i32) + (param v55 i32) + (param v218 i32) + (let (v21 u32) (cast v20)) + (let (v22 u32) (add.checked v21 8)) + (let (v23 (ptr i32)) (inttoptr v22)) + (let (v24 i32) (load v23)) + (let (v25 i32) (const.i32 1)) + (let (v26 i32) (band v24 v25)) + (let (v27 i1) (neq v26 0)) + (condbr v27 (block 11) (block 12))) + + (block 10) + + (block 11 + (let (v136 i32) (const.i32 -2)) + (let (v137 i32) (band v24 v136)) + (let (v138 u32) (cast v20)) + (let (v139 u32) (add.checked v138 8)) + (let (v140 (ptr i32)) (inttoptr v139)) + (store v140 v137) + (let (v141 u32) (cast v20)) + (let (v142 u32) (add.checked v141 4)) + (let (v143 (ptr i32)) (inttoptr v142)) + (let (v144 i32) (load v143)) + (let (v145 i32) (const.i32 -4)) + (let (v146 i32) (band v144 v145)) + (let (v147 i1) (neq v146 0)) + (condbr v147 (block 22) (block 23))) + + (block 12 + (let (v28 u32) (cast v20)) + (let (v29 (ptr i32)) (inttoptr v28)) + (let (v30 i32) (load v29)) + (let (v31 i32) (const.i32 -4)) + (let (v32 i32) (band v30 v31)) + (let (v33 i32) (const.i32 8)) + (let (v34 i32) (add.wrapping v20 v33)) + (let (v35 i32) (sub.wrapping v32 v34)) + (let (v37 u32) (cast v35)) + (let (v38 u32) (cast v36)) + (let (v39 i1) (lt v37 v38)) + (let (v40 i32) (cast v39)) + (let (v41 i1) (neq v40 0)) + (condbr v41 (block 4 v55 v24 v36 v45 v52 v218) (block 13))) + + (block 13 + (let (v42 i32) (const.i32 72)) + (let (v43 i32) (add.wrapping v34 v42)) + (let (v44 i32) (sub.wrapping v32 v36)) + (let (v46 i32) (band v44 v45)) + (let (v47 u32) (cast v43)) + (let (v48 u32) (cast v46)) + (let (v49 i1) (lte v47 v48)) + (let (v50 i32) (cast v49)) + (let (v51 i1) (neq v50 0)) + (condbr v51 (block 14) (block 15))) + + (block 14 + (let (v63 i32) (const.i32 0)) + (let (v64 i32) (const.i32 0)) + (let (v65 u32) (cast v46)) + (let (v66 (ptr i32)) (inttoptr v65)) + (store v66 v64) + (let (v67 i32) (const.i32 -8)) + (let (v68 i32) (add.wrapping v46 v67)) + (let (v69 i64) (const.i64 0)) + (let (v70 u32) (cast v68)) + (let (v71 (ptr i64)) (inttoptr v70)) + (store v71 v69) + (let (v72 u32) (cast v20)) + (let (v73 (ptr i32)) (inttoptr v72)) + (let (v74 i32) (load v73)) + (let (v75 i32) (const.i32 -4)) + (let (v76 i32) (band v74 v75)) + (let (v77 u32) (cast v68)) + (let (v78 (ptr i32)) (inttoptr v77)) + (store v78 v76) + (let (v79 u32) (cast v20)) + (let (v80 (ptr i32)) (inttoptr v79)) + (let (v81 i32) (load v80)) + (let (v82 i32) (const.i32 2)) + (let (v83 i32) (band v81 v82)) + (let (v84 i1) (neq v83 0)) + (condbr v84 (block 17 v68 v63 v20) (block 18))) + + (block 15 + (let (v53 i32) (band v52 v34)) + (let (v54 i1) (neq v53 0)) + (condbr v54 (block 4 v55 v24 v36 v45 v52 v218) (block 16))) + + (block 16 + (let (v56 i32) (const.i32 -4)) + (let (v57 i32) (band v24 v56)) + (let (v58 u32) (cast v55)) + (let (v59 (ptr i32)) (inttoptr v58)) + (store v59 v57) + (let (v60 u32) (cast v20)) + (let (v61 (ptr i32)) (inttoptr v60)) + (let (v62 i32) (load v61)) + (br (block 7 v20 v62))) + + (block 17 (param v106 i32) (param v107 i32) (param v108 i32) + (let (v109 i32) (bor v107 v108)) + (let (v110 u32) (cast v106)) + (let (v111 u32) (add.checked v110 4)) + (let (v112 (ptr i32)) (inttoptr v111)) + (store v112 v109) + (let (v113 u32) (cast v108)) + (let (v114 u32) (add.checked v113 8)) + (let (v115 (ptr i32)) (inttoptr v114)) + (let (v116 i32) (load v115)) + (let (v117 i32) (const.i32 -2)) + (let (v118 i32) (band v116 v117)) + (let (v119 u32) (cast v108)) + (let (v120 u32) (add.checked v119 8)) + (let (v121 (ptr i32)) (inttoptr v120)) + (store v121 v118) + (let (v122 u32) (cast v108)) + (let (v123 (ptr i32)) (inttoptr v122)) + (let (v124 i32) (load v123)) + (let (v125 i32) (const.i32 3)) + (let (v126 i32) (band v124 v125)) + (let (v127 i32) (bor v126 v106)) + (let (v128 u32) (cast v108)) + (let (v129 (ptr i32)) (inttoptr v128)) + (store v129 v127) + (let (v130 i32) (const.i32 2)) + (let (v131 i32) (band v124 v130)) + (let (v132 i1) (neq v131 0)) + (condbr v132 (block 8) (block 20))) + + (block 18 + (let (v85 i32) (const.i32 -4)) + (let (v86 i32) (band v81 v85)) + (let (v87 i1) (eq v86 0)) + (let (v88 i32) (cast v87)) + (let (v89 i1) (neq v88 0)) + (condbr v89 (block 17 v68 v63 v20) (block 19))) + + (block 19 + (let (v90 u32) (cast v86)) + (let (v91 u32) (add.checked v90 4)) + (let (v92 (ptr i32)) (inttoptr v91)) + (let (v93 i32) (load v92)) + (let (v94 i32) (const.i32 3)) + (let (v95 i32) (band v93 v94)) + (let (v96 i32) (bor v95 v68)) + (let (v97 u32) (cast v86)) + (let (v98 u32) (add.checked v97 4)) + (let (v99 (ptr i32)) (inttoptr v98)) + (store v99 v96) + (let (v100 u32) (cast v68)) + (let (v101 u32) (add.checked v100 4)) + (let (v102 (ptr i32)) (inttoptr v101)) + (let (v103 i32) (load v102)) + (let (v104 i32) (const.i32 3)) + (let (v105 i32) (band v103 v104)) + (br (block 17 v68 v105 v20))) + + (block 20 + (let (v133 u32) (cast v106)) + (let (v134 (ptr i32)) (inttoptr v133)) + (let (v135 i32) (load v134)) + (br (block 7 v106 v135))) + + (block 21 + (param v158 i32) + (param v168 i32) + (param v177 i32) + (param v183 i32) + (param v186 i32) + (param v189 i32) + (param v220 i32) + (call #wee_alloc::neighbors::Neighbors::remove v158) + (let (v159 u32) (cast v158)) + (let (v160 (ptr u8)) (inttoptr v159)) + (let (v161 u8) (load v160)) + (let (v162 i32) (zext v161)) + (let (v163 i32) (const.i32 2)) + (let (v164 i32) (band v162 v163)) + (let (v165 i1) (eq v164 0)) + (let (v166 i32) (cast v165)) + (let (v167 i1) (neq v166 0)) + (condbr v167 (block 24 v177 v168 v183 v186 v189 v220) (block 25))) + + (block 22 + (let (v149 i32) (const.i32 0)) + (let (v150 u32) (cast v146)) + (let (v151 (ptr u8)) (inttoptr v150)) + (let (v152 u8) (load v151)) + (let (v153 i32) (zext v152)) + (let (v154 i32) (const.i32 1)) + (let (v155 i32) (band v153 v154)) + (let (v156 i1) (neq v155 0)) + (let (v157 i32) (select v156 v149 v146)) + (br (block 21 v20 v157 v55 v36 v45 v52 v218))) + + (block 23 + (let (v148 i32) (const.i32 0)) + (br (block 21 v20 v148 v55 v36 v45 v52 v218))) + + (block 24 + (param v176 i32) + (param v178 i32) + (param v182 i32) + (param v185 i32) + (param v188 i32) + (param v219 i32) + (let (v179 u32) (cast v176)) + (let (v180 (ptr i32)) (inttoptr v179)) + (store v180 v178) + (br (block 9 v178 v182 v185 v188 v176 v219))) + + (block 25 + (let (v169 u32) (cast v168)) + (let (v170 (ptr i32)) (inttoptr v169)) + (let (v171 i32) (load v170)) + (let (v172 i32) (const.i32 2)) + (let (v173 i32) (bor v171 v172)) + (let (v174 u32) (cast v168)) + (let (v175 (ptr i32)) (inttoptr v174)) + (store v175 v173) + (br (block 24 v177 v168 v183 v186 v189 v220))) + ) + + (func (export #::alloc) + (param i32) (param i32) (param i32) (result i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) (let (v4 i32) (const.i32 0)) (let (v5 i32) (global.load i32 (global.symbol #__stack_pointer))) - (let (v6 i32) (const.i32 32)) + (let (v6 i32) (const.i32 16)) (let (v7 i32) (sub.wrapping v5 v6)) (let (v8 (ptr i32)) (global.symbol #__stack_pointer)) (store v8 v7) - (call #miden_sdk_tx_kernel::remove_asset v7 v0) - (let (v9 felt) (call #miden_sdk_tx_kernel::create_note v7 v1 v2 v3)) - (let (v10 i32) (const.i32 32)) - (let (v11 i32) (add.wrapping v7 v10)) - (let (v12 (ptr i32)) (global.symbol #__stack_pointer)) - (store v12 v11) - (br (block 1))) + (let (v9 i32) (const.i32 1)) + (let (v10 i32) (const.i32 1)) + (let (v11 u32) (cast v1)) + (let (v12 u32) (cast v10)) + (let (v13 i1) (gt v11 v12)) + (let (v14 i32) (cast v13)) + (let (v15 i1) (neq v14 0)) + (let (v16 i32) (select v15 v1 v9)) + (let (v17 i1) (eq v2 0)) + (let (v18 i32) (cast v17)) + (let (v19 i1) (neq v18 0)) + (condbr v19 (block 2 v7 v16) (block 3))) + + (block 1 (param v3 i32) + (ret v3)) + + (block 2 (param v82 i32) (param v87 i32) + (let (v84 i32) (const.i32 16)) + (let (v85 i32) (add.wrapping v82 v84)) + (let (v86 (ptr i32)) (global.symbol #__stack_pointer)) + (store v86 v85) + (br (block 1 v87))) + + (block 3 + (let (v20 u32) (cast v0)) + (let (v21 (ptr i32)) (inttoptr v20)) + (let (v22 i32) (load v21)) + (let (v23 u32) (cast v7)) + (let (v24 u32) (add.checked v23 12)) + (let (v25 (ptr i32)) (inttoptr v24)) + (store v25 v22) + (let (v26 i32) (const.i32 3)) + (let (v27 i32) (add.wrapping v2 v26)) + (let (v28 i32) (const.i32 2)) + (let (v29 u32) (cast v27)) + (let (v30 u32) (cast v28)) + (let (v31 u32) (shr.wrapping v29 v30)) + (let (v32 i32) (cast v31)) + (let (v33 i32) (const.i32 12)) + (let (v34 i32) (add.wrapping v7 v33)) + (let (v35 i32) (call #wee_alloc::alloc_first_fit v32 v16 v34)) + (let (v36 i1) (eq v35 0)) + (let (v37 i32) (cast v36)) + (let (v38 i1) (neq v37 0)) + (condbr v38 (block 4) (block 5))) + + (block 4 + (call #::new_cell_for_free_list v7 v7 v32 v16) + (let (v45 u32) (cast v7)) + (let (v46 (ptr i32)) (inttoptr v45)) + (let (v47 i32) (load v46)) + (let (v48 i1) (eq v47 0)) + (let (v49 i32) (cast v48)) + (let (v50 i1) (neq v49 0)) + (condbr v50 (block 7) (block 8))) + + (block 5 + (let (v39 u32) (cast v7)) + (let (v40 u32) (add.checked v39 12)) + (let (v41 (ptr i32)) (inttoptr v40)) + (let (v42 i32) (load v41)) + (let (v43 u32) (cast v0)) + (let (v44 (ptr i32)) (inttoptr v43)) + (store v44 v42) + (br (block 2 v7 v35))) + + (block 6 (param v83 i32) + (let (v81 i32) (const.i32 0)) + (br (block 2 v83 v81))) + + (block 7 + (let (v57 u32) (cast v7)) + (let (v58 u32) (add.checked v57 4)) + (let (v59 (ptr i32)) (inttoptr v58)) + (let (v60 i32) (load v59)) + (let (v61 u32) (cast v7)) + (let (v62 u32) (add.checked v61 12)) + (let (v63 (ptr i32)) (inttoptr v62)) + (let (v64 i32) (load v63)) + (let (v65 u32) (cast v60)) + (let (v66 u32) (add.checked v65 8)) + (let (v67 (ptr i32)) (inttoptr v66)) + (store v67 v64) + (let (v68 u32) (cast v7)) + (let (v69 u32) (add.checked v68 12)) + (let (v70 (ptr i32)) (inttoptr v69)) + (store v70 v60) + (let (v71 i32) (const.i32 12)) + (let (v72 i32) (add.wrapping v7 v71)) + (let (v73 i32) (call #wee_alloc::alloc_first_fit v32 v16 v72)) + (let (v74 u32) (cast v7)) + (let (v75 u32) (add.checked v74 12)) + (let (v76 (ptr i32)) (inttoptr v75)) + (let (v77 i32) (load v76)) + (let (v78 u32) (cast v0)) + (let (v79 (ptr i32)) (inttoptr v78)) + (store v79 v77) + (let (v80 i1) (neq v73 0)) + (condbr v80 (block 2 v7 v73) (block 9))) + + (block 8 + (let (v51 u32) (cast v7)) + (let (v52 u32) (add.checked v51 12)) + (let (v53 (ptr i32)) (inttoptr v52)) + (let (v54 i32) (load v53)) + (let (v55 u32) (cast v0)) + (let (v56 (ptr i32)) (inttoptr v55)) + (store v56 v54) + (br (block 6 v7))) + + (block 9 + (br (block 6 v7))) + ) + + (func (export #::dealloc) + (param i32) (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) (param v3 i32) + (let (v4 i32) (const.i32 0)) + (let (v5 i1) (eq v1 0)) + (let (v6 i32) (cast v5)) + (let (v7 i1) (neq v6 0)) + (condbr v7 (block 2) (block 3))) (block 1 (ret)) + + (block 2 + (br (block 1))) + + (block 3 + (let (v8 i1) (eq v3 0)) + (let (v9 i32) (cast v8)) + (let (v10 i1) (neq v9 0)) + (condbr v10 (block 2) (block 4))) + + (block 4 + (let (v11 i32) (const.i32 0)) + (let (v12 u32) (cast v1)) + (let (v13 (ptr i32)) (inttoptr v12)) + (store v13 v11) + (let (v14 i32) (const.i32 -8)) + (let (v15 i32) (add.wrapping v1 v14)) + (let (v16 u32) (cast v15)) + (let (v17 (ptr i32)) (inttoptr v16)) + (let (v18 i32) (load v17)) + (let (v19 i32) (const.i32 -2)) + (let (v20 i32) (band v18 v19)) + (let (v21 u32) (cast v15)) + (let (v22 (ptr i32)) (inttoptr v21)) + (store v22 v20) + (let (v23 u32) (cast v0)) + (let (v24 (ptr i32)) (inttoptr v23)) + (let (v25 i32) (load v24)) + (let (v26 i32) (const.i32 4)) + (let (v27 i32) (add.wrapping v15 v26)) + (let (v28 u32) (cast v27)) + (let (v29 (ptr i32)) (inttoptr v28)) + (let (v30 i32) (load v29)) + (let (v31 i32) (const.i32 -4)) + (let (v32 i32) (band v30 v31)) + (let (v33 i1) (eq v32 0)) + (let (v34 i32) (cast v33)) + (let (v35 i1) (neq v34 0)) + (condbr v35 (block 7 v18 v1 v25 v15 v0) (block 8))) + + (block 5 (param v98 i32) (param v102 i32) + (let (v104 u32) (cast v98)) + (let (v105 (ptr i32)) (inttoptr v104)) + (store v105 v102) + (br (block 2))) + + (block 6 (param v97 i32) (param v101 i32) + (br (block 5 v101 v97))) + + (block 7 + (param v59 i32) + (param v78 i32) + (param v80 i32) + (param v91 i32) + (param v100 i32) + (let (v60 i32) (const.i32 2)) + (let (v61 i32) (band v59 v60)) + (let (v62 i1) (neq v61 0)) + (condbr v62 (block 12 v78 v80 v100 v91) (block 13))) + + (block 8 + (let (v36 u32) (cast v32)) + (let (v37 (ptr u8)) (inttoptr v36)) + (let (v38 u8) (load v37)) + (let (v39 i32) (zext v38)) + (let (v40 i32) (const.i32 1)) + (let (v41 i32) (band v39 v40)) + (let (v42 i1) (neq v41 0)) + (condbr v42 (block 7 v18 v1 v25 v15 v0) (block 9))) + + (block 9 + (call #wee_alloc::neighbors::Neighbors::remove v15) + (let (v43 u32) (cast v15)) + (let (v44 (ptr u8)) (inttoptr v43)) + (let (v45 u8) (load v44)) + (let (v46 i32) (zext v45)) + (let (v47 i32) (const.i32 2)) + (let (v48 i32) (band v46 v47)) + (let (v49 i1) (eq v48 0)) + (let (v50 i32) (cast v49)) + (let (v51 i1) (neq v50 0)) + (condbr v51 (block 6 v25 v0) (block 10))) + + (block 10 + (let (v52 u32) (cast v32)) + (let (v53 (ptr i32)) (inttoptr v52)) + (let (v54 i32) (load v53)) + (let (v55 i32) (const.i32 2)) + (let (v56 i32) (bor v54 v55)) + (let (v57 u32) (cast v32)) + (let (v58 (ptr i32)) (inttoptr v57)) + (store v58 v56) + (br (block 6 v25 v0))) + + (block 11 + (let (v83 u32) (cast v64)) + (let (v84 u32) (add.checked v83 8)) + (let (v85 (ptr i32)) (inttoptr v84)) + (let (v86 i32) (load v85)) + (let (v87 i32) (const.i32 -4)) + (let (v88 i32) (band v86 v87)) + (let (v89 u32) (cast v78)) + (let (v90 (ptr i32)) (inttoptr v89)) + (store v90 v88) + (let (v92 i32) (const.i32 1)) + (let (v93 i32) (bor v91 v92)) + (let (v94 u32) (cast v64)) + (let (v95 u32) (add.checked v94 8)) + (let (v96 (ptr i32)) (inttoptr v95)) + (store v96 v93) + (br (block 6 v80 v100))) + + (block 12 + (param v77 i32) + (param v79 i32) + (param v99 i32) + (param v103 i32) + (let (v81 u32) (cast v77)) + (let (v82 (ptr i32)) (inttoptr v81)) + (store v82 v79) + (br (block 5 v99 v103))) + + (block 13 + (let (v63 i32) (const.i32 -4)) + (let (v64 i32) (band v59 v63)) + (let (v65 i1) (eq v64 0)) + (let (v66 i32) (cast v65)) + (let (v67 i1) (neq v66 0)) + (condbr v67 (block 12 v78 v80 v100 v91) (block 14))) + + (block 14 + (let (v68 u32) (cast v64)) + (let (v69 (ptr u8)) (inttoptr v68)) + (let (v70 u8) (load v69)) + (let (v71 i32) (zext v70)) + (let (v72 i32) (const.i32 1)) + (let (v73 i32) (band v71 v72)) + (let (v74 i1) (eq v73 0)) + (let (v75 i32) (cast v74)) + (let (v76 i1) (neq v75 0)) + (condbr v76 (block 11) (block 15))) + + (block 15 + (br (block 12 v78 v80 v100 v91))) + ) + + (func (export #miden_sdk_tx_kernel::get_id) + (result felt) + (block 0 + (let (v1 felt) (call (#miden:tx_kernel/account #get_id))) + (br (block 1 v1))) + + (block 1 (param v0 felt) + (ret v0)) + ) + + (func (export #miden_sdk_tx_kernel::get_inputs) + (param i32) + (block 0 (param v0 i32) + (let (v1 i32) (const.i32 0)) + (let (v2 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v3 i32) (const.i32 16)) + (let (v4 i32) (sub.wrapping v2 v3)) + (let (v5 (ptr i32)) (global.symbol #__stack_pointer)) + (store v5 v4) + (let (v6 i32) (const.i32 4)) + (let (v7 i32) (add.wrapping v4 v6)) + (let (v8 i32) (const.i32 256)) + (let (v9 i32) (const.i32 0)) + (call #alloc::raw_vec::RawVec::try_allocate_in v7 v8 v9) + (let (v10 u32) (cast v4)) + (let (v11 u32) (add.checked v10 12)) + (let (v12 (ptr i32)) (inttoptr v11)) + (let (v13 i32) (load v12)) + (let (v14 u32) (cast v4)) + (let (v15 u32) (add.checked v14 8)) + (let (v16 (ptr i32)) (inttoptr v15)) + (let (v17 i32) (load v16)) + (let (v18 u32) (cast v4)) + (let (v19 u32) (add.checked v18 4)) + (let (v20 (ptr i32)) (inttoptr v19)) + (let (v21 i32) (load v20)) + (let (v22 i1) (eq v21 0)) + (let (v23 i32) (cast v22)) + (let (v24 i1) (neq v23 0)) + (condbr v24 (block 3) (block 4))) + + (block 1) + + (block 2 + (call #alloc::raw_vec::capacity_overflow) + (unreachable)) + + (block 3 + (let [(v28 i32) (v29 felt)] (call (#miden:tx_kernel/note #get_inputs) v13)) + (let (v30 i32) (const.i32 0)) + (let (v31 u32) (cast v0)) + (let (v32 u32) (add.checked v31 8)) + (let (v33 (ptr i32)) (inttoptr v32)) + (store v33 v30) + (let (v34 u32) (cast v0)) + (let (v35 u32) (add.checked v34 4)) + (let (v36 (ptr i32)) (inttoptr v35)) + (store v36 v13) + (let (v37 u32) (cast v0)) + (let (v38 (ptr i32)) (inttoptr v37)) + (store v38 v17) + (let (v39 i32) (const.i32 16)) + (let (v40 i32) (add.wrapping v4 v39)) + (let (v41 (ptr i32)) (global.symbol #__stack_pointer)) + (store v41 v40) + (ret)) + + (block 4 + (let (v25 i1) (eq v17 0)) + (let (v26 i32) (cast v25)) + (let (v27 i1) (neq v26 0)) + (condbr v27 (block 2) (block 5))) + + (block 5 + (call #alloc::alloc::handle_alloc_error v17 v13) + (unreachable)) ) (func (export #miden_sdk_tx_kernel::add_asset) @@ -267,13 +2158,625 @@ (ret v4)) ) + (func (export #alloc::vec::Vec::with_capacity) + (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v2 i32) (const.i32 0)) + (let (v3 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v4 i32) (const.i32 16)) + (let (v5 i32) (sub.wrapping v3 v4)) + (let (v6 (ptr i32)) (global.symbol #__stack_pointer)) + (store v6 v5) + (let (v7 i32) (const.i32 4)) + (let (v8 i32) (add.wrapping v5 v7)) + (let (v9 i32) (const.i32 0)) + (call #alloc::raw_vec::RawVec::try_allocate_in v8 v1 v9) + (let (v10 u32) (cast v5)) + (let (v11 u32) (add.checked v10 12)) + (let (v12 (ptr i32)) (inttoptr v11)) + (let (v13 i32) (load v12)) + (let (v14 u32) (cast v5)) + (let (v15 u32) (add.checked v14 8)) + (let (v16 (ptr i32)) (inttoptr v15)) + (let (v17 i32) (load v16)) + (let (v18 u32) (cast v5)) + (let (v19 u32) (add.checked v18 4)) + (let (v20 (ptr i32)) (inttoptr v19)) + (let (v21 i32) (load v20)) + (let (v22 i1) (eq v21 0)) + (let (v23 i32) (cast v22)) + (let (v24 i1) (neq v23 0)) + (condbr v24 (block 3) (block 4))) + + (block 1) + + (block 2 + (call #alloc::raw_vec::capacity_overflow) + (unreachable)) + + (block 3 + (let (v28 i32) (const.i32 0)) + (let (v29 u32) (cast v0)) + (let (v30 u32) (add.checked v29 8)) + (let (v31 (ptr i32)) (inttoptr v30)) + (store v31 v28) + (let (v32 u32) (cast v0)) + (let (v33 u32) (add.checked v32 4)) + (let (v34 (ptr i32)) (inttoptr v33)) + (store v34 v13) + (let (v35 u32) (cast v0)) + (let (v36 (ptr i32)) (inttoptr v35)) + (store v36 v17) + (let (v37 i32) (const.i32 16)) + (let (v38 i32) (add.wrapping v5 v37)) + (let (v39 (ptr i32)) (global.symbol #__stack_pointer)) + (store v39 v38) + (ret)) + + (block 4 + (let (v25 i1) (eq v17 0)) + (let (v26 i32) (cast v25)) + (let (v27 i1) (neq v26 0)) + (condbr v27 (block 2) (block 5))) + + (block 5 + (call #alloc::alloc::handle_alloc_error v17 v13) + (unreachable)) + ) + + (func (export #alloc::raw_vec::RawVec::try_allocate_in) + (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (let (v3 i32) (const.i32 0)) + (let (v4 i1) (neq v1 0)) + (condbr v4 (block 3) (block 4))) + + (block 1 + (ret)) + + (block 2 (param v55 i32) (param v57 i32) + (let (v58 u32) (cast v55)) + (let (v59 (ptr i32)) (inttoptr v58)) + (store v59 v57) + (br (block 1))) + + (block 3 + (let (v10 i32) (const.i32 268435456)) + (let (v11 u32) (cast v1)) + (let (v12 u32) (cast v10)) + (let (v13 i1) (lt v11 v12)) + (let (v14 i32) (cast v13)) + (let (v15 i1) (neq v14 0)) + (condbr v15 (block 6) (block 7))) + + (block 4 + (let (v5 i64) (const.i64 34359738368)) + (let (v6 u32) (cast v0)) + (let (v7 u32) (add.checked v6 4)) + (let (v8 (ptr i64)) (inttoptr v7)) + (store v8 v5) + (let (v9 i32) (const.i32 0)) + (br (block 2 v0 v9))) + + (block 5 (param v56 i32) + (let (v54 i32) (const.i32 1)) + (br (block 2 v56 v54))) + + (block 6 + (let (v20 i32) (const.i32 3)) + (let (v21 i32) (shl.wrapping v1 v20)) + (let (v22 i1) (neq v2 0)) + (condbr v22 (block 9) (block 10))) + + (block 7 + (let (v16 i32) (const.i32 0)) + (let (v17 u32) (cast v0)) + (let (v18 u32) (add.checked v17 4)) + (let (v19 (ptr i32)) (inttoptr v18)) + (store v19 v16) + (br (block 5 v0))) + + (block 8 + (param v33 i32) + (param v37 i32) + (param v41 i32) + (param v46 i32) + (let (v34 i1) (eq v33 0)) + (let (v35 i32) (cast v34)) + (let (v36 i1) (neq v35 0)) + (condbr v36 (block 11) (block 12))) + + (block 9 + (let (v31 i32) (const.i32 8)) + (let (v32 i32) (call #__rust_alloc_zeroed v21 v31)) + (br (block 8 v32 v0 v1 v21))) + + (block 10 + (let (v23 i32) (const.i32 0)) + (let (v24 u32) (cast v23)) + (let (v25 u32) (add.checked v24 1048656)) + (let (v26 (ptr u8)) (inttoptr v25)) + (let (v27 u8) (load v26)) + (let (v28 i32) (zext v27)) + (let (v29 i32) (const.i32 8)) + (let (v30 i32) (call #__rust_alloc v21 v29)) + (br (block 8 v30 v0 v1 v21))) + + (block 11 + (let (v47 u32) (cast v37)) + (let (v48 u32) (add.checked v47 8)) + (let (v49 (ptr i32)) (inttoptr v48)) + (store v49 v46) + (let (v50 i32) (const.i32 8)) + (let (v51 u32) (cast v37)) + (let (v52 u32) (add.checked v51 4)) + (let (v53 (ptr i32)) (inttoptr v52)) + (store v53 v50) + (br (block 5 v37))) + + (block 12 + (let (v38 u32) (cast v37)) + (let (v39 u32) (add.checked v38 8)) + (let (v40 (ptr i32)) (inttoptr v39)) + (store v40 v33) + (let (v42 u32) (cast v37)) + (let (v43 u32) (add.checked v42 4)) + (let (v44 (ptr i32)) (inttoptr v43)) + (store v44 v41) + (let (v45 i32) (const.i32 0)) + (br (block 2 v37 v45))) + ) + + (func (export #>::from) + (param i32) (result felt) + (block 0 (param v0 i32) + (let (v2 u32) (cast v0)) + (let (v3 u64) (zext v2)) + (let (v4 i64) (cast v3)) + (let (v5 felt) (cast v4)) + (br (block 1 v5))) + + (block 1 (param v1 felt) + (ret v1)) + ) + + (func (export #miden_prelude::stdlib::mem::pipe_words_to_memory) + (param i32) (param felt) + (block 0 (param v0 i32) (param v1 felt) + (let (v2 i32) (const.i32 0)) + (let (v3 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v4 i32) (const.i32 64)) + (let (v5 i32) (sub.wrapping v3 v4)) + (let (v6 (ptr i32)) (global.symbol #__stack_pointer)) + (store v6 v5) + (let (v7 i32) (const.i32 52)) + (let (v8 i32) (add.wrapping v5 v7)) + (let (v9 i64) (cast v1)) + (let (v10 i32) (trunc v9)) + (let (v11 i32) (const.i32 2)) + (let (v12 i32) (shl.wrapping v10 v11)) + (call #alloc::vec::Vec::with_capacity v8 v12) + (let (v13 u32) (cast v5)) + (let (v14 u32) (add.checked v13 56)) + (let (v15 (ptr i32)) (inttoptr v14)) + (let (v16 i32) (load v15)) + (let (v17 felt) (call #>::from v16)) + (let (v18 i32) (const.i32 8)) + (let (v19 i32) (add.wrapping v5 v18)) + (let [(v20 felt) (v21 felt) (v22 felt) (v23 felt) (v24 felt)] (call (#miden:prelude/std_mem #pipe_words_to_memory) v1 v17)) + (let (v25 u32) (cast v19)) + (let (v26 (ptr felt)) (inttoptr v25)) + (store v26 v20) + (let (v27 u32) (add.checked v25 8)) + (let (v28 (ptr felt)) (inttoptr v27)) + (store v28 v21) + (let (v29 u32) (add.checked v25 16)) + (let (v30 (ptr felt)) (inttoptr v29)) + (store v30 v22) + (let (v31 u32) (add.checked v25 24)) + (let (v32 (ptr felt)) (inttoptr v31)) + (store v32 v23) + (let (v33 u32) (add.checked v25 32)) + (let (v34 (ptr felt)) (inttoptr v33)) + (store v34 v24) + (let (v35 u32) (cast v5)) + (let (v36 u32) (add.checked v35 32)) + (let (v37 (ptr felt)) (inttoptr v36)) + (let (v38 felt) (load v37)) + (let (v39 u32) (cast v0)) + (let (v40 u32) (add.checked v39 24)) + (let (v41 (ptr felt)) (inttoptr v40)) + (store v41 v38) + (let (v42 u32) (cast v5)) + (let (v43 u32) (add.checked v42 24)) + (let (v44 (ptr felt)) (inttoptr v43)) + (let (v45 felt) (load v44)) + (let (v46 u32) (cast v0)) + (let (v47 u32) (add.checked v46 16)) + (let (v48 (ptr felt)) (inttoptr v47)) + (store v48 v45) + (let (v49 u32) (cast v5)) + (let (v50 u32) (add.checked v49 16)) + (let (v51 (ptr felt)) (inttoptr v50)) + (let (v52 felt) (load v51)) + (let (v53 u32) (cast v0)) + (let (v54 u32) (add.checked v53 8)) + (let (v55 (ptr felt)) (inttoptr v54)) + (store v55 v52) + (let (v56 u32) (cast v5)) + (let (v57 u32) (add.checked v56 8)) + (let (v58 (ptr felt)) (inttoptr v57)) + (let (v59 felt) (load v58)) + (let (v60 u32) (cast v0)) + (let (v61 (ptr felt)) (inttoptr v60)) + (store v61 v59) + (let (v62 u32) (cast v5)) + (let (v63 u32) (add.checked v62 52)) + (let (v64 (ptr i64)) (inttoptr v63)) + (let (v65 i64) (load v64)) + (let (v66 u32) (cast v0)) + (let (v67 u32) (add.checked v66 32)) + (let (v68 (ptr i64)) (inttoptr v67)) + (store v68 v65) + (let (v69 i32) (const.i32 40)) + (let (v70 i32) (add.wrapping v0 v69)) + (let (v71 i32) (const.i32 60)) + (let (v72 i32) (add.wrapping v5 v71)) + (let (v73 u32) (cast v72)) + (let (v74 (ptr i32)) (inttoptr v73)) + (let (v75 i32) (load v74)) + (let (v76 u32) (cast v70)) + (let (v77 (ptr i32)) (inttoptr v76)) + (store v77 v75) + (let (v78 i32) (const.i32 64)) + (let (v79 i32) (add.wrapping v5 v78)) + (let (v80 (ptr i32)) (global.symbol #__stack_pointer)) + (store v80 v79) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #miden_prelude::stdlib::mem::pipe_double_words_to_memory) + (param i32) (param felt) + (block 0 (param v0 i32) (param v1 felt) + (let (v2 i32) (const.i32 0)) + (let (v3 felt) (const.felt 0)) + (let (v4 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v5 i32) (const.i32 128)) + (let (v6 i32) (sub.wrapping v4 v5)) + (let (v7 (ptr i32)) (global.symbol #__stack_pointer)) + (store v7 v6) + (let (v8 i32) (const.i32 12)) + (let (v9 i32) (add.wrapping v6 v8)) + (let (v10 i64) (cast v1)) + (let (v11 i32) (trunc v10)) + (let (v12 i32) (const.i32 2)) + (let (v13 i32) (shl.wrapping v11 v12)) + (call #alloc::vec::Vec::with_capacity v9 v13) + (let (v14 u32) (cast v6)) + (let (v15 u32) (add.checked v14 16)) + (let (v16 (ptr i32)) (inttoptr v15)) + (let (v17 i32) (load v16)) + (let (v18 felt) (call #>::from v17)) + (let (v19 felt) (call #>::from v13)) + (let (v20 felt) (add.unchecked v18 v19)) + (let (v21 i64) (const.i64 0)) + (let (v22 felt) (cast v21)) + (let (v23 i32) (const.i32 24)) + (let (v24 i32) (add.wrapping v6 v23)) + (let [(v25 felt) (v26 felt) (v27 felt) (v28 felt) (v29 felt) (v30 felt) (v31 felt) (v32 felt) (v33 felt) (v34 felt) (v35 felt) (v36 felt) (v37 felt)] (call (#miden:prelude/std_mem #pipe_double_words_to_memory) v22 v22 v22 v22 v22 v22 v22 v22 v22 v22 v22 v22 v18 v20)) + (let (v38 u32) (cast v24)) + (let (v39 (ptr felt)) (inttoptr v38)) + (store v39 v25) + (let (v40 u32) (add.checked v38 8)) + (let (v41 (ptr felt)) (inttoptr v40)) + (store v41 v26) + (let (v42 u32) (add.checked v38 16)) + (let (v43 (ptr felt)) (inttoptr v42)) + (store v43 v27) + (let (v44 u32) (add.checked v38 24)) + (let (v45 (ptr felt)) (inttoptr v44)) + (store v45 v28) + (let (v46 u32) (add.checked v38 32)) + (let (v47 (ptr felt)) (inttoptr v46)) + (store v47 v29) + (let (v48 u32) (add.checked v38 40)) + (let (v49 (ptr felt)) (inttoptr v48)) + (store v49 v30) + (let (v50 u32) (add.checked v38 48)) + (let (v51 (ptr felt)) (inttoptr v50)) + (store v51 v31) + (let (v52 u32) (add.checked v38 56)) + (let (v53 (ptr felt)) (inttoptr v52)) + (store v53 v32) + (let (v54 u32) (add.checked v38 64)) + (let (v55 (ptr felt)) (inttoptr v54)) + (store v55 v33) + (let (v56 u32) (add.checked v38 72)) + (let (v57 (ptr felt)) (inttoptr v56)) + (store v57 v34) + (let (v58 u32) (add.checked v38 80)) + (let (v59 (ptr felt)) (inttoptr v58)) + (store v59 v35) + (let (v60 u32) (add.checked v38 88)) + (let (v61 (ptr felt)) (inttoptr v60)) + (store v61 v36) + (let (v62 u32) (add.checked v38 96)) + (let (v63 (ptr felt)) (inttoptr v62)) + (store v63 v37) + (let (v64 u32) (cast v6)) + (let (v65 u32) (add.checked v64 80)) + (let (v66 (ptr felt)) (inttoptr v65)) + (let (v67 felt) (load v66)) + (let (v68 u32) (cast v0)) + (let (v69 u32) (add.checked v68 24)) + (let (v70 (ptr felt)) (inttoptr v69)) + (store v70 v67) + (let (v71 u32) (cast v6)) + (let (v72 u32) (add.checked v71 72)) + (let (v73 (ptr felt)) (inttoptr v72)) + (let (v74 felt) (load v73)) + (let (v75 u32) (cast v0)) + (let (v76 u32) (add.checked v75 16)) + (let (v77 (ptr felt)) (inttoptr v76)) + (store v77 v74) + (let (v78 u32) (cast v6)) + (let (v79 u32) (add.checked v78 64)) + (let (v80 (ptr felt)) (inttoptr v79)) + (let (v81 felt) (load v80)) + (let (v82 u32) (cast v0)) + (let (v83 u32) (add.checked v82 8)) + (let (v84 (ptr felt)) (inttoptr v83)) + (store v84 v81) + (let (v85 u32) (cast v6)) + (let (v86 u32) (add.checked v85 56)) + (let (v87 (ptr felt)) (inttoptr v86)) + (let (v88 felt) (load v87)) + (let (v89 u32) (cast v0)) + (let (v90 (ptr felt)) (inttoptr v89)) + (store v90 v88) + (let (v91 u32) (cast v6)) + (let (v92 u32) (add.checked v91 12)) + (let (v93 (ptr i64)) (inttoptr v92)) + (let (v94 i64) (load v93)) + (let (v95 u32) (cast v0)) + (let (v96 u32) (add.checked v95 32)) + (let (v97 (ptr i64)) (inttoptr v96)) + (store v97 v94) + (let (v98 i32) (const.i32 40)) + (let (v99 i32) (add.wrapping v0 v98)) + (let (v100 i32) (const.i32 20)) + (let (v101 i32) (add.wrapping v6 v100)) + (let (v102 u32) (cast v101)) + (let (v103 (ptr i32)) (inttoptr v102)) + (let (v104 i32) (load v103)) + (let (v105 u32) (cast v99)) + (let (v106 (ptr i32)) (inttoptr v105)) + (store v106 v104) + (let (v107 i32) (const.i32 128)) + (let (v108 i32) (add.wrapping v6 v107)) + (let (v109 (ptr i32)) (global.symbol #__stack_pointer)) + (store v109 v108) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #dummy) + (block 0 + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #__wasm_call_dtors) + (block 0 + (call #dummy) + (call #dummy) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #alloc::alloc::handle_alloc_error) + (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (unreachable)) + + (block 1) + ) + + (func (export #alloc::raw_vec::capacity_overflow) + + (block 0 + (unreachable)) + + (block 1) + ) + + (func (export #core::slice::::copy_from_slice::len_mismatch_fail) + (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (unreachable)) + + (block 1) + ) + + (func (export #core::slice::::copy_from_slice) + (param i32) (param i32) (param i32) (param i32) (param i32) + (block 0 + (param v0 i32) + (param v1 i32) + (param v2 i32) + (param v3 i32) + (param v4 i32) + (let (v5 i1) (neq v1 v3)) + (let (v6 i32) (cast v5)) + (let (v7 i1) (neq v6 0)) + (condbr v7 (block 2) (block 3))) + + (block 1) + + (block 2 + (call #core::slice::::copy_from_slice::len_mismatch_fail v1 v1 v1) + (unreachable)) + + (block 3 + (let (v8 u32) (cast v0)) + (let (v9 (ptr u8)) (inttoptr v8)) + (let (v10 u32) (cast v2)) + (let (v11 (ptr u8)) (inttoptr v10)) + (memcpy v11 v9 v1) + (ret)) + ) + + (func (export #get_wallet_magic_number.command_export) (result felt) + (block 0 + (let (v1 felt) (call #get_wallet_magic_number)) + (call #__wasm_call_dtors) + (br (block 1 v1))) + + (block 1 (param v0 felt) + (ret v0)) + ) + + (func (export #test_add_asset.command_export) (result felt) + (block 0 + (let (v1 felt) (call #test_add_asset)) + (call #__wasm_call_dtors) + (br (block 1 v1))) + + (block 1 (param v0 felt) + (ret v0)) + ) + + (func (export #test_felt_ops_smoke.command_export) + (param felt) (param felt) (result felt) + (block 0 (param v0 felt) (param v1 felt) + (let (v3 felt) (call #test_felt_ops_smoke v0 v1)) + (call #__wasm_call_dtors) + (br (block 1 v3))) + + (block 1 (param v2 felt) + (ret v2)) + ) + + (func (export #note_script.command_export) (result felt) + (block 0 + (let (v1 felt) (call #note_script)) + (call #__wasm_call_dtors) + (br (block 1 v1))) + + (block 1 (param v0 felt) + (ret v0)) + ) + + (func (export #test_blake3_hash_1to1.command_export) + (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (call #test_blake3_hash_1to1 v0 v1) + (call #__wasm_call_dtors) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_blake3_hash_2to1.command_export) + (param i32) (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) (param v2 i32) + (call #test_blake3_hash_2to1 v0 v1 v2) + (call #__wasm_call_dtors) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_rpo_falcon512_verify.command_export) + (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (call #test_rpo_falcon512_verify v0 v1) + (call #__wasm_call_dtors) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_pipe_words_to_memory.command_export) + (param i32) (param felt) + (block 0 (param v0 i32) (param v1 felt) + (call #test_pipe_words_to_memory v0 v1) + (call #__wasm_call_dtors) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_pipe_double_words_to_memory.command_export) + (param i32) (param felt) + (block 0 (param v0 i32) (param v1 felt) + (call #test_pipe_double_words_to_memory v0 v1) + (call #__wasm_call_dtors) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #test_remove_asset.command_export) + (param i32) (result felt) + (block 0 (param v0 i32) + (let (v2 felt) (call #test_remove_asset v0)) + (call #__wasm_call_dtors) + (br (block 1 v2))) + + (block 1 (param v1 felt) + (ret v1)) + ) + + (func (export #test_create_note.command_export) + (param i32) (param felt) (param felt) (param i32) (result felt) + (block 0 + (param v0 i32) + (param v1 felt) + (param v2 felt) + (param v3 i32) + (let (v5 felt) (call #test_create_note v0 v1 v2 v3)) + (call #__wasm_call_dtors) + (br (block 1 v5))) + + (block 1 (param v4 felt) + (ret v4)) + ) + ;; Imports + (func (import #miden:prelude/std_crypto_dsa #rpo_falcon512_verify) + (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt)) + (func (import #miden:prelude/std_mem #pipe_double_words_to_memory) + (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt felt felt felt felt felt felt felt felt felt)) + (func (import #miden:prelude/std_mem #pipe_words_to_memory) + (param felt) (param felt) (result felt felt felt felt felt)) (func (import #miden:tx_kernel/account #add_asset) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)) + (func (import #miden:tx_kernel/account #get_id) (result felt)) (func (import #miden:tx_kernel/account #remove_asset) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)) + (func (import #miden:tx_kernel/note #get_inputs) + (param felt) (result i32 felt)) (func (import #miden:tx_kernel/tx #create_note) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt)) + (func (import #std::crypto_hashes #blake3_hash_1to1) + (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt felt felt felt felt)) + (func (import #std::crypto_hashes #blake3_hash_2to1) + (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt felt felt felt felt)) ) ) diff --git a/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.wat b/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.wat index 26f3eae39..5ca0d6b52 100644 --- a/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.wat +++ b/tests/integration/expected/rust_sdk_account_test/miden_sdk_account_test.wat @@ -1,50 +1,1475 @@ (module $miden_sdk_account_test.wasm - (type (;0;) (func (param f64 f64 f64 f64 i32))) - (type (;1;) (func (param f64 f64 f64 f64 f64 f64 f64 f64 f64 f64) (result f64))) - (type (;2;) (func (param i32))) - (type (;3;) (func (param i32 f64 f64 i32))) - (type (;4;) (func (param i32 i32))) - (type (;5;) (func (param i32 f64 f64 i32) (result f64))) - (import "miden:tx_kernel/account" "add_asset<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_add_asset (;0;) (type 0))) - (import "miden:tx_kernel/account" "remove_asset<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_remove_asset (;1;) (type 0))) - (import "miden:tx_kernel/tx" "create_note<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_tx_create_note (;2;) (type 1))) - (func $receive_asset (;3;) (type 2) (param i32) + (type (;0;) (func (param i64) (result f64))) + (type (;1;) (func (param f64 f64) (result f64))) + (type (;2;) (func (param f64) (result i64))) + (type (;3;) (func (param f64 f64) (result i32))) + (type (;4;) (func (param f64) (result i32))) + (type (;5;) (func (param f64))) + (type (;6;) (func (param f64) (result f64))) + (type (;7;) (func (param f64 f64))) + (type (;8;) (func (param f64 f64 f64 f64 f64 f64 f64 f64 i32))) + (type (;9;) (func (param f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 i32))) + (type (;10;) (func (param f64 f64 f64 f64 f64 f64 f64 f64))) + (type (;11;) (func (result f64))) + (type (;12;) (func (param i32) (result i32))) + (type (;13;) (func (param f64 f64 f64 f64 i32))) + (type (;14;) (func (param f64 f64 f64 f64 f64 f64 f64 f64 f64 f64) (result f64))) + (type (;15;) (func (param f64 f64 i32))) + (type (;16;) (func (param f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 f64 i32))) + (type (;17;) (func (param i32))) + (type (;18;) (func (param i32 i32 i32) (result i32))) + (type (;19;) (func (param i32 i32 i32))) + (type (;20;) (func (param i32 i32))) + (type (;21;) (func (param i32 f64))) + (type (;22;) (func (param i32) (result f64))) + (type (;23;) (func (param i32 f64 f64 i32) (result f64))) + (type (;24;) (func (param i32 i32) (result i32))) + (type (;25;) (func (param i32 i32 i32 i32))) + (type (;26;) (func)) + (type (;27;) (func (param i32 i32 i32 i32 i32))) + (import "miden:prelude/intrinsics_felt" "from_u64_unchecked" (func $miden_prelude::intrinsics::felt::extern_from_u64_unchecked (;0;) (type 0))) + (import "miden:prelude/intrinsics_felt" "add" (func $miden_prelude::intrinsics::felt::extern_add (;1;) (type 1))) + (import "miden:prelude/intrinsics_felt" "as_u64" (func $miden_prelude::intrinsics::felt::extern_as_u64 (;2;) (type 2))) + (import "miden:prelude/intrinsics_felt" "gt" (func $miden_prelude::intrinsics::felt::extern_gt (;3;) (type 3))) + (import "miden:prelude/intrinsics_felt" "lt" (func $miden_prelude::intrinsics::felt::extern_lt (;4;) (type 3))) + (import "miden:prelude/intrinsics_felt" "le" (func $miden_prelude::intrinsics::felt::extern_le (;5;) (type 3))) + (import "miden:prelude/intrinsics_felt" "ge" (func $miden_prelude::intrinsics::felt::extern_ge (;6;) (type 3))) + (import "miden:prelude/intrinsics_felt" "eq" (func $miden_prelude::intrinsics::felt::extern_eq (;7;) (type 3))) + (import "miden:prelude/intrinsics_felt" "is_odd" (func $miden_prelude::intrinsics::felt::extern_is_odd (;8;) (type 4))) + (import "miden:prelude/intrinsics_felt" "assertz" (func $miden_prelude::intrinsics::felt::extern_assertz (;9;) (type 5))) + (import "miden:prelude/intrinsics_felt" "assert" (func $miden_prelude::intrinsics::felt::extern_assert (;10;) (type 5))) + (import "miden:prelude/intrinsics_felt" "inv" (func $miden_prelude::intrinsics::felt::extern_inv (;11;) (type 6))) + (import "miden:prelude/intrinsics_felt" "exp" (func $miden_prelude::intrinsics::felt::extern_exp (;12;) (type 1))) + (import "miden:prelude/intrinsics_felt" "sub" (func $miden_prelude::intrinsics::felt::extern_sub (;13;) (type 1))) + (import "miden:prelude/intrinsics_felt" "pow2" (func $miden_prelude::intrinsics::felt::extern_pow2 (;14;) (type 6))) + (import "miden:prelude/intrinsics_felt" "mul" (func $miden_prelude::intrinsics::felt::extern_mul (;15;) (type 1))) + (import "miden:prelude/intrinsics_felt" "div" (func $miden_prelude::intrinsics::felt::extern_div (;16;) (type 1))) + (import "miden:prelude/intrinsics_felt" "assert_eq" (func $miden_prelude::intrinsics::felt::extern_assert_eq (;17;) (type 7))) + (import "miden:prelude/intrinsics_felt" "neg" (func $miden_prelude::intrinsics::felt::extern_neg (;18;) (type 6))) + (import "std::crypto_hashes" "blake3_hash_1to1<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_prelude::stdlib::crypto::hashes::extern_blake3_hash_1to1 (;19;) (type 8))) + (import "std::crypto_hashes" "blake3_hash_2to1<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_prelude::stdlib::crypto::hashes::extern_blake3_hash_2to1 (;20;) (type 9))) + (import "miden:prelude/std_crypto_dsa" "rpo_falcon512_verify<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_prelude::stdlib::crypto::dsa::extern_rpo_falcon512_verify (;21;) (type 10))) + (import "miden:tx_kernel/account" "get_id<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_get_id (;22;) (type 11))) + (import "miden:tx_kernel/note" "get_inputs<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_note_get_inputs (;23;) (type 12))) + (import "miden:tx_kernel/account" "add_asset<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_add_asset (;24;) (type 13))) + (import "miden:tx_kernel/account" "remove_asset<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_remove_asset (;25;) (type 13))) + (import "miden:tx_kernel/tx" "create_note<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_tx_create_note (;26;) (type 14))) + (import "miden:prelude/std_mem" "pipe_words_to_memory<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_prelude::stdlib::mem::extern_pipe_words_to_memory (;27;) (type 15))) + (import "miden:prelude/std_mem" "pipe_double_words_to_memory<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_prelude::stdlib::mem::extern_pipe_double_words_to_memory (;28;) (type 16))) + (func $< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop (;29;) (type 17) (param i32) (local i32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 1 global.set $__stack_pointer local.get 1 local.get 0 - call $miden_sdk_tx_kernel::add_asset + i32.load + local.tee 0 + i32.load + i32.store offset=12 local.get 1 - i32.const 32 + local.get 0 + i32.load offset=8 + i32.store offset=8 + local.get 1 + i32.const 8 + i32.add + call $ as core::ops::drop::Drop>::drop + local.get 1 + i32.const 16 i32.add global.set $__stack_pointer ) - (func $send_asset (;4;) (type 3) (param i32 f64 f64 i32) + (func $ as core::ops::drop::Drop>::drop (;30;) (type 17) (param i32) (local i32) + block ;; label = @1 + local.get 0 + i32.load + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.load offset=4 + local.get 1 + i32.const 3 + i32.shl + i32.const 8 + call $__rust_dealloc + end + ) + (func $core::alloc::global::GlobalAlloc::alloc_zeroed (;31;) (type 18) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 0 + local.get 1 + local.get 2 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 2 + memory.fill + end + local.get 1 + ) + (func $__rust_dealloc (;32;) (type 19) (param i32 i32 i32) + i32.const 1048652 + local.get 0 + local.get 2 + local.get 1 + call $::dealloc + ) + (func $ as core::ops::drop::Drop>::drop (;33;) (type 17) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + local.get 0 + i32.store offset=12 + local.get 1 + i32.const 12 + i32.add + call $< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $get_wallet_magic_number (;34;) (type 11) (result f64) + (local f64) + call $miden_sdk_tx_kernel::get_id + local.set 0 + i64.const 42 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.get 0 + call $miden_prelude::intrinsics::felt::extern_add + ) + (func $test_add_asset (;35;) (type 11) (result f64) + (local i32 f64 f64 f64) global.get $__stack_pointer + i32.const 64 + i32.sub + local.tee 0 + global.set $__stack_pointer + i64.const 1 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 1 + i64.const 2 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 2 + i64.const 3 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 3 + local.get 0 + i64.const 4 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + f64.store offset=24 + local.get 0 + local.get 3 + f64.store offset=16 + local.get 0 + local.get 2 + f64.store offset=8 + local.get 0 + local.get 1 + f64.store + local.get 0 i32.const 32 + i32.add + local.get 0 + call $miden_sdk_tx_kernel::add_asset + local.get 0 + f64.load offset=32 + local.set 1 + local.get 0 + i32.const 64 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $test_felt_ops_smoke (;36;) (type 1) (param f64 f64) (result f64) + (local i64) + local.get 0 + call $miden_prelude::intrinsics::felt::extern_as_u64 + local.set 2 + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + block ;; label = @5 + block ;; label = @6 + local.get 0 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_gt + br_if 0 (;@6;) + local.get 1 + local.get 0 + call $miden_prelude::intrinsics::felt::extern_lt + br_if 1 (;@5;) + local.get 1 + local.get 0 + call $miden_prelude::intrinsics::felt::extern_le + br_if 2 (;@4;) + local.get 0 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_ge + br_if 3 (;@3;) + local.get 0 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_eq + i32.const 1 + i32.eq + br_if 4 (;@2;) + local.get 0 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_eq + i32.const 1 + i32.ne + br_if 5 (;@1;) + block ;; label = @7 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_is_odd + br_if 0 (;@7;) + local.get 1 + call $miden_prelude::intrinsics::felt::extern_assertz + local.get 0 + return + end + local.get 0 + call $miden_prelude::intrinsics::felt::extern_assert + local.get 1 + return + end + local.get 0 + call $miden_prelude::intrinsics::felt::extern_inv + local.get 1 + call $miden_prelude::intrinsics::felt::extern_add + return + end + local.get 0 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_exp + local.get 1 + call $miden_prelude::intrinsics::felt::extern_sub + return + end + local.get 0 + call $miden_prelude::intrinsics::felt::extern_pow2 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_mul + return + end + local.get 1 + local.get 0 + call $miden_prelude::intrinsics::felt::extern_div + return + end + local.get 0 + local.get 1 + call $miden_prelude::intrinsics::felt::extern_assert_eq + local.get 0 + local.get 2 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + call $miden_prelude::intrinsics::felt::extern_add + return + end + local.get 0 + call $miden_prelude::intrinsics::felt::extern_neg + ) + (func $note_script (;37;) (type 11) (result f64) + (local i32 f64 i32 i32 i32 i32) + global.get $__stack_pointer + i32.const 16 i32.sub + local.tee 0 + global.set $__stack_pointer + i64.const 0 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 1 + local.get 0 + call $miden_sdk_tx_kernel::get_inputs + local.get 0 + i32.load + local.set 2 + local.get 0 + local.get 0 + i32.load offset=4 + local.tee 3 + local.get 0 + i32.load offset=8 + i32.const 3 + i32.shl local.tee 4 + i32.add + local.tee 5 + i32.store offset=12 + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store + loop (result f64) ;; label = @1 + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 5 + i32.store offset=4 + local.get 0 + call $ as core::ops::drop::Drop>::drop + local.get 0 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + return + end + local.get 4 + i32.const -8 + i32.add + local.set 4 + local.get 1 + local.get 3 + f64.load + call $miden_prelude::intrinsics::felt::extern_add + local.set 1 + local.get 3 + i32.const 8 + i32.add + local.set 3 + br 0 (;@1;) + end + ) + (func $test_blake3_hash_1to1 (;38;) (type 20) (param i32 i32) + (local i32 i32 f64) + global.get $__stack_pointer + i32.const 240 + i32.sub + local.tee 2 global.set $__stack_pointer - local.get 4 + i32.const 0 + local.set 3 + i64.const 0 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 4 + loop ;; label = @1 + block ;; label = @2 + local.get 3 + i32.const 64 + i32.ne + br_if 0 (;@2;) + i32.const 0 + local.set 3 + block ;; label = @3 + loop ;; label = @4 + block ;; label = @5 + local.get 3 + i32.const 64 + i32.ne + br_if 0 (;@5;) + local.get 2 + f64.load offset=8 + local.get 2 + f64.load offset=16 + local.get 2 + f64.load offset=24 + local.get 2 + f64.load offset=32 + local.get 2 + f64.load offset=40 + local.get 2 + f64.load offset=48 + local.get 2 + f64.load offset=56 + local.get 2 + f64.load offset=64 + local.get 2 + i32.const 72 + i32.add + call $miden_prelude::stdlib::crypto::hashes::extern_blake3_hash_1to1 + local.get 2 + i32.const 136 + i32.add + local.get 2 + i32.const 72 + i32.add + i32.const 64 + memory.copy + local.get 2 + i32.const 224 + i32.add + i64.const 0 + i64.store + local.get 2 + i32.const 216 + i32.add + i64.const 0 + i64.store + local.get 2 + i32.const 200 + i32.add + i32.const 8 + i32.add + i64.const 0 + i64.store + local.get 2 + i64.const 0 + i64.store offset=200 + local.get 2 + i32.const 136 + i32.add + local.set 1 + i32.const 0 + local.set 3 + loop ;; label = @6 + local.get 3 + i32.const 32 + i32.eq + br_if 3 (;@3;) + local.get 2 + local.get 1 + f64.load + call $miden_prelude::intrinsics::felt::extern_as_u64 + i64.store offset=232 + local.get 2 + i32.const 200 + i32.add + local.get 3 + i32.add + i32.const 4 + local.get 2 + i32.const 232 + i32.add + i32.const 4 + i32.const 1048620 + call $core::slice::::copy_from_slice + local.get 3 + i32.const 4 + i32.add + local.set 3 + local.get 1 + i32.const 8 + i32.add + local.set 1 + br 0 (;@6;) + end + end + local.get 2 + i32.const 8 + i32.add + local.get 3 + i32.add + local.get 1 + i64.load32_u align=1 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + f64.store + local.get 3 + i32.const 8 + i32.add + local.set 3 + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@4;) + end + end + local.get 0 + local.get 2 + i64.load offset=200 + i64.store align=1 + local.get 0 + i32.const 24 + i32.add + local.get 2 + i32.const 200 + i32.add + i32.const 24 + i32.add + i64.load + i64.store align=1 + local.get 0 + i32.const 16 + i32.add + local.get 2 + i32.const 200 + i32.add + i32.const 16 + i32.add + i64.load + i64.store align=1 + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.const 200 + i32.add + i32.const 8 + i32.add + i64.load + i64.store align=1 + local.get 2 + i32.const 240 + i32.add + global.set $__stack_pointer + return + end + local.get 2 + i32.const 8 + i32.add + local.get 3 + i32.add + local.get 4 + f64.store + local.get 3 + i32.const 8 + i32.add + local.set 3 + br 0 (;@1;) + end + ) + (func $test_blake3_hash_2to1 (;39;) (type 19) (param i32 i32 i32) + (local i32 i32 f64) + global.get $__stack_pointer + i32.const 432 + i32.sub + local.tee 3 + global.set $__stack_pointer + i32.const 0 + local.set 4 + i64.const 0 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 5 + loop ;; label = @1 + block ;; label = @2 + local.get 4 + i32.const 64 + i32.ne + br_if 0 (;@2;) + i32.const 0 + local.set 4 + loop ;; label = @3 + block ;; label = @4 + local.get 4 + i32.const 64 + i32.ne + br_if 0 (;@4;) + i32.const 0 + local.set 4 + i64.const 0 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.set 5 + loop ;; label = @5 + block ;; label = @6 + local.get 4 + i32.const 64 + i32.ne + br_if 0 (;@6;) + i32.const 0 + local.set 4 + block ;; label = @7 + loop ;; label = @8 + block ;; label = @9 + local.get 4 + i32.const 64 + i32.ne + br_if 0 (;@9;) + local.get 3 + f64.load offset=8 + local.get 3 + f64.load offset=16 + local.get 3 + f64.load offset=24 + local.get 3 + f64.load offset=32 + local.get 3 + f64.load offset=40 + local.get 3 + f64.load offset=48 + local.get 3 + f64.load offset=56 + local.get 3 + f64.load offset=64 + local.get 3 + f64.load offset=72 + local.get 3 + f64.load offset=80 + local.get 3 + f64.load offset=88 + local.get 3 + f64.load offset=96 + local.get 3 + f64.load offset=104 + local.get 3 + f64.load offset=112 + local.get 3 + f64.load offset=120 + local.get 3 + f64.load offset=128 + local.get 3 + i32.const 136 + i32.add + call $miden_prelude::stdlib::crypto::hashes::extern_blake3_hash_2to1 + local.get 3 + i32.const 264 + i32.add + local.get 3 + i32.const 136 + i32.add + i32.const 128 + memory.copy + local.get 3 + i32.const 416 + i32.add + i64.const 0 + i64.store + local.get 3 + i32.const 408 + i32.add + i64.const 0 + i64.store + local.get 3 + i32.const 392 + i32.add + i32.const 8 + i32.add + i64.const 0 + i64.store + local.get 3 + i64.const 0 + i64.store offset=392 + local.get 3 + i32.const 264 + i32.add + local.set 2 + i32.const 0 + local.set 4 + loop ;; label = @10 + local.get 4 + i32.const 32 + i32.eq + br_if 3 (;@7;) + local.get 3 + local.get 2 + f64.load + call $miden_prelude::intrinsics::felt::extern_as_u64 + i64.store offset=424 + local.get 3 + i32.const 392 + i32.add + local.get 4 + i32.add + i32.const 4 + local.get 3 + i32.const 424 + i32.add + i32.const 4 + i32.const 1048636 + call $core::slice::::copy_from_slice + local.get 4 + i32.const 4 + i32.add + local.set 4 + local.get 2 + i32.const 8 + i32.add + local.set 2 + br 0 (;@10;) + end + end + local.get 3 + i32.const 72 + i32.add + local.get 4 + i32.add + local.get 2 + i64.load32_u align=1 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + f64.store + local.get 4 + i32.const 8 + i32.add + local.set 4 + local.get 2 + i32.const 4 + i32.add + local.set 2 + br 0 (;@8;) + end + end + local.get 0 + local.get 3 + i64.load offset=392 + i64.store align=1 + local.get 0 + i32.const 24 + i32.add + local.get 3 + i32.const 392 + i32.add + i32.const 24 + i32.add + i64.load + i64.store align=1 + local.get 0 + i32.const 16 + i32.add + local.get 3 + i32.const 392 + i32.add + i32.const 16 + i32.add + i64.load + i64.store align=1 + local.get 0 + i32.const 8 + i32.add + local.get 3 + i32.const 392 + i32.add + i32.const 8 + i32.add + i64.load + i64.store align=1 + local.get 3 + i32.const 432 + i32.add + global.set $__stack_pointer + return + end + local.get 3 + i32.const 72 + i32.add + local.get 4 + i32.add + local.get 5 + f64.store + local.get 4 + i32.const 8 + i32.add + local.set 4 + br 0 (;@5;) + end + end + local.get 3 + i32.const 8 + i32.add + local.get 4 + i32.add + local.get 1 + i64.load32_u align=1 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + f64.store + local.get 4 + i32.const 8 + i32.add + local.set 4 + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@3;) + end + end + local.get 3 + i32.const 8 + i32.add + local.get 4 + i32.add + local.get 5 + f64.store + local.get 4 + i32.const 8 + i32.add + local.set 4 + br 0 (;@1;) + end + ) + (func $test_rpo_falcon512_verify (;40;) (type 20) (param i32 i32) + local.get 0 + f64.load + local.get 0 + f64.load offset=8 + local.get 0 + f64.load offset=16 + local.get 0 + f64.load offset=24 + local.get 1 + f64.load + local.get 1 + f64.load offset=8 + local.get 1 + f64.load offset=16 + local.get 1 + f64.load offset=24 + call $miden_prelude::stdlib::crypto::dsa::extern_rpo_falcon512_verify + ) + (func $test_pipe_words_to_memory (;41;) (type 21) (param i32 f64) + local.get 0 + local.get 1 + call $miden_prelude::stdlib::mem::pipe_words_to_memory + ) + (func $test_pipe_double_words_to_memory (;42;) (type 21) (param i32 f64) + local.get 0 + local.get 1 + call $miden_prelude::stdlib::mem::pipe_double_words_to_memory + ) + (func $test_remove_asset (;43;) (type 22) (param i32) (result f64) + (local i32 f64) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 local.get 0 call $miden_sdk_tx_kernel::remove_asset - local.get 4 + local.get 1 + f64.load + local.set 2 + local.get 1 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 2 + ) + (func $test_create_note (;44;) (type 23) (param i32 f64 f64 i32) (result f64) + local.get 0 local.get 1 local.get 2 local.get 3 call $miden_sdk_tx_kernel::create_note - drop - local.get 4 - i32.const 32 + ) + (func $__rust_alloc (;45;) (type 24) (param i32 i32) (result i32) + i32.const 1048652 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rust_alloc_zeroed (;46;) (type 24) (param i32 i32) (result i32) + i32.const 1048652 + local.get 1 + local.get 0 + call $core::alloc::global::GlobalAlloc::alloc_zeroed + ) + (func $wee_alloc::neighbors::Neighbors::remove (;47;) (type 17) (param i32) + (local i32 i32 i32) + block ;; label = @1 + local.get 0 + i32.load + local.tee 1 + i32.const 2 + i32.and + br_if 0 (;@1;) + local.get 1 + i32.const -4 + i32.and + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 2 + local.get 2 + i32.load offset=4 + i32.const 3 + i32.and + local.get 0 + i32.load offset=4 + i32.const -4 + i32.and + i32.or + i32.store offset=4 + local.get 0 + i32.load + local.set 1 + end + block ;; label = @1 + local.get 0 + i32.load offset=4 + local.tee 2 + i32.const -4 + i32.and + local.tee 3 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 3 + i32.load + i32.const 3 + i32.and + local.get 1 + i32.const -4 + i32.and + i32.or + i32.store + local.get 0 + i32.load offset=4 + local.set 2 + local.get 0 + i32.load + local.set 1 + end + local.get 0 + local.get 2 + i32.const 3 + i32.and + i32.store offset=4 + local.get 0 + local.get 1 + i32.const 3 + i32.and + i32.store + ) + (func $::new_cell_for_free_list (;48;) (type 25) (param i32 i32 i32 i32) + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.const 2 + i32.shl + local.tee 2 + local.get 3 + i32.const 3 + i32.shl + i32.const 512 + i32.add + local.tee 3 + local.get 2 + local.get 3 + i32.gt_u + select + i32.const 65543 + i32.add + local.tee 3 + i32.const 16 + i32.shr_u + memory.grow + local.tee 2 + i32.const -1 + i32.ne + br_if 0 (;@2;) + i32.const 1 + local.set 3 + i32.const 0 + local.set 2 + br 1 (;@1;) + end + local.get 2 + i32.const 16 + i32.shl + local.tee 2 + i64.const 0 + i64.store offset=4 align=4 + local.get 2 + local.get 2 + local.get 3 + i32.const -65536 + i32.and + i32.add + i32.const 2 + i32.or + i32.store + i32.const 0 + local.set 3 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 3 + i32.store + ) + (func $wee_alloc::alloc_first_fit (;49;) (type 18) (param i32 i32 i32) (result i32) + (local i32 i32 i32 i32 i32 i32) + local.get 1 + i32.const -1 i32.add + local.set 3 + i32.const 0 + local.set 4 + i32.const 0 + local.get 1 + i32.sub + local.set 5 + local.get 0 + i32.const 2 + i32.shl + local.set 6 + local.get 2 + i32.load + local.set 0 + loop (result i32) ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 0 + i32.eqz + br_if 0 (;@3;) + local.get 0 + local.set 1 + block ;; label = @4 + block ;; label = @5 + loop ;; label = @6 + block ;; label = @7 + local.get 1 + i32.load offset=8 + local.tee 0 + i32.const 1 + i32.and + br_if 0 (;@7;) + local.get 1 + i32.load + i32.const -4 + i32.and + local.tee 7 + local.get 1 + i32.const 8 + i32.add + local.tee 8 + i32.sub + local.get 6 + i32.lt_u + br_if 5 (;@2;) + block ;; label = @8 + local.get 8 + i32.const 72 + i32.add + local.get 7 + local.get 6 + i32.sub + local.get 5 + i32.and + local.tee 7 + i32.le_u + br_if 0 (;@8;) + local.get 3 + local.get 8 + i32.and + br_if 6 (;@2;) + local.get 2 + local.get 0 + i32.const -4 + i32.and + i32.store + local.get 1 + i32.load + local.set 2 + local.get 1 + local.set 0 + br 4 (;@4;) + end + i32.const 0 + local.set 2 + local.get 7 + i32.const 0 + i32.store + local.get 7 + i32.const -8 + i32.add + local.tee 0 + i64.const 0 + i64.store align=4 + local.get 0 + local.get 1 + i32.load + i32.const -4 + i32.and + i32.store + block ;; label = @8 + local.get 1 + i32.load + local.tee 8 + i32.const 2 + i32.and + br_if 0 (;@8;) + local.get 8 + i32.const -4 + i32.and + local.tee 8 + i32.eqz + br_if 0 (;@8;) + local.get 8 + local.get 8 + i32.load offset=4 + i32.const 3 + i32.and + local.get 0 + i32.or + i32.store offset=4 + local.get 0 + i32.load offset=4 + i32.const 3 + i32.and + local.set 2 + end + local.get 0 + local.get 2 + local.get 1 + i32.or + i32.store offset=4 + local.get 1 + local.get 1 + i32.load offset=8 + i32.const -2 + i32.and + i32.store offset=8 + local.get 1 + local.get 1 + i32.load + local.tee 2 + i32.const 3 + i32.and + local.get 0 + i32.or + local.tee 8 + i32.store + local.get 2 + i32.const 2 + i32.and + br_if 2 (;@5;) + local.get 0 + i32.load + local.set 2 + br 3 (;@4;) + end + local.get 1 + local.get 0 + i32.const -2 + i32.and + i32.store offset=8 + block ;; label = @7 + block ;; label = @8 + local.get 1 + i32.load offset=4 + i32.const -4 + i32.and + local.tee 0 + br_if 0 (;@8;) + i32.const 0 + local.set 0 + br 1 (;@7;) + end + i32.const 0 + local.get 0 + local.get 0 + i32.load8_u + i32.const 1 + i32.and + select + local.set 0 + end + local.get 1 + call $wee_alloc::neighbors::Neighbors::remove + block ;; label = @7 + local.get 1 + i32.load8_u + i32.const 2 + i32.and + i32.eqz + br_if 0 (;@7;) + local.get 0 + local.get 0 + i32.load + i32.const 2 + i32.or + i32.store + end + local.get 2 + local.get 0 + i32.store + local.get 0 + local.set 1 + br 0 (;@6;) + end + end + local.get 1 + local.get 8 + i32.const -3 + i32.and + i32.store + local.get 0 + i32.load + i32.const 2 + i32.or + local.set 2 + end + local.get 0 + local.get 2 + i32.const 1 + i32.or + i32.store + local.get 0 + i32.const 8 + i32.add + local.set 4 + end + local.get 4 + return + end + local.get 2 + local.get 0 + i32.store + br 0 (;@1;) + end + ) + (func $::alloc (;50;) (type 18) (param i32 i32 i32) (result i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 global.set $__stack_pointer + local.get 1 + i32.const 1 + local.get 1 + i32.const 1 + i32.gt_u + select + local.set 1 + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 0 + i32.load + i32.store offset=12 + block ;; label = @2 + local.get 2 + i32.const 3 + i32.add + i32.const 2 + i32.shr_u + local.tee 4 + local.get 1 + local.get 3 + i32.const 12 + i32.add + call $wee_alloc::alloc_first_fit + local.tee 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.load offset=12 + i32.store + local.get 2 + local.set 1 + br 1 (;@1;) + end + local.get 3 + local.get 3 + local.get 4 + local.get 1 + call $::new_cell_for_free_list + block ;; label = @2 + block ;; label = @3 + local.get 3 + i32.load + i32.eqz + br_if 0 (;@3;) + local.get 0 + local.get 3 + i32.load offset=12 + i32.store + br 1 (;@2;) + end + local.get 3 + i32.load offset=4 + local.tee 2 + local.get 3 + i32.load offset=12 + i32.store offset=8 + local.get 3 + local.get 2 + i32.store offset=12 + local.get 4 + local.get 1 + local.get 3 + i32.const 12 + i32.add + call $wee_alloc::alloc_first_fit + local.set 1 + local.get 0 + local.get 3 + i32.load offset=12 + i32.store + local.get 1 + br_if 1 (;@1;) + end + i32.const 0 + local.set 1 + end + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + local.get 1 + ) + (func $::dealloc (;51;) (type 25) (param i32 i32 i32 i32) + (local i32 i32 i32) + block ;; label = @1 + local.get 1 + i32.eqz + br_if 0 (;@1;) + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + i32.store + local.get 1 + i32.const -8 + i32.add + local.tee 3 + local.get 3 + i32.load + local.tee 4 + i32.const -2 + i32.and + i32.store + local.get 0 + i32.load + local.set 5 + block ;; label = @2 + block ;; label = @3 + block ;; label = @4 + local.get 3 + i32.const 4 + i32.add + i32.load + i32.const -4 + i32.and + local.tee 6 + i32.eqz + br_if 0 (;@4;) + local.get 6 + i32.load8_u + i32.const 1 + i32.and + br_if 0 (;@4;) + local.get 3 + call $wee_alloc::neighbors::Neighbors::remove + local.get 3 + i32.load8_u + i32.const 2 + i32.and + i32.eqz + br_if 1 (;@3;) + local.get 6 + local.get 6 + i32.load + i32.const 2 + i32.or + i32.store + br 1 (;@3;) + end + block ;; label = @4 + block ;; label = @5 + local.get 4 + i32.const 2 + i32.and + br_if 0 (;@5;) + local.get 4 + i32.const -4 + i32.and + local.tee 4 + i32.eqz + br_if 0 (;@5;) + local.get 4 + i32.load8_u + i32.const 1 + i32.and + i32.eqz + br_if 1 (;@4;) + end + local.get 1 + local.get 5 + i32.store + br 2 (;@2;) + end + local.get 1 + local.get 4 + i32.load offset=8 + i32.const -4 + i32.and + i32.store + local.get 4 + local.get 3 + i32.const 1 + i32.or + i32.store offset=8 + end + local.get 5 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + end ) - (func $miden_sdk_tx_kernel::add_asset (;5;) (type 4) (param i32 i32) + (func $miden_sdk_tx_kernel::get_id (;52;) (type 11) (result f64) + call $miden_sdk_tx_kernel::externs::extern_account_get_id + ) + (func $miden_sdk_tx_kernel::get_inputs (;53;) (type 17) (param i32) + (local i32 i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 4 + i32.add + i32.const 256 + i32.const 0 + call $alloc::raw_vec::RawVec::try_allocate_in + local.get 1 + i32.load offset=12 + local.set 2 + local.get 1 + i32.load offset=8 + local.set 3 + block ;; label = @1 + block ;; label = @2 + local.get 1 + i32.load offset=4 + i32.eqz + br_if 0 (;@2;) + local.get 3 + i32.eqz + br_if 1 (;@1;) + local.get 3 + local.get 2 + call $alloc::alloc::handle_alloc_error + unreachable + end + local.get 2 + call $miden_sdk_tx_kernel::externs::extern_note_get_inputs + drop + local.get 0 + i32.const 0 + i32.store offset=8 + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 3 + i32.store + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + return + end + call $alloc::raw_vec::capacity_overflow + unreachable + ) + (func $miden_sdk_tx_kernel::add_asset (;54;) (type 20) (param i32 i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -94,7 +1519,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_sdk_tx_kernel::remove_asset (;6;) (type 4) (param i32 i32) + (func $miden_sdk_tx_kernel::remove_asset (;55;) (type 20) (param i32 i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -144,7 +1569,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_sdk_tx_kernel::create_note (;7;) (type 5) (param i32 f64 f64 i32) (result f64) + (func $miden_sdk_tx_kernel::create_note (;56;) (type 23) (param i32 f64 f64 i32) (result f64) local.get 0 f64.load local.get 0 @@ -165,10 +1590,382 @@ f64.load offset=24 call $miden_sdk_tx_kernel::externs::extern_tx_create_note ) + (func $alloc::vec::Vec::with_capacity (;57;) (type 20) (param i32 i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 4 + i32.add + local.get 1 + i32.const 0 + call $alloc::raw_vec::RawVec::try_allocate_in + local.get 2 + i32.load offset=12 + local.set 3 + local.get 2 + i32.load offset=8 + local.set 1 + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.load offset=4 + i32.eqz + br_if 0 (;@2;) + local.get 1 + i32.eqz + br_if 1 (;@1;) + local.get 1 + local.get 3 + call $alloc::alloc::handle_alloc_error + unreachable + end + local.get 0 + i32.const 0 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + return + end + call $alloc::raw_vec::capacity_overflow + unreachable + ) + (func $alloc::raw_vec::RawVec::try_allocate_in (;58;) (type 19) (param i32 i32 i32) + (local i32) + block ;; label = @1 + block ;; label = @2 + local.get 1 + br_if 0 (;@2;) + local.get 0 + i64.const 34359738368 + i64.store offset=4 align=4 + i32.const 0 + local.set 1 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 1 + i32.const 268435456 + i32.lt_u + br_if 0 (;@3;) + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@2;) + end + local.get 1 + i32.const 3 + i32.shl + local.set 3 + block ;; label = @3 + block ;; label = @4 + local.get 2 + br_if 0 (;@4;) + i32.const 0 + i32.load8_u offset=1048656 + drop + local.get 3 + i32.const 8 + call $__rust_alloc + local.set 2 + br 1 (;@3;) + end + local.get 3 + i32.const 8 + call $__rust_alloc_zeroed + local.set 2 + end + block ;; label = @3 + local.get 2 + i32.eqz + br_if 0 (;@3;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 1 + br 2 (;@1;) + end + local.get 0 + local.get 3 + i32.store offset=8 + local.get 0 + i32.const 8 + i32.store offset=4 + end + i32.const 1 + local.set 1 + end + local.get 0 + local.get 1 + i32.store + ) + (func $>::from (;59;) (type 22) (param i32) (result f64) + local.get 0 + i64.extend_i32_u + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + ) + (func $miden_prelude::stdlib::mem::pipe_words_to_memory (;60;) (type 21) (param i32 f64) + (local i32) + global.get $__stack_pointer + i32.const 64 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 52 + i32.add + local.get 1 + call $miden_prelude::intrinsics::felt::extern_as_u64 + i32.wrap_i64 + i32.const 2 + i32.shl + call $alloc::vec::Vec::with_capacity + local.get 1 + local.get 2 + i32.load offset=56 + call $>::from + local.get 2 + i32.const 8 + i32.add + call $miden_prelude::stdlib::mem::extern_pipe_words_to_memory + local.get 0 + local.get 2 + f64.load offset=32 + f64.store offset=24 + local.get 0 + local.get 2 + f64.load offset=24 + f64.store offset=16 + local.get 0 + local.get 2 + f64.load offset=16 + f64.store offset=8 + local.get 0 + local.get 2 + f64.load offset=8 + f64.store + local.get 0 + local.get 2 + i64.load offset=52 align=4 + i64.store offset=32 align=4 + local.get 0 + i32.const 40 + i32.add + local.get 2 + i32.const 60 + i32.add + i32.load + i32.store + local.get 2 + i32.const 64 + i32.add + global.set $__stack_pointer + ) + (func $miden_prelude::stdlib::mem::pipe_double_words_to_memory (;61;) (type 21) (param i32 f64) + (local i32 i32 f64 f64) + global.get $__stack_pointer + i32.const 128 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 2 + i32.const 12 + i32.add + local.get 1 + call $miden_prelude::intrinsics::felt::extern_as_u64 + i32.wrap_i64 + i32.const 2 + i32.shl + local.tee 3 + call $alloc::vec::Vec::with_capacity + local.get 2 + i32.load offset=16 + call $>::from + local.tee 4 + local.get 3 + call $>::from + call $miden_prelude::intrinsics::felt::extern_add + local.set 5 + i64.const 0 + call $miden_prelude::intrinsics::felt::extern_from_u64_unchecked + local.tee 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 1 + local.get 4 + local.get 5 + local.get 2 + i32.const 24 + i32.add + call $miden_prelude::stdlib::mem::extern_pipe_double_words_to_memory + local.get 0 + local.get 2 + f64.load offset=80 + f64.store offset=24 + local.get 0 + local.get 2 + f64.load offset=72 + f64.store offset=16 + local.get 0 + local.get 2 + f64.load offset=64 + f64.store offset=8 + local.get 0 + local.get 2 + f64.load offset=56 + f64.store + local.get 0 + local.get 2 + i64.load offset=12 align=4 + i64.store offset=32 align=4 + local.get 0 + i32.const 40 + i32.add + local.get 2 + i32.const 20 + i32.add + i32.load + i32.store + local.get 2 + i32.const 128 + i32.add + global.set $__stack_pointer + ) + (func $dummy (;62;) (type 26)) + (func $__wasm_call_dtors (;63;) (type 26) + call $dummy + call $dummy + ) + (func $alloc::alloc::handle_alloc_error (;64;) (type 20) (param i32 i32) + unreachable + unreachable + ) + (func $alloc::raw_vec::capacity_overflow (;65;) (type 26) + unreachable + unreachable + ) + (func $core::slice::::copy_from_slice::len_mismatch_fail (;66;) (type 19) (param i32 i32 i32) + unreachable + unreachable + ) + (func $core::slice::::copy_from_slice (;67;) (type 27) (param i32 i32 i32 i32 i32) + block ;; label = @1 + local.get 1 + local.get 3 + i32.ne + br_if 0 (;@1;) + local.get 0 + local.get 2 + local.get 1 + memory.copy + return + end + local.get 1 + local.get 1 + local.get 1 + call $core::slice::::copy_from_slice::len_mismatch_fail + unreachable + ) + (func $get_wallet_magic_number.command_export (;68;) (type 11) (result f64) + call $get_wallet_magic_number + call $__wasm_call_dtors + ) + (func $test_add_asset.command_export (;69;) (type 11) (result f64) + call $test_add_asset + call $__wasm_call_dtors + ) + (func $test_felt_ops_smoke.command_export (;70;) (type 1) (param f64 f64) (result f64) + local.get 0 + local.get 1 + call $test_felt_ops_smoke + call $__wasm_call_dtors + ) + (func $note_script.command_export (;71;) (type 11) (result f64) + call $note_script + call $__wasm_call_dtors + ) + (func $test_blake3_hash_1to1.command_export (;72;) (type 20) (param i32 i32) + local.get 0 + local.get 1 + call $test_blake3_hash_1to1 + call $__wasm_call_dtors + ) + (func $test_blake3_hash_2to1.command_export (;73;) (type 19) (param i32 i32 i32) + local.get 0 + local.get 1 + local.get 2 + call $test_blake3_hash_2to1 + call $__wasm_call_dtors + ) + (func $test_rpo_falcon512_verify.command_export (;74;) (type 20) (param i32 i32) + local.get 0 + local.get 1 + call $test_rpo_falcon512_verify + call $__wasm_call_dtors + ) + (func $test_pipe_words_to_memory.command_export (;75;) (type 21) (param i32 f64) + local.get 0 + local.get 1 + call $test_pipe_words_to_memory + call $__wasm_call_dtors + ) + (func $test_pipe_double_words_to_memory.command_export (;76;) (type 21) (param i32 f64) + local.get 0 + local.get 1 + call $test_pipe_double_words_to_memory + call $__wasm_call_dtors + ) + (func $test_remove_asset.command_export (;77;) (type 22) (param i32) (result f64) + local.get 0 + call $test_remove_asset + call $__wasm_call_dtors + ) + (func $test_create_note.command_export (;78;) (type 23) (param i32 f64 f64 i32) (result f64) + local.get 0 + local.get 1 + local.get 2 + local.get 3 + call $test_create_note + call $__wasm_call_dtors + ) (table (;0;) 1 1 funcref) - (memory (;0;) 16) + (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) - (export "receive_asset" (func $receive_asset)) - (export "send_asset" (func $send_asset)) + (export "get_wallet_magic_number" (func $get_wallet_magic_number.command_export)) + (export "test_add_asset" (func $test_add_asset.command_export)) + (export "test_felt_ops_smoke" (func $test_felt_ops_smoke.command_export)) + (export "note_script" (func $note_script.command_export)) + (export "test_blake3_hash_1to1" (func $test_blake3_hash_1to1.command_export)) + (export "test_blake3_hash_2to1" (func $test_blake3_hash_2to1.command_export)) + (export "test_rpo_falcon512_verify" (func $test_rpo_falcon512_verify.command_export)) + (export "test_pipe_words_to_memory" (func $test_pipe_words_to_memory.command_export)) + (export "test_pipe_double_words_to_memory" (func $test_pipe_double_words_to_memory.command_export)) + (export "test_remove_asset" (func $test_remove_asset.command_export)) + (export "test_create_note" (func $test_create_note.command_export)) + (data $.rodata (;0;) (i32.const 1048576) "~/sdk/prelude/src/stdlib/crypto/hashes.rs\00\00\00\00\00\10\00)\00\00\00\8b\00\00\00(\00\00\00\00\00\10\00)\00\00\00\d1\00\00\00(\00\00\00") ) \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.hir b/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.hir new file mode 100644 index 000000000..0916626ba --- /dev/null +++ b/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.hir @@ -0,0 +1,279 @@ +(component + ;; Component Imports + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)))) (#miden:tx_kernel/account #add_asset) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)))) (#miden:tx_kernel/account #remove_asset) + (lower ((digest 0x0000000000000000000000000000000000000000000000000000000000000000) (type (func (abi canon) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt)))) (#miden:tx_kernel/tx #create_note) + + ;; Modules + (module #rust_sdk_basic_wallet + ;; Constants + (const (id 0) 0x00100000) + + ;; Global Variables + (global (export #__stack_pointer) (id 0) (type i32) (const 0)) + + ;; Functions + (func (export #receive_asset) (param i32) + (block 0 (param v0 i32) + (let (v1 i32) (const.i32 0)) + (let (v2 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v3 i32) (const.i32 32)) + (let (v4 i32) (sub.wrapping v2 v3)) + (let (v5 (ptr i32)) (global.symbol #__stack_pointer)) + (store v5 v4) + (call #miden_sdk_tx_kernel::add_asset v4 v0) + (let (v6 i32) (const.i32 32)) + (let (v7 i32) (add.wrapping v4 v6)) + (let (v8 (ptr i32)) (global.symbol #__stack_pointer)) + (store v8 v7) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #send_asset) + (param i32) (param felt) (param felt) (param i32) + (block 0 + (param v0 i32) + (param v1 felt) + (param v2 felt) + (param v3 i32) + (let (v4 i32) (const.i32 0)) + (let (v5 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v6 i32) (const.i32 32)) + (let (v7 i32) (sub.wrapping v5 v6)) + (let (v8 (ptr i32)) (global.symbol #__stack_pointer)) + (store v8 v7) + (call #miden_sdk_tx_kernel::remove_asset v7 v0) + (let (v9 felt) (call #miden_sdk_tx_kernel::create_note v7 v1 v2 v3)) + (let (v10 i32) (const.i32 32)) + (let (v11 i32) (add.wrapping v7 v10)) + (let (v12 (ptr i32)) (global.symbol #__stack_pointer)) + (store v12 v11) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #miden_sdk_tx_kernel::add_asset) + (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v2 i32) (const.i32 0)) + (let (v3 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v4 i32) (const.i32 32)) + (let (v5 i32) (sub.wrapping v3 v4)) + (let (v6 (ptr i32)) (global.symbol #__stack_pointer)) + (store v6 v5) + (let (v7 u32) (cast v1)) + (let (v8 (ptr felt)) (inttoptr v7)) + (let (v9 felt) (load v8)) + (let (v10 u32) (cast v1)) + (let (v11 u32) (add.checked v10 8)) + (let (v12 (ptr felt)) (inttoptr v11)) + (let (v13 felt) (load v12)) + (let (v14 u32) (cast v1)) + (let (v15 u32) (add.checked v14 16)) + (let (v16 (ptr felt)) (inttoptr v15)) + (let (v17 felt) (load v16)) + (let (v18 u32) (cast v1)) + (let (v19 u32) (add.checked v18 24)) + (let (v20 (ptr felt)) (inttoptr v19)) + (let (v21 felt) (load v20)) + (let [(v22 felt) (v23 felt) (v24 felt) (v25 felt)] (call (#miden:tx_kernel/account #add_asset) v9 v13 v17 v21)) + (let (v26 u32) (cast v5)) + (let (v27 (ptr felt)) (inttoptr v26)) + (store v27 v22) + (let (v28 u32) (add.checked v26 8)) + (let (v29 (ptr felt)) (inttoptr v28)) + (store v29 v23) + (let (v30 u32) (add.checked v26 16)) + (let (v31 (ptr felt)) (inttoptr v30)) + (store v31 v24) + (let (v32 u32) (add.checked v26 24)) + (let (v33 (ptr felt)) (inttoptr v32)) + (store v33 v25) + (let (v34 i32) (const.i32 24)) + (let (v35 i32) (add.wrapping v0 v34)) + (let (v36 i32) (const.i32 24)) + (let (v37 i32) (add.wrapping v5 v36)) + (let (v38 u32) (cast v37)) + (let (v39 (ptr i64)) (inttoptr v38)) + (let (v40 i64) (load v39)) + (let (v41 u32) (cast v35)) + (let (v42 (ptr i64)) (inttoptr v41)) + (store v42 v40) + (let (v43 i32) (const.i32 16)) + (let (v44 i32) (add.wrapping v0 v43)) + (let (v45 i32) (const.i32 16)) + (let (v46 i32) (add.wrapping v5 v45)) + (let (v47 u32) (cast v46)) + (let (v48 (ptr i64)) (inttoptr v47)) + (let (v49 i64) (load v48)) + (let (v50 u32) (cast v44)) + (let (v51 (ptr i64)) (inttoptr v50)) + (store v51 v49) + (let (v52 i32) (const.i32 8)) + (let (v53 i32) (add.wrapping v0 v52)) + (let (v54 i32) (const.i32 8)) + (let (v55 i32) (add.wrapping v5 v54)) + (let (v56 u32) (cast v55)) + (let (v57 (ptr i64)) (inttoptr v56)) + (let (v58 i64) (load v57)) + (let (v59 u32) (cast v53)) + (let (v60 (ptr i64)) (inttoptr v59)) + (store v60 v58) + (let (v61 u32) (cast v5)) + (let (v62 (ptr i64)) (inttoptr v61)) + (let (v63 i64) (load v62)) + (let (v64 u32) (cast v0)) + (let (v65 (ptr i64)) (inttoptr v64)) + (store v65 v63) + (let (v66 i32) (const.i32 32)) + (let (v67 i32) (add.wrapping v5 v66)) + (let (v68 (ptr i32)) (global.symbol #__stack_pointer)) + (store v68 v67) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #miden_sdk_tx_kernel::remove_asset) + (param i32) (param i32) + (block 0 (param v0 i32) (param v1 i32) + (let (v2 i32) (const.i32 0)) + (let (v3 i32) (global.load i32 (global.symbol #__stack_pointer))) + (let (v4 i32) (const.i32 32)) + (let (v5 i32) (sub.wrapping v3 v4)) + (let (v6 (ptr i32)) (global.symbol #__stack_pointer)) + (store v6 v5) + (let (v7 u32) (cast v1)) + (let (v8 (ptr felt)) (inttoptr v7)) + (let (v9 felt) (load v8)) + (let (v10 u32) (cast v1)) + (let (v11 u32) (add.checked v10 8)) + (let (v12 (ptr felt)) (inttoptr v11)) + (let (v13 felt) (load v12)) + (let (v14 u32) (cast v1)) + (let (v15 u32) (add.checked v14 16)) + (let (v16 (ptr felt)) (inttoptr v15)) + (let (v17 felt) (load v16)) + (let (v18 u32) (cast v1)) + (let (v19 u32) (add.checked v18 24)) + (let (v20 (ptr felt)) (inttoptr v19)) + (let (v21 felt) (load v20)) + (let [(v22 felt) (v23 felt) (v24 felt) (v25 felt)] (call (#miden:tx_kernel/account #remove_asset) v9 v13 v17 v21)) + (let (v26 u32) (cast v5)) + (let (v27 (ptr felt)) (inttoptr v26)) + (store v27 v22) + (let (v28 u32) (add.checked v26 8)) + (let (v29 (ptr felt)) (inttoptr v28)) + (store v29 v23) + (let (v30 u32) (add.checked v26 16)) + (let (v31 (ptr felt)) (inttoptr v30)) + (store v31 v24) + (let (v32 u32) (add.checked v26 24)) + (let (v33 (ptr felt)) (inttoptr v32)) + (store v33 v25) + (let (v34 i32) (const.i32 24)) + (let (v35 i32) (add.wrapping v0 v34)) + (let (v36 i32) (const.i32 24)) + (let (v37 i32) (add.wrapping v5 v36)) + (let (v38 u32) (cast v37)) + (let (v39 (ptr i64)) (inttoptr v38)) + (let (v40 i64) (load v39)) + (let (v41 u32) (cast v35)) + (let (v42 (ptr i64)) (inttoptr v41)) + (store v42 v40) + (let (v43 i32) (const.i32 16)) + (let (v44 i32) (add.wrapping v0 v43)) + (let (v45 i32) (const.i32 16)) + (let (v46 i32) (add.wrapping v5 v45)) + (let (v47 u32) (cast v46)) + (let (v48 (ptr i64)) (inttoptr v47)) + (let (v49 i64) (load v48)) + (let (v50 u32) (cast v44)) + (let (v51 (ptr i64)) (inttoptr v50)) + (store v51 v49) + (let (v52 i32) (const.i32 8)) + (let (v53 i32) (add.wrapping v0 v52)) + (let (v54 i32) (const.i32 8)) + (let (v55 i32) (add.wrapping v5 v54)) + (let (v56 u32) (cast v55)) + (let (v57 (ptr i64)) (inttoptr v56)) + (let (v58 i64) (load v57)) + (let (v59 u32) (cast v53)) + (let (v60 (ptr i64)) (inttoptr v59)) + (store v60 v58) + (let (v61 u32) (cast v5)) + (let (v62 (ptr i64)) (inttoptr v61)) + (let (v63 i64) (load v62)) + (let (v64 u32) (cast v0)) + (let (v65 (ptr i64)) (inttoptr v64)) + (store v65 v63) + (let (v66 i32) (const.i32 32)) + (let (v67 i32) (add.wrapping v5 v66)) + (let (v68 (ptr i32)) (global.symbol #__stack_pointer)) + (store v68 v67) + (br (block 1))) + + (block 1 + (ret)) + ) + + (func (export #miden_sdk_tx_kernel::create_note) + (param i32) (param felt) (param felt) (param i32) (result felt) + (block 0 + (param v0 i32) + (param v1 felt) + (param v2 felt) + (param v3 i32) + (let (v5 u32) (cast v0)) + (let (v6 (ptr felt)) (inttoptr v5)) + (let (v7 felt) (load v6)) + (let (v8 u32) (cast v0)) + (let (v9 u32) (add.checked v8 8)) + (let (v10 (ptr felt)) (inttoptr v9)) + (let (v11 felt) (load v10)) + (let (v12 u32) (cast v0)) + (let (v13 u32) (add.checked v12 16)) + (let (v14 (ptr felt)) (inttoptr v13)) + (let (v15 felt) (load v14)) + (let (v16 u32) (cast v0)) + (let (v17 u32) (add.checked v16 24)) + (let (v18 (ptr felt)) (inttoptr v17)) + (let (v19 felt) (load v18)) + (let (v20 u32) (cast v3)) + (let (v21 (ptr felt)) (inttoptr v20)) + (let (v22 felt) (load v21)) + (let (v23 u32) (cast v3)) + (let (v24 u32) (add.checked v23 8)) + (let (v25 (ptr felt)) (inttoptr v24)) + (let (v26 felt) (load v25)) + (let (v27 u32) (cast v3)) + (let (v28 u32) (add.checked v27 16)) + (let (v29 (ptr felt)) (inttoptr v28)) + (let (v30 felt) (load v29)) + (let (v31 u32) (cast v3)) + (let (v32 u32) (add.checked v31 24)) + (let (v33 (ptr felt)) (inttoptr v32)) + (let (v34 felt) (load v33)) + (let (v35 felt) (call (#miden:tx_kernel/tx #create_note) v7 v11 v15 v19 v1 v2 v22 v26 v30 v34)) + (br (block 1 v35))) + + (block 1 (param v4 felt) + (ret v4)) + ) + + ;; Imports + (func (import #miden:tx_kernel/account #add_asset) + (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)) + (func (import #miden:tx_kernel/account #remove_asset) + (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)) + (func (import #miden:tx_kernel/tx #create_note) + (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (param felt) (result felt)) + ) + +) diff --git a/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.masm b/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.masm new file mode 100644 index 000000000..69e62dea0 --- /dev/null +++ b/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.masm @@ -0,0 +1,802 @@ +mod rust_sdk_basic_wallet + +use.miden:tx_kernel/account +use.miden:tx_kernel/tx + +export.receive_asset + mem_load.0x00000000 + push.32 + u32wrapping_sub + push.32 + dup.1 + swap.1 + u32wrapping_add + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw + dup.0 + swap.1 + swap.2 + swap.1 + exec."_ZN19miden_sdk_tx_kernel9add_asset17h6f4cff304c095ffcE" + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw +end + + +export.send_asset + mem_load.0x00000000 + push.32 + u32wrapping_sub + dup.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.5 + swap.3 + swap.1 + exec."_ZN19miden_sdk_tx_kernel11create_note17h99477639e0ff4f18E" + push.32 + dup.3 + swap.1 + u32wrapping_add + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw + dup.2 + swap.1 + swap.2 + swap.1 + exec."_ZN19miden_sdk_tx_kernel12remove_asset17hf5f373d8386f7b96E" + movup.2 + swap.1 + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw + dropw +end + + +export."_ZN19miden_sdk_tx_kernel9add_asset17h6f4cff304c095ffcE" + mem_load.0x00000000 + push.32 + u32wrapping_sub + dup.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.3 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.24 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.4 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.16 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.5 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.8 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + movup.6 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + exec.miden:tx_kernel/account::add_asset + push.32 + dup.6 + swap.1 + u32wrapping_add + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw + dup.5 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + dup.8 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + push.8 + dup.6 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + push.8 + dup.9 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + push.16 + dup.6 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + push.16 + dup.9 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + push.24 + dup.6 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + push.24 + movup.9 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + dup.4 + add.24 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + dup.3 + add.16 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + dup.2 + add.8 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + swap.1 + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw +end + + +export."_ZN19miden_sdk_tx_kernel12remove_asset17hf5f373d8386f7b96E" + mem_load.0x00000000 + push.32 + u32wrapping_sub + dup.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.3 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.24 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.4 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.16 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.5 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.8 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + movup.6 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + exec.miden:tx_kernel/account::remove_asset + push.32 + dup.6 + swap.1 + u32wrapping_add + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw + dup.5 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + dup.8 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + push.8 + dup.6 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + push.8 + dup.9 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + push.16 + dup.6 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + push.16 + dup.9 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + push.24 + dup.6 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_dw + push.24 + movup.9 + swap.1 + u32wrapping_add + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_dw + dup.4 + add.24 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + dup.3 + add.16 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + dup.2 + add.8 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + swap.1 + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_felt + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::store_sw +end + + +export."_ZN19miden_sdk_tx_kernel11create_note17h99477639e0ff4f18E" + dup.3 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.24 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.4 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.16 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.5 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.8 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + movup.6 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.4 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.24 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.5 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.16 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + dup.6 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + add.8 + u32assert + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + movup.7 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + dup.0 + u32mod.16 + dup.0 + u32mod.4 + swap.1 + u32div.4 + movup.2 + u32div.16 + exec.intrinsics::mem::load_felt + movup.5 + swap.7 + swap.9 + movdn.5 + movup.4 + swap.6 + swap.8 + movdn.4 + exec.miden:tx_kernel/tx::create_note +end + + diff --git a/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.wat b/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.wat new file mode 100644 index 000000000..45e3048ae --- /dev/null +++ b/tests/integration/expected/rust_sdk_basic_wallet/rust_sdk_basic_wallet.wat @@ -0,0 +1,174 @@ +(module $rust_sdk_basic_wallet.wasm + (type (;0;) (func (param f64 f64 f64 f64 i32))) + (type (;1;) (func (param f64 f64 f64 f64 f64 f64 f64 f64 f64 f64) (result f64))) + (type (;2;) (func (param i32))) + (type (;3;) (func (param i32 f64 f64 i32))) + (type (;4;) (func (param i32 i32))) + (type (;5;) (func (param i32 f64 f64 i32) (result f64))) + (import "miden:tx_kernel/account" "add_asset<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_add_asset (;0;) (type 0))) + (import "miden:tx_kernel/account" "remove_asset<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_account_remove_asset (;1;) (type 0))) + (import "miden:tx_kernel/tx" "create_note<0x0000000000000000000000000000000000000000000000000000000000000000>" (func $miden_sdk_tx_kernel::externs::extern_tx_create_note (;2;) (type 1))) + (func $receive_asset (;3;) (type 2) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + local.get 0 + call $miden_sdk_tx_kernel::add_asset + local.get 1 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $send_asset (;4;) (type 3) (param i32 f64 f64 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 4 + global.set $__stack_pointer + local.get 4 + local.get 0 + call $miden_sdk_tx_kernel::remove_asset + local.get 4 + local.get 1 + local.get 2 + local.get 3 + call $miden_sdk_tx_kernel::create_note + drop + local.get 4 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_sdk_tx_kernel::add_asset (;5;) (type 4) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f64.load + local.get 1 + f64.load offset=8 + local.get 1 + f64.load offset=16 + local.get 1 + f64.load offset=24 + local.get 2 + call $miden_sdk_tx_kernel::externs::extern_account_add_asset + local.get 0 + i32.const 24 + i32.add + local.get 2 + i32.const 24 + i32.add + i64.load + i64.store + local.get 0 + i32.const 16 + i32.add + local.get 2 + i32.const 16 + i32.add + i64.load + i64.store + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.const 8 + i32.add + i64.load + i64.store + local.get 0 + local.get 2 + i64.load + i64.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_sdk_tx_kernel::remove_asset (;6;) (type 4) (param i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f64.load + local.get 1 + f64.load offset=8 + local.get 1 + f64.load offset=16 + local.get 1 + f64.load offset=24 + local.get 2 + call $miden_sdk_tx_kernel::externs::extern_account_remove_asset + local.get 0 + i32.const 24 + i32.add + local.get 2 + i32.const 24 + i32.add + i64.load + i64.store + local.get 0 + i32.const 16 + i32.add + local.get 2 + i32.const 16 + i32.add + i64.load + i64.store + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.const 8 + i32.add + i64.load + i64.store + local.get 0 + local.get 2 + i64.load + i64.store + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_sdk_tx_kernel::create_note (;7;) (type 5) (param i32 f64 f64 i32) (result f64) + local.get 0 + f64.load + local.get 0 + f64.load offset=8 + local.get 0 + f64.load offset=16 + local.get 0 + f64.load offset=24 + local.get 1 + local.get 2 + local.get 3 + f64.load + local.get 3 + f64.load offset=8 + local.get 3 + f64.load offset=16 + local.get 3 + f64.load offset=24 + call $miden_sdk_tx_kernel::externs::extern_tx_create_note + ) + (table (;0;) 1 1 funcref) + (memory (;0;) 16) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "receive_asset" (func $receive_asset)) + (export "send_asset" (func $send_asset)) +) \ No newline at end of file diff --git a/tests/integration/src/cargo_proj/mod.rs b/tests/integration/src/cargo_proj/mod.rs index 12853e47b..ff46ec43f 100644 --- a/tests/integration/src/cargo_proj/mod.rs +++ b/tests/integration/src/cargo_proj/mod.rs @@ -363,7 +363,7 @@ pub fn basic_manifest(name: &str, version: &str) -> String { name = "{}" version = "{}" authors = [] - edition = "2015" + edition = "2021" "#, name, version ) @@ -377,7 +377,7 @@ pub fn basic_bin_manifest(name: &str) -> String { name = "{}" version = "0.5.0" authors = ["wycats@example.com"] - edition = "2015" + edition = "2021" [[bin]] @@ -395,7 +395,7 @@ pub fn basic_lib_manifest(name: &str) -> String { name = "{}" version = "0.5.0" authors = ["wycats@example.com"] - edition = "2015" + edition = "2021" [lib] diff --git a/tests/integration/src/compiler_test.rs b/tests/integration/src/compiler_test.rs index 0d1ee9d9e..fc3d92cbc 100644 --- a/tests/integration/src/compiler_test.rs +++ b/tests/integration/src/compiler_test.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use core::panic; use std::{ fs, @@ -356,10 +358,7 @@ impl CompilerTest { /// Set the Rust source code to compile with `miden-prelude` (stdlib + intrinsics) pub fn rust_fn_body_with_prelude(name: &str, rust_source: &str, is_build_std: bool) -> Self { - let cwd = std::env::current_dir().unwrap(); - let miden_prelude_path = - cwd.parent().unwrap().parent().unwrap().join("sdk").join("prelude"); - let miden_prelude_path_str = miden_prelude_path.to_str().unwrap(); + let miden_prelude_path_str = prelude_crate_path(); // dbg!(&miden_prelude_path); let proj = project(name) .file( @@ -369,7 +368,7 @@ impl CompilerTest { [package] name = "{name}" version = "0.0.1" - edition = "2015" + edition = "2021" authors = [] [dependencies] @@ -553,6 +552,31 @@ impl CompilerTest { } } +fn prelude_crate_path() -> String { + let cwd = std::env::current_dir().unwrap(); + cwd.parent() + .unwrap() + .parent() + .unwrap() + .join("sdk") + .join("prelude") + .to_str() + .unwrap() + .to_string() +} + +pub fn sdk_crate_path() -> String { + let cwd = std::env::current_dir().unwrap(); + cwd.parent() + .unwrap() + .parent() + .unwrap() + .join("sdk") + .join("sdk") + .to_str() + .unwrap() + .to_string() +} /// Get the directory for the top-level workspace fn get_workspace_dir() -> String { // Get the directory for the integration test suite project diff --git a/tests/integration/src/rust_masm_tests/components.rs b/tests/integration/src/rust_masm_tests/components.rs index c1f5d13c2..8cb7d2f99 100644 --- a/tests/integration/src/rust_masm_tests/components.rs +++ b/tests/integration/src/rust_masm_tests/components.rs @@ -16,7 +16,7 @@ fn wcm_no_imports() { [package] name = "add-wasm-component" version = "0.0.1" - edition = "2015" + edition = "2021" authors = [] [dependencies] @@ -132,7 +132,7 @@ fn wcm_import() { [package] name = "inc-wasm-component" version = "0.0.1" - edition = "2015" + edition = "2021" authors = [] [dependencies] diff --git a/tests/integration/src/rust_masm_tests/rust_sdk.rs b/tests/integration/src/rust_masm_tests/rust_sdk.rs index 4e6f55e26..3a1c83d2c 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use expect_test::expect_file; -use crate::CompilerTest; +use crate::{cargo_proj::project, compiler_test::sdk_crate_path, CompilerTest}; #[test] fn account() { @@ -18,7 +18,76 @@ fn account() { test.expect_ir(expect_file![format!( "../../expected/rust_sdk_account_test/{artifact_name}.hir" )]); - test.expect_masm(expect_file![format!( - "../../expected/rust_sdk_account_test/{artifact_name}.masm" - )]); + // test.expect_masm(expect_file![format!( + // "../../expected/rust_sdk_account_test/{artifact_name}.masm" + // )]); +} + +#[test] +fn basic_wallet() { + let sdk_crate_path = sdk_crate_path(); + let project_name = "rust_sdk_basic_wallet"; + let proj = project(project_name) + .file( + "Cargo.toml", + format!( + r#" + + [package] + name = "{project_name}" + version = "0.0.1" + edition = "2021" + authors = [] + + [dependencies] + wee_alloc = {{ version = "0.4.5", default-features = false}} + miden-sdk = {{ path = "{sdk_crate_path}" }} + + [lib] + crate-type = ["cdylib"] + + [profile.release] + panic = "abort" + # optimize for size + opt-level = "z" + "#).as_str() + ) + .file( + "src/lib.rs", + r#" + #![no_std] + + #[panic_handler] + fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} + } + + #[global_allocator] + static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + + use miden_sdk::*; + + pub struct Account; + + impl Account { + #[no_mangle] + pub fn receive_asset(asset: CoreAsset) { + add_asset(asset); + } + + #[no_mangle] + pub fn send_asset(asset: CoreAsset, tag: Tag, note_type: NoteType, recipient: Recipient) { + let asset = remove_asset(asset); + create_note(asset, tag, note_type, recipient); + } + } + "#, + ) + .build(); + + let mut test = CompilerTest::rust_source_cargo_lib(proj.root(), true, None); + let artifact_name = test.source.artifact_name(); + test.expect_wasm(expect_file![format!("../../expected/{project_name}/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../../expected/{project_name}/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../../expected/{project_name}/{artifact_name}.masm")]); } diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs index 907260782..81e8b9667 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/account-test/src/lib.rs @@ -1,26 +1,103 @@ -#![no_std] - -#[panic_handler] -fn my_panic(_info: &core::panic::PanicInfo) -> ! { - loop {} -} - #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +extern crate alloc; + use miden_sdk::*; pub struct Account; impl Account { #[no_mangle] - pub fn receive_asset(asset: CoreAsset) { - add_asset(asset); + pub fn get_wallet_magic_number() -> Felt { + let acc_id = get_id(); + let magic = felt!(42); + magic + acc_id.into() + } + + #[no_mangle] + pub fn test_add_asset() -> Felt { + let asset_in = CoreAsset::new([felt!(1), felt!(2), felt!(3), felt!(4)]); + let asset_out = add_asset(asset_in); + asset_out.as_word()[0] } #[no_mangle] - pub fn send_asset(asset: CoreAsset, tag: Tag, note_type: NoteType, recipient: Recipient) { - let asset = remove_asset(asset); - create_note(asset, tag, note_type, recipient); + pub fn test_felt_ops_smoke(a: Felt, b: Felt) -> Felt { + let d = a.as_u64(); + if a > b { + a.inv() + b + } else if a < b { + a.exp(b) - b + } else if a <= b { + a.pow2() * b + } else if a >= b { + b / a + } else if a == b { + assert_eq(a, b); + a + Felt::from_u64_unchecked(d) + } else if a != b { + -a + } else if b.is_odd() { + assert(a); + b + } else { + assertz(b); + a + } } } + +pub struct Note; + +impl Note { + #[no_mangle] + pub fn note_script() -> Felt { + let mut sum = Felt::new(0).unwrap(); + for input in get_inputs() { + sum = sum + input; + } + sum + } +} + +#[no_mangle] +pub fn test_blake3_hash_1to1(input: [u8; 32]) -> [u8; 32] { + blake3_hash_1to1(input) +} + +#[no_mangle] +pub fn test_blake3_hash_2to1(input1: [u8; 32], input2: [u8; 32]) -> [u8; 32] { + blake3_hash_2to1(input1, input2) +} + +#[no_mangle] +pub fn test_rpo_falcon512_verify(pk: Word, msg: Word) { + rpo_falcon512_verify(pk, msg) +} + +#[no_mangle] +pub fn test_pipe_words_to_memory(num_words: Felt) -> (Word, Vec) { + pipe_words_to_memory(num_words) +} + +#[no_mangle] +pub fn test_pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { + pipe_double_words_to_memory(num_words) +} + +#[no_mangle] +pub fn test_remove_asset(asset: CoreAsset) -> Felt { + let asset_out = remove_asset(asset); + asset_out.as_word()[0] +} + +#[no_mangle] +pub fn test_create_note( + asset: CoreAsset, + tag: Tag, + note_type: NoteType, + recipient: Recipient, +) -> NoteId { + create_note(asset, tag, note_type, recipient) +}