diff --git a/Cargo.lock b/Cargo.lock index 71f64f087..2d35d5e9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1181,7 +1181,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -2482,9 +2482,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -2494,6 +2502,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -2519,6 +2528,7 @@ dependencies = [ "midenc-expect-test", "midenc-frontend-wasm", "midenc-session", + "p3-field", ] [[package]] @@ -2596,7 +2606,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -2745,6 +2755,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-standards" version = "0.13.3" @@ -3521,6 +3539,162 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools 0.14.0", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools 0.14.0", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools 0.14.0", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools 0.14.0", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools 0.14.0", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "page_size" version = "0.6.0" @@ -4616,6 +4790,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -4638,6 +4821,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string-interner" version = "0.19.0" @@ -5285,6 +5474,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "try-lock" version = "0.2.5" diff --git a/Cargo.toml b/Cargo.toml index 0c6386387..c5f5a1f0a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ members = [ "midenc-driver", "midenc-session", "sdk/field-repr/*", - "sdk/field", "sdk/alloc", "sdk/base", "sdk/base-macros", @@ -153,6 +152,8 @@ miden-integration-tests = { path = "tests/integration" } midenc-expect-test = { path = "tools/expect-test" } miden-test-harness = { path = "test-harness/test-harness-lib" } miden-test-harness-macros = { path = "test-harness/test-harness-macros" } +# TODO: switch to version after miden-crypto release +miden-field = { path = "../../unified-felt/crypto/miden-field", version = "0.22" } [patch.crates-io] #miden-assembly = { git = "https://github.com/0xMiden/miden-vm", rev = "614cd7f9b52f45238b0ab59c71ebb49325051e5d" } diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 434cb0288..4f7000ace 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -569,7 +569,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1179,9 +1179,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1191,6 +1199,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1241,7 +1250,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1326,6 +1335,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2077,6 +2250,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2087,6 +2269,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2382,6 +2570,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.110" diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index 5833c1a06..512b095b4 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/basic-wallet-tx-script/src/lib.rs b/examples/basic-wallet-tx-script/src/lib.rs index ae7c5d627..a13d7eb0d 100644 --- a/examples/basic-wallet-tx-script/src/lib.rs +++ b/examples/basic-wallet-tx-script/src/lib.rs @@ -24,9 +24,9 @@ const ASSET_END: usize = 10; #[tx_script] fn run(arg: Word, account: &mut Account) { let num_felts = adv_push_mapvaln(arg.clone()); - let num_felts_u64 = num_felts.as_u64(); + let num_felts_u64 = num_felts.as_canonical_u64(); assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); - let num_words = Felt::from_u64_unchecked(num_felts_u64 / 4); + let num_words = Felt::new(num_felts_u64 / 4); let commitment = arg; let input = adv_load_preimage(num_words, commitment); let tag = input[TAG_INDEX]; diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index 70be2fb68..0a8cdcbdf 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index 4a952e6cb..c0f6524d4 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/counter-contract/src/lib.rs b/examples/counter-contract/src/lib.rs index cfea0814f..a0f636356 100644 --- a/examples/counter-contract/src/lib.rs +++ b/examples/counter-contract/src/lib.rs @@ -21,16 +21,18 @@ struct CounterContract { impl CounterContract { /// Returns the current counter value stored in the contract's storage map. pub fn get_count(&self) -> Felt { - let key = Word::from_u64_unchecked(0, 0, 0, 1); - self.count_map.get(&key) + let key = Word::new([Felt::ZERO, Felt::ZERO, Felt::ZERO, felt!(1)]); + let word: Word = self.count_map.get(&key); + word[3] } /// Increments the counter value stored in the contract's storage map by one. pub fn increment_count(&mut self) -> Felt { - let key = Word::from_u64_unchecked(0, 0, 0, 1); - let current_value: Felt = self.count_map.get(&key); - let new_value = current_value + felt!(1); - self.count_map.set(key, new_value); + let key = Word::new([Felt::ZERO, Felt::ZERO, Felt::ZERO, felt!(1)]); + let current_value_word: Word = self.count_map.get(&key); + let new_value = current_value_word[3] + felt!(1); + let new_value_word = Word::new([Felt::ZERO, Felt::ZERO, Felt::ZERO, new_value]); + self.count_map.set(key, new_value_word); new_value } } diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index 9fbd5a4e6..0e68c5cf7 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/counter-note/src/lib.rs b/examples/counter-note/src/lib.rs index 2d480918b..11f1016c0 100644 --- a/examples/counter-note/src/lib.rs +++ b/examples/counter-note/src/lib.rs @@ -21,7 +21,7 @@ impl CounterNote { pub fn run(self, _arg: Word) { let initial_value = counter_contract::get_count(); counter_contract::increment_count(); - let expected_value = initial_value + Felt::from_u32(1); + let expected_value = initial_value + felt!(1); let final_value = counter_contract::get_count(); assert_eq(final_value, expected_value); } diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index bbab11dc1..18afc203a 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -521,7 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -555,7 +555,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1165,9 +1165,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1177,6 +1185,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1227,7 +1236,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1312,6 +1321,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ dependencies = [ "miden", ] +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index a4cc09fd5..8a2732395 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -555,7 +555,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1165,9 +1165,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1177,6 +1185,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1227,7 +1236,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1312,6 +1321,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ dependencies = [ "miden", ] +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 4afbd3d52..adb6e6724 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -555,7 +555,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1165,9 +1165,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1177,6 +1185,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1227,7 +1236,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1312,6 +1321,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1545,6 +1562,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2085,6 +2258,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "miden", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/examples/storage-example/src/lib.rs b/examples/storage-example/src/lib.rs index ad88966db..0ddc29ea9 100644 --- a/examples/storage-example/src/lib.rs +++ b/examples/storage-example/src/lib.rs @@ -32,13 +32,15 @@ impl foo::Guest for MyAccount { let mut my_account = MyAccount::default(); let owner_key: Word = my_account.owner_public_key.read(); if pub_key == owner_key { - my_account.asset_qty_map.set(asset, qty); + let new_value_word = Word::new([qty, Felt::ZERO, Felt::ZERO, Felt::ZERO]); + my_account.asset_qty_map.set(asset.into(), new_value_word); } } /// Returns the stored quantity for `asset`, or 0 if not present. fn get_asset_qty(asset: Asset) -> Felt { let my_account = MyAccount::default(); - my_account.asset_qty_map.get(&asset) + let word: Word = my_account.asset_qty_map.get(&asset); + word[3] } } diff --git a/sdk/base-macros/src/component_macro/storage.rs b/sdk/base-macros/src/component_macro/storage.rs index b85d8a06a..81fcbb73a 100644 --- a/sdk/base-macros/src/component_macro/storage.rs +++ b/sdk/base-macros/src/component_macro/storage.rs @@ -87,8 +87,8 @@ fn slot_id_tokens(id: miden_protocol::account::StorageSlotId) -> proc_macro2::To let prefix = id.prefix().as_int(); quote! { ::miden::StorageSlotId::new( - ::miden::Felt::from_u64_unchecked(#suffix), - ::miden::Felt::from_u64_unchecked(#prefix), + ::miden::Felt::new(#suffix), + ::miden::Felt::new(#prefix), ) } } diff --git a/sdk/base-macros/wit/miden.wit b/sdk/base-macros/wit/miden.wit index 2820dc315..c62f81960 100644 --- a/sdk/base-macros/wit/miden.wit +++ b/sdk/base-macros/wit/miden.wit @@ -13,9 +13,11 @@ interface core-types { /// A group of four field elements in the Miden base field. - // type word = tuple; record word { - inner: tuple + a: felt, + b: felt, + c: felt, + d: felt, } /// A cryptographic digest representing a 256-bit hash value. diff --git a/sdk/base-sys/src/bindings/active_account.rs b/sdk/base-sys/src/bindings/active_account.rs index b335761e4..358d447b8 100644 --- a/sdk/base-sys/src/bindings/active_account.rs +++ b/sdk/base-sys/src/bindings/active_account.rs @@ -70,7 +70,7 @@ pub fn get_initial_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_get_initial_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -80,7 +80,7 @@ pub fn compute_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_compute_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -90,7 +90,7 @@ pub fn get_code_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_get_code_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -100,7 +100,7 @@ pub fn get_initial_storage_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_get_initial_storage_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -110,7 +110,7 @@ pub fn compute_storage_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_compute_storage_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -139,7 +139,7 @@ pub fn has_non_fungible_asset(asset: Asset) -> bool { asset.inner[2], asset.inner[1], asset.inner[0], - ) != Felt::from_u32(0) + ) != Felt::new(0) } } @@ -149,7 +149,7 @@ pub fn get_initial_vault_root() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_get_initial_vault_root(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -159,7 +159,7 @@ pub fn get_vault_root() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_active_account_get_vault_root(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -174,8 +174,8 @@ pub fn get_num_procedures() -> Felt { pub fn get_procedure_root(index: u8) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - extern_active_account_get_procedure_root(index.into(), ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + extern_active_account_get_procedure_root(Felt::new(index as u64), ret_area.as_mut_ptr()); + ret_area.assume_init().reversed() } } @@ -184,7 +184,7 @@ pub fn get_procedure_root(index: u8) -> Word { pub fn has_procedure(proc_root: Word) -> bool { unsafe { extern_active_account_has_procedure(proc_root[3], proc_root[2], proc_root[1], proc_root[0]) - != Felt::from_u32(0) + != Felt::new(0) } } diff --git a/sdk/base-sys/src/bindings/active_note.rs b/sdk/base-sys/src/bindings/active_note.rs index 88d2a8c33..5a9f968e1 100644 --- a/sdk/base-sys/src/bindings/active_note.rs +++ b/sdk/base-sys/src/bindings/active_note.rs @@ -95,7 +95,7 @@ pub fn get_recipient() -> Recipient { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_note_get_recipient(ret_area.as_mut_ptr()); let mut recipient = ret_area.assume_init(); - recipient.inner = recipient.inner.reverse(); + recipient.inner = recipient.inner.reversed(); recipient } } @@ -105,7 +105,7 @@ pub fn get_script_root() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_note_get_script_root(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -114,7 +114,7 @@ pub fn get_serial_number() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_note_get_serial_number(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -123,7 +123,7 @@ pub fn get_metadata() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_note_get_metadata(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } diff --git a/sdk/base-sys/src/bindings/asset.rs b/sdk/base-sys/src/bindings/asset.rs index 4f1e58e99..c809faeff 100644 --- a/sdk/base-sys/src/bindings/asset.rs +++ b/sdk/base-sys/src/bindings/asset.rs @@ -33,7 +33,7 @@ pub fn build_fungible_asset(faucet_id: AccountId, amount: Felt) -> Asset { amount, ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -50,6 +50,6 @@ pub fn build_non_fungible_asset(faucet_id: AccountId, data_hash: Word) -> Asset data_hash[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } diff --git a/sdk/base-sys/src/bindings/faucet.rs b/sdk/base-sys/src/bindings/faucet.rs index 33ced3fd0..db03263d3 100644 --- a/sdk/base-sys/src/bindings/faucet.rs +++ b/sdk/base-sys/src/bindings/faucet.rs @@ -51,7 +51,7 @@ pub fn create_fungible_asset(amount: Felt) -> Asset { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_faucet_create_fungible_asset(amount, ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -66,7 +66,7 @@ pub fn create_non_fungible_asset(data_hash: Word) -> Asset { data_hash[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -81,7 +81,7 @@ pub fn mint(asset: Asset) -> Asset { asset.inner[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -96,7 +96,7 @@ pub fn burn(asset: Asset) -> Asset { asset.inner[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -116,6 +116,6 @@ pub fn is_non_fungible_asset_issued(asset: Asset) -> bool { asset.inner[1], asset.inner[0], ); - result != Felt::from_u32(0) + result != Felt::new(0) } } diff --git a/sdk/base-sys/src/bindings/input_note.rs b/sdk/base-sys/src/bindings/input_note.rs index 8cfc72909..d6109f268 100644 --- a/sdk/base-sys/src/bindings/input_note.rs +++ b/sdk/base-sys/src/bindings/input_note.rs @@ -51,7 +51,7 @@ pub fn get_assets_info(note_index: NoteIdx) -> InputNoteAssetsInfo { extern_input_note_get_assets_info(note_index.inner, ret_area.as_mut_ptr()); let (commitment, num_assets) = ret_area.assume_init(); InputNoteAssetsInfo { - commitment: commitment.reverse(), + commitment: commitment.reversed(), num_assets, } } @@ -77,7 +77,7 @@ pub fn get_recipient(note_index: NoteIdx) -> Recipient { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_input_note_get_recipient(note_index.inner, ret_area.as_mut_ptr()); let mut recipient = ret_area.assume_init(); - recipient.inner = recipient.inner.reverse(); + recipient.inner = recipient.inner.reversed(); recipient } } @@ -87,7 +87,7 @@ pub fn get_metadata(note_index: NoteIdx) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_input_note_get_metadata(note_index.inner, ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -107,7 +107,7 @@ pub fn get_inputs_info(note_index: NoteIdx) -> InputNoteInputsInfo { extern_input_note_get_inputs_info(note_index.inner, ret_area.as_mut_ptr()); let (commitment, num_inputs) = ret_area.assume_init(); InputNoteInputsInfo { - commitment: commitment.reverse(), + commitment: commitment.reversed(), num_inputs, } } @@ -118,7 +118,7 @@ pub fn get_script_root(note_index: NoteIdx) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_input_note_get_script_root(note_index.inner, ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -127,6 +127,6 @@ pub fn get_serial_number(note_index: NoteIdx) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_input_note_get_serial_number(note_index.inner, ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } diff --git a/sdk/base-sys/src/bindings/native_account.rs b/sdk/base-sys/src/bindings/native_account.rs index 5ff4fdfa2..4372a8b85 100644 --- a/sdk/base-sys/src/bindings/native_account.rs +++ b/sdk/base-sys/src/bindings/native_account.rs @@ -92,7 +92,7 @@ pub fn remove_asset(asset: Asset) -> Asset { asset.inner[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -108,7 +108,7 @@ pub fn compute_delta_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_native_account_compute_delta_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -121,7 +121,7 @@ pub fn was_procedure_called(proc_root: Word) -> bool { proc_root[2], proc_root[1], proc_root[0], - ) != Felt::from_u32(0) + ) != Felt::new(0) } } diff --git a/sdk/base-sys/src/bindings/output_note.rs b/sdk/base-sys/src/bindings/output_note.rs index 88fba0d53..d98c53f6e 100644 --- a/sdk/base-sys/src/bindings/output_note.rs +++ b/sdk/base-sys/src/bindings/output_note.rs @@ -197,7 +197,7 @@ pub fn get_assets_info(note_index: NoteIdx) -> OutputNoteAssetsInfo { extern_output_note_get_assets_info(note_index.inner, ret_area.as_mut_ptr()); let (commitment, num_assets) = ret_area.assume_init(); OutputNoteAssetsInfo { - commitment: commitment.reverse(), + commitment: commitment.reversed(), num_assets, } } @@ -224,7 +224,7 @@ pub fn get_recipient(note_index: NoteIdx) -> Recipient { extern_output_note_get_recipient(note_index.inner, ret_area.as_mut_ptr()); let recipient = ret_area.assume_init(); Recipient { - inner: recipient.inner.reverse(), + inner: recipient.inner.reversed(), } } } @@ -234,6 +234,6 @@ pub fn get_metadata(note_index: NoteIdx) -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_output_note_get_metadata(note_index.inner, ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } diff --git a/sdk/base-sys/src/bindings/storage.rs b/sdk/base-sys/src/bindings/storage.rs index 6f144935a..bb2c58a8a 100644 --- a/sdk/base-sys/src/bindings/storage.rs +++ b/sdk/base-sys/src/bindings/storage.rs @@ -77,7 +77,7 @@ pub fn get_item(slot_id: StorageSlotId) -> Word { let (prefix, suffix) = slot_id.to_prefix_suffix(); extern_get_storage_item(prefix, suffix, ret_area.as_mut_ptr()); let word = ret_area.assume_init(); - word.reverse() + word.reversed() } } @@ -88,7 +88,7 @@ pub fn get_initial_item(slot_id: StorageSlotId) -> Word { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); let (prefix, suffix) = slot_id.to_prefix_suffix(); extern_get_initial_storage_item(prefix, suffix, ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -118,7 +118,7 @@ pub fn set_item(slot_id: StorageSlotId, value: Word) -> Word { value[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -149,7 +149,7 @@ pub fn get_map_item(slot_id: StorageSlotId, key: &Word) -> Word { key[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -168,7 +168,7 @@ pub fn get_initial_map_item(slot_id: StorageSlotId, key: &Word) -> Word { key[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -204,6 +204,6 @@ pub fn set_map_item(slot_id: StorageSlotId, key: Word, value: Word) -> Word { value[0], ret_area.as_mut_ptr(), ); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } diff --git a/sdk/base-sys/src/bindings/tx.rs b/sdk/base-sys/src/bindings/tx.rs index 0d7c212e4..4253617ad 100644 --- a/sdk/base-sys/src/bindings/tx.rs +++ b/sdk/base-sys/src/bindings/tx.rs @@ -40,7 +40,7 @@ pub fn get_input_notes_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_tx_get_input_notes_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -49,7 +49,7 @@ pub fn get_block_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_tx_get_block_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } @@ -85,6 +85,6 @@ pub fn get_output_notes_commitment() -> Word { unsafe { let mut ret_area = ::core::mem::MaybeUninit::::uninit(); extern_tx_get_output_notes_commitment(ret_area.as_mut_ptr()); - ret_area.assume_init().reverse() + ret_area.assume_init().reversed() } } diff --git a/sdk/base-sys/src/bindings/types.rs b/sdk/base-sys/src/bindings/types.rs index fddfa4170..ce6c72128 100644 --- a/sdk/base-sys/src/bindings/types.rs +++ b/sdk/base-sys/src/bindings/types.rs @@ -1,6 +1,7 @@ extern crate alloc; use alloc::vec::Vec; +use core::ops::Deref; use miden_field_repr::FromFeltRepr; use miden_stdlib_sys::{Digest, Felt, Word, hash_elements, intrinsics::crypto::merge}; @@ -63,9 +64,9 @@ impl Asset { } #[inline] - pub(crate) fn reverse(&self) -> Self { + pub(crate) fn reversed(&self) -> Self { Self { - inner: self.inner.reverse(), + inner: self.inner.reversed(), } } } @@ -88,8 +89,10 @@ impl From for Word { } } -impl AsRef for Asset { - fn as_ref(&self) -> &Word { +impl Deref for Asset { + type Target = Word; + + fn deref(&self) -> &Self::Target { &self.inner } } @@ -108,7 +111,7 @@ impl Recipient { /// /// Where `inputs_commitment` is the RPO256 hash of the provided `inputs`. pub fn compute(serial_num: Word, script_digest: Digest, inputs: Vec) -> Self { - let empty_word = Word::from_u64_unchecked(0, 0, 0, 0); + let empty_word = Word::empty(); let serial_num_hash = merge([Digest::from_word(serial_num), Digest::from_word(empty_word)]); let merge_script = merge([serial_num_hash, script_digest]); diff --git a/sdk/base/src/types/storage.rs b/sdk/base/src/types/storage.rs index ee5538ce6..94dd10d6b 100644 --- a/sdk/base/src/types/storage.rs +++ b/sdk/base/src/types/storage.rs @@ -37,18 +37,16 @@ pub struct StorageMap { pub slot: StorageSlotId, } -impl + AsRef, V: From + Into> StorageMapAccess - for StorageMap -{ +impl + Into> StorageMapAccess for StorageMap { /// Returns a map item value from the account storage. #[inline(always)] - fn get(&self, key: &K) -> V { - storage::get_map_item(self.slot, key.as_ref()).into() + fn get(&self, key: &Word) -> V { + storage::get_map_item(self.slot, key).into() } /// Sets a map item `value` in the account storage and returns the previous value. #[inline(always)] - fn set(&mut self, key: K, value: V) -> V { - storage::set_map_item(self.slot, key.into(), value.into()).into() + fn set(&mut self, key: Word, value: V) -> V { + storage::set_map_item(self.slot, key, value.into()).into() } } diff --git a/sdk/field-repr/derive/README.md b/sdk/field-repr/derive/README.md index aa241d1b4..9db082834 100644 --- a/sdk/field-repr/derive/README.md +++ b/sdk/field-repr/derive/README.md @@ -21,8 +21,8 @@ struct AccountId { } let value = AccountId { - prefix: Felt::from_u64_unchecked(1), - suffix: Felt::from_u64_unchecked(2), + prefix: Felt::new(1), + suffix: Felt::new(2), }; let felts = value.to_felt_repr(); let roundtrip = AccountId::from(felts.as_slice()); @@ -45,7 +45,7 @@ enum Message { // Ping -> tag = 0 // Transfer -> tag = 1 let value = Message::Transfer { - to: Felt::from_u64_unchecked(7), + to: Felt::new(7), amount: 10, }; let felts = value.to_felt_repr(); diff --git a/sdk/field-repr/repr/Cargo.toml b/sdk/field-repr/repr/Cargo.toml index 3538a8a0a..e963021c3 100644 --- a/sdk/field-repr/repr/Cargo.toml +++ b/sdk/field-repr/repr/Cargo.toml @@ -15,8 +15,9 @@ edition.workspace = true crate-type = ["rlib"] [dependencies] -miden-field = { version = "0.9.0", path = "../../field" } +miden-field.workspace = true miden-field-repr-derive = { path = "../derive", version = "0.9.0" } +p3-field = { version = "0.4.2", default-features = false } [target.'cfg(not(target_family = "wasm"))'.dependencies] miden-core.workspace = true diff --git a/sdk/field-repr/repr/src/lib.rs b/sdk/field-repr/repr/src/lib.rs index cf2ee7de4..fac3fb5a3 100644 --- a/sdk/field-repr/repr/src/lib.rs +++ b/sdk/field-repr/repr/src/lib.rs @@ -15,6 +15,8 @@ pub use miden_field::Felt; pub use miden_field_repr_derive::DeriveFromFeltRepr as FromFeltRepr; /// Re-export `DeriveToFeltRepr` as `ToFeltRepr` for `#[derive(ToFeltRepr)]` ergonomics. pub use miden_field_repr_derive::DeriveToFeltRepr as ToFeltRepr; +#[allow(unused_imports)] +use p3_field::PrimeField64; /// A reader that wraps a slice of `Felt` elements and tracks the current position. pub struct FeltReader<'a> { @@ -79,7 +81,7 @@ impl FromFeltRepr for Felt { impl FromFeltRepr for miden_core::Felt { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { - Self::from(reader.read()) + Self::new(reader.read().as_canonical_u64()) } } @@ -87,9 +89,9 @@ impl FromFeltRepr for u64 { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { // Encode u64 as 2 u32 limbs - let lo = reader.read().as_u64(); + let lo = reader.read().as_canonical_u64(); assert!(lo <= u32::MAX as u64, "u64: low limb out of range"); - let hi = reader.read().as_u64(); + let hi = reader.read().as_canonical_u64(); assert!(hi <= u32::MAX as u64, "u64: high limb out of range"); (hi << 32) | lo @@ -99,21 +101,21 @@ impl FromFeltRepr for u64 { impl FromFeltRepr for u32 { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { - reader.read().as_u64() as u32 + reader.read().as_canonical_u64() as u32 } } impl FromFeltRepr for u8 { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { - reader.read().as_u64() as u8 + reader.read().as_canonical_u64() as u8 } } impl FromFeltRepr for bool { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { - reader.read().as_u64() != 0 + reader.read().as_canonical_u64() != 0 } } @@ -128,7 +130,7 @@ where { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { - match reader.read().as_u64() { + match reader.read().as_canonical_u64() { 0 => None, 1 => Some(T::from_felt_repr(reader)), _ => panic!("Option: invalid tag"), @@ -145,7 +147,7 @@ where { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { - let len = reader.read().as_u64(); + let len = reader.read().as_canonical_u64(); assert!(len <= u32::MAX as u64, "Vec: length out of range"); let len = len as usize; @@ -185,7 +187,7 @@ impl ToFeltRepr for Felt { impl ToFeltRepr for miden_core::Felt { #[inline(always)] fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { - writer.write((*self).into()); + writer.write(Felt::new(self.as_int())); } } @@ -194,29 +196,29 @@ impl ToFeltRepr for u64 { fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { let lo = (*self & 0xffff_ffff) as u32; let hi = (*self >> 32) as u32; - writer.write(Felt::from_u32(lo)); - writer.write(Felt::from_u32(hi)); + writer.write(Felt::new(lo as u64)); + writer.write(Felt::new(hi as u64)); } } impl ToFeltRepr for u32 { #[inline(always)] fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { - writer.write(Felt::from_u64_unchecked(*self as u64)); + writer.write(Felt::new(*self as u64)); } } impl ToFeltRepr for u8 { #[inline(always)] fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { - writer.write(Felt::from_u64_unchecked(*self as u64)); + writer.write(Felt::new(*self as u64)); } } impl ToFeltRepr for bool { #[inline(always)] fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { - writer.write(Felt::from_u64_unchecked(*self as u64)); + writer.write(Felt::new(*self as u64)); } } @@ -232,9 +234,9 @@ where #[inline(always)] fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { match self { - None => writer.write(Felt::from_u64_unchecked(0)), + None => writer.write(Felt::new(0)), Some(value) => { - writer.write(Felt::from_u64_unchecked(1)); + writer.write(Felt::new(1)); value.write_felt_repr(writer); } } @@ -252,7 +254,7 @@ where fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { let len = self.len(); assert!(len <= u32::MAX as usize, "Vec: length out of range"); - writer.write(Felt::from_u64_unchecked(len as u64)); + writer.write(Felt::new(len as u64)); let mut i = 0usize; while i < len { diff --git a/sdk/field-repr/tests/Cargo.toml b/sdk/field-repr/tests/Cargo.toml index 98e3ba6d7..b0cb2310f 100644 --- a/sdk/field-repr/tests/Cargo.toml +++ b/sdk/field-repr/tests/Cargo.toml @@ -13,11 +13,12 @@ edition.workspace = true publish = false [dependencies] -miden-field = { path = "../../field", version = "0.9.0" } +miden-field.workspace = true miden-field-repr = { path = "../repr", version = "0.9.0" } miden-core.workspace = true [dev-dependencies] +p3-field = { version = "0.4.2", default-features = false } miden-integration-tests = { path = "../../../tests/integration" } midenc-frontend-wasm.workspace = true midenc-session.workspace = true diff --git a/sdk/field-repr/tests/src/offchain.rs b/sdk/field-repr/tests/src/offchain.rs index 705696eae..dbdfd1245 100644 --- a/sdk/field-repr/tests/src/offchain.rs +++ b/sdk/field-repr/tests/src/offchain.rs @@ -5,6 +5,7 @@ use miden_field::Felt; use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; +use p3_field::PrimeField64; /// Serializes `value` off-chain and deserializes it back, asserting equality. fn assert_roundtrip(value: &T) @@ -27,33 +28,33 @@ struct TwoFelts { #[test] fn test_serialization() { let value = TwoFelts { - a: Felt::from_u64_unchecked(12345), - b: Felt::from_u64_unchecked(67890), + a: Felt::new(12345), + b: Felt::new(67890), }; let felts = value.to_felt_repr(); assert_eq!(felts.len(), 2); - assert_eq!(felts[0], Felt::from_u64_unchecked(12345)); - assert_eq!(felts[1], Felt::from_u64_unchecked(67890)); + assert_eq!(felts[0], Felt::new(12345)); + assert_eq!(felts[1], Felt::new(67890)); } #[test] fn test_deserialization() { - let felts = [Felt::from_u64_unchecked(12345), Felt::from_u64_unchecked(67890)]; + let felts = [Felt::new(12345), Felt::new(67890)]; let mut reader = FeltReader::new(&felts); let value = TwoFelts::from_felt_repr(&mut reader); - assert_eq!(value.a, Felt::from_u64_unchecked(12345)); - assert_eq!(value.b, Felt::from_u64_unchecked(67890)); + assert_eq!(value.a, Felt::new(12345)); + assert_eq!(value.b, Felt::new(67890)); } #[test] fn test_roundtrip() { let original = TwoFelts { - a: Felt::from_u64_unchecked(12345), - b: Felt::from_u64_unchecked(67890), + a: Felt::new(12345), + b: Felt::new(67890), }; assert_roundtrip(&original); @@ -71,7 +72,7 @@ struct MixedStruct { #[test] fn test_struct_roundtrip_mixed_types() { let original = MixedStruct { - a: Felt::from_u64_unchecked(11), + a: Felt::new(11), b: 22, c: true, d: 33, @@ -79,10 +80,10 @@ fn test_struct_roundtrip_mixed_types() { let felts = original.to_felt_repr(); assert_eq!(felts.len(), 4); - assert_eq!(felts[0], Felt::from_u64_unchecked(11)); - assert_eq!(felts[1], Felt::from_u64_unchecked(22)); - assert_eq!(felts[2], Felt::from_u64_unchecked(1)); - assert_eq!(felts[3], Felt::from_u64_unchecked(33)); + assert_eq!(felts[0], Felt::new(11)); + assert_eq!(felts[1], Felt::new(22)); + assert_eq!(felts[2], Felt::new(1)); + assert_eq!(felts[3], Felt::new(33)); assert_roundtrip(&original); } @@ -107,7 +108,7 @@ fn test_struct_roundtrip_nested() { let original = Outer { head: 1, inner: Inner { - x: Felt::from_u64_unchecked(2), + x: Felt::new(2), y: 3, }, tail: false, @@ -115,11 +116,11 @@ fn test_struct_roundtrip_nested() { let felts = original.to_felt_repr(); assert_eq!(felts.len(), 5); - assert_eq!(felts[0], Felt::from_u64_unchecked(1)); - assert_eq!(felts[1], Felt::from_u64_unchecked(2)); - assert_eq!(felts[2], Felt::from_u64_unchecked(3)); - assert_eq!(felts[3], Felt::from_u64_unchecked(0)); - assert_eq!(felts[4], Felt::from_u64_unchecked(0)); + assert_eq!(felts[0], Felt::new(1)); + assert_eq!(felts[1], Felt::new(2)); + assert_eq!(felts[2], Felt::new(3)); + assert_eq!(felts[3], Felt::new(0)); + assert_eq!(felts[4], Felt::new(0)); assert_roundtrip(&original); } @@ -136,7 +137,7 @@ enum SimpleEnum { fn test_enum_roundtrip_unit() { let original = SimpleEnum::B; let felts = original.to_felt_repr(); - assert_eq!(felts, vec![Felt::from_u64_unchecked(1)]); + assert_eq!(felts, vec![Felt::new(1)]); assert_roundtrip(&original); } @@ -151,12 +152,12 @@ enum MixedEnum { #[test] fn test_enum_roundtrip_tuple_variant() { - let original = MixedEnum::Pair(Felt::from_u64_unchecked(7), 8); + let original = MixedEnum::Pair(Felt::new(7), 8); let felts = original.to_felt_repr(); assert_eq!(felts.len(), 3); - assert_eq!(felts[0], Felt::from_u64_unchecked(1)); - assert_eq!(felts[1], Felt::from_u64_unchecked(7)); - assert_eq!(felts[2], Felt::from_u64_unchecked(8)); + assert_eq!(felts[0], Felt::new(1)); + assert_eq!(felts[1], Felt::new(7)); + assert_eq!(felts[2], Felt::new(8)); assert_roundtrip(&original); } @@ -165,10 +166,10 @@ fn test_enum_roundtrip_struct_variant() { let original = MixedEnum::Struct { n: 9, flag: true }; let felts = original.to_felt_repr(); assert_eq!(felts.len(), 4); - assert_eq!(felts[0], Felt::from_u64_unchecked(2)); - assert_eq!(felts[1], Felt::from_u64_unchecked(9)); - assert_eq!(felts[2], Felt::from_u64_unchecked(0)); - assert_eq!(felts[3], Felt::from_u64_unchecked(1)); + assert_eq!(felts[0], Felt::new(2)); + assert_eq!(felts[1], Felt::new(9)); + assert_eq!(felts[2], Felt::new(0)); + assert_eq!(felts[3], Felt::new(1)); assert_roundtrip(&original); } @@ -183,9 +184,9 @@ struct WithEnum { #[test] fn test_struct_with_enum_roundtrip() { let original = WithEnum { - prefix: Felt::from_u64_unchecked(10), + prefix: Felt::new(10), msg: MixedEnum::Nested(Inner { - x: Felt::from_u64_unchecked(11), + x: Felt::new(11), y: 12, }), suffix: 13, @@ -194,12 +195,12 @@ fn test_struct_with_enum_roundtrip() { // prefix (1) + msg(tag=3 + Inner(3)) + suffix (1) = 6 felts let felts = original.to_felt_repr(); assert_eq!(felts.len(), 6); - assert_eq!(felts[0], Felt::from_u64_unchecked(10)); - assert_eq!(felts[1], Felt::from_u64_unchecked(3)); - assert_eq!(felts[2], Felt::from_u64_unchecked(11)); - assert_eq!(felts[3], Felt::from_u64_unchecked(12)); - assert_eq!(felts[4], Felt::from_u64_unchecked(0)); - assert_eq!(felts[5], Felt::from_u64_unchecked(13)); + assert_eq!(felts[0], Felt::new(10)); + assert_eq!(felts[1], Felt::new(3)); + assert_eq!(felts[2], Felt::new(11)); + assert_eq!(felts[3], Felt::new(12)); + assert_eq!(felts[4], Felt::new(0)); + assert_eq!(felts[5], Felt::new(13)); assert_roundtrip(&original); } @@ -214,7 +215,7 @@ enum Top { #[test] fn test_enum_nested_with_struct_roundtrip() { let original = Top::Some(WithEnum { - prefix: Felt::from_u64_unchecked(21), + prefix: Felt::new(21), msg: MixedEnum::Struct { n: 22, flag: false }, suffix: 23, }); @@ -236,22 +237,14 @@ struct WithOption { #[test] fn test_struct_roundtrip_option_some() { let original = WithOption { - prefix: Felt::from_u64_unchecked(5), + prefix: Felt::new(5), maybe: Some(42), suffix: true, }; let felts = original.to_felt_repr(); assert_eq!(felts.len(), 4); - assert_eq!( - felts, - vec![ - Felt::from_u64_unchecked(5), - Felt::from_u64_unchecked(1), - Felt::from_u64_unchecked(42), - Felt::from_u64_unchecked(1) - ] - ); + assert_eq!(felts, vec![Felt::new(5), Felt::new(1), Felt::new(42), Felt::new(1)]); assert_roundtrip(&original); } @@ -259,21 +252,14 @@ fn test_struct_roundtrip_option_some() { #[test] fn test_struct_roundtrip_option_none() { let original = WithOption { - prefix: Felt::from_u64_unchecked(7), + prefix: Felt::new(7), maybe: None, suffix: false, }; let felts = original.to_felt_repr(); assert_eq!(felts.len(), 3); - assert_eq!( - felts, - vec![ - Felt::from_u64_unchecked(7), - Felt::from_u64_unchecked(0), - Felt::from_u64_unchecked(0) - ] - ); + assert_eq!(felts, vec![Felt::new(7), Felt::new(0), Felt::new(0)]); assert_roundtrip(&original); } @@ -289,7 +275,7 @@ struct WithVec { #[test] fn test_struct_roundtrip_vec_non_empty() { let original = WithVec { - prefix: Felt::from_u64_unchecked(9), + prefix: Felt::new(9), items: vec![1, 2, 3], suffix: true, }; @@ -300,12 +286,12 @@ fn test_struct_roundtrip_vec_non_empty() { assert_eq!( felts, vec![ - Felt::from_u64_unchecked(9), - Felt::from_u64_unchecked(3), - Felt::from_u64_unchecked(1), - Felt::from_u64_unchecked(2), - Felt::from_u64_unchecked(3), - Felt::from_u64_unchecked(1), + Felt::new(9), + Felt::new(3), + Felt::new(1), + Felt::new(2), + Felt::new(3), + Felt::new(1), ] ); @@ -315,21 +301,14 @@ fn test_struct_roundtrip_vec_non_empty() { #[test] fn test_struct_roundtrip_vec_empty() { let original = WithVec { - prefix: Felt::from_u64_unchecked(10), + prefix: Felt::new(10), items: vec![], suffix: false, }; let felts = original.to_felt_repr(); assert_eq!(felts.len(), 3); - assert_eq!( - felts, - vec![ - Felt::from_u64_unchecked(10), - Felt::from_u64_unchecked(0), - Felt::from_u64_unchecked(0) - ] - ); + assert_eq!(felts, vec![Felt::new(10), Felt::new(0), Felt::new(0)]); assert_roundtrip(&original); } @@ -340,17 +319,10 @@ struct TupleStruct(u32, bool, Felt); #[test] fn test_tuple_struct_roundtrip() { - let original = TupleStruct(22, true, Felt::from_u64_unchecked(33)); + let original = TupleStruct(22, true, Felt::new(33)); let felts = original.to_felt_repr(); - assert_eq!( - felts, - vec![ - Felt::from_u64_unchecked(22), - Felt::from_u64_unchecked(1), - Felt::from_u64_unchecked(33) - ] - ); + assert_eq!(felts, vec![Felt::new(22), Felt::new(1), Felt::new(33)]); assert_roundtrip(&original); } @@ -365,8 +337,8 @@ fn test_u64_roundtrip_uses_u32_limbs() { let expected_lo = value & 0xffff_ffff; let expected_hi = value >> 32; - assert_eq!(felts[0].as_u64(), expected_lo); - assert_eq!(felts[1].as_u64(), expected_hi); + assert_eq!(felts[0].as_canonical_u64(), expected_lo); + assert_eq!(felts[1].as_canonical_u64(), expected_hi); let mut reader = FeltReader::new(&felts); let roundtripped = u64::from_felt_repr(&mut reader); diff --git a/sdk/field-repr/tests/src/onchain.rs b/sdk/field-repr/tests/src/onchain.rs index acd9557b3..7316bae8a 100644 --- a/sdk/field-repr/tests/src/onchain.rs +++ b/sdk/field-repr/tests/src/onchain.rs @@ -10,12 +10,17 @@ use miden_field::Felt; use miden_field_repr::{Felt as ReprFelt, FeltReader, FromFeltRepr, ToFeltRepr}; use miden_integration_tests::testing::{Initializer, eval_package}; use midenc_frontend_wasm::WasmTranslationConfig; +use p3_field::PrimeField64; use crate::build_felt_repr_test; /// Converts `miden-field-repr` felts to `miden-core` felts for VM memory initialization. fn to_core_felts(felts: &[ReprFelt]) -> Vec { - felts.iter().copied().map(Into::into).collect() + felts + .iter() + .copied() + .map(|felt| miden_core::Felt::new(felt.as_canonical_u64())) + .collect() } fn read_vec_felts( @@ -41,7 +46,7 @@ fn read_vec_felts( .read_from_rust_memory(word_addr) .unwrap_or_else(|| panic!("Failed to read word for element {i}")); let elem_in_word = ((byte_addr % 16) / 4) as usize; - result.push(word[elem_in_word].0.into()); + result.push(ReprFelt::new(word[elem_in_word].0.as_int())); } result @@ -58,8 +63,8 @@ struct TwoFelts { #[test] fn test_felt_reader() { let original = TwoFelts { - a: Felt::from_u64_unchecked(12345), - b: Felt::from_u64_unchecked(67890), + a: Felt::new(12345), + b: Felt::new(67890), }; let serialized = original.to_felt_repr(); @@ -86,8 +91,8 @@ fn test_felt_reader() { let out_byte_addr = out_elem_addr * 4; let input_word: Vec = vec![ - serialized[0].into(), - serialized[1].into(), + miden_core::Felt::new(serialized[0].as_canonical_u64()), + miden_core::Felt::new(serialized[1].as_canonical_u64()), miden_core::Felt::new(0), miden_core::Felt::new(0), ]; @@ -107,7 +112,10 @@ fn test_felt_reader() { .read_from_rust_memory(out_byte_addr) .expect("Failed to read result from memory"); - let result_felts = [result_word[0].0.into(), result_word[1].0.into()]; + let result_felts = [ + ReprFelt::new(result_word[0].0.as_int()), + ReprFelt::new(result_word[1].0.as_int()), + ]; let mut reader = FeltReader::new(&result_felts); let result_struct = TwoFelts::from_felt_repr(&mut reader); @@ -126,8 +134,8 @@ fn test_felt_reader() { #[test] fn test_two_felts_struct_round_trip() { let original = TwoFelts { - a: Felt::from_u64_unchecked(12345), - b: Felt::from_u64_unchecked(67890), + a: Felt::new(12345), + b: Felt::new(67890), }; let serialized = original.to_felt_repr(); @@ -156,7 +164,10 @@ fn test_two_felts_struct_round_trip() { let in_byte_addr = in_elem_addr * 4; let out_byte_addr = out_elem_addr * 4; - let input_felts: Vec = vec![serialized[0].into(), serialized[1].into()]; + let input_felts: Vec = vec![ + miden_core::Felt::new(serialized[0].as_canonical_u64()), + miden_core::Felt::new(serialized[1].as_canonical_u64()), + ]; let initializers = [Initializer::MemoryFelts { addr: in_elem_addr, @@ -193,16 +204,16 @@ struct FiveFelts { #[test] fn test_five_felts_struct_round_trip() { let original = FiveFelts { - a: Felt::from_u64_unchecked(11111), - b: Felt::from_u64_unchecked(22222), - c: Felt::from_u64_unchecked(33333), - d: Felt::from_u64_unchecked(44444), - e: Felt::from_u64_unchecked(55555), + a: Felt::new(11111), + b: Felt::new(22222), + c: Felt::new(33333), + d: Felt::new(44444), + e: Felt::new(55555), }; let serialized = original.to_felt_repr(); assert_eq!(serialized.len(), 5); - assert_eq!(serialized[4], Felt::from_u64_unchecked(55555)); + assert_eq!(serialized[4], Felt::new(55555)); let onchain_code = r#"(input: [Felt; 5]) -> Vec { use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; @@ -359,10 +370,10 @@ struct MixedTypesNoU64 { #[test] fn test_mixed_types_no_u64_round_trip() { let original = MixedTypesNoU64 { - f1: Felt::from_u64_unchecked(111111), - f2: Felt::from_u64_unchecked(222222), - f3: Felt::from_u64_unchecked(333333), - f4: Felt::from_u64_unchecked(444444), + f1: Felt::new(111111), + f2: Felt::new(222222), + f3: Felt::new(333333), + f4: Felt::new(444444), x: 55555, y: 66, }; @@ -450,9 +461,9 @@ struct Outer { #[test] fn test_nested_struct_round_trip() { let original = Outer { - a: Felt::from_u64_unchecked(111111), + a: Felt::new(111111), inner: Inner { - x: Felt::from_u64_unchecked(222222), + x: Felt::new(222222), y: 333333, }, b: 44444, @@ -544,14 +555,14 @@ fn test_enum_unit_round_trip() { } let original = Wrapper { - pad: Felt::from_u64_unchecked(999), + pad: Felt::new(999), value: SimpleEnum::B, }; let serialized = original.to_felt_repr(); assert_eq!(serialized.len(), 2); - assert_eq!(serialized[0], Felt::from_u64_unchecked(999)); - assert_eq!(serialized[1], Felt::from_u64_unchecked(1)); + assert_eq!(serialized[0], Felt::new(999)); + assert_eq!(serialized[1], Felt::new(1)); let onchain_code = r#"(input: [Felt; 2]) -> Vec { use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; @@ -613,13 +624,13 @@ fn test_enum_tuple_round_trip() { Struct { x: u64, flag: bool }, } - let original = MixedEnum::Pair(Felt::from_u64_unchecked(111), 222); + let original = MixedEnum::Pair(Felt::new(111), 222); let serialized = original.to_felt_repr(); assert_eq!(serialized.len(), 3); - assert_eq!(serialized[0], Felt::from_u64_unchecked(1)); - assert_eq!(serialized[1], Felt::from_u64_unchecked(111)); - assert_eq!(serialized[2], Felt::from_u64_unchecked(222)); + assert_eq!(serialized[0], Felt::new(1)); + assert_eq!(serialized[1], Felt::new(111)); + assert_eq!(serialized[2], Felt::new(222)); let onchain_code = r#"(input: [Felt; 3]) -> Vec { use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; @@ -689,10 +700,10 @@ fn test_struct_with_enum_round_trip() { } let original = Outer { - prefix: Felt::from_u64_unchecked(999), + prefix: Felt::new(999), kind: Kind::Inline { inner: Inner { - a: Felt::from_u64_unchecked(111), + a: Felt::new(111), b: 222, }, ok: true, @@ -783,8 +794,8 @@ fn test_enum_nested_with_struct_round_trip() { } let original = Top::Wrap(Wrapper { - left: Felt::from_u64_unchecked(7), - right: Felt::from_u64_unchecked(8), + left: Felt::new(7), + right: Felt::new(8), state: State::B { n: 999_999, f: false, @@ -862,12 +873,12 @@ struct WithOption { #[test] fn test_struct_with_option_round_trip() { let original_none = WithOption { - prefix: Felt::from_u64_unchecked(7), + prefix: Felt::new(7), maybe: None, suffix: false, }; let original_some = WithOption { - prefix: Felt::from_u64_unchecked(5), + prefix: Felt::new(5), maybe: Some(42), suffix: true, }; @@ -908,7 +919,7 @@ fn test_struct_with_option_round_trip() { // `[Felt; 4]` so we can reuse the same compiled package for both `None` and `Some`. // The extra trailing `0` is never read by `FromFeltRepr`. let mut input_none = serialized_none.clone(); - input_none.resize(4, ReprFelt::from_u64_unchecked(0)); + input_none.resize(4, ReprFelt::new(0)); let initializers = [Initializer::MemoryFelts { addr: in_elem_addr, felts: Cow::from(to_core_felts(&input_none)), @@ -952,7 +963,7 @@ struct WithVec { #[test] fn test_struct_with_vec_round_trip() { let original = WithVec { - prefix: Felt::from_u64_unchecked(9), + prefix: Felt::new(9), items: vec![1, 2, 3], suffix: true, }; @@ -1010,16 +1021,9 @@ struct TupleStruct(u32, bool, Felt); #[test] fn test_tuple_struct_round_trip() { - let original = TupleStruct(22, true, Felt::from_u64_unchecked(33)); + let original = TupleStruct(22, true, Felt::new(33)); let serialized = original.to_felt_repr(); - assert_eq!( - serialized, - vec![ - ReprFelt::from_u64_unchecked(22), - ReprFelt::from_u64_unchecked(1), - ReprFelt::from_u64_unchecked(33), - ] - ); + assert_eq!(serialized, vec![ReprFelt::new(22), ReprFelt::new(1), ReprFelt::new(33),]); let onchain_code = r#"(input: [Felt; 3]) -> Vec { use miden_field_repr::{FeltReader, FromFeltRepr, ToFeltRepr}; diff --git a/sdk/field/Cargo.toml b/sdk/field/Cargo.toml deleted file mode 100644 index b05643f67..000000000 --- a/sdk/field/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "miden-field" -description = "A unified field element type for on-chain and off-chain Miden Rust code" -version = "0.9.0" -rust-version.workspace = true -authors.workspace = true -repository.workspace = true -homepage.workspace = true -documentation.workspace = true -categories.workspace = true -keywords.workspace = true -license.workspace = true -readme.workspace = true -edition.workspace = true - -[lib] -crate-type = ["rlib"] - -[dependencies] - -[target.'cfg(not(target_family = "wasm"))'.dependencies] -miden-core.workspace = true - -[target.'cfg(all(target_family = "wasm", not(miden)))'.dependencies] -miden-core.workspace = true - -[features] -default = [] diff --git a/sdk/field/build.rs b/sdk/field/build.rs deleted file mode 100644 index 733da30b9..000000000 --- a/sdk/field/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -use std::env; - -fn main() { - println!("cargo::rerun-if-env-changed=MIDENC_TARGET_IS_MIDEN_VM"); - println!("cargo::rustc-check-cfg=cfg(miden)"); - - // `cargo-miden` compiles Rust to Wasm which will then be compiled to Miden VM code by `midenc`. - // When targeting a "real" Wasm runtime (e.g. `wasm32-unknown-unknown` for a web SDK), we want a - // regular felt representation instead. - if env::var_os("MIDENC_TARGET_IS_MIDEN_VM").is_some() { - println!("cargo::rustc-cfg=miden"); - } -} diff --git a/sdk/field/src/lib.rs b/sdk/field/src/lib.rs deleted file mode 100644 index 2bab6fd7c..000000000 --- a/sdk/field/src/lib.rs +++ /dev/null @@ -1,136 +0,0 @@ -//! A unified `Felt` for on-chain and off-chain Miden Rust code. -//! -//! This crate provides a single `Felt` type that can be used in both on-chain (Wasm) and off-chain -//! (native) Rust code: -//! - When targeting the Miden VM via Wasm, `Felt` is backed by an on-chain felt. -//! - Otherwise, `Felt` is backed by a felt (`miden-core`'s field element). - -#![no_std] -#![deny(warnings)] - -use core::{fmt, hash::Hash}; - -/// The field modulus, `2^64 - 2^32 + 1`. -pub const MODULUS: u64 = 0xffff_ffff_0000_0001; - -/// Errors returned by [`Felt::new`]. -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub enum FeltError { - /// The provided value was not a valid canonical felt. - InvalidValue, -} - -/// A crate-local trait capturing the API surface shared by all `Felt` representations. -/// -/// This is used to ensure the on-chain and off-chain implementations don't drift in the common -/// "core" operations, and that required operator traits are implemented consistently. -pub(crate) trait FeltImpl: - Copy - + Clone - + fmt::Debug - + fmt::Display - + Eq - + Ord - + Hash - + core::ops::Add - + core::ops::Sub - + core::ops::Mul - + core::ops::Div - + core::ops::Neg - + core::ops::AddAssign - + core::ops::SubAssign - + core::ops::MulAssign - + core::ops::DivAssign -{ - /// Creates a `Felt` from `value`. - /// - /// # Panics - /// - /// Panics if `value > Felt::M`. - fn from_u64_unchecked(value: u64) -> Self; - - /// Creates a `Felt` from a `u32` value. - fn from_u32(value: u32) -> Self; - - /// Returns the canonical `u64` value of this felt. - fn as_u64(self) -> u64; - - /// Returns true if this felt is odd. - fn is_odd(self) -> bool; - - /// Returns `self^-1`. Fails if `self = 0`. - fn inv(self) -> Self; - - /// Returns `2^self`. Fails if `self > 63`. - fn pow2(self) -> Self; - - /// Returns `self^other`. - fn exp(self, other: Self) -> Self; -} - -#[cfg(all(target_family = "wasm", miden))] -mod wasm32; -#[cfg(all(target_family = "wasm", miden))] -pub use wasm32::Felt; - -#[cfg(not(all(target_family = "wasm", miden)))] -mod native; -#[cfg(not(all(target_family = "wasm", miden)))] -pub use native::Felt; - -impl Felt { - /// Field modulus = 2^64 - 2^32 + 1. - pub const M: u64 = MODULUS; - - /// Creates a `Felt` from `value` without range checks. - #[inline(always)] - pub fn from_u64_unchecked(value: u64) -> Self { - ::from_u64_unchecked(value) - } - - /// Creates a `Felt` from a `u32` value. - #[inline(always)] - pub fn from_u32(value: u32) -> Self { - ::from_u32(value) - } - - /// Creates a `Felt` from `value`, returning an error if it is out of range. - #[inline(always)] - pub fn new(value: u64) -> Result { - if value >= Self::M { - Err(FeltError::InvalidValue) - } else { - Ok(Self::from_u64_unchecked(value)) - } - } - - /// Returns the canonical `u64` value of this felt. - #[inline(always)] - pub fn as_u64(self) -> u64 { - ::as_u64(self) - } - - /// Returns true if this felt is odd. - #[inline(always)] - pub fn is_odd(self) -> bool { - ::is_odd(self) - } - - /// Returns `self^-1`. Fails if `self = 0`. - #[inline(always)] - pub fn inv(self) -> Self { - ::inv(self) - } - - /// Returns `2^self`. Fails if `self > 63`. - #[inline(always)] - pub fn pow2(self) -> Self { - ::pow2(self) - } - - /// Returns `self^other`. - #[inline(always)] - pub fn exp(self, other: Self) -> Self { - ::exp(self, other) - } -} diff --git a/sdk/field/src/native.rs b/sdk/field/src/native.rs deleted file mode 100644 index 1b352f699..000000000 --- a/sdk/field/src/native.rs +++ /dev/null @@ -1,203 +0,0 @@ -//! Off-chain implementation of [`crate::Felt`]. - -use miden_core::{Felt as CoreFelt, FieldElement}; - -use crate::FeltImpl; - -#[repr(transparent)] -#[derive(Copy, Clone, Debug)] -/// A `Felt` represented as a felt (`miden_core::Felt`). -pub struct Felt(pub miden_core::Felt); - -impl FeltImpl for Felt { - #[inline(always)] - fn from_u64_unchecked(value: u64) -> Self { - assert!(value <= Felt::M, "value {value} is larger than field modulus {}", Felt::M); - Self(CoreFelt::new(value)) - } - - #[inline(always)] - fn from_u32(value: u32) -> Self { - Self::from_u64_unchecked(value as u64) - } - - #[inline(always)] - fn as_u64(self) -> u64 { - self.0.as_int() - } - - #[inline(always)] - fn is_odd(self) -> bool { - self.as_u64() & 1 == 1 - } - - #[inline(always)] - fn inv(self) -> Self { - Self(self.0.inv()) - } - - #[inline(always)] - fn pow2(self) -> Self { - let n = self.as_u64(); - assert!(n <= 63, "pow2: exponent out of range"); - Self(CoreFelt::new(1u64 << (n as u32))) - } - - #[inline(always)] - fn exp(self, other: Self) -> Self { - Self(self.0.exp(other.as_u64())) - } -} - -impl From for Felt { - fn from(value: CoreFelt) -> Self { - Self(value) - } -} - -impl From for CoreFelt { - fn from(value: Felt) -> Self { - value.0 - } -} - -impl From for u64 { - fn from(felt: Felt) -> u64 { - felt.as_u64() - } -} - -impl From for Felt { - fn from(value: u32) -> Self { - Self::from_u32(value) - } -} - -impl From for Felt { - fn from(value: u16) -> Self { - Self::from_u64_unchecked(value as u64) - } -} - -impl From for Felt { - fn from(value: u8) -> Self { - Self::from_u64_unchecked(value as u64) - } -} - -#[cfg(target_pointer_width = "32")] -impl From for Felt { - fn from(value: usize) -> Self { - Self::from_u64_unchecked(value as u64) - } -} - -impl core::ops::Add for Felt { - type Output = Self; - - #[inline(always)] - fn add(self, other: Self) -> Self { - Self(self.0 + other.0) - } -} - -impl core::ops::AddAssign for Felt { - #[inline(always)] - fn add_assign(&mut self, other: Self) { - *self = *self + other; - } -} - -impl core::ops::Sub for Felt { - type Output = Self; - - #[inline(always)] - fn sub(self, other: Self) -> Self { - Self(self.0 - other.0) - } -} - -impl core::ops::SubAssign for Felt { - #[inline(always)] - fn sub_assign(&mut self, other: Self) { - *self = *self - other; - } -} - -impl core::ops::Mul for Felt { - type Output = Self; - - #[inline(always)] - fn mul(self, other: Self) -> Self { - Self(self.0 * other.0) - } -} - -impl core::ops::MulAssign for Felt { - #[inline(always)] - fn mul_assign(&mut self, other: Self) { - *self = *self * other; - } -} - -impl core::ops::Div for Felt { - type Output = Self; - - #[inline(always)] - fn div(self, other: Self) -> Self { - Self(self.0 / other.0) - } -} - -impl core::ops::DivAssign for Felt { - #[inline(always)] - fn div_assign(&mut self, other: Self) { - *self = *self / other; - } -} - -impl core::ops::Neg for Felt { - type Output = Self; - - #[inline(always)] - fn neg(self) -> Self { - Self(-self.0) - } -} - -impl PartialEq for Felt { - #[inline(always)] - fn eq(&self, other: &Self) -> bool { - self.as_u64() == other.as_u64() - } -} - -impl Eq for Felt {} - -impl PartialOrd for Felt { - #[inline(always)] - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Ord for Felt { - #[inline(always)] - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - self.as_u64().cmp(&other.as_u64()) - } -} - -impl core::fmt::Display for Felt { - #[inline] - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - core::fmt::Display::fmt(&self.as_u64(), f) - } -} - -impl core::hash::Hash for Felt { - #[inline] - fn hash(&self, state: &mut H) { - core::hash::Hash::hash(&self.as_u64(), state); - } -} diff --git a/sdk/field/src/wasm32.rs b/sdk/field/src/wasm32.rs deleted file mode 100644 index 550ef65db..000000000 --- a/sdk/field/src/wasm32.rs +++ /dev/null @@ -1,296 +0,0 @@ -//! On-chain implementation of [`crate::Felt`]. - -use crate::FeltImpl; - -#[repr(transparent)] -#[derive(Copy, Clone, Debug)] -/// A `Felt` represented as an on-chain felt. -pub struct Felt { - /// The backing type is `f32` which will be treated as a felt by the compiler. - /// We're basically hijacking the Wasm `f32` type and treat as felt. - pub inner: f32, - // We cannot define this type as `Felt(f32)` since there is no struct tuple support in WIT. - // For the type remapping to work the bindings are expecting the remapped type to be the same - // shape as the one generated from WIT. - // In WIT it's defined as - // ```wit - // record felt { - // inner: f32, - // } - // - //``` - // see sdk/base-macros/wit/miden.wit so we have to define it like that here. - // -} - -unsafe extern "C" { - #[link_name = "intrinsics::felt::from_u64_unchecked"] - pub(crate) fn extern_from_u64_unchecked(value: u64) -> Felt; - - #[link_name = "intrinsics::felt::from_u32"] - pub(crate) fn extern_from_u32(value: u32) -> Felt; - - #[link_name = "intrinsics::felt::as_u64"] - pub(crate) fn extern_as_u64(felt: Felt) -> u64; - - #[link_name = "intrinsics::felt::sub"] - pub(crate) fn extern_sub(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::mul"] - pub(crate) fn extern_mul(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::div"] - pub(crate) fn extern_div(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::neg"] - pub(crate) fn extern_neg(a: Felt) -> Felt; - - #[link_name = "intrinsics::felt::inv"] - pub(crate) fn extern_inv(a: Felt) -> Felt; - - #[link_name = "intrinsics::felt::pow2"] - pub(crate) fn extern_pow2(a: Felt) -> Felt; - - #[link_name = "intrinsics::felt::exp"] - pub(crate) fn extern_exp(a: Felt, b: Felt) -> Felt; - - #[link_name = "intrinsics::felt::eq"] - pub(crate) fn extern_eq(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::gt"] - pub(crate) fn extern_gt(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::lt"] - pub(crate) fn extern_lt(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::ge"] - pub(crate) fn extern_ge(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::le"] - pub(crate) fn extern_le(a: Felt, b: Felt) -> i32; - - #[link_name = "intrinsics::felt::is_odd"] - pub(crate) fn extern_is_odd(a: Felt) -> i32; - - #[link_name = "intrinsics::felt::add"] - pub(crate) fn extern_add(a: Felt, b: Felt) -> Felt; -} - -// Note: inherent `Felt` methods live in `sdk/field/src/lib.rs` and delegate to the crate-local -// `FeltImpl` trait to ensure the on-chain/off-chain APIs don't drift. - -impl FeltImpl for Felt { - #[inline(always)] - fn from_u64_unchecked(value: u64) -> Self { - assert!(value <= Felt::M, "value {value} is larger than field modulus {}", Felt::M); - unsafe { extern_from_u64_unchecked(value) } - } - - #[inline(always)] - fn from_u32(value: u32) -> Self { - unsafe { extern_from_u32(value) } - } - - #[inline(always)] - fn as_u64(self) -> u64 { - unsafe { extern_as_u64(self) } - } - - #[inline(always)] - fn is_odd(self) -> bool { - unsafe { extern_is_odd(self) != 0 } - } - - #[inline(always)] - fn inv(self) -> Self { - unsafe { extern_inv(self) } - } - - #[inline(always)] - fn pow2(self) -> Self { - unsafe { extern_pow2(self) } - } - - #[inline(always)] - fn exp(self, other: Self) -> Self { - unsafe { extern_exp(self, other) } - } -} - -impl From for u64 { - fn from(felt: Felt) -> u64 { - felt.as_u64() - } -} - -impl From for Felt { - fn from(value: u32) -> Self { - Self { - inner: f32::from_bits(value), - } - } -} - -impl From for Felt { - fn from(value: u16) -> Self { - Self { - inner: f32::from_bits(value as u32), - } - } -} - -impl From for Felt { - fn from(value: u8) -> Self { - Self { - inner: f32::from_bits(value as u32), - } - } -} - -#[cfg(target_pointer_width = "32")] -impl From for Felt { - fn from(value: usize) -> Self { - Self { - inner: f32::from_bits(value as u32), - } - } -} - -impl core::ops::Add for Felt { - type Output = Self; - - #[inline(always)] - fn add(self, other: Self) -> Self { - unsafe { extern_add(self, other) } - } -} - -impl core::ops::AddAssign for Felt { - #[inline(always)] - fn add_assign(&mut self, other: Self) { - *self = *self + other; - } -} - -impl core::ops::Sub for Felt { - type Output = Self; - - #[inline(always)] - fn sub(self, other: Self) -> Self { - unsafe { extern_sub(self, other) } - } -} - -impl core::ops::SubAssign for Felt { - #[inline(always)] - fn sub_assign(&mut self, other: Self) { - *self = *self - other; - } -} - -impl core::ops::Mul for Felt { - type Output = Self; - - #[inline(always)] - fn mul(self, other: Self) -> Self { - unsafe { extern_mul(self, other) } - } -} - -impl core::ops::MulAssign for Felt { - #[inline(always)] - fn mul_assign(&mut self, other: Self) { - *self = *self * other; - } -} - -impl core::ops::Div for Felt { - type Output = Self; - - #[inline(always)] - fn div(self, other: Self) -> Self { - unsafe { extern_div(self, other) } - } -} - -impl core::ops::DivAssign for Felt { - #[inline(always)] - fn div_assign(&mut self, other: Self) { - *self = *self / other; - } -} - -impl core::ops::Neg for Felt { - type Output = Self; - - #[inline(always)] - fn neg(self) -> Self { - unsafe { extern_neg(self) } - } -} - -impl PartialEq for Felt { - #[inline(always)] - fn eq(&self, other: &Self) -> bool { - unsafe { extern_eq(*self, *other) == 1 } - } -} - -impl Eq for Felt {} - -impl PartialOrd for Felt { - #[inline(always)] - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } - - #[inline(always)] - fn gt(&self, other: &Self) -> bool { - unsafe { extern_gt(*self, *other) != 0 } - } - - #[inline(always)] - fn ge(&self, other: &Self) -> bool { - unsafe { extern_ge(*self, *other) != 0 } - } - - #[inline(always)] - fn lt(&self, other: &Self) -> bool { - unsafe { extern_lt(*self, *other) != 0 } - } - - #[inline(always)] - fn le(&self, other: &Self) -> bool { - unsafe { extern_le(*self, *other) != 0 } - } -} - -impl Ord for Felt { - #[inline(always)] - fn cmp(&self, other: &Self) -> core::cmp::Ordering { - if self.lt(other) { - core::cmp::Ordering::Less - } else if self.gt(other) { - core::cmp::Ordering::Greater - } else { - core::cmp::Ordering::Equal - } - } -} - -// Note: public `assert` helpers live in `sdk/field/src/lib.rs` to preserve their stable paths in -// emitted WASM and expected-file tests. - -impl core::fmt::Display for Felt { - #[inline] - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - core::fmt::Display::fmt(&self.as_u64(), f) - } -} - -impl core::hash::Hash for Felt { - #[inline] - fn hash(&self, state: &mut H) { - core::hash::Hash::hash(&self.as_u64(), state); - } -} diff --git a/sdk/sdk/Cargo.toml b/sdk/sdk/Cargo.toml index 07515cf0e..4b64ab996 100644 --- a/sdk/sdk/Cargo.toml +++ b/sdk/sdk/Cargo.toml @@ -21,7 +21,7 @@ miden-base = { version = "0.9.0", path = "../base" } miden-base-macros = { version = "0.9.0", path = "../base-macros" } miden-base-sys = { version = "0.9.0", path = "../base-sys" } miden-field-repr = { version = "0.9.0", path = "../field-repr/repr" } -miden-field = { version = "0.9.0", path = "../field" } +miden-field.workspace = true wit-bindgen = { version = "0.46", default-features = false, features = ["macros"] } [features] diff --git a/sdk/sdk/src/lib.rs b/sdk/sdk/src/lib.rs index 2e71404d2..f251a7296 100644 --- a/sdk/sdk/src/lib.rs +++ b/sdk/sdk/src/lib.rs @@ -5,9 +5,7 @@ pub use miden_base::*; pub use miden_base_macros::{component, export_type, generate, note, note_script, tx_script}; pub use miden_base_sys::bindings::*; /// Unified `Felt` and related helpers. -pub use miden_field as felt; -/// Error type for [`felt::Felt::new`]. -pub use miden_field::FeltError; +pub use miden_field; /// Felt representation helpers. pub use miden_field_repr as felt_repr; pub use miden_sdk_alloc::BumpAlloc; diff --git a/sdk/stdlib-sys/Cargo.toml b/sdk/stdlib-sys/Cargo.toml index 4154b536d..cd659530f 100644 --- a/sdk/stdlib-sys/Cargo.toml +++ b/sdk/stdlib-sys/Cargo.toml @@ -17,7 +17,7 @@ links = "miden_stdlib_sys_stubs" crate-type = ["rlib"] [dependencies] -miden-field = { version = "0.9.0", path = "../field" } +miden-field.workspace = true [features] default = [] diff --git a/sdk/stdlib-sys/src/intrinsics/felt.rs b/sdk/stdlib-sys/src/intrinsics/felt.rs index 7079ba8a2..7bd274296 100644 --- a/sdk/stdlib-sys/src/intrinsics/felt.rs +++ b/sdk/stdlib-sys/src/intrinsics/felt.rs @@ -1,6 +1,6 @@ //! Felt-related intrinsics and helpers. -pub use miden_field::{Felt, FeltError}; +use miden_field::Felt; #[cfg(all(target_family = "wasm", miden))] unsafe extern "C" { @@ -39,7 +39,7 @@ pub fn assert_eq(a: Felt, b: Felt) { #[cfg(not(all(target_family = "wasm", miden)))] #[inline(always)] pub fn assert(a: Felt) { - if a != Felt::from_u64_unchecked(1) { + if a != Felt::new(1) { panic!("assert: expected 1"); } } @@ -48,7 +48,7 @@ pub fn assert(a: Felt) { #[cfg(not(all(target_family = "wasm", miden)))] #[inline(always)] pub fn assertz(a: Felt) { - if a != Felt::from_u64_unchecked(0) { + if a != Felt::new(0) { panic!("assertz: expected 0"); } } @@ -70,10 +70,6 @@ macro_rules! felt { ($value:literal) => {{ const VALUE: u64 = $value as u64; // assert!(VALUE <= Felt::M, "Invalid Felt value, must be >= 0 and <= 2^64 - 2^32 + 1"); - // Temporarily switch to `from_u32` to use `bitcast` and avoid checks. - // see https://github.com/0xMiden/compiler/issues/361 - assert!(VALUE <= u32::MAX as u64, "Invalid value, must be >= 0 and <= 2^32"); - const VALUE_U32: u32 = $value as u32; - $crate::Felt::from_u32(VALUE_U32) + $crate::Felt::new(VALUE) }}; } diff --git a/sdk/stdlib-sys/src/intrinsics/mod.rs b/sdk/stdlib-sys/src/intrinsics/mod.rs index 588328821..4029bed25 100644 --- a/sdk/stdlib-sys/src/intrinsics/mod.rs +++ b/sdk/stdlib-sys/src/intrinsics/mod.rs @@ -1,26 +1,29 @@ use core::ops::{Deref, DerefMut}; +pub use miden_field::{Felt, Word}; + pub use self::{ crypto::Digest, - felt::{Felt, assert, assert_eq, assertz}, - word::Word, + felt::{assert, assert_eq, assertz}, }; pub mod advice; pub mod crypto; pub mod debug; pub mod felt; -pub mod word; +/// A wrapper type which ensures that the wrapped value is aligned to 32 bytes. #[repr(C, align(32))] pub struct WordAligned(T); impl WordAligned { #[inline(always)] + /// Wraps the provided value. pub const fn new(t: T) -> Self { Self(t) } #[inline(always)] + /// Returns the wrapped value. pub fn into_inner(self) -> T { self.0 } diff --git a/sdk/stdlib-sys/src/intrinsics/word.rs b/sdk/stdlib-sys/src/intrinsics/word.rs deleted file mode 100644 index 41b61d540..000000000 --- a/sdk/stdlib-sys/src/intrinsics/word.rs +++ /dev/null @@ -1,115 +0,0 @@ -use core::ops::{Index, IndexMut}; - -use super::felt::Felt; -use crate::felt; - -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)] -#[repr(C, align(16))] -pub struct Word { - pub inner: (Felt, Felt, Felt, Felt), -} -impl Word { - pub const fn new(word: [Felt; 4]) -> Self { - Self { - inner: (word[0], word[1], word[2], word[3]), - } - } - - /// Converts each of the `values` to `Felt`. - /// - /// # Panics - /// - /// Panics if a value is larger than `Felt::M`. - #[inline(always)] - pub fn from_u64_unchecked(a: u64, b: u64, c: u64, d: u64) -> Self { - Self { - inner: ( - Felt::from_u64_unchecked(a), - Felt::from_u64_unchecked(b), - Felt::from_u64_unchecked(c), - Felt::from_u64_unchecked(d), - ), - } - } - - #[inline(always)] - pub fn reverse(&self) -> Word { - Word { - inner: (self.inner.3, self.inner.2, self.inner.1, self.inner.0), - } - } -} -impl From<(Felt, Felt, Felt, Felt)> for Word { - fn from(word: (Felt, Felt, Felt, Felt)) -> Self { - Self { inner: word } - } -} -impl From<[Felt; 4]> for Word { - fn from(word: [Felt; 4]) -> Self { - Self { - inner: (word[0], word[1], word[2], word[3]), - } - } -} -impl From for (Felt, Felt, Felt, Felt) { - #[inline(always)] - fn from(word: Word) -> Self { - word.inner - } -} -impl From for [Felt; 4] { - #[inline(always)] - fn from(word: Word) -> Self { - [word.inner.0, word.inner.1, word.inner.2, word.inner.3] - } -} -impl From<&Word> for [Felt; 4] { - #[inline(always)] - fn from(word: &Word) -> Self { - [word.inner.0, word.inner.1, word.inner.2, word.inner.3] - } -} -impl From for Word { - fn from(value: Felt) -> Self { - Word { - inner: (felt!(0), felt!(0), felt!(0), value), - } - } -} -impl From for Felt { - fn from(value: Word) -> Self { - value.inner.3 - } -} -impl Index for Word { - type Output = Felt; - - #[inline(always)] - fn index(&self, index: usize) -> &Self::Output { - match index { - 0 => &self.inner.0, - 1 => &self.inner.1, - 2 => &self.inner.2, - 3 => &self.inner.3, - _ => unreachable!(), - } - } -} -impl IndexMut for Word { - #[inline(always)] - fn index_mut(&mut self, index: usize) -> &mut Self::Output { - match index { - 0 => &mut self.inner.0, - 1 => &mut self.inner.1, - 2 => &mut self.inner.2, - 3 => &mut self.inner.3, - _ => unreachable!(), - } - } -} - -impl AsRef for Word { - fn as_ref(&self) -> &Word { - self - } -} diff --git a/sdk/stdlib-sys/src/stdlib/collections/smt.rs b/sdk/stdlib-sys/src/stdlib/collections/smt.rs index 6ea261277..54dbb20ec 100644 --- a/sdk/stdlib-sys/src/stdlib/collections/smt.rs +++ b/sdk/stdlib-sys/src/stdlib/collections/smt.rs @@ -84,8 +84,8 @@ pub fn smt_get(key: Word, root: Word) -> SmtGetResponse { extern_smt_get(key[3], key[2], key[1], key[0], root[3], root[2], root[1], root[0], ptr); let (value, returned_root) = ret_area.assume_init().into_inner(); SmtGetResponse { - value: value.reverse(), - root: returned_root.reverse(), + value: value.reversed(), + root: returned_root.reversed(), } } } @@ -105,8 +105,8 @@ pub fn smt_set(value: Word, key: Word, root: Word) -> SmtSetResponse { ); let (old_value, new_root) = ret_area.assume_init().into_inner(); SmtSetResponse { - old_value: old_value.reverse(), - new_root: new_root.reverse(), + old_value: old_value.reversed(), + new_root: new_root.reversed(), } } } diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index 2930e8a90..aaee703f6 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -279,7 +279,7 @@ mod imp { let result_ptr = ret_area.as_mut_ptr() as *mut Felt; let miden_ptr = rust_ptr / 4; // Since our BumpAlloc produces word-aligned allocations the pointer should be word-aligned - assert_eq(Felt::from_u32(miden_ptr % 4), felt!(0)); + assert_eq(Felt::new((miden_ptr % 4) as u64), felt!(0)); if element_count.is_multiple_of(4) { let start_addr = miden_ptr; @@ -289,7 +289,7 @@ mod imp { extern_hash_elements(miden_ptr, num_elements, result_ptr); } - Digest::from_word(ret_area.assume_init().reverse()) + Digest::from_word(ret_area.assume_init().reversed()) } } @@ -306,7 +306,7 @@ mod imp { let miden_ptr = rust_ptr / 4; // It's safe to assume the `words` ptr is word-aligned. - assert_eq(Felt::from_u32(miden_ptr % 4), felt!(0)); + assert_eq(Felt::new((miden_ptr % 4) as u64), felt!(0)); unsafe { let mut ret_area = core::mem::MaybeUninit::::uninit(); @@ -315,7 +315,7 @@ mod imp { let end_addr = start_addr + (words.len() as u32 * 4); extern_hash_words(start_addr, end_addr, result_ptr); - Digest::from_word(ret_area.assume_init().reverse()) + Digest::from_word(ret_area.assume_init().reversed()) } } } diff --git a/sdk/stdlib-sys/src/stdlib/mem.rs b/sdk/stdlib-sys/src/stdlib/mem.rs index 27c15ed1f..9e0a70217 100644 --- a/sdk/stdlib-sys/src/stdlib/mem.rs +++ b/sdk/stdlib-sys/src/stdlib/mem.rs @@ -89,7 +89,7 @@ pub fn pipe_words_to_memory(num_words: Felt) -> (Word, Vec) { unsafe { // Place for returned HASH, write_ptr let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let mut buf: Vec = Vec::with_capacity((num_words.as_u64() * 4) as usize); + let mut buf: Vec = Vec::with_capacity((num_words.as_canonical_u64() * 4) as usize); extern_pipe_words_to_memory( num_words, buf.as_mut_ptr(), @@ -119,7 +119,7 @@ pub fn pipe_double_words_to_memory(num_words: Felt) -> (Word, Vec) { write_ptr: *mut Felt, } - let num_words_in_felts = num_words.as_u64() as usize * 4; + let num_words_in_felts = num_words.as_canonical_u64() as usize * 4; let mut buf: Vec = Vec::with_capacity(num_words_in_felts); let write_ptr = buf.as_mut_ptr(); let end_ptr = unsafe { write_ptr.add(num_words_in_felts) }; @@ -162,7 +162,7 @@ pub fn pipe_double_words_to_memory(_num_words: Felt) -> (Word, Vec) { #[cfg(all(target_family = "wasm", miden))] pub fn adv_load_preimage(num_words: Felt, commitment: Word) -> Vec { // Allocate a Vec with the specified capacity - let num_words_usize = num_words.as_u64() as usize; + let num_words_usize = num_words.as_canonical_u64() as usize; let num_felts = num_words_usize * 4; let mut result: Vec = Vec::with_capacity(num_felts); diff --git a/tests/examples/counter/Cargo.lock b/tests/examples/counter/Cargo.lock index 2b0b92c5f..1b32b6b02 100644 --- a/tests/examples/counter/Cargo.lock +++ b/tests/examples/counter/Cargo.lock @@ -864,7 +864,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1452,7 +1452,7 @@ dependencies = [ [[package]] name = "miden" -version = "0.8.0" +version = "0.9.0" dependencies = [ "miden-base", "miden-base-macros", @@ -1535,7 +1535,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.9.0" dependencies = [ "miden-base-sys", "miden-stdlib-sys", @@ -1543,7 +1543,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.9.0" dependencies = [ "heck", "miden-protocol", @@ -1558,7 +1558,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.9.0" dependencies = [ "miden-field-repr", "miden-stdlib-sys", @@ -1677,23 +1677,32 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.8.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] name = "miden-field-repr" -version = "0.7.1" +version = "0.9.0" dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] name = "miden-field-repr-derive" -version = "0.7.1" +version = "0.9.0" dependencies = [ "proc-macro2", "quote", @@ -1739,7 +1748,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1841,7 +1850,15 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.9.0" + +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] [[package]] name = "miden-standards" @@ -1863,7 +1880,7 @@ dependencies = [ [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.9.0" dependencies = [ "miden-field", ] @@ -2409,6 +2426,162 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -3094,6 +3267,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -3116,6 +3298,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -3482,6 +3670,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.114" diff --git a/tests/examples/counter/src/lib.rs b/tests/examples/counter/src/lib.rs index 85ae7719a..19f81220d 100644 --- a/tests/examples/counter/src/lib.rs +++ b/tests/examples/counter/src/lib.rs @@ -25,13 +25,13 @@ mod component { impl CounterContract { /// Returns the current counter value stored in the contract's storage map. pub fn get_count(&self) -> Felt { - let key = Word::from_u64_unchecked(0, 0, 0, 1); + let key = word!("0x1000000000000000200000000000000030000000000000004000000000000000"); self.count_map.get(&key) } /// Increments the counter value stored in the contract's storage map by one. pub fn increment_count(&mut self) -> Felt { - let key = Word::from_u64_unchecked(0, 0, 0, 1); + let key = word!("0x1000000000000000200000000000000030000000000000004000000000000000"); let current_value: Felt = self.count_map.get(&key); let new_value = current_value + felt!(1); self.count_map.set(key, new_value); diff --git a/tests/integration-network/src/mockchain/counter_contract.rs b/tests/integration-network/src/mockchain/counter_contract.rs index 2a5ab4b51..08898a467 100644 --- a/tests/integration-network/src/mockchain/counter_contract.rs +++ b/tests/integration-network/src/mockchain/counter_contract.rs @@ -17,6 +17,7 @@ use super::helpers::{ NoteCreationConfig, account_component_from_package, assert_counter_storage, compile_rust_package, create_note_from_package, execute_tx, }; +use crate::mockchain::helpers::COUNTER_CONTRACT_STORAGE_KEY; /// Tests the counter contract deployment and note consumption workflow on a mock chain. #[test] @@ -25,13 +26,12 @@ pub fn test_counter_contract() { let contract_package = compile_rust_package("../../examples/counter-contract", true); let note_package = compile_rust_package("../../examples/counter-note", true); - let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); let counter_storage_slot = StorageSlotName::new("miden::component::miden_counter_contract::count_map").unwrap(); let storage_slots = vec![StorageSlot::with_map( counter_storage_slot.clone(), - StorageMap::with_entries([(key, value)]).unwrap(), + StorageMap::with_entries([(COUNTER_CONTRACT_STORAGE_KEY, value)]).unwrap(), )]; let counter_component = account_component_from_package(contract_package, storage_slots); diff --git a/tests/integration-network/src/mockchain/counter_contract_no_auth.rs b/tests/integration-network/src/mockchain/counter_contract_no_auth.rs index 04fffd086..4b432d924 100644 --- a/tests/integration-network/src/mockchain/counter_contract_no_auth.rs +++ b/tests/integration-network/src/mockchain/counter_contract_no_auth.rs @@ -18,6 +18,7 @@ use super::helpers::{ build_existing_counter_account_builder_with_auth_package, compile_rust_package, create_note_from_package, execute_tx, }; +use crate::mockchain::helpers::COUNTER_CONTRACT_STORAGE_KEY; /// Tests the counter contract with a "no-auth" authentication component. /// @@ -34,13 +35,12 @@ pub fn test_counter_contract_no_auth() { let no_auth_auth_component = compile_rust_package("../../examples/auth-component-no-auth", true); - let key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); let value = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); let counter_storage_slot = StorageSlotName::new("miden::component::miden_counter_contract::count_map").unwrap(); let counter_storage_slots = vec![StorageSlot::with_map( counter_storage_slot.clone(), - StorageMap::with_entries([(key, value)]).unwrap(), + StorageMap::with_entries([(COUNTER_CONTRACT_STORAGE_KEY, value)]).unwrap(), )]; let mut builder = MockChain::builder(); diff --git a/tests/integration-network/src/mockchain/helpers.rs b/tests/integration-network/src/mockchain/helpers.rs index 695c659d0..8ffe80a31 100644 --- a/tests/integration-network/src/mockchain/helpers.rs +++ b/tests/integration-network/src/mockchain/helpers.rs @@ -276,20 +276,21 @@ fn auth_public_key_slot_name() -> StorageSlotName { .expect("auth component storage slot name should be valid") } +pub const COUNTER_CONTRACT_STORAGE_KEY: Word = + Word::new([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); + /// Asserts the counter value stored in the counter contract's storage map at `storage_slot`. pub(super) fn assert_counter_storage( counter_account_storage: &AccountStorage, storage_slot: &StorageSlotName, expected: u64, ) { - // according to `examples/counter-contract` for inner (slot, key) values - let counter_contract_storage_key = Word::from([Felt::ZERO, Felt::ZERO, Felt::ZERO, Felt::ONE]); - let word = counter_account_storage - .get_map_item(storage_slot, counter_contract_storage_key) + .get_map_item(storage_slot, COUNTER_CONTRACT_STORAGE_KEY) .expect("Failed to get counter value from storage slot"); - let val = word.last().unwrap(); + // According to the counter-contract the counter value is stored in the last element. + let val = word[3]; assert_eq!( val.as_int(), expected, diff --git a/tests/integration/expected/adv_load_preimage.hir b/tests/integration/expected/adv_load_preimage.hir index 1d0dbd1cf..6ca184b2f 100644 --- a/tests/integration/expected/adv_load_preimage.hir +++ b/tests/integration/expected/adv_load_preimage.hir @@ -2,42 +2,42 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @adv_load_preimage { private builtin.function @__rustc::__rust_alloc(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): - v3 = arith.constant 1048576 : i32; + v3 = arith.constant 1048604 : i32; v4 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v3, v1, v0) : i32 builtin.ret v4; }; private builtin.function @__rustc::__rust_alloc_zeroed(v5: i32, v6: i32) -> i32 { ^block6(v5: i32, v6: i32): - v8 = arith.constant 1048576 : i32; + v8 = arith.constant 1048604 : i32; v9 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v8, v6, v5) : i32 - v503 = arith.constant 0 : i32; + v695 = arith.constant 0 : i32; v10 = arith.constant 0 : i32; v11 = arith.eq v9, v10 : i1; v12 = arith.zext v11 : u32; v13 = hir.bitcast v12 : i32; - v15 = arith.neq v13, v503 : i1; + v15 = arith.neq v13, v695 : i1; scf.if v15{ ^block8: scf.yield ; } else { ^block9: - v501 = arith.constant 0 : i32; - v502 = arith.constant 0 : i32; - v17 = arith.eq v5, v502 : i1; + v693 = arith.constant 0 : i32; + v694 = arith.constant 0 : i32; + v17 = arith.eq v5, v694 : i1; v18 = arith.zext v17 : u32; v19 = hir.bitcast v18 : i32; - v21 = arith.neq v19, v501 : i1; + v21 = arith.neq v19, v693 : i1; scf.if v21{ - ^block68: + ^block74: scf.yield ; } else { ^block10: - v495 = arith.constant 0 : u8; + v687 = arith.constant 0 : u8; v24 = hir.bitcast v5 : u32; v25 = hir.bitcast v9 : u32; v26 = hir.int_to_ptr v25 : ptr; - hir.mem_set v26, v24, v495; + hir.mem_set v26, v24, v687; scf.yield ; }; scf.yield ; @@ -47,206 +47,393 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @entrypoint(v28: i32, v29: felt, v30: felt, v31: felt, v32: felt) { ^block11(v28: i32, v29: felt, v30: felt, v31: felt, v32: felt): - v37 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v38 = hir.bitcast v37 : ptr; - v39 = hir.load v38 : i32; - v40 = arith.constant 16 : i32; - v41 = arith.sub v39, v40 : i32 #[overflow = wrapping]; - v42 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v43 = hir.bitcast v42 : ptr; - hir.store v43, v41; - v44 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::advice::adv_push_mapvaln(v32, v31, v30, v29) : felt - v45 = hir.cast v44 : i64; - v512 = arith.constant 0 : felt; - v47 = arith.constant 3 : i32; - v46 = arith.trunc v45 : i32; - v48 = arith.band v46, v47 : i32; - v49 = hir.bitcast v48 : felt; - hir.assert_eq v49, v512; - v54 = arith.constant 2 : i64; - v56 = hir.cast v54 : u32; - v55 = hir.bitcast v45 : u64; - v57 = arith.shr v55, v56 : u64; - v58 = hir.bitcast v57 : i64; - v59 = arith.trunc v58 : felt; - v511 = arith.constant 2 : u32; - v60 = hir.cast v59 : i64; - v61 = arith.trunc v60 : i32; - v64 = arith.shl v61, v511 : i32; - v552 = arith.constant 4 : i32; + v36 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v37 = hir.bitcast v36 : ptr; + v38 = hir.load v37 : i32; + v39 = arith.constant 48 : i32; + v40 = arith.sub v38, v39 : i32 #[overflow = wrapping]; + v41 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v42 = hir.bitcast v41 : ptr; + hir.store v42, v40; + v44 = arith.constant 28 : u32; + v43 = hir.bitcast v40 : u32; + v45 = arith.add v43, v44 : u32 #[overflow = checked]; + v46 = arith.constant 4 : u32; + v47 = arith.mod v45, v46 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + hir.store v48, v32; + v50 = arith.constant 24 : u32; + v49 = hir.bitcast v40 : u32; + v51 = arith.add v49, v50 : u32 #[overflow = checked]; + v785 = arith.constant 4 : u32; + v53 = arith.mod v51, v785 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + hir.store v54, v31; + v56 = arith.constant 20 : u32; + v55 = hir.bitcast v40 : u32; + v57 = arith.add v55, v56 : u32 #[overflow = checked]; + v784 = arith.constant 4 : u32; + v59 = arith.mod v57, v784 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + hir.store v60, v30; + v62 = arith.constant 16 : u32; + v61 = hir.bitcast v40 : u32; + v63 = arith.add v61, v62 : u32 #[overflow = checked]; + v783 = arith.constant 4 : u32; + v65 = arith.mod v63, v783 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + hir.store v66, v29; + v67 = arith.constant 16 : i32; + v68 = arith.add v40, v67 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::from(v40, v68) + v70 = arith.constant 8 : u32; + v69 = hir.bitcast v40 : u32; + v71 = arith.add v69, v70 : u32 #[overflow = checked]; + v782 = arith.constant 8 : u32; + v73 = arith.mod v71, v782 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + v75 = hir.load v74 : i64; + v781 = arith.constant 24 : u32; + v76 = hir.bitcast v40 : u32; + v78 = arith.add v76, v781 : u32 #[overflow = checked]; + v780 = arith.constant 8 : u32; + v80 = arith.mod v78, v780 : u32; + hir.assertz v80 #[code = 250]; + v81 = hir.int_to_ptr v78 : ptr; + hir.store v81, v75; + v82 = hir.bitcast v40 : u32; + v779 = arith.constant 8 : u32; + v84 = arith.mod v82, v779 : u32; + hir.assertz v84 #[code = 250]; + v85 = hir.int_to_ptr v82 : ptr; + v86 = hir.load v85 : i64; + v778 = arith.constant 16 : u32; + v87 = hir.bitcast v40 : u32; + v89 = arith.add v87, v778 : u32 #[overflow = checked]; + v777 = arith.constant 8 : u32; + v91 = arith.mod v89, v777 : u32; + hir.assertz v91 #[code = 250]; + v92 = hir.int_to_ptr v89 : ptr; + hir.store v92, v86; + v96 = arith.constant 1048588 : i32; + v95 = arith.constant 3 : i32; + v776 = arith.constant 16 : i32; + v94 = arith.add v40, v776 : i32 #[overflow = wrapping]; + v97 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v94, v95, v96) : i32 + v98 = hir.bitcast v97 : u32; + v775 = arith.constant 4 : u32; + v100 = arith.mod v98, v775 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + v102 = hir.load v101 : felt; + v773 = arith.constant 1048588 : i32; + v105 = arith.constant 2 : i32; + v774 = arith.constant 16 : i32; + v104 = arith.add v40, v774 : i32 #[overflow = wrapping]; + v107 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v104, v105, v773) : i32 + v108 = hir.bitcast v107 : u32; + v772 = arith.constant 4 : u32; + v110 = arith.mod v108, v772 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : felt; + v770 = arith.constant 1048588 : i32; + v115 = arith.constant 1 : i32; + v771 = arith.constant 16 : i32; + v114 = arith.add v40, v771 : i32 #[overflow = wrapping]; + v117 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v114, v115, v770) : i32 + v118 = hir.bitcast v117 : u32; + v769 = arith.constant 4 : u32; + v120 = arith.mod v118, v769 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + v122 = hir.load v121 : felt; + v767 = arith.constant 1048588 : i32; v33 = arith.constant 0 : i32; - v52 = arith.constant 4 : i32; - v53 = arith.add v41, v52 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::try_allocate_in(v53, v64, v33, v552, v552) - v69 = arith.constant 8 : u32; - v68 = hir.bitcast v41 : u32; - v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v71 = arith.constant 4 : u32; - v72 = arith.mod v70, v71 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i32; - v551 = arith.constant 4 : u32; - v75 = hir.bitcast v41 : u32; - v77 = arith.add v75, v551 : u32 #[overflow = checked]; - v550 = arith.constant 4 : u32; - v79 = arith.mod v77, v550 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i32; - v549 = arith.constant 0 : i32; - v82 = arith.constant 1 : i32; - v83 = arith.eq v81, v82 : i1; - v84 = arith.zext v83 : u32; - v85 = hir.bitcast v84 : i32; - v87 = arith.neq v85, v549 : i1; - v517 = scf.if v87 : u32 { + v768 = arith.constant 16 : i32; + v124 = arith.add v40, v768 : i32 #[overflow = wrapping]; + v127 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v124, v33, v767) : i32 + v128 = hir.bitcast v127 : u32; + v766 = arith.constant 4 : u32; + v130 = arith.mod v128, v766 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + v132 = hir.load v131 : felt; + v133 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::advice::adv_push_mapvaln(v102, v112, v122, v132) : felt + v134 = hir.cast v133 : i64; + v34 = arith.constant 0 : i64; + v139 = arith.trunc v34 : felt; + v135 = arith.constant 3 : i64; + v136 = arith.band v134, v135 : i64; + v137 = arith.trunc v136 : felt; + hir.assert_eq v137, v139; + v140 = arith.constant 2 : i64; + v142 = hir.cast v140 : u32; + v141 = hir.bitcast v134 : u64; + v143 = arith.shr v141, v142 : u64; + v144 = hir.bitcast v143 : i64; + v145 = arith.trunc v144 : felt; + v765 = arith.constant 8 : u32; + v146 = hir.bitcast v40 : u32; + v148 = arith.add v146, v765 : u32 #[overflow = checked]; + v764 = arith.constant 8 : u32; + v150 = arith.mod v148, v764 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i64; + v763 = arith.constant 24 : u32; + v153 = hir.bitcast v40 : u32; + v155 = arith.add v153, v763 : u32 #[overflow = checked]; + v762 = arith.constant 8 : u32; + v157 = arith.mod v155, v762 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + hir.store v158, v152; + v159 = hir.bitcast v40 : u32; + v761 = arith.constant 8 : u32; + v161 = arith.mod v159, v761 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : i64; + v760 = arith.constant 16 : u32; + v164 = hir.bitcast v40 : u32; + v166 = arith.add v164, v760 : u32 #[overflow = checked]; + v759 = arith.constant 8 : u32; + v168 = arith.mod v166, v759 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + hir.store v169, v163; + v699 = arith.constant 2 : u32; + v172 = hir.cast v145 : i64; + v173 = arith.trunc v172 : i32; + v176 = arith.shl v173, v699 : i32; + v178 = arith.constant 4 : i32; + v758 = arith.constant 0 : i32; + v170 = arith.constant 36 : i32; + v171 = arith.add v40, v170 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::try_allocate_in(v171, v176, v758, v178, v178) + v181 = arith.constant 40 : u32; + v180 = hir.bitcast v40 : u32; + v182 = arith.add v180, v181 : u32 #[overflow = checked]; + v757 = arith.constant 4 : u32; + v184 = arith.mod v182, v757 : u32; + hir.assertz v184 #[code = 250]; + v185 = hir.int_to_ptr v182 : ptr; + v186 = hir.load v185 : i32; + v188 = arith.constant 36 : u32; + v187 = hir.bitcast v40 : u32; + v189 = arith.add v187, v188 : u32 #[overflow = checked]; + v756 = arith.constant 4 : u32; + v191 = arith.mod v189, v756 : u32; + hir.assertz v191 #[code = 250]; + v192 = hir.int_to_ptr v189 : ptr; + v193 = hir.load v192 : i32; + v754 = arith.constant 0 : i32; + v755 = arith.constant 1 : i32; + v195 = arith.eq v193, v755 : i1; + v196 = arith.zext v195 : u32; + v197 = hir.bitcast v196 : i32; + v199 = arith.neq v197, v754 : i1; + v704 = scf.if v199 : u32 { ^block14: - v178 = arith.constant 12 : u32; - v177 = hir.bitcast v41 : u32; - v179 = arith.add v177, v178 : u32 #[overflow = checked]; - v548 = arith.constant 4 : u32; - v181 = arith.mod v179, v548 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - v183 = hir.load v182 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v74, v183) - v513 = arith.constant 0 : u32; - scf.yield v513; + v330 = arith.constant 44 : u32; + v329 = hir.bitcast v40 : u32; + v331 = arith.add v329, v330 : u32 #[overflow = checked]; + v753 = arith.constant 4 : u32; + v333 = arith.mod v331, v753 : u32; + hir.assertz v333 #[code = 250]; + v334 = hir.int_to_ptr v331 : ptr; + v335 = hir.load v334 : i32; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v186, v335) + v700 = arith.constant 0 : u32; + scf.yield v700; } else { ^block15: - v547 = arith.constant 12 : u32; - v88 = hir.bitcast v41 : u32; - v90 = arith.add v88, v547 : u32 #[overflow = checked]; - v546 = arith.constant 4 : u32; - v92 = arith.mod v90, v546 : u32; - hir.assertz v92 #[code = 250]; - v93 = hir.int_to_ptr v90 : ptr; - v94 = hir.load v93 : i32; - v545 = arith.constant 2 : u32; - v96 = hir.bitcast v94 : u32; - v98 = arith.shr v96, v545 : u32; - v99 = hir.bitcast v98 : i32; - v100 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/miden::core::mem::pipe_preimage_to_memory(v59, v99, v32, v31, v30, v29) : i32 - v544 = arith.constant 8 : u32; - v101 = hir.bitcast v28 : u32; - v103 = arith.add v101, v544 : u32 #[overflow = checked]; - v543 = arith.constant 4 : u32; - v105 = arith.mod v103, v543 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - hir.store v106, v64; - v542 = arith.constant 4 : u32; - v107 = hir.bitcast v28 : u32; - v109 = arith.add v107, v542 : u32 #[overflow = checked]; - v541 = arith.constant 4 : u32; - v111 = arith.mod v109, v541 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - hir.store v112, v94; - v113 = hir.bitcast v28 : u32; - v540 = arith.constant 4 : u32; - v115 = arith.mod v113, v540 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - hir.store v116, v74; - v538 = arith.constant 0 : i32; - v539 = arith.constant 0 : i32; - v118 = arith.eq v64, v539 : i1; - v119 = arith.zext v118 : u32; - v120 = hir.bitcast v119 : i32; - v122 = arith.neq v120, v538 : i1; - v519 = scf.if v122 : u32 { - ^block73: - v537 = arith.constant 0 : u32; - scf.yield v537; + v752 = arith.constant 44 : u32; + v200 = hir.bitcast v40 : u32; + v202 = arith.add v200, v752 : u32 #[overflow = checked]; + v751 = arith.constant 4 : u32; + v204 = arith.mod v202, v751 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + v206 = hir.load v205 : i32; + v748 = arith.constant 1048588 : i32; + v749 = arith.constant 3 : i32; + v750 = arith.constant 16 : i32; + v213 = arith.add v40, v750 : i32 #[overflow = wrapping]; + v216 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v213, v749, v748) : i32 + v217 = hir.bitcast v216 : u32; + v747 = arith.constant 4 : u32; + v219 = arith.mod v217, v747 : u32; + hir.assertz v219 #[code = 250]; + v220 = hir.int_to_ptr v217 : ptr; + v221 = hir.load v220 : felt; + v744 = arith.constant 1048588 : i32; + v745 = arith.constant 2 : i32; + v746 = arith.constant 16 : i32; + v223 = arith.add v40, v746 : i32 #[overflow = wrapping]; + v226 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v223, v745, v744) : i32 + v227 = hir.bitcast v226 : u32; + v743 = arith.constant 4 : u32; + v229 = arith.mod v227, v743 : u32; + hir.assertz v229 #[code = 250]; + v230 = hir.int_to_ptr v227 : ptr; + v231 = hir.load v230 : felt; + v740 = arith.constant 1048588 : i32; + v741 = arith.constant 1 : i32; + v742 = arith.constant 16 : i32; + v233 = arith.add v40, v742 : i32 #[overflow = wrapping]; + v236 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v233, v741, v740) : i32 + v237 = hir.bitcast v236 : u32; + v739 = arith.constant 4 : u32; + v239 = arith.mod v237, v739 : u32; + hir.assertz v239 #[code = 250]; + v240 = hir.int_to_ptr v237 : ptr; + v241 = hir.load v240 : felt; + v736 = arith.constant 1048588 : i32; + v737 = arith.constant 0 : i32; + v738 = arith.constant 16 : i32; + v243 = arith.add v40, v738 : i32 #[overflow = wrapping]; + v246 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/>::index(v243, v737, v736) : i32 + v247 = hir.bitcast v246 : u32; + v735 = arith.constant 4 : u32; + v249 = arith.mod v247, v735 : u32; + hir.assertz v249 #[code = 250]; + v250 = hir.int_to_ptr v247 : ptr; + v251 = hir.load v250 : felt; + v734 = arith.constant 2 : u32; + v208 = hir.bitcast v206 : u32; + v210 = arith.shr v208, v734 : u32; + v211 = hir.bitcast v210 : i32; + v252 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/miden::core::mem::pipe_preimage_to_memory(v145, v211, v221, v231, v241, v251) : i32 + v733 = arith.constant 8 : u32; + v253 = hir.bitcast v28 : u32; + v255 = arith.add v253, v733 : u32 #[overflow = checked]; + v732 = arith.constant 4 : u32; + v257 = arith.mod v255, v732 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + hir.store v258, v176; + v731 = arith.constant 4 : u32; + v259 = hir.bitcast v28 : u32; + v261 = arith.add v259, v731 : u32 #[overflow = checked]; + v730 = arith.constant 4 : u32; + v263 = arith.mod v261, v730 : u32; + hir.assertz v263 #[code = 250]; + v264 = hir.int_to_ptr v261 : ptr; + hir.store v264, v206; + v265 = hir.bitcast v28 : u32; + v729 = arith.constant 4 : u32; + v267 = arith.mod v265, v729 : u32; + hir.assertz v267 #[code = 250]; + v268 = hir.int_to_ptr v265 : ptr; + hir.store v268, v186; + v727 = arith.constant 0 : i32; + v728 = arith.constant 0 : i32; + v270 = arith.eq v176, v728 : i1; + v271 = arith.zext v270 : u32; + v272 = hir.bitcast v271 : i32; + v274 = arith.neq v272, v727 : i1; + v706 = scf.if v274 : u32 { + ^block79: + v726 = arith.constant 0 : u32; + scf.yield v726; } else { ^block16: - v123 = hir.bitcast v94 : u32; - v536 = arith.constant 4 : u32; - v125 = arith.mod v123, v536 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : felt; - v509 = arith.constant 1 : felt; - hir.assert_eq v127, v509; - v535 = arith.constant 4 : u32; - v130 = hir.bitcast v94 : u32; - v132 = arith.add v130, v535 : u32 #[overflow = checked]; - v534 = arith.constant 4 : u32; - v134 = arith.mod v132, v534 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - v136 = hir.load v135 : felt; - v508 = arith.constant 2 : felt; - hir.assert_eq v136, v508; - v533 = arith.constant 0 : i32; - v507 = arith.constant 5 : u32; - v140 = hir.bitcast v64 : u32; - v142 = arith.lte v140, v507 : i1; - v143 = arith.zext v142 : u32; - v144 = hir.bitcast v143 : i32; - v146 = arith.neq v144, v533 : i1; - v521 = scf.if v146 : u32 { - ^block72: - v532 = arith.constant 0 : u32; - scf.yield v532; + v275 = hir.bitcast v206 : u32; + v725 = arith.constant 4 : u32; + v277 = arith.mod v275, v725 : u32; + hir.assertz v277 #[code = 250]; + v278 = hir.int_to_ptr v275 : ptr; + v279 = hir.load v278 : felt; + v280 = arith.constant 1 : i64; + v281 = arith.trunc v280 : felt; + hir.assert_eq v279, v281; + v724 = arith.constant 4 : u32; + v282 = hir.bitcast v206 : u32; + v284 = arith.add v282, v724 : u32 #[overflow = checked]; + v723 = arith.constant 4 : u32; + v286 = arith.mod v284, v723 : u32; + hir.assertz v286 #[code = 250]; + v287 = hir.int_to_ptr v284 : ptr; + v288 = hir.load v287 : felt; + v722 = arith.constant 2 : i64; + v290 = arith.trunc v722 : felt; + hir.assert_eq v288, v290; + v721 = arith.constant 0 : i32; + v697 = arith.constant 5 : u32; + v292 = hir.bitcast v176 : u32; + v294 = arith.lte v292, v697 : i1; + v295 = arith.zext v294 : u32; + v296 = hir.bitcast v295 : i32; + v298 = arith.neq v296, v721 : i1; + v708 = scf.if v298 : u32 { + ^block78: + v720 = arith.constant 0 : u32; + scf.yield v720; } else { ^block17: - v148 = arith.constant 20 : u32; - v147 = hir.bitcast v94 : u32; - v149 = arith.add v147, v148 : u32 #[overflow = checked]; - v531 = arith.constant 4 : u32; - v151 = arith.mod v149, v531 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : felt; - v506 = arith.constant 6 : felt; - hir.assert_eq v153, v506; - v530 = arith.constant 0 : i32; - v505 = arith.constant 14 : u32; - v157 = hir.bitcast v64 : u32; - v159 = arith.lte v157, v505 : i1; - v160 = arith.zext v159 : u32; - v161 = hir.bitcast v160 : i32; - v163 = arith.neq v161, v530 : i1; - scf.if v163{ - ^block71: + v719 = arith.constant 20 : u32; + v299 = hir.bitcast v206 : u32; + v301 = arith.add v299, v719 : u32 #[overflow = checked]; + v718 = arith.constant 4 : u32; + v303 = arith.mod v301, v718 : u32; + hir.assertz v303 #[code = 250]; + v304 = hir.int_to_ptr v301 : ptr; + v305 = hir.load v304 : felt; + v306 = arith.constant 6 : i64; + v307 = arith.trunc v306 : felt; + hir.assert_eq v305, v307; + v717 = arith.constant 0 : i32; + v696 = arith.constant 14 : u32; + v309 = hir.bitcast v176 : u32; + v311 = arith.lte v309, v696 : i1; + v312 = arith.zext v311 : u32; + v313 = hir.bitcast v312 : i32; + v315 = arith.neq v313, v717 : i1; + scf.if v315{ + ^block77: scf.yield ; } else { ^block18: - v165 = arith.constant 56 : u32; - v164 = hir.bitcast v94 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v529 = arith.constant 4 : u32; - v168 = arith.mod v166, v529 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : felt; - v504 = arith.constant 15 : felt; - hir.assert_eq v170, v504; - v528 = arith.constant 16 : i32; - v174 = arith.add v41, v528 : i32 #[overflow = wrapping]; - v175 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v176 = hir.bitcast v175 : ptr; - hir.store v176, v174; + v317 = arith.constant 56 : u32; + v316 = hir.bitcast v206 : u32; + v318 = arith.add v316, v317 : u32 #[overflow = checked]; + v716 = arith.constant 4 : u32; + v320 = arith.mod v318, v716 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + v322 = hir.load v321 : felt; + v323 = arith.constant 15 : i64; + v324 = arith.trunc v323 : felt; + hir.assert_eq v322, v324; + v715 = arith.constant 48 : i32; + v326 = arith.add v40, v715 : i32 #[overflow = wrapping]; + v327 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v328 = hir.bitcast v327 : ptr; + hir.store v328, v326; scf.yield ; }; - v515 = arith.constant 1 : u32; - v527 = arith.constant 0 : u32; - v525 = cf.select v163, v527, v515 : u32; - scf.yield v525; + v702 = arith.constant 1 : u32; + v714 = arith.constant 0 : u32; + v712 = cf.select v315, v714, v702 : u32; + scf.yield v712; }; - scf.yield v521; + scf.yield v708; }; - scf.yield v519; + scf.yield v706; }; - v526 = arith.constant 0 : u32; - v524 = arith.eq v517, v526 : i1; - cf.cond_br v524 ^block13, ^block75; + v713 = arith.constant 0 : u32; + v711 = arith.eq v704, v713 : i1; + cf.cond_br v711 ^block13, ^block81; ^block13: ub.unreachable ; - ^block75: + ^block81: builtin.ret ; }; @@ -255,460 +442,514 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v184: i32, v185: i32, v186: i32) -> i32 { - ^block21(v184: i32, v185: i32, v186: i32): - v189 = arith.constant 16 : i32; - v188 = arith.constant 0 : i32; - v554 = arith.constant 16 : u32; - v191 = hir.bitcast v185 : u32; - v193 = arith.gt v191, v554 : i1; - v194 = arith.zext v193 : u32; - v195 = hir.bitcast v194 : i32; - v197 = arith.neq v195, v188 : i1; - v198 = cf.select v197, v185, v189 : i32; - v594 = arith.constant 0 : i32; - v199 = arith.constant -1 : i32; - v200 = arith.add v198, v199 : i32 #[overflow = wrapping]; - v201 = arith.band v198, v200 : i32; - v203 = arith.neq v201, v594 : i1; - v563, v564 = scf.if v203 : i32, u32 { - ^block82: - v555 = arith.constant 0 : u32; - v559 = ub.poison i32 : i32; - scf.yield v559, v555; + private builtin.function @::alloc(v336: i32, v337: i32, v338: i32) -> i32 { + ^block21(v336: i32, v337: i32, v338: i32): + v341 = arith.constant 16 : i32; + v340 = arith.constant 0 : i32; + v787 = arith.constant 16 : u32; + v343 = hir.bitcast v337 : u32; + v345 = arith.gt v343, v787 : i1; + v346 = arith.zext v345 : u32; + v347 = hir.bitcast v346 : i32; + v349 = arith.neq v347, v340 : i1; + v350 = cf.select v349, v337, v341 : i32; + v827 = arith.constant 0 : i32; + v351 = arith.constant -1 : i32; + v352 = arith.add v350, v351 : i32 #[overflow = wrapping]; + v353 = arith.band v350, v352 : i32; + v355 = arith.neq v353, v827 : i1; + v796, v797 = scf.if v355 : i32, u32 { + ^block88: + v788 = arith.constant 0 : u32; + v792 = ub.poison i32 : i32; + scf.yield v792, v788; } else { ^block24: - v205 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::max(v185, v198) : i32 - v593 = arith.constant 0 : i32; - v204 = arith.constant -2147483648 : i32; - v206 = arith.sub v204, v205 : i32 #[overflow = wrapping]; - v208 = hir.bitcast v206 : u32; - v207 = hir.bitcast v186 : u32; - v209 = arith.gt v207, v208 : i1; - v210 = arith.zext v209 : u32; - v211 = hir.bitcast v210 : i32; - v213 = arith.neq v211, v593 : i1; - v578 = scf.if v213 : i32 { - ^block81: - v592 = ub.poison i32 : i32; - scf.yield v592; + v357 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::max(v337, v350) : i32 + v826 = arith.constant 0 : i32; + v356 = arith.constant -2147483648 : i32; + v358 = arith.sub v356, v357 : i32 #[overflow = wrapping]; + v360 = hir.bitcast v358 : u32; + v359 = hir.bitcast v338 : u32; + v361 = arith.gt v359, v360 : i1; + v362 = arith.zext v361 : u32; + v363 = hir.bitcast v362 : i32; + v365 = arith.neq v363, v826 : i1; + v811 = scf.if v365 : i32 { + ^block87: + v825 = ub.poison i32 : i32; + scf.yield v825; } else { ^block25: - v590 = arith.constant 0 : i32; - v219 = arith.sub v590, v205 : i32 #[overflow = wrapping]; - v591 = arith.constant -1 : i32; - v215 = arith.add v186, v205 : i32 #[overflow = wrapping]; - v217 = arith.add v215, v591 : i32 #[overflow = wrapping]; - v220 = arith.band v217, v219 : i32; - v221 = hir.bitcast v184 : u32; - v222 = arith.constant 4 : u32; - v223 = arith.mod v221, v222 : u32; - hir.assertz v223 #[code = 250]; - v224 = hir.int_to_ptr v221 : ptr; - v225 = hir.load v224 : i32; - v589 = arith.constant 0 : i32; - v227 = arith.neq v225, v589 : i1; - scf.if v227{ - ^block80: + v823 = arith.constant 0 : i32; + v371 = arith.sub v823, v357 : i32 #[overflow = wrapping]; + v824 = arith.constant -1 : i32; + v367 = arith.add v338, v357 : i32 #[overflow = wrapping]; + v369 = arith.add v367, v824 : i32 #[overflow = wrapping]; + v372 = arith.band v369, v371 : i32; + v373 = hir.bitcast v336 : u32; + v374 = arith.constant 4 : u32; + v375 = arith.mod v373, v374 : u32; + hir.assertz v375 #[code = 250]; + v376 = hir.int_to_ptr v373 : ptr; + v377 = hir.load v376 : i32; + v822 = arith.constant 0 : i32; + v379 = arith.neq v377, v822 : i1; + scf.if v379{ + ^block86: scf.yield ; } else { ^block27: - v228 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::mem::heap_base() : i32 - v229 = hir.mem_size : u32; - v235 = hir.bitcast v184 : u32; - v588 = arith.constant 4 : u32; - v237 = arith.mod v235, v588 : u32; - hir.assertz v237 #[code = 250]; - v587 = arith.constant 16 : u32; - v230 = hir.bitcast v229 : i32; - v233 = arith.shl v230, v587 : i32; - v234 = arith.add v228, v233 : i32 #[overflow = wrapping]; - v238 = hir.int_to_ptr v235 : ptr; - hir.store v238, v234; + v380 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::mem::heap_base() : i32 + v381 = hir.mem_size : u32; + v387 = hir.bitcast v336 : u32; + v821 = arith.constant 4 : u32; + v389 = arith.mod v387, v821 : u32; + hir.assertz v389 #[code = 250]; + v820 = arith.constant 16 : u32; + v382 = hir.bitcast v381 : i32; + v385 = arith.shl v382, v820 : i32; + v386 = arith.add v380, v385 : i32 #[overflow = wrapping]; + v390 = hir.int_to_ptr v387 : ptr; + hir.store v390, v386; scf.yield ; }; - v241 = hir.bitcast v184 : u32; - v586 = arith.constant 4 : u32; - v243 = arith.mod v241, v586 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - v245 = hir.load v244 : i32; - v584 = arith.constant 0 : i32; - v585 = arith.constant -1 : i32; - v247 = arith.bxor v245, v585 : i32; - v249 = hir.bitcast v247 : u32; - v248 = hir.bitcast v220 : u32; - v250 = arith.gt v248, v249 : i1; - v251 = arith.zext v250 : u32; - v252 = hir.bitcast v251 : i32; - v254 = arith.neq v252, v584 : i1; - v577 = scf.if v254 : i32 { + v393 = hir.bitcast v336 : u32; + v819 = arith.constant 4 : u32; + v395 = arith.mod v393, v819 : u32; + hir.assertz v395 #[code = 250]; + v396 = hir.int_to_ptr v393 : ptr; + v397 = hir.load v396 : i32; + v817 = arith.constant 0 : i32; + v818 = arith.constant -1 : i32; + v399 = arith.bxor v397, v818 : i32; + v401 = hir.bitcast v399 : u32; + v400 = hir.bitcast v372 : u32; + v402 = arith.gt v400, v401 : i1; + v403 = arith.zext v402 : u32; + v404 = hir.bitcast v403 : i32; + v406 = arith.neq v404, v817 : i1; + v810 = scf.if v406 : i32 { ^block28: - v583 = arith.constant 0 : i32; - scf.yield v583; + v816 = arith.constant 0 : i32; + scf.yield v816; } else { ^block29: - v256 = hir.bitcast v184 : u32; - v582 = arith.constant 4 : u32; - v258 = arith.mod v256, v582 : u32; - hir.assertz v258 #[code = 250]; - v255 = arith.add v245, v220 : i32 #[overflow = wrapping]; - v259 = hir.int_to_ptr v256 : ptr; - hir.store v259, v255; - v261 = arith.add v245, v205 : i32 #[overflow = wrapping]; - scf.yield v261; + v408 = hir.bitcast v336 : u32; + v815 = arith.constant 4 : u32; + v410 = arith.mod v408, v815 : u32; + hir.assertz v410 #[code = 250]; + v407 = arith.add v397, v372 : i32 #[overflow = wrapping]; + v411 = hir.int_to_ptr v408 : ptr; + hir.store v411, v407; + v413 = arith.add v397, v357 : i32 #[overflow = wrapping]; + scf.yield v413; }; - scf.yield v577; + scf.yield v810; }; - v560 = arith.constant 1 : u32; - v581 = arith.constant 0 : u32; - v579 = cf.select v213, v581, v560 : u32; - scf.yield v578, v579; + v793 = arith.constant 1 : u32; + v814 = arith.constant 0 : u32; + v812 = cf.select v365, v814, v793 : u32; + scf.yield v811, v812; }; - v580 = arith.constant 0 : u32; - v576 = arith.eq v564, v580 : i1; - cf.cond_br v576 ^block23, ^block84(v563); + v813 = arith.constant 0 : u32; + v809 = arith.eq v797, v813 : i1; + cf.cond_br v809 ^block23, ^block90(v796); ^block23: ub.unreachable ; - ^block84(v556: i32): - builtin.ret v556; + ^block90(v789: i32): + builtin.ret v789; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block30: - v264 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v264; + v416 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v416; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v266: felt, v267: felt, v268: felt, v269: felt) -> felt { - ^block34(v266: felt, v267: felt, v268: felt, v269: felt): - v270 = hir.exec @intrinsics/advice/adv_push_mapvaln(v266, v267, v268, v269) : felt - builtin.ret v270; + private builtin.function @intrinsics::advice::adv_push_mapvaln(v418: felt, v419: felt, v420: felt, v421: felt) -> felt { + ^block34(v418: felt, v419: felt, v420: felt, v421: felt): + v422 = hir.exec @intrinsics/advice/adv_push_mapvaln(v418, v419, v420, v421) : felt + builtin.ret v422; }; - private builtin.function @miden::core::mem::pipe_preimage_to_memory(v272: felt, v273: i32, v274: felt, v275: felt, v276: felt, v277: felt) -> i32 { - ^block37(v272: felt, v273: i32, v274: felt, v275: felt, v276: felt, v277: felt): - v278 = hir.exec @miden/core/mem/pipe_preimage_to_memory(v272, v273, v274, v275, v276, v277) : i32 - builtin.ret v278; + private builtin.function @miden::core::mem::pipe_preimage_to_memory(v424: felt, v425: i32, v426: felt, v427: felt, v428: felt, v429: felt) -> i32 { + ^block37(v424: felt, v425: i32, v426: felt, v427: felt, v428: felt, v429: felt): + v430 = hir.exec @miden/core/mem/pipe_preimage_to_memory(v424, v425, v426, v427, v428, v429) : i32 + builtin.ret v430; }; - private builtin.function @::alloc_impl(v280: i32, v281: i32, v282: i32, v283: i32) { - ^block42(v280: i32, v281: i32, v282: i32, v283: i32): - v610 = arith.constant 0 : i32; - v284 = arith.constant 0 : i32; - v285 = arith.eq v282, v284 : i1; - v286 = arith.zext v285 : u32; - v287 = hir.bitcast v286 : i32; - v289 = arith.neq v287, v610 : i1; - v606 = scf.if v289 : i32 { - ^block88: - scf.yield v281; + private builtin.function @>::index(v432: i32, v433: i32, v434: i32) -> i32 { + ^block42(v432: i32, v433: i32, v434: i32): + v442 = arith.constant 0 : i32; + v829 = arith.constant 3 : u32; + v437 = hir.bitcast v433 : u32; + v439 = arith.gt v437, v829 : i1; + v440 = arith.zext v439 : u32; + v441 = hir.bitcast v440 : i32; + v443 = arith.neq v441, v442 : i1; + cf.cond_br v443 ^block44, ^block45; + ^block44: + ub.unreachable ; + ^block45: + v828 = arith.constant 2 : u32; + v446 = arith.shl v433, v828 : i32; + v447 = arith.add v432, v446 : i32 #[overflow = wrapping]; + builtin.ret v447; + }; + + private builtin.function @>::from(v448: i32, v449: i32) { + ^block46(v448: i32, v449: i32): + v451 = arith.constant 8 : u32; + v450 = hir.bitcast v449 : u32; + v452 = arith.add v450, v451 : u32 #[overflow = checked]; + v453 = arith.constant 4 : u32; + v454 = arith.mod v452, v453 : u32; + hir.assertz v454 #[code = 250]; + v455 = hir.int_to_ptr v452 : ptr; + v456 = hir.load v455 : i64; + v835 = arith.constant 8 : u32; + v457 = hir.bitcast v448 : u32; + v459 = arith.add v457, v835 : u32 #[overflow = checked]; + v834 = arith.constant 8 : u32; + v461 = arith.mod v459, v834 : u32; + hir.assertz v461 #[code = 250]; + v462 = hir.int_to_ptr v459 : ptr; + hir.store v462, v456; + v463 = hir.bitcast v449 : u32; + v833 = arith.constant 4 : u32; + v465 = arith.mod v463, v833 : u32; + hir.assertz v465 #[code = 250]; + v466 = hir.int_to_ptr v463 : ptr; + v467 = hir.load v466 : i64; + v468 = hir.bitcast v448 : u32; + v832 = arith.constant 8 : u32; + v470 = arith.mod v468, v832 : u32; + hir.assertz v470 #[code = 250]; + v471 = hir.int_to_ptr v468 : ptr; + hir.store v471, v467; + builtin.ret ; + }; + + private builtin.function @::alloc_impl(v472: i32, v473: i32, v474: i32, v475: i32) { + ^block48(v472: i32, v473: i32, v474: i32, v475: i32): + v851 = arith.constant 0 : i32; + v476 = arith.constant 0 : i32; + v477 = arith.eq v474, v476 : i1; + v478 = arith.zext v477 : u32; + v479 = hir.bitcast v478 : i32; + v481 = arith.neq v479, v851 : i1; + v847 = scf.if v481 : i32 { + ^block96: + scf.yield v473; } else { - ^block45: + ^block51: hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v609 = arith.constant 0 : i32; - v291 = arith.neq v283, v609 : i1; - v605 = scf.if v291 : i32 { - ^block46: - v293 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v282, v281) : i32 - scf.yield v293; + v850 = arith.constant 0 : i32; + v483 = arith.neq v475, v850 : i1; + v846 = scf.if v483 : i32 { + ^block52: + v485 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v474, v473) : i32 + scf.yield v485; } else { - ^block47: - v292 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v282, v281) : i32 - scf.yield v292; + ^block53: + v484 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v474, v473) : i32 + scf.yield v484; }; - scf.yield v605; + scf.yield v846; }; - v297 = arith.constant 4 : u32; - v296 = hir.bitcast v280 : u32; - v298 = arith.add v296, v297 : u32 #[overflow = checked]; - v608 = arith.constant 4 : u32; - v300 = arith.mod v298, v608 : u32; - hir.assertz v300 #[code = 250]; - v301 = hir.int_to_ptr v298 : ptr; - hir.store v301, v282; - v303 = hir.bitcast v280 : u32; - v607 = arith.constant 4 : u32; - v305 = arith.mod v303, v607 : u32; - hir.assertz v305 #[code = 250]; - v306 = hir.int_to_ptr v303 : ptr; - hir.store v306, v606; + v489 = arith.constant 4 : u32; + v488 = hir.bitcast v472 : u32; + v490 = arith.add v488, v489 : u32 #[overflow = checked]; + v849 = arith.constant 4 : u32; + v492 = arith.mod v490, v849 : u32; + hir.assertz v492 #[code = 250]; + v493 = hir.int_to_ptr v490 : ptr; + hir.store v493, v474; + v495 = hir.bitcast v472 : u32; + v848 = arith.constant 4 : u32; + v497 = arith.mod v495, v848 : u32; + hir.assertz v497 #[code = 250]; + v498 = hir.int_to_ptr v495 : ptr; + hir.store v498, v847; builtin.ret ; }; - private builtin.function @::allocate(v307: i32, v308: i32, v309: i32) { - ^block48(v307: i32, v308: i32, v309: i32): - v311 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v312 = hir.bitcast v311 : ptr; - v313 = hir.load v312 : i32; - v314 = arith.constant 16 : i32; - v315 = arith.sub v313, v314 : i32 #[overflow = wrapping]; - v316 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v317 = hir.bitcast v316 : ptr; - hir.store v317, v315; - v310 = arith.constant 0 : i32; - v318 = arith.constant 8 : i32; - v319 = arith.add v315, v318 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v319, v308, v309, v310) - v322 = arith.constant 12 : u32; - v321 = hir.bitcast v315 : u32; - v323 = arith.add v321, v322 : u32 #[overflow = checked]; - v324 = arith.constant 4 : u32; - v325 = arith.mod v323, v324 : u32; - hir.assertz v325 #[code = 250]; - v326 = hir.int_to_ptr v323 : ptr; - v327 = hir.load v326 : i32; - v329 = arith.constant 8 : u32; - v328 = hir.bitcast v315 : u32; - v330 = arith.add v328, v329 : u32 #[overflow = checked]; - v615 = arith.constant 4 : u32; - v332 = arith.mod v330, v615 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - v334 = hir.load v333 : i32; - v335 = hir.bitcast v307 : u32; - v614 = arith.constant 4 : u32; - v337 = arith.mod v335, v614 : u32; - hir.assertz v337 #[code = 250]; - v338 = hir.int_to_ptr v335 : ptr; - hir.store v338, v334; - v613 = arith.constant 4 : u32; - v339 = hir.bitcast v307 : u32; - v341 = arith.add v339, v613 : u32 #[overflow = checked]; - v612 = arith.constant 4 : u32; - v343 = arith.mod v341, v612 : u32; - hir.assertz v343 #[code = 250]; - v344 = hir.int_to_ptr v341 : ptr; - hir.store v344, v327; - v611 = arith.constant 16 : i32; - v346 = arith.add v315, v611 : i32 #[overflow = wrapping]; - v347 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v348 = hir.bitcast v347 : ptr; - hir.store v348, v346; + private builtin.function @::allocate(v499: i32, v500: i32, v501: i32) { + ^block54(v499: i32, v500: i32, v501: i32): + v503 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v504 = hir.bitcast v503 : ptr; + v505 = hir.load v504 : i32; + v506 = arith.constant 16 : i32; + v507 = arith.sub v505, v506 : i32 #[overflow = wrapping]; + v508 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v509 = hir.bitcast v508 : ptr; + hir.store v509, v507; + v502 = arith.constant 0 : i32; + v510 = arith.constant 8 : i32; + v511 = arith.add v507, v510 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v511, v500, v501, v502) + v514 = arith.constant 12 : u32; + v513 = hir.bitcast v507 : u32; + v515 = arith.add v513, v514 : u32 #[overflow = checked]; + v516 = arith.constant 4 : u32; + v517 = arith.mod v515, v516 : u32; + hir.assertz v517 #[code = 250]; + v518 = hir.int_to_ptr v515 : ptr; + v519 = hir.load v518 : i32; + v521 = arith.constant 8 : u32; + v520 = hir.bitcast v507 : u32; + v522 = arith.add v520, v521 : u32 #[overflow = checked]; + v856 = arith.constant 4 : u32; + v524 = arith.mod v522, v856 : u32; + hir.assertz v524 #[code = 250]; + v525 = hir.int_to_ptr v522 : ptr; + v526 = hir.load v525 : i32; + v527 = hir.bitcast v499 : u32; + v855 = arith.constant 4 : u32; + v529 = arith.mod v527, v855 : u32; + hir.assertz v529 #[code = 250]; + v530 = hir.int_to_ptr v527 : ptr; + hir.store v530, v526; + v854 = arith.constant 4 : u32; + v531 = hir.bitcast v499 : u32; + v533 = arith.add v531, v854 : u32 #[overflow = checked]; + v853 = arith.constant 4 : u32; + v535 = arith.mod v533, v853 : u32; + hir.assertz v535 #[code = 250]; + v536 = hir.int_to_ptr v533 : ptr; + hir.store v536, v519; + v852 = arith.constant 16 : i32; + v538 = arith.add v507, v852 : i32 #[overflow = wrapping]; + v539 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v540 = hir.bitcast v539 : ptr; + hir.store v540, v538; builtin.ret ; }; - private builtin.function @::try_allocate_in(v349: i32, v350: i32, v351: i32, v352: i32, v353: i32) { - ^block50(v349: i32, v350: i32, v351: i32, v352: i32, v353: i32): - v356 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v357 = hir.bitcast v356 : ptr; - v358 = hir.load v357 : i32; - v359 = arith.constant 16 : i32; - v360 = arith.sub v358, v359 : i32 #[overflow = wrapping]; - v361 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v362 = hir.bitcast v361 : ptr; - hir.store v362, v360; - v372 = hir.bitcast v350 : u32; - v373 = arith.zext v372 : u64; - v374 = hir.bitcast v373 : i64; - v354 = arith.constant 0 : i32; - v367 = arith.sub v354, v352 : i32 #[overflow = wrapping]; - v364 = arith.constant -1 : i32; - v363 = arith.add v352, v353 : i32 #[overflow = wrapping]; - v365 = arith.add v363, v364 : i32 #[overflow = wrapping]; - v368 = arith.band v365, v367 : i32; - v369 = hir.bitcast v368 : u32; - v370 = arith.zext v369 : u64; - v371 = hir.bitcast v370 : i64; - v375 = arith.mul v371, v374 : i64 #[overflow = wrapping]; - v718 = arith.constant 0 : i32; - v376 = arith.constant 32 : i64; - v378 = hir.cast v376 : u32; - v377 = hir.bitcast v375 : u64; - v379 = arith.shr v377, v378 : u64; - v380 = hir.bitcast v379 : i64; - v381 = arith.trunc v380 : i32; - v383 = arith.neq v381, v718 : i1; - v631, v632, v633, v634, v635, v636 = scf.if v383 : i32, i32, i32, i32, i32, u32 { - ^block91: - v616 = arith.constant 0 : u32; - v623 = ub.poison i32 : i32; - scf.yield v349, v360, v623, v623, v623, v616; + private builtin.function @::try_allocate_in(v541: i32, v542: i32, v543: i32, v544: i32, v545: i32) { + ^block56(v541: i32, v542: i32, v543: i32, v544: i32, v545: i32): + v548 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v549 = hir.bitcast v548 : ptr; + v550 = hir.load v549 : i32; + v551 = arith.constant 16 : i32; + v552 = arith.sub v550, v551 : i32 #[overflow = wrapping]; + v553 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v554 = hir.bitcast v553 : ptr; + hir.store v554, v552; + v564 = hir.bitcast v542 : u32; + v565 = arith.zext v564 : u64; + v566 = hir.bitcast v565 : i64; + v546 = arith.constant 0 : i32; + v559 = arith.sub v546, v544 : i32 #[overflow = wrapping]; + v556 = arith.constant -1 : i32; + v555 = arith.add v544, v545 : i32 #[overflow = wrapping]; + v557 = arith.add v555, v556 : i32 #[overflow = wrapping]; + v560 = arith.band v557, v559 : i32; + v561 = hir.bitcast v560 : u32; + v562 = arith.zext v561 : u64; + v563 = hir.bitcast v562 : i64; + v567 = arith.mul v563, v566 : i64 #[overflow = wrapping]; + v959 = arith.constant 0 : i32; + v568 = arith.constant 32 : i64; + v570 = hir.cast v568 : u32; + v569 = hir.bitcast v567 : u64; + v571 = arith.shr v569, v570 : u64; + v572 = hir.bitcast v571 : i64; + v573 = arith.trunc v572 : i32; + v575 = arith.neq v573, v959 : i1; + v872, v873, v874, v875, v876, v877 = scf.if v575 : i32, i32, i32, i32, i32, u32 { + ^block99: + v857 = arith.constant 0 : u32; + v864 = ub.poison i32 : i32; + scf.yield v541, v552, v864, v864, v864, v857; } else { - ^block55: - v384 = arith.trunc v375 : i32; - v717 = arith.constant 0 : i32; - v385 = arith.constant -2147483648 : i32; - v386 = arith.sub v385, v352 : i32 #[overflow = wrapping]; - v388 = hir.bitcast v386 : u32; - v387 = hir.bitcast v384 : u32; - v389 = arith.lte v387, v388 : i1; - v390 = arith.zext v389 : u32; - v391 = hir.bitcast v390 : i32; - v393 = arith.neq v391, v717 : i1; - v679 = scf.if v393 : i32 { - ^block53: - v716 = arith.constant 0 : i32; - v404 = arith.neq v384, v716 : i1; - v678 = scf.if v404 : i32 { - ^block57: - v715 = arith.constant 0 : i32; - v420 = arith.neq v351, v715 : i1; - v677 = scf.if v420 : i32 { - ^block60: - v402 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v360, v352, v384, v402) - v431 = hir.bitcast v360 : u32; - v472 = arith.constant 4 : u32; - v433 = arith.mod v431, v472 : u32; - hir.assertz v433 #[code = 250]; - v434 = hir.int_to_ptr v431 : ptr; - v435 = hir.load v434 : i32; - scf.yield v435; + ^block61: + v576 = arith.trunc v567 : i32; + v958 = arith.constant 0 : i32; + v577 = arith.constant -2147483648 : i32; + v578 = arith.sub v577, v544 : i32 #[overflow = wrapping]; + v580 = hir.bitcast v578 : u32; + v579 = hir.bitcast v576 : u32; + v581 = arith.lte v579, v580 : i1; + v582 = arith.zext v581 : u32; + v583 = hir.bitcast v582 : i32; + v585 = arith.neq v583, v958 : i1; + v920 = scf.if v585 : i32 { + ^block59: + v957 = arith.constant 0 : i32; + v596 = arith.neq v576, v957 : i1; + v919 = scf.if v596 : i32 { + ^block63: + v956 = arith.constant 0 : i32; + v612 = arith.neq v543, v956 : i1; + v918 = scf.if v612 : i32 { + ^block66: + v594 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc_impl(v552, v544, v576, v594) + v623 = hir.bitcast v552 : u32; + v664 = arith.constant 4 : u32; + v625 = arith.mod v623, v664 : u32; + hir.assertz v625 #[code = 250]; + v626 = hir.int_to_ptr v623 : ptr; + v627 = hir.load v626 : i32; + scf.yield v627; } else { - ^block61: - v421 = arith.constant 8 : i32; - v422 = arith.add v360, v421 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v422, v352, v384) - v406 = arith.constant 8 : u32; - v423 = hir.bitcast v360 : u32; - v425 = arith.add v423, v406 : u32 #[overflow = checked]; - v714 = arith.constant 4 : u32; - v427 = arith.mod v425, v714 : u32; - hir.assertz v427 #[code = 250]; - v428 = hir.int_to_ptr v425 : ptr; - v429 = hir.load v428 : i32; - scf.yield v429; + ^block67: + v613 = arith.constant 8 : i32; + v614 = arith.add v552, v613 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v614, v544, v576) + v598 = arith.constant 8 : u32; + v615 = hir.bitcast v552 : u32; + v617 = arith.add v615, v598 : u32 #[overflow = checked]; + v955 = arith.constant 4 : u32; + v619 = arith.mod v617, v955 : u32; + hir.assertz v619 #[code = 250]; + v620 = hir.int_to_ptr v617 : ptr; + v621 = hir.load v620 : i32; + scf.yield v621; }; - v713 = arith.constant 0 : i32; - v438 = arith.neq v677, v713 : i1; - scf.if v438{ - ^block62: - v712 = arith.constant 8 : u32; - v455 = hir.bitcast v349 : u32; - v457 = arith.add v455, v712 : u32 #[overflow = checked]; - v711 = arith.constant 4 : u32; - v459 = arith.mod v457, v711 : u32; - hir.assertz v459 #[code = 250]; - v460 = hir.int_to_ptr v457 : ptr; - hir.store v460, v677; - v710 = arith.constant 4 : u32; - v462 = hir.bitcast v349 : u32; - v464 = arith.add v462, v710 : u32 #[overflow = checked]; - v709 = arith.constant 4 : u32; - v466 = arith.mod v464, v709 : u32; - hir.assertz v466 #[code = 250]; - v467 = hir.int_to_ptr v464 : ptr; - hir.store v467, v350; + v954 = arith.constant 0 : i32; + v630 = arith.neq v918, v954 : i1; + scf.if v630{ + ^block68: + v953 = arith.constant 8 : u32; + v647 = hir.bitcast v541 : u32; + v649 = arith.add v647, v953 : u32 #[overflow = checked]; + v952 = arith.constant 4 : u32; + v651 = arith.mod v649, v952 : u32; + hir.assertz v651 #[code = 250]; + v652 = hir.int_to_ptr v649 : ptr; + hir.store v652, v918; + v951 = arith.constant 4 : u32; + v654 = hir.bitcast v541 : u32; + v656 = arith.add v654, v951 : u32 #[overflow = checked]; + v950 = arith.constant 4 : u32; + v658 = arith.mod v656, v950 : u32; + hir.assertz v658 #[code = 250]; + v659 = hir.int_to_ptr v656 : ptr; + hir.store v659, v542; scf.yield ; } else { - ^block63: - v708 = arith.constant 8 : u32; - v441 = hir.bitcast v349 : u32; - v443 = arith.add v441, v708 : u32 #[overflow = checked]; - v707 = arith.constant 4 : u32; - v445 = arith.mod v443, v707 : u32; - hir.assertz v445 #[code = 250]; - v446 = hir.int_to_ptr v443 : ptr; - hir.store v446, v384; - v706 = arith.constant 4 : u32; - v448 = hir.bitcast v349 : u32; - v450 = arith.add v448, v706 : u32 #[overflow = checked]; - v705 = arith.constant 4 : u32; - v452 = arith.mod v450, v705 : u32; - hir.assertz v452 #[code = 250]; - v453 = hir.int_to_ptr v450 : ptr; - hir.store v453, v352; + ^block69: + v949 = arith.constant 8 : u32; + v633 = hir.bitcast v541 : u32; + v635 = arith.add v633, v949 : u32 #[overflow = checked]; + v948 = arith.constant 4 : u32; + v637 = arith.mod v635, v948 : u32; + hir.assertz v637 #[code = 250]; + v638 = hir.int_to_ptr v635 : ptr; + hir.store v638, v576; + v947 = arith.constant 4 : u32; + v640 = hir.bitcast v541 : u32; + v642 = arith.add v640, v947 : u32 #[overflow = checked]; + v946 = arith.constant 4 : u32; + v644 = arith.mod v642, v946 : u32; + hir.assertz v644 #[code = 250]; + v645 = hir.int_to_ptr v642 : ptr; + hir.store v645, v544; scf.yield ; }; - v703 = arith.constant 1 : i32; - v704 = arith.constant 0 : i32; - v676 = cf.select v438, v704, v703 : i32; - scf.yield v676; + v944 = arith.constant 1 : i32; + v945 = arith.constant 0 : i32; + v917 = cf.select v630, v945, v944 : i32; + scf.yield v917; } else { - ^block58: - v702 = arith.constant 8 : u32; - v405 = hir.bitcast v349 : u32; - v407 = arith.add v405, v702 : u32 #[overflow = checked]; - v701 = arith.constant 4 : u32; - v409 = arith.mod v407, v701 : u32; - hir.assertz v409 #[code = 250]; - v410 = hir.int_to_ptr v407 : ptr; - hir.store v410, v352; - v700 = arith.constant 4 : u32; - v413 = hir.bitcast v349 : u32; - v415 = arith.add v413, v700 : u32 #[overflow = checked]; - v699 = arith.constant 4 : u32; - v417 = arith.mod v415, v699 : u32; - hir.assertz v417 #[code = 250]; - v698 = arith.constant 0 : i32; - v418 = hir.int_to_ptr v415 : ptr; - hir.store v418, v698; - v697 = arith.constant 0 : i32; - scf.yield v697; + ^block64: + v943 = arith.constant 8 : u32; + v597 = hir.bitcast v541 : u32; + v599 = arith.add v597, v943 : u32 #[overflow = checked]; + v942 = arith.constant 4 : u32; + v601 = arith.mod v599, v942 : u32; + hir.assertz v601 #[code = 250]; + v602 = hir.int_to_ptr v599 : ptr; + hir.store v602, v544; + v941 = arith.constant 4 : u32; + v605 = hir.bitcast v541 : u32; + v607 = arith.add v605, v941 : u32 #[overflow = checked]; + v940 = arith.constant 4 : u32; + v609 = arith.mod v607, v940 : u32; + hir.assertz v609 #[code = 250]; + v939 = arith.constant 0 : i32; + v610 = hir.int_to_ptr v607 : ptr; + hir.store v610, v939; + v938 = arith.constant 0 : i32; + scf.yield v938; }; - scf.yield v678; + scf.yield v919; } else { - ^block56: - v696 = ub.poison i32 : i32; - scf.yield v696; + ^block62: + v937 = ub.poison i32 : i32; + scf.yield v937; }; - v691 = arith.constant 0 : u32; - v624 = arith.constant 1 : u32; - v684 = cf.select v393, v624, v691 : u32; - v692 = ub.poison i32 : i32; - v683 = cf.select v393, v360, v692 : i32; - v693 = ub.poison i32 : i32; - v682 = cf.select v393, v349, v693 : i32; - v694 = ub.poison i32 : i32; - v681 = cf.select v393, v694, v360 : i32; - v695 = ub.poison i32 : i32; - v680 = cf.select v393, v695, v349 : i32; - scf.yield v680, v681, v682, v679, v683, v684; + v932 = arith.constant 0 : u32; + v865 = arith.constant 1 : u32; + v925 = cf.select v585, v865, v932 : u32; + v933 = ub.poison i32 : i32; + v924 = cf.select v585, v552, v933 : i32; + v934 = ub.poison i32 : i32; + v923 = cf.select v585, v541, v934 : i32; + v935 = ub.poison i32 : i32; + v922 = cf.select v585, v935, v552 : i32; + v936 = ub.poison i32 : i32; + v921 = cf.select v585, v936, v541 : i32; + scf.yield v921, v922, v923, v920, v924, v925; }; - v637, v638, v639 = scf.index_switch v636 : i32, i32, i32 + v878, v879, v880 = scf.index_switch v877 : i32, i32, i32 case 0 { - ^block54: - v690 = arith.constant 4 : u32; - v396 = hir.bitcast v631 : u32; - v398 = arith.add v396, v690 : u32 #[overflow = checked]; - v689 = arith.constant 4 : u32; - v400 = arith.mod v398, v689 : u32; - hir.assertz v400 #[code = 250]; - v688 = arith.constant 0 : i32; - v401 = hir.int_to_ptr v398 : ptr; - hir.store v401, v688; - v687 = arith.constant 1 : i32; - scf.yield v631, v687, v632; + ^block60: + v931 = arith.constant 4 : u32; + v588 = hir.bitcast v872 : u32; + v590 = arith.add v588, v931 : u32 #[overflow = checked]; + v930 = arith.constant 4 : u32; + v592 = arith.mod v590, v930 : u32; + hir.assertz v592 #[code = 250]; + v929 = arith.constant 0 : i32; + v593 = hir.int_to_ptr v590 : ptr; + hir.store v593, v929; + v928 = arith.constant 1 : i32; + scf.yield v872, v928, v873; } default { - ^block95: - scf.yield v633, v634, v635; + ^block103: + scf.yield v874, v875, v876; }; - v471 = hir.bitcast v637 : u32; - v686 = arith.constant 4 : u32; - v473 = arith.mod v471, v686 : u32; - hir.assertz v473 #[code = 250]; - v474 = hir.int_to_ptr v471 : ptr; - hir.store v474, v638; - v685 = arith.constant 16 : i32; - v479 = arith.add v639, v685 : i32 #[overflow = wrapping]; - v480 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v481 = hir.bitcast v480 : ptr; - hir.store v481, v479; + v663 = hir.bitcast v878 : u32; + v927 = arith.constant 4 : u32; + v665 = arith.mod v663, v927 : u32; + hir.assertz v665 #[code = 250]; + v666 = hir.int_to_ptr v663 : ptr; + hir.store v666, v879; + v926 = arith.constant 16 : i32; + v671 = arith.add v880, v926 : i32 #[overflow = wrapping]; + v672 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v673 = hir.bitcast v672 : ptr; + hir.store v673, v671; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v482: i32, v483: i32) { - ^block64(v482: i32, v483: i32): + private builtin.function @alloc::raw_vec::handle_error(v674: i32, v675: i32) { + ^block70(v674: i32, v675: i32): ub.unreachable ; }; - private builtin.function @::max(v484: i32, v485: i32) -> i32 { - ^block66(v484: i32, v485: i32): - v492 = arith.constant 0 : i32; - v488 = hir.bitcast v485 : u32; - v487 = hir.bitcast v484 : u32; - v489 = arith.gt v487, v488 : i1; - v490 = arith.zext v489 : u32; - v491 = hir.bitcast v490 : i32; - v493 = arith.neq v491, v492 : i1; - v494 = cf.select v493, v484, v485 : i32; - builtin.ret v494; + private builtin.function @::max(v676: i32, v677: i32) -> i32 { + ^block72(v676: i32, v677: i32): + v684 = arith.constant 0 : i32; + v680 = hir.bitcast v677 : u32; + v679 = hir.bitcast v676 : u32; + v681 = arith.gt v679, v680 : i1; + v682 = arith.zext v681 : u32; + v683 = hir.bitcast v682 : i32; + v685 = arith.neq v683, v684 : i1; + v686 = cf.select v685, v676, v677 : i32; + builtin.ret v686; }; builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/adv_load_preimage.masm b/tests/integration/expected/adv_load_preimage.masm index 9462251be..e921f4b90 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -5,16 +5,24 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop push.1048576 u32assert - mem_store.278528 + mem_store.278536 end # mod ::"root_ns:root@1.0.0"::adv_load_preimage @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048576 + push.1048604 movup.2 swap.1 trace.240 @@ -26,7 +34,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048576 + push.1048604 dup.1 swap.2 swap.3 @@ -102,7 +110,7 @@ end @callconv("C") pub proc entrypoint(i32, felt, felt, felt, felt) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -110,9 +118,9 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.48 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -122,10 +130,256 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop - dup.2 + push.28 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.6 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + dup.1 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::from + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.24 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.16 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1048588 + push.3 + push.16 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.2 + push.16 dup.4 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + push.16 + dup.5 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + push.16 dup.6 - dup.8 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 trace.240 nop exec.::"root_ns:root@1.0.0"::adv_load_preimage::"intrinsics::advice::adv_push_mapvaln" @@ -133,11 +387,20 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop u32split push.0 + push.0 + mul.4294967296 + add push.3 - dup.3 - dup.3 - drop - u32and + push.0 + dup.4 + dup.4 + trace.240 + nop + exec.::miden::core::math::u64::and + trace.252 + nop + mul.4294967296 + add assert_eq push.2 push.0 @@ -160,6 +423,77 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop mul.4294967296 add + push.8 + dup.2 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.24 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.16 + dup.4 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop push.2 dup.1 u32split @@ -168,7 +502,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) u32shl push.4 push.0 - push.4 + push.36 dup.5 u32wrapping_add dup.3 @@ -181,7 +515,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::"root_ns:root@1.0.0"::adv_load_preimage::::try_allocate_in trace.252 nop - push.8 + push.40 dup.3 add u32assert @@ -198,7 +532,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.4 + push.36 dup.4 add u32assert @@ -226,15 +560,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) drop movup.2 drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.12 + push.44 movup.2 add u32assert @@ -259,7 +585,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop push.0 else - push.12 + push.44 dup.4 add u32assert @@ -276,22 +602,108 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + push.1048588 + push.3 + push.16 + dup.7 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 push.2 + push.16 + dup.8 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 dup.1 swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + push.16 + dup.9 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + push.16 + dup.10 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::adv_load_preimage::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + dup.5 + swap.1 u32shr - movup.5 - swap.7 - movdn.5 - movup.3 - swap.9 - movdn.3 movup.2 - swap.10 + swap.4 movdn.2 swap.1 + swap.5 swap.8 - swap.4 trace.240 nop exec.::"root_ns:root@1.0.0"::adv_load_preimage::"miden::core::mem::pipe_preimage_to_memory" @@ -299,7 +711,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop drop push.8 - dup.1 + dup.5 add u32assert push.4 @@ -308,7 +720,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) u32mod u32assert assertz - dup.4 + dup.2 swap.1 u32divmod.4 swap.1 @@ -318,7 +730,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.4 - dup.1 + dup.5 add u32assert push.4 @@ -336,14 +748,13 @@ pub proc entrypoint(i32, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop + movup.4 push.4 dup.1 swap.1 u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -353,7 +764,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) nop push.0 push.0 - dup.4 + dup.2 eq neq if.true @@ -377,6 +788,9 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.1 + push.0 + mul.4294967296 + add assert_eq push.4 dup.2 @@ -396,10 +810,13 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.2 + push.0 + mul.4294967296 + add assert_eq push.0 push.5 - dup.4 + dup.2 swap.1 u32lte neq @@ -427,10 +844,13 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.6 + push.0 + mul.4294967296 + add assert_eq push.0 push.14 - movup.4 + movup.2 swap.1 u32lte neq @@ -441,7 +861,7 @@ pub proc entrypoint(i32, felt, felt, felt, felt) drop else push.56 - movup.3 + movup.2 add u32assert push.4 @@ -458,11 +878,14 @@ pub proc entrypoint(i32, felt, felt, felt, felt) trace.252 nop push.15 + push.0 + mul.4294967296 + add assert_eq - push.16 + push.48 movup.2 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -711,6 +1134,109 @@ proc miden::core::mem::pipe_preimage_to_memory( nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + @callconv("C") proc ::alloc_impl( i32, @@ -795,7 +1321,7 @@ proc ::allocate( i32, i32 ) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -805,7 +1331,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -898,7 +1424,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -916,7 +1442,7 @@ proc ::try_allocate_in( i32, i32 ) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -926,7 +1452,7 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -1307,7 +1833,7 @@ proc ::try_allocate_in( nop push.16 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/adv_load_preimage.wat b/tests/integration/expected/adv_load_preimage.wat index 4a368b6ce..f37232498 100644 --- a/tests/integration/expected/adv_load_preimage.wat +++ b/tests/integration/expected/adv_load_preimage.wat @@ -7,27 +7,26 @@ (type (;5;) (func (param f32 f32 f32 f32) (result f32))) (type (;6;) (func (param f32) (result i64))) (type (;7;) (func (param f32 f32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param i64) (result f32))) - (type (;10;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) + (type (;8;) (func (param i64) (result f32))) + (type (;9;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) + (type (;10;) (func (param i32 i32))) (type (;11;) (func (param i32 i32 i32 i32))) (type (;12;) (func (param i32 i32 i32))) (type (;13;) (func (param i32 i32 i32 i32 i32))) - (type (;14;) (func (param i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) (func $__rustc::__rust_alloc (;0;) (type 0) (param i32 i32) (result i32) - i32.const 1048576 + i32.const 1048604 local.get 1 local.get 0 call $::alloc ) (func $__rustc::__rust_alloc_zeroed (;1;) (type 0) (param i32 i32) (result i32) block ;; label = @1 - i32.const 1048576 + i32.const 1048604 local.get 1 local.get 0 call $::alloc @@ -45,114 +44,195 @@ local.get 1 ) (func $entrypoint (;2;) (type 1) (param i32 f32 f32 f32 f32) - (local i32 i64 f32 i32 i32 i32) + (local i32 i64 i32 i32 i32) global.get $__stack_pointer - i32.const 16 + i32.const 48 i32.sub local.tee 5 global.set $__stack_pointer + local.get 5 local.get 4 + f32.store offset=28 + local.get 5 local.get 3 + f32.store offset=24 + local.get 5 local.get 2 + f32.store offset=20 + local.get 5 local.get 1 + f32.store offset=16 + local.get 5 + local.get 5 + i32.const 16 + i32.add + call $>::from + local.get 5 + local.get 5 + i64.load offset=8 + i64.store offset=24 + local.get 5 + local.get 5 + i64.load + i64.store offset=16 + local.get 5 + i32.const 16 + i32.add + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 5 + i32.const 16 + i32.add + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 5 + i32.const 16 + i32.add + i32.const 1 + i32.const 1048588 + call $>::index + f32.load + local.get 5 + i32.const 16 + i32.add + i32.const 0 + i32.const 1048588 + call $>::index + f32.load call $intrinsics::advice::adv_push_mapvaln call $intrinsics::felt::as_u64 local.tee 6 - i32.wrap_i64 - i32.const 3 - i32.and - call $intrinsics::felt::from_u32 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 3 + i64.and + call $intrinsics::felt::from_u64_unchecked + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - local.get 5 - i32.const 4 - i32.add local.get 6 i64.const 2 i64.shr_u call $intrinsics::felt::from_u64_unchecked - local.tee 7 + local.set 4 + local.get 5 + local.get 5 + i64.load offset=8 + i64.store offset=24 + local.get 5 + local.get 5 + i64.load + i64.store offset=16 + local.get 5 + i32.const 36 + i32.add + local.get 4 call $intrinsics::felt::as_u64 i32.wrap_i64 i32.const 2 i32.shl - local.tee 8 + local.tee 7 i32.const 0 i32.const 4 i32.const 4 call $::try_allocate_in local.get 5 - i32.load offset=8 - local.set 9 + i32.load offset=40 + local.set 8 block ;; label = @1 block ;; label = @2 local.get 5 - i32.load offset=4 + i32.load offset=36 i32.const 1 i32.eq br_if 0 (;@2;) - local.get 7 + local.get 4 local.get 5 - i32.load offset=12 - local.tee 10 + i32.load offset=44 + local.tee 9 i32.const 2 i32.shr_u - local.get 4 - local.get 3 - local.get 2 - local.get 1 + local.get 5 + i32.const 16 + i32.add + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 5 + i32.const 16 + i32.add + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 5 + i32.const 16 + i32.add + i32.const 1 + i32.const 1048588 + call $>::index + f32.load + local.get 5 + i32.const 16 + i32.add + i32.const 0 + i32.const 1048588 + call $>::index + f32.load call $miden::core::mem::pipe_preimage_to_memory drop local.get 0 - local.get 8 + local.get 7 i32.store offset=8 local.get 0 - local.get 10 + local.get 9 i32.store offset=4 local.get 0 - local.get 9 - i32.store local.get 8 + i32.store + local.get 7 i32.eqz br_if 1 (;@1;) - local.get 10 + local.get 9 f32.load - i32.const 1 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - local.get 10 + local.get 9 f32.load offset=4 - i32.const 2 - call $intrinsics::felt::from_u32 + i64.const 2 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - local.get 8 + local.get 7 i32.const 5 i32.le_u br_if 1 (;@1;) - local.get 10 + local.get 9 f32.load offset=20 - i32.const 6 - call $intrinsics::felt::from_u32 + i64.const 6 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - local.get 8 + local.get 7 i32.const 14 i32.le_u br_if 1 (;@1;) - local.get 10 + local.get 9 f32.load offset=56 - i32.const 15 - call $intrinsics::felt::from_u32 + i64.const 15 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 - i32.const 16 + i32.const 48 i32.add global.set $__stack_pointer return end - local.get 9 + local.get 8 local.get 5 - i32.load offset=12 + i32.load offset=44 call $alloc::raw_vec::handle_error end unreachable @@ -244,16 +324,38 @@ (func $intrinsics::felt::assert_eq (;8;) (type 7) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;9;) (type 8) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;9;) (type 8) (param i64) (result f32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;10;) (type 9) (param i64) (result f32) + (func $miden::core::mem::pipe_preimage_to_memory (;10;) (type 9) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) - (func $miden::core::mem::pipe_preimage_to_memory (;11;) (type 10) (param f32 i32 f32 f32 f32 f32) (result i32) + (func $>::index (;11;) (type 3) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end unreachable ) - (func $::alloc_impl (;12;) (type 11) (param i32 i32 i32 i32) + (func $>::from (;12;) (type 10) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $::alloc_impl (;13;) (type 11) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -280,7 +382,7 @@ local.get 1 i32.store ) - (func $::allocate (;13;) (type 12) (param i32 i32 i32) + (func $::allocate (;14;) (type 12) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -309,7 +411,7 @@ i32.add global.set $__stack_pointer ) - (func $::try_allocate_in (;14;) (type 13) (param i32 i32 i32 i32 i32) + (func $::try_allocate_in (;15;) (type 13) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -420,10 +522,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;15;) (type 14) (param i32 i32) + (func $alloc::raw_vec::handle_error (;16;) (type 10) (param i32 i32) unreachable ) - (func $::max (;16;) (type 0) (param i32 i32) (result i32) + (func $::max (;17;) (type 0) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -431,4 +533,5 @@ i32.gt_u select ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/examples/auth_component_no_auth.wat b/tests/integration/expected/examples/auth_component_no_auth.wat index f3e2ed388..d9e296f45 100644 --- a/tests/integration/expected/examples/auth_component_no_auth.wat +++ b/tests/integration/expected/examples/auth_component_no_auth.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -137,15 +136,14 @@ (component $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-auth-procedure" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "auth-procedure" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-auth-procedure" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "auth-procedure" (func 0) (func (type 7))) ) (instance $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-instance (;1;) (instantiate $miden:auth-component-no-auth/auth-component-no-auth@0.1.0-shim-component (with "import-func-auth-procedure" (func $auth-procedure)) diff --git a/tests/integration/expected/examples/basic_wallet.hir b/tests/integration/expected/examples/basic_wallet.hir index 70afe81cd..63d9417f4 100644 --- a/tests/integration/expected/examples/basic_wallet.hir +++ b/tests/integration/expected/examples/basic_wallet.hir @@ -32,33 +32,33 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v20 = arith.constant 8 : u32; v19 = hir.bitcast v10 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v289 = arith.constant 4 : u32; - v23 = arith.mod v21, v289 : u32; + v328 = arith.constant 4 : u32; + v23 = arith.mod v21, v328 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v2; - v288 = arith.constant 4 : u32; + v327 = arith.constant 4 : u32; v25 = hir.bitcast v10 : u32; - v27 = arith.add v25, v288 : u32 #[overflow = checked]; - v287 = arith.constant 4 : u32; - v29 = arith.mod v27, v287 : u32; + v27 = arith.add v25, v327 : u32 #[overflow = checked]; + v326 = arith.constant 4 : u32; + v29 = arith.mod v27, v326 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; hir.store v30, v1; v31 = hir.bitcast v10 : u32; - v286 = arith.constant 4 : u32; - v33 = arith.mod v31, v286 : u32; + v325 = arith.constant 4 : u32; + v33 = arith.mod v31, v325 : u32; hir.assertz v33 #[code = 250]; v34 = hir.int_to_ptr v31 : ptr; hir.store v34, v0; v35 = arith.constant 16 : i32; v36 = arith.add v10, v35 : i32 #[overflow = wrapping]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::remove_asset(v36, v10) - v285 = arith.constant 16 : i32; - v38 = arith.add v10, v285 : i32 #[overflow = wrapping]; + v324 = arith.constant 16 : i32; + v38 = arith.add v10, v324 : i32 #[overflow = wrapping]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::output_note::add_asset(v38, v4) - v284 = arith.constant 32 : i32; - v40 = arith.add v10, v284 : i32 #[overflow = wrapping]; + v323 = arith.constant 32 : i32; + v40 = arith.add v10, v323 : i32 #[overflow = wrapping]; v41 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v42 = hir.bitcast v41 : ptr; hir.store v42, v40; @@ -87,30 +87,30 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v62 = arith.constant 8 : u32; v61 = hir.bitcast v52 : u32; v63 = arith.add v61, v62 : u32 #[overflow = checked]; - v294 = arith.constant 4 : u32; - v65 = arith.mod v63, v294 : u32; + v333 = arith.constant 4 : u32; + v65 = arith.mod v63, v333 : u32; hir.assertz v65 #[code = 250]; v66 = hir.int_to_ptr v63 : ptr; hir.store v66, v45; - v293 = arith.constant 4 : u32; + v332 = arith.constant 4 : u32; v67 = hir.bitcast v52 : u32; - v69 = arith.add v67, v293 : u32 #[overflow = checked]; - v292 = arith.constant 4 : u32; - v71 = arith.mod v69, v292 : u32; + v69 = arith.add v67, v332 : u32 #[overflow = checked]; + v331 = arith.constant 4 : u32; + v71 = arith.mod v69, v331 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; hir.store v72, v44; v73 = hir.bitcast v52 : u32; - v291 = arith.constant 4 : u32; - v75 = arith.mod v73, v291 : u32; + v330 = arith.constant 4 : u32; + v75 = arith.mod v73, v330 : u32; hir.assertz v75 #[code = 250]; v76 = hir.int_to_ptr v73 : ptr; hir.store v76, v43; v77 = arith.constant 16 : i32; v78 = arith.add v52, v77 : i32 #[overflow = wrapping]; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden_base_sys::bindings::native_account::add_asset(v78, v52) - v290 = arith.constant 32 : i32; - v80 = arith.add v52, v290 : i32 #[overflow = wrapping]; + v329 = arith.constant 32 : i32; + v80 = arith.add v52, v329 : i32 #[overflow = wrapping]; v81 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr v82 = hir.bitcast v81 : ptr; hir.store v82, v80; @@ -122,7 +122,7 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v84 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr v85 = hir.bitcast v84 : ptr; v86 = hir.load v85 : i32; - v87 = arith.constant 1048584 : i32; + v87 = arith.constant 1048612 : i32; v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; v89 = hir.bitcast v88 : u32; v90 = hir.int_to_ptr v89 : ptr; @@ -140,12 +140,12 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { v97 = hir.bitcast v96 : ptr; v98 = hir.load v97 : i32; hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__wasm_call_ctors() - v296 = arith.constant 1 : u8; - v298 = arith.constant 1048584 : i32; - v100 = arith.add v98, v298 : i32 #[overflow = wrapping]; + v335 = arith.constant 1 : u8; + v337 = arith.constant 1048612 : i32; + v100 = arith.add v98, v337 : i32 #[overflow = wrapping]; v104 = hir.bitcast v100 : u32; v105 = hir.int_to_ptr v104 : ptr; - hir.store v105, v296; + hir.store v105, v335; scf.yield ; }; builtin.ret ; @@ -153,202 +153,242 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { private builtin.function @miden_base_sys::bindings::native_account::add_asset(v106: i32, v107: i32) { ^block17(v106: i32, v107: i32): - v109 = arith.constant 12 : u32; - v108 = hir.bitcast v107 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v111 = arith.constant 4 : u32; - v112 = arith.mod v110, v111 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v116 = arith.constant 8 : u32; - v115 = hir.bitcast v107 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v302 = arith.constant 4 : u32; - v119 = arith.mod v117, v302 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v301 = arith.constant 4 : u32; - v122 = hir.bitcast v107 : u32; - v124 = arith.add v122, v301 : u32 #[overflow = checked]; - v300 = arith.constant 4 : u32; - v126 = arith.mod v124, v300 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - v128 = hir.load v127 : felt; - v129 = hir.bitcast v107 : u32; - v299 = arith.constant 4 : u32; - v131 = arith.mod v129, v299 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::native_account::add_asset(v114, v121, v128, v133, v106) + v110 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v111 = hir.bitcast v110 : ptr; + v112 = hir.load v111 : i32; + v113 = arith.constant 1048596 : i32; + v114 = arith.add v112, v113 : i32 #[overflow = wrapping]; + v109 = arith.constant 3 : i32; + v115 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v107, v109, v114) : i32 + v116 = hir.bitcast v115 : u32; + v117 = arith.constant 4 : u32; + v118 = arith.mod v116, v117 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : felt; + v121 = arith.constant 2 : i32; + v122 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v107, v121, v114) : i32 + v123 = hir.bitcast v122 : u32; + v340 = arith.constant 4 : u32; + v125 = arith.mod v123, v340 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + v127 = hir.load v126 : felt; + v128 = arith.constant 1 : i32; + v129 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v107, v128, v114) : i32 + v130 = hir.bitcast v129 : u32; + v339 = arith.constant 4 : u32; + v132 = arith.mod v130, v339 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : felt; + v108 = arith.constant 0 : i32; + v136 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v107, v108, v114) : i32 + v137 = hir.bitcast v136 : u32; + v338 = arith.constant 4 : u32; + v139 = arith.mod v137, v338 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::native_account::add_asset(v120, v127, v134, v141, v106) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::add_asset(v134: i32, v135: felt) { - ^block19(v134: i32, v135: felt): - v137 = arith.constant 12 : u32; - v136 = hir.bitcast v134 : u32; - v138 = arith.add v136, v137 : u32 #[overflow = checked]; - v139 = arith.constant 4 : u32; - v140 = arith.mod v138, v139 : u32; - hir.assertz v140 #[code = 250]; - v141 = hir.int_to_ptr v138 : ptr; - v142 = hir.load v141 : felt; - v144 = arith.constant 8 : u32; - v143 = hir.bitcast v134 : u32; - v145 = arith.add v143, v144 : u32 #[overflow = checked]; - v306 = arith.constant 4 : u32; - v147 = arith.mod v145, v306 : u32; - hir.assertz v147 #[code = 250]; - v148 = hir.int_to_ptr v145 : ptr; - v149 = hir.load v148 : felt; - v305 = arith.constant 4 : u32; - v150 = hir.bitcast v134 : u32; - v152 = arith.add v150, v305 : u32 #[overflow = checked]; - v304 = arith.constant 4 : u32; - v154 = arith.mod v152, v304 : u32; + private builtin.function @miden_base_sys::bindings::output_note::add_asset(v142: i32, v143: felt) { + ^block19(v142: i32, v143: felt): + v146 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v147 = hir.bitcast v146 : ptr; + v148 = hir.load v147 : i32; + v149 = arith.constant 1048596 : i32; + v150 = arith.add v148, v149 : i32 #[overflow = wrapping]; + v145 = arith.constant 3 : i32; + v151 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v142, v145, v150) : i32 + v152 = hir.bitcast v151 : u32; + v153 = arith.constant 4 : u32; + v154 = arith.mod v152, v153 : u32; hir.assertz v154 #[code = 250]; v155 = hir.int_to_ptr v152 : ptr; v156 = hir.load v155 : felt; - v157 = hir.bitcast v134 : u32; - v303 = arith.constant 4 : u32; - v159 = arith.mod v157, v303 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - v161 = hir.load v160 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::output_note::add_asset(v142, v149, v156, v161, v135) + v157 = arith.constant 2 : i32; + v158 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v142, v157, v150) : i32 + v159 = hir.bitcast v158 : u32; + v343 = arith.constant 4 : u32; + v161 = arith.mod v159, v343 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : felt; + v164 = arith.constant 1 : i32; + v165 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v142, v164, v150) : i32 + v166 = hir.bitcast v165 : u32; + v342 = arith.constant 4 : u32; + v168 = arith.mod v166, v342 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + v170 = hir.load v169 : felt; + v144 = arith.constant 0 : i32; + v172 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v142, v144, v150) : i32 + v173 = hir.bitcast v172 : u32; + v341 = arith.constant 4 : u32; + v175 = arith.mod v173, v341 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::output_note::add_asset(v156, v163, v170, v177, v143) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::native_account::remove_asset(v162: i32, v163: i32) { - ^block21(v162: i32, v163: i32): - v165 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v166 = hir.bitcast v165 : ptr; - v167 = hir.load v166 : i32; - v168 = arith.constant 16 : i32; - v169 = arith.sub v167, v168 : i32 #[overflow = wrapping]; - v170 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v171 = hir.bitcast v170 : ptr; - hir.store v171, v169; - v173 = arith.constant 12 : u32; - v172 = hir.bitcast v163 : u32; - v174 = arith.add v172, v173 : u32 #[overflow = checked]; - v175 = arith.constant 4 : u32; - v176 = arith.mod v174, v175 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : felt; - v180 = arith.constant 8 : u32; - v179 = hir.bitcast v163 : u32; - v181 = arith.add v179, v180 : u32 #[overflow = checked]; - v323 = arith.constant 4 : u32; - v183 = arith.mod v181, v323 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - v185 = hir.load v184 : felt; - v322 = arith.constant 4 : u32; - v186 = hir.bitcast v163 : u32; - v188 = arith.add v186, v322 : u32 #[overflow = checked]; - v321 = arith.constant 4 : u32; - v190 = arith.mod v188, v321 : u32; - hir.assertz v190 #[code = 250]; - v191 = hir.int_to_ptr v188 : ptr; - v192 = hir.load v191 : felt; - v193 = hir.bitcast v163 : u32; - v320 = arith.constant 4 : u32; - v195 = arith.mod v193, v320 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - v197 = hir.load v196 : felt; - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::native_account::remove_asset(v178, v185, v192, v197, v169) - v198 = hir.bitcast v169 : u32; - v319 = arith.constant 8 : u32; - v200 = arith.mod v198, v319 : u32; - hir.assertz v200 #[code = 250]; - v201 = hir.int_to_ptr v198 : ptr; - v202 = hir.load v201 : i64; - v310, v311 = arith.split v202 : felt, felt; - v318 = arith.constant 8 : u32; - v206 = hir.bitcast v162 : u32; - v208 = arith.add v206, v318 : u32 #[overflow = checked]; - v317 = arith.constant 8 : u32; - v210 = arith.mod v208, v317 : u32; - hir.assertz v210 #[code = 250]; - v312 = arith.join v311, v310 : i64; - v211 = hir.int_to_ptr v208 : ptr; - hir.store v211, v312; - v316 = arith.constant 8 : u32; - v212 = hir.bitcast v169 : u32; - v214 = arith.add v212, v316 : u32 #[overflow = checked]; - v315 = arith.constant 8 : u32; - v216 = arith.mod v214, v315 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - v218 = hir.load v217 : i64; - v307, v308 = arith.split v218 : felt, felt; - v222 = hir.bitcast v162 : u32; - v314 = arith.constant 8 : u32; - v224 = arith.mod v222, v314 : u32; - hir.assertz v224 #[code = 250]; - v309 = arith.join v308, v307 : i64; - v225 = hir.int_to_ptr v222 : ptr; - hir.store v225, v309; - v313 = arith.constant 16 : i32; - v227 = arith.add v169, v313 : i32 #[overflow = wrapping]; - v228 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr - v229 = hir.bitcast v228 : ptr; - hir.store v229, v227; + private builtin.function @miden_base_sys::bindings::native_account::remove_asset(v178: i32, v179: i32) { + ^block21(v178: i32, v179: i32): + v181 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v182 = hir.bitcast v181 : ptr; + v183 = hir.load v182 : i32; + v184 = arith.constant 16 : i32; + v185 = arith.sub v183, v184 : i32 #[overflow = wrapping]; + v186 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v187 = hir.bitcast v186 : ptr; + hir.store v187, v185; + v189 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v190 = hir.bitcast v189 : ptr; + v191 = hir.load v190 : i32; + v192 = arith.constant 1048596 : i32; + v193 = arith.add v191, v192 : i32 #[overflow = wrapping]; + v188 = arith.constant 3 : i32; + v194 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v179, v188, v193) : i32 + v195 = hir.bitcast v194 : u32; + v196 = arith.constant 4 : u32; + v197 = arith.mod v195, v196 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + v199 = hir.load v198 : felt; + v200 = arith.constant 2 : i32; + v201 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v179, v200, v193) : i32 + v202 = hir.bitcast v201 : u32; + v358 = arith.constant 4 : u32; + v204 = arith.mod v202, v358 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + v206 = hir.load v205 : felt; + v207 = arith.constant 1 : i32; + v208 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v179, v207, v193) : i32 + v209 = hir.bitcast v208 : u32; + v357 = arith.constant 4 : u32; + v211 = arith.mod v209, v357 : u32; + hir.assertz v211 #[code = 250]; + v212 = hir.int_to_ptr v209 : ptr; + v213 = hir.load v212 : felt; + v180 = arith.constant 0 : i32; + v215 = hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/>::index(v179, v180, v193) : i32 + v216 = hir.bitcast v215 : u32; + v356 = arith.constant 4 : u32; + v218 = arith.mod v216, v356 : u32; + hir.assertz v218 #[code = 250]; + v219 = hir.int_to_ptr v216 : ptr; + v220 = hir.load v219 : felt; + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden::protocol::native_account::remove_asset(v199, v206, v213, v220, v185) + v221 = hir.bitcast v185 : u32; + v222 = arith.constant 8 : u32; + v223 = arith.mod v221, v222 : u32; + hir.assertz v223 #[code = 250]; + v224 = hir.int_to_ptr v221 : ptr; + v225 = hir.load v224 : i64; + v347, v348 = arith.split v225 : felt, felt; + v355 = arith.constant 8 : u32; + v229 = hir.bitcast v178 : u32; + v231 = arith.add v229, v355 : u32 #[overflow = checked]; + v354 = arith.constant 8 : u32; + v233 = arith.mod v231, v354 : u32; + hir.assertz v233 #[code = 250]; + v349 = arith.join v348, v347 : i64; + v234 = hir.int_to_ptr v231 : ptr; + hir.store v234, v349; + v353 = arith.constant 8 : u32; + v235 = hir.bitcast v185 : u32; + v237 = arith.add v235, v353 : u32 #[overflow = checked]; + v352 = arith.constant 8 : u32; + v239 = arith.mod v237, v352 : u32; + hir.assertz v239 #[code = 250]; + v240 = hir.int_to_ptr v237 : ptr; + v241 = hir.load v240 : i64; + v344, v345 = arith.split v241 : felt, felt; + v245 = hir.bitcast v178 : u32; + v351 = arith.constant 8 : u32; + v247 = arith.mod v245, v351 : u32; + hir.assertz v247 #[code = 250]; + v346 = arith.join v345, v344 : i64; + v248 = hir.int_to_ptr v245 : ptr; + hir.store v248, v346; + v350 = arith.constant 16 : i32; + v250 = arith.add v185, v350 : i32 #[overflow = wrapping]; + v251 = builtin.global_symbol @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/__stack_pointer : ptr + v252 = hir.bitcast v251 : ptr; + hir.store v252, v250; builtin.ret ; }; - private builtin.function @miden::protocol::native_account::add_asset(v230: felt, v231: felt, v232: felt, v233: felt, v234: i32) { - ^block23(v230: felt, v231: felt, v232: felt, v233: felt, v234: i32): - v235, v236, v237, v238 = hir.exec @miden/protocol/native_account/add_asset(v230, v231, v232, v233) : felt, felt, felt, felt - v239 = hir.bitcast v234 : u32; - v240 = hir.int_to_ptr v239 : ptr; - hir.store v240, v235; - v241 = arith.constant 4 : u32; - v242 = arith.add v239, v241 : u32 #[overflow = checked]; - v243 = hir.int_to_ptr v242 : ptr; - hir.store v243, v236; - v244 = arith.constant 8 : u32; - v245 = arith.add v239, v244 : u32 #[overflow = checked]; - v246 = hir.int_to_ptr v245 : ptr; - hir.store v246, v237; - v247 = arith.constant 12 : u32; - v248 = arith.add v239, v247 : u32 #[overflow = checked]; - v249 = hir.int_to_ptr v248 : ptr; - hir.store v249, v238; + private builtin.function @>::index(v253: i32, v254: i32, v255: i32) -> i32 { + ^block23(v253: i32, v254: i32, v255: i32): + v263 = arith.constant 0 : i32; + v360 = arith.constant 3 : u32; + v258 = hir.bitcast v254 : u32; + v260 = arith.gt v258, v360 : i1; + v261 = arith.zext v260 : u32; + v262 = hir.bitcast v261 : i32; + v264 = arith.neq v262, v263 : i1; + cf.cond_br v264 ^block25, ^block26; + ^block25: + ub.unreachable ; + ^block26: + v359 = arith.constant 2 : u32; + v267 = arith.shl v254, v359 : i32; + v268 = arith.add v253, v267 : i32 #[overflow = wrapping]; + builtin.ret v268; + }; + + private builtin.function @miden::protocol::native_account::add_asset(v269: felt, v270: felt, v271: felt, v272: felt, v273: i32) { + ^block27(v269: felt, v270: felt, v271: felt, v272: felt, v273: i32): + v274, v275, v276, v277 = hir.exec @miden/protocol/native_account/add_asset(v269, v270, v271, v272) : felt, felt, felt, felt + v278 = hir.bitcast v273 : u32; + v279 = hir.int_to_ptr v278 : ptr; + hir.store v279, v274; + v280 = arith.constant 4 : u32; + v281 = arith.add v278, v280 : u32 #[overflow = checked]; + v282 = hir.int_to_ptr v281 : ptr; + hir.store v282, v275; + v283 = arith.constant 8 : u32; + v284 = arith.add v278, v283 : u32 #[overflow = checked]; + v285 = hir.int_to_ptr v284 : ptr; + hir.store v285, v276; + v286 = arith.constant 12 : u32; + v287 = arith.add v278, v286 : u32 #[overflow = checked]; + v288 = hir.int_to_ptr v287 : ptr; + hir.store v288, v277; builtin.ret ; }; - private builtin.function @miden::protocol::native_account::remove_asset(v250: felt, v251: felt, v252: felt, v253: felt, v254: i32) { - ^block28(v250: felt, v251: felt, v252: felt, v253: felt, v254: i32): - v255, v256, v257, v258 = hir.exec @miden/protocol/native_account/remove_asset(v250, v251, v252, v253) : felt, felt, felt, felt - v259 = hir.bitcast v254 : u32; - v260 = hir.int_to_ptr v259 : ptr; - hir.store v260, v255; - v261 = arith.constant 4 : u32; - v262 = arith.add v259, v261 : u32 #[overflow = checked]; - v263 = hir.int_to_ptr v262 : ptr; - hir.store v263, v256; - v264 = arith.constant 8 : u32; - v265 = arith.add v259, v264 : u32 #[overflow = checked]; - v266 = hir.int_to_ptr v265 : ptr; - hir.store v266, v257; - v267 = arith.constant 12 : u32; - v268 = arith.add v259, v267 : u32 #[overflow = checked]; - v269 = hir.int_to_ptr v268 : ptr; - hir.store v269, v258; + private builtin.function @miden::protocol::native_account::remove_asset(v289: felt, v290: felt, v291: felt, v292: felt, v293: i32) { + ^block32(v289: felt, v290: felt, v291: felt, v292: felt, v293: i32): + v294, v295, v296, v297 = hir.exec @miden/protocol/native_account/remove_asset(v289, v290, v291, v292) : felt, felt, felt, felt + v298 = hir.bitcast v293 : u32; + v299 = hir.int_to_ptr v298 : ptr; + hir.store v299, v294; + v300 = arith.constant 4 : u32; + v301 = arith.add v298, v300 : u32 #[overflow = checked]; + v302 = hir.int_to_ptr v301 : ptr; + hir.store v302, v295; + v303 = arith.constant 8 : u32; + v304 = arith.add v298, v303 : u32 #[overflow = checked]; + v305 = hir.int_to_ptr v304 : ptr; + hir.store v305, v296; + v306 = arith.constant 12 : u32; + v307 = arith.add v298, v306 : u32 #[overflow = checked]; + v308 = hir.int_to_ptr v307 : ptr; + hir.store v308, v297; builtin.ret ; }; - private builtin.function @miden::protocol::output_note::add_asset(v270: felt, v271: felt, v272: felt, v273: felt, v274: felt) { - ^block30(v270: felt, v271: felt, v272: felt, v273: felt, v274: felt): - hir.exec @miden/protocol/output_note/add_asset(v270, v271, v272, v273, v274) + private builtin.function @miden::protocol::output_note::add_asset(v309: felt, v310: felt, v311: felt, v312: felt, v313: felt) { + ^block34(v309: felt, v310: felt, v311: felt, v312: felt, v313: felt): + hir.exec @miden/protocol/output_note/add_asset(v309, v310, v311, v312, v313) builtin.ret ; }; @@ -360,18 +400,20 @@ builtin.component miden:basic-wallet/basic-wallet@0.1.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; - public builtin.function @receive-asset(v275: felt, v276: felt, v277: felt, v278: felt) { - ^block33(v275: felt, v276: felt, v277: felt, v278: felt): - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v275, v276, v277, v278) + public builtin.function @receive-asset(v314: felt, v315: felt, v316: felt, v317: felt) { + ^block37(v314: felt, v315: felt, v316: felt, v317: felt): + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#receive-asset(v314, v315, v316, v317) builtin.ret ; }; - public builtin.function @move-asset-to-note(v279: felt, v280: felt, v281: felt, v282: felt, v283: felt) { - ^block35(v279: felt, v280: felt, v281: felt, v282: felt, v283: felt): - hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v279, v280, v281, v282, v283) + public builtin.function @move-asset-to-note(v318: felt, v319: felt, v320: felt, v321: felt, v322: felt) { + ^block39(v318: felt, v319: felt, v320: felt, v321: felt, v322: felt): + hir.exec @miden:basic-wallet/basic-wallet@0.1.0/basic_wallet/miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note(v318, v319, v320, v321, v322) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index 1dc798f35..31cb9f792 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -27,20 +27,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet @@ -67,7 +67,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( felt, felt ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -77,7 +77,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -187,7 +187,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#move-asset-to-note( nop push.32 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -199,7 +199,7 @@ end @callconv("C") proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -209,7 +209,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -309,7 +309,7 @@ proc miden:basic-wallet/basic-wallet@0.1.0#receive-asset(felt, felt, felt, felt) nop push.32 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -323,7 +323,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -331,7 +331,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -352,7 +352,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -366,7 +366,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -398,10 +398,26 @@ proc miden_base_sys::bindings::native_account::add_asset( i32, i32 ) - push.12 + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.3 dup.2 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -415,10 +431,16 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.2 + dup.4 dup.3 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -432,10 +454,16 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 + push.1 + dup.5 dup.4 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -449,7 +477,17 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.6 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -463,8 +501,10 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movdn.3 + swap.3 + swap.4 swap.2 + swap.1 trace.240 nop exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden::protocol::native_account::add_asset" @@ -477,10 +517,26 @@ proc miden_base_sys::bindings::output_note::add_asset( i32, felt ) - push.12 - dup.1 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.2 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -494,10 +550,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert + push.2 + dup.3 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -511,10 +573,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 - add - u32assert + push.1 + dup.4 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -528,7 +596,17 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.5 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -543,7 +621,6 @@ proc miden_base_sys::bindings::output_note::add_asset( trace.252 nop movdn.3 - swap.2 trace.240 nop exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden::protocol::output_note::add_asset" @@ -556,7 +633,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( i32, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -566,7 +643,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -576,10 +653,26 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.3 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -593,10 +686,16 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -610,10 +709,16 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -627,7 +732,17 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -641,17 +756,19 @@ proc miden_base_sys::bindings::native_account::remove_asset( exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + dup.3 swap.1 swap.3 swap.1 swap.4 + swap.6 + swap.2 trace.240 nop exec.::"miden:basic-wallet/basic-wallet@0.1.0"::basic_wallet::"miden::protocol::native_account::remove_asset" trace.252 nop - dup.0 + dup.1 push.8 dup.1 swap.1 @@ -667,7 +784,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( nop swap.1 push.8 - dup.4 + dup.3 add u32assert push.8 @@ -688,7 +805,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( trace.252 nop push.8 - dup.1 + dup.2 add u32assert push.8 @@ -705,7 +822,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -725,7 +842,7 @@ proc miden_base_sys::bindings::native_account::remove_asset( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -735,6 +852,34 @@ proc miden_base_sys::bindings::native_account::remove_asset( nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + @callconv("C") proc miden::protocol::native_account::add_asset(felt, felt, felt, felt, i32) trace.240 diff --git a/tests/integration/expected/examples/basic_wallet.wat b/tests/integration/expected/examples/basic_wallet.wat index 8cb61876e..ec88557bc 100644 --- a/tests/integration/expected/examples/basic_wallet.wat +++ b/tests/integration/expected/examples/basic_wallet.wat @@ -3,13 +3,12 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) - (type (;7;) (record (field "inner" 1))) - (export (;8;) "note-idx" (type (eq 7))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) + (type (;6;) (record (field "inner" 1))) + (export (;7;) "note-idx" (type (eq 6))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -19,7 +18,8 @@ (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param i32 i32))) (type (;4;) (func (param i32 f32))) - (type (;5;) (func (param f32 f32 f32 f32 i32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;6;) (func (param f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -99,7 +99,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -107,50 +107,97 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::native_account::add_asset (;5;) (type 3) (param i32 i32) + (local i32) local.get 1 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 2 + call $>::index + f32.load local.get 1 - f32.load offset=8 + i32.const 2 + local.get 2 + call $>::index + f32.load local.get 1 - f32.load offset=4 + i32.const 1 + local.get 2 + call $>::index + f32.load local.get 1 + i32.const 0 + local.get 2 + call $>::index f32.load local.get 0 call $miden::protocol::native_account::add_asset ) (func $miden_base_sys::bindings::output_note::add_asset (;6;) (type 4) (param i32 f32) + (local i32) local.get 0 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 2 + call $>::index + f32.load local.get 0 - f32.load offset=8 + i32.const 2 + local.get 2 + call $>::index + f32.load local.get 0 - f32.load offset=4 + i32.const 1 + local.get 2 + call $>::index + f32.load local.get 0 + i32.const 0 + local.get 2 + call $>::index f32.load local.get 1 call $miden::protocol::output_note::add_asset ) (func $miden_base_sys::bindings::native_account::remove_asset (;7;) (type 3) (param i32 i32) - (local i32) + (local i32 i32) global.get $__stack_pointer i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 1 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 1 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 1 + i32.const 0 + local.get 3 + call $>::index f32.load local.get 2 call $miden::protocol::native_account::remove_asset @@ -171,16 +218,32 @@ i32.add global.set $__stack_pointer ) - (func $miden::protocol::native_account::add_asset (;8;) (type 5) (param f32 f32 f32 f32 i32) + (func $>::index (;8;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $miden::protocol::native_account::add_asset (;9;) (type 6) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::protocol::native_account::remove_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::remove_asset (;10;) (type 6) (param f32 f32 f32 f32 i32) unreachable ) - (func $miden::protocol::output_note::add_asset (;10;) (type 1) (param f32 f32 f32 f32 f32) + (func $miden::protocol::output_note::add_asset (;11;) (type 1) (param f32 f32 f32 f32 f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "\19basic_wallet\01\0b0.1.0\03\01\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) @@ -200,25 +263,24 @@ (component $miden:basic-wallet/basic-wallet@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (type (;7;) (record (field "inner" 1))) - (import "import-type-note-idx" (type (;8;) (eq 7))) - (import "import-type-asset0" (type (;9;) (eq 6))) - (type (;10;) (func (param "asset" 9))) - (import "import-func-receive-asset" (func (;0;) (type 10))) - (import "import-type-note-idx0" (type (;11;) (eq 8))) - (type (;12;) (func (param "asset" 9) (param "note-idx" 11))) - (import "import-func-move-asset-to-note" (func (;1;) (type 12))) - (export (;13;) "asset" (type 6)) - (export (;14;) "note-idx" (type 8)) - (type (;15;) (func (param "asset" 13))) - (export (;2;) "receive-asset" (func 0) (func (type 15))) - (type (;16;) (func (param "asset" 13) (param "note-idx" 14))) - (export (;3;) "move-asset-to-note" (func 1) (func (type 16))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (type (;6;) (record (field "inner" 1))) + (import "import-type-note-idx" (type (;7;) (eq 6))) + (import "import-type-asset0" (type (;8;) (eq 5))) + (type (;9;) (func (param "asset" 8))) + (import "import-func-receive-asset" (func (;0;) (type 9))) + (import "import-type-note-idx0" (type (;10;) (eq 7))) + (type (;11;) (func (param "asset" 8) (param "note-idx" 10))) + (import "import-func-move-asset-to-note" (func (;1;) (type 11))) + (export (;12;) "asset" (type 5)) + (export (;13;) "note-idx" (type 7)) + (type (;14;) (func (param "asset" 12))) + (export (;2;) "receive-asset" (func 0) (func (type 14))) + (type (;15;) (func (param "asset" 12) (param "note-idx" 13))) + (export (;3;) "move-asset-to-note" (func 1) (func (type 15))) ) (instance $miden:basic-wallet/basic-wallet@0.1.0-shim-instance (;1;) (instantiate $miden:basic-wallet/basic-wallet@0.1.0-shim-component (with "import-func-receive-asset" (func $receive-asset)) diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index 7393ab47b..1a25b7771 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -1,6 +1,6 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.module public @basic_wallet_tx_script { - private builtin.function @basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt) { + private builtin.function @basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import8(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt) { ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt): hir.call v0, v1, v2, v3, v4 #[callee = miden:basic-wallet/basic-wallet@0.1.0/move-asset-to-note] #[signature = (param felt) (param felt) (param felt) (param felt) (param felt)]; builtin.ret ; @@ -16,7 +16,7 @@ builtin.component miden:base/transaction-script@1.0.0 { v8 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr v9 = hir.bitcast v8 : ptr; v10 = hir.load v9 : i32; - v11 = arith.constant 1048616 : i32; + v11 = arith.constant 1048632 : i32; v12 = arith.add v10, v11 : i32 #[overflow = wrapping]; v13 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v12, v6, v5) : i32 builtin.ret v13; @@ -32,36 +32,36 @@ builtin.component miden:base/transaction-script@1.0.0 { v20 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr v21 = hir.bitcast v20 : ptr; v22 = hir.load v21 : i32; - v23 = arith.constant 1048616 : i32; + v23 = arith.constant 1048632 : i32; v24 = arith.add v22, v23 : i32 #[overflow = wrapping]; v25 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v24, v18, v17) : i32 - v900 = arith.constant 0 : i32; + v1059 = arith.constant 0 : i32; v26 = arith.constant 0 : i32; v27 = arith.eq v25, v26 : i1; v28 = arith.zext v27 : u32; v29 = hir.bitcast v28 : i32; - v31 = arith.neq v29, v900 : i1; + v31 = arith.neq v29, v1059 : i1; scf.if v31{ ^block16: scf.yield ; } else { ^block17: - v898 = arith.constant 0 : i32; - v899 = arith.constant 0 : i32; - v33 = arith.eq v17, v899 : i1; + v1057 = arith.constant 0 : i32; + v1058 = arith.constant 0 : i32; + v33 = arith.eq v17, v1058 : i1; v34 = arith.zext v33 : u32; v35 = hir.bitcast v34 : i32; - v37 = arith.neq v35, v898 : i1; + v37 = arith.neq v35, v1057 : i1; scf.if v37{ - ^block121: + ^block129: scf.yield ; } else { ^block18: - v892 = arith.constant 0 : u8; + v1051 = arith.constant 0 : u8; v40 = hir.bitcast v17 : u32; v41 = hir.bitcast v25 : u32; v42 = hir.int_to_ptr v41 : ptr; - hir.mem_set v42, v40, v892; + hir.mem_set v42, v40, v1051; scf.yield ; }; scf.yield ; @@ -94,20 +94,20 @@ builtin.component miden:base/transaction-script@1.0.0 { scf.yield ; } else { ^block25: - v904 = arith.constant 0 : i32; + v1063 = arith.constant 0 : i32; v55 = hir.bitcast v46 : u32; v54 = hir.bitcast v45 : u32; v56 = arith.gt v54, v55 : i1; v57 = arith.zext v56 : u32; v58 = hir.bitcast v57 : i32; - v60 = arith.neq v58, v904 : i1; + v60 = arith.neq v58, v1063 : i1; scf.if v60{ ^block23: v71 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr v72 = hir.bitcast v71 : ptr; v73 = hir.load v72 : i32; - v903 = arith.constant 1048600 : i32; - v75 = arith.add v73, v903 : i32 #[overflow = wrapping]; + v1062 = arith.constant 1048600 : i32; + v75 = arith.add v73, v1062 : i32 #[overflow = wrapping]; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v45, v46, v75) scf.yield ; } else { @@ -115,8 +115,8 @@ builtin.component miden:base/transaction-script@1.0.0 { v61 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr v62 = hir.bitcast v61 : ptr; v63 = hir.load v62 : i32; - v902 = arith.constant 1048600 : i32; - v65 = arith.add v63, v902 : i32 #[overflow = wrapping]; + v1061 = arith.constant 1048600 : i32; + v65 = arith.add v63, v1061 : i32 #[overflow = wrapping]; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_index_fail::do_panic::runtime(v45, v46, v65) scf.yield ; }; @@ -125,7 +125,7 @@ builtin.component miden:base/transaction-script@1.0.0 { ub.unreachable ; }; - private builtin.function @ as core::ops::index::Index>>::index(v76: i32, v77: i32, v78: i32, v79: i32) { + private builtin.function @ as core::ops::index::Index>>::index(v76: i32, v77: i32, v78: i32, v79: i32) { ^block27(v76: i32, v77: i32, v78: i32, v79: i32): v82 = arith.constant 8 : u32; v81 = hir.bitcast v77 : u32; @@ -144,29 +144,29 @@ builtin.component miden:base/transaction-script@1.0.0 { v94 = arith.neq v92, v80 : i1; cf.cond_br v94 ^block29, ^block30; ^block29: - v911 = arith.constant 4 : u32; + v1070 = arith.constant 4 : u32; v96 = hir.bitcast v76 : u32; - v98 = arith.add v96, v911 : u32 #[overflow = checked]; - v910 = arith.constant 4 : u32; - v100 = arith.mod v98, v910 : u32; + v98 = arith.add v96, v1070 : u32 #[overflow = checked]; + v1069 = arith.constant 4 : u32; + v100 = arith.mod v98, v1069 : u32; hir.assertz v100 #[code = 250]; v95 = arith.sub v79, v78 : i32 #[overflow = wrapping]; v101 = hir.int_to_ptr v98 : ptr; hir.store v101, v95; - v909 = arith.constant 4 : u32; + v1068 = arith.constant 4 : u32; v102 = hir.bitcast v77 : u32; - v104 = arith.add v102, v909 : u32 #[overflow = checked]; - v908 = arith.constant 4 : u32; - v106 = arith.mod v104, v908 : u32; + v104 = arith.add v102, v1068 : u32 #[overflow = checked]; + v1067 = arith.constant 4 : u32; + v106 = arith.mod v104, v1067 : u32; hir.assertz v106 #[code = 250]; v107 = hir.int_to_ptr v104 : ptr; v108 = hir.load v107 : i32; v113 = hir.bitcast v76 : u32; - v907 = arith.constant 4 : u32; - v115 = arith.mod v113, v907 : u32; + v1066 = arith.constant 4 : u32; + v115 = arith.mod v113, v1066 : u32; hir.assertz v115 #[code = 250]; - v905 = arith.constant 2 : u32; - v111 = arith.shl v78, v905 : i32; + v1064 = arith.constant 2 : u32; + v111 = arith.shl v78, v1064 : i32; v112 = arith.add v108, v111 : i32 #[overflow = wrapping]; v116 = hir.int_to_ptr v113 : ptr; hir.store v116, v112; @@ -187,332 +187,487 @@ builtin.component miden:base/transaction-script@1.0.0 { v131 = hir.bitcast v130 : ptr; hir.store v131, v129; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/wit_bindgen::rt::run_ctors_once() - v132 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v120, v119, v118, v117) : felt - v133 = hir.cast v132 : i64; - v914 = arith.constant 0 : felt; - v135 = arith.constant 3 : i32; - v134 = arith.trunc v133 : i32; - v136 = arith.band v134, v135 : i32; - v137 = hir.bitcast v136 : felt; - hir.assert_eq v137, v914; - v142 = arith.constant 2 : i64; - v144 = hir.cast v142 : u32; - v143 = hir.bitcast v133 : u64; - v145 = arith.shr v143, v144 : u64; - v146 = hir.bitcast v145 : i64; - v147 = arith.trunc v146 : felt; - v913 = arith.constant 2 : u32; - v148 = hir.cast v147 : i64; - v149 = arith.trunc v148 : i32; - v152 = arith.shl v149, v913 : i32; - v154 = arith.constant 4 : i32; - v121 = arith.constant 0 : i32; - v140 = arith.constant 64 : i32; - v141 = arith.add v129, v140 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::try_allocate_in(v141, v152, v121, v154, v154) - v157 = arith.constant 68 : u32; - v156 = hir.bitcast v129 : u32; - v158 = arith.add v156, v157 : u32 #[overflow = checked]; - v159 = arith.constant 4 : u32; - v160 = arith.mod v158, v159 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - v162 = hir.load v161 : i32; - v164 = arith.constant 64 : u32; - v163 = hir.bitcast v129 : u32; - v165 = arith.add v163, v164 : u32 #[overflow = checked]; - v983 = arith.constant 4 : u32; - v167 = arith.mod v165, v983 : u32; + v133 = arith.constant 76 : u32; + v132 = hir.bitcast v129 : u32; + v134 = arith.add v132, v133 : u32 #[overflow = checked]; + v135 = arith.constant 4 : u32; + v136 = arith.mod v134, v135 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + hir.store v137, v120; + v139 = arith.constant 72 : u32; + v138 = hir.bitcast v129 : u32; + v140 = arith.add v138, v139 : u32 #[overflow = checked]; + v1180 = arith.constant 4 : u32; + v142 = arith.mod v140, v1180 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + hir.store v143, v119; + v145 = arith.constant 68 : u32; + v144 = hir.bitcast v129 : u32; + v146 = arith.add v144, v145 : u32 #[overflow = checked]; + v1179 = arith.constant 4 : u32; + v148 = arith.mod v146, v1179 : u32; + hir.assertz v148 #[code = 250]; + v149 = hir.int_to_ptr v146 : ptr; + hir.store v149, v118; + v151 = arith.constant 64 : u32; + v150 = hir.bitcast v129 : u32; + v152 = arith.add v150, v151 : u32 #[overflow = checked]; + v1178 = arith.constant 4 : u32; + v154 = arith.mod v152, v1178 : u32; + hir.assertz v154 #[code = 250]; + v155 = hir.int_to_ptr v152 : ptr; + hir.store v155, v117; + v159 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v160 = hir.bitcast v159 : ptr; + v161 = hir.load v160 : i32; + v162 = arith.constant 1048600 : i32; + v163 = arith.add v161, v162 : i32 #[overflow = wrapping]; + v158 = arith.constant 3 : i32; + v156 = arith.constant 64 : i32; + v157 = arith.add v129, v156 : i32 #[overflow = wrapping]; + v164 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v157, v158, v163) : i32 + v165 = hir.bitcast v164 : u32; + v1177 = arith.constant 4 : u32; + v167 = arith.mod v165, v1177 : u32; hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - v169 = hir.load v168 : i32; - v982 = arith.constant 0 : i32; - v170 = arith.constant 1 : i32; - v171 = arith.eq v169, v170 : i1; - v172 = arith.zext v171 : u32; - v173 = hir.bitcast v172 : i32; - v175 = arith.neq v173, v982 : i1; - v919 = scf.if v175 : u32 { + v168 = hir.int_to_ptr v165 : ptr; + v169 = hir.load v168 : felt; + v172 = arith.constant 2 : i32; + v1176 = arith.constant 64 : i32; + v171 = arith.add v129, v1176 : i32 #[overflow = wrapping]; + v173 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v171, v172, v163) : i32 + v174 = hir.bitcast v173 : u32; + v1175 = arith.constant 4 : u32; + v176 = arith.mod v174, v1175 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : felt; + v181 = arith.constant 1 : i32; + v1174 = arith.constant 64 : i32; + v180 = arith.add v129, v1174 : i32 #[overflow = wrapping]; + v182 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v180, v181, v163) : i32 + v183 = hir.bitcast v182 : u32; + v1173 = arith.constant 4 : u32; + v185 = arith.mod v183, v1173 : u32; + hir.assertz v185 #[code = 250]; + v186 = hir.int_to_ptr v183 : ptr; + v187 = hir.load v186 : felt; + v121 = arith.constant 0 : i32; + v1172 = arith.constant 64 : i32; + v189 = arith.add v129, v1172 : i32 #[overflow = wrapping]; + v191 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v189, v121, v163) : i32 + v192 = hir.bitcast v191 : u32; + v1171 = arith.constant 4 : u32; + v194 = arith.mod v192, v1171 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + v196 = hir.load v195 : felt; + v197 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v169, v178, v187, v196) : felt + v198 = hir.cast v197 : i64; + v1170 = arith.constant 3 : i32; + v199 = arith.trunc v198 : i32; + v201 = arith.band v199, v1170 : i32; + v202 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::from_u32(v201) : felt + v122 = arith.constant 0 : i64; + v204 = arith.trunc v122 : felt; + hir.assert_eq v202, v204; + v205 = arith.constant 2 : i64; + v207 = hir.cast v205 : u32; + v206 = hir.bitcast v198 : u64; + v208 = arith.shr v206, v207 : u64; + v209 = hir.bitcast v208 : i64; + v210 = arith.trunc v209 : felt; + v1169 = arith.constant 76 : u32; + v211 = hir.bitcast v129 : u32; + v213 = arith.add v211, v1169 : u32 #[overflow = checked]; + v1168 = arith.constant 4 : u32; + v215 = arith.mod v213, v1168 : u32; + hir.assertz v215 #[code = 250]; + v216 = hir.int_to_ptr v213 : ptr; + hir.store v216, v120; + v1167 = arith.constant 72 : u32; + v217 = hir.bitcast v129 : u32; + v219 = arith.add v217, v1167 : u32 #[overflow = checked]; + v1166 = arith.constant 4 : u32; + v221 = arith.mod v219, v1166 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + hir.store v222, v119; + v1165 = arith.constant 68 : u32; + v223 = hir.bitcast v129 : u32; + v225 = arith.add v223, v1165 : u32 #[overflow = checked]; + v1164 = arith.constant 4 : u32; + v227 = arith.mod v225, v1164 : u32; + hir.assertz v227 #[code = 250]; + v228 = hir.int_to_ptr v225 : ptr; + hir.store v228, v118; + v1163 = arith.constant 64 : u32; + v229 = hir.bitcast v129 : u32; + v231 = arith.add v229, v1163 : u32 #[overflow = checked]; + v1162 = arith.constant 4 : u32; + v233 = arith.mod v231, v1162 : u32; + hir.assertz v233 #[code = 250]; + v234 = hir.int_to_ptr v231 : ptr; + hir.store v234, v117; + v1072 = arith.constant 2 : u32; + v237 = hir.cast v210 : i64; + v238 = arith.trunc v237 : i32; + v241 = arith.shl v238, v1072 : i32; + v243 = arith.constant 4 : i32; + v1161 = arith.constant 0 : i32; + v235 = arith.constant 48 : i32; + v236 = arith.add v129, v235 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::try_allocate_in(v236, v241, v1161, v243, v243) + v246 = arith.constant 52 : u32; + v245 = hir.bitcast v129 : u32; + v247 = arith.add v245, v246 : u32 #[overflow = checked]; + v1160 = arith.constant 4 : u32; + v249 = arith.mod v247, v1160 : u32; + hir.assertz v249 #[code = 250]; + v250 = hir.int_to_ptr v247 : ptr; + v251 = hir.load v250 : i32; + v253 = arith.constant 48 : u32; + v252 = hir.bitcast v129 : u32; + v254 = arith.add v252, v253 : u32 #[overflow = checked]; + v1159 = arith.constant 4 : u32; + v256 = arith.mod v254, v1159 : u32; + hir.assertz v256 #[code = 250]; + v257 = hir.int_to_ptr v254 : ptr; + v258 = hir.load v257 : i32; + v1157 = arith.constant 0 : i32; + v1158 = arith.constant 1 : i32; + v260 = arith.eq v258, v1158 : i1; + v261 = arith.zext v260 : u32; + v262 = hir.bitcast v261 : i32; + v264 = arith.neq v262, v1157 : i1; + v1077 = scf.if v264 : u32 { ^block34: - v373 = arith.constant 72 : u32; - v372 = hir.bitcast v129 : u32; - v374 = arith.add v372, v373 : u32 #[overflow = checked]; - v981 = arith.constant 4 : u32; - v376 = arith.mod v374, v981 : u32; - hir.assertz v376 #[code = 250]; - v377 = hir.int_to_ptr v374 : ptr; - v378 = hir.load v377 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v162, v378) - v915 = arith.constant 0 : u32; - scf.yield v915; + v503 = arith.constant 56 : u32; + v502 = hir.bitcast v129 : u32; + v504 = arith.add v502, v503 : u32 #[overflow = checked]; + v1156 = arith.constant 4 : u32; + v506 = arith.mod v504, v1156 : u32; + hir.assertz v506 #[code = 250]; + v507 = hir.int_to_ptr v504 : ptr; + v508 = hir.load v507 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v251, v508) + v1073 = arith.constant 0 : u32; + scf.yield v1073; } else { ^block35: - v980 = arith.constant 72 : u32; - v176 = hir.bitcast v129 : u32; - v178 = arith.add v176, v980 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v180 = arith.mod v178, v979 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - v182 = hir.load v181 : i32; - v978 = arith.constant 2 : u32; - v184 = hir.bitcast v182 : u32; - v186 = arith.shr v184, v978 : u32; - v187 = hir.bitcast v186 : i32; - v188 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::core::mem::pipe_preimage_to_memory(v147, v187, v120, v119, v118, v117) : i32 - v190 = arith.constant 28 : u32; - v189 = hir.bitcast v129 : u32; - v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v977 = arith.constant 4 : u32; - v193 = arith.mod v191, v977 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v152; - v196 = arith.constant 24 : u32; - v195 = hir.bitcast v129 : u32; - v197 = arith.add v195, v196 : u32 #[overflow = checked]; - v976 = arith.constant 4 : u32; - v199 = arith.mod v197, v976 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v182; - v202 = arith.constant 20 : u32; - v201 = hir.bitcast v129 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v975 = arith.constant 4 : u32; - v205 = arith.mod v203, v975 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v162; - v973 = arith.constant 0 : i32; - v974 = arith.constant 0 : i32; - v208 = arith.eq v152, v974 : i1; - v209 = arith.zext v208 : u32; - v210 = hir.bitcast v209 : i32; - v212 = arith.neq v210, v973 : i1; - v921 = scf.if v212 : u32 { - ^block130: - v972 = arith.constant 0 : u32; - scf.yield v972; + v1155 = arith.constant 56 : u32; + v265 = hir.bitcast v129 : u32; + v267 = arith.add v265, v1155 : u32 #[overflow = checked]; + v1154 = arith.constant 4 : u32; + v269 = arith.mod v267, v1154 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + v271 = hir.load v270 : i32; + v280 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v281 = hir.bitcast v280 : ptr; + v282 = hir.load v281 : i32; + v1153 = arith.constant 1048600 : i32; + v284 = arith.add v282, v1153 : i32 #[overflow = wrapping]; + v1151 = arith.constant 3 : i32; + v1152 = arith.constant 64 : i32; + v278 = arith.add v129, v1152 : i32 #[overflow = wrapping]; + v285 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v278, v1151, v284) : i32 + v286 = hir.bitcast v285 : u32; + v1150 = arith.constant 4 : u32; + v288 = arith.mod v286, v1150 : u32; + hir.assertz v288 #[code = 250]; + v289 = hir.int_to_ptr v286 : ptr; + v290 = hir.load v289 : felt; + v1148 = arith.constant 2 : i32; + v1149 = arith.constant 64 : i32; + v292 = arith.add v129, v1149 : i32 #[overflow = wrapping]; + v294 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v292, v1148, v284) : i32 + v295 = hir.bitcast v294 : u32; + v1147 = arith.constant 4 : u32; + v297 = arith.mod v295, v1147 : u32; + hir.assertz v297 #[code = 250]; + v298 = hir.int_to_ptr v295 : ptr; + v299 = hir.load v298 : felt; + v1145 = arith.constant 1 : i32; + v1146 = arith.constant 64 : i32; + v301 = arith.add v129, v1146 : i32 #[overflow = wrapping]; + v303 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v301, v1145, v284) : i32 + v304 = hir.bitcast v303 : u32; + v1144 = arith.constant 4 : u32; + v306 = arith.mod v304, v1144 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : felt; + v1142 = arith.constant 0 : i32; + v1143 = arith.constant 64 : i32; + v310 = arith.add v129, v1143 : i32 #[overflow = wrapping]; + v312 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v310, v1142, v284) : i32 + v313 = hir.bitcast v312 : u32; + v1141 = arith.constant 4 : u32; + v315 = arith.mod v313, v1141 : u32; + hir.assertz v315 #[code = 250]; + v316 = hir.int_to_ptr v313 : ptr; + v317 = hir.load v316 : felt; + v1140 = arith.constant 2 : u32; + v273 = hir.bitcast v271 : u32; + v275 = arith.shr v273, v1140 : u32; + v276 = hir.bitcast v275 : i32; + v318 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::core::mem::pipe_preimage_to_memory(v210, v276, v290, v299, v308, v317) : i32 + v320 = arith.constant 28 : u32; + v319 = hir.bitcast v129 : u32; + v321 = arith.add v319, v320 : u32 #[overflow = checked]; + v1139 = arith.constant 4 : u32; + v323 = arith.mod v321, v1139 : u32; + hir.assertz v323 #[code = 250]; + v324 = hir.int_to_ptr v321 : ptr; + hir.store v324, v241; + v326 = arith.constant 24 : u32; + v325 = hir.bitcast v129 : u32; + v327 = arith.add v325, v326 : u32 #[overflow = checked]; + v1138 = arith.constant 4 : u32; + v329 = arith.mod v327, v1138 : u32; + hir.assertz v329 #[code = 250]; + v330 = hir.int_to_ptr v327 : ptr; + hir.store v330, v271; + v332 = arith.constant 20 : u32; + v331 = hir.bitcast v129 : u32; + v333 = arith.add v331, v332 : u32 #[overflow = checked]; + v1137 = arith.constant 4 : u32; + v335 = arith.mod v333, v1137 : u32; + hir.assertz v335 #[code = 250]; + v336 = hir.int_to_ptr v333 : ptr; + hir.store v336, v251; + v1135 = arith.constant 0 : i32; + v1136 = arith.constant 0 : i32; + v338 = arith.eq v241, v1136 : i1; + v339 = arith.zext v338 : u32; + v340 = hir.bitcast v339 : i32; + v342 = arith.neq v340, v1135 : i1; + v1079 = scf.if v342 : u32 { + ^block138: + v1134 = arith.constant 0 : u32; + scf.yield v1134; } else { ^block36: - v971 = arith.constant 4 : u32; - v213 = hir.bitcast v182 : u32; - v215 = arith.add v213, v971 : u32 #[overflow = checked]; - v970 = arith.constant 4 : u32; - v217 = arith.mod v215, v970 : u32; - hir.assertz v217 #[code = 250]; - v218 = hir.int_to_ptr v215 : ptr; - v219 = hir.load v218 : felt; - v220 = hir.bitcast v182 : u32; - v969 = arith.constant 4 : u32; - v222 = arith.mod v220, v969 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - v224 = hir.load v223 : felt; - v230 = arith.constant 6 : i32; - v150 = arith.constant 2 : i32; - v227 = arith.constant 20 : i32; - v228 = arith.add v129, v227 : i32 #[overflow = wrapping]; - v225 = arith.constant 8 : i32; - v226 = arith.add v129, v225 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v226, v228, v150, v230) - v232 = arith.constant 12 : u32; - v231 = hir.bitcast v129 : u32; - v233 = arith.add v231, v232 : u32 #[overflow = checked]; - v968 = arith.constant 4 : u32; - v235 = arith.mod v233, v968 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - v237 = hir.load v236 : i32; - v966 = arith.constant 0 : i32; - v967 = arith.constant 4 : i32; - v239 = arith.neq v237, v967 : i1; - v240 = arith.zext v239 : u32; - v241 = hir.bitcast v240 : i32; - v243 = arith.neq v241, v966 : i1; - v923 = scf.if v243 : u32 { - ^block129: - v965 = arith.constant 0 : u32; - scf.yield v965; + v1133 = arith.constant 4 : u32; + v343 = hir.bitcast v271 : u32; + v345 = arith.add v343, v1133 : u32 #[overflow = checked]; + v1132 = arith.constant 4 : u32; + v347 = arith.mod v345, v1132 : u32; + hir.assertz v347 #[code = 250]; + v348 = hir.int_to_ptr v345 : ptr; + v349 = hir.load v348 : felt; + v350 = hir.bitcast v271 : u32; + v1131 = arith.constant 4 : u32; + v352 = arith.mod v350, v1131 : u32; + hir.assertz v352 #[code = 250]; + v353 = hir.int_to_ptr v350 : ptr; + v354 = hir.load v353 : felt; + v360 = arith.constant 6 : i32; + v1130 = arith.constant 2 : i32; + v357 = arith.constant 20 : i32; + v358 = arith.add v129, v357 : i32 #[overflow = wrapping]; + v355 = arith.constant 8 : i32; + v356 = arith.add v129, v355 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v356, v358, v1130, v360) + v362 = arith.constant 12 : u32; + v361 = hir.bitcast v129 : u32; + v363 = arith.add v361, v362 : u32 #[overflow = checked]; + v1129 = arith.constant 4 : u32; + v365 = arith.mod v363, v1129 : u32; + hir.assertz v365 #[code = 250]; + v366 = hir.int_to_ptr v363 : ptr; + v367 = hir.load v366 : i32; + v1127 = arith.constant 0 : i32; + v1128 = arith.constant 4 : i32; + v369 = arith.neq v367, v1128 : i1; + v370 = arith.zext v369 : u32; + v371 = hir.bitcast v370 : i32; + v373 = arith.neq v371, v1127 : i1; + v1081 = scf.if v373 : u32 { + ^block137: + v1126 = arith.constant 0 : u32; + scf.yield v1126; } else { ^block37: - v249 = arith.constant 8 : u32; - v248 = hir.bitcast v129 : u32; - v250 = arith.add v248, v249 : u32 #[overflow = checked]; - v964 = arith.constant 4 : u32; - v252 = arith.mod v250, v964 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i32; - v963 = arith.constant 8 : i32; - v256 = arith.add v254, v963 : i32 #[overflow = wrapping]; - v257 = hir.bitcast v256 : u32; - v962 = arith.constant 4 : u32; - v259 = arith.mod v257, v962 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - v261 = hir.load v260 : i64; - v961 = arith.constant 8 : i32; - v244 = arith.constant 32 : i32; - v245 = arith.add v129, v244 : i32 #[overflow = wrapping]; - v247 = arith.add v245, v961 : i32 #[overflow = wrapping]; - v262 = hir.bitcast v247 : u32; - v960 = arith.constant 8 : u32; - v264 = arith.mod v262, v960 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - hir.store v265, v261; - v266 = hir.bitcast v254 : u32; - v959 = arith.constant 4 : u32; - v268 = arith.mod v266, v959 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - v270 = hir.load v269 : i64; - v272 = arith.constant 32 : u32; - v271 = hir.bitcast v129 : u32; - v273 = arith.add v271, v272 : u32 #[overflow = checked]; - v958 = arith.constant 8 : u32; - v275 = arith.mod v273, v958 : u32; - hir.assertz v275 #[code = 250]; - v276 = hir.int_to_ptr v273 : ptr; - hir.store v276, v270; - v956 = arith.constant 32 : i32; - v280 = arith.add v129, v956 : i32 #[overflow = wrapping]; - v957 = arith.constant 64 : i32; - v278 = arith.add v129, v957 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v278, v280) - v955 = arith.constant 64 : i32; - v282 = arith.add v129, v955 : i32 #[overflow = wrapping]; - v283 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v224, v219, v282) : felt - v287 = arith.constant 10 : i32; - v953 = arith.constant 6 : i32; - v954 = arith.constant 20 : i32; - v285 = arith.add v129, v954 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v129, v285, v953, v287) - v952 = arith.constant 4 : u32; - v288 = hir.bitcast v129 : u32; - v290 = arith.add v288, v952 : u32 #[overflow = checked]; - v951 = arith.constant 4 : u32; - v292 = arith.mod v290, v951 : u32; - hir.assertz v292 #[code = 250]; - v293 = hir.int_to_ptr v290 : ptr; - v294 = hir.load v293 : i32; - v949 = arith.constant 0 : i32; - v950 = arith.constant 4 : i32; - v296 = arith.neq v294, v950 : i1; - v297 = arith.zext v296 : u32; - v298 = hir.bitcast v297 : i32; - v300 = arith.neq v298, v949 : i1; - scf.if v300{ - ^block128: + v379 = arith.constant 8 : u32; + v378 = hir.bitcast v129 : u32; + v380 = arith.add v378, v379 : u32 #[overflow = checked]; + v1125 = arith.constant 4 : u32; + v382 = arith.mod v380, v1125 : u32; + hir.assertz v382 #[code = 250]; + v383 = hir.int_to_ptr v380 : ptr; + v384 = hir.load v383 : i32; + v1124 = arith.constant 8 : i32; + v386 = arith.add v384, v1124 : i32 #[overflow = wrapping]; + v387 = hir.bitcast v386 : u32; + v1123 = arith.constant 4 : u32; + v389 = arith.mod v387, v1123 : u32; + hir.assertz v389 #[code = 250]; + v390 = hir.int_to_ptr v387 : ptr; + v391 = hir.load v390 : i64; + v1122 = arith.constant 8 : i32; + v374 = arith.constant 32 : i32; + v375 = arith.add v129, v374 : i32 #[overflow = wrapping]; + v377 = arith.add v375, v1122 : i32 #[overflow = wrapping]; + v392 = hir.bitcast v377 : u32; + v1121 = arith.constant 8 : u32; + v394 = arith.mod v392, v1121 : u32; + hir.assertz v394 #[code = 250]; + v395 = hir.int_to_ptr v392 : ptr; + hir.store v395, v391; + v396 = hir.bitcast v384 : u32; + v1120 = arith.constant 4 : u32; + v398 = arith.mod v396, v1120 : u32; + hir.assertz v398 #[code = 250]; + v399 = hir.int_to_ptr v396 : ptr; + v400 = hir.load v399 : i64; + v402 = arith.constant 32 : u32; + v401 = hir.bitcast v129 : u32; + v403 = arith.add v401, v402 : u32 #[overflow = checked]; + v1119 = arith.constant 8 : u32; + v405 = arith.mod v403, v1119 : u32; + hir.assertz v405 #[code = 250]; + v406 = hir.int_to_ptr v403 : ptr; + hir.store v406, v400; + v1117 = arith.constant 32 : i32; + v410 = arith.add v129, v1117 : i32 #[overflow = wrapping]; + v1118 = arith.constant 64 : i32; + v408 = arith.add v129, v1118 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v408, v410) + v1116 = arith.constant 64 : i32; + v412 = arith.add v129, v1116 : i32 #[overflow = wrapping]; + v413 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::output_note::create(v354, v349, v412) : felt + v417 = arith.constant 10 : i32; + v1114 = arith.constant 6 : i32; + v1115 = arith.constant 20 : i32; + v415 = arith.add v129, v1115 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>>::index(v129, v415, v1114, v417) + v1113 = arith.constant 4 : u32; + v418 = hir.bitcast v129 : u32; + v420 = arith.add v418, v1113 : u32 #[overflow = checked]; + v1112 = arith.constant 4 : u32; + v422 = arith.mod v420, v1112 : u32; + hir.assertz v422 #[code = 250]; + v423 = hir.int_to_ptr v420 : ptr; + v424 = hir.load v423 : i32; + v1110 = arith.constant 0 : i32; + v1111 = arith.constant 4 : i32; + v426 = arith.neq v424, v1111 : i1; + v427 = arith.zext v426 : u32; + v428 = hir.bitcast v427 : i32; + v430 = arith.neq v428, v1110 : i1; + scf.if v430{ + ^block136: scf.yield ; } else { ^block38: - v305 = hir.bitcast v129 : u32; - v948 = arith.constant 4 : u32; - v307 = arith.mod v305, v948 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - v309 = hir.load v308 : i32; - v947 = arith.constant 8 : i32; - v311 = arith.add v309, v947 : i32 #[overflow = wrapping]; - v312 = hir.bitcast v311 : u32; - v946 = arith.constant 4 : u32; - v314 = arith.mod v312, v946 : u32; - hir.assertz v314 #[code = 250]; - v315 = hir.int_to_ptr v312 : ptr; - v316 = hir.load v315 : i64; - v945 = arith.constant 8 : i32; - v301 = arith.constant 48 : i32; - v302 = arith.add v129, v301 : i32 #[overflow = wrapping]; - v304 = arith.add v302, v945 : i32 #[overflow = wrapping]; - v317 = hir.bitcast v304 : u32; - v944 = arith.constant 8 : u32; - v319 = arith.mod v317, v944 : u32; - hir.assertz v319 #[code = 250]; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v316; - v321 = hir.bitcast v309 : u32; - v943 = arith.constant 4 : u32; - v323 = arith.mod v321, v943 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - v325 = hir.load v324 : i64; - v327 = arith.constant 48 : u32; - v326 = hir.bitcast v129 : u32; - v328 = arith.add v326, v327 : u32 #[overflow = checked]; - v942 = arith.constant 8 : u32; - v330 = arith.mod v328, v942 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - hir.store v331, v325; - v940 = arith.constant 48 : i32; - v335 = arith.add v129, v940 : i32 #[overflow = wrapping]; - v941 = arith.constant 64 : i32; - v333 = arith.add v129, v941 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v333, v335) - v939 = arith.constant 64 : u32; - v336 = hir.bitcast v129 : u32; - v338 = arith.add v336, v939 : u32 #[overflow = checked]; - v938 = arith.constant 4 : u32; - v340 = arith.mod v338, v938 : u32; - hir.assertz v340 #[code = 250]; - v341 = hir.int_to_ptr v338 : ptr; - v342 = hir.load v341 : felt; - v937 = arith.constant 68 : u32; - v343 = hir.bitcast v129 : u32; - v345 = arith.add v343, v937 : u32 #[overflow = checked]; - v936 = arith.constant 4 : u32; - v347 = arith.mod v345, v936 : u32; - hir.assertz v347 #[code = 250]; - v348 = hir.int_to_ptr v345 : ptr; - v349 = hir.load v348 : felt; - v935 = arith.constant 72 : u32; - v350 = hir.bitcast v129 : u32; - v352 = arith.add v350, v935 : u32 #[overflow = checked]; - v934 = arith.constant 4 : u32; - v354 = arith.mod v352, v934 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - v356 = hir.load v355 : felt; - v358 = arith.constant 76 : u32; - v357 = hir.bitcast v129 : u32; - v359 = arith.add v357, v358 : u32 #[overflow = checked]; - v933 = arith.constant 4 : u32; - v361 = arith.mod v359, v933 : u32; - hir.assertz v361 #[code = 250]; - v362 = hir.int_to_ptr v359 : ptr; - v363 = hir.load v362 : felt; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9(v342, v349, v356, v363, v283) - v932 = arith.constant 20 : i32; - v365 = arith.add v129, v932 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v365) - v931 = arith.constant 20 : i32; - v367 = arith.add v129, v931 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v367) - v930 = arith.constant 80 : i32; - v369 = arith.add v129, v930 : i32 #[overflow = wrapping]; - v370 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v371 = hir.bitcast v370 : ptr; - hir.store v371, v369; + v435 = hir.bitcast v129 : u32; + v1109 = arith.constant 4 : u32; + v437 = arith.mod v435, v1109 : u32; + hir.assertz v437 #[code = 250]; + v438 = hir.int_to_ptr v435 : ptr; + v439 = hir.load v438 : i32; + v1108 = arith.constant 8 : i32; + v441 = arith.add v439, v1108 : i32 #[overflow = wrapping]; + v442 = hir.bitcast v441 : u32; + v1107 = arith.constant 4 : u32; + v444 = arith.mod v442, v1107 : u32; + hir.assertz v444 #[code = 250]; + v445 = hir.int_to_ptr v442 : ptr; + v446 = hir.load v445 : i64; + v1105 = arith.constant 8 : i32; + v1106 = arith.constant 48 : i32; + v432 = arith.add v129, v1106 : i32 #[overflow = wrapping]; + v434 = arith.add v432, v1105 : i32 #[overflow = wrapping]; + v447 = hir.bitcast v434 : u32; + v1104 = arith.constant 8 : u32; + v449 = arith.mod v447, v1104 : u32; + hir.assertz v449 #[code = 250]; + v450 = hir.int_to_ptr v447 : ptr; + hir.store v450, v446; + v451 = hir.bitcast v439 : u32; + v1103 = arith.constant 4 : u32; + v453 = arith.mod v451, v1103 : u32; + hir.assertz v453 #[code = 250]; + v454 = hir.int_to_ptr v451 : ptr; + v455 = hir.load v454 : i64; + v1102 = arith.constant 48 : u32; + v456 = hir.bitcast v129 : u32; + v458 = arith.add v456, v1102 : u32 #[overflow = checked]; + v1101 = arith.constant 8 : u32; + v460 = arith.mod v458, v1101 : u32; + hir.assertz v460 #[code = 250]; + v461 = hir.int_to_ptr v458 : ptr; + hir.store v461, v455; + v1099 = arith.constant 48 : i32; + v465 = arith.add v129, v1099 : i32 #[overflow = wrapping]; + v1100 = arith.constant 64 : i32; + v463 = arith.add v129, v1100 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v463, v465) + v1098 = arith.constant 64 : u32; + v466 = hir.bitcast v129 : u32; + v468 = arith.add v466, v1098 : u32 #[overflow = checked]; + v1097 = arith.constant 4 : u32; + v470 = arith.mod v468, v1097 : u32; + hir.assertz v470 #[code = 250]; + v471 = hir.int_to_ptr v468 : ptr; + v472 = hir.load v471 : felt; + v1096 = arith.constant 68 : u32; + v473 = hir.bitcast v129 : u32; + v475 = arith.add v473, v1096 : u32 #[overflow = checked]; + v1095 = arith.constant 4 : u32; + v477 = arith.mod v475, v1095 : u32; + hir.assertz v477 #[code = 250]; + v478 = hir.int_to_ptr v475 : ptr; + v479 = hir.load v478 : felt; + v1094 = arith.constant 72 : u32; + v480 = hir.bitcast v129 : u32; + v482 = arith.add v480, v1094 : u32 #[overflow = checked]; + v1093 = arith.constant 4 : u32; + v484 = arith.mod v482, v1093 : u32; + hir.assertz v484 #[code = 250]; + v485 = hir.int_to_ptr v482 : ptr; + v486 = hir.load v485 : felt; + v1092 = arith.constant 76 : u32; + v487 = hir.bitcast v129 : u32; + v489 = arith.add v487, v1092 : u32 #[overflow = checked]; + v1091 = arith.constant 4 : u32; + v491 = arith.mod v489, v1091 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + v493 = hir.load v492 : felt; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import8(v472, v479, v486, v493, v413) + v1090 = arith.constant 20 : i32; + v495 = arith.add v129, v1090 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v495) + v1089 = arith.constant 20 : i32; + v497 = arith.add v129, v1089 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::drop::Drop>::drop(v497) + v1088 = arith.constant 80 : i32; + v499 = arith.add v129, v1088 : i32 #[overflow = wrapping]; + v500 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v501 = hir.bitcast v500 : ptr; + hir.store v501, v499; scf.yield ; }; - v917 = arith.constant 1 : u32; - v929 = arith.constant 0 : u32; - v927 = cf.select v300, v929, v917 : u32; - scf.yield v927; + v1075 = arith.constant 1 : u32; + v1087 = arith.constant 0 : u32; + v1085 = cf.select v430, v1087, v1075 : u32; + scf.yield v1085; }; - scf.yield v923; + scf.yield v1081; }; - scf.yield v921; + scf.yield v1079; }; - v928 = arith.constant 0 : u32; - v926 = arith.eq v919, v928 : i1; - cf.cond_br v926 ^block33, ^block132; + v1086 = arith.constant 0 : u32; + v1084 = arith.eq v1077, v1086 : i1; + cf.cond_br v1084 ^block33, ^block140; ^block33: ub.unreachable ; - ^block132: + ^block140: builtin.ret ; }; @@ -523,731 +678,769 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block41: - v380 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v381 = hir.bitcast v380 : ptr; - v382 = hir.load v381 : i32; - v383 = arith.constant 1048620 : i32; - v384 = arith.add v382, v383 : i32 #[overflow = wrapping]; - v385 = hir.bitcast v384 : u32; - v386 = hir.int_to_ptr v385 : ptr; - v387 = hir.load v386 : u8; - v379 = arith.constant 0 : i32; - v388 = arith.zext v387 : u32; - v389 = hir.bitcast v388 : i32; - v391 = arith.neq v389, v379 : i1; - scf.if v391{ + v510 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v511 = hir.bitcast v510 : ptr; + v512 = hir.load v511 : i32; + v513 = arith.constant 1048636 : i32; + v514 = arith.add v512, v513 : i32 #[overflow = wrapping]; + v515 = hir.bitcast v514 : u32; + v516 = hir.int_to_ptr v515 : ptr; + v517 = hir.load v516 : u8; + v509 = arith.constant 0 : i32; + v518 = arith.zext v517 : u32; + v519 = hir.bitcast v518 : i32; + v521 = arith.neq v519, v509 : i1; + scf.if v521{ ^block43: scf.yield ; } else { ^block44: - v392 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v393 = hir.bitcast v392 : ptr; - v394 = hir.load v393 : i32; + v522 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v523 = hir.bitcast v522 : ptr; + v524 = hir.load v523 : i32; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__wasm_call_ctors() - v985 = arith.constant 1 : u8; - v987 = arith.constant 1048620 : i32; - v396 = arith.add v394, v987 : i32 #[overflow = wrapping]; - v400 = hir.bitcast v396 : u32; - v401 = hir.int_to_ptr v400 : ptr; - hir.store v401, v985; + v1182 = arith.constant 1 : u8; + v1184 = arith.constant 1048636 : i32; + v526 = arith.add v524, v1184 : i32 #[overflow = wrapping]; + v530 = hir.bitcast v526 : u32; + v531 = hir.int_to_ptr v530 : ptr; + hir.store v531, v1182; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v402: i32, v403: i32, v404: i32) -> i32 { - ^block45(v402: i32, v403: i32, v404: i32): - v407 = arith.constant 16 : i32; - v406 = arith.constant 0 : i32; - v989 = arith.constant 16 : u32; - v409 = hir.bitcast v403 : u32; - v411 = arith.gt v409, v989 : i1; - v412 = arith.zext v411 : u32; - v413 = hir.bitcast v412 : i32; - v415 = arith.neq v413, v406 : i1; - v416 = cf.select v415, v403, v407 : i32; - v1029 = arith.constant 0 : i32; - v417 = arith.constant -1 : i32; - v418 = arith.add v416, v417 : i32 #[overflow = wrapping]; - v419 = arith.band v416, v418 : i32; - v421 = arith.neq v419, v1029 : i1; - v998, v999 = scf.if v421 : i32, u32 { - ^block140: - v990 = arith.constant 0 : u32; - v994 = ub.poison i32 : i32; - scf.yield v994, v990; + private builtin.function @::alloc(v532: i32, v533: i32, v534: i32) -> i32 { + ^block45(v532: i32, v533: i32, v534: i32): + v537 = arith.constant 16 : i32; + v536 = arith.constant 0 : i32; + v1186 = arith.constant 16 : u32; + v539 = hir.bitcast v533 : u32; + v541 = arith.gt v539, v1186 : i1; + v542 = arith.zext v541 : u32; + v543 = hir.bitcast v542 : i32; + v545 = arith.neq v543, v536 : i1; + v546 = cf.select v545, v533, v537 : i32; + v1226 = arith.constant 0 : i32; + v547 = arith.constant -1 : i32; + v548 = arith.add v546, v547 : i32 #[overflow = wrapping]; + v549 = arith.band v546, v548 : i32; + v551 = arith.neq v549, v1226 : i1; + v1195, v1196 = scf.if v551 : i32, u32 { + ^block148: + v1187 = arith.constant 0 : u32; + v1191 = ub.poison i32 : i32; + scf.yield v1191, v1187; } else { ^block48: - v423 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::max(v403, v416) : i32 - v1028 = arith.constant 0 : i32; - v422 = arith.constant -2147483648 : i32; - v424 = arith.sub v422, v423 : i32 #[overflow = wrapping]; - v426 = hir.bitcast v424 : u32; - v425 = hir.bitcast v404 : u32; - v427 = arith.gt v425, v426 : i1; - v428 = arith.zext v427 : u32; - v429 = hir.bitcast v428 : i32; - v431 = arith.neq v429, v1028 : i1; - v1013 = scf.if v431 : i32 { - ^block139: - v1027 = ub.poison i32 : i32; - scf.yield v1027; + v553 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::max(v533, v546) : i32 + v1225 = arith.constant 0 : i32; + v552 = arith.constant -2147483648 : i32; + v554 = arith.sub v552, v553 : i32 #[overflow = wrapping]; + v556 = hir.bitcast v554 : u32; + v555 = hir.bitcast v534 : u32; + v557 = arith.gt v555, v556 : i1; + v558 = arith.zext v557 : u32; + v559 = hir.bitcast v558 : i32; + v561 = arith.neq v559, v1225 : i1; + v1210 = scf.if v561 : i32 { + ^block147: + v1224 = ub.poison i32 : i32; + scf.yield v1224; } else { ^block49: - v1025 = arith.constant 0 : i32; - v437 = arith.sub v1025, v423 : i32 #[overflow = wrapping]; - v1026 = arith.constant -1 : i32; - v433 = arith.add v404, v423 : i32 #[overflow = wrapping]; - v435 = arith.add v433, v1026 : i32 #[overflow = wrapping]; - v438 = arith.band v435, v437 : i32; - v439 = hir.bitcast v402 : u32; - v440 = arith.constant 4 : u32; - v441 = arith.mod v439, v440 : u32; - hir.assertz v441 #[code = 250]; - v442 = hir.int_to_ptr v439 : ptr; - v443 = hir.load v442 : i32; - v1024 = arith.constant 0 : i32; - v445 = arith.neq v443, v1024 : i1; - scf.if v445{ - ^block138: + v1222 = arith.constant 0 : i32; + v567 = arith.sub v1222, v553 : i32 #[overflow = wrapping]; + v1223 = arith.constant -1 : i32; + v563 = arith.add v534, v553 : i32 #[overflow = wrapping]; + v565 = arith.add v563, v1223 : i32 #[overflow = wrapping]; + v568 = arith.band v565, v567 : i32; + v569 = hir.bitcast v532 : u32; + v570 = arith.constant 4 : u32; + v571 = arith.mod v569, v570 : u32; + hir.assertz v571 #[code = 250]; + v572 = hir.int_to_ptr v569 : ptr; + v573 = hir.load v572 : i32; + v1221 = arith.constant 0 : i32; + v575 = arith.neq v573, v1221 : i1; + scf.if v575{ + ^block146: scf.yield ; } else { ^block51: - v446 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 - v447 = hir.mem_size : u32; - v453 = hir.bitcast v402 : u32; - v1023 = arith.constant 4 : u32; - v455 = arith.mod v453, v1023 : u32; - hir.assertz v455 #[code = 250]; - v1022 = arith.constant 16 : u32; - v448 = hir.bitcast v447 : i32; - v451 = arith.shl v448, v1022 : i32; - v452 = arith.add v446, v451 : i32 #[overflow = wrapping]; - v456 = hir.int_to_ptr v453 : ptr; - hir.store v456, v452; + v576 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 + v577 = hir.mem_size : u32; + v583 = hir.bitcast v532 : u32; + v1220 = arith.constant 4 : u32; + v585 = arith.mod v583, v1220 : u32; + hir.assertz v585 #[code = 250]; + v1219 = arith.constant 16 : u32; + v578 = hir.bitcast v577 : i32; + v581 = arith.shl v578, v1219 : i32; + v582 = arith.add v576, v581 : i32 #[overflow = wrapping]; + v586 = hir.int_to_ptr v583 : ptr; + hir.store v586, v582; scf.yield ; }; - v459 = hir.bitcast v402 : u32; - v1021 = arith.constant 4 : u32; - v461 = arith.mod v459, v1021 : u32; - hir.assertz v461 #[code = 250]; - v462 = hir.int_to_ptr v459 : ptr; - v463 = hir.load v462 : i32; - v1019 = arith.constant 0 : i32; - v1020 = arith.constant -1 : i32; - v465 = arith.bxor v463, v1020 : i32; - v467 = hir.bitcast v465 : u32; - v466 = hir.bitcast v438 : u32; - v468 = arith.gt v466, v467 : i1; - v469 = arith.zext v468 : u32; - v470 = hir.bitcast v469 : i32; - v472 = arith.neq v470, v1019 : i1; - v1012 = scf.if v472 : i32 { + v589 = hir.bitcast v532 : u32; + v1218 = arith.constant 4 : u32; + v591 = arith.mod v589, v1218 : u32; + hir.assertz v591 #[code = 250]; + v592 = hir.int_to_ptr v589 : ptr; + v593 = hir.load v592 : i32; + v1216 = arith.constant 0 : i32; + v1217 = arith.constant -1 : i32; + v595 = arith.bxor v593, v1217 : i32; + v597 = hir.bitcast v595 : u32; + v596 = hir.bitcast v568 : u32; + v598 = arith.gt v596, v597 : i1; + v599 = arith.zext v598 : u32; + v600 = hir.bitcast v599 : i32; + v602 = arith.neq v600, v1216 : i1; + v1209 = scf.if v602 : i32 { ^block52: - v1018 = arith.constant 0 : i32; - scf.yield v1018; + v1215 = arith.constant 0 : i32; + scf.yield v1215; } else { ^block53: - v474 = hir.bitcast v402 : u32; - v1017 = arith.constant 4 : u32; - v476 = arith.mod v474, v1017 : u32; - hir.assertz v476 #[code = 250]; - v473 = arith.add v463, v438 : i32 #[overflow = wrapping]; - v477 = hir.int_to_ptr v474 : ptr; - hir.store v477, v473; - v479 = arith.add v463, v423 : i32 #[overflow = wrapping]; - scf.yield v479; + v604 = hir.bitcast v532 : u32; + v1214 = arith.constant 4 : u32; + v606 = arith.mod v604, v1214 : u32; + hir.assertz v606 #[code = 250]; + v603 = arith.add v593, v568 : i32 #[overflow = wrapping]; + v607 = hir.int_to_ptr v604 : ptr; + hir.store v607, v603; + v609 = arith.add v593, v553 : i32 #[overflow = wrapping]; + scf.yield v609; }; - scf.yield v1012; + scf.yield v1209; }; - v995 = arith.constant 1 : u32; - v1016 = arith.constant 0 : u32; - v1014 = cf.select v431, v1016, v995 : u32; - scf.yield v1013, v1014; + v1192 = arith.constant 1 : u32; + v1213 = arith.constant 0 : u32; + v1211 = cf.select v561, v1213, v1192 : u32; + scf.yield v1210, v1211; }; - v1015 = arith.constant 0 : u32; - v1011 = arith.eq v999, v1015 : i1; - cf.cond_br v1011 ^block47, ^block142(v998); + v1212 = arith.constant 0 : u32; + v1208 = arith.eq v1196, v1212 : i1; + cf.cond_br v1208 ^block47, ^block150(v1195); ^block47: ub.unreachable ; - ^block142(v991: i32): - builtin.ret v991; + ^block150(v1188: i32): + builtin.ret v1188; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block54: - v482 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v482; + v612 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v612; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v484: i32) { - ^block58(v484: i32): - v485 = arith.constant 4 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v484, v485, v485) + private builtin.function @ as core::ops::drop::Drop>::drop(v614: i32) { + ^block58(v614: i32): + v615 = arith.constant 4 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v614, v615, v615) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::create(v487: felt, v488: felt, v489: i32) -> felt { - ^block60(v487: felt, v488: felt, v489: i32): - v492 = arith.constant 12 : u32; - v491 = hir.bitcast v489 : u32; - v493 = arith.add v491, v492 : u32 #[overflow = checked]; - v494 = arith.constant 4 : u32; - v495 = arith.mod v493, v494 : u32; - hir.assertz v495 #[code = 250]; - v496 = hir.int_to_ptr v493 : ptr; - v497 = hir.load v496 : felt; - v499 = arith.constant 8 : u32; - v498 = hir.bitcast v489 : u32; - v500 = arith.add v498, v499 : u32 #[overflow = checked]; - v1033 = arith.constant 4 : u32; - v502 = arith.mod v500, v1033 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - v504 = hir.load v503 : felt; - v1032 = arith.constant 4 : u32; - v505 = hir.bitcast v489 : u32; - v507 = arith.add v505, v1032 : u32 #[overflow = checked]; - v1031 = arith.constant 4 : u32; - v509 = arith.mod v507, v1031 : u32; - hir.assertz v509 #[code = 250]; - v510 = hir.int_to_ptr v507 : ptr; - v511 = hir.load v510 : felt; - v512 = hir.bitcast v489 : u32; - v1030 = arith.constant 4 : u32; - v514 = arith.mod v512, v1030 : u32; - hir.assertz v514 #[code = 250]; - v515 = hir.int_to_ptr v512 : ptr; - v516 = hir.load v515 : felt; - v517 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::protocol::output_note::create(v487, v488, v497, v504, v511, v516) : felt - builtin.ret v517; + private builtin.function @miden_base_sys::bindings::output_note::create(v617: felt, v618: felt, v619: i32) -> felt { + ^block60(v617: felt, v618: felt, v619: i32): + v623 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v624 = hir.bitcast v623 : ptr; + v625 = hir.load v624 : i32; + v626 = arith.constant 1048616 : i32; + v627 = arith.add v625, v626 : i32 #[overflow = wrapping]; + v622 = arith.constant 3 : i32; + v628 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v619, v622, v627) : i32 + v629 = hir.bitcast v628 : u32; + v630 = arith.constant 4 : u32; + v631 = arith.mod v629, v630 : u32; + hir.assertz v631 #[code = 250]; + v632 = hir.int_to_ptr v629 : ptr; + v633 = hir.load v632 : felt; + v634 = arith.constant 2 : i32; + v635 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v619, v634, v627) : i32 + v636 = hir.bitcast v635 : u32; + v1229 = arith.constant 4 : u32; + v638 = arith.mod v636, v1229 : u32; + hir.assertz v638 #[code = 250]; + v639 = hir.int_to_ptr v636 : ptr; + v640 = hir.load v639 : felt; + v641 = arith.constant 1 : i32; + v642 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v619, v641, v627) : i32 + v643 = hir.bitcast v642 : u32; + v1228 = arith.constant 4 : u32; + v645 = arith.mod v643, v1228 : u32; + hir.assertz v645 #[code = 250]; + v646 = hir.int_to_ptr v643 : ptr; + v647 = hir.load v646 : felt; + v621 = arith.constant 0 : i32; + v649 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::index(v619, v621, v627) : i32 + v650 = hir.bitcast v649 : u32; + v1227 = arith.constant 4 : u32; + v652 = arith.mod v650, v1227 : u32; + hir.assertz v652 #[code = 250]; + v653 = hir.int_to_ptr v650 : ptr; + v654 = hir.load v653 : felt; + v655 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden::protocol::output_note::create(v617, v618, v633, v640, v647, v654) : felt + builtin.ret v655; }; - private builtin.function @>::from(v518: i32, v519: i32) { - ^block62(v518: i32, v519: i32): - v521 = arith.constant 8 : u32; - v520 = hir.bitcast v519 : u32; - v522 = arith.add v520, v521 : u32 #[overflow = checked]; - v523 = arith.constant 4 : u32; - v524 = arith.mod v522, v523 : u32; - hir.assertz v524 #[code = 250]; - v525 = hir.int_to_ptr v522 : ptr; - v526 = hir.load v525 : i64; - v1037 = arith.constant 8 : u32; - v527 = hir.bitcast v518 : u32; - v529 = arith.add v527, v1037 : u32 #[overflow = checked]; - v1036 = arith.constant 8 : u32; - v531 = arith.mod v529, v1036 : u32; - hir.assertz v531 #[code = 250]; - v532 = hir.int_to_ptr v529 : ptr; - hir.store v532, v526; - v533 = hir.bitcast v519 : u32; - v1035 = arith.constant 4 : u32; - v535 = arith.mod v533, v1035 : u32; - hir.assertz v535 #[code = 250]; - v536 = hir.int_to_ptr v533 : ptr; - v537 = hir.load v536 : i64; - v538 = hir.bitcast v518 : u32; - v1034 = arith.constant 8 : u32; - v540 = arith.mod v538, v1034 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - hir.store v541, v537; + private builtin.function @>::from(v656: i32, v657: i32) { + ^block62(v656: i32, v657: i32): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v656, v657) builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v542: i32) { - ^block64(v542: i32): + private builtin.function @ as core::ops::drop::Drop>::drop(v658: i32) { + ^block64(v658: i32): builtin.ret ; }; - private builtin.function @intrinsics::advice::adv_push_mapvaln(v543: felt, v544: felt, v545: felt, v546: felt) -> felt { - ^block66(v543: felt, v544: felt, v545: felt, v546: felt): - v547 = hir.exec @intrinsics/advice/adv_push_mapvaln(v543, v544, v545, v546) : felt - builtin.ret v547; + private builtin.function @intrinsics::advice::adv_push_mapvaln(v659: felt, v660: felt, v661: felt, v662: felt) -> felt { + ^block66(v659: felt, v660: felt, v661: felt, v662: felt): + v663 = hir.exec @intrinsics/advice/adv_push_mapvaln(v659, v660, v661, v662) : felt + builtin.ret v663; }; - private builtin.function @miden::core::mem::pipe_preimage_to_memory(v549: felt, v550: i32, v551: felt, v552: felt, v553: felt, v554: felt) -> i32 { - ^block69(v549: felt, v550: i32, v551: felt, v552: felt, v553: felt, v554: felt): - v555 = hir.exec @miden/core/mem/pipe_preimage_to_memory(v549, v550, v551, v552, v553, v554) : i32 - builtin.ret v555; + private builtin.function @miden::core::mem::pipe_preimage_to_memory(v665: felt, v666: i32, v667: felt, v668: felt, v669: felt, v670: felt) -> i32 { + ^block69(v665: felt, v666: i32, v667: felt, v668: felt, v669: felt, v670: felt): + v671 = hir.exec @miden/core/mem/pipe_preimage_to_memory(v665, v666, v667, v668, v669, v670) : i32 + builtin.ret v671; + }; + + private builtin.function @::from_u32(v673: i32) -> felt { + ^block74(v673: i32): + v675 = hir.bitcast v673 : felt; + builtin.ret v675; + }; + + private builtin.function @>::index(v676: i32, v677: i32, v678: i32) -> i32 { + ^block76(v676: i32, v677: i32, v678: i32): + v686 = arith.constant 0 : i32; + v1231 = arith.constant 3 : u32; + v681 = hir.bitcast v677 : u32; + v683 = arith.gt v681, v1231 : i1; + v684 = arith.zext v683 : u32; + v685 = hir.bitcast v684 : i32; + v687 = arith.neq v685, v686 : i1; + cf.cond_br v687 ^block78, ^block79; + ^block78: + ub.unreachable ; + ^block79: + v1230 = arith.constant 2 : u32; + v690 = arith.shl v677, v1230 : i32; + v691 = arith.add v676, v690 : i32 #[overflow = wrapping]; + builtin.ret v691; + }; + + private builtin.function @>::from(v692: i32, v693: i32) { + ^block80(v692: i32, v693: i32): + v695 = arith.constant 8 : u32; + v694 = hir.bitcast v693 : u32; + v696 = arith.add v694, v695 : u32 #[overflow = checked]; + v697 = arith.constant 4 : u32; + v698 = arith.mod v696, v697 : u32; + hir.assertz v698 #[code = 250]; + v699 = hir.int_to_ptr v696 : ptr; + v700 = hir.load v699 : i64; + v1237 = arith.constant 8 : u32; + v701 = hir.bitcast v692 : u32; + v703 = arith.add v701, v1237 : u32 #[overflow = checked]; + v1236 = arith.constant 8 : u32; + v705 = arith.mod v703, v1236 : u32; + hir.assertz v705 #[code = 250]; + v706 = hir.int_to_ptr v703 : ptr; + hir.store v706, v700; + v707 = hir.bitcast v693 : u32; + v1235 = arith.constant 4 : u32; + v709 = arith.mod v707, v1235 : u32; + hir.assertz v709 #[code = 250]; + v710 = hir.int_to_ptr v707 : ptr; + v711 = hir.load v710 : i64; + v712 = hir.bitcast v692 : u32; + v1234 = arith.constant 8 : u32; + v714 = arith.mod v712, v1234 : u32; + hir.assertz v714 #[code = 250]; + v715 = hir.int_to_ptr v712 : ptr; + hir.store v715, v711; + builtin.ret ; }; - private builtin.function @::alloc_impl(v557: i32, v558: i32, v559: i32, v560: i32) { - ^block74(v557: i32, v558: i32, v559: i32, v560: i32): - v1053 = arith.constant 0 : i32; - v561 = arith.constant 0 : i32; - v562 = arith.eq v559, v561 : i1; - v563 = arith.zext v562 : u32; - v564 = hir.bitcast v563 : i32; - v566 = arith.neq v564, v1053 : i1; - v1049 = scf.if v566 : i32 { - ^block146: - scf.yield v558; + private builtin.function @::alloc_impl(v716: i32, v717: i32, v718: i32, v719: i32) { + ^block82(v716: i32, v717: i32, v718: i32, v719: i32): + v1253 = arith.constant 0 : i32; + v720 = arith.constant 0 : i32; + v721 = arith.eq v718, v720 : i1; + v722 = arith.zext v721 : u32; + v723 = hir.bitcast v722 : i32; + v725 = arith.neq v723, v1253 : i1; + v1249 = scf.if v725 : i32 { + ^block156: + scf.yield v717; } else { - ^block77: + ^block85: hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1052 = arith.constant 0 : i32; - v568 = arith.neq v560, v1052 : i1; - v1048 = scf.if v568 : i32 { - ^block78: - v570 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v559, v558) : i32 - scf.yield v570; + v1252 = arith.constant 0 : i32; + v727 = arith.neq v719, v1252 : i1; + v1248 = scf.if v727 : i32 { + ^block86: + v729 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v718, v717) : i32 + scf.yield v729; } else { - ^block79: - v569 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v559, v558) : i32 - scf.yield v569; + ^block87: + v728 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v718, v717) : i32 + scf.yield v728; }; - scf.yield v1048; + scf.yield v1248; }; - v574 = arith.constant 4 : u32; - v573 = hir.bitcast v557 : u32; - v575 = arith.add v573, v574 : u32 #[overflow = checked]; - v1051 = arith.constant 4 : u32; - v577 = arith.mod v575, v1051 : u32; - hir.assertz v577 #[code = 250]; - v578 = hir.int_to_ptr v575 : ptr; - hir.store v578, v559; - v580 = hir.bitcast v557 : u32; - v1050 = arith.constant 4 : u32; - v582 = arith.mod v580, v1050 : u32; - hir.assertz v582 #[code = 250]; - v583 = hir.int_to_ptr v580 : ptr; - hir.store v583, v1049; + v733 = arith.constant 4 : u32; + v732 = hir.bitcast v716 : u32; + v734 = arith.add v732, v733 : u32 #[overflow = checked]; + v1251 = arith.constant 4 : u32; + v736 = arith.mod v734, v1251 : u32; + hir.assertz v736 #[code = 250]; + v737 = hir.int_to_ptr v734 : ptr; + hir.store v737, v718; + v739 = hir.bitcast v716 : u32; + v1250 = arith.constant 4 : u32; + v741 = arith.mod v739, v1250 : u32; + hir.assertz v741 #[code = 250]; + v742 = hir.int_to_ptr v739 : ptr; + hir.store v742, v1249; builtin.ret ; }; - private builtin.function @::deallocate(v584: i32, v585: i32, v586: i32) { - ^block80(v584: i32, v585: i32, v586: i32): - v588 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v589 = hir.bitcast v588 : ptr; - v590 = hir.load v589 : i32; - v591 = arith.constant 16 : i32; - v592 = arith.sub v590, v591 : i32 #[overflow = wrapping]; - v593 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v594 = hir.bitcast v593 : ptr; - hir.store v594, v592; - v595 = arith.constant 4 : i32; - v596 = arith.add v592, v595 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::current_memory(v596, v584, v585, v586) - v598 = arith.constant 8 : u32; - v597 = hir.bitcast v592 : u32; - v599 = arith.add v597, v598 : u32 #[overflow = checked]; - v600 = arith.constant 4 : u32; - v601 = arith.mod v599, v600 : u32; - hir.assertz v601 #[code = 250]; - v602 = hir.int_to_ptr v599 : ptr; - v603 = hir.load v602 : i32; - v1060 = arith.constant 0 : i32; - v587 = arith.constant 0 : i32; - v605 = arith.eq v603, v587 : i1; - v606 = arith.zext v605 : u32; - v607 = hir.bitcast v606 : i32; - v609 = arith.neq v607, v1060 : i1; - scf.if v609{ - ^block149: + private builtin.function @::deallocate(v743: i32, v744: i32, v745: i32) { + ^block88(v743: i32, v744: i32, v745: i32): + v747 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v748 = hir.bitcast v747 : ptr; + v749 = hir.load v748 : i32; + v750 = arith.constant 16 : i32; + v751 = arith.sub v749, v750 : i32 #[overflow = wrapping]; + v752 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v753 = hir.bitcast v752 : ptr; + hir.store v753, v751; + v754 = arith.constant 4 : i32; + v755 = arith.add v751, v754 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::current_memory(v755, v743, v744, v745) + v757 = arith.constant 8 : u32; + v756 = hir.bitcast v751 : u32; + v758 = arith.add v756, v757 : u32 #[overflow = checked]; + v759 = arith.constant 4 : u32; + v760 = arith.mod v758, v759 : u32; + hir.assertz v760 #[code = 250]; + v761 = hir.int_to_ptr v758 : ptr; + v762 = hir.load v761 : i32; + v1260 = arith.constant 0 : i32; + v746 = arith.constant 0 : i32; + v764 = arith.eq v762, v746 : i1; + v765 = arith.zext v764 : u32; + v766 = hir.bitcast v765 : i32; + v768 = arith.neq v766, v1260 : i1; + scf.if v768{ + ^block159: scf.yield ; } else { - ^block83: - v1059 = arith.constant 4 : u32; - v610 = hir.bitcast v592 : u32; - v612 = arith.add v610, v1059 : u32 #[overflow = checked]; - v1058 = arith.constant 4 : u32; - v614 = arith.mod v612, v1058 : u32; - hir.assertz v614 #[code = 250]; - v615 = hir.int_to_ptr v612 : ptr; - v616 = hir.load v615 : i32; - v618 = arith.constant 12 : u32; - v617 = hir.bitcast v592 : u32; - v619 = arith.add v617, v618 : u32 #[overflow = checked]; - v1057 = arith.constant 4 : u32; - v621 = arith.mod v619, v1057 : u32; - hir.assertz v621 #[code = 250]; - v622 = hir.int_to_ptr v619 : ptr; - v623 = hir.load v622 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v616, v603, v623) + ^block91: + v1259 = arith.constant 4 : u32; + v769 = hir.bitcast v751 : u32; + v771 = arith.add v769, v1259 : u32 #[overflow = checked]; + v1258 = arith.constant 4 : u32; + v773 = arith.mod v771, v1258 : u32; + hir.assertz v773 #[code = 250]; + v774 = hir.int_to_ptr v771 : ptr; + v775 = hir.load v774 : i32; + v777 = arith.constant 12 : u32; + v776 = hir.bitcast v751 : u32; + v778 = arith.add v776, v777 : u32 #[overflow = checked]; + v1257 = arith.constant 4 : u32; + v780 = arith.mod v778, v1257 : u32; + hir.assertz v780 #[code = 250]; + v781 = hir.int_to_ptr v778 : ptr; + v782 = hir.load v781 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v775, v762, v782) scf.yield ; }; - v1056 = arith.constant 16 : i32; - v626 = arith.add v592, v1056 : i32 #[overflow = wrapping]; - v627 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v628 = hir.bitcast v627 : ptr; - hir.store v628, v626; + v1256 = arith.constant 16 : i32; + v785 = arith.add v751, v1256 : i32 #[overflow = wrapping]; + v786 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v787 = hir.bitcast v786 : ptr; + hir.store v787, v785; builtin.ret ; }; - private builtin.function @::current_memory(v629: i32, v630: i32, v631: i32, v632: i32) { - ^block84(v629: i32, v630: i32, v631: i32, v632: i32): - v1086 = arith.constant 0 : i32; - v633 = arith.constant 0 : i32; - v637 = arith.eq v632, v633 : i1; - v638 = arith.zext v637 : u32; - v639 = hir.bitcast v638 : i32; - v641 = arith.neq v639, v1086 : i1; - v1073, v1074 = scf.if v641 : i32, i32 { - ^block152: - v1085 = arith.constant 0 : i32; - v635 = arith.constant 4 : i32; - scf.yield v635, v1085; + private builtin.function @::current_memory(v788: i32, v789: i32, v790: i32, v791: i32) { + ^block92(v788: i32, v789: i32, v790: i32, v791: i32): + v1286 = arith.constant 0 : i32; + v792 = arith.constant 0 : i32; + v796 = arith.eq v791, v792 : i1; + v797 = arith.zext v796 : u32; + v798 = hir.bitcast v797 : i32; + v800 = arith.neq v798, v1286 : i1; + v1273, v1274 = scf.if v800 : i32, i32 { + ^block162: + v1285 = arith.constant 0 : i32; + v794 = arith.constant 4 : i32; + scf.yield v794, v1285; } else { - ^block87: - v642 = hir.bitcast v630 : u32; - v677 = arith.constant 4 : u32; - v644 = arith.mod v642, v677 : u32; - hir.assertz v644 #[code = 250]; - v645 = hir.int_to_ptr v642 : ptr; - v646 = hir.load v645 : i32; - v1083 = arith.constant 0 : i32; - v1084 = arith.constant 0 : i32; - v648 = arith.eq v646, v1084 : i1; - v649 = arith.zext v648 : u32; - v650 = hir.bitcast v649 : i32; - v652 = arith.neq v650, v1083 : i1; - v1071 = scf.if v652 : i32 { - ^block151: - v1082 = arith.constant 0 : i32; - scf.yield v1082; + ^block95: + v801 = hir.bitcast v789 : u32; + v836 = arith.constant 4 : u32; + v803 = arith.mod v801, v836 : u32; + hir.assertz v803 #[code = 250]; + v804 = hir.int_to_ptr v801 : ptr; + v805 = hir.load v804 : i32; + v1283 = arith.constant 0 : i32; + v1284 = arith.constant 0 : i32; + v807 = arith.eq v805, v1284 : i1; + v808 = arith.zext v807 : u32; + v809 = hir.bitcast v808 : i32; + v811 = arith.neq v809, v1283 : i1; + v1271 = scf.if v811 : i32 { + ^block161: + v1282 = arith.constant 0 : i32; + scf.yield v1282; } else { - ^block88: - v1081 = arith.constant 4 : u32; - v653 = hir.bitcast v629 : u32; - v655 = arith.add v653, v1081 : u32 #[overflow = checked]; - v1080 = arith.constant 4 : u32; - v657 = arith.mod v655, v1080 : u32; - hir.assertz v657 #[code = 250]; - v658 = hir.int_to_ptr v655 : ptr; - hir.store v658, v631; - v1079 = arith.constant 4 : u32; - v659 = hir.bitcast v630 : u32; - v661 = arith.add v659, v1079 : u32 #[overflow = checked]; - v1078 = arith.constant 4 : u32; - v663 = arith.mod v661, v1078 : u32; - hir.assertz v663 #[code = 250]; - v664 = hir.int_to_ptr v661 : ptr; - v665 = hir.load v664 : i32; - v666 = hir.bitcast v629 : u32; - v1077 = arith.constant 4 : u32; - v668 = arith.mod v666, v1077 : u32; - hir.assertz v668 #[code = 250]; - v669 = hir.int_to_ptr v666 : ptr; - hir.store v669, v665; - v670 = arith.mul v646, v632 : i32 #[overflow = wrapping]; - scf.yield v670; + ^block96: + v1281 = arith.constant 4 : u32; + v812 = hir.bitcast v788 : u32; + v814 = arith.add v812, v1281 : u32 #[overflow = checked]; + v1280 = arith.constant 4 : u32; + v816 = arith.mod v814, v1280 : u32; + hir.assertz v816 #[code = 250]; + v817 = hir.int_to_ptr v814 : ptr; + hir.store v817, v790; + v1279 = arith.constant 4 : u32; + v818 = hir.bitcast v789 : u32; + v820 = arith.add v818, v1279 : u32 #[overflow = checked]; + v1278 = arith.constant 4 : u32; + v822 = arith.mod v820, v1278 : u32; + hir.assertz v822 #[code = 250]; + v823 = hir.int_to_ptr v820 : ptr; + v824 = hir.load v823 : i32; + v825 = hir.bitcast v788 : u32; + v1277 = arith.constant 4 : u32; + v827 = arith.mod v825, v1277 : u32; + hir.assertz v827 #[code = 250]; + v828 = hir.int_to_ptr v825 : ptr; + hir.store v828, v824; + v829 = arith.mul v805, v791 : i32 #[overflow = wrapping]; + scf.yield v829; }; - v671 = arith.constant 8 : i32; - v1076 = arith.constant 4 : i32; - v1072 = cf.select v652, v1076, v671 : i32; - scf.yield v1072, v1071; + v830 = arith.constant 8 : i32; + v1276 = arith.constant 4 : i32; + v1272 = cf.select v811, v1276, v830 : i32; + scf.yield v1272, v1271; }; - v674 = arith.add v629, v1073 : i32 #[overflow = wrapping]; - v676 = hir.bitcast v674 : u32; - v1075 = arith.constant 4 : u32; - v678 = arith.mod v676, v1075 : u32; - hir.assertz v678 #[code = 250]; - v679 = hir.int_to_ptr v676 : ptr; - hir.store v679, v1074; + v833 = arith.add v788, v1273 : i32 #[overflow = wrapping]; + v835 = hir.bitcast v833 : u32; + v1275 = arith.constant 4 : u32; + v837 = arith.mod v835, v1275 : u32; + hir.assertz v837 #[code = 250]; + v838 = hir.int_to_ptr v835 : ptr; + hir.store v838, v1274; builtin.ret ; }; - private builtin.function @::deallocate(v680: i32, v681: i32, v682: i32) { - ^block89(v680: i32, v681: i32, v682: i32): - v1088 = arith.constant 0 : i32; - v683 = arith.constant 0 : i32; - v684 = arith.eq v682, v683 : i1; - v685 = arith.zext v684 : u32; - v686 = hir.bitcast v685 : i32; - v688 = arith.neq v686, v1088 : i1; - scf.if v688{ - ^block91: + private builtin.function @::deallocate(v839: i32, v840: i32, v841: i32) { + ^block97(v839: i32, v840: i32, v841: i32): + v1288 = arith.constant 0 : i32; + v842 = arith.constant 0 : i32; + v843 = arith.eq v841, v842 : i1; + v844 = arith.zext v843 : u32; + v845 = hir.bitcast v844 : i32; + v847 = arith.neq v845, v1288 : i1; + scf.if v847{ + ^block99: scf.yield ; } else { - ^block92: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v680, v682, v681) + ^block100: + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v839, v841, v840) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v689: i32, v690: i32, v691: i32) { - ^block93(v689: i32, v690: i32, v691: i32): - v693 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v694 = hir.bitcast v693 : ptr; - v695 = hir.load v694 : i32; - v696 = arith.constant 16 : i32; - v697 = arith.sub v695, v696 : i32 #[overflow = wrapping]; - v698 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v699 = hir.bitcast v698 : ptr; - hir.store v699, v697; - v692 = arith.constant 0 : i32; - v700 = arith.constant 8 : i32; - v701 = arith.add v697, v700 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v701, v690, v691, v692) - v704 = arith.constant 12 : u32; - v703 = hir.bitcast v697 : u32; - v705 = arith.add v703, v704 : u32 #[overflow = checked]; - v706 = arith.constant 4 : u32; - v707 = arith.mod v705, v706 : u32; - hir.assertz v707 #[code = 250]; - v708 = hir.int_to_ptr v705 : ptr; - v709 = hir.load v708 : i32; - v711 = arith.constant 8 : u32; - v710 = hir.bitcast v697 : u32; - v712 = arith.add v710, v711 : u32 #[overflow = checked]; - v1093 = arith.constant 4 : u32; - v714 = arith.mod v712, v1093 : u32; - hir.assertz v714 #[code = 250]; - v715 = hir.int_to_ptr v712 : ptr; - v716 = hir.load v715 : i32; - v717 = hir.bitcast v689 : u32; - v1092 = arith.constant 4 : u32; - v719 = arith.mod v717, v1092 : u32; - hir.assertz v719 #[code = 250]; - v720 = hir.int_to_ptr v717 : ptr; - hir.store v720, v716; - v1091 = arith.constant 4 : u32; - v721 = hir.bitcast v689 : u32; - v723 = arith.add v721, v1091 : u32 #[overflow = checked]; - v1090 = arith.constant 4 : u32; - v725 = arith.mod v723, v1090 : u32; - hir.assertz v725 #[code = 250]; - v726 = hir.int_to_ptr v723 : ptr; - hir.store v726, v709; - v1089 = arith.constant 16 : i32; - v728 = arith.add v697, v1089 : i32 #[overflow = wrapping]; - v729 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v730 = hir.bitcast v729 : ptr; - hir.store v730, v728; + private builtin.function @::allocate(v848: i32, v849: i32, v850: i32) { + ^block101(v848: i32, v849: i32, v850: i32): + v852 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v853 = hir.bitcast v852 : ptr; + v854 = hir.load v853 : i32; + v855 = arith.constant 16 : i32; + v856 = arith.sub v854, v855 : i32 #[overflow = wrapping]; + v857 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v858 = hir.bitcast v857 : ptr; + hir.store v858, v856; + v851 = arith.constant 0 : i32; + v859 = arith.constant 8 : i32; + v860 = arith.add v856, v859 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v860, v849, v850, v851) + v863 = arith.constant 12 : u32; + v862 = hir.bitcast v856 : u32; + v864 = arith.add v862, v863 : u32 #[overflow = checked]; + v865 = arith.constant 4 : u32; + v866 = arith.mod v864, v865 : u32; + hir.assertz v866 #[code = 250]; + v867 = hir.int_to_ptr v864 : ptr; + v868 = hir.load v867 : i32; + v870 = arith.constant 8 : u32; + v869 = hir.bitcast v856 : u32; + v871 = arith.add v869, v870 : u32 #[overflow = checked]; + v1293 = arith.constant 4 : u32; + v873 = arith.mod v871, v1293 : u32; + hir.assertz v873 #[code = 250]; + v874 = hir.int_to_ptr v871 : ptr; + v875 = hir.load v874 : i32; + v876 = hir.bitcast v848 : u32; + v1292 = arith.constant 4 : u32; + v878 = arith.mod v876, v1292 : u32; + hir.assertz v878 #[code = 250]; + v879 = hir.int_to_ptr v876 : ptr; + hir.store v879, v875; + v1291 = arith.constant 4 : u32; + v880 = hir.bitcast v848 : u32; + v882 = arith.add v880, v1291 : u32 #[overflow = checked]; + v1290 = arith.constant 4 : u32; + v884 = arith.mod v882, v1290 : u32; + hir.assertz v884 #[code = 250]; + v885 = hir.int_to_ptr v882 : ptr; + hir.store v885, v868; + v1289 = arith.constant 16 : i32; + v887 = arith.add v856, v1289 : i32 #[overflow = wrapping]; + v888 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v889 = hir.bitcast v888 : ptr; + hir.store v889, v887; builtin.ret ; }; - private builtin.function @::try_allocate_in(v731: i32, v732: i32, v733: i32, v734: i32, v735: i32) { - ^block95(v731: i32, v732: i32, v733: i32, v734: i32, v735: i32): - v738 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v739 = hir.bitcast v738 : ptr; - v740 = hir.load v739 : i32; - v741 = arith.constant 16 : i32; - v742 = arith.sub v740, v741 : i32 #[overflow = wrapping]; - v743 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v744 = hir.bitcast v743 : ptr; - hir.store v744, v742; - v754 = hir.bitcast v732 : u32; - v755 = arith.zext v754 : u64; - v756 = hir.bitcast v755 : i64; - v736 = arith.constant 0 : i32; - v749 = arith.sub v736, v734 : i32 #[overflow = wrapping]; - v746 = arith.constant -1 : i32; - v745 = arith.add v734, v735 : i32 #[overflow = wrapping]; - v747 = arith.add v745, v746 : i32 #[overflow = wrapping]; - v750 = arith.band v747, v749 : i32; - v751 = hir.bitcast v750 : u32; - v752 = arith.zext v751 : u64; - v753 = hir.bitcast v752 : i64; - v757 = arith.mul v753, v756 : i64 #[overflow = wrapping]; - v1196 = arith.constant 0 : i32; - v758 = arith.constant 32 : i64; - v760 = hir.cast v758 : u32; - v759 = hir.bitcast v757 : u64; - v761 = arith.shr v759, v760 : u64; - v762 = hir.bitcast v761 : i64; - v763 = arith.trunc v762 : i32; - v765 = arith.neq v763, v1196 : i1; - v1109, v1110, v1111, v1112, v1113, v1114 = scf.if v765 : i32, i32, i32, i32, i32, u32 { - ^block156: - v1094 = arith.constant 0 : u32; - v1101 = ub.poison i32 : i32; - scf.yield v731, v742, v1101, v1101, v1101, v1094; + private builtin.function @::try_allocate_in(v890: i32, v891: i32, v892: i32, v893: i32, v894: i32) { + ^block103(v890: i32, v891: i32, v892: i32, v893: i32, v894: i32): + v897 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v898 = hir.bitcast v897 : ptr; + v899 = hir.load v898 : i32; + v900 = arith.constant 16 : i32; + v901 = arith.sub v899, v900 : i32 #[overflow = wrapping]; + v902 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v903 = hir.bitcast v902 : ptr; + hir.store v903, v901; + v913 = hir.bitcast v891 : u32; + v914 = arith.zext v913 : u64; + v915 = hir.bitcast v914 : i64; + v895 = arith.constant 0 : i32; + v908 = arith.sub v895, v893 : i32 #[overflow = wrapping]; + v905 = arith.constant -1 : i32; + v904 = arith.add v893, v894 : i32 #[overflow = wrapping]; + v906 = arith.add v904, v905 : i32 #[overflow = wrapping]; + v909 = arith.band v906, v908 : i32; + v910 = hir.bitcast v909 : u32; + v911 = arith.zext v910 : u64; + v912 = hir.bitcast v911 : i64; + v916 = arith.mul v912, v915 : i64 #[overflow = wrapping]; + v1396 = arith.constant 0 : i32; + v917 = arith.constant 32 : i64; + v919 = hir.cast v917 : u32; + v918 = hir.bitcast v916 : u64; + v920 = arith.shr v918, v919 : u64; + v921 = hir.bitcast v920 : i64; + v922 = arith.trunc v921 : i32; + v924 = arith.neq v922, v1396 : i1; + v1309, v1310, v1311, v1312, v1313, v1314 = scf.if v924 : i32, i32, i32, i32, i32, u32 { + ^block166: + v1294 = arith.constant 0 : u32; + v1301 = ub.poison i32 : i32; + scf.yield v890, v901, v1301, v1301, v1301, v1294; } else { - ^block100: - v766 = arith.trunc v757 : i32; - v1195 = arith.constant 0 : i32; - v767 = arith.constant -2147483648 : i32; - v768 = arith.sub v767, v734 : i32 #[overflow = wrapping]; - v770 = hir.bitcast v768 : u32; - v769 = hir.bitcast v766 : u32; - v771 = arith.lte v769, v770 : i1; - v772 = arith.zext v771 : u32; - v773 = hir.bitcast v772 : i32; - v775 = arith.neq v773, v1195 : i1; - v1157 = scf.if v775 : i32 { - ^block98: - v1194 = arith.constant 0 : i32; - v786 = arith.neq v766, v1194 : i1; - v1156 = scf.if v786 : i32 { - ^block102: - v1193 = arith.constant 0 : i32; - v802 = arith.neq v733, v1193 : i1; - v1155 = scf.if v802 : i32 { - ^block105: - v784 = arith.constant 1 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v742, v734, v766, v784) - v813 = hir.bitcast v742 : u32; - v854 = arith.constant 4 : u32; - v815 = arith.mod v813, v854 : u32; - hir.assertz v815 #[code = 250]; - v816 = hir.int_to_ptr v813 : ptr; - v817 = hir.load v816 : i32; - scf.yield v817; + ^block108: + v925 = arith.trunc v916 : i32; + v1395 = arith.constant 0 : i32; + v926 = arith.constant -2147483648 : i32; + v927 = arith.sub v926, v893 : i32 #[overflow = wrapping]; + v929 = hir.bitcast v927 : u32; + v928 = hir.bitcast v925 : u32; + v930 = arith.lte v928, v929 : i1; + v931 = arith.zext v930 : u32; + v932 = hir.bitcast v931 : i32; + v934 = arith.neq v932, v1395 : i1; + v1357 = scf.if v934 : i32 { + ^block106: + v1394 = arith.constant 0 : i32; + v945 = arith.neq v925, v1394 : i1; + v1356 = scf.if v945 : i32 { + ^block110: + v1393 = arith.constant 0 : i32; + v961 = arith.neq v892, v1393 : i1; + v1355 = scf.if v961 : i32 { + ^block113: + v943 = arith.constant 1 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc_impl(v901, v893, v925, v943) + v972 = hir.bitcast v901 : u32; + v1013 = arith.constant 4 : u32; + v974 = arith.mod v972, v1013 : u32; + hir.assertz v974 #[code = 250]; + v975 = hir.int_to_ptr v972 : ptr; + v976 = hir.load v975 : i32; + scf.yield v976; } else { - ^block106: - v803 = arith.constant 8 : i32; - v804 = arith.add v742, v803 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v804, v734, v766) - v788 = arith.constant 8 : u32; - v805 = hir.bitcast v742 : u32; - v807 = arith.add v805, v788 : u32 #[overflow = checked]; - v1192 = arith.constant 4 : u32; - v809 = arith.mod v807, v1192 : u32; - hir.assertz v809 #[code = 250]; - v810 = hir.int_to_ptr v807 : ptr; - v811 = hir.load v810 : i32; - scf.yield v811; + ^block114: + v962 = arith.constant 8 : i32; + v963 = arith.add v901, v962 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v963, v893, v925) + v947 = arith.constant 8 : u32; + v964 = hir.bitcast v901 : u32; + v966 = arith.add v964, v947 : u32 #[overflow = checked]; + v1392 = arith.constant 4 : u32; + v968 = arith.mod v966, v1392 : u32; + hir.assertz v968 #[code = 250]; + v969 = hir.int_to_ptr v966 : ptr; + v970 = hir.load v969 : i32; + scf.yield v970; }; - v1191 = arith.constant 0 : i32; - v820 = arith.neq v1155, v1191 : i1; - scf.if v820{ - ^block107: - v1190 = arith.constant 8 : u32; - v837 = hir.bitcast v731 : u32; - v839 = arith.add v837, v1190 : u32 #[overflow = checked]; - v1189 = arith.constant 4 : u32; - v841 = arith.mod v839, v1189 : u32; - hir.assertz v841 #[code = 250]; - v842 = hir.int_to_ptr v839 : ptr; - hir.store v842, v1155; - v1188 = arith.constant 4 : u32; - v844 = hir.bitcast v731 : u32; - v846 = arith.add v844, v1188 : u32 #[overflow = checked]; - v1187 = arith.constant 4 : u32; - v848 = arith.mod v846, v1187 : u32; - hir.assertz v848 #[code = 250]; - v849 = hir.int_to_ptr v846 : ptr; - hir.store v849, v732; + v1391 = arith.constant 0 : i32; + v979 = arith.neq v1355, v1391 : i1; + scf.if v979{ + ^block115: + v1390 = arith.constant 8 : u32; + v996 = hir.bitcast v890 : u32; + v998 = arith.add v996, v1390 : u32 #[overflow = checked]; + v1389 = arith.constant 4 : u32; + v1000 = arith.mod v998, v1389 : u32; + hir.assertz v1000 #[code = 250]; + v1001 = hir.int_to_ptr v998 : ptr; + hir.store v1001, v1355; + v1388 = arith.constant 4 : u32; + v1003 = hir.bitcast v890 : u32; + v1005 = arith.add v1003, v1388 : u32 #[overflow = checked]; + v1387 = arith.constant 4 : u32; + v1007 = arith.mod v1005, v1387 : u32; + hir.assertz v1007 #[code = 250]; + v1008 = hir.int_to_ptr v1005 : ptr; + hir.store v1008, v891; scf.yield ; } else { - ^block108: - v1186 = arith.constant 8 : u32; - v823 = hir.bitcast v731 : u32; - v825 = arith.add v823, v1186 : u32 #[overflow = checked]; - v1185 = arith.constant 4 : u32; - v827 = arith.mod v825, v1185 : u32; - hir.assertz v827 #[code = 250]; - v828 = hir.int_to_ptr v825 : ptr; - hir.store v828, v766; - v1184 = arith.constant 4 : u32; - v830 = hir.bitcast v731 : u32; - v832 = arith.add v830, v1184 : u32 #[overflow = checked]; - v1183 = arith.constant 4 : u32; - v834 = arith.mod v832, v1183 : u32; - hir.assertz v834 #[code = 250]; - v835 = hir.int_to_ptr v832 : ptr; - hir.store v835, v734; + ^block116: + v1386 = arith.constant 8 : u32; + v982 = hir.bitcast v890 : u32; + v984 = arith.add v982, v1386 : u32 #[overflow = checked]; + v1385 = arith.constant 4 : u32; + v986 = arith.mod v984, v1385 : u32; + hir.assertz v986 #[code = 250]; + v987 = hir.int_to_ptr v984 : ptr; + hir.store v987, v925; + v1384 = arith.constant 4 : u32; + v989 = hir.bitcast v890 : u32; + v991 = arith.add v989, v1384 : u32 #[overflow = checked]; + v1383 = arith.constant 4 : u32; + v993 = arith.mod v991, v1383 : u32; + hir.assertz v993 #[code = 250]; + v994 = hir.int_to_ptr v991 : ptr; + hir.store v994, v893; scf.yield ; }; - v1181 = arith.constant 1 : i32; - v1182 = arith.constant 0 : i32; - v1154 = cf.select v820, v1182, v1181 : i32; - scf.yield v1154; + v1381 = arith.constant 1 : i32; + v1382 = arith.constant 0 : i32; + v1354 = cf.select v979, v1382, v1381 : i32; + scf.yield v1354; } else { - ^block103: - v1180 = arith.constant 8 : u32; - v787 = hir.bitcast v731 : u32; - v789 = arith.add v787, v1180 : u32 #[overflow = checked]; - v1179 = arith.constant 4 : u32; - v791 = arith.mod v789, v1179 : u32; - hir.assertz v791 #[code = 250]; - v792 = hir.int_to_ptr v789 : ptr; - hir.store v792, v734; - v1178 = arith.constant 4 : u32; - v795 = hir.bitcast v731 : u32; - v797 = arith.add v795, v1178 : u32 #[overflow = checked]; - v1177 = arith.constant 4 : u32; - v799 = arith.mod v797, v1177 : u32; - hir.assertz v799 #[code = 250]; - v1176 = arith.constant 0 : i32; - v800 = hir.int_to_ptr v797 : ptr; - hir.store v800, v1176; - v1175 = arith.constant 0 : i32; - scf.yield v1175; + ^block111: + v1380 = arith.constant 8 : u32; + v946 = hir.bitcast v890 : u32; + v948 = arith.add v946, v1380 : u32 #[overflow = checked]; + v1379 = arith.constant 4 : u32; + v950 = arith.mod v948, v1379 : u32; + hir.assertz v950 #[code = 250]; + v951 = hir.int_to_ptr v948 : ptr; + hir.store v951, v893; + v1378 = arith.constant 4 : u32; + v954 = hir.bitcast v890 : u32; + v956 = arith.add v954, v1378 : u32 #[overflow = checked]; + v1377 = arith.constant 4 : u32; + v958 = arith.mod v956, v1377 : u32; + hir.assertz v958 #[code = 250]; + v1376 = arith.constant 0 : i32; + v959 = hir.int_to_ptr v956 : ptr; + hir.store v959, v1376; + v1375 = arith.constant 0 : i32; + scf.yield v1375; }; - scf.yield v1156; + scf.yield v1356; } else { - ^block101: - v1174 = ub.poison i32 : i32; - scf.yield v1174; + ^block109: + v1374 = ub.poison i32 : i32; + scf.yield v1374; }; - v1169 = arith.constant 0 : u32; - v1102 = arith.constant 1 : u32; - v1162 = cf.select v775, v1102, v1169 : u32; - v1170 = ub.poison i32 : i32; - v1161 = cf.select v775, v742, v1170 : i32; - v1171 = ub.poison i32 : i32; - v1160 = cf.select v775, v731, v1171 : i32; - v1172 = ub.poison i32 : i32; - v1159 = cf.select v775, v1172, v742 : i32; - v1173 = ub.poison i32 : i32; - v1158 = cf.select v775, v1173, v731 : i32; - scf.yield v1158, v1159, v1160, v1157, v1161, v1162; + v1369 = arith.constant 0 : u32; + v1302 = arith.constant 1 : u32; + v1362 = cf.select v934, v1302, v1369 : u32; + v1370 = ub.poison i32 : i32; + v1361 = cf.select v934, v901, v1370 : i32; + v1371 = ub.poison i32 : i32; + v1360 = cf.select v934, v890, v1371 : i32; + v1372 = ub.poison i32 : i32; + v1359 = cf.select v934, v1372, v901 : i32; + v1373 = ub.poison i32 : i32; + v1358 = cf.select v934, v1373, v890 : i32; + scf.yield v1358, v1359, v1360, v1357, v1361, v1362; }; - v1115, v1116, v1117 = scf.index_switch v1114 : i32, i32, i32 + v1315, v1316, v1317 = scf.index_switch v1314 : i32, i32, i32 case 0 { - ^block99: - v1168 = arith.constant 4 : u32; - v778 = hir.bitcast v1109 : u32; - v780 = arith.add v778, v1168 : u32 #[overflow = checked]; - v1167 = arith.constant 4 : u32; - v782 = arith.mod v780, v1167 : u32; - hir.assertz v782 #[code = 250]; - v1166 = arith.constant 0 : i32; - v783 = hir.int_to_ptr v780 : ptr; - hir.store v783, v1166; - v1165 = arith.constant 1 : i32; - scf.yield v1109, v1165, v1110; + ^block107: + v1368 = arith.constant 4 : u32; + v937 = hir.bitcast v1309 : u32; + v939 = arith.add v937, v1368 : u32 #[overflow = checked]; + v1367 = arith.constant 4 : u32; + v941 = arith.mod v939, v1367 : u32; + hir.assertz v941 #[code = 250]; + v1366 = arith.constant 0 : i32; + v942 = hir.int_to_ptr v939 : ptr; + hir.store v942, v1366; + v1365 = arith.constant 1 : i32; + scf.yield v1309, v1365, v1310; } default { - ^block160: - scf.yield v1111, v1112, v1113; + ^block170: + scf.yield v1311, v1312, v1313; }; - v853 = hir.bitcast v1115 : u32; - v1164 = arith.constant 4 : u32; - v855 = arith.mod v853, v1164 : u32; - hir.assertz v855 #[code = 250]; - v856 = hir.int_to_ptr v853 : ptr; - hir.store v856, v1116; - v1163 = arith.constant 16 : i32; - v861 = arith.add v1117, v1163 : i32 #[overflow = wrapping]; - v862 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v863 = hir.bitcast v862 : ptr; - hir.store v863, v861; + v1012 = hir.bitcast v1315 : u32; + v1364 = arith.constant 4 : u32; + v1014 = arith.mod v1012, v1364 : u32; + hir.assertz v1014 #[code = 250]; + v1015 = hir.int_to_ptr v1012 : ptr; + hir.store v1015, v1316; + v1363 = arith.constant 16 : i32; + v1020 = arith.add v1317, v1363 : i32 #[overflow = wrapping]; + v1021 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v1022 = hir.bitcast v1021 : ptr; + hir.store v1022, v1020; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v864: i32, v865: i32) { - ^block109(v864: i32, v865: i32): + private builtin.function @alloc::raw_vec::handle_error(v1023: i32, v1024: i32) { + ^block117(v1023: i32, v1024: i32): ub.unreachable ; }; - private builtin.function @core::slice::index::slice_index_fail::do_panic::runtime(v866: i32, v867: i32, v868: i32) { - ^block111(v866: i32, v867: i32, v868: i32): + private builtin.function @core::slice::index::slice_index_fail::do_panic::runtime(v1025: i32, v1026: i32, v1027: i32) { + ^block119(v1025: i32, v1026: i32, v1027: i32): ub.unreachable ; }; - private builtin.function @::max(v869: i32, v870: i32) -> i32 { - ^block113(v869: i32, v870: i32): - v877 = arith.constant 0 : i32; - v873 = hir.bitcast v870 : u32; - v872 = hir.bitcast v869 : u32; - v874 = arith.gt v872, v873 : i1; - v875 = arith.zext v874 : u32; - v876 = hir.bitcast v875 : i32; - v878 = arith.neq v876, v877 : i1; - v879 = cf.select v878, v869, v870 : i32; - builtin.ret v879; + private builtin.function @::max(v1028: i32, v1029: i32) -> i32 { + ^block121(v1028: i32, v1029: i32): + v1036 = arith.constant 0 : i32; + v1032 = hir.bitcast v1029 : u32; + v1031 = hir.bitcast v1028 : u32; + v1033 = arith.gt v1031, v1032 : i1; + v1034 = arith.zext v1033 : u32; + v1035 = hir.bitcast v1034 : i32; + v1037 = arith.neq v1035, v1036 : i1; + v1038 = cf.select v1037, v1028, v1029 : i32; + builtin.ret v1038; }; - private builtin.function @miden::protocol::output_note::create(v880: felt, v881: felt, v882: felt, v883: felt, v884: felt, v885: felt) -> felt { - ^block115(v880: felt, v881: felt, v882: felt, v883: felt, v884: felt, v885: felt): - v886 = hir.exec @miden/protocol/output_note/create(v880, v881, v882, v883, v884, v885) : felt - builtin.ret v886; + private builtin.function @miden::protocol::output_note::create(v1039: felt, v1040: felt, v1041: felt, v1042: felt, v1043: felt, v1044: felt) -> felt { + ^block123(v1039: felt, v1040: felt, v1041: felt, v1042: felt, v1043: felt, v1044: felt): + v1045 = hir.exec @miden/protocol/output_note/create(v1039, v1040, v1041, v1042, v1043, v1044) : felt + builtin.ret v1045; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1260,12 +1453,12 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.segment readonly @1048576 = 0x003e64657463616465723c; - builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; + builtin.segment @1048588 = 0x00000000000000000000000a0010000000000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v888: felt, v889: felt, v890: felt, v891: felt) { - ^block119(v888: felt, v889: felt, v890: felt, v891: felt): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v888, v889, v890, v891) + public builtin.function @run(v1047: felt, v1048: felt, v1049: felt, v1050: felt) { + ^block127(v1047: felt, v1048: felt, v1049: felt, v1050: felt): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v1047, v1048, v1049, v1050) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.masm b/tests/integration/expected/examples/basic_wallet_tx_script.masm index cfd06899e..c3f7ecf0e 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -16,10 +16,10 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[3747760794384071571,1766386520481277932,2198275188940187258,538857382178104910] + push.[11060787405599139519,5881115343068084788,9840913696683659608,11382150558635495408] adv.push_mapval push.262144 - push.3 + push.4 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 @@ -35,7 +35,7 @@ end # mod ::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script @callconv("C") -proc basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9( +proc basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import8( felt, felt, felt, @@ -66,7 +66,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 + push.1048632 u32wrapping_add movup.2 swap.1 @@ -94,7 +94,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048616 + push.1048632 u32wrapping_add dup.1 swap.2 @@ -252,7 +252,7 @@ proc core::slice::index::slice_index_fail(i32, i32, i32) end @callconv("C") -proc as core::ops::index::Index>>::index( +proc as core::ops::index::Index>>::index( i32, i32, i32, @@ -384,22 +384,214 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::wit_bindgen::rt::run_ctors_once trace.252 nop + push.76 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.72 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.68 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.64 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + push.3 + push.64 + dup.3 + u32wrapping_add + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop + push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + push.64 + dup.4 + u32wrapping_add dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + push.64 dup.5 - dup.7 + u32wrapping_add + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.64 + dup.6 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.1 trace.240 nop exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"intrinsics::advice::adv_push_mapvaln" trace.252 nop u32split - push.0 push.3 - dup.3 - dup.3 + dup.2 + dup.2 drop u32and + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::from_u32 + trace.252 + nop + push.0 + push.0 + mul.4294967296 + add assert_eq push.2 push.0 @@ -422,6 +614,82 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop mul.4294967296 add + push.76 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.6 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.72 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.68 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.64 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.2 dup.1 u32split @@ -430,7 +698,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32shl push.4 push.0 - push.64 + push.48 dup.5 u32wrapping_add dup.3 @@ -443,7 +711,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::::try_allocate_in trace.252 nop - push.68 + push.52 dup.3 add u32assert @@ -460,7 +728,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.64 + push.48 dup.4 add u32assert @@ -486,16 +754,8 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) movdn.2 drop drop + push.56 movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.72 - movup.2 add u32assert push.4 @@ -508,21 +768,131 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + else + push.56 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048600 + u32wrapping_add + push.3 + push.64 + dup.7 + u32wrapping_add + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt trace.252 nop + push.2 + push.64 + dup.8 + u32wrapping_add + dup.3 + swap.2 swap.1 trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::alloc::raw_vec::handle_error + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index trace.252 nop - push.0 - else - push.72 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + push.64 + dup.9 + u32wrapping_add dup.4 - add + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.64 + dup.10 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -533,25 +903,19 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::load_felt trace.252 nop push.2 - dup.1 + dup.5 swap.1 u32shr - movup.5 - swap.6 - movdn.5 - movup.3 - swap.8 - movdn.3 movup.2 - swap.9 + swap.3 movdn.2 swap.1 - swap.7 - swap.4 + swap.5 + swap.8 trace.240 nop exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"miden::core::mem::pipe_preimage_to_memory" @@ -559,7 +923,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop drop push.28 - dup.1 + dup.4 add u32assert push.4 @@ -568,7 +932,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - dup.3 + dup.2 swap.1 u32divmod.4 swap.1 @@ -578,7 +942,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.24 - dup.1 + dup.4 add u32assert push.4 @@ -587,7 +951,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - dup.2 + dup.3 swap.1 u32divmod.4 swap.1 @@ -597,7 +961,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.20 - dup.1 + dup.4 add u32assert push.4 @@ -606,8 +970,6 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32mod u32assert assertz - movup.4 - swap.1 u32divmod.4 swap.1 trace.240 @@ -617,7 +979,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) nop push.0 push.0 - movup.4 + movup.2 eq neq if.true @@ -626,7 +988,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) push.0 else push.4 - dup.2 + dup.1 add u32assert push.4 @@ -642,7 +1004,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 + swap.1 push.4 dup.1 swap.1 @@ -666,7 +1028,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::index::Index>>::index + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::index::Index>>::index trace.252 nop push.12 @@ -792,7 +1154,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from trace.252 nop push.64 @@ -812,7 +1174,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) dup.4 trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::index::Index>>::index + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::index::Index>>::index trace.252 nop push.4 @@ -935,7 +1297,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from trace.252 nop push.64 @@ -1015,7 +1377,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) swap.3 trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import8 trace.252 nop push.20 @@ -1023,7 +1385,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop trace.252 nop push.20 @@ -1031,7 +1393,7 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script:: as core::ops::drop::Drop>::drop trace.252 nop push.80 @@ -1082,7 +1444,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048620 + push.1048636 u32wrapping_add u32divmod.4 swap.1 @@ -1117,7 +1479,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048620 + push.1048636 movup.2 u32wrapping_add u32divmod.4 @@ -1336,7 +1698,7 @@ proc intrinsics::mem::heap_base( end @callconv("C") -proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) push.4 @@ -1355,10 +1717,26 @@ proc miden_base_sys::bindings::output_note::create( felt, i32 ) -> felt - push.12 - dup.3 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048616 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1372,10 +1750,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1389,10 +1773,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1406,7 +1796,17 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1420,12 +1820,11 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 - swap.3 - movdn.2 swap.5 - swap.1 swap.4 + swap.1 + swap.2 + swap.3 trace.240 nop exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::"miden::protocol::output_note::create" @@ -1434,7 +1833,86 @@ proc miden_base_sys::bindings::output_note::create( end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:base/transaction-script@1.0.0"::basic_wallet_tx_script::>::from + trace.252 + nop +end + +@callconv("C") +proc as core::ops::drop::Drop>::drop( + i32 +) + drop +end + +@callconv("C") +proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt + trace.240 + nop + exec.::intrinsics::advice::adv_push_mapvaln + trace.252 + nop +end + +@callconv("C") +proc miden::core::mem::pipe_preimage_to_memory( + felt, + i32, + felt, + felt, + felt, + felt +) -> i32 + trace.240 + nop + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + nop +end + +@callconv("C") +proc ::from_u32( + i32 +) -> felt + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) @@ -1508,38 +1986,6 @@ proc as core::ops::drop::Drop>::drop( - i32 -) - drop -end - -@callconv("C") -proc intrinsics::advice::adv_push_mapvaln(felt, felt, felt, felt) -> felt - trace.240 - nop - exec.::intrinsics::advice::adv_push_mapvaln - trace.252 - nop -end - -@callconv("C") -proc miden::core::mem::pipe_preimage_to_memory( - felt, - i32, - felt, - felt, - felt, - felt -) -> i32 - trace.240 - nop - exec.::miden::core::mem::pipe_preimage_to_memory - trace.252 - nop -end - @callconv("C") proc ::alloc_impl( i32, diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index c150ba832..c55dc8ce2 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -3,13 +3,12 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) - (type (;7;) (record (field "inner" 1))) - (export (;8;) "note-idx" (type (eq 7))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) + (type (;6;) (record (field "inner" 1))) + (export (;7;) "note-idx" (type (eq 6))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -46,7 +45,7 @@ (type (;16;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) (type (;17;) (func (param i32 i32 i32 i32 i32))) (type (;18;) (func (param f32 f32 f32 f32 f32 f32) (result f32))) - (import "miden:basic-wallet/basic-wallet@0.1.0" "move-asset-to-note" (func $basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 (;0;) (type 0))) + (import "miden:basic-wallet/basic-wallet@0.1.0" "move-asset-to-note" (func $basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import8 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -57,7 +56,7 @@ (func $__wasm_call_ctors (;1;) (type 1)) (func $__rustc::__rust_alloc (;2;) (type 2) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048616 + i32.const 1048632 i32.add local.get 1 local.get 0 @@ -67,7 +66,7 @@ (func $__rustc::__rust_alloc_zeroed (;4;) (type 2) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048616 + i32.const 1048632 i32.add local.get 1 local.get 0 @@ -121,7 +120,7 @@ call $core::slice::index::slice_index_fail::do_panic::runtime unreachable ) - (func $ as core::ops::index::Index>>::index (;7;) (type 4) (param i32 i32 i32 i32) + (func $ as core::ops::index::Index>>::index (;7;) (type 4) (param i32 i32 i32 i32) (local i32) block ;; label = @1 local.get 3 @@ -151,84 +150,163 @@ i32.store ) (func $miden:base/transaction-script@1.0.0#run (;8;) (type 5) (param f32 f32 f32 f32) - (local i32 i64 f32 i32 i32 i32) + (local i32 i32 i64 f32 i32 i32 i32) global.get $__stack_pointer i32.const 80 i32.sub local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once + local.get 4 local.get 3 + f32.store offset=76 + local.get 4 local.get 2 + f32.store offset=72 + local.get 4 local.get 1 + f32.store offset=68 + local.get 4 local.get 0 + f32.store offset=64 + local.get 4 + i32.const 64 + i32.add + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + local.tee 5 + call $>::index + f32.load + local.get 4 + i32.const 64 + i32.add + i32.const 2 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 64 + i32.add + i32.const 1 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 64 + i32.add + i32.const 0 + local.get 5 + call $>::index + f32.load call $intrinsics::advice::adv_push_mapvaln call $intrinsics::felt::as_u64 - local.tee 5 + local.tee 6 i32.wrap_i64 i32.const 3 i32.and - call $intrinsics::felt::from_u32 - i32.const 0 - call $intrinsics::felt::from_u32 + call $::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - local.get 4 - i32.const 64 - i32.add - local.get 5 + local.get 6 i64.const 2 i64.shr_u call $intrinsics::felt::from_u64_unchecked - local.tee 6 + local.set 7 + local.get 4 + local.get 3 + f32.store offset=76 + local.get 4 + local.get 2 + f32.store offset=72 + local.get 4 + local.get 1 + f32.store offset=68 + local.get 4 + local.get 0 + f32.store offset=64 + local.get 4 + i32.const 48 + i32.add + local.get 7 call $intrinsics::felt::as_u64 i32.wrap_i64 i32.const 2 i32.shl - local.tee 7 + local.tee 8 i32.const 0 i32.const 4 i32.const 4 call $::try_allocate_in local.get 4 - i32.load offset=68 - local.set 8 + i32.load offset=52 + local.set 9 block ;; label = @1 block ;; label = @2 local.get 4 - i32.load offset=64 + i32.load offset=48 i32.const 1 i32.eq br_if 0 (;@2;) - local.get 6 + local.get 7 local.get 4 - i32.load offset=72 - local.tee 9 + i32.load offset=56 + local.tee 10 i32.const 2 i32.shr_u - local.get 3 - local.get 2 - local.get 1 - local.get 0 + local.get 4 + i32.const 64 + i32.add + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048600 + i32.add + local.tee 5 + call $>::index + f32.load + local.get 4 + i32.const 64 + i32.add + i32.const 2 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 64 + i32.add + i32.const 1 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 64 + i32.add + i32.const 0 + local.get 5 + call $>::index + f32.load call $miden::core::mem::pipe_preimage_to_memory drop local.get 4 - local.get 7 + local.get 8 i32.store offset=28 local.get 4 - local.get 9 + local.get 10 i32.store offset=24 local.get 4 - local.get 8 + local.get 9 i32.store offset=20 - local.get 7 + local.get 8 i32.eqz br_if 1 (;@1;) - local.get 9 + local.get 10 f32.load offset=4 - local.set 0 - local.get 9 + local.set 3 + local.get 10 f32.load - local.set 1 + local.set 2 local.get 4 i32.const 8 i32.add @@ -237,7 +315,7 @@ i32.add i32.const 2 i32.const 6 - call $ as core::ops::index::Index>>::index + call $ as core::ops::index::Index>>::index local.get 4 i32.load offset=12 i32.const 4 @@ -250,13 +328,13 @@ i32.add local.get 4 i32.load offset=8 - local.tee 9 + local.tee 5 i32.const 8 i32.add i64.load align=4 i64.store local.get 4 - local.get 9 + local.get 5 i64.load align=4 i64.store offset=32 local.get 4 @@ -265,21 +343,21 @@ local.get 4 i32.const 32 i32.add - call $>::from - local.get 1 - local.get 0 + call $>::from + local.get 2 + local.get 3 local.get 4 i32.const 64 i32.add call $miden_base_sys::bindings::output_note::create - local.set 0 + local.set 3 local.get 4 local.get 4 i32.const 20 i32.add i32.const 6 i32.const 10 - call $ as core::ops::index::Index>>::index + call $ as core::ops::index::Index>>::index local.get 4 i32.load offset=4 i32.const 4 @@ -292,13 +370,13 @@ i32.add local.get 4 i32.load - local.tee 9 + local.tee 5 i32.const 8 i32.add i64.load align=4 i64.store local.get 4 - local.get 9 + local.get 5 i64.load align=4 i64.store offset=48 local.get 4 @@ -307,7 +385,7 @@ local.get 4 i32.const 48 i32.add - call $>::from + call $>::from local.get 4 f32.load offset=64 local.get 4 @@ -316,25 +394,25 @@ f32.load offset=72 local.get 4 f32.load offset=76 - local.get 0 - call $basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 + local.get 3 + call $basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import8 local.get 4 i32.const 20 i32.add - call $ as core::ops::drop::Drop>::drop + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 20 i32.add - call $ as core::ops::drop::Drop>::drop + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 80 i32.add global.set $__stack_pointer return end - local.get 8 + local.get 9 local.get 4 - i32.load offset=72 + i32.load offset=56 call $alloc::raw_vec::handle_error end unreachable @@ -346,7 +424,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048620 + i32.const 1048636 i32.add i32.load8_u br_if 0 (;@1;) @@ -354,7 +432,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048620 + i32.const 1048636 i32.add i32.const 1 i32.store8 @@ -435,36 +513,47 @@ (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) unreachable ) - (func $ as core::ops::drop::Drop>::drop (;13;) (type 8) (param i32) + (func $ as core::ops::drop::Drop>::drop (;13;) (type 8) (param i32) local.get 0 i32.const 4 i32.const 4 call $::deallocate ) (func $miden_base_sys::bindings::output_note::create (;14;) (type 9) (param f32 f32 i32) (result f32) + (local i32) local.get 0 local.get 1 local.get 2 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048616 + i32.add + local.tee 3 + call $>::index + f32.load local.get 2 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 2 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 2 + i32.const 0 + local.get 3 + call $>::index f32.load call $miden::protocol::output_note::create ) - (func $>::from (;15;) (type 10) (param i32 i32) + (func $>::from (;15;) (type 10) (param i32 i32) local.get 0 local.get 1 - i64.load offset=8 align=4 - i64.store offset=8 - local.get 0 - local.get 1 - i64.load align=4 - i64.store + call $>::from ) - (func $ as core::ops::drop::Drop>::drop (;16;) (type 8) (param i32)) + (func $ as core::ops::drop::Drop>::drop (;16;) (type 8) (param i32)) (func $intrinsics::advice::adv_push_mapvaln (;17;) (type 11) (param f32 f32 f32 f32) (result f32) unreachable ) @@ -483,7 +572,36 @@ (func $miden::core::mem::pipe_preimage_to_memory (;22;) (type 16) (param f32 i32 f32 f32 f32 f32) (result i32) unreachable ) - (func $::alloc_impl (;23;) (type 4) (param i32 i32 i32 i32) + (func $::from_u32 (;23;) (type 14) (param i32) (result f32) + local.get 0 + call $intrinsics::felt::from_u32 + ) + (func $>::index (;24;) (type 6) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;25;) (type 10) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $::alloc_impl (;26;) (type 4) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -510,7 +628,7 @@ local.get 1 i32.store ) - (func $::deallocate (;24;) (type 3) (param i32 i32 i32) + (func $::deallocate (;27;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -542,7 +660,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;25;) (type 4) (param i32 i32 i32 i32) + (func $::current_memory (;28;) (type 4) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -577,7 +695,7 @@ local.get 4 i32.store ) - (func $::deallocate (;26;) (type 3) (param i32 i32 i32) + (func $::deallocate (;29;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -588,7 +706,7 @@ call $__rustc::__rust_dealloc end ) - (func $::allocate (;27;) (type 3) (param i32 i32 i32) + (func $::allocate (;30;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -617,7 +735,7 @@ i32.add global.set $__stack_pointer ) - (func $::try_allocate_in (;28;) (type 17) (param i32 i32 i32 i32 i32) + (func $::try_allocate_in (;31;) (type 17) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -728,13 +846,13 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;29;) (type 10) (param i32 i32) + (func $alloc::raw_vec::handle_error (;32;) (type 10) (param i32 i32) unreachable ) - (func $core::slice::index::slice_index_fail::do_panic::runtime (;30;) (type 3) (param i32 i32 i32) + (func $core::slice::index::slice_index_fail::do_panic::runtime (;33;) (type 3) (param i32 i32 i32) unreachable ) - (func $::max (;31;) (type 2) (param i32 i32) (result i32) + (func $::max (;34;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -742,11 +860,11 @@ i32.gt_u select ) - (func $miden::protocol::output_note::create (;32;) (type 18) (param f32 f32 f32 f32 f32 f32) (result f32) + (func $miden::protocol::output_note::create (;35;) (type 18) (param f32 f32 f32 f32 f32 f32) (result f32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "\00") - (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;4;))) (alias export $miden:basic-wallet/basic-wallet@0.1.0 "move-asset-to-note" (func $move-asset-to-note (;0;))) @@ -767,15 +885,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/examples/counter.hir b/tests/integration/expected/examples/counter.hir index bc198887b..2a9aef05e 100644 --- a/tests/integration/expected/examples/counter.hir +++ b/tests/integration/expected/examples/counter.hir @@ -20,433 +20,515 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { v10 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr v11 = hir.bitcast v10 : ptr; hir.store v11, v9; - v13 = arith.constant 12 : u32; - v12 = hir.bitcast v3 : u32; - v14 = arith.add v12, v13 : u32 #[overflow = checked]; - v15 = arith.constant 4 : u32; - v16 = arith.mod v14, v15 : u32; - hir.assertz v16 #[code = 250]; - v17 = hir.int_to_ptr v14 : ptr; - v18 = hir.load v17 : felt; - v20 = arith.constant 8 : u32; - v19 = hir.bitcast v3 : u32; - v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v387 = arith.constant 4 : u32; - v23 = arith.mod v21, v387 : u32; - hir.assertz v23 #[code = 250]; - v24 = hir.int_to_ptr v21 : ptr; - v25 = hir.load v24 : felt; - v386 = arith.constant 4 : u32; - v26 = hir.bitcast v3 : u32; - v28 = arith.add v26, v386 : u32 #[overflow = checked]; - v385 = arith.constant 4 : u32; - v30 = arith.mod v28, v385 : u32; - hir.assertz v30 #[code = 250]; - v31 = hir.int_to_ptr v28 : ptr; - v32 = hir.load v31 : felt; - v33 = hir.bitcast v3 : u32; - v384 = arith.constant 4 : u32; - v35 = arith.mod v33, v384 : u32; + v13 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v14 = hir.bitcast v13 : ptr; + v15 = hir.load v14 : i32; + v16 = arith.constant 1048596 : i32; + v17 = arith.add v15, v16 : i32 #[overflow = wrapping]; + v12 = arith.constant 3 : i32; + v18 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v3, v12, v17) : i32 + v19 = hir.bitcast v18 : u32; + v20 = arith.constant 4 : u32; + v21 = arith.mod v19, v20 : u32; + hir.assertz v21 #[code = 250]; + v22 = hir.int_to_ptr v19 : ptr; + v23 = hir.load v22 : felt; + v24 = arith.constant 2 : i32; + v25 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v3, v24, v17) : i32 + v26 = hir.bitcast v25 : u32; + v461 = arith.constant 4 : u32; + v28 = arith.mod v26, v461 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + v30 = hir.load v29 : felt; + v31 = arith.constant 1 : i32; + v32 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v3, v31, v17) : i32 + v33 = hir.bitcast v32 : u32; + v460 = arith.constant 4 : u32; + v35 = arith.mod v33, v460 : u32; hir.assertz v35 #[code = 250]; v36 = hir.int_to_ptr v33 : ptr; v37 = hir.load v36 : felt; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::protocol::active_account::get_map_item(v2, v1, v18, v25, v32, v37, v9) - v38 = hir.bitcast v9 : u32; - v383 = arith.constant 8 : u32; - v40 = arith.mod v38, v383 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - v42 = hir.load v41 : i64; - v374, v375 = arith.split v42 : felt, felt; - v382 = arith.constant 8 : u32; - v46 = hir.bitcast v0 : u32; - v48 = arith.add v46, v382 : u32 #[overflow = checked]; - v381 = arith.constant 8 : u32; - v50 = arith.mod v48, v381 : u32; - hir.assertz v50 #[code = 250]; - v376 = arith.join v375, v374 : i64; - v51 = hir.int_to_ptr v48 : ptr; - hir.store v51, v376; - v380 = arith.constant 8 : u32; - v52 = hir.bitcast v9 : u32; - v54 = arith.add v52, v380 : u32 #[overflow = checked]; - v379 = arith.constant 8 : u32; - v56 = arith.mod v54, v379 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - v58 = hir.load v57 : i64; - v371, v372 = arith.split v58 : felt, felt; - v62 = hir.bitcast v0 : u32; - v378 = arith.constant 8 : u32; - v64 = arith.mod v62, v378 : u32; - hir.assertz v64 #[code = 250]; - v373 = arith.join v372, v371 : i64; - v65 = hir.int_to_ptr v62 : ptr; - hir.store v65, v373; - v377 = arith.constant 16 : i32; - v67 = arith.add v9, v377 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; + v4 = arith.constant 0 : i32; + v39 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v3, v4, v17) : i32 + v40 = hir.bitcast v39 : u32; + v459 = arith.constant 4 : u32; + v42 = arith.mod v40, v459 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::protocol::active_account::get_map_item(v2, v1, v23, v30, v37, v44, v9) + v45 = hir.bitcast v9 : u32; + v46 = arith.constant 8 : u32; + v47 = arith.mod v45, v46 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + v49 = hir.load v48 : i64; + v450, v451 = arith.split v49 : felt, felt; + v458 = arith.constant 8 : u32; + v53 = hir.bitcast v0 : u32; + v55 = arith.add v53, v458 : u32 #[overflow = checked]; + v457 = arith.constant 8 : u32; + v57 = arith.mod v55, v457 : u32; + hir.assertz v57 #[code = 250]; + v452 = arith.join v451, v450 : i64; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v452; + v456 = arith.constant 8 : u32; + v59 = hir.bitcast v9 : u32; + v61 = arith.add v59, v456 : u32 #[overflow = checked]; + v455 = arith.constant 8 : u32; + v63 = arith.mod v61, v455 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : i64; + v447, v448 = arith.split v65 : felt, felt; + v69 = hir.bitcast v0 : u32; + v454 = arith.constant 8 : u32; + v71 = arith.mod v69, v454 : u32; + hir.assertz v71 #[code = 250]; + v449 = arith.join v448, v447 : i64; + v72 = hir.int_to_ptr v69 : ptr; + hir.store v72, v449; + v453 = arith.constant 16 : i32; + v74 = arith.add v9, v453 : i32 #[overflow = wrapping]; + v75 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v76 = hir.bitcast v75 : ptr; + hir.store v76, v74; builtin.ret ; }; - private builtin.function @::default(v70: i32) { - ^block11(v70: i32): - v77 = arith.constant 4 : u32; - v76 = hir.bitcast v70 : u32; - v78 = arith.add v76, v77 : u32 #[overflow = checked]; - v389 = arith.constant 4 : u32; - v80 = arith.mod v78, v389 : u32; - hir.assertz v80 #[code = 250]; - v74 = arith.constant 1466204381252459361 : i64; - v75 = arith.trunc v74 : felt; - v81 = hir.int_to_ptr v78 : ptr; - hir.store v81, v75; - v82 = hir.bitcast v70 : u32; - v388 = arith.constant 4 : u32; - v84 = arith.mod v82, v388 : u32; - hir.assertz v84 #[code = 250]; - v72 = arith.constant -6649237899119803499 : i64; - v73 = arith.trunc v72 : felt; - v85 = hir.int_to_ptr v82 : ptr; - hir.store v85, v73; + private builtin.function @::default(v77: i32) { + ^block11(v77: i32): + v84 = arith.constant 4 : u32; + v83 = hir.bitcast v77 : u32; + v85 = arith.add v83, v84 : u32 #[overflow = checked]; + v463 = arith.constant 4 : u32; + v87 = arith.mod v85, v463 : u32; + hir.assertz v87 #[code = 250]; + v81 = arith.constant 1466204381252459361 : i64; + v82 = arith.trunc v81 : felt; + v88 = hir.int_to_ptr v85 : ptr; + hir.store v88, v82; + v89 = hir.bitcast v77 : u32; + v462 = arith.constant 4 : u32; + v91 = arith.mod v89, v462 : u32; + hir.assertz v91 #[code = 250]; + v79 = arith.constant -6649237899119803499 : i64; + v80 = arith.trunc v79 : felt; + v92 = hir.int_to_ptr v89 : ptr; + hir.store v92, v80; builtin.ret ; }; private builtin.function @miden:counter-contract/counter-contract@0.1.0#get-count() -> felt { ^block13: - v89 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v90 = hir.bitcast v89 : ptr; - v91 = hir.load v90 : i32; - v92 = arith.constant 48 : i32; - v93 = arith.sub v91, v92 : i32 #[overflow = wrapping]; - v94 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - hir.store v95, v93; + v96 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; + v99 = arith.constant 48 : i32; + v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; + v101 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v102 = hir.bitcast v101 : ptr; + hir.store v102, v100; hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/wit_bindgen::rt::run_ctors_once() - v96 = arith.constant 8 : i32; - v97 = arith.add v93, v96 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::default(v97) - v99 = arith.constant 12 : u32; - v98 = hir.bitcast v93 : u32; - v100 = arith.add v98, v99 : u32 #[overflow = checked]; - v101 = arith.constant 4 : u32; - v102 = arith.mod v100, v101 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : felt; - v106 = arith.constant 8 : u32; - v105 = hir.bitcast v93 : u32; + v103 = arith.constant 8 : i32; + v104 = arith.add v100, v103 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::default(v104) + v106 = arith.constant 12 : u32; + v105 = hir.bitcast v100 : u32; v107 = arith.add v105, v106 : u32 #[overflow = checked]; - v398 = arith.constant 4 : u32; - v109 = arith.mod v107, v398 : u32; + v108 = arith.constant 4 : u32; + v109 = arith.mod v107, v108 : u32; hir.assertz v109 #[code = 250]; v110 = hir.int_to_ptr v107 : ptr; v111 = hir.load v110 : felt; - v121 = arith.constant 28 : u32; - v120 = hir.bitcast v93 : u32; - v122 = arith.add v120, v121 : u32 #[overflow = checked]; - v397 = arith.constant 4 : u32; - v124 = arith.mod v122, v397 : u32; - hir.assertz v124 #[code = 250]; - v118 = arith.constant 1 : i64; - v119 = arith.trunc v118 : felt; - v125 = hir.int_to_ptr v122 : ptr; - hir.store v125, v119; - v127 = arith.constant 24 : u32; - v126 = hir.bitcast v93 : u32; - v128 = arith.add v126, v127 : u32 #[overflow = checked]; - v396 = arith.constant 4 : u32; - v130 = arith.mod v128, v396 : u32; - hir.assertz v130 #[code = 250]; - v112 = arith.constant 0 : i64; - v117 = arith.trunc v112 : felt; - v131 = hir.int_to_ptr v128 : ptr; - hir.store v131, v117; - v133 = arith.constant 20 : u32; - v132 = hir.bitcast v93 : u32; - v134 = arith.add v132, v133 : u32 #[overflow = checked]; - v395 = arith.constant 4 : u32; - v136 = arith.mod v134, v395 : u32; - hir.assertz v136 #[code = 250]; - v394 = arith.constant 0 : i64; - v115 = arith.trunc v394 : felt; - v137 = hir.int_to_ptr v134 : ptr; - hir.store v137, v115; - v139 = arith.constant 16 : u32; - v138 = hir.bitcast v93 : u32; - v140 = arith.add v138, v139 : u32 #[overflow = checked]; - v393 = arith.constant 4 : u32; - v142 = arith.mod v140, v393 : u32; - hir.assertz v142 #[code = 250]; - v392 = arith.constant 0 : i64; - v113 = arith.trunc v392 : felt; - v143 = hir.int_to_ptr v140 : ptr; - hir.store v143, v113; - v146 = arith.constant 16 : i32; - v147 = arith.add v93, v146 : i32 #[overflow = wrapping]; - v144 = arith.constant 32 : i32; - v145 = arith.add v93, v144 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v145, v111, v104, v147) - v149 = arith.constant 44 : u32; - v148 = hir.bitcast v93 : u32; - v150 = arith.add v148, v149 : u32 #[overflow = checked]; - v391 = arith.constant 4 : u32; - v152 = arith.mod v150, v391 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - v154 = hir.load v153 : felt; - v390 = arith.constant 48 : i32; - v156 = arith.add v93, v390 : i32 #[overflow = wrapping]; - v157 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v158 = hir.bitcast v157 : ptr; - hir.store v158, v156; - builtin.ret v154; + v113 = arith.constant 8 : u32; + v112 = hir.bitcast v100 : u32; + v114 = arith.add v112, v113 : u32 #[overflow = checked]; + v470 = arith.constant 4 : u32; + v116 = arith.mod v114, v470 : u32; + hir.assertz v116 #[code = 250]; + v117 = hir.int_to_ptr v114 : ptr; + v118 = hir.load v117 : felt; + v122 = arith.constant 28 : u32; + v121 = hir.bitcast v100 : u32; + v123 = arith.add v121, v122 : u32 #[overflow = checked]; + v469 = arith.constant 4 : u32; + v125 = arith.mod v123, v469 : u32; + hir.assertz v125 #[code = 250]; + v119 = arith.constant 1 : i64; + v120 = arith.trunc v119 : felt; + v126 = hir.int_to_ptr v123 : ptr; + hir.store v126, v120; + v129 = arith.constant 24 : u32; + v128 = hir.bitcast v100 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v468 = arith.constant 4 : u32; + v132 = arith.mod v130, v468 : u32; + hir.assertz v132 #[code = 250]; + v94 = arith.constant 0 : i32; + v133 = hir.int_to_ptr v130 : ptr; + hir.store v133, v94; + v136 = arith.constant 16 : u32; + v135 = hir.bitcast v100 : u32; + v137 = arith.add v135, v136 : u32 #[overflow = checked]; + v467 = arith.constant 8 : u32; + v139 = arith.mod v137, v467 : u32; + hir.assertz v139 #[code = 250]; + v134 = arith.constant 0 : i64; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v134; + v143 = arith.constant 16 : i32; + v144 = arith.add v100, v143 : i32 #[overflow = wrapping]; + v141 = arith.constant 32 : i32; + v142 = arith.add v100, v141 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v142, v118, v111, v144) + v148 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v149 = hir.bitcast v148 : ptr; + v150 = hir.load v149 : i32; + v151 = arith.constant 1048596 : i32; + v152 = arith.add v150, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 3 : i32; + v466 = arith.constant 32 : i32; + v146 = arith.add v100, v466 : i32 #[overflow = wrapping]; + v153 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v146, v147, v152) : i32 + v154 = hir.bitcast v153 : u32; + v465 = arith.constant 4 : u32; + v156 = arith.mod v154, v465 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : felt; + v464 = arith.constant 48 : i32; + v160 = arith.add v100, v464 : i32 #[overflow = wrapping]; + v161 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v162 = hir.bitcast v161 : ptr; + hir.store v162, v160; + builtin.ret v158; }; private builtin.function @miden:counter-contract/counter-contract@0.1.0#increment-count() -> felt { ^block15: - v162 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v163 = hir.bitcast v162 : ptr; - v164 = hir.load v163 : i32; - v165 = arith.constant 64 : i32; - v166 = arith.sub v164, v165 : i32 #[overflow = wrapping]; - v167 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v168 = hir.bitcast v167 : ptr; - hir.store v168, v166; + v168 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v169 = hir.bitcast v168 : ptr; + v170 = hir.load v169 : i32; + v171 = arith.constant 96 : i32; + v172 = arith.sub v170, v171 : i32 #[overflow = wrapping]; + v173 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v174 = hir.bitcast v173 : ptr; + hir.store v174, v172; hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/wit_bindgen::rt::run_ctors_once() - v169 = arith.constant 8 : i32; - v170 = arith.add v166, v169 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::default(v170) - v172 = arith.constant 12 : u32; - v171 = hir.bitcast v166 : u32; - v173 = arith.add v171, v172 : u32 #[overflow = checked]; - v174 = arith.constant 4 : u32; - v175 = arith.mod v173, v174 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : felt; - v179 = arith.constant 8 : u32; - v178 = hir.bitcast v166 : u32; - v180 = arith.add v178, v179 : u32 #[overflow = checked]; - v413 = arith.constant 4 : u32; - v182 = arith.mod v180, v413 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - v184 = hir.load v183 : felt; - v185 = arith.constant 0 : i64; - v186 = arith.trunc v185 : felt; - v412 = arith.constant 0 : i64; - v188 = arith.trunc v412 : felt; - v411 = arith.constant 0 : i64; - v190 = arith.trunc v411 : felt; - v191 = arith.constant 1 : i64; - v192 = arith.trunc v191 : felt; + v175 = arith.constant 8 : i32; + v176 = arith.add v172, v175 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/::default(v176) + v178 = arith.constant 12 : u32; + v177 = hir.bitcast v172 : u32; + v179 = arith.add v177, v178 : u32 #[overflow = checked]; + v180 = arith.constant 4 : u32; + v181 = arith.mod v179, v180 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : felt; + v185 = arith.constant 8 : u32; + v184 = hir.bitcast v172 : u32; + v186 = arith.add v184, v185 : u32 #[overflow = checked]; + v509 = arith.constant 4 : u32; + v188 = arith.mod v186, v509 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + v190 = hir.load v189 : felt; v194 = arith.constant 28 : u32; - v193 = hir.bitcast v166 : u32; + v193 = hir.bitcast v172 : u32; v195 = arith.add v193, v194 : u32 #[overflow = checked]; - v410 = arith.constant 4 : u32; - v197 = arith.mod v195, v410 : u32; + v508 = arith.constant 4 : u32; + v197 = arith.mod v195, v508 : u32; hir.assertz v197 #[code = 250]; + v191 = arith.constant 1 : i64; + v192 = arith.trunc v191 : felt; v198 = hir.int_to_ptr v195 : ptr; hir.store v198, v192; - v200 = arith.constant 24 : u32; - v199 = hir.bitcast v166 : u32; - v201 = arith.add v199, v200 : u32 #[overflow = checked]; - v409 = arith.constant 4 : u32; - v203 = arith.mod v201, v409 : u32; - hir.assertz v203 #[code = 250]; - v204 = hir.int_to_ptr v201 : ptr; - hir.store v204, v190; - v206 = arith.constant 20 : u32; - v205 = hir.bitcast v166 : u32; - v207 = arith.add v205, v206 : u32 #[overflow = checked]; - v408 = arith.constant 4 : u32; - v209 = arith.mod v207, v408 : u32; - hir.assertz v209 #[code = 250]; - v210 = hir.int_to_ptr v207 : ptr; - hir.store v210, v188; - v212 = arith.constant 16 : u32; - v211 = hir.bitcast v166 : u32; - v213 = arith.add v211, v212 : u32 #[overflow = checked]; - v407 = arith.constant 4 : u32; - v215 = arith.mod v213, v407 : u32; - hir.assertz v215 #[code = 250]; - v216 = hir.int_to_ptr v213 : ptr; - hir.store v216, v186; - v219 = arith.constant 16 : i32; - v220 = arith.add v166, v219 : i32 #[overflow = wrapping]; - v217 = arith.constant 48 : i32; - v218 = arith.add v166, v217 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v218, v184, v177, v220) - v224 = arith.constant 60 : u32; - v223 = hir.bitcast v166 : u32; - v225 = arith.add v223, v224 : u32 #[overflow = checked]; - v406 = arith.constant 4 : u32; - v227 = arith.mod v225, v406 : u32; - hir.assertz v227 #[code = 250]; - v228 = hir.int_to_ptr v225 : ptr; - v229 = hir.load v228 : felt; - v399 = arith.constant 1 : felt; - v232 = arith.add v229, v399 : felt #[overflow = unchecked]; - v221 = arith.constant 32 : i32; - v222 = arith.add v166, v221 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::from(v222, v232) - v234 = arith.constant 44 : u32; - v233 = hir.bitcast v166 : u32; - v235 = arith.add v233, v234 : u32 #[overflow = checked]; - v405 = arith.constant 4 : u32; - v237 = arith.mod v235, v405 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : felt; - v241 = arith.constant 40 : u32; - v240 = hir.bitcast v166 : u32; - v242 = arith.add v240, v241 : u32 #[overflow = checked]; - v404 = arith.constant 4 : u32; - v244 = arith.mod v242, v404 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - v246 = hir.load v245 : felt; - v248 = arith.constant 36 : u32; - v247 = hir.bitcast v166 : u32; - v249 = arith.add v247, v248 : u32 #[overflow = checked]; - v403 = arith.constant 4 : u32; - v251 = arith.mod v249, v403 : u32; + v201 = arith.constant 24 : u32; + v200 = hir.bitcast v172 : u32; + v202 = arith.add v200, v201 : u32 #[overflow = checked]; + v507 = arith.constant 4 : u32; + v204 = arith.mod v202, v507 : u32; + hir.assertz v204 #[code = 250]; + v164 = arith.constant 0 : i32; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v164; + v208 = arith.constant 16 : u32; + v207 = hir.bitcast v172 : u32; + v209 = arith.add v207, v208 : u32 #[overflow = checked]; + v506 = arith.constant 8 : u32; + v211 = arith.mod v209, v506 : u32; + hir.assertz v211 #[code = 250]; + v206 = arith.constant 0 : i64; + v212 = hir.int_to_ptr v209 : ptr; + hir.store v212, v206; + v215 = arith.constant 16 : i32; + v216 = arith.add v172, v215 : i32 #[overflow = wrapping]; + v213 = arith.constant 32 : i32; + v214 = arith.add v172, v213 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v214, v190, v183, v216) + v220 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v221 = hir.bitcast v220 : ptr; + v222 = hir.load v221 : i32; + v223 = arith.constant 1048596 : i32; + v224 = arith.add v222, v223 : i32 #[overflow = wrapping]; + v219 = arith.constant 3 : i32; + v505 = arith.constant 32 : i32; + v218 = arith.add v172, v505 : i32 #[overflow = wrapping]; + v225 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v218, v219, v224) : i32 + v226 = hir.bitcast v225 : u32; + v504 = arith.constant 4 : u32; + v228 = arith.mod v226, v504 : u32; + hir.assertz v228 #[code = 250]; + v229 = hir.int_to_ptr v226 : ptr; + v230 = hir.load v229 : felt; + v503 = arith.constant 1 : i64; + v232 = arith.trunc v503 : felt; + v233 = arith.add v230, v232 : felt #[overflow = unchecked]; + v502 = arith.constant 24 : u32; + v234 = hir.bitcast v172 : u32; + v236 = arith.add v234, v502 : u32 #[overflow = checked]; + v501 = arith.constant 8 : u32; + v238 = arith.mod v236, v501 : u32; + hir.assertz v238 #[code = 250]; + v239 = hir.int_to_ptr v236 : ptr; + v240 = hir.load v239 : i64; + v242 = arith.constant 56 : u32; + v241 = hir.bitcast v172 : u32; + v243 = arith.add v241, v242 : u32 #[overflow = checked]; + v500 = arith.constant 8 : u32; + v245 = arith.mod v243, v500 : u32; + hir.assertz v245 #[code = 250]; + v246 = hir.int_to_ptr v243 : ptr; + hir.store v246, v240; + v499 = arith.constant 16 : u32; + v247 = hir.bitcast v172 : u32; + v249 = arith.add v247, v499 : u32 #[overflow = checked]; + v498 = arith.constant 8 : u32; + v251 = arith.mod v249, v498 : u32; hir.assertz v251 #[code = 250]; - v252 = hir.int_to_ptr v249 : ptr; - v253 = hir.load v252 : felt; - v255 = arith.constant 32 : u32; - v254 = hir.bitcast v166 : u32; + v252 = hir.int_to_ptr v249 : ptr; + v253 = hir.load v252 : i64; + v255 = arith.constant 48 : u32; + v254 = hir.bitcast v172 : u32; v256 = arith.add v254, v255 : u32 #[overflow = checked]; - v402 = arith.constant 4 : u32; - v258 = arith.mod v256, v402 : u32; + v497 = arith.constant 8 : u32; + v258 = arith.mod v256, v497 : u32; hir.assertz v258 #[code = 250]; - v259 = hir.int_to_ptr v256 : ptr; - v260 = hir.load v259 : felt; - v401 = arith.constant 48 : i32; - v262 = arith.add v166, v401 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::protocol::native_account::set_map_item(v177, v184, v192, v190, v188, v186, v239, v246, v253, v260, v262) - v400 = arith.constant 64 : i32; - v264 = arith.add v166, v400 : i32 #[overflow = wrapping]; - v265 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr - v266 = hir.bitcast v265 : ptr; - hir.store v266, v264; - builtin.ret v232; + v259 = hir.int_to_ptr v256 : ptr; + hir.store v259, v253; + v261 = arith.constant 76 : u32; + v260 = hir.bitcast v172 : u32; + v262 = arith.add v260, v261 : u32 #[overflow = checked]; + v496 = arith.constant 4 : u32; + v264 = arith.mod v262, v496 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + hir.store v265, v233; + v268 = arith.constant 72 : u32; + v267 = hir.bitcast v172 : u32; + v269 = arith.add v267, v268 : u32 #[overflow = checked]; + v495 = arith.constant 4 : u32; + v271 = arith.mod v269, v495 : u32; + hir.assertz v271 #[code = 250]; + v494 = arith.constant 0 : i32; + v272 = hir.int_to_ptr v269 : ptr; + hir.store v272, v494; + v275 = arith.constant 64 : u32; + v274 = hir.bitcast v172 : u32; + v276 = arith.add v274, v275 : u32 #[overflow = checked]; + v493 = arith.constant 8 : u32; + v278 = arith.mod v276, v493 : u32; + hir.assertz v278 #[code = 250]; + v492 = arith.constant 0 : i64; + v279 = hir.int_to_ptr v276 : ptr; + hir.store v279, v492; + v491 = arith.constant 3 : i32; + v280 = arith.constant 48 : i32; + v281 = arith.add v172, v280 : i32 #[overflow = wrapping]; + v283 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v281, v491, v224) : i32 + v284 = hir.bitcast v283 : u32; + v490 = arith.constant 4 : u32; + v286 = arith.mod v284, v490 : u32; + hir.assertz v286 #[code = 250]; + v287 = hir.int_to_ptr v284 : ptr; + v288 = hir.load v287 : felt; + v291 = arith.constant 2 : i32; + v489 = arith.constant 48 : i32; + v290 = arith.add v172, v489 : i32 #[overflow = wrapping]; + v292 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v290, v291, v224) : i32 + v293 = hir.bitcast v292 : u32; + v488 = arith.constant 4 : u32; + v295 = arith.mod v293, v488 : u32; + hir.assertz v295 #[code = 250]; + v296 = hir.int_to_ptr v293 : ptr; + v297 = hir.load v296 : felt; + v300 = arith.constant 1 : i32; + v487 = arith.constant 48 : i32; + v299 = arith.add v172, v487 : i32 #[overflow = wrapping]; + v301 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v299, v300, v224) : i32 + v302 = hir.bitcast v301 : u32; + v486 = arith.constant 4 : u32; + v304 = arith.mod v302, v486 : u32; + hir.assertz v304 #[code = 250]; + v305 = hir.int_to_ptr v302 : ptr; + v306 = hir.load v305 : felt; + v484 = arith.constant 0 : i32; + v485 = arith.constant 48 : i32; + v308 = arith.add v172, v485 : i32 #[overflow = wrapping]; + v310 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v308, v484, v224) : i32 + v311 = hir.bitcast v310 : u32; + v483 = arith.constant 4 : u32; + v313 = arith.mod v311, v483 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + v315 = hir.load v314 : felt; + v482 = arith.constant 3 : i32; + v316 = arith.constant 64 : i32; + v317 = arith.add v172, v316 : i32 #[overflow = wrapping]; + v319 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v317, v482, v224) : i32 + v320 = hir.bitcast v319 : u32; + v481 = arith.constant 4 : u32; + v322 = arith.mod v320, v481 : u32; + hir.assertz v322 #[code = 250]; + v323 = hir.int_to_ptr v320 : ptr; + v324 = hir.load v323 : felt; + v479 = arith.constant 2 : i32; + v480 = arith.constant 64 : i32; + v326 = arith.add v172, v480 : i32 #[overflow = wrapping]; + v328 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v326, v479, v224) : i32 + v329 = hir.bitcast v328 : u32; + v478 = arith.constant 4 : u32; + v331 = arith.mod v329, v478 : u32; + hir.assertz v331 #[code = 250]; + v332 = hir.int_to_ptr v329 : ptr; + v333 = hir.load v332 : felt; + v476 = arith.constant 1 : i32; + v477 = arith.constant 64 : i32; + v335 = arith.add v172, v477 : i32 #[overflow = wrapping]; + v337 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v335, v476, v224) : i32 + v338 = hir.bitcast v337 : u32; + v475 = arith.constant 4 : u32; + v340 = arith.mod v338, v475 : u32; + hir.assertz v340 #[code = 250]; + v341 = hir.int_to_ptr v338 : ptr; + v342 = hir.load v341 : felt; + v473 = arith.constant 0 : i32; + v474 = arith.constant 64 : i32; + v344 = arith.add v172, v474 : i32 #[overflow = wrapping]; + v346 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/>::index(v344, v473, v224) : i32 + v347 = hir.bitcast v346 : u32; + v472 = arith.constant 4 : u32; + v349 = arith.mod v347, v472 : u32; + hir.assertz v349 #[code = 250]; + v350 = hir.int_to_ptr v347 : ptr; + v351 = hir.load v350 : felt; + v352 = arith.constant 80 : i32; + v353 = arith.add v172, v352 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden::protocol::native_account::set_map_item(v183, v190, v288, v297, v306, v315, v324, v333, v342, v351, v353) + v471 = arith.constant 96 : i32; + v355 = arith.add v172, v471 : i32 #[overflow = wrapping]; + v356 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/__stack_pointer : ptr + v357 = hir.bitcast v356 : ptr; + hir.store v357, v355; + builtin.ret v233; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block17: - v268 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr - v269 = hir.bitcast v268 : ptr; - v270 = hir.load v269 : i32; - v271 = arith.constant 1048584 : i32; - v272 = arith.add v270, v271 : i32 #[overflow = wrapping]; - v273 = hir.bitcast v272 : u32; - v274 = hir.int_to_ptr v273 : ptr; - v275 = hir.load v274 : u8; - v267 = arith.constant 0 : i32; - v276 = arith.zext v275 : u32; - v277 = hir.bitcast v276 : i32; - v279 = arith.neq v277, v267 : i1; - scf.if v279{ + v359 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v360 = hir.bitcast v359 : ptr; + v361 = hir.load v360 : i32; + v362 = arith.constant 1048612 : i32; + v363 = arith.add v361, v362 : i32 #[overflow = wrapping]; + v364 = hir.bitcast v363 : u32; + v365 = hir.int_to_ptr v364 : ptr; + v366 = hir.load v365 : u8; + v358 = arith.constant 0 : i32; + v367 = arith.zext v366 : u32; + v368 = hir.bitcast v367 : i32; + v370 = arith.neq v368, v358 : i1; + scf.if v370{ ^block19: scf.yield ; } else { ^block20: - v280 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr - v281 = hir.bitcast v280 : ptr; - v282 = hir.load v281 : i32; + v371 = builtin.global_symbol @miden:counter-contract/counter-contract@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v372 = hir.bitcast v371 : ptr; + v373 = hir.load v372 : i32; hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/__wasm_call_ctors() - v415 = arith.constant 1 : u8; - v417 = arith.constant 1048584 : i32; - v284 = arith.add v282, v417 : i32 #[overflow = wrapping]; - v288 = hir.bitcast v284 : u32; - v289 = hir.int_to_ptr v288 : ptr; - hir.store v289, v415; + v511 = arith.constant 1 : u8; + v513 = arith.constant 1048612 : i32; + v375 = arith.add v373, v513 : i32 #[overflow = wrapping]; + v379 = hir.bitcast v375 : u32; + v380 = hir.int_to_ptr v379 : ptr; + hir.store v380, v511; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v290: i32, v291: felt) { - ^block21(v290: i32, v291: felt): - v300 = arith.constant 12 : u32; - v299 = hir.bitcast v290 : u32; - v301 = arith.add v299, v300 : u32 #[overflow = checked]; - v302 = arith.constant 4 : u32; - v303 = arith.mod v301, v302 : u32; - hir.assertz v303 #[code = 250]; - v304 = hir.int_to_ptr v301 : ptr; - hir.store v304, v291; - v306 = arith.constant 8 : u32; - v305 = hir.bitcast v290 : u32; - v307 = arith.add v305, v306 : u32 #[overflow = checked]; - v426 = arith.constant 4 : u32; - v309 = arith.mod v307, v426 : u32; - hir.assertz v309 #[code = 250]; - v420 = arith.constant 0 : felt; - v310 = hir.int_to_ptr v307 : ptr; - hir.store v310, v420; - v425 = arith.constant 4 : u32; - v311 = hir.bitcast v290 : u32; - v313 = arith.add v311, v425 : u32 #[overflow = checked]; - v424 = arith.constant 4 : u32; - v315 = arith.mod v313, v424 : u32; - hir.assertz v315 #[code = 250]; - v423 = arith.constant 0 : felt; - v316 = hir.int_to_ptr v313 : ptr; - hir.store v316, v423; - v317 = hir.bitcast v290 : u32; - v422 = arith.constant 4 : u32; - v319 = arith.mod v317, v422 : u32; - hir.assertz v319 #[code = 250]; - v421 = arith.constant 0 : felt; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v421; - builtin.ret ; + private builtin.function @>::index(v381: i32, v382: i32, v383: i32) -> i32 { + ^block21(v381: i32, v382: i32, v383: i32): + v391 = arith.constant 0 : i32; + v515 = arith.constant 3 : u32; + v386 = hir.bitcast v382 : u32; + v388 = arith.gt v386, v515 : i1; + v389 = arith.zext v388 : u32; + v390 = hir.bitcast v389 : i32; + v392 = arith.neq v390, v391 : i1; + cf.cond_br v392 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v514 = arith.constant 2 : u32; + v395 = arith.shl v382, v514 : i32; + v396 = arith.add v381, v395 : i32 #[overflow = wrapping]; + builtin.ret v396; }; - private builtin.function @miden::protocol::active_account::get_map_item(v321: felt, v322: felt, v323: felt, v324: felt, v325: felt, v326: felt, v327: i32) { - ^block23(v321: felt, v322: felt, v323: felt, v324: felt, v325: felt, v326: felt, v327: i32): - v328, v329, v330, v331 = hir.exec @miden/protocol/active_account/get_map_item(v321, v322, v323, v324, v325, v326) : felt, felt, felt, felt - v332 = hir.bitcast v327 : u32; - v333 = hir.int_to_ptr v332 : ptr; - hir.store v333, v328; - v334 = arith.constant 4 : u32; - v335 = arith.add v332, v334 : u32 #[overflow = checked]; - v336 = hir.int_to_ptr v335 : ptr; - hir.store v336, v329; - v337 = arith.constant 8 : u32; - v338 = arith.add v332, v337 : u32 #[overflow = checked]; - v339 = hir.int_to_ptr v338 : ptr; - hir.store v339, v330; - v340 = arith.constant 12 : u32; - v341 = arith.add v332, v340 : u32 #[overflow = checked]; - v342 = hir.int_to_ptr v341 : ptr; - hir.store v342, v331; + private builtin.function @miden::protocol::active_account::get_map_item(v397: felt, v398: felt, v399: felt, v400: felt, v401: felt, v402: felt, v403: i32) { + ^block25(v397: felt, v398: felt, v399: felt, v400: felt, v401: felt, v402: felt, v403: i32): + v404, v405, v406, v407 = hir.exec @miden/protocol/active_account/get_map_item(v397, v398, v399, v400, v401, v402) : felt, felt, felt, felt + v408 = hir.bitcast v403 : u32; + v409 = hir.int_to_ptr v408 : ptr; + hir.store v409, v404; + v410 = arith.constant 4 : u32; + v411 = arith.add v408, v410 : u32 #[overflow = checked]; + v412 = hir.int_to_ptr v411 : ptr; + hir.store v412, v405; + v413 = arith.constant 8 : u32; + v414 = arith.add v408, v413 : u32 #[overflow = checked]; + v415 = hir.int_to_ptr v414 : ptr; + hir.store v415, v406; + v416 = arith.constant 12 : u32; + v417 = arith.add v408, v416 : u32 #[overflow = checked]; + v418 = hir.int_to_ptr v417 : ptr; + hir.store v418, v407; builtin.ret ; }; - private builtin.function @miden::protocol::native_account::set_map_item(v343: felt, v344: felt, v345: felt, v346: felt, v347: felt, v348: felt, v349: felt, v350: felt, v351: felt, v352: felt, v353: i32) { - ^block28(v343: felt, v344: felt, v345: felt, v346: felt, v347: felt, v348: felt, v349: felt, v350: felt, v351: felt, v352: felt, v353: i32): - v354, v355, v356, v357 = hir.exec @miden/protocol/native_account/set_map_item(v343, v344, v345, v346, v347, v348, v349, v350, v351, v352) : felt, felt, felt, felt - v358 = hir.bitcast v353 : u32; - v359 = hir.int_to_ptr v358 : ptr; - hir.store v359, v354; - v360 = arith.constant 4 : u32; - v361 = arith.add v358, v360 : u32 #[overflow = checked]; - v362 = hir.int_to_ptr v361 : ptr; - hir.store v362, v355; - v363 = arith.constant 8 : u32; - v364 = arith.add v358, v363 : u32 #[overflow = checked]; - v365 = hir.int_to_ptr v364 : ptr; - hir.store v365, v356; - v366 = arith.constant 12 : u32; - v367 = arith.add v358, v366 : u32 #[overflow = checked]; - v368 = hir.int_to_ptr v367 : ptr; - hir.store v368, v357; + private builtin.function @miden::protocol::native_account::set_map_item(v419: felt, v420: felt, v421: felt, v422: felt, v423: felt, v424: felt, v425: felt, v426: felt, v427: felt, v428: felt, v429: i32) { + ^block30(v419: felt, v420: felt, v421: felt, v422: felt, v423: felt, v424: felt, v425: felt, v426: felt, v427: felt, v428: felt, v429: i32): + v430, v431, v432, v433 = hir.exec @miden/protocol/native_account/set_map_item(v419, v420, v421, v422, v423, v424, v425, v426, v427, v428) : felt, felt, felt, felt + v434 = hir.bitcast v429 : u32; + v435 = hir.int_to_ptr v434 : ptr; + hir.store v435, v430; + v436 = arith.constant 4 : u32; + v437 = arith.add v434, v436 : u32 #[overflow = checked]; + v438 = hir.int_to_ptr v437 : ptr; + hir.store v438, v431; + v439 = arith.constant 8 : u32; + v440 = arith.add v434, v439 : u32 #[overflow = checked]; + v441 = hir.int_to_ptr v440 : ptr; + hir.store v441, v432; + v442 = arith.constant 12 : u32; + v443 = arith.add v434, v442 : u32 #[overflow = checked]; + v444 = hir.int_to_ptr v443 : ptr; + hir.store v444, v433; builtin.ret ; }; @@ -458,18 +540,20 @@ builtin.component miden:counter-contract/counter-contract@0.1.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @get-count() -> felt { - ^block31: - v369 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#get-count() : felt - builtin.ret v369; + ^block33: + v445 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#get-count() : felt + builtin.ret v445; }; public builtin.function @increment-count() -> felt { - ^block33: - v370 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#increment-count() : felt - builtin.ret v370; + ^block35: + v446 = hir.exec @miden:counter-contract/counter-contract@0.1.0/counter_contract/miden:counter-contract/counter-contract@0.1.0#increment-count() : felt + builtin.ret v446; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/counter.masm b/tests/integration/expected/examples/counter.masm index 676eb2b5a..b79528b4f 100644 --- a/tests/integration/expected/examples/counter.masm +++ b/tests/integration/expected/examples/counter.masm @@ -31,20 +31,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:counter-contract/counter-contract@0.1.0"::counter_contract @@ -70,7 +70,7 @@ proc miden_base_sys::bindings::storage::get_map_item( felt, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -80,7 +80,7 @@ proc miden_base_sys::bindings::storage::get_map_item( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -90,10 +90,26 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.5 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.6 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -107,10 +123,16 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.6 - add - u32assert + push.2 + dup.7 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -124,10 +146,16 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.7 - add - u32assert + push.1 + dup.8 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -141,7 +169,17 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop - movup.7 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.9 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -155,22 +193,20 @@ proc miden_base_sys::bindings::storage::get_map_item( exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 - movup.2 - swap.4 - movdn.2 + dup.3 + movup.4 + swap.8 + movdn.4 + swap.6 swap.1 swap.5 swap.7 - swap.1 - swap.6 - swap.8 trace.240 nop exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::"miden::protocol::active_account::get_map_item" trace.252 nop - dup.0 + dup.1 push.8 dup.1 swap.1 @@ -186,7 +222,7 @@ proc miden_base_sys::bindings::storage::get_map_item( nop swap.1 push.8 - dup.4 + dup.3 add u32assert push.8 @@ -207,7 +243,7 @@ proc miden_base_sys::bindings::storage::get_map_item( trace.252 nop push.8 - dup.1 + dup.2 add u32assert push.8 @@ -224,7 +260,7 @@ proc miden_base_sys::bindings::storage::get_map_item( trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -244,7 +280,7 @@ proc miden_base_sys::bindings::storage::get_map_item( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -304,7 +340,7 @@ end proc miden:counter-contract/counter-contract@0.1.0#get-count( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -314,7 +350,7 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( nop push.48 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -404,22 +440,19 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( u32assert assertz push.0 - push.0 - mul.4294967296 - add swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop - push.20 + push.16 dup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -427,57 +460,50 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( assertz push.0 push.0 - mul.4294967296 - add - swap.1 + movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_dw trace.252 nop push.16 dup.3 - add - u32assert - push.4 - dup.1 + u32wrapping_add + push.32 + dup.4 + u32wrapping_add swap.1 - u32mod - u32assert - assertz - push.0 - push.0 - mul.4294967296 - add + swap.3 + swap.2 swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::miden_base_sys::bindings::storage::get_map_item + trace.252 + nop + push.1114180 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.3 + push.1048596 u32wrapping_add + push.3 push.32 - dup.4 + dup.3 u32wrapping_add - swap.1 - swap.3 - swap.2 - swap.1 trace.240 nop - exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::miden_base_sys::bindings::storage::get_map_item + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index trace.252 nop - push.44 - dup.1 - add - u32assert push.4 dup.1 swap.1 @@ -494,7 +520,7 @@ proc miden:counter-contract/counter-contract@0.1.0#get-count( push.48 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -508,7 +534,7 @@ end proc miden:counter-contract/counter-contract@0.1.0#increment-count( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -516,9 +542,9 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( exec.::intrinsics::mem::load_sw trace.252 nop - push.64 + push.96 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -575,24 +601,8 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( exec.::intrinsics::mem::load_felt trace.252 nop - push.0 - push.0 - mul.4294967296 - add - push.0 - push.0 - mul.4294967296 - add - push.0 - push.0 - mul.4294967296 - add - push.1 - push.0 - mul.4294967296 - add push.28 - dup.7 + dup.3 add u32assert push.4 @@ -601,7 +611,10 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( u32mod u32assert assertz - dup.1 + push.1 + push.0 + mul.4294967296 + add swap.1 u32divmod.4 swap.1 @@ -611,7 +624,7 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( trace.252 nop push.24 - dup.7 + dup.3 add u32assert push.4 @@ -620,71 +633,73 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( u32mod u32assert assertz - dup.2 + push.0 swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_sw trace.252 nop - push.20 - dup.7 + push.16 + dup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz - dup.3 - swap.1 + push.0 + push.0 + movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::store_dw trace.252 nop push.16 - dup.7 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + dup.3 + u32wrapping_add + push.32 dup.4 - swap.1 + u32wrapping_add + dup.2 + dup.4 + swap.2 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::miden_base_sys::bindings::storage::get_map_item + trace.252 + nop + push.1114180 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_felt + exec.::intrinsics::mem::load_sw trace.252 nop - push.16 - dup.7 + push.1048596 u32wrapping_add - push.48 - dup.8 + push.3 + push.32 + dup.5 u32wrapping_add - dup.6 - dup.8 + dup.2 swap.2 + swap.1 trace.240 nop - exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::miden_base_sys::bindings::storage::get_map_item + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index trace.252 nop - push.60 - dup.7 - add - u32assert push.4 dup.1 swap.1 @@ -699,22 +714,33 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( trace.252 nop push.1 + push.0 + mul.4294967296 add - push.32 - dup.8 - u32wrapping_add + add + push.24 + dup.5 + add + u32assert + push.8 dup.1 swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::from + exec.::intrinsics::mem::load_dw trace.252 nop - push.44 - dup.8 + swap.1 + push.56 + dup.7 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -722,16 +748,18 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_dw trace.252 nop - push.40 - dup.9 + push.16 + dup.5 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -741,14 +769,15 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop - push.36 - dup.10 + swap.1 + push.48 + dup.7 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -756,13 +785,15 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_dw trace.252 nop - push.32 - dup.11 + push.76 + dup.5 add u32assert push.4 @@ -771,38 +802,282 @@ proc miden:counter-contract/counter-contract@0.1.0#increment-count( u32mod u32assert assertz - u32divmod.4 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.72 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.64 + dup.5 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + push.0 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.3 + push.48 + dup.6 + u32wrapping_add + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 swap.1 trace.240 nop exec.::intrinsics::mem::load_felt trace.252 nop + push.2 push.48 + dup.7 + u32wrapping_add + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + push.48 + dup.8 + u32wrapping_add + dup.5 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.48 + dup.9 + u32wrapping_add + dup.6 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.3 + push.64 + dup.10 + u32wrapping_add + dup.7 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + push.64 + dup.11 + u32wrapping_add + dup.8 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + push.64 dup.12 u32wrapping_add + dup.9 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.64 + dup.13 + u32wrapping_add + movup.2 + swap.10 + movdn.2 + trace.240 + nop + exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.80 + dup.12 + u32wrapping_add + movup.4 + swap.5 + movdn.4 movup.3 - swap.7 + swap.6 movdn.3 movup.2 - swap.8 - swap.4 - swap.6 + swap.7 movdn.2 swap.10 swap.1 swap.9 - swap.5 + swap.8 swap.11 trace.240 nop exec.::"miden:counter-contract/counter-contract@0.1.0"::counter_contract::"miden::protocol::native_account::set_map_item" trace.252 nop - push.64 + push.96 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -816,7 +1091,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -824,7 +1099,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -845,7 +1120,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -859,7 +1134,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -887,82 +1162,31 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( +proc >::index( i32, - felt -) - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + i32, + i32 +) -> i32 movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + drop push.0 + push.3 + dup.3 swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end end @callconv("C") diff --git a/tests/integration/expected/examples/counter.wat b/tests/integration/expected/examples/counter.wat index bd1f0f1d6..9decb1fcf 100644 --- a/tests/integration/expected/examples/counter.wat +++ b/tests/integration/expected/examples/counter.wat @@ -11,12 +11,11 @@ (type (;1;) (func (param i32 f32 f32 i32))) (type (;2;) (func (param i32))) (type (;3;) (func (result f32))) - (type (;4;) (func (param i32 f32))) - (type (;5;) (func (param f32 f32) (result f32))) - (type (;6;) (func (param i32) (result f32))) - (type (;7;) (func (param i64) (result f32))) - (type (;8;) (func (param f32 f32 f32 f32 f32 f32 i32))) - (type (;9;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;4;) (func (param f32 f32) (result f32))) + (type (;5;) (func (param i64) (result f32))) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (param f32 f32 f32 f32 f32 f32 i32))) + (type (;8;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -28,7 +27,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $counter_contract::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden_base_sys::bindings::storage::get_map_item (;2;) (type 1) (param i32 f32 f32 i32) - (local i32) + (local i32 i32) global.get $__stack_pointer i32.const 16 i32.sub @@ -37,12 +36,27 @@ local.get 2 local.get 1 local.get 3 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 5 + call $>::index + f32.load local.get 3 - f32.load offset=8 + i32.const 2 + local.get 5 + call $>::index + f32.load local.get 3 - f32.load offset=4 + i32.const 1 + local.get 5 + call $>::index + f32.load local.get 3 + i32.const 0 + local.get 5 + call $>::index f32.load local.get 4 call $miden::protocol::active_account::get_map_item @@ -77,7 +91,7 @@ f32.store ) (func $miden:counter-contract/counter-contract@0.1.0#get-count (;4;) (type 3) (result f32) - (local i32 f32 f32 f32 f32 f32) + (local i32 f32 f32) global.get $__stack_pointer i32.const 48 i32.sub @@ -94,28 +108,16 @@ local.get 0 f32.load offset=8 local.set 2 - i64.const 0 - call $intrinsics::felt::from_u64_unchecked - local.set 3 - i64.const 0 - call $intrinsics::felt::from_u64_unchecked - local.set 4 - i64.const 0 - call $intrinsics::felt::from_u64_unchecked - local.set 5 local.get 0 i64.const 1 call $intrinsics::felt::from_u64_unchecked f32.store offset=28 local.get 0 - local.get 5 - f32.store offset=24 - local.get 0 - local.get 4 - f32.store offset=20 + i32.const 0 + i32.store offset=24 local.get 0 - local.get 3 - f32.store offset=16 + i64.const 0 + i64.store offset=16 local.get 0 i32.const 32 i32.add @@ -126,7 +128,14 @@ i32.add call $miden_base_sys::bindings::storage::get_map_item local.get 0 - f32.load offset=44 + i32.const 32 + i32.add + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + call $>::index + f32.load local.set 1 local.get 0 i32.const 48 @@ -135,9 +144,9 @@ local.get 1 ) (func $miden:counter-contract/counter-contract@0.1.0#increment-count (;5;) (type 3) (result f32) - (local i32 f32 f32 f32 f32 f32 f32 f32) + (local i32 f32 f32 i32 f32) global.get $__stack_pointer - i32.const 64 + i32.const 96 i32.sub local.tee 0 global.set $__stack_pointer @@ -152,31 +161,18 @@ local.get 0 f32.load offset=8 local.set 2 - i64.const 0 - call $intrinsics::felt::from_u64_unchecked - local.set 3 - i64.const 0 - call $intrinsics::felt::from_u64_unchecked - local.set 4 - i64.const 0 - call $intrinsics::felt::from_u64_unchecked - local.set 5 local.get 0 i64.const 1 call $intrinsics::felt::from_u64_unchecked - local.tee 6 f32.store offset=28 local.get 0 - local.get 5 - f32.store offset=24 - local.get 0 - local.get 4 - f32.store offset=20 + i32.const 0 + i32.store offset=24 local.get 0 - local.get 3 - f32.store offset=16 + i64.const 0 + i64.store offset=16 local.get 0 - i32.const 48 + i32.const 32 i32.add local.get 2 local.get 1 @@ -187,42 +183,107 @@ local.get 0 i32.const 32 i32.add - local.get 0 - f32.load offset=60 - i32.const 1 - call $intrinsics::felt::from_u32 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load + i64.const 1 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add - local.tee 7 - call $>::from + local.set 4 + local.get 0 + local.get 0 + i64.load offset=24 + i64.store offset=56 + local.get 0 + local.get 0 + i64.load offset=16 + i64.store offset=48 + local.get 0 + local.get 4 + f32.store offset=76 + local.get 0 + i32.const 0 + i32.store offset=72 + local.get 0 + i64.const 0 + i64.store offset=64 local.get 1 local.get 2 - local.get 6 - local.get 5 - local.get 4 + local.get 0 + i32.const 48 + i32.add + i32.const 3 local.get 3 + call $>::index + f32.load local.get 0 - f32.load offset=44 + i32.const 48 + i32.add + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 0 - f32.load offset=40 + i32.const 48 + i32.add + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 0 - f32.load offset=36 + i32.const 48 + i32.add + i32.const 0 + local.get 3 + call $>::index + f32.load local.get 0 - f32.load offset=32 + i32.const 64 + i32.add + i32.const 3 + local.get 3 + call $>::index + f32.load local.get 0 - i32.const 48 + i32.const 64 i32.add - call $miden::protocol::native_account::set_map_item + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 0 i32.const 64 i32.add + i32.const 1 + local.get 3 + call $>::index + f32.load + local.get 0 + i32.const 64 + i32.add + i32.const 0 + local.get 3 + call $>::index + f32.load + local.get 0 + i32.const 80 + i32.add + call $miden::protocol::native_account::set_map_item + local.get 0 + i32.const 96 + i32.add global.set $__stack_pointer - local.get 7 + local.get 4 ) (func $wit_bindgen::rt::run_ctors_once (;6;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -230,52 +291,41 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;7;) (type 4) (param i32 f32) - (local f32 f32 f32) - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 2 - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 3 - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 4 - local.get 0 - local.get 1 - f32.store offset=12 - local.get 0 - local.get 4 - f32.store offset=8 - local.get 0 - local.get 3 - f32.store offset=4 - local.get 0 - local.get 2 - f32.store - ) - (func $intrinsics::felt::add (;8;) (type 5) (param f32 f32) (result f32) + (func $intrinsics::felt::add (;7;) (type 4) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;9;) (type 6) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;8;) (type 5) (param i64) (result f32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;10;) (type 7) (param i64) (result f32) + (func $>::index (;9;) (type 6) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end unreachable ) - (func $miden::protocol::active_account::get_map_item (;11;) (type 8) (param f32 f32 f32 f32 f32 f32 i32) + (func $miden::protocol::active_account::get_map_item (;10;) (type 7) (param f32 f32 f32 f32 f32 f32 i32) unreachable ) - (func $miden::protocol::native_account::set_map_item (;12;) (type 9) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::set_map_item (;11;) (type 8) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "!counter-contract\95A simple example of a Miden counter contract using the Account Storage API\0b0.1.0\03\01\01\003miden::component::miden_counter_contract::count_map\01\019counter contract storage map\00\00\09word\00\00\09word\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/examples/counter_note.hir b/tests/integration/expected/examples/counter_note.hir index b1d34e2d5..ba15ab264 100644 --- a/tests/integration/expected/examples/counter_note.hir +++ b/tests/integration/expected/examples/counter_note.hir @@ -28,8 +28,9 @@ builtin.component miden:base/note-script@1.0.0 { v7 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0() : felt v8 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0() : felt v12 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0() : felt - v40 = arith.constant 1 : felt; - v11 = arith.add v7, v40 : felt #[overflow = unchecked]; + v9 = arith.constant 1 : i64; + v10 = arith.trunc v9 : felt; + v11 = arith.add v7, v10 : felt #[overflow = unchecked]; hir.assert_eq v12, v11; builtin.ret ; }; @@ -57,12 +58,12 @@ builtin.component miden:base/note-script@1.0.0 { v27 = hir.bitcast v26 : ptr; v28 = hir.load v27 : i32; hir.exec @miden:base/note-script@1.0.0/counter_note/__wasm_call_ctors() - v42 = arith.constant 1 : u8; - v44 = arith.constant 1048588 : i32; - v30 = arith.add v28, v44 : i32 #[overflow = wrapping]; + v41 = arith.constant 1 : u8; + v43 = arith.constant 1048588 : i32; + v30 = arith.add v28, v43 : i32 #[overflow = wrapping]; v34 = hir.bitcast v30 : u32; v35 = hir.int_to_ptr v34 : ptr; - hir.store v35, v42; + hir.store v35, v41; scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/examples/counter_note.masm b/tests/integration/expected/examples/counter_note.masm index 19f6ca3f9..2472fdc02 100644 --- a/tests/integration/expected/examples/counter_note.masm +++ b/tests/integration/expected/examples/counter_note.masm @@ -98,6 +98,9 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.1 + push.0 + mul.4294967296 + add movup.2 add assert_eq diff --git a/tests/integration/expected/examples/counter_note.wat b/tests/integration/expected/examples/counter_note.wat index 42fbcbb73..9a735e455 100644 --- a/tests/integration/expected/examples/counter_note.wat +++ b/tests/integration/expected/examples/counter_note.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -26,7 +25,7 @@ (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param f32 f32) (result f32))) (type (;4;) (func (param f32 f32))) - (type (;5;) (func (param i32) (result f32))) + (type (;5;) (func (param i64) (result f32))) (import "miden:counter-contract/counter-contract@0.1.0" "get-count" (func $counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 (;0;) (type 0))) (import "miden:counter-contract/counter-contract@0.1.0" "increment-count" (func $counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 (;1;) (type 0))) (table (;0;) 2 2 funcref) @@ -46,8 +45,8 @@ call $counter_note::bindings::miden::counter_contract::counter_contract::increment_count::wit_import0 drop local.get 4 - i32.const 1 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 4 call $counter_note::bindings::miden::counter_contract::counter_contract::get_count::wit_import0 @@ -78,7 +77,7 @@ (func $intrinsics::felt::assert_eq (;7;) (type 4) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;8;) (type 5) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;8;) (type 5) (param i64) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") @@ -105,15 +104,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index 48504841a..bb9571168 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -1,6 +1,6 @@ builtin.component miden:base/note-script@1.0.0 { builtin.module public @p2id { - private builtin.function @p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v0: felt, v1: felt, v2: felt, v3: felt) { + private builtin.function @p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import6(v0: felt, v1: felt, v2: felt, v3: felt) { ^block3(v0: felt, v1: felt, v2: felt, v3: felt): hir.call v0, v1, v2, v3 #[callee = miden:basic-wallet/basic-wallet@0.1.0/receive-asset] #[signature = (param felt) (param felt) (param felt) (param felt)]; builtin.ret ; @@ -134,10 +134,10 @@ builtin.component miden:base/note-script@1.0.0 { v85 = hir.load v84 : felt; v1084 = arith.constant 32 : i32; v87 = arith.add v54, v1084 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v87) + hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v87) v1083 = arith.constant 32 : i32; v89 = arith.add v54, v1083 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v89) + hir.exec @miden:base/note-script@1.0.0/p2id/ as core::ops::drop::Drop>::drop(v89) v90 = arith.constant 8 : i32; v91 = arith.add v54, v90 : i32 #[overflow = wrapping]; hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v91) @@ -282,7 +282,7 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v198 #[code = 250]; v199 = hir.int_to_ptr v196 : ptr; v200 = hir.load v199 : felt; - hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v179, v186, v193, v200) + hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import6(v179, v186, v193, v200) v203 = arith.constant 16 : i32; v204 = arith.add v1040, v203 : i32 #[overflow = wrapping]; v201 = arith.constant -16 : i32; @@ -625,7 +625,7 @@ builtin.component miden:base/note-script@1.0.0 { ub.unreachable ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v424: i32) { + private builtin.function @ as core::ops::drop::Drop>::drop(v424: i32) { ^block56(v424: i32): v425 = arith.constant 4 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v424, v425, v425) @@ -882,7 +882,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v620: i32) { + private builtin.function @ as core::ops::drop::Drop>::drop(v620: i32) { ^block70(v620: i32): builtin.ret ; }; diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index c636e8a9f..db3048e02 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -35,7 +35,7 @@ end # mod ::"miden:base/note-script@1.0.0"::p2id @callconv("C") -proc p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7( +proc p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import6( felt, felt, felt, @@ -302,7 +302,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/note-script@1.0.0"::p2id:: as core::ops::drop::Drop>::drop + exec.::"miden:base/note-script@1.0.0"::p2id:: as core::ops::drop::Drop>::drop trace.252 nop push.32 @@ -310,7 +310,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/note-script@1.0.0"::p2id:: as core::ops::drop::Drop>::drop + exec.::"miden:base/note-script@1.0.0"::p2id:: as core::ops::drop::Drop>::drop trace.252 nop push.8 @@ -589,7 +589,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.2 trace.240 nop - exec.::"miden:base/note-script@1.0.0"::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 + exec.::"miden:base/note-script@1.0.0"::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import6 trace.252 nop push.16 @@ -1240,7 +1240,7 @@ proc ::with_capacity_in( end @callconv("C") -proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) push.4 @@ -1791,7 +1791,7 @@ proc as core::op end @callconv("C") -proc as core::ops::drop::Drop>::drop( +proc as core::ops::drop::Drop>::drop( i32 ) drop diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index f2e410785..f8c17ad3e 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -34,7 +33,7 @@ (type (;9;) (func (param i32 i32 i32 i32 i32))) (type (;10;) (func (param i32 i32))) (type (;11;) (func (param i32) (result i32))) - (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) + (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import6 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -103,11 +102,11 @@ local.get 4 i32.const 32 i32.add - call $ as core::ops::drop::Drop>::drop + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 32 i32.add - call $ as core::ops::drop::Drop>::drop + call $ as core::ops::drop::Drop>::drop local.get 4 i32.const 8 i32.add @@ -167,7 +166,7 @@ f32.load offset=8 local.get 5 f32.load offset=12 - call $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 + call $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import6 local.get 9 i32.const -16 i32.add @@ -360,7 +359,7 @@ i32.add global.set $__stack_pointer ) - (func $ as core::ops::drop::Drop>::drop (;13;) (type 6) (param i32) + (func $ as core::ops::drop::Drop>::drop (;13;) (type 6) (param i32) local.get 0 i32.const 4 i32.const 4 @@ -502,7 +501,7 @@ i32.const 16 call $::deallocate ) - (func $ as core::ops::drop::Drop>::drop (;20;) (type 6) (param i32)) + (func $ as core::ops::drop::Drop>::drop (;20;) (type 6) (param i32)) (func $intrinsics::felt::eq (;21;) (type 8) (param f32 f32) (result i32) unreachable ) @@ -792,15 +791,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/examples/storage_example.hir b/tests/integration/expected/examples/storage_example.hir index 4cd2f1803..7b4e8650f 100644 --- a/tests/integration/expected/examples/storage_example.hir +++ b/tests/integration/expected/examples/storage_example.hir @@ -25,26 +25,26 @@ builtin.component miden:storage-example/foo@1.0.0 { v17 = arith.constant 8 : u32; v16 = hir.bitcast v0 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v352 = arith.constant 4 : u32; - v20 = arith.mod v18, v352 : u32; + v520 = arith.constant 4 : u32; + v20 = arith.mod v18, v520 : u32; hir.assertz v20 #[code = 250]; v6 = arith.constant -6475110084634595035 : i64; v7 = arith.trunc v6 : felt; v21 = hir.int_to_ptr v18 : ptr; hir.store v21, v7; - v351 = arith.constant 4 : u32; + v519 = arith.constant 4 : u32; v22 = hir.bitcast v0 : u32; - v24 = arith.add v22, v351 : u32 #[overflow = checked]; - v350 = arith.constant 4 : u32; - v26 = arith.mod v24, v350 : u32; + v24 = arith.add v22, v519 : u32 #[overflow = checked]; + v518 = arith.constant 4 : u32; + v26 = arith.mod v24, v518 : u32; hir.assertz v26 #[code = 250]; v4 = arith.constant -637820373289844411 : i64; v5 = arith.trunc v4 : felt; v27 = hir.int_to_ptr v24 : ptr; hir.store v27, v5; v28 = hir.bitcast v0 : u32; - v349 = arith.constant 4 : u32; - v30 = arith.mod v28, v349 : u32; + v517 = arith.constant 4 : u32; + v30 = arith.mod v28, v517 : u32; hir.assertz v30 #[code = 250]; v2 = arith.constant 3042002143573699788 : i64; v3 = arith.trunc v2 : felt; @@ -58,13 +58,12 @@ builtin.component miden:storage-example/foo@1.0.0 { v38 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr v39 = hir.bitcast v38 : ptr; v40 = hir.load v39 : i32; - v41 = arith.constant 32 : i32; + v41 = arith.constant 64 : i32; v42 = arith.sub v40, v41 : i32 #[overflow = wrapping]; v43 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr v44 = hir.bitcast v43 : ptr; hir.store v44, v42; hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() - hir.exec @miden:storage-example/foo@1.0.0/storage_example/::default(v42) v46 = arith.constant 12 : u32; v45 = hir.bitcast v42 : u32; v47 = arith.add v45, v46 : u32 #[overflow = checked]; @@ -72,201 +71,417 @@ builtin.component miden:storage-example/foo@1.0.0 { v49 = arith.mod v47, v48 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; - v51 = hir.load v50 : felt; - v53 = arith.constant 8 : u32; - v52 = hir.bitcast v42 : u32; - v54 = arith.add v52, v53 : u32 #[overflow = checked]; - v355 = arith.constant 4 : u32; - v56 = arith.mod v54, v355 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - v58 = hir.load v57 : felt; - v59 = arith.constant 16 : i32; - v60 = arith.add v42, v59 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::active_account::get_map_item(v51, v58, v35, v34, v33, v32, v60) - v62 = arith.constant 16 : u32; - v61 = hir.bitcast v42 : u32; - v63 = arith.add v61, v62 : u32 #[overflow = checked]; - v354 = arith.constant 4 : u32; - v65 = arith.mod v63, v354 : u32; + hir.store v50, v35; + v52 = arith.constant 8 : u32; + v51 = hir.bitcast v42 : u32; + v53 = arith.add v51, v52 : u32 #[overflow = checked]; + v543 = arith.constant 4 : u32; + v55 = arith.mod v53, v543 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v34; + v542 = arith.constant 4 : u32; + v57 = hir.bitcast v42 : u32; + v59 = arith.add v57, v542 : u32 #[overflow = checked]; + v541 = arith.constant 4 : u32; + v61 = arith.mod v59, v541 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + hir.store v62, v33; + v63 = hir.bitcast v42 : u32; + v540 = arith.constant 4 : u32; + v65 = arith.mod v63, v540 : u32; hir.assertz v65 #[code = 250]; v66 = hir.int_to_ptr v63 : ptr; - v67 = hir.load v66 : felt; - v353 = arith.constant 32 : i32; - v69 = arith.add v42, v353 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - builtin.ret v67; - }; - - private builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v72: felt, v73: felt, v74: felt, v75: felt, v76: felt, v77: felt, v78: felt, v79: felt, v80: felt) { - ^block13(v72: felt, v73: felt, v74: felt, v75: felt, v76: felt, v77: felt, v78: felt, v79: felt, v80: felt): - v83 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; - v86 = arith.constant 48 : i32; - v87 = arith.sub v85, v86 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() - hir.exec @miden:storage-example/foo@1.0.0/storage_example/::default(v87) - v91 = arith.constant 4 : u32; - v90 = hir.bitcast v87 : u32; - v92 = arith.add v90, v91 : u32 #[overflow = checked]; - v383 = arith.constant 4 : u32; - v94 = arith.mod v92, v383 : u32; - hir.assertz v94 #[code = 250]; - v95 = hir.int_to_ptr v92 : ptr; - v96 = hir.load v95 : felt; - v97 = hir.bitcast v87 : u32; - v382 = arith.constant 4 : u32; - v99 = arith.mod v97, v382 : u32; + hir.store v66, v32; + v67 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v68 = hir.bitcast v67 : ptr; + v69 = hir.load v68 : i32; + v70 = arith.constant 16 : i32; + v71 = arith.add v42, v70 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/::default(v71) + v73 = arith.constant 28 : u32; + v72 = hir.bitcast v42 : u32; + v74 = arith.add v72, v73 : u32 #[overflow = checked]; + v539 = arith.constant 4 : u32; + v76 = arith.mod v74, v539 : u32; + hir.assertz v76 #[code = 250]; + v77 = hir.int_to_ptr v74 : ptr; + v78 = hir.load v77 : felt; + v80 = arith.constant 24 : u32; + v79 = hir.bitcast v42 : u32; + v81 = arith.add v79, v80 : u32 #[overflow = checked]; + v538 = arith.constant 4 : u32; + v83 = arith.mod v81, v538 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + v85 = hir.load v84 : felt; + v87 = arith.constant 1048596 : i32; + v88 = arith.add v69, v87 : i32 #[overflow = wrapping]; + v86 = arith.constant 3 : i32; + v89 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v42, v86, v88) : i32 + v90 = hir.bitcast v89 : u32; + v537 = arith.constant 4 : u32; + v92 = arith.mod v90, v537 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + v94 = hir.load v93 : felt; + v95 = arith.constant 2 : i32; + v96 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v42, v95, v88) : i32 + v97 = hir.bitcast v96 : u32; + v536 = arith.constant 4 : u32; + v99 = arith.mod v97, v536 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : felt; - v102 = arith.constant 32 : i32; - v103 = arith.add v87, v102 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::active_account::get_item(v96, v101, v103) - v105 = arith.constant 40 : u32; - v104 = hir.bitcast v87 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v381 = arith.constant 4 : u32; - v108 = arith.mod v106, v381 : u32; - hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : felt; - v112 = arith.constant 36 : u32; - v111 = hir.bitcast v87 : u32; - v113 = arith.add v111, v112 : u32 #[overflow = checked]; - v380 = arith.constant 4 : u32; - v115 = arith.mod v113, v380 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - v117 = hir.load v116 : felt; - v119 = arith.constant 32 : u32; - v118 = hir.bitcast v87 : u32; + v102 = arith.constant 1 : i32; + v103 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v42, v102, v88) : i32 + v104 = hir.bitcast v103 : u32; + v535 = arith.constant 4 : u32; + v106 = arith.mod v104, v535 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : felt; + v37 = arith.constant 0 : i32; + v110 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v42, v37, v88) : i32 + v111 = hir.bitcast v110 : u32; + v534 = arith.constant 4 : u32; + v113 = arith.mod v111, v534 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + v115 = hir.load v114 : felt; + v116 = arith.constant 48 : i32; + v117 = arith.add v42, v116 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::active_account::get_map_item(v78, v85, v94, v101, v108, v115, v117) + v119 = arith.constant 48 : u32; + v118 = hir.bitcast v42 : u32; v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v379 = arith.constant 4 : u32; - v122 = arith.mod v120, v379 : u32; + v533 = arith.constant 8 : u32; + v122 = arith.mod v120, v533 : u32; hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - v124 = hir.load v123 : felt; - v126 = arith.constant 44 : u32; - v125 = hir.bitcast v87 : u32; - v127 = arith.add v125, v126 : u32 #[overflow = checked]; - v378 = arith.constant 4 : u32; - v129 = arith.mod v127, v378 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : felt; - v81 = arith.constant 0 : i32; - v134 = arith.constant 1 : i32; - v132 = arith.eq v72, v131 : i1; - v133 = hir.cast v132 : i32; - v135 = arith.neq v133, v134 : i1; - v136 = arith.zext v135 : u32; - v137 = hir.bitcast v136 : i32; - v139 = arith.neq v137, v81 : i1; - scf.if v139{ - ^block43: + v123 = hir.int_to_ptr v120 : ptr; + v124 = hir.load v123 : i64; + v524, v525 = arith.split v124 : felt, felt; + v129 = arith.constant 40 : u32; + v128 = hir.bitcast v42 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v532 = arith.constant 8 : u32; + v132 = arith.mod v130, v532 : u32; + hir.assertz v132 #[code = 250]; + v526 = arith.join v525, v524 : i64; + v133 = hir.int_to_ptr v130 : ptr; + hir.store v133, v526; + v135 = arith.constant 56 : u32; + v134 = hir.bitcast v42 : u32; + v136 = arith.add v134, v135 : u32 #[overflow = checked]; + v531 = arith.constant 8 : u32; + v138 = arith.mod v136, v531 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : i64; + v521, v522 = arith.split v140 : felt, felt; + v145 = arith.constant 32 : u32; + v144 = hir.bitcast v42 : u32; + v146 = arith.add v144, v145 : u32 #[overflow = checked]; + v530 = arith.constant 8 : u32; + v148 = arith.mod v146, v530 : u32; + hir.assertz v148 #[code = 250]; + v523 = arith.join v522, v521 : i64; + v149 = hir.int_to_ptr v146 : ptr; + hir.store v149, v523; + v529 = arith.constant 3 : i32; + v150 = arith.constant 32 : i32; + v151 = arith.add v42, v150 : i32 #[overflow = wrapping]; + v153 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v151, v529, v88) : i32 + v154 = hir.bitcast v153 : u32; + v528 = arith.constant 4 : u32; + v156 = arith.mod v154, v528 : u32; + hir.assertz v156 #[code = 250]; + v157 = hir.int_to_ptr v154 : ptr; + v158 = hir.load v157 : felt; + v527 = arith.constant 64 : i32; + v160 = arith.add v42, v527 : i32 #[overflow = wrapping]; + v161 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v162 = hir.bitcast v161 : ptr; + hir.store v162, v160; + builtin.ret v158; + }; + + private builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v163: felt, v164: felt, v165: felt, v166: felt, v167: felt, v168: felt, v169: felt, v170: felt, v171: felt) { + ^block13(v163: felt, v164: felt, v165: felt, v166: felt, v167: felt, v168: felt, v169: felt, v170: felt, v171: felt): + v175 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v176 = hir.bitcast v175 : ptr; + v177 = hir.load v176 : i32; + v178 = arith.constant 64 : i32; + v179 = arith.sub v177, v178 : i32 #[overflow = wrapping]; + v180 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v181 = hir.bitcast v180 : ptr; + hir.store v181, v179; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen::rt::run_ctors_once() + hir.exec @miden:storage-example/foo@1.0.0/storage_example/::default(v179) + v183 = arith.constant 4 : u32; + v182 = hir.bitcast v179 : u32; + v184 = arith.add v182, v183 : u32 #[overflow = checked]; + v595 = arith.constant 4 : u32; + v186 = arith.mod v184, v595 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + v188 = hir.load v187 : felt; + v189 = hir.bitcast v179 : u32; + v594 = arith.constant 4 : u32; + v191 = arith.mod v189, v594 : u32; + hir.assertz v191 #[code = 250]; + v192 = hir.int_to_ptr v189 : ptr; + v193 = hir.load v192 : felt; + v194 = arith.constant 48 : i32; + v195 = arith.add v179, v194 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::active_account::get_item(v188, v193, v195) + v197 = arith.constant 56 : u32; + v196 = hir.bitcast v179 : u32; + v198 = arith.add v196, v197 : u32 #[overflow = checked]; + v593 = arith.constant 4 : u32; + v200 = arith.mod v198, v593 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + v202 = hir.load v201 : felt; + v204 = arith.constant 52 : u32; + v203 = hir.bitcast v179 : u32; + v205 = arith.add v203, v204 : u32 #[overflow = checked]; + v592 = arith.constant 4 : u32; + v207 = arith.mod v205, v592 : u32; + hir.assertz v207 #[code = 250]; + v208 = hir.int_to_ptr v205 : ptr; + v209 = hir.load v208 : felt; + v211 = arith.constant 48 : u32; + v210 = hir.bitcast v179 : u32; + v212 = arith.add v210, v211 : u32 #[overflow = checked]; + v591 = arith.constant 4 : u32; + v214 = arith.mod v212, v591 : u32; + hir.assertz v214 #[code = 250]; + v215 = hir.int_to_ptr v212 : ptr; + v216 = hir.load v215 : felt; + v218 = arith.constant 60 : u32; + v217 = hir.bitcast v179 : u32; + v219 = arith.add v217, v218 : u32 #[overflow = checked]; + v590 = arith.constant 4 : u32; + v221 = arith.mod v219, v590 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + v223 = hir.load v222 : felt; + v172 = arith.constant 0 : i32; + v226 = arith.constant 1 : i32; + v224 = arith.eq v163, v223 : i1; + v225 = hir.cast v224 : i32; + v227 = arith.neq v225, v226 : i1; + v228 = arith.zext v227 : u32; + v229 = hir.bitcast v228 : i32; + v231 = arith.neq v229, v172 : i1; + scf.if v231{ + ^block45: scf.yield ; } else { ^block16: - v376 = arith.constant 0 : i32; - v377 = arith.constant 1 : i32; - v140 = arith.eq v73, v110 : i1; - v141 = hir.cast v140 : i32; - v143 = arith.neq v141, v377 : i1; - v144 = arith.zext v143 : u32; - v145 = hir.bitcast v144 : i32; - v147 = arith.neq v145, v376 : i1; - scf.if v147{ - ^block42: + v588 = arith.constant 0 : i32; + v589 = arith.constant 1 : i32; + v232 = arith.eq v164, v202 : i1; + v233 = hir.cast v232 : i32; + v235 = arith.neq v233, v589 : i1; + v236 = arith.zext v235 : u32; + v237 = hir.bitcast v236 : i32; + v239 = arith.neq v237, v588 : i1; + scf.if v239{ + ^block44: scf.yield ; } else { ^block17: - v374 = arith.constant 0 : i32; - v375 = arith.constant 1 : i32; - v148 = arith.eq v74, v117 : i1; - v149 = hir.cast v148 : i32; - v151 = arith.neq v149, v375 : i1; - v152 = arith.zext v151 : u32; - v153 = hir.bitcast v152 : i32; - v155 = arith.neq v153, v374 : i1; - scf.if v155{ - ^block41: + v586 = arith.constant 0 : i32; + v587 = arith.constant 1 : i32; + v240 = arith.eq v165, v209 : i1; + v241 = hir.cast v240 : i32; + v243 = arith.neq v241, v587 : i1; + v244 = arith.zext v243 : u32; + v245 = hir.bitcast v244 : i32; + v247 = arith.neq v245, v586 : i1; + scf.if v247{ + ^block43: scf.yield ; } else { ^block18: - v372 = arith.constant 0 : i32; - v373 = arith.constant 1 : i32; - v156 = arith.eq v75, v124 : i1; - v157 = hir.cast v156 : i32; - v159 = arith.neq v157, v373 : i1; - v160 = arith.zext v159 : u32; - v161 = hir.bitcast v160 : i32; - v163 = arith.neq v161, v372 : i1; - scf.if v163{ - ^block40: + v584 = arith.constant 0 : i32; + v585 = arith.constant 1 : i32; + v248 = arith.eq v166, v216 : i1; + v249 = hir.cast v248 : i32; + v251 = arith.neq v249, v585 : i1; + v252 = arith.zext v251 : u32; + v253 = hir.bitcast v252 : i32; + v255 = arith.neq v253, v584 : i1; + scf.if v255{ + ^block42: scf.yield ; } else { ^block19: - v165 = arith.constant 12 : u32; - v164 = hir.bitcast v87 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v371 = arith.constant 4 : u32; - v168 = arith.mod v166, v371 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : felt; - v172 = arith.constant 8 : u32; - v171 = hir.bitcast v87 : u32; - v173 = arith.add v171, v172 : u32 #[overflow = checked]; - v370 = arith.constant 4 : u32; - v175 = arith.mod v173, v370 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : felt; - v178 = arith.constant 16 : i32; - v179 = arith.add v87, v178 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v179, v80) - v181 = arith.constant 28 : u32; - v180 = hir.bitcast v87 : u32; - v182 = arith.add v180, v181 : u32 #[overflow = checked]; - v369 = arith.constant 4 : u32; - v184 = arith.mod v182, v369 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - v186 = hir.load v185 : felt; - v188 = arith.constant 24 : u32; - v187 = hir.bitcast v87 : u32; - v189 = arith.add v187, v188 : u32 #[overflow = checked]; - v368 = arith.constant 4 : u32; - v191 = arith.mod v189, v368 : u32; - hir.assertz v191 #[code = 250]; - v192 = hir.int_to_ptr v189 : ptr; - v193 = hir.load v192 : felt; - v195 = arith.constant 20 : u32; - v194 = hir.bitcast v87 : u32; - v196 = arith.add v194, v195 : u32 #[overflow = checked]; - v367 = arith.constant 4 : u32; - v198 = arith.mod v196, v367 : u32; - hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - v200 = hir.load v199 : felt; - v202 = arith.constant 16 : u32; - v201 = hir.bitcast v87 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v366 = arith.constant 4 : u32; - v205 = arith.mod v203, v366 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - v207 = hir.load v206 : felt; - v365 = arith.constant 32 : i32; - v209 = arith.add v87, v365 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::native_account::set_map_item(v170, v177, v79, v78, v77, v76, v186, v193, v200, v207, v209) + v257 = arith.constant 28 : u32; + v256 = hir.bitcast v179 : u32; + v258 = arith.add v256, v257 : u32 #[overflow = checked]; + v583 = arith.constant 4 : u32; + v260 = arith.mod v258, v583 : u32; + hir.assertz v260 #[code = 250]; + v261 = hir.int_to_ptr v258 : ptr; + hir.store v261, v170; + v263 = arith.constant 24 : u32; + v262 = hir.bitcast v179 : u32; + v264 = arith.add v262, v263 : u32 #[overflow = checked]; + v582 = arith.constant 4 : u32; + v266 = arith.mod v264, v582 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + hir.store v267, v169; + v269 = arith.constant 20 : u32; + v268 = hir.bitcast v179 : u32; + v270 = arith.add v268, v269 : u32 #[overflow = checked]; + v581 = arith.constant 4 : u32; + v272 = arith.mod v270, v581 : u32; + hir.assertz v272 #[code = 250]; + v273 = hir.int_to_ptr v270 : ptr; + hir.store v273, v168; + v275 = arith.constant 16 : u32; + v274 = hir.bitcast v179 : u32; + v276 = arith.add v274, v275 : u32 #[overflow = checked]; + v580 = arith.constant 4 : u32; + v278 = arith.mod v276, v580 : u32; + hir.assertz v278 #[code = 250]; + v279 = hir.int_to_ptr v276 : ptr; + hir.store v279, v167; + v281 = arith.constant 8 : u32; + v280 = hir.bitcast v179 : u32; + v282 = arith.add v280, v281 : u32 #[overflow = checked]; + v579 = arith.constant 4 : u32; + v284 = arith.mod v282, v579 : u32; + hir.assertz v284 #[code = 250]; + v285 = hir.int_to_ptr v282 : ptr; + v286 = hir.load v285 : felt; + v288 = arith.constant 12 : u32; + v287 = hir.bitcast v179 : u32; + v289 = arith.add v287, v288 : u32 #[overflow = checked]; + v578 = arith.constant 4 : u32; + v291 = arith.mod v289, v578 : u32; + hir.assertz v291 #[code = 250]; + v292 = hir.int_to_ptr v289 : ptr; + v293 = hir.load v292 : felt; + v296 = arith.constant 44 : u32; + v295 = hir.bitcast v179 : u32; + v297 = arith.add v295, v296 : u32 #[overflow = checked]; + v577 = arith.constant 4 : u32; + v299 = arith.mod v297, v577 : u32; + hir.assertz v299 #[code = 250]; + v576 = arith.constant 0 : i32; + v300 = hir.int_to_ptr v297 : ptr; + hir.store v300, v576; + v303 = arith.constant 36 : u32; + v302 = hir.bitcast v179 : u32; + v304 = arith.add v302, v303 : u32 #[overflow = checked]; + v575 = arith.constant 4 : u32; + v306 = arith.mod v304, v575 : u32; + hir.assertz v306 #[code = 250]; + v301 = arith.constant 0 : i64; + v307 = hir.int_to_ptr v304 : ptr; + hir.store v307, v301; + v309 = arith.constant 32 : u32; + v308 = hir.bitcast v179 : u32; + v310 = arith.add v308, v309 : u32 #[overflow = checked]; + v574 = arith.constant 4 : u32; + v312 = arith.mod v310, v574 : u32; + hir.assertz v312 #[code = 250]; + v313 = hir.int_to_ptr v310 : ptr; + hir.store v313, v171; + v317 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v318 = hir.bitcast v317 : ptr; + v319 = hir.load v318 : i32; + v320 = arith.constant 1048596 : i32; + v321 = arith.add v319, v320 : i32 #[overflow = wrapping]; + v316 = arith.constant 3 : i32; + v314 = arith.constant 16 : i32; + v315 = arith.add v179, v314 : i32 #[overflow = wrapping]; + v322 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v315, v316, v321) : i32 + v323 = hir.bitcast v322 : u32; + v573 = arith.constant 4 : u32; + v325 = arith.mod v323, v573 : u32; + hir.assertz v325 #[code = 250]; + v326 = hir.int_to_ptr v323 : ptr; + v327 = hir.load v326 : felt; + v330 = arith.constant 2 : i32; + v572 = arith.constant 16 : i32; + v329 = arith.add v179, v572 : i32 #[overflow = wrapping]; + v331 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v329, v330, v321) : i32 + v332 = hir.bitcast v331 : u32; + v571 = arith.constant 4 : u32; + v334 = arith.mod v332, v571 : u32; + hir.assertz v334 #[code = 250]; + v335 = hir.int_to_ptr v332 : ptr; + v336 = hir.load v335 : felt; + v569 = arith.constant 1 : i32; + v570 = arith.constant 16 : i32; + v338 = arith.add v179, v570 : i32 #[overflow = wrapping]; + v340 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v338, v569, v321) : i32 + v341 = hir.bitcast v340 : u32; + v568 = arith.constant 4 : u32; + v343 = arith.mod v341, v568 : u32; + hir.assertz v343 #[code = 250]; + v344 = hir.int_to_ptr v341 : ptr; + v345 = hir.load v344 : felt; + v566 = arith.constant 0 : i32; + v567 = arith.constant 16 : i32; + v347 = arith.add v179, v567 : i32 #[overflow = wrapping]; + v349 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v347, v566, v321) : i32 + v350 = hir.bitcast v349 : u32; + v565 = arith.constant 4 : u32; + v352 = arith.mod v350, v565 : u32; + hir.assertz v352 #[code = 250]; + v353 = hir.int_to_ptr v350 : ptr; + v354 = hir.load v353 : felt; + v564 = arith.constant 3 : i32; + v355 = arith.constant 32 : i32; + v356 = arith.add v179, v355 : i32 #[overflow = wrapping]; + v358 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v356, v564, v321) : i32 + v359 = hir.bitcast v358 : u32; + v563 = arith.constant 4 : u32; + v361 = arith.mod v359, v563 : u32; + hir.assertz v361 #[code = 250]; + v362 = hir.int_to_ptr v359 : ptr; + v363 = hir.load v362 : felt; + v561 = arith.constant 2 : i32; + v562 = arith.constant 32 : i32; + v365 = arith.add v179, v562 : i32 #[overflow = wrapping]; + v367 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v365, v561, v321) : i32 + v368 = hir.bitcast v367 : u32; + v560 = arith.constant 4 : u32; + v370 = arith.mod v368, v560 : u32; + hir.assertz v370 #[code = 250]; + v371 = hir.int_to_ptr v368 : ptr; + v372 = hir.load v371 : felt; + v558 = arith.constant 1 : i32; + v559 = arith.constant 32 : i32; + v374 = arith.add v179, v559 : i32 #[overflow = wrapping]; + v376 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v374, v558, v321) : i32 + v377 = hir.bitcast v376 : u32; + v557 = arith.constant 4 : u32; + v379 = arith.mod v377, v557 : u32; + hir.assertz v379 #[code = 250]; + v380 = hir.int_to_ptr v377 : ptr; + v381 = hir.load v380 : felt; + v555 = arith.constant 0 : i32; + v556 = arith.constant 32 : i32; + v383 = arith.add v179, v556 : i32 #[overflow = wrapping]; + v385 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::index(v383, v555, v321) : i32 + v386 = hir.bitcast v385 : u32; + v554 = arith.constant 4 : u32; + v388 = arith.mod v386, v554 : u32; + hir.assertz v388 #[code = 250]; + v389 = hir.int_to_ptr v386 : ptr; + v390 = hir.load v389 : felt; + v553 = arith.constant 48 : i32; + v392 = arith.add v179, v553 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::protocol::native_account::set_map_item(v293, v286, v327, v336, v345, v354, v363, v372, v381, v390, v392) scf.yield ; }; scf.yield ; @@ -275,146 +490,127 @@ builtin.component miden:storage-example/foo@1.0.0 { }; scf.yield ; }; - v364 = arith.constant 48 : i32; - v212 = arith.add v87, v364 : i32 #[overflow = wrapping]; - v213 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v214 = hir.bitcast v213 : ptr; - hir.store v214, v212; + v552 = arith.constant 64 : i32; + v395 = arith.add v179, v552 : i32 #[overflow = wrapping]; + v396 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v397 = hir.bitcast v396 : ptr; + hir.store v397, v395; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block20: - v216 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr - v217 = hir.bitcast v216 : ptr; - v218 = hir.load v217 : i32; - v219 = arith.constant 1048584 : i32; - v220 = arith.add v218, v219 : i32 #[overflow = wrapping]; - v221 = hir.bitcast v220 : u32; - v222 = hir.int_to_ptr v221 : ptr; - v223 = hir.load v222 : u8; - v215 = arith.constant 0 : i32; - v224 = arith.zext v223 : u32; - v225 = hir.bitcast v224 : i32; - v227 = arith.neq v225, v215 : i1; - scf.if v227{ + v399 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v400 = hir.bitcast v399 : ptr; + v401 = hir.load v400 : i32; + v402 = arith.constant 1048612 : i32; + v403 = arith.add v401, v402 : i32 #[overflow = wrapping]; + v404 = hir.bitcast v403 : u32; + v405 = hir.int_to_ptr v404 : ptr; + v406 = hir.load v405 : u8; + v398 = arith.constant 0 : i32; + v407 = arith.zext v406 : u32; + v408 = hir.bitcast v407 : i32; + v410 = arith.neq v408, v398 : i1; + scf.if v410{ ^block22: scf.yield ; } else { ^block23: - v228 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr - v229 = hir.bitcast v228 : ptr; - v230 = hir.load v229 : i32; + v411 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v412 = hir.bitcast v411 : ptr; + v413 = hir.load v412 : i32; hir.exec @miden:storage-example/foo@1.0.0/storage_example/__wasm_call_ctors() - v385 = arith.constant 1 : u8; - v387 = arith.constant 1048584 : i32; - v232 = arith.add v230, v387 : i32 #[overflow = wrapping]; - v236 = hir.bitcast v232 : u32; - v237 = hir.int_to_ptr v236 : ptr; - hir.store v237, v385; + v597 = arith.constant 1 : u8; + v599 = arith.constant 1048612 : i32; + v415 = arith.add v413, v599 : i32 #[overflow = wrapping]; + v419 = hir.bitcast v415 : u32; + v420 = hir.int_to_ptr v419 : ptr; + hir.store v420, v597; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v238: i32, v239: felt) { - ^block24(v238: i32, v239: felt): - v248 = arith.constant 12 : u32; - v247 = hir.bitcast v238 : u32; - v249 = arith.add v247, v248 : u32 #[overflow = checked]; - v250 = arith.constant 4 : u32; - v251 = arith.mod v249, v250 : u32; - hir.assertz v251 #[code = 250]; - v252 = hir.int_to_ptr v249 : ptr; - hir.store v252, v239; - v254 = arith.constant 8 : u32; - v253 = hir.bitcast v238 : u32; - v255 = arith.add v253, v254 : u32 #[overflow = checked]; - v396 = arith.constant 4 : u32; - v257 = arith.mod v255, v396 : u32; - hir.assertz v257 #[code = 250]; - v390 = arith.constant 0 : felt; - v258 = hir.int_to_ptr v255 : ptr; - hir.store v258, v390; - v395 = arith.constant 4 : u32; - v259 = hir.bitcast v238 : u32; - v261 = arith.add v259, v395 : u32 #[overflow = checked]; - v394 = arith.constant 4 : u32; - v263 = arith.mod v261, v394 : u32; - hir.assertz v263 #[code = 250]; - v393 = arith.constant 0 : felt; - v264 = hir.int_to_ptr v261 : ptr; - hir.store v264, v393; - v265 = hir.bitcast v238 : u32; - v392 = arith.constant 4 : u32; - v267 = arith.mod v265, v392 : u32; - hir.assertz v267 #[code = 250]; - v391 = arith.constant 0 : felt; - v268 = hir.int_to_ptr v265 : ptr; - hir.store v268, v391; - builtin.ret ; + private builtin.function @>::index(v421: i32, v422: i32, v423: i32) -> i32 { + ^block24(v421: i32, v422: i32, v423: i32): + v431 = arith.constant 0 : i32; + v601 = arith.constant 3 : u32; + v426 = hir.bitcast v422 : u32; + v428 = arith.gt v426, v601 : i1; + v429 = arith.zext v428 : u32; + v430 = hir.bitcast v429 : i32; + v432 = arith.neq v430, v431 : i1; + cf.cond_br v432 ^block26, ^block27; + ^block26: + ub.unreachable ; + ^block27: + v600 = arith.constant 2 : u32; + v435 = arith.shl v422, v600 : i32; + v436 = arith.add v421, v435 : i32 #[overflow = wrapping]; + builtin.ret v436; }; - private builtin.function @miden::protocol::active_account::get_item(v269: felt, v270: felt, v271: i32) { - ^block26(v269: felt, v270: felt, v271: i32): - v272, v273, v274, v275 = hir.exec @miden/protocol/active_account/get_item(v269, v270) : felt, felt, felt, felt - v276 = hir.bitcast v271 : u32; - v277 = hir.int_to_ptr v276 : ptr; - hir.store v277, v272; - v278 = arith.constant 4 : u32; - v279 = arith.add v276, v278 : u32 #[overflow = checked]; - v280 = hir.int_to_ptr v279 : ptr; - hir.store v280, v273; - v281 = arith.constant 8 : u32; - v282 = arith.add v276, v281 : u32 #[overflow = checked]; - v283 = hir.int_to_ptr v282 : ptr; - hir.store v283, v274; - v284 = arith.constant 12 : u32; - v285 = arith.add v276, v284 : u32 #[overflow = checked]; - v286 = hir.int_to_ptr v285 : ptr; - hir.store v286, v275; + private builtin.function @miden::protocol::active_account::get_item(v437: felt, v438: felt, v439: i32) { + ^block28(v437: felt, v438: felt, v439: i32): + v440, v441, v442, v443 = hir.exec @miden/protocol/active_account/get_item(v437, v438) : felt, felt, felt, felt + v444 = hir.bitcast v439 : u32; + v445 = hir.int_to_ptr v444 : ptr; + hir.store v445, v440; + v446 = arith.constant 4 : u32; + v447 = arith.add v444, v446 : u32 #[overflow = checked]; + v448 = hir.int_to_ptr v447 : ptr; + hir.store v448, v441; + v449 = arith.constant 8 : u32; + v450 = arith.add v444, v449 : u32 #[overflow = checked]; + v451 = hir.int_to_ptr v450 : ptr; + hir.store v451, v442; + v452 = arith.constant 12 : u32; + v453 = arith.add v444, v452 : u32 #[overflow = checked]; + v454 = hir.int_to_ptr v453 : ptr; + hir.store v454, v443; builtin.ret ; }; - private builtin.function @miden::protocol::active_account::get_map_item(v287: felt, v288: felt, v289: felt, v290: felt, v291: felt, v292: felt, v293: i32) { - ^block31(v287: felt, v288: felt, v289: felt, v290: felt, v291: felt, v292: felt, v293: i32): - v294, v295, v296, v297 = hir.exec @miden/protocol/active_account/get_map_item(v287, v288, v289, v290, v291, v292) : felt, felt, felt, felt - v298 = hir.bitcast v293 : u32; - v299 = hir.int_to_ptr v298 : ptr; - hir.store v299, v294; - v300 = arith.constant 4 : u32; - v301 = arith.add v298, v300 : u32 #[overflow = checked]; - v302 = hir.int_to_ptr v301 : ptr; - hir.store v302, v295; - v303 = arith.constant 8 : u32; - v304 = arith.add v298, v303 : u32 #[overflow = checked]; - v305 = hir.int_to_ptr v304 : ptr; - hir.store v305, v296; - v306 = arith.constant 12 : u32; - v307 = arith.add v298, v306 : u32 #[overflow = checked]; - v308 = hir.int_to_ptr v307 : ptr; - hir.store v308, v297; + private builtin.function @miden::protocol::active_account::get_map_item(v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: felt, v461: i32) { + ^block33(v455: felt, v456: felt, v457: felt, v458: felt, v459: felt, v460: felt, v461: i32): + v462, v463, v464, v465 = hir.exec @miden/protocol/active_account/get_map_item(v455, v456, v457, v458, v459, v460) : felt, felt, felt, felt + v466 = hir.bitcast v461 : u32; + v467 = hir.int_to_ptr v466 : ptr; + hir.store v467, v462; + v468 = arith.constant 4 : u32; + v469 = arith.add v466, v468 : u32 #[overflow = checked]; + v470 = hir.int_to_ptr v469 : ptr; + hir.store v470, v463; + v471 = arith.constant 8 : u32; + v472 = arith.add v466, v471 : u32 #[overflow = checked]; + v473 = hir.int_to_ptr v472 : ptr; + hir.store v473, v464; + v474 = arith.constant 12 : u32; + v475 = arith.add v466, v474 : u32 #[overflow = checked]; + v476 = hir.int_to_ptr v475 : ptr; + hir.store v476, v465; builtin.ret ; }; - private builtin.function @miden::protocol::native_account::set_map_item(v309: felt, v310: felt, v311: felt, v312: felt, v313: felt, v314: felt, v315: felt, v316: felt, v317: felt, v318: felt, v319: i32) { - ^block33(v309: felt, v310: felt, v311: felt, v312: felt, v313: felt, v314: felt, v315: felt, v316: felt, v317: felt, v318: felt, v319: i32): - v320, v321, v322, v323 = hir.exec @miden/protocol/native_account/set_map_item(v309, v310, v311, v312, v313, v314, v315, v316, v317, v318) : felt, felt, felt, felt - v324 = hir.bitcast v319 : u32; - v325 = hir.int_to_ptr v324 : ptr; - hir.store v325, v320; - v326 = arith.constant 4 : u32; - v327 = arith.add v324, v326 : u32 #[overflow = checked]; - v328 = hir.int_to_ptr v327 : ptr; - hir.store v328, v321; - v329 = arith.constant 8 : u32; - v330 = arith.add v324, v329 : u32 #[overflow = checked]; - v331 = hir.int_to_ptr v330 : ptr; - hir.store v331, v322; - v332 = arith.constant 12 : u32; - v333 = arith.add v324, v332 : u32 #[overflow = checked]; - v334 = hir.int_to_ptr v333 : ptr; - hir.store v334, v323; + private builtin.function @miden::protocol::native_account::set_map_item(v477: felt, v478: felt, v479: felt, v480: felt, v481: felt, v482: felt, v483: felt, v484: felt, v485: felt, v486: felt, v487: i32) { + ^block35(v477: felt, v478: felt, v479: felt, v480: felt, v481: felt, v482: felt, v483: felt, v484: felt, v485: felt, v486: felt, v487: i32): + v488, v489, v490, v491 = hir.exec @miden/protocol/native_account/set_map_item(v477, v478, v479, v480, v481, v482, v483, v484, v485, v486) : felt, felt, felt, felt + v492 = hir.bitcast v487 : u32; + v493 = hir.int_to_ptr v492 : ptr; + hir.store v493, v488; + v494 = arith.constant 4 : u32; + v495 = arith.add v492, v494 : u32 #[overflow = checked]; + v496 = hir.int_to_ptr v495 : ptr; + hir.store v496, v489; + v497 = arith.constant 8 : u32; + v498 = arith.add v492, v497 : u32 #[overflow = checked]; + v499 = hir.int_to_ptr v498 : ptr; + hir.store v499, v490; + v500 = arith.constant 12 : u32; + v501 = arith.add v492, v500 : u32 #[overflow = checked]; + v502 = hir.int_to_ptr v501 : ptr; + hir.store v502, v491; builtin.ret ; }; @@ -426,18 +622,20 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; - public builtin.function @set-asset-qty(v335: felt, v336: felt, v337: felt, v338: felt, v339: felt, v340: felt, v341: felt, v342: felt, v343: felt) { - ^block36(v335: felt, v336: felt, v337: felt, v338: felt, v339: felt, v340: felt, v341: felt, v342: felt, v343: felt): - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v335, v336, v337, v338, v339, v340, v341, v342, v343) + public builtin.function @set-asset-qty(v503: felt, v504: felt, v505: felt, v506: felt, v507: felt, v508: felt, v509: felt, v510: felt, v511: felt) { + ^block38(v503: felt, v504: felt, v505: felt, v506: felt, v507: felt, v508: felt, v509: felt, v510: felt, v511: felt): + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v503, v504, v505, v506, v507, v508, v509, v510, v511) builtin.ret ; }; - public builtin.function @get-asset-qty(v344: felt, v345: felt, v346: felt, v347: felt) -> felt { - ^block38(v344: felt, v345: felt, v346: felt, v347: felt): - v348 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v344, v345, v346, v347) : felt - builtin.ret v348; + public builtin.function @get-asset-qty(v512: felt, v513: felt, v514: felt, v515: felt) -> felt { + ^block40(v512: felt, v513: felt, v514: felt, v515: felt): + v516 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v512, v513, v514, v515) : felt + builtin.ret v516; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/storage_example.masm b/tests/integration/expected/examples/storage_example.masm index 4ada6c165..3c4b65932 100644 --- a/tests/integration/expected/examples/storage_example.masm +++ b/tests/integration/expected/examples/storage_example.masm @@ -27,20 +27,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:storage-example/foo@1.0.0"::storage_example @@ -156,7 +156,7 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( felt, felt ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -164,9 +164,9 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.64 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -181,13 +181,26 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( exec.::"miden:storage-example/foo@1.0.0"::storage_example::wit_bindgen::rt::run_ctors_once trace.252 nop - dup.0 + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 trace.240 nop - exec.::"miden:storage-example/foo@1.0.0"::storage_example::::default + exec.::intrinsics::mem::store_felt trace.252 nop - push.12 + push.8 dup.1 add u32assert @@ -197,15 +210,17 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( u32mod u32assert assertz + movup.4 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_felt trace.252 nop - push.8 - dup.2 + push.4 + dup.1 add u32assert push.4 @@ -214,30 +229,49 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( u32mod u32assert assertz + movup.3 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_felt + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.3 + dup.2 u32wrapping_add - movup.4 - swap.5 - movdn.4 - swap.6 - swap.3 - swap.7 - swap.2 trace.240 nop - exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::active_account::get_map_item" + exec.::"miden:storage-example/foo@1.0.0"::storage_example::::default trace.252 nop - push.16 - dup.1 + push.28 + dup.2 add u32assert push.4 @@ -253,66 +287,82 @@ proc miden:storage-example/foo@1.0.0#get-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - movup.2 - u32wrapping_add - push.1114144 + push.24 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_felt trace.252 nop -end - -@callconv("C") -proc miden:storage-example/foo@1.0.0#set-asset-qty( - felt, - felt, - felt, - felt, - felt, - felt, - felt, - felt, - felt -) - push.1114144 - u32divmod.4 + push.1048596 + movup.3 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index trace.252 nop - push.48 - u32wrapping_sub - push.1114144 + push.4 dup.1 swap.1 + u32mod + u32assert + assertz u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_felt trace.252 nop + push.2 + dup.5 + dup.3 + swap.2 + swap.1 trace.240 nop - exec.::"miden:storage-example/foo@1.0.0"::storage_example::wit_bindgen::rt::run_ctors_once + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index trace.252 nop - dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 trace.240 nop - exec.::"miden:storage-example/foo@1.0.0"::storage_example::::default + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index trace.252 nop - push.4 - dup.1 - add - u32assert push.4 dup.1 swap.1 @@ -326,7 +376,16 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - dup.1 + push.0 + dup.7 + dup.5 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -340,20 +399,26 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.32 - dup.3 + push.48 + dup.8 u32wrapping_add - swap.2 + movup.2 + swap.4 + movdn.2 + swap.6 + swap.1 + swap.5 + swap.7 trace.240 nop - exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::active_account::get_item" + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::active_account::get_map_item" trace.252 nop - push.40 - dup.1 + push.48 + dup.2 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -363,31 +428,36 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop - push.36 - dup.2 + swap.1 + push.40 + dup.4 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod u32assert assertz + swap.2 + movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_dw trace.252 nop - push.32 - dup.3 + push.56 + dup.2 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -397,13 +467,40 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop - push.44 + swap.1 + push.32 dup.4 add u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.3 + push.32 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -417,65 +514,358 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.0 - push.1 - movup.7 - movup.3 - eq - neq - neq - if.true - drop - drop - drop - movdn.8 - dropw - dropw - else - push.0 - push.1 - movup.6 - movup.5 - eq - neq - neq - if.true - drop - drop - movdn.7 - dropw - drop - drop - drop - else - push.0 - push.1 - movup.5 - movup.4 - eq - neq - neq - if.true - drop - movdn.6 - dropw - drop - drop - else - push.0 - push.1 - movup.4 - movup.3 - eq - neq - neq - if.true + push.64 + movup.2 + u32wrapping_add + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden:storage-example/foo@1.0.0#set-asset-qty( + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt, + felt +) + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.64 + u32wrapping_sub + push.1114176 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::wit_bindgen::rt::run_ctors_once + trace.252 + nop + dup.0 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::::default + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.48 + dup.3 + u32wrapping_add + swap.2 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::active_account::get_item" + trace.252 + nop + push.56 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.52 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.48 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.60 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.1 + movup.7 + movup.3 + eq + neq + neq + if.true + drop + drop + drop + movdn.8 + dropw + dropw + else + push.0 + push.1 + movup.6 + movup.5 + eq + neq + neq + if.true + drop + drop + movdn.7 + dropw + drop + drop + drop + else + push.0 + push.1 + movup.5 + movup.4 + eq + neq + neq + if.true + drop + movdn.6 + dropw + drop + drop + else + push.0 + push.1 + movup.4 + movup.3 + eq + neq + neq + if.true movdn.5 dropw drop else + push.28 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.44 + dup.3 + add + u32assert + push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.36 + dup.3 add u32assert push.4 @@ -484,15 +874,20 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( u32mod u32assert assertz + push.0 + push.0 + movup.2 u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_dw trace.252 nop - push.8 - dup.2 + push.32 + dup.3 add u32assert push.4 @@ -501,27 +896,62 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( u32mod u32assert assertz + movup.4 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw trace.252 nop + push.1048596 + u32wrapping_add + push.3 push.16 - dup.3 + dup.5 u32wrapping_add - movup.8 + dup.2 + swap.2 swap.1 trace.240 nop - exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::from + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index trace.252 nop - push.28 - dup.3 - add + push.4 + dup.1 + swap.1 + u32mod u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + push.16 + dup.6 + u32wrapping_add + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -535,10 +965,18 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.24 + push.1 + push.16 + dup.7 + u32wrapping_add dup.4 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -552,10 +990,18 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.20 + push.0 + push.16 + dup.8 + u32wrapping_add dup.5 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -569,10 +1015,18 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop - push.16 + push.3 + push.32 + dup.9 + u32wrapping_add dup.6 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -586,20 +1040,96 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( exec.::intrinsics::mem::load_felt trace.252 nop + push.2 push.32 + dup.10 + u32wrapping_add dup.7 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + push.32 + dup.11 u32wrapping_add - swap.10 - swap.3 - swap.7 - swap.11 + dup.8 swap.2 - swap.8 - swap.5 swap.1 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + push.32 + dup.12 + u32wrapping_add + movup.2 swap.9 - swap.4 + movdn.2 + trace.240 + nop + exec.::"miden:storage-example/foo@1.0.0"::storage_example::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.48 + dup.11 + u32wrapping_add + movup.4 + swap.5 + movdn.4 + movup.3 swap.6 + movdn.3 + movup.2 + swap.7 + movdn.2 + swap.10 + swap.1 + swap.9 trace.240 nop exec.::"miden:storage-example/foo@1.0.0"::storage_example::"miden::protocol::native_account::set_map_item" @@ -609,9 +1139,9 @@ proc miden:storage-example/foo@1.0.0#set-asset-qty( end end end - push.48 + push.64 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -625,7 +1155,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -633,7 +1163,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -654,7 +1184,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -668,7 +1198,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -696,82 +1226,31 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( +proc >::index( i32, - felt -) - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + i32, + i32 +) -> i32 movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + drop push.0 + push.3 + dup.3 swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end end @callconv("C") diff --git a/tests/integration/expected/examples/storage_example.wat b/tests/integration/expected/examples/storage_example.wat index 1d221f742..6f1d4a2ac 100644 --- a/tests/integration/expected/examples/storage_example.wat +++ b/tests/integration/expected/examples/storage_example.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -16,13 +15,12 @@ (type (;1;) (func (param i32))) (type (;2;) (func (param f32 f32 f32 f32) (result f32))) (type (;3;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32))) - (type (;4;) (func (param i32 f32))) - (type (;5;) (func (param f32 f32) (result i32))) - (type (;6;) (func (param i32) (result f32))) - (type (;7;) (func (param i64) (result f32))) - (type (;8;) (func (param f32 f32 i32))) - (type (;9;) (func (param f32 f32 f32 f32 f32 f32 i32))) - (type (;10;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;4;) (func (param f32 f32) (result i32))) + (type (;5;) (func (param i64) (result f32))) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (param f32 f32 i32))) + (type (;8;) (func (param f32 f32 f32 f32 f32 f32 i32))) + (type (;9;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -59,40 +57,92 @@ f32.store ) (func $miden:storage-example/foo@1.0.0#get-asset-qty (;3;) (type 2) (param f32 f32 f32 f32) (result f32) - (local i32) + (local i32 i32) global.get $__stack_pointer - i32.const 32 + i32.const 64 i32.sub local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 4 - call $::default - local.get 4 - f32.load offset=12 - local.get 4 - f32.load offset=8 local.get 3 + f32.store offset=12 + local.get 4 local.get 2 + f32.store offset=8 + local.get 4 local.get 1 + f32.store offset=4 + local.get 4 local.get 0 + f32.store + global.get $GOT.data.internal.__memory_base + local.set 5 local.get 4 i32.const 16 i32.add + call $::default + local.get 4 + f32.load offset=28 + local.get 4 + f32.load offset=24 + local.get 4 + i32.const 3 + local.get 5 + i32.const 1048596 + i32.add + local.tee 5 + call $>::index + f32.load + local.get 4 + i32.const 2 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 1 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 0 + local.get 5 + call $>::index + f32.load + local.get 4 + i32.const 48 + i32.add call $miden::protocol::active_account::get_map_item local.get 4 - f32.load offset=16 - local.set 0 + local.get 4 + i64.load offset=48 + i64.const 32 + i64.rotl + i64.store offset=40 + local.get 4 + local.get 4 + i64.load offset=56 + i64.const 32 + i64.rotl + i64.store offset=32 local.get 4 i32.const 32 i32.add + i32.const 3 + local.get 5 + call $>::index + f32.load + local.set 3 + local.get 4 + i32.const 64 + i32.add global.set $__stack_pointer - local.get 0 + local.get 3 ) (func $miden:storage-example/foo@1.0.0#set-asset-qty (;4;) (type 3) (param f32 f32 f32 f32 f32 f32 f32 f32 f32) - (local i32 f32 f32 f32) + (local i32 f32 f32 f32 i32) global.get $__stack_pointer - i32.const 48 + i32.const 64 i32.sub local.tee 9 global.set $__stack_pointer @@ -104,22 +154,22 @@ local.get 9 f32.load local.get 9 - i32.const 32 + i32.const 48 i32.add call $miden::protocol::active_account::get_item local.get 9 - f32.load offset=40 + f32.load offset=56 local.set 10 local.get 9 - f32.load offset=36 + f32.load offset=52 local.set 11 local.get 9 - f32.load offset=32 + f32.load offset=48 local.set 12 block ;; label = @1 local.get 0 local.get 9 - f32.load offset=44 + f32.load offset=60 call $intrinsics::felt::eq i32.const 1 i32.ne @@ -143,37 +193,100 @@ i32.ne br_if 0 (;@1;) local.get 9 - f32.load offset=12 - local.set 0 + local.get 7 + f32.store offset=28 + local.get 9 + local.get 6 + f32.store offset=24 + local.get 9 + local.get 5 + f32.store offset=20 + local.get 9 + local.get 4 + f32.store offset=16 local.get 9 f32.load offset=8 + local.set 0 + local.get 9 + f32.load offset=12 local.set 1 local.get 9 - i32.const 16 - i32.add + i32.const 0 + i32.store offset=44 + local.get 9 + i64.const 0 + i64.store offset=36 align=4 + local.get 9 local.get 8 - call $>::from - local.get 0 + f32.store offset=32 local.get 1 - local.get 7 - local.get 6 - local.get 5 - local.get 4 + local.get 0 + local.get 9 + i32.const 16 + i32.add + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 13 + call $>::index + f32.load + local.get 9 + i32.const 16 + i32.add + i32.const 2 + local.get 13 + call $>::index + f32.load local.get 9 - f32.load offset=28 + i32.const 16 + i32.add + i32.const 1 + local.get 13 + call $>::index + f32.load local.get 9 - f32.load offset=24 + i32.const 16 + i32.add + i32.const 0 + local.get 13 + call $>::index + f32.load + local.get 9 + i32.const 32 + i32.add + i32.const 3 + local.get 13 + call $>::index + f32.load local.get 9 - f32.load offset=20 + i32.const 32 + i32.add + i32.const 2 + local.get 13 + call $>::index + f32.load local.get 9 - f32.load offset=16 + i32.const 32 + i32.add + i32.const 1 + local.get 13 + call $>::index + f32.load local.get 9 i32.const 32 i32.add + i32.const 0 + local.get 13 + call $>::index + f32.load + local.get 9 + i32.const 48 + i32.add call $miden::protocol::native_account::set_map_item end local.get 9 - i32.const 48 + i32.const 64 i32.add global.set $__stack_pointer ) @@ -181,7 +294,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -189,55 +302,44 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;6;) (type 4) (param i32 f32) - (local f32 f32 f32) - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 2 - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 3 - i32.const 0 - call $intrinsics::felt::from_u32 - local.set 4 - local.get 0 - local.get 1 - f32.store offset=12 - local.get 0 - local.get 4 - f32.store offset=8 - local.get 0 - local.get 3 - f32.store offset=4 - local.get 0 - local.get 2 - f32.store - ) - (func $intrinsics::felt::eq (;7;) (type 5) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;6;) (type 4) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;8;) (type 6) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;7;) (type 5) (param i64) (result f32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;9;) (type 7) (param i64) (result f32) + (func $>::index (;8;) (type 6) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end unreachable ) - (func $miden::protocol::active_account::get_item (;10;) (type 8) (param f32 f32 i32) + (func $miden::protocol::active_account::get_item (;9;) (type 7) (param f32 f32 i32) unreachable ) - (func $miden::protocol::active_account::get_map_item (;11;) (type 9) (param f32 f32 f32 f32 f32 f32 i32) + (func $miden::protocol::active_account::get_map_item (;10;) (type 8) (param f32 f32 f32 f32 f32 f32 i32) unreachable ) - (func $miden::protocol::native_account::set_map_item (;12;) (type 10) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::set_map_item (;11;) (type 9) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "\1fstorage-example_A simple example of a Miden account storage API\0b0.1.0\03\01\02\006miden::component::miden_storage_example::asset_qty_map\01\01%asset quantity map\00\00\09word\00\00\09word\009miden::component::miden_storage_example::owner_public_key\00\01!owner public key\00\09word\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) @@ -257,25 +359,24 @@ (component $miden:storage-example/foo@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-word0" (type (;7;) (eq 4))) - (import "import-type-asset0" (type (;8;) (eq 6))) - (import "import-type-felt0" (type (;9;) (eq 1))) - (type (;10;) (func (param "pub-key" 7) (param "asset" 8) (param "qty" 9))) - (import "import-func-set-asset-qty" (func (;0;) (type 10))) - (type (;11;) (func (param "asset" 8) (result 9))) - (import "import-func-get-asset-qty" (func (;1;) (type 11))) - (export (;12;) "felt" (type 1)) - (export (;13;) "word" (type 4)) - (export (;14;) "asset" (type 6)) - (type (;15;) (func (param "pub-key" 13) (param "asset" 14) (param "qty" 12))) - (export (;2;) "set-asset-qty" (func 0) (func (type 15))) - (type (;16;) (func (param "asset" 14) (result 12))) - (export (;3;) "get-asset-qty" (func 1) (func (type 16))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-word0" (type (;6;) (eq 3))) + (import "import-type-asset0" (type (;7;) (eq 5))) + (import "import-type-felt0" (type (;8;) (eq 1))) + (type (;9;) (func (param "pub-key" 6) (param "asset" 7) (param "qty" 8))) + (import "import-func-set-asset-qty" (func (;0;) (type 9))) + (type (;10;) (func (param "asset" 7) (result 8))) + (import "import-func-get-asset-qty" (func (;1;) (type 10))) + (export (;11;) "felt" (type 1)) + (export (;12;) "word" (type 3)) + (export (;13;) "asset" (type 5)) + (type (;14;) (func (param "pub-key" 12) (param "asset" 13) (param "qty" 11))) + (export (;2;) "set-asset-qty" (func 0) (func (type 14))) + (type (;15;) (func (param "asset" 13) (result 11))) + (export (;3;) "get-asset-qty" (func 1) (func (type 15))) ) (instance $miden:storage-example/foo@1.0.0-shim-instance (;1;) (instantiate $miden:storage-example/foo@1.0.0-shim-component (with "import-func-set-asset-qty" (func $set-asset-qty)) diff --git a/tests/integration/expected/hash_elements.hir b/tests/integration/expected/hash_elements.hir index 66a393c29..f9279358a 100644 --- a/tests/integration/expected/hash_elements.hir +++ b/tests/integration/expected/hash_elements.hir @@ -10,7 +10,7 @@ builtin.component root_ns:root@1.0.0 { v7 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr v8 = hir.bitcast v7 : ptr; v9 = hir.load v8 : i32; - v10 = arith.constant 16 : i32; + v10 = arith.constant 32 : i32; v11 = arith.sub v9, v10 : i32 #[overflow = wrapping]; v12 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr v13 = hir.bitcast v12 : ptr; @@ -23,247 +23,309 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v18 #[code = 250]; v19 = hir.int_to_ptr v16 : ptr; v20 = hir.load v19 : i32; - v214 = arith.constant 4 : u32; + v280 = arith.constant 4 : u32; v21 = hir.bitcast v3 : u32; - v23 = arith.add v21, v214 : u32 #[overflow = checked]; - v213 = arith.constant 4 : u32; - v25 = arith.mod v23, v213 : u32; + v23 = arith.add v21, v280 : u32 #[overflow = checked]; + v279 = arith.constant 4 : u32; + v25 = arith.mod v23, v279 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v204 = arith.constant 2 : u32; + v263 = arith.constant 2 : u32; v29 = hir.bitcast v27 : u32; - v31 = arith.shr v29, v204 : u32; + v31 = arith.shr v29, v263 : u32; v32 = hir.bitcast v31 : i32; - v203 = arith.constant 0 : felt; + v39 = arith.constant 0 : i64; + v40 = arith.trunc v39 : felt; v33 = arith.constant 3 : i32; v34 = arith.band v32, v33 : i32; - v35 = hir.bitcast v34 : felt; - hir.assert_eq v35, v203; - v211 = arith.constant 0 : i32; + v35 = hir.bitcast v34 : u32; + v36 = arith.zext v35 : u64; + v37 = hir.bitcast v36 : i64; + v38 = arith.trunc v37 : felt; + hir.assert_eq v38, v40; + v277 = arith.constant 0 : i32; v5 = arith.constant 0 : i32; - v212 = arith.constant 3 : i32; - v39 = arith.band v20, v212 : i32; - v41 = arith.eq v39, v5 : i1; - v42 = arith.zext v41 : u32; - v43 = hir.bitcast v42 : i32; - v45 = arith.neq v43, v211 : i1; - scf.if v45{ + v278 = arith.constant 3 : i32; + v42 = arith.band v20, v278 : i32; + v44 = arith.eq v42, v5 : i1; + v45 = arith.zext v44 : u32; + v46 = hir.bitcast v45 : i32; + v48 = arith.neq v46, v277 : i1; + scf.if v48{ ^block9: - v46 = arith.add v32, v20 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/miden::core::crypto::hashes::rpo256::hash_words(v32, v46, v11) + v52 = arith.constant 16 : i32; + v53 = arith.add v11, v52 : i32 #[overflow = wrapping]; + v51 = arith.add v32, v20 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/miden::core::crypto::hashes::rpo256::hash_words(v32, v51, v53) scf.yield ; } else { ^block10: - hir.exec @root_ns:root@1.0.0/hash_elements/miden::core::crypto::hashes::rpo256::hash_elements(v32, v20, v11) + v276 = arith.constant 16 : i32; + v50 = arith.add v11, v276 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/miden::core::crypto::hashes::rpo256::hash_elements(v32, v20, v50) scf.yield ; }; - v49 = arith.constant 12 : u32; - v48 = hir.bitcast v11 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v210 = arith.constant 4 : u32; - v52 = arith.mod v50, v210 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : felt; - v56 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v3, v56, v56) - v209 = arith.constant 16 : i32; - v59 = arith.add v11, v209 : i32 #[overflow = wrapping]; - v60 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v61 = hir.bitcast v60 : ptr; - hir.store v61, v59; - builtin.ret v54; + v56 = arith.constant 16 : u32; + v55 = hir.bitcast v11 : u32; + v57 = arith.add v55, v56 : u32 #[overflow = checked]; + v275 = arith.constant 8 : u32; + v59 = arith.mod v57, v275 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i64; + v260, v261 = arith.split v61 : felt, felt; + v274 = arith.constant 8 : u32; + v65 = hir.bitcast v11 : u32; + v67 = arith.add v65, v274 : u32 #[overflow = checked]; + v273 = arith.constant 8 : u32; + v69 = arith.mod v67, v273 : u32; + hir.assertz v69 #[code = 250]; + v262 = arith.join v261, v260 : i64; + v70 = hir.int_to_ptr v67 : ptr; + hir.store v70, v262; + v72 = arith.constant 24 : u32; + v71 = hir.bitcast v11 : u32; + v73 = arith.add v71, v72 : u32 #[overflow = checked]; + v272 = arith.constant 8 : u32; + v75 = arith.mod v73, v272 : u32; + hir.assertz v75 #[code = 250]; + v76 = hir.int_to_ptr v73 : ptr; + v77 = hir.load v76 : i64; + v257, v258 = arith.split v77 : felt, felt; + v81 = hir.bitcast v11 : u32; + v271 = arith.constant 8 : u32; + v83 = arith.mod v81, v271 : u32; + hir.assertz v83 #[code = 250]; + v259 = arith.join v258, v257 : i64; + v84 = hir.int_to_ptr v81 : ptr; + hir.store v84, v259; + v86 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v3, v86, v86) + v89 = arith.constant 1048588 : i32; + v270 = arith.constant 0 : i32; + v90 = hir.exec @root_ns:root@1.0.0/hash_elements/>::index(v11, v270, v89) : i32 + v91 = hir.bitcast v90 : u32; + v269 = arith.constant 4 : u32; + v93 = arith.mod v91, v269 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + v95 = hir.load v94 : felt; + v268 = arith.constant 32 : i32; + v97 = arith.add v11, v268 : i32 #[overflow = wrapping]; + v98 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v99 = hir.bitcast v98 : ptr; + hir.store v99, v97; + builtin.ret v95; }; - private builtin.function @miden::core::crypto::hashes::rpo256::hash_elements(v62: i32, v63: i32, v64: i32) { - ^block11(v62: i32, v63: i32, v64: i32): - v65, v66, v67, v68 = hir.exec @miden/core/crypto/hashes/rpo256/hash_elements(v62, v63) : felt, felt, felt, felt - v69 = hir.bitcast v64 : u32; - v70 = hir.int_to_ptr v69 : ptr; - hir.store v70, v65; - v71 = arith.constant 4 : u32; - v72 = arith.add v69, v71 : u32 #[overflow = checked]; - v73 = hir.int_to_ptr v72 : ptr; - hir.store v73, v66; - v74 = arith.constant 8 : u32; - v75 = arith.add v69, v74 : u32 #[overflow = checked]; - v76 = hir.int_to_ptr v75 : ptr; - hir.store v76, v67; - v77 = arith.constant 12 : u32; - v78 = arith.add v69, v77 : u32 #[overflow = checked]; - v79 = hir.int_to_ptr v78 : ptr; - hir.store v79, v68; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_elements(v100: i32, v101: i32, v102: i32) { + ^block11(v100: i32, v101: i32, v102: i32): + v103, v104, v105, v106 = hir.exec @miden/core/crypto/hashes/rpo256/hash_elements(v100, v101) : felt, felt, felt, felt + v107 = hir.bitcast v102 : u32; + v108 = hir.int_to_ptr v107 : ptr; + hir.store v108, v103; + v109 = arith.constant 4 : u32; + v110 = arith.add v107, v109 : u32 #[overflow = checked]; + v111 = hir.int_to_ptr v110 : ptr; + hir.store v111, v104; + v112 = arith.constant 8 : u32; + v113 = arith.add v107, v112 : u32 #[overflow = checked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v105; + v115 = arith.constant 12 : u32; + v116 = arith.add v107, v115 : u32 #[overflow = checked]; + v117 = hir.int_to_ptr v116 : ptr; + hir.store v117, v106; builtin.ret ; }; - private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v80: i32, v81: i32, v82: i32) { - ^block18(v80: i32, v81: i32, v82: i32): - v83, v84, v85, v86 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v80, v81) : felt, felt, felt, felt - v87 = hir.bitcast v82 : u32; - v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v83; - v89 = arith.constant 4 : u32; - v90 = arith.add v87, v89 : u32 #[overflow = checked]; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v84; - v92 = arith.constant 8 : u32; - v93 = arith.add v87, v92 : u32 #[overflow = checked]; - v94 = hir.int_to_ptr v93 : ptr; - hir.store v94, v85; - v95 = arith.constant 12 : u32; - v96 = arith.add v87, v95 : u32 #[overflow = checked]; - v97 = hir.int_to_ptr v96 : ptr; - hir.store v97, v86; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v118: i32, v119: i32, v120: i32) { + ^block18(v118: i32, v119: i32, v120: i32): + v121, v122, v123, v124 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v118, v119) : felt, felt, felt, felt + v125 = hir.bitcast v120 : u32; + v126 = hir.int_to_ptr v125 : ptr; + hir.store v126, v121; + v127 = arith.constant 4 : u32; + v128 = arith.add v125, v127 : u32 #[overflow = checked]; + v129 = hir.int_to_ptr v128 : ptr; + hir.store v129, v122; + v130 = arith.constant 8 : u32; + v131 = arith.add v125, v130 : u32 #[overflow = checked]; + v132 = hir.int_to_ptr v131 : ptr; + hir.store v132, v123; + v133 = arith.constant 12 : u32; + v134 = arith.add v125, v133 : u32 #[overflow = checked]; + v135 = hir.int_to_ptr v134 : ptr; + hir.store v135, v124; builtin.ret ; }; - private builtin.function @::deallocate(v98: i32, v99: i32, v100: i32) { - ^block20(v98: i32, v99: i32, v100: i32): - v102 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v103 = hir.bitcast v102 : ptr; - v104 = hir.load v103 : i32; - v105 = arith.constant 16 : i32; - v106 = arith.sub v104, v105 : i32 #[overflow = wrapping]; - v107 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v108 = hir.bitcast v107 : ptr; - hir.store v108, v106; - v109 = arith.constant 4 : i32; - v110 = arith.add v106, v109 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/::current_memory(v110, v98, v99, v100) - v112 = arith.constant 8 : u32; - v111 = hir.bitcast v106 : u32; - v113 = arith.add v111, v112 : u32 #[overflow = checked]; - v114 = arith.constant 4 : u32; - v115 = arith.mod v113, v114 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - v117 = hir.load v116 : i32; - v221 = arith.constant 0 : i32; - v101 = arith.constant 0 : i32; - v119 = arith.eq v117, v101 : i1; - v120 = arith.zext v119 : u32; - v121 = hir.bitcast v120 : i32; - v123 = arith.neq v121, v221 : i1; - scf.if v123{ - ^block34: + private builtin.function @>::index(v136: i32, v137: i32, v138: i32) -> i32 { + ^block20(v136: i32, v137: i32, v138: i32): + v146 = arith.constant 0 : i32; + v282 = arith.constant 3 : u32; + v141 = hir.bitcast v137 : u32; + v143 = arith.gt v141, v282 : i1; + v144 = arith.zext v143 : u32; + v145 = hir.bitcast v144 : i32; + v147 = arith.neq v145, v146 : i1; + cf.cond_br v147 ^block22, ^block23; + ^block22: + ub.unreachable ; + ^block23: + v281 = arith.constant 2 : u32; + v150 = arith.shl v137, v281 : i32; + v151 = arith.add v136, v150 : i32 #[overflow = wrapping]; + builtin.ret v151; + }; + + private builtin.function @::deallocate(v152: i32, v153: i32, v154: i32) { + ^block24(v152: i32, v153: i32, v154: i32): + v156 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v157 = hir.bitcast v156 : ptr; + v158 = hir.load v157 : i32; + v159 = arith.constant 16 : i32; + v160 = arith.sub v158, v159 : i32 #[overflow = wrapping]; + v161 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v162 = hir.bitcast v161 : ptr; + hir.store v162, v160; + v163 = arith.constant 4 : i32; + v164 = arith.add v160, v163 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/::current_memory(v164, v152, v153, v154) + v166 = arith.constant 8 : u32; + v165 = hir.bitcast v160 : u32; + v167 = arith.add v165, v166 : u32 #[overflow = checked]; + v168 = arith.constant 4 : u32; + v169 = arith.mod v167, v168 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + v171 = hir.load v170 : i32; + v291 = arith.constant 0 : i32; + v155 = arith.constant 0 : i32; + v173 = arith.eq v171, v155 : i1; + v174 = arith.zext v173 : u32; + v175 = hir.bitcast v174 : i32; + v177 = arith.neq v175, v291 : i1; + scf.if v177{ + ^block40: scf.yield ; } else { - ^block23: - v220 = arith.constant 4 : u32; - v124 = hir.bitcast v106 : u32; - v126 = arith.add v124, v220 : u32 #[overflow = checked]; - v219 = arith.constant 4 : u32; - v128 = arith.mod v126, v219 : u32; - hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; - v130 = hir.load v129 : i32; - v132 = arith.constant 12 : u32; - v131 = hir.bitcast v106 : u32; - v133 = arith.add v131, v132 : u32 #[overflow = checked]; - v218 = arith.constant 4 : u32; - v135 = arith.mod v133, v218 : u32; - hir.assertz v135 #[code = 250]; - v136 = hir.int_to_ptr v133 : ptr; - v137 = hir.load v136 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v130, v117, v137) + ^block27: + v290 = arith.constant 4 : u32; + v178 = hir.bitcast v160 : u32; + v180 = arith.add v178, v290 : u32 #[overflow = checked]; + v289 = arith.constant 4 : u32; + v182 = arith.mod v180, v289 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + v184 = hir.load v183 : i32; + v186 = arith.constant 12 : u32; + v185 = hir.bitcast v160 : u32; + v187 = arith.add v185, v186 : u32 #[overflow = checked]; + v288 = arith.constant 4 : u32; + v189 = arith.mod v187, v288 : u32; + hir.assertz v189 #[code = 250]; + v190 = hir.int_to_ptr v187 : ptr; + v191 = hir.load v190 : i32; + hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v184, v171, v191) scf.yield ; }; - v217 = arith.constant 16 : i32; - v140 = arith.add v106, v217 : i32 #[overflow = wrapping]; - v141 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v142 = hir.bitcast v141 : ptr; - hir.store v142, v140; + v287 = arith.constant 16 : i32; + v194 = arith.add v160, v287 : i32 #[overflow = wrapping]; + v195 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v196 = hir.bitcast v195 : ptr; + hir.store v196, v194; builtin.ret ; }; - private builtin.function @::current_memory(v143: i32, v144: i32, v145: i32, v146: i32) { - ^block24(v143: i32, v144: i32, v145: i32, v146: i32): - v247 = arith.constant 0 : i32; - v147 = arith.constant 0 : i32; - v151 = arith.eq v146, v147 : i1; - v152 = arith.zext v151 : u32; - v153 = hir.bitcast v152 : i32; - v155 = arith.neq v153, v247 : i1; - v234, v235 = scf.if v155 : i32, i32 { - ^block37: - v246 = arith.constant 0 : i32; - v149 = arith.constant 4 : i32; - scf.yield v149, v246; + private builtin.function @::current_memory(v197: i32, v198: i32, v199: i32, v200: i32) { + ^block28(v197: i32, v198: i32, v199: i32, v200: i32): + v317 = arith.constant 0 : i32; + v201 = arith.constant 0 : i32; + v205 = arith.eq v200, v201 : i1; + v206 = arith.zext v205 : u32; + v207 = hir.bitcast v206 : i32; + v209 = arith.neq v207, v317 : i1; + v304, v305 = scf.if v209 : i32, i32 { + ^block43: + v316 = arith.constant 0 : i32; + v203 = arith.constant 4 : i32; + scf.yield v203, v316; } else { - ^block27: - v156 = hir.bitcast v144 : u32; - v191 = arith.constant 4 : u32; - v158 = arith.mod v156, v191 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - v160 = hir.load v159 : i32; - v244 = arith.constant 0 : i32; - v245 = arith.constant 0 : i32; - v162 = arith.eq v160, v245 : i1; - v163 = arith.zext v162 : u32; - v164 = hir.bitcast v163 : i32; - v166 = arith.neq v164, v244 : i1; - v232 = scf.if v166 : i32 { - ^block36: - v243 = arith.constant 0 : i32; - scf.yield v243; + ^block31: + v210 = hir.bitcast v198 : u32; + v245 = arith.constant 4 : u32; + v212 = arith.mod v210, v245 : u32; + hir.assertz v212 #[code = 250]; + v213 = hir.int_to_ptr v210 : ptr; + v214 = hir.load v213 : i32; + v314 = arith.constant 0 : i32; + v315 = arith.constant 0 : i32; + v216 = arith.eq v214, v315 : i1; + v217 = arith.zext v216 : u32; + v218 = hir.bitcast v217 : i32; + v220 = arith.neq v218, v314 : i1; + v302 = scf.if v220 : i32 { + ^block42: + v313 = arith.constant 0 : i32; + scf.yield v313; } else { - ^block28: - v242 = arith.constant 4 : u32; - v167 = hir.bitcast v143 : u32; - v169 = arith.add v167, v242 : u32 #[overflow = checked]; - v241 = arith.constant 4 : u32; - v171 = arith.mod v169, v241 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v145; - v240 = arith.constant 4 : u32; - v173 = hir.bitcast v144 : u32; - v175 = arith.add v173, v240 : u32 #[overflow = checked]; - v239 = arith.constant 4 : u32; - v177 = arith.mod v175, v239 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - v179 = hir.load v178 : i32; - v180 = hir.bitcast v143 : u32; - v238 = arith.constant 4 : u32; - v182 = arith.mod v180, v238 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - hir.store v183, v179; - v184 = arith.mul v160, v146 : i32 #[overflow = wrapping]; - scf.yield v184; + ^block32: + v312 = arith.constant 4 : u32; + v221 = hir.bitcast v197 : u32; + v223 = arith.add v221, v312 : u32 #[overflow = checked]; + v311 = arith.constant 4 : u32; + v225 = arith.mod v223, v311 : u32; + hir.assertz v225 #[code = 250]; + v226 = hir.int_to_ptr v223 : ptr; + hir.store v226, v199; + v310 = arith.constant 4 : u32; + v227 = hir.bitcast v198 : u32; + v229 = arith.add v227, v310 : u32 #[overflow = checked]; + v309 = arith.constant 4 : u32; + v231 = arith.mod v229, v309 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + v233 = hir.load v232 : i32; + v234 = hir.bitcast v197 : u32; + v308 = arith.constant 4 : u32; + v236 = arith.mod v234, v308 : u32; + hir.assertz v236 #[code = 250]; + v237 = hir.int_to_ptr v234 : ptr; + hir.store v237, v233; + v238 = arith.mul v214, v200 : i32 #[overflow = wrapping]; + scf.yield v238; }; - v185 = arith.constant 8 : i32; - v237 = arith.constant 4 : i32; - v233 = cf.select v166, v237, v185 : i32; - scf.yield v233, v232; + v239 = arith.constant 8 : i32; + v307 = arith.constant 4 : i32; + v303 = cf.select v220, v307, v239 : i32; + scf.yield v303, v302; }; - v188 = arith.add v143, v234 : i32 #[overflow = wrapping]; - v190 = hir.bitcast v188 : u32; - v236 = arith.constant 4 : u32; - v192 = arith.mod v190, v236 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v235; + v242 = arith.add v197, v304 : i32 #[overflow = wrapping]; + v244 = hir.bitcast v242 : u32; + v306 = arith.constant 4 : u32; + v246 = arith.mod v244, v306 : u32; + hir.assertz v246 #[code = 250]; + v247 = hir.int_to_ptr v244 : ptr; + hir.store v247, v305; builtin.ret ; }; - private builtin.function @::deallocate(v194: i32, v195: i32, v196: i32) { - ^block29(v194: i32, v195: i32, v196: i32): - v249 = arith.constant 0 : i32; - v197 = arith.constant 0 : i32; - v198 = arith.eq v196, v197 : i1; - v199 = arith.zext v198 : u32; - v200 = hir.bitcast v199 : i32; - v202 = arith.neq v200, v249 : i1; - scf.if v202{ - ^block31: + private builtin.function @::deallocate(v248: i32, v249: i32, v250: i32) { + ^block33(v248: i32, v249: i32, v250: i32): + v319 = arith.constant 0 : i32; + v251 = arith.constant 0 : i32; + v252 = arith.eq v250, v251 : i1; + v253 = arith.zext v252 : u32; + v254 = hir.bitcast v253 : i32; + v256 = arith.neq v254, v319 : i1; + scf.if v256{ + ^block35: scf.yield ; } else { - ^block32: - hir.exec @root_ns:root@1.0.0/hash_elements/__rustc::__rust_dealloc(v194, v196, v195) + ^block36: + hir.exec @root_ns:root@1.0.0/hash_elements/__rustc::__rust_dealloc(v248, v250, v249) scf.yield ; }; builtin.ret ; @@ -272,5 +334,7 @@ builtin.component root_ns:root@1.0.0 { builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/hash_elements.masm b/tests/integration/expected/hash_elements.masm index 1814fca25..f42d8d8d9 100644 --- a/tests/integration/expected/hash_elements.masm +++ b/tests/integration/expected/hash_elements.masm @@ -5,9 +5,17 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop push.1048576 u32assert - mem_store.278528 + mem_store.278536 end # mod ::"root_ns:root@1.0.0"::hash_elements @@ -21,7 +29,7 @@ end @callconv("C") pub proc entrypoint(i32) -> felt - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -29,9 +37,9 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -80,9 +88,15 @@ pub proc entrypoint(i32) -> felt swap.1 u32shr push.0 + push.0 + mul.4294967296 + add push.3 dup.2 u32and + push.0 + mul.4294967296 + add assert_eq push.0 push.0 @@ -92,31 +106,34 @@ pub proc entrypoint(i32) -> felt eq neq if.true - dup.0 - movup.2 + push.16 + dup.3 u32wrapping_add + movup.2 dup.2 - swap.2 + u32wrapping_add + movup.2 trace.240 nop exec.::"root_ns:root@1.0.0"::hash_elements::"miden::core::crypto::hashes::rpo256::hash_words" trace.252 nop else - dup.2 - swap.2 - swap.1 + push.16 + dup.3 + u32wrapping_add + movdn.2 trace.240 nop exec.::"root_ns:root@1.0.0"::hash_elements::"miden::core::crypto::hashes::rpo256::hash_elements" trace.252 nop end - push.12 + push.16 dup.1 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -126,21 +143,101 @@ pub proc entrypoint(i32) -> felt swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + dup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw trace.252 nop push.4 dup.0 swap.2 - swap.4 + swap.3 trace.240 nop exec.::"root_ns:root@1.0.0"::hash_elements::::deallocate trace.252 nop - push.16 + push.1048588 + push.0 + dup.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hash_elements::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.32 + movup.2 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -262,13 +359,41 @@ proc miden::core::crypto::hashes::rpo256::hash_words(i32, i32, i32) nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + @callconv("C") proc ::deallocate( i32, i32, i32 ) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -278,7 +403,7 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -369,7 +494,7 @@ proc ::deallocate( end push.16 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/hash_elements.wat b/tests/integration/expected/hash_elements.wat index a8c241dc4..b658739ca 100644 --- a/tests/integration/expected/hash_elements.wat +++ b/tests/integration/expected/hash_elements.wat @@ -2,9 +2,11 @@ (type (;0;) (func (param i32 i32 i32))) (type (;1;) (func (param i32) (result f32))) (type (;2;) (func (param f32 f32))) - (type (;3;) (func (param i32 i32 i32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32 i32 i32))) (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 "entrypoint" (func $entrypoint)) @@ -12,7 +14,7 @@ (func $entrypoint (;1;) (type 1) (param i32) (result f32) (local i32 i32 i32 f32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 1 global.set $__stack_pointer @@ -26,9 +28,10 @@ local.tee 3 i32.const 3 i32.and - call $intrinsics::felt::from_u32 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.extend_i32_u + call $intrinsics::felt::from_u64_unchecked + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq block ;; label = @1 block ;; label = @2 @@ -40,6 +43,8 @@ local.get 3 local.get 2 local.get 1 + i32.const 16 + i32.add call $miden::core::crypto::hashes::rpo256::hash_elements br 1 (;@1;) end @@ -48,17 +53,34 @@ local.get 2 i32.add local.get 1 + i32.const 16 + i32.add call $miden::core::crypto::hashes::rpo256::hash_words end local.get 1 - f32.load offset=12 - local.set 4 + local.get 1 + i64.load offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 + local.get 1 + local.get 1 + i64.load offset=24 + i64.const 32 + i64.rotl + i64.store local.get 0 i32.const 4 i32.const 4 call $::deallocate local.get 1 - i32.const 16 + i32.const 0 + i32.const 1048588 + call $>::index + f32.load + local.set 4 + local.get 1 + i32.const 32 i32.add global.set $__stack_pointer local.get 4 @@ -66,7 +88,7 @@ (func $intrinsics::felt::assert_eq (;2;) (type 2) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;3;) (type 1) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) unreachable ) (func $miden::core::crypto::hashes::rpo256::hash_elements (;4;) (type 0) (param i32 i32 i32) @@ -75,7 +97,22 @@ (func $miden::core::crypto::hashes::rpo256::hash_words (;5;) (type 0) (param i32 i32 i32) unreachable ) - (func $::deallocate (;6;) (type 0) (param i32 i32 i32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $::deallocate (;7;) (type 0) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -107,7 +144,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;7;) (type 3) (param i32 i32 i32 i32) + (func $::current_memory (;8;) (type 5) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -142,7 +179,7 @@ local.get 4 i32.store ) - (func $::deallocate (;8;) (type 0) (param i32 i32 i32) + (func $::deallocate (;9;) (type 0) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -153,4 +190,5 @@ call $__rustc::__rust_dealloc end ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/hash_words.hir b/tests/integration/expected/hash_words.hir index 7fdd3d12e..f574b73d4 100644 --- a/tests/integration/expected/hash_words.hir +++ b/tests/integration/expected/hash_words.hir @@ -10,7 +10,7 @@ builtin.component root_ns:root@1.0.0 { v7 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr v8 = hir.bitcast v7 : ptr; v9 = hir.load v8 : i32; - v10 = arith.constant 16 : i32; + v10 = arith.constant 32 : i32; v11 = arith.sub v9, v10 : i32 #[overflow = wrapping]; v12 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr v13 = hir.bitcast v12 : ptr; @@ -18,214 +18,273 @@ builtin.component root_ns:root@1.0.0 { v15 = arith.constant 4 : u32; v14 = hir.bitcast v3 : u32; v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v186 = arith.constant 4 : u32; - v18 = arith.mod v16, v186 : u32; + v245 = arith.constant 4 : u32; + v18 = arith.mod v16, v245 : u32; hir.assertz v18 #[code = 250]; v19 = hir.int_to_ptr v16 : ptr; v20 = hir.load v19 : i32; v22 = arith.constant 8 : u32; v21 = hir.bitcast v3 : u32; v23 = arith.add v21, v22 : u32 #[overflow = checked]; - v185 = arith.constant 4 : u32; - v25 = arith.mod v23, v185 : u32; + v244 = arith.constant 4 : u32; + v25 = arith.mod v23, v244 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v180 = arith.constant 0 : felt; - hir.assert_eq v180, v180; - v178 = arith.constant 2 : u32; + v243 = arith.constant 0 : i64; + v31 = arith.trunc v243 : felt; + v28 = arith.constant 0 : i64; + v29 = arith.trunc v28 : felt; + hir.assert_eq v29, v31; + v233 = arith.constant 2 : u32; v33 = hir.bitcast v20 : u32; - v35 = arith.shr v33, v178 : u32; + v35 = arith.shr v33, v233 : u32; v36 = hir.bitcast v35 : i32; - v184 = arith.constant 2 : u32; - v39 = arith.shl v27, v184 : i32; + v41 = arith.constant 16 : i32; + v42 = arith.add v11, v41 : i32 #[overflow = wrapping]; + v242 = arith.constant 2 : u32; + v39 = arith.shl v27, v242 : i32; v40 = arith.add v36, v39 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/miden::core::crypto::hashes::rpo256::hash_words(v36, v40, v11) - v42 = arith.constant 12 : u32; - v41 = hir.bitcast v11 : u32; - v43 = arith.add v41, v42 : u32 #[overflow = checked]; - v183 = arith.constant 4 : u32; - v45 = arith.mod v43, v183 : u32; - hir.assertz v45 #[code = 250]; - v46 = hir.int_to_ptr v43 : ptr; - v47 = hir.load v46 : felt; - v182 = arith.constant 16 : i32; - hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v3, v182, v182) - v181 = arith.constant 16 : i32; - v51 = arith.add v11, v181 : i32 #[overflow = wrapping]; - v52 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v53 = hir.bitcast v52 : ptr; - hir.store v53, v51; - builtin.ret v47; + hir.exec @root_ns:root@1.0.0/hash_words/miden::core::crypto::hashes::rpo256::hash_words(v36, v40, v42) + v44 = arith.constant 16 : u32; + v43 = hir.bitcast v11 : u32; + v45 = arith.add v43, v44 : u32 #[overflow = checked]; + v241 = arith.constant 8 : u32; + v47 = arith.mod v45, v241 : u32; + hir.assertz v47 #[code = 250]; + v48 = hir.int_to_ptr v45 : ptr; + v49 = hir.load v48 : i64; + v229, v230 = arith.split v49 : felt, felt; + v240 = arith.constant 8 : u32; + v53 = hir.bitcast v11 : u32; + v55 = arith.add v53, v240 : u32 #[overflow = checked]; + v239 = arith.constant 8 : u32; + v57 = arith.mod v55, v239 : u32; + hir.assertz v57 #[code = 250]; + v231 = arith.join v230, v229 : i64; + v58 = hir.int_to_ptr v55 : ptr; + hir.store v58, v231; + v60 = arith.constant 24 : u32; + v59 = hir.bitcast v11 : u32; + v61 = arith.add v59, v60 : u32 #[overflow = checked]; + v238 = arith.constant 8 : u32; + v63 = arith.mod v61, v238 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : i64; + v226, v227 = arith.split v65 : felt, felt; + v69 = hir.bitcast v11 : u32; + v237 = arith.constant 8 : u32; + v71 = arith.mod v69, v237 : u32; + hir.assertz v71 #[code = 250]; + v228 = arith.join v227, v226 : i64; + v72 = hir.int_to_ptr v69 : ptr; + hir.store v72, v228; + v74 = arith.constant 1048588 : i32; + v5 = arith.constant 0 : i32; + v75 = hir.exec @root_ns:root@1.0.0/hash_words/>::index(v11, v5, v74) : i32 + v76 = hir.bitcast v75 : u32; + v236 = arith.constant 4 : u32; + v78 = arith.mod v76, v236 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : felt; + v235 = arith.constant 16 : i32; + hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v3, v235, v235) + v234 = arith.constant 32 : i32; + v84 = arith.add v11, v234 : i32 #[overflow = wrapping]; + v85 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v86 = hir.bitcast v85 : ptr; + hir.store v86, v84; + builtin.ret v80; }; - private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v54: i32, v55: i32, v56: i32) { - ^block8(v54: i32, v55: i32, v56: i32): - v57, v58, v59, v60 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v54, v55) : felt, felt, felt, felt - v61 = hir.bitcast v56 : u32; - v62 = hir.int_to_ptr v61 : ptr; - hir.store v62, v57; - v63 = arith.constant 4 : u32; - v64 = arith.add v61, v63 : u32 #[overflow = checked]; - v65 = hir.int_to_ptr v64 : ptr; - hir.store v65, v58; - v66 = arith.constant 8 : u32; - v67 = arith.add v61, v66 : u32 #[overflow = checked]; - v68 = hir.int_to_ptr v67 : ptr; - hir.store v68, v59; - v69 = arith.constant 12 : u32; - v70 = arith.add v61, v69 : u32 #[overflow = checked]; - v71 = hir.int_to_ptr v70 : ptr; - hir.store v71, v60; + private builtin.function @miden::core::crypto::hashes::rpo256::hash_words(v87: i32, v88: i32, v89: i32) { + ^block8(v87: i32, v88: i32, v89: i32): + v90, v91, v92, v93 = hir.exec @miden/core/crypto/hashes/rpo256/hash_words(v87, v88) : felt, felt, felt, felt + v94 = hir.bitcast v89 : u32; + v95 = hir.int_to_ptr v94 : ptr; + hir.store v95, v90; + v96 = arith.constant 4 : u32; + v97 = arith.add v94, v96 : u32 #[overflow = checked]; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v91; + v99 = arith.constant 8 : u32; + v100 = arith.add v94, v99 : u32 #[overflow = checked]; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v92; + v102 = arith.constant 12 : u32; + v103 = arith.add v94, v102 : u32 #[overflow = checked]; + v104 = hir.int_to_ptr v103 : ptr; + hir.store v104, v93; builtin.ret ; }; - private builtin.function @::deallocate(v72: i32, v73: i32, v74: i32) { - ^block15(v72: i32, v73: i32, v74: i32): - v76 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v77 = hir.bitcast v76 : ptr; - v78 = hir.load v77 : i32; - v79 = arith.constant 16 : i32; - v80 = arith.sub v78, v79 : i32 #[overflow = wrapping]; - v81 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v82 = hir.bitcast v81 : ptr; - hir.store v82, v80; - v83 = arith.constant 4 : i32; - v84 = arith.add v80, v83 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_words/::current_memory(v84, v72, v73, v74) - v86 = arith.constant 8 : u32; - v85 = hir.bitcast v80 : u32; - v87 = arith.add v85, v86 : u32 #[overflow = checked]; - v88 = arith.constant 4 : u32; - v89 = arith.mod v87, v88 : u32; - hir.assertz v89 #[code = 250]; - v90 = hir.int_to_ptr v87 : ptr; - v91 = hir.load v90 : i32; - v193 = arith.constant 0 : i32; - v75 = arith.constant 0 : i32; - v93 = arith.eq v91, v75 : i1; - v94 = arith.zext v93 : u32; - v95 = hir.bitcast v94 : i32; - v97 = arith.neq v95, v193 : i1; - scf.if v97{ - ^block28: + private builtin.function @>::index(v105: i32, v106: i32, v107: i32) -> i32 { + ^block15(v105: i32, v106: i32, v107: i32): + v115 = arith.constant 0 : i32; + v247 = arith.constant 3 : u32; + v110 = hir.bitcast v106 : u32; + v112 = arith.gt v110, v247 : i1; + v113 = arith.zext v112 : u32; + v114 = hir.bitcast v113 : i32; + v116 = arith.neq v114, v115 : i1; + cf.cond_br v116 ^block17, ^block18; + ^block17: + ub.unreachable ; + ^block18: + v246 = arith.constant 2 : u32; + v119 = arith.shl v106, v246 : i32; + v120 = arith.add v105, v119 : i32 #[overflow = wrapping]; + builtin.ret v120; + }; + + private builtin.function @::deallocate(v121: i32, v122: i32, v123: i32) { + ^block19(v121: i32, v122: i32, v123: i32): + v125 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v126 = hir.bitcast v125 : ptr; + v127 = hir.load v126 : i32; + v128 = arith.constant 16 : i32; + v129 = arith.sub v127, v128 : i32 #[overflow = wrapping]; + v130 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v131 = hir.bitcast v130 : ptr; + hir.store v131, v129; + v132 = arith.constant 4 : i32; + v133 = arith.add v129, v132 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_words/::current_memory(v133, v121, v122, v123) + v135 = arith.constant 8 : u32; + v134 = hir.bitcast v129 : u32; + v136 = arith.add v134, v135 : u32 #[overflow = checked]; + v137 = arith.constant 4 : u32; + v138 = arith.mod v136, v137 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : i32; + v256 = arith.constant 0 : i32; + v124 = arith.constant 0 : i32; + v142 = arith.eq v140, v124 : i1; + v143 = arith.zext v142 : u32; + v144 = hir.bitcast v143 : i32; + v146 = arith.neq v144, v256 : i1; + scf.if v146{ + ^block34: scf.yield ; } else { - ^block18: - v192 = arith.constant 4 : u32; - v98 = hir.bitcast v80 : u32; - v100 = arith.add v98, v192 : u32 #[overflow = checked]; - v191 = arith.constant 4 : u32; - v102 = arith.mod v100, v191 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i32; - v106 = arith.constant 12 : u32; - v105 = hir.bitcast v80 : u32; - v107 = arith.add v105, v106 : u32 #[overflow = checked]; - v190 = arith.constant 4 : u32; - v109 = arith.mod v107, v190 : u32; - hir.assertz v109 #[code = 250]; - v110 = hir.int_to_ptr v107 : ptr; - v111 = hir.load v110 : i32; - hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v104, v91, v111) + ^block22: + v255 = arith.constant 4 : u32; + v147 = hir.bitcast v129 : u32; + v149 = arith.add v147, v255 : u32 #[overflow = checked]; + v254 = arith.constant 4 : u32; + v151 = arith.mod v149, v254 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v155 = arith.constant 12 : u32; + v154 = hir.bitcast v129 : u32; + v156 = arith.add v154, v155 : u32 #[overflow = checked]; + v253 = arith.constant 4 : u32; + v158 = arith.mod v156, v253 : u32; + hir.assertz v158 #[code = 250]; + v159 = hir.int_to_ptr v156 : ptr; + v160 = hir.load v159 : i32; + hir.exec @root_ns:root@1.0.0/hash_words/::deallocate(v153, v140, v160) scf.yield ; }; - v189 = arith.constant 16 : i32; - v114 = arith.add v80, v189 : i32 #[overflow = wrapping]; - v115 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr - v116 = hir.bitcast v115 : ptr; - hir.store v116, v114; + v252 = arith.constant 16 : i32; + v163 = arith.add v129, v252 : i32 #[overflow = wrapping]; + v164 = builtin.global_symbol @root_ns:root@1.0.0/hash_words/__stack_pointer : ptr + v165 = hir.bitcast v164 : ptr; + hir.store v165, v163; builtin.ret ; }; - private builtin.function @::current_memory(v117: i32, v118: i32, v119: i32, v120: i32) { - ^block19(v117: i32, v118: i32, v119: i32, v120: i32): - v219 = arith.constant 0 : i32; - v121 = arith.constant 0 : i32; - v125 = arith.eq v120, v121 : i1; - v126 = arith.zext v125 : u32; - v127 = hir.bitcast v126 : i32; - v129 = arith.neq v127, v219 : i1; - v206, v207 = scf.if v129 : i32, i32 { - ^block31: - v218 = arith.constant 0 : i32; - v123 = arith.constant 4 : i32; - scf.yield v123, v218; + private builtin.function @::current_memory(v166: i32, v167: i32, v168: i32, v169: i32) { + ^block23(v166: i32, v167: i32, v168: i32, v169: i32): + v282 = arith.constant 0 : i32; + v170 = arith.constant 0 : i32; + v174 = arith.eq v169, v170 : i1; + v175 = arith.zext v174 : u32; + v176 = hir.bitcast v175 : i32; + v178 = arith.neq v176, v282 : i1; + v269, v270 = scf.if v178 : i32, i32 { + ^block37: + v281 = arith.constant 0 : i32; + v172 = arith.constant 4 : i32; + scf.yield v172, v281; } else { - ^block22: - v130 = hir.bitcast v118 : u32; - v165 = arith.constant 4 : u32; - v132 = arith.mod v130, v165 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : i32; - v216 = arith.constant 0 : i32; - v217 = arith.constant 0 : i32; - v136 = arith.eq v134, v217 : i1; - v137 = arith.zext v136 : u32; - v138 = hir.bitcast v137 : i32; - v140 = arith.neq v138, v216 : i1; - v204 = scf.if v140 : i32 { - ^block30: - v215 = arith.constant 0 : i32; - scf.yield v215; + ^block26: + v179 = hir.bitcast v167 : u32; + v214 = arith.constant 4 : u32; + v181 = arith.mod v179, v214 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : i32; + v279 = arith.constant 0 : i32; + v280 = arith.constant 0 : i32; + v185 = arith.eq v183, v280 : i1; + v186 = arith.zext v185 : u32; + v187 = hir.bitcast v186 : i32; + v189 = arith.neq v187, v279 : i1; + v267 = scf.if v189 : i32 { + ^block36: + v278 = arith.constant 0 : i32; + scf.yield v278; } else { - ^block23: - v214 = arith.constant 4 : u32; - v141 = hir.bitcast v117 : u32; - v143 = arith.add v141, v214 : u32 #[overflow = checked]; - v213 = arith.constant 4 : u32; - v145 = arith.mod v143, v213 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - hir.store v146, v119; - v212 = arith.constant 4 : u32; - v147 = hir.bitcast v118 : u32; - v149 = arith.add v147, v212 : u32 #[overflow = checked]; - v211 = arith.constant 4 : u32; - v151 = arith.mod v149, v211 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : i32; - v154 = hir.bitcast v117 : u32; - v210 = arith.constant 4 : u32; - v156 = arith.mod v154, v210 : u32; - hir.assertz v156 #[code = 250]; - v157 = hir.int_to_ptr v154 : ptr; - hir.store v157, v153; - v158 = arith.mul v134, v120 : i32 #[overflow = wrapping]; - scf.yield v158; + ^block27: + v277 = arith.constant 4 : u32; + v190 = hir.bitcast v166 : u32; + v192 = arith.add v190, v277 : u32 #[overflow = checked]; + v276 = arith.constant 4 : u32; + v194 = arith.mod v192, v276 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v168; + v275 = arith.constant 4 : u32; + v196 = hir.bitcast v167 : u32; + v198 = arith.add v196, v275 : u32 #[overflow = checked]; + v274 = arith.constant 4 : u32; + v200 = arith.mod v198, v274 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + v202 = hir.load v201 : i32; + v203 = hir.bitcast v166 : u32; + v273 = arith.constant 4 : u32; + v205 = arith.mod v203, v273 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v202; + v207 = arith.mul v183, v169 : i32 #[overflow = wrapping]; + scf.yield v207; }; - v159 = arith.constant 8 : i32; - v209 = arith.constant 4 : i32; - v205 = cf.select v140, v209, v159 : i32; - scf.yield v205, v204; + v208 = arith.constant 8 : i32; + v272 = arith.constant 4 : i32; + v268 = cf.select v189, v272, v208 : i32; + scf.yield v268, v267; }; - v162 = arith.add v117, v206 : i32 #[overflow = wrapping]; - v164 = hir.bitcast v162 : u32; - v208 = arith.constant 4 : u32; - v166 = arith.mod v164, v208 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - hir.store v167, v207; + v211 = arith.add v166, v269 : i32 #[overflow = wrapping]; + v213 = hir.bitcast v211 : u32; + v271 = arith.constant 4 : u32; + v215 = arith.mod v213, v271 : u32; + hir.assertz v215 #[code = 250]; + v216 = hir.int_to_ptr v213 : ptr; + hir.store v216, v270; builtin.ret ; }; - private builtin.function @::deallocate(v168: i32, v169: i32, v170: i32) { - ^block24(v168: i32, v169: i32, v170: i32): - v221 = arith.constant 0 : i32; - v171 = arith.constant 0 : i32; - v172 = arith.eq v170, v171 : i1; - v173 = arith.zext v172 : u32; - v174 = hir.bitcast v173 : i32; - v176 = arith.neq v174, v221 : i1; - scf.if v176{ - ^block26: + private builtin.function @::deallocate(v217: i32, v218: i32, v219: i32) { + ^block28(v217: i32, v218: i32, v219: i32): + v284 = arith.constant 0 : i32; + v220 = arith.constant 0 : i32; + v221 = arith.eq v219, v220 : i1; + v222 = arith.zext v221 : u32; + v223 = hir.bitcast v222 : i32; + v225 = arith.neq v223, v284 : i1; + scf.if v225{ + ^block30: scf.yield ; } else { - ^block27: - hir.exec @root_ns:root@1.0.0/hash_words/__rustc::__rust_dealloc(v168, v170, v169) + ^block31: + hir.exec @root_ns:root@1.0.0/hash_words/__rustc::__rust_dealloc(v217, v219, v218) scf.yield ; }; builtin.ret ; @@ -234,5 +293,7 @@ builtin.component root_ns:root@1.0.0 { builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/hash_words.masm b/tests/integration/expected/hash_words.masm index f1db0d3ee..c9bd26e15 100644 --- a/tests/integration/expected/hash_words.masm +++ b/tests/integration/expected/hash_words.masm @@ -5,9 +5,17 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop push.1048576 u32assert - mem_store.278528 + mem_store.278536 end # mod ::"root_ns:root@1.0.0"::hash_words @@ -21,7 +29,7 @@ end @callconv("C") pub proc entrypoint(i32) -> felt - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -29,9 +37,9 @@ pub proc entrypoint(i32) -> felt exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -76,29 +84,116 @@ pub proc entrypoint(i32) -> felt trace.252 nop push.0 - dup.0 + push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add assert_eq push.2 movup.2 swap.1 u32shr + push.16 + dup.3 + u32wrapping_add push.2 - movup.2 + movup.3 swap.1 u32shl - dup.1 - u32wrapping_add dup.2 - swap.2 + u32wrapping_add + movup.2 trace.240 nop exec.::"root_ns:root@1.0.0"::hash_words::"miden::core::crypto::hashes::rpo256::hash_words" trace.252 nop - push.12 + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.24 dup.1 add u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + dup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + swap.2 + movup.2 + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1048588 + push.0 + dup.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hash_words::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -121,9 +216,9 @@ pub proc entrypoint(i32) -> felt exec.::"root_ns:root@1.0.0"::hash_words::::deallocate trace.252 nop - push.16 + push.32 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -189,13 +284,41 @@ proc miden::core::crypto::hashes::rpo256::hash_words(i32, i32, i32) nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + @callconv("C") proc ::deallocate( i32, i32, i32 ) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -205,7 +328,7 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -296,7 +419,7 @@ proc ::deallocate( end push.16 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/hash_words.wat b/tests/integration/expected/hash_words.wat index 9705a3c84..1f4de79ce 100644 --- a/tests/integration/expected/hash_words.wat +++ b/tests/integration/expected/hash_words.wat @@ -2,9 +2,11 @@ (type (;0;) (func (param i32 i32 i32))) (type (;1;) (func (param i32) (result f32))) (type (;2;) (func (param f32 f32))) - (type (;3;) (func (param i32 i32 i32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32 i32 i32))) (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 "entrypoint" (func $entrypoint)) @@ -12,7 +14,7 @@ (func $entrypoint (;1;) (type 1) (param i32) (result f32) (local i32 i32 i32 f32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 1 global.set $__stack_pointer @@ -22,10 +24,10 @@ local.get 0 i32.load offset=8 local.set 3 - i32.const 0 - call $intrinsics::felt::from_u32 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 2 i32.const 2 @@ -37,16 +39,33 @@ i32.shl i32.add local.get 1 + i32.const 16 + i32.add call $miden::core::crypto::hashes::rpo256::hash_words local.get 1 - f32.load offset=12 + local.get 1 + i64.load offset=16 + i64.const 32 + i64.rotl + i64.store offset=8 + local.get 1 + local.get 1 + i64.load offset=24 + i64.const 32 + i64.rotl + i64.store + local.get 1 + i32.const 0 + i32.const 1048588 + call $>::index + f32.load local.set 4 local.get 0 i32.const 16 i32.const 16 call $::deallocate local.get 1 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer local.get 4 @@ -54,13 +73,28 @@ (func $intrinsics::felt::assert_eq (;2;) (type 2) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;3;) (type 1) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;3;) (type 3) (param i64) (result f32) unreachable ) (func $miden::core::crypto::hashes::rpo256::hash_words (;4;) (type 0) (param i32 i32 i32) unreachable ) - (func $::deallocate (;5;) (type 0) (param i32 i32 i32) + (func $>::index (;5;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $::deallocate (;6;) (type 0) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -92,7 +126,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;6;) (type 3) (param i32 i32 i32 i32) + (func $::current_memory (;7;) (type 5) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -127,7 +161,7 @@ local.get 4 i32.store ) - (func $::deallocate (;7;) (type 0) (param i32 i32 i32) + (func $::deallocate (;8;) (type 0) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -138,4 +172,5 @@ call $__rustc::__rust_dealloc end ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/hmerge.hir b/tests/integration/expected/hmerge.hir index 187e6634e..8c72ba765 100644 --- a/tests/integration/expected/hmerge.hir +++ b/tests/integration/expected/hmerge.hir @@ -5,100 +5,199 @@ builtin.component root_ns:root@1.0.0 { v10 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr v11 = hir.bitcast v10 : ptr; v12 = hir.load v11 : i32; - v13 = arith.constant 48 : i32; + v13 = arith.constant 64 : i32; v14 = arith.sub v12, v13 : i32 #[overflow = wrapping]; v15 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr v16 = hir.bitcast v15 : ptr; hir.store v16, v14; - v18 = arith.constant 28 : u32; + v18 = arith.constant 60 : u32; v17 = hir.bitcast v14 : u32; v19 = arith.add v17, v18 : u32 #[overflow = checked]; v20 = arith.constant 4 : u32; v21 = arith.mod v19, v20 : u32; hir.assertz v21 #[code = 250]; v22 = hir.int_to_ptr v19 : ptr; - hir.store v22, v7; - v24 = arith.constant 24 : u32; + hir.store v22, v3; + v24 = arith.constant 56 : u32; v23 = hir.bitcast v14 : u32; v25 = arith.add v23, v24 : u32 #[overflow = checked]; - v87 = arith.constant 4 : u32; - v27 = arith.mod v25, v87 : u32; + v175 = arith.constant 4 : u32; + v27 = arith.mod v25, v175 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v6; - v30 = arith.constant 20 : u32; + hir.store v28, v2; + v30 = arith.constant 52 : u32; v29 = hir.bitcast v14 : u32; v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v86 = arith.constant 4 : u32; - v33 = arith.mod v31, v86 : u32; + v174 = arith.constant 4 : u32; + v33 = arith.mod v31, v174 : u32; hir.assertz v33 #[code = 250]; v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v5; - v36 = arith.constant 16 : u32; + hir.store v34, v1; + v36 = arith.constant 48 : u32; v35 = hir.bitcast v14 : u32; v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v85 = arith.constant 4 : u32; - v39 = arith.mod v37, v85 : u32; + v173 = arith.constant 4 : u32; + v39 = arith.mod v37, v173 : u32; hir.assertz v39 #[code = 250]; v40 = hir.int_to_ptr v37 : ptr; - hir.store v40, v4; - v42 = arith.constant 12 : u32; - v41 = hir.bitcast v14 : u32; - v43 = arith.add v41, v42 : u32 #[overflow = checked]; - v84 = arith.constant 4 : u32; - v45 = arith.mod v43, v84 : u32; - hir.assertz v45 #[code = 250]; - v46 = hir.int_to_ptr v43 : ptr; - hir.store v46, v3; - v48 = arith.constant 8 : u32; - v47 = hir.bitcast v14 : u32; - v49 = arith.add v47, v48 : u32 #[overflow = checked]; - v83 = arith.constant 4 : u32; - v51 = arith.mod v49, v83 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - hir.store v52, v2; - v82 = arith.constant 4 : u32; - v53 = hir.bitcast v14 : u32; - v55 = arith.add v53, v82 : u32 #[overflow = checked]; - v81 = arith.constant 4 : u32; - v57 = arith.mod v55, v81 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v1; - v59 = hir.bitcast v14 : u32; - v80 = arith.constant 4 : u32; - v61 = arith.mod v59, v80 : u32; + hir.store v40, v0; + v43 = arith.constant 48 : i32; + v44 = arith.add v14, v43 : i32 #[overflow = wrapping]; + v41 = arith.constant 16 : i32; + v42 = arith.add v14, v41 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hmerge/>::from(v42, v44) + v172 = arith.constant 60 : u32; + v45 = hir.bitcast v14 : u32; + v47 = arith.add v45, v172 : u32 #[overflow = checked]; + v171 = arith.constant 4 : u32; + v49 = arith.mod v47, v171 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + hir.store v50, v7; + v170 = arith.constant 56 : u32; + v51 = hir.bitcast v14 : u32; + v53 = arith.add v51, v170 : u32 #[overflow = checked]; + v169 = arith.constant 4 : u32; + v55 = arith.mod v53, v169 : u32; + hir.assertz v55 #[code = 250]; + v56 = hir.int_to_ptr v53 : ptr; + hir.store v56, v6; + v168 = arith.constant 52 : u32; + v57 = hir.bitcast v14 : u32; + v59 = arith.add v57, v168 : u32 #[overflow = checked]; + v167 = arith.constant 4 : u32; + v61 = arith.mod v59, v167 : u32; hir.assertz v61 #[code = 250]; v62 = hir.int_to_ptr v59 : ptr; - hir.store v62, v0; - v63 = arith.constant 32 : i32; - v64 = arith.add v14, v63 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hmerge/intrinsics::crypto::hmerge(v14, v64) - v66 = arith.constant 32 : u32; - v65 = hir.bitcast v14 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v79 = arith.constant 4 : u32; - v69 = arith.mod v67, v79 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : felt; - v78 = arith.constant 48 : i32; - v73 = arith.add v14, v78 : i32 #[overflow = wrapping]; - v74 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr - v75 = hir.bitcast v74 : ptr; - hir.store v75, v73; - builtin.ret v71; + hir.store v62, v5; + v166 = arith.constant 48 : u32; + v63 = hir.bitcast v14 : u32; + v65 = arith.add v63, v166 : u32 #[overflow = checked]; + v165 = arith.constant 4 : u32; + v67 = arith.mod v65, v165 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + hir.store v68, v4; + v164 = arith.constant 48 : i32; + v70 = arith.add v14, v164 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hmerge/>::from(v14, v70) + v74 = arith.constant 8 : u32; + v73 = hir.bitcast v14 : u32; + v75 = arith.add v73, v74 : u32 #[overflow = checked]; + v163 = arith.constant 8 : u32; + v77 = arith.mod v75, v163 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + v79 = hir.load v78 : i64; + v71 = arith.constant 40 : i32; + v72 = arith.add v14, v71 : i32 #[overflow = wrapping]; + v80 = hir.bitcast v72 : u32; + v162 = arith.constant 8 : u32; + v82 = arith.mod v80, v162 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + hir.store v83, v79; + v84 = hir.bitcast v14 : u32; + v161 = arith.constant 8 : u32; + v86 = arith.mod v84, v161 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + v88 = hir.load v87 : i64; + v90 = arith.constant 32 : u32; + v89 = hir.bitcast v14 : u32; + v91 = arith.add v89, v90 : u32 #[overflow = checked]; + v160 = arith.constant 8 : u32; + v93 = arith.mod v91, v160 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + hir.store v94, v88; + v158 = arith.constant 48 : i32; + v98 = arith.add v14, v158 : i32 #[overflow = wrapping]; + v159 = arith.constant 16 : i32; + v96 = arith.add v14, v159 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hmerge/intrinsics::crypto::hmerge(v96, v98) + v102 = arith.constant 1048588 : i32; + v9 = arith.constant 0 : i32; + v157 = arith.constant 48 : i32; + v100 = arith.add v14, v157 : i32 #[overflow = wrapping]; + v103 = hir.exec @root_ns:root@1.0.0/hmerge/>::index(v100, v9, v102) : i32 + v104 = hir.bitcast v103 : u32; + v156 = arith.constant 4 : u32; + v106 = arith.mod v104, v156 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : felt; + v155 = arith.constant 64 : i32; + v110 = arith.add v14, v155 : i32 #[overflow = wrapping]; + v111 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr + v112 = hir.bitcast v111 : ptr; + hir.store v112, v110; + builtin.ret v108; }; - private builtin.function @intrinsics::crypto::hmerge(v76: i32, v77: i32) { - ^block6(v76: i32, v77: i32): - hir.exec @intrinsics/crypto/hmerge(v76, v77) + private builtin.function @intrinsics::crypto::hmerge(v113: i32, v114: i32) { + ^block6(v113: i32, v114: i32): + hir.exec @intrinsics/crypto/hmerge(v113, v114) + builtin.ret ; + }; + + private builtin.function @>::index(v115: i32, v116: i32, v117: i32) -> i32 { + ^block10(v115: i32, v116: i32, v117: i32): + v125 = arith.constant 0 : i32; + v177 = arith.constant 3 : u32; + v120 = hir.bitcast v116 : u32; + v122 = arith.gt v120, v177 : i1; + v123 = arith.zext v122 : u32; + v124 = hir.bitcast v123 : i32; + v126 = arith.neq v124, v125 : i1; + cf.cond_br v126 ^block12, ^block13; + ^block12: + ub.unreachable ; + ^block13: + v176 = arith.constant 2 : u32; + v129 = arith.shl v116, v176 : i32; + v130 = arith.add v115, v129 : i32 #[overflow = wrapping]; + builtin.ret v130; + }; + + private builtin.function @>::from(v131: i32, v132: i32) { + ^block14(v131: i32, v132: i32): + v134 = arith.constant 8 : u32; + v133 = hir.bitcast v132 : u32; + v135 = arith.add v133, v134 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v137 = arith.mod v135, v136 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + v139 = hir.load v138 : i64; + v183 = arith.constant 8 : u32; + v140 = hir.bitcast v131 : u32; + v142 = arith.add v140, v183 : u32 #[overflow = checked]; + v182 = arith.constant 8 : u32; + v144 = arith.mod v142, v182 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + hir.store v145, v139; + v146 = hir.bitcast v132 : u32; + v181 = arith.constant 4 : u32; + v148 = arith.mod v146, v181 : u32; + hir.assertz v148 #[code = 250]; + v149 = hir.int_to_ptr v146 : ptr; + v150 = hir.load v149 : i64; + v151 = hir.bitcast v131 : u32; + v180 = arith.constant 8 : u32; + v153 = arith.mod v151, v180 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v150; builtin.ret ; }; builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/hmerge.masm b/tests/integration/expected/hmerge.masm index 19142e3c0..b9d6704da 100644 --- a/tests/integration/expected/hmerge.masm +++ b/tests/integration/expected/hmerge.masm @@ -5,16 +5,24 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop push.1048576 u32assert - mem_store.278528 + mem_store.278536 end # mod ::"root_ns:root@1.0.0"::hmerge @callconv("C") pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -22,9 +30,9 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::load_sw trace.252 nop - push.48 + push.64 u32wrapping_sub - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -34,7 +42,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_sw trace.252 nop - push.28 + push.60 dup.1 add u32assert @@ -44,7 +52,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.9 + movup.5 swap.1 u32divmod.4 swap.1 @@ -53,7 +61,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.24 + push.56 dup.1 add u32assert @@ -63,7 +71,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.8 + movup.4 swap.1 u32divmod.4 swap.1 @@ -72,7 +80,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.20 + push.52 dup.1 add u32assert @@ -82,7 +90,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.7 + movup.3 swap.1 u32divmod.4 swap.1 @@ -91,7 +99,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.16 + push.48 dup.1 add u32assert @@ -101,7 +109,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt u32mod u32assert assertz - movup.6 + movup.2 swap.1 u32divmod.4 swap.1 @@ -110,7 +118,18 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.12 + push.48 + dup.1 + u32wrapping_add + push.16 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hmerge::>::from + trace.252 + nop + push.60 dup.1 add u32assert @@ -129,7 +148,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.8 + push.56 dup.1 add u32assert @@ -148,7 +167,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.4 + push.52 dup.1 add u32assert @@ -167,7 +186,10 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + push.48 + dup.1 + add + u32assert push.4 dup.1 swap.1 @@ -183,19 +205,106 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::store_felt trace.252 nop - push.32 + push.48 dup.1 u32wrapping_add dup.1 trace.240 nop - exec.::"root_ns:root@1.0.0"::hmerge::"intrinsics::crypto::hmerge" + exec.::"root_ns:root@1.0.0"::hmerge::>::from trace.252 nop - push.32 + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.40 + dup.3 + u32wrapping_add + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + dup.0 + push.8 dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.32 + dup.3 add u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.48 + dup.1 + u32wrapping_add + push.16 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hmerge::"intrinsics::crypto::hmerge" + trace.252 + nop + push.1048588 + push.0 + push.48 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::hmerge::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -209,10 +318,10 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) -> felt exec.::intrinsics::mem::load_felt trace.252 nop - push.48 + push.64 movup.2 u32wrapping_add - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -231,3 +340,106 @@ proc intrinsics::crypto::hmerge(i32, i32) nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + diff --git a/tests/integration/expected/hmerge.wat b/tests/integration/expected/hmerge.wat index 769febe96..3508cc83a 100644 --- a/tests/integration/expected/hmerge.wat +++ b/tests/integration/expected/hmerge.wat @@ -1,57 +1,113 @@ (module $hmerge.wasm (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) (type (;1;) (func (param i32 i32))) + (type (;2;) (func (param i32 i32 i32) (result i32))) (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 "entrypoint" (func $entrypoint)) (func $entrypoint (;0;) (type 0) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) (local i32) global.get $__stack_pointer - i32.const 48 + i32.const 64 i32.sub local.tee 8 global.set $__stack_pointer local.get 8 + local.get 3 + f32.store offset=60 + local.get 8 + local.get 2 + f32.store offset=56 + local.get 8 + local.get 1 + f32.store offset=52 + local.get 8 + local.get 0 + f32.store offset=48 + local.get 8 + i32.const 16 + i32.add + local.get 8 + i32.const 48 + i32.add + call $>::from + local.get 8 local.get 7 - f32.store offset=28 + f32.store offset=60 local.get 8 local.get 6 - f32.store offset=24 + f32.store offset=56 local.get 8 local.get 5 - f32.store offset=20 + f32.store offset=52 local.get 8 local.get 4 - f32.store offset=16 + f32.store offset=48 local.get 8 - local.get 3 - f32.store offset=12 local.get 8 - local.get 2 - f32.store offset=8 + i32.const 48 + i32.add + call $>::from local.get 8 - local.get 1 - f32.store offset=4 + i32.const 40 + i32.add + local.get 8 + i64.load offset=8 + i64.store local.get 8 - local.get 0 - f32.store local.get 8 + i64.load + i64.store offset=32 local.get 8 - i32.const 32 + i32.const 16 i32.add - call $intrinsics::crypto::hmerge local.get 8 - f32.load offset=32 - local.set 7 + i32.const 48 + i32.add + call $intrinsics::crypto::hmerge local.get 8 i32.const 48 i32.add + i32.const 0 + i32.const 1048588 + call $>::index + f32.load + local.set 3 + local.get 8 + i32.const 64 + i32.add global.set $__stack_pointer - local.get 7 + local.get 3 ) (func $intrinsics::crypto::hmerge (;1;) (type 1) (param i32 i32) unreachable ) + (func $>::index (;2;) (type 2) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;3;) (type 1) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/rust_sdk/component_macros_account.hir b/tests/integration/expected/rust_sdk/component_macros_account.hir index f6847e040..98c9db5aa 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.hir +++ b/tests/integration/expected/rust_sdk/component_macros_account.hir @@ -12,88 +12,167 @@ builtin.component miden:component-macros-account/component-macros-account@0.1.0 private builtin.function @miden:component-macros-account/component-macros-account@0.1.0#test-custom-types(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt) -> i32 { ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt): - v14 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v14 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/__stack_pointer : ptr v15 = hir.bitcast v14 : ptr; v16 = hir.load v15 : i32; + v17 = arith.constant 32 : i32; + v18 = arith.sub v16, v17 : i32 #[overflow = wrapping]; + v19 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/__stack_pointer : ptr + v20 = hir.bitcast v19 : ptr; + hir.store v20, v18; hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/wit_bindgen::rt::run_ctors_once() - v17 = arith.constant 1048584 : i32; - v18 = arith.add v16, v17 : i32 #[overflow = wrapping]; - v20 = arith.constant 4 : u32; - v19 = hir.bitcast v18 : u32; - v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v136 = arith.constant 4 : u32; - v23 = arith.mod v21, v136 : u32; - hir.assertz v23 #[code = 250]; - v24 = hir.int_to_ptr v21 : ptr; - hir.store v24, v8; - v25 = hir.bitcast v18 : u32; - v135 = arith.constant 4 : u32; - v27 = arith.mod v25, v135 : u32; - hir.assertz v27 #[code = 250]; - v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v0; - builtin.ret v18; + v22 = arith.constant 28 : u32; + v21 = hir.bitcast v18 : u32; + v23 = arith.add v21, v22 : u32 #[overflow = checked]; + v24 = arith.constant 4 : u32; + v25 = arith.mod v23, v24 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + hir.store v26, v2; + v28 = arith.constant 24 : u32; + v27 = hir.bitcast v18 : u32; + v29 = arith.add v27, v28 : u32 #[overflow = checked]; + v199 = arith.constant 4 : u32; + v31 = arith.mod v29, v199 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v1; + v34 = arith.constant 20 : u32; + v33 = hir.bitcast v18 : u32; + v35 = arith.add v33, v34 : u32 #[overflow = checked]; + v198 = arith.constant 4 : u32; + v37 = arith.mod v35, v198 : u32; + hir.assertz v37 #[code = 250]; + v38 = hir.int_to_ptr v35 : ptr; + hir.store v38, v8; + v40 = arith.constant 16 : u32; + v39 = hir.bitcast v18 : u32; + v41 = arith.add v39, v40 : u32 #[overflow = checked]; + v197 = arith.constant 4 : u32; + v43 = arith.mod v41, v197 : u32; + hir.assertz v43 #[code = 250]; + v44 = hir.int_to_ptr v41 : ptr; + hir.store v44, v0; + v45 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v46 = hir.bitcast v45 : ptr; + v47 = hir.load v46 : i32; + v48 = arith.constant 16 : i32; + v49 = arith.add v18, v48 : i32 #[overflow = wrapping]; + hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/>::from(v18, v49) + v50 = arith.constant 1048584 : i32; + v51 = arith.add v47, v50 : i32 #[overflow = wrapping]; + v52 = hir.bitcast v18 : u32; + v53 = arith.constant 8 : u32; + v54 = arith.mod v52, v53 : u32; + hir.assertz v54 #[code = 250]; + v55 = hir.int_to_ptr v52 : ptr; + v56 = hir.load v55 : i64; + v57 = hir.bitcast v51 : u32; + v196 = arith.constant 4 : u32; + v59 = arith.mod v57, v196 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + hir.store v60, v56; + v195 = arith.constant 32 : i32; + v62 = arith.add v18, v195 : i32 #[overflow = wrapping]; + v63 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/__stack_pointer : ptr + v64 = hir.bitcast v63 : ptr; + hir.store v64, v62; + builtin.ret v51; }; - private builtin.function @miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v29: felt, v30: felt, v31: felt, v32: felt, v33: felt, v34: felt, v35: felt, v36: felt, v37: felt, v38: felt, v39: felt, v40: felt) -> i32 { - ^block11(v29: felt, v30: felt, v31: felt, v32: felt, v33: felt, v34: felt, v35: felt, v36: felt, v37: felt, v38: felt, v39: felt, v40: felt): - v43 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; + private builtin.function @miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v65: felt, v66: felt, v67: felt, v68: felt, v69: felt, v70: felt, v71: felt, v72: felt, v73: felt, v74: felt, v75: felt, v76: felt) -> i32 { + ^block11(v65: felt, v66: felt, v67: felt, v68: felt, v69: felt, v70: felt, v71: felt, v72: felt, v73: felt, v74: felt, v75: felt, v76: felt): + v79 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v80 = hir.bitcast v79 : ptr; + v81 = hir.load v80 : i32; hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/wit_bindgen::rt::run_ctors_once() - v46 = arith.constant 1048584 : i32; - v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; - v49 = arith.constant 4 : u32; - v48 = hir.bitcast v47 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v52 = arith.mod v50, v138 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - hir.store v53, v30; - v54 = hir.bitcast v47 : u32; - v137 = arith.constant 4 : u32; - v56 = arith.mod v54, v137 : u32; - hir.assertz v56 #[code = 250]; - v57 = hir.int_to_ptr v54 : ptr; - hir.store v57, v29; - builtin.ret v47; + v82 = arith.constant 1048584 : i32; + v83 = arith.add v81, v82 : i32 #[overflow = wrapping]; + v85 = arith.constant 4 : u32; + v84 = hir.bitcast v83 : u32; + v86 = arith.add v84, v85 : u32 #[overflow = checked]; + v201 = arith.constant 4 : u32; + v88 = arith.mod v86, v201 : u32; + hir.assertz v88 #[code = 250]; + v89 = hir.int_to_ptr v86 : ptr; + hir.store v89, v66; + v90 = hir.bitcast v83 : u32; + v200 = arith.constant 4 : u32; + v92 = arith.mod v90, v200 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + hir.store v93, v65; + builtin.ret v83; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block13: - v59 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v60 = hir.bitcast v59 : ptr; - v61 = hir.load v60 : i32; - v62 = arith.constant 1048592 : i32; - v63 = arith.add v61, v62 : i32 #[overflow = wrapping]; - v64 = hir.bitcast v63 : u32; - v65 = hir.int_to_ptr v64 : ptr; - v66 = hir.load v65 : u8; - v58 = arith.constant 0 : i32; - v67 = arith.zext v66 : u32; - v68 = hir.bitcast v67 : i32; - v70 = arith.neq v68, v58 : i1; - scf.if v70{ + v95 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v96 = hir.bitcast v95 : ptr; + v97 = hir.load v96 : i32; + v98 = arith.constant 1048592 : i32; + v99 = arith.add v97, v98 : i32 #[overflow = wrapping]; + v100 = hir.bitcast v99 : u32; + v101 = hir.int_to_ptr v100 : ptr; + v102 = hir.load v101 : u8; + v94 = arith.constant 0 : i32; + v103 = arith.zext v102 : u32; + v104 = hir.bitcast v103 : i32; + v106 = arith.neq v104, v94 : i1; + scf.if v106{ ^block15: scf.yield ; } else { ^block16: - v71 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; + v107 = builtin.global_symbol @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/GOT.data.internal.__memory_base : ptr + v108 = hir.bitcast v107 : ptr; + v109 = hir.load v108 : i32; hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/__wasm_call_ctors() - v140 = arith.constant 1 : u8; - v142 = arith.constant 1048592 : i32; - v75 = arith.add v73, v142 : i32 #[overflow = wrapping]; - v79 = hir.bitcast v75 : u32; - v80 = hir.int_to_ptr v79 : ptr; - hir.store v80, v140; + v203 = arith.constant 1 : u8; + v205 = arith.constant 1048592 : i32; + v111 = arith.add v109, v205 : i32 #[overflow = wrapping]; + v115 = hir.bitcast v111 : u32; + v116 = hir.int_to_ptr v115 : ptr; + hir.store v116, v203; scf.yield ; }; builtin.ret ; }; + private builtin.function @>::from(v117: i32, v118: i32) { + ^block17(v117: i32, v118: i32): + v120 = arith.constant 8 : u32; + v119 = hir.bitcast v118 : u32; + v121 = arith.add v119, v120 : u32 #[overflow = checked]; + v122 = arith.constant 4 : u32; + v123 = arith.mod v121, v122 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i64; + v209 = arith.constant 8 : u32; + v126 = hir.bitcast v117 : u32; + v128 = arith.add v126, v209 : u32 #[overflow = checked]; + v208 = arith.constant 8 : u32; + v130 = arith.mod v128, v208 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + hir.store v131, v125; + v132 = hir.bitcast v118 : u32; + v207 = arith.constant 4 : u32; + v134 = arith.mod v132, v207 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + v136 = hir.load v135 : i64; + v137 = hir.bitcast v117 : u32; + v206 = arith.constant 8 : u32; + v139 = arith.mod v137, v206 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v136; + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -105,39 +184,39 @@ builtin.component miden:component-macros-account/component-macros-account@0.1.0 builtin.segment @1048576 = 0x0000000100000001; }; - public builtin.function @test-custom-types(v81: felt, v82: felt, v83: felt, v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt) -> felt, felt { - ^block17(v81: felt, v82: felt, v83: felt, v84: felt, v85: felt, v86: felt, v87: felt, v88: felt, v89: felt, v90: felt, v91: felt, v92: felt): - v93 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types(v81, v82, v83, v84, v85, v86, v87, v88, v89, v90, v91, v92) : i32 - v144 = arith.constant 0 : i32; - v94 = arith.constant 0 : i32; - v95 = arith.add v93, v94 : i32 #[overflow = unchecked]; - v97 = arith.add v95, v144 : i32 #[overflow = unchecked]; - v98 = hir.int_to_ptr v97 : ptr; - v99 = hir.load v98 : felt; - v143 = arith.constant 0 : i32; - v100 = arith.constant 4 : i32; - v101 = arith.add v93, v100 : i32 #[overflow = unchecked]; - v103 = arith.add v101, v143 : i32 #[overflow = unchecked]; - v104 = hir.int_to_ptr v103 : ptr; - v105 = hir.load v104 : felt; - builtin.ret v99, v105; + public builtin.function @test-custom-types(v141: felt, v142: felt, v143: felt, v144: felt, v145: felt, v146: felt, v147: felt, v148: felt, v149: felt, v150: felt, v151: felt, v152: felt) -> felt, felt { + ^block19(v141: felt, v142: felt, v143: felt, v144: felt, v145: felt, v146: felt, v147: felt, v148: felt, v149: felt, v150: felt, v151: felt, v152: felt): + v153 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types(v141, v142, v143, v144, v145, v146, v147, v148, v149, v150, v151, v152) : i32 + v211 = arith.constant 0 : i32; + v154 = arith.constant 0 : i32; + v155 = arith.add v153, v154 : i32 #[overflow = unchecked]; + v157 = arith.add v155, v211 : i32 #[overflow = unchecked]; + v158 = hir.int_to_ptr v157 : ptr; + v159 = hir.load v158 : felt; + v210 = arith.constant 0 : i32; + v160 = arith.constant 4 : i32; + v161 = arith.add v153, v160 : i32 #[overflow = unchecked]; + v163 = arith.add v161, v210 : i32 #[overflow = unchecked]; + v164 = hir.int_to_ptr v163 : ptr; + v165 = hir.load v164 : felt; + builtin.ret v159, v165; }; - public builtin.function @test-custom-types2(v108: felt, v109: felt, v110: felt, v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt) -> felt, felt { - ^block19(v108: felt, v109: felt, v110: felt, v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt): - v120 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v108, v109, v110, v111, v112, v113, v114, v115, v116, v117, v118, v119) : i32 - v146 = arith.constant 0 : i32; - v121 = arith.constant 0 : i32; - v122 = arith.add v120, v121 : i32 #[overflow = unchecked]; - v124 = arith.add v122, v146 : i32 #[overflow = unchecked]; - v125 = hir.int_to_ptr v124 : ptr; - v126 = hir.load v125 : felt; - v145 = arith.constant 0 : i32; - v127 = arith.constant 4 : i32; - v128 = arith.add v120, v127 : i32 #[overflow = unchecked]; - v130 = arith.add v128, v145 : i32 #[overflow = unchecked]; - v131 = hir.int_to_ptr v130 : ptr; - v132 = hir.load v131 : felt; - builtin.ret v126, v132; + public builtin.function @test-custom-types2(v168: felt, v169: felt, v170: felt, v171: felt, v172: felt, v173: felt, v174: felt, v175: felt, v176: felt, v177: felt, v178: felt, v179: felt) -> felt, felt { + ^block21(v168: felt, v169: felt, v170: felt, v171: felt, v172: felt, v173: felt, v174: felt, v175: felt, v176: felt, v177: felt, v178: felt, v179: felt): + v180 = hir.exec @miden:component-macros-account/component-macros-account@0.1.0/component_macros_account/miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2(v168, v169, v170, v171, v172, v173, v174, v175, v176, v177, v178, v179) : i32 + v213 = arith.constant 0 : i32; + v181 = arith.constant 0 : i32; + v182 = arith.add v180, v181 : i32 #[overflow = unchecked]; + v184 = arith.add v182, v213 : i32 #[overflow = unchecked]; + v185 = hir.int_to_ptr v184 : ptr; + v186 = hir.load v185 : felt; + v212 = arith.constant 0 : i32; + v187 = arith.constant 4 : i32; + v188 = arith.add v180, v187 : i32 #[overflow = unchecked]; + v190 = arith.add v188, v212 : i32 #[overflow = unchecked]; + v191 = hir.int_to_ptr v190 : ptr; + v192 = hir.load v191 : felt; + builtin.ret v186, v192; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/component_macros_account.masm b/tests/integration/expected/rust_sdk/component_macros_account.masm index eceb5d0ed..f6a4b1e33 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.masm +++ b/tests/integration/expected/rust_sdk/component_macros_account.masm @@ -150,27 +150,23 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t felt, felt ) -> i32 - swap.1 - drop - swap.1 - drop - swap.1 + movup.3 drop - swap.1 + movup.3 drop - swap.1 + movup.3 drop - swap.1 + movup.3 drop - swap.1 + movup.3 drop - movup.2 + movup.4 drop - movup.2 + movup.4 drop - movup.2 + movup.4 drop - push.1114148 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -178,15 +174,44 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::load_sw trace.252 nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop trace.240 nop exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::wit_bindgen::rt::run_ctors_once trace.252 nop - push.1048584 - u32wrapping_add + push.28 + dup.1 + add + u32assert push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 add u32assert push.4 @@ -204,7 +229,29 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert push.4 dup.1 swap.1 @@ -220,6 +267,67 @@ proc miden:component-macros-account/component-macros-account@0.1.0#test-custom-t exec.::intrinsics::mem::store_felt trace.252 nop + push.1114148 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::"miden:component-macros-account/component-macros-account@0.1.0"::component_macros_account::>::from + trace.252 + nop + push.1048584 + u32wrapping_add + dup.1 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + movup.2 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end @callconv("C") @@ -383,3 +491,78 @@ proc wit_bindgen::rt::run_ctors_once( end end +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/component_macros_account.wat b/tests/integration/expected/rust_sdk/component_macros_account.wat index 5c96bac3e..54b766f25 100644 --- a/tests/integration/expected/rust_sdk/component_macros_account.wat +++ b/tests/integration/expected/rust_sdk/component_macros_account.wat @@ -3,17 +3,17 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result i32))) + (type (;2;) (func (param i32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -25,20 +25,44 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $component_macros_account::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:component-macros-account/component-macros-account@0.1.0#test-custom-types (;2;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result i32) - (local i32) - global.get $GOT.data.internal.__memory_base - local.set 12 + (local i32 i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 12 + global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 12 - i32.const 1048584 - i32.add - local.tee 12 + local.get 2 + f32.store offset=28 + local.get 12 + local.get 1 + f32.store offset=24 + local.get 12 local.get 8 - f32.store offset=4 + f32.store offset=20 local.get 12 local.get 0 - f32.store + f32.store offset=16 + global.get $GOT.data.internal.__memory_base + local.set 13 local.get 12 + local.get 12 + i32.const 16 + i32.add + call $>::from + local.get 13 + i32.const 1048584 + i32.add + local.tee 13 + local.get 12 + i64.load + i64.store align=4 + local.get 12 + i32.const 32 + i32.add + global.set $__stack_pointer + local.get 13 ) (func $miden:component-macros-account/component-macros-account@0.1.0#test-custom-types2 (;3;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result i32) (local i32) @@ -74,6 +98,16 @@ i32.store8 end ) + (func $>::from (;5;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") (@custom "rodata,miden_account" (after data) "1component_macros_account\01\0b0.1.0\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) @@ -101,45 +135,44 @@ (component $miden:component-macros-account/component-macros-account@0.1.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-word0" (type (;7;) (eq 4))) - (import "import-type-asset0" (type (;8;) (eq 6))) - (type (;9;) (record (field "foo" 7) (field "asset" 8))) - (import "import-type-struct-a" (type (;10;) (eq 9))) - (import "import-type-felt0" (type (;11;) (eq 1))) - (type (;12;) (record (field "bar" 11) (field "baz" 11))) - (import "import-type-struct-b" (type (;13;) (eq 12))) - (type (;14;) (func (param "a" 10) (param "asset" 8) (result 13))) - (import "import-func-test-custom-types" (func (;0;) (type 14))) - (type (;15;) (record (field "inner1" 11) (field "inner2" 11))) - (import "import-type-struct-c" (type (;16;) (eq 15))) - (type (;17;) (func (param "a" 10) (param "asset" 8) (result 16))) - (import "import-func-test-custom-types2" (func (;1;) (type 17))) - (export (;18;) "asset" (type 6)) - (export (;19;) "felt" (type 1)) - (export (;20;) "word" (type 4)) - (type (;21;) (variant (case "variant-a") (case "variant-b"))) - (export (;22;) "enum-a" (type 21)) - (type (;23;) (record (field "value" 19))) - (export (;24;) "later-defined" (type 23)) - (type (;25;) (record (field "nested" 24))) - (export (;26;) "forward-holder" (type 25)) - (type (;27;) (record (field "foo" 20) (field "asset" 18))) - (export (;28;) "struct-a" (type 27)) - (type (;29;) (record (field "bar" 19) (field "baz" 19))) - (export (;30;) "struct-b" (type 29)) - (type (;31;) (record (field "inner1" 19) (field "inner2" 19))) - (export (;32;) "struct-c" (type 31)) - (type (;33;) (record (field "bar" 19) (field "baz" 19))) - (export (;34;) "struct-d" (type 33)) - (type (;35;) (func (param "a" 28) (param "asset" 18) (result 30))) - (export (;2;) "test-custom-types" (func 0) (func (type 35))) - (type (;36;) (func (param "a" 28) (param "asset" 18) (result 32))) - (export (;3;) "test-custom-types2" (func 1) (func (type 36))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-word0" (type (;6;) (eq 3))) + (import "import-type-asset0" (type (;7;) (eq 5))) + (type (;8;) (record (field "foo" 6) (field "asset" 7))) + (import "import-type-struct-a" (type (;9;) (eq 8))) + (import "import-type-felt0" (type (;10;) (eq 1))) + (type (;11;) (record (field "bar" 10) (field "baz" 10))) + (import "import-type-struct-b" (type (;12;) (eq 11))) + (type (;13;) (func (param "a" 9) (param "asset" 7) (result 12))) + (import "import-func-test-custom-types" (func (;0;) (type 13))) + (type (;14;) (record (field "inner1" 10) (field "inner2" 10))) + (import "import-type-struct-c" (type (;15;) (eq 14))) + (type (;16;) (func (param "a" 9) (param "asset" 7) (result 15))) + (import "import-func-test-custom-types2" (func (;1;) (type 16))) + (export (;17;) "asset" (type 5)) + (export (;18;) "felt" (type 1)) + (export (;19;) "word" (type 3)) + (type (;20;) (variant (case "variant-a") (case "variant-b"))) + (export (;21;) "enum-a" (type 20)) + (type (;22;) (record (field "value" 18))) + (export (;23;) "later-defined" (type 22)) + (type (;24;) (record (field "nested" 23))) + (export (;25;) "forward-holder" (type 24)) + (type (;26;) (record (field "foo" 19) (field "asset" 17))) + (export (;27;) "struct-a" (type 26)) + (type (;28;) (record (field "bar" 18) (field "baz" 18))) + (export (;29;) "struct-b" (type 28)) + (type (;30;) (record (field "inner1" 18) (field "inner2" 18))) + (export (;31;) "struct-c" (type 30)) + (type (;32;) (record (field "bar" 18) (field "baz" 18))) + (export (;33;) "struct-d" (type 32)) + (type (;34;) (func (param "a" 27) (param "asset" 17) (result 29))) + (export (;2;) "test-custom-types" (func 0) (func (type 34))) + (type (;35;) (func (param "a" 27) (param "asset" 17) (result 31))) + (export (;3;) "test-custom-types2" (func 1) (func (type 35))) ) (instance $miden:component-macros-account/component-macros-account@0.1.0-shim-instance (;1;) (instantiate $miden:component-macros-account/component-macros-account@0.1.0-shim-component (with "import-func-test-custom-types" (func $test-custom-types)) diff --git a/tests/integration/expected/rust_sdk/component_macros_note.hir b/tests/integration/expected/rust_sdk/component_macros_note.hir index 0eea850d1..6e5911b7b 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.hir +++ b/tests/integration/expected/rust_sdk/component_macros_note.hir @@ -1,18 +1,18 @@ builtin.component miden:base/note-script@1.0.0 { builtin.module public @component_macros_note { - private builtin.function @component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: i32) { + private builtin.function @component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import19(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: i32) { ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: i32): v13, v14 = hir.call v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 : felt, felt #[callee = miden:component-macros-account/component-macros-account@0.1.0/test-custom-types] #[signature = (cc canon-lower) (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)]; - v125 = arith.constant 0 : i32; + v201 = arith.constant 0 : i32; v15 = arith.constant 0 : i32; v16 = arith.add v12, v15 : i32 #[overflow = unchecked]; - v18 = arith.add v16, v125 : i32 #[overflow = unchecked]; + v18 = arith.add v16, v201 : i32 #[overflow = unchecked]; v19 = hir.int_to_ptr v18 : ptr; hir.store v19, v13; - v124 = arith.constant 0 : i32; + v200 = arith.constant 0 : i32; v20 = arith.constant 4 : i32; v21 = arith.add v12, v20 : i32 #[overflow = unchecked]; - v23 = arith.add v21, v124 : i32 #[overflow = unchecked]; + v23 = arith.add v21, v200 : i32 #[overflow = unchecked]; v24 = hir.int_to_ptr v23 : ptr; hir.store v24, v14; builtin.ret ; @@ -33,7 +33,7 @@ builtin.component miden:base/note-script@1.0.0 { v31 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr v32 = hir.bitcast v31 : ptr; v33 = hir.load v32 : i32; - v34 = arith.constant 16 : i32; + v34 = arith.constant 32 : i32; v35 = arith.sub v33, v34 : i32 #[overflow = wrapping]; v36 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr v37 = hir.bitcast v36 : ptr; @@ -41,127 +41,228 @@ builtin.component miden:base/note-script@1.0.0 { hir.exec @miden:base/note-script@1.0.0/component_macros_note/wit_bindgen::rt::run_ctors_once() v38 = arith.constant 11 : i64; v39 = arith.trunc v38 : felt; - v56 = arith.constant 8 : u32; - v55 = hir.bitcast v35 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v147 = arith.constant 8 : u32; - v59 = arith.mod v57, v147 : u32; - hir.assertz v59 #[code = 250]; - v54 = arith.constant 0 : i64; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v54; - v61 = arith.constant 8 : i32; - v62 = arith.add v35, v61 : i32 #[overflow = wrapping]; - v126 = arith.constant 66 : felt; - v127 = arith.constant 77 : felt; - v128 = arith.constant 88 : felt; - v129 = arith.constant 99 : felt; + v55 = arith.constant 28 : u32; + v54 = hir.bitcast v35 : u32; + v56 = arith.add v54, v55 : u32 #[overflow = checked]; + v57 = arith.constant 4 : u32; + v58 = arith.mod v56, v57 : u32; + hir.assertz v58 #[code = 250]; + v52 = arith.constant 66 : i64; + v53 = arith.trunc v52 : felt; + v59 = hir.int_to_ptr v56 : ptr; + hir.store v59, v53; + v61 = arith.constant 24 : u32; + v60 = hir.bitcast v35 : u32; + v62 = arith.add v60, v61 : u32 #[overflow = checked]; + v230 = arith.constant 4 : u32; + v64 = arith.mod v62, v230 : u32; + hir.assertz v64 #[code = 250]; + v50 = arith.constant 77 : i64; + v51 = arith.trunc v50 : felt; + v65 = hir.int_to_ptr v62 : ptr; + hir.store v65, v51; + v67 = arith.constant 20 : u32; + v66 = hir.bitcast v35 : u32; + v68 = arith.add v66, v67 : u32 #[overflow = checked]; + v229 = arith.constant 4 : u32; + v70 = arith.mod v68, v229 : u32; + hir.assertz v70 #[code = 250]; + v48 = arith.constant 88 : i64; + v49 = arith.trunc v48 : felt; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v49; + v73 = arith.constant 16 : u32; + v72 = hir.bitcast v35 : u32; + v74 = arith.add v72, v73 : u32 #[overflow = checked]; + v228 = arith.constant 4 : u32; + v76 = arith.mod v74, v228 : u32; + hir.assertz v76 #[code = 250]; + v46 = arith.constant 99 : i64; + v47 = arith.trunc v46 : felt; + v77 = hir.int_to_ptr v74 : ptr; + hir.store v77, v47; + v78 = arith.constant 16 : i32; + v79 = arith.add v35, v78 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/component_macros_note/>::from(v35, v79) + v80 = hir.bitcast v35 : u32; + v227 = arith.constant 4 : u32; + v82 = arith.mod v80, v227 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : felt; + v226 = arith.constant 4 : u32; + v85 = hir.bitcast v35 : u32; + v87 = arith.add v85, v226 : u32 #[overflow = checked]; + v225 = arith.constant 4 : u32; + v89 = arith.mod v87, v225 : u32; + hir.assertz v89 #[code = 250]; + v90 = hir.int_to_ptr v87 : ptr; + v91 = hir.load v90 : felt; + v93 = arith.constant 8 : u32; + v92 = hir.bitcast v35 : u32; + v94 = arith.add v92, v93 : u32 #[overflow = checked]; + v224 = arith.constant 4 : u32; + v96 = arith.mod v94, v224 : u32; + hir.assertz v96 #[code = 250]; + v97 = hir.int_to_ptr v94 : ptr; + v98 = hir.load v97 : felt; + v100 = arith.constant 12 : u32; + v99 = hir.bitcast v35 : u32; + v101 = arith.add v99, v100 : u32 #[overflow = checked]; + v223 = arith.constant 4 : u32; + v103 = arith.mod v101, v223 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : felt; + v222 = arith.constant 16 : u32; + v107 = hir.bitcast v35 : u32; + v109 = arith.add v107, v222 : u32 #[overflow = checked]; + v221 = arith.constant 8 : u32; + v111 = arith.mod v109, v221 : u32; + hir.assertz v111 #[code = 250]; + v106 = arith.constant 0 : i64; + v112 = hir.int_to_ptr v109 : ptr; + hir.store v112, v106; + v220 = arith.constant 16 : i32; + v114 = arith.add v35, v220 : i32 #[overflow = wrapping]; v44 = arith.constant 44 : i64; v45 = arith.trunc v44 : felt; v42 = arith.constant 33 : i64; v43 = arith.trunc v42 : felt; v40 = arith.constant 22 : i64; v41 = arith.trunc v40 : felt; - hir.exec @miden:base/note-script@1.0.0/component_macros_note/component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22(v39, v41, v43, v45, v129, v128, v127, v126, v129, v128, v127, v126, v62) - v64 = arith.constant 12 : u32; - v63 = hir.bitcast v35 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v66 = arith.constant 4 : u32; - v67 = arith.mod v65, v66 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - v69 = hir.load v68 : felt; - v146 = arith.constant 8 : u32; - v70 = hir.bitcast v35 : u32; - v72 = arith.add v70, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v74 = arith.mod v72, v145 : u32; - hir.assertz v74 #[code = 250]; - v75 = hir.int_to_ptr v72 : ptr; - v76 = hir.load v75 : felt; + hir.exec @miden:base/note-script@1.0.0/component_macros_note/component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import19(v39, v41, v43, v45, v84, v91, v98, v105, v84, v91, v98, v105, v114) + v219 = arith.constant 20 : u32; + v115 = hir.bitcast v35 : u32; + v117 = arith.add v115, v219 : u32 #[overflow = checked]; + v218 = arith.constant 4 : u32; + v119 = arith.mod v117, v218 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v217 = arith.constant 16 : u32; + v122 = hir.bitcast v35 : u32; + v124 = arith.add v122, v217 : u32 #[overflow = checked]; + v216 = arith.constant 4 : u32; + v126 = arith.mod v124, v216 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + v128 = hir.load v127 : felt; v29 = arith.constant 0 : i32; - v79 = arith.constant 1 : i32; - v77 = arith.eq v76, v39 : i1; - v78 = hir.cast v77 : i32; - v80 = arith.neq v78, v79 : i1; - v81 = arith.zext v80 : u32; - v82 = hir.bitcast v81 : i32; - v84 = arith.neq v82, v29 : i1; - v134 = scf.if v84 : u32 { - ^block24: - v130 = arith.constant 0 : u32; - scf.yield v130; + v131 = arith.constant 1 : i32; + v129 = arith.eq v128, v39 : i1; + v130 = hir.cast v129 : i32; + v132 = arith.neq v130, v131 : i1; + v133 = arith.zext v132 : u32; + v134 = hir.bitcast v133 : i32; + v136 = arith.neq v134, v29 : i1; + v206 = scf.if v136 : u32 { + ^block26: + v202 = arith.constant 0 : u32; + scf.yield v202; } else { ^block15: - v142 = arith.constant 0 : i32; - v143 = arith.constant 1 : i32; - v144 = arith.constant 99 : felt; - v85 = arith.eq v69, v144 : i1; - v86 = hir.cast v85 : i32; - v88 = arith.neq v86, v143 : i1; - v89 = arith.zext v88 : u32; - v90 = hir.bitcast v89 : i32; - v92 = arith.neq v90, v142 : i1; - scf.if v92{ - ^block23: + v214 = arith.constant 0 : i32; + v215 = arith.constant 1 : i32; + v137 = arith.eq v121, v84 : i1; + v138 = hir.cast v137 : i32; + v140 = arith.neq v138, v215 : i1; + v141 = arith.zext v140 : u32; + v142 = hir.bitcast v141 : i32; + v144 = arith.neq v142, v214 : i1; + scf.if v144{ + ^block25: scf.yield ; } else { ^block16: - v141 = arith.constant 16 : i32; - v94 = arith.add v35, v141 : i32 #[overflow = wrapping]; - v95 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr - v96 = hir.bitcast v95 : ptr; - hir.store v96, v94; + v213 = arith.constant 32 : i32; + v146 = arith.add v35, v213 : i32 #[overflow = wrapping]; + v147 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/__stack_pointer : ptr + v148 = hir.bitcast v147 : ptr; + hir.store v148, v146; scf.yield ; }; - v132 = arith.constant 1 : u32; - v140 = arith.constant 0 : u32; - v138 = cf.select v92, v140, v132 : u32; - scf.yield v138; + v204 = arith.constant 1 : u32; + v212 = arith.constant 0 : u32; + v210 = cf.select v144, v212, v204 : u32; + scf.yield v210; }; - v139 = arith.constant 0 : u32; - v137 = arith.eq v134, v139 : i1; - cf.cond_br v137 ^block14, ^block26; + v211 = arith.constant 0 : u32; + v209 = arith.eq v206, v211 : i1; + cf.cond_br v209 ^block14, ^block28; ^block14: ub.unreachable ; - ^block26: + ^block28: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block17: - v98 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr - v99 = hir.bitcast v98 : ptr; - v100 = hir.load v99 : i32; - v101 = arith.constant 1048588 : i32; - v102 = arith.add v100, v101 : i32 #[overflow = wrapping]; - v103 = hir.bitcast v102 : u32; - v104 = hir.int_to_ptr v103 : ptr; - v105 = hir.load v104 : u8; - v97 = arith.constant 0 : i32; - v106 = arith.zext v105 : u32; - v107 = hir.bitcast v106 : i32; - v109 = arith.neq v107, v97 : i1; - scf.if v109{ + v150 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr + v151 = hir.bitcast v150 : ptr; + v152 = hir.load v151 : i32; + v153 = arith.constant 1048588 : i32; + v154 = arith.add v152, v153 : i32 #[overflow = wrapping]; + v155 = hir.bitcast v154 : u32; + v156 = hir.int_to_ptr v155 : ptr; + v157 = hir.load v156 : u8; + v149 = arith.constant 0 : i32; + v158 = arith.zext v157 : u32; + v159 = hir.bitcast v158 : i32; + v161 = arith.neq v159, v149 : i1; + scf.if v161{ ^block19: scf.yield ; } else { ^block20: - v110 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr - v111 = hir.bitcast v110 : ptr; - v112 = hir.load v111 : i32; + v162 = builtin.global_symbol @miden:base/note-script@1.0.0/component_macros_note/GOT.data.internal.__memory_base : ptr + v163 = hir.bitcast v162 : ptr; + v164 = hir.load v163 : i32; hir.exec @miden:base/note-script@1.0.0/component_macros_note/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048588 : i32; - v114 = arith.add v112, v151 : i32 #[overflow = wrapping]; - v118 = hir.bitcast v114 : u32; - v119 = hir.int_to_ptr v118 : ptr; - hir.store v119, v149; + v232 = arith.constant 1 : u8; + v234 = arith.constant 1048588 : i32; + v166 = arith.add v164, v234 : i32 #[overflow = wrapping]; + v170 = hir.bitcast v166 : u32; + v171 = hir.int_to_ptr v170 : ptr; + hir.store v171, v232; scf.yield ; }; builtin.ret ; }; + private builtin.function @>::from(v172: i32, v173: i32) { + ^block21(v172: i32, v173: i32): + v175 = arith.constant 8 : u32; + v174 = hir.bitcast v173 : u32; + v176 = arith.add v174, v175 : u32 #[overflow = checked]; + v177 = arith.constant 4 : u32; + v178 = arith.mod v176, v177 : u32; + hir.assertz v178 #[code = 250]; + v179 = hir.int_to_ptr v176 : ptr; + v180 = hir.load v179 : i64; + v238 = arith.constant 8 : u32; + v181 = hir.bitcast v172 : u32; + v183 = arith.add v181, v238 : u32 #[overflow = checked]; + v237 = arith.constant 8 : u32; + v185 = arith.mod v183, v237 : u32; + hir.assertz v185 #[code = 250]; + v186 = hir.int_to_ptr v183 : ptr; + hir.store v186, v180; + v187 = hir.bitcast v173 : u32; + v236 = arith.constant 4 : u32; + v189 = arith.mod v187, v236 : u32; + hir.assertz v189 #[code = 250]; + v190 = hir.int_to_ptr v187 : ptr; + v191 = hir.load v190 : i64; + v192 = hir.bitcast v172 : u32; + v235 = arith.constant 8 : u32; + v194 = arith.mod v192, v235 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v191; + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -173,9 +274,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v120: felt, v121: felt, v122: felt, v123: felt) { - ^block21(v120: felt, v121: felt, v122: felt, v123: felt): - hir.exec @miden:base/note-script@1.0.0/component_macros_note/miden:base/note-script@1.0.0#run(v120, v121, v122, v123) + public builtin.function @run(v196: felt, v197: felt, v198: felt, v199: felt) { + ^block23(v196: felt, v197: felt, v198: felt, v199: felt): + hir.exec @miden:base/note-script@1.0.0/component_macros_note/miden:base/note-script@1.0.0#run(v196, v197, v198, v199) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/component_macros_note.masm b/tests/integration/expected/rust_sdk/component_macros_note.masm index 3620aaf90..3aa2cfd2b 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.masm +++ b/tests/integration/expected/rust_sdk/component_macros_note.masm @@ -35,7 +35,7 @@ end # mod ::"miden:base/note-script@1.0.0"::component_macros_note @callconv("C") -proc component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22( +proc component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import19( felt, felt, felt, @@ -109,7 +109,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub push.1114144 dup.1 @@ -130,10 +130,172 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) push.0 mul.4294967296 add - push.8 + push.28 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.66 + push.0 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.77 + push.0 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.88 + push.0 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 dup.2 add u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.99 + push.0 + mul.4294967296 + add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::component_macros_note::>::from + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.16 + dup.6 + add + u32assert push.8 dup.1 swap.1 @@ -152,13 +314,9 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::store_dw trace.252 nop - push.8 - dup.2 + push.16 + dup.6 u32wrapping_add - push.66 - push.77 - push.88 - push.99 push.44 push.0 mul.4294967296 @@ -172,29 +330,30 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) mul.4294967296 add dup.8 - dup.4 - dup.6 dup.8 - dup.10 + dup.9 + dup.9 + dup.9 + dup.9 + movup.3 + swap.8 + movdn.3 + swap.11 + swap.6 swap.1 swap.10 - swap.6 + swap.7 swap.2 swap.9 + swap.12 swap.5 - swap.1 - swap.11 - swap.7 - swap.3 - swap.8 - swap.4 trace.240 nop - exec.::"miden:base/note-script@1.0.0"::component_macros_note::component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 + exec.::"miden:base/note-script@1.0.0"::component_macros_note::component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import19 trace.252 nop - push.12 - dup.2 + push.20 + dup.3 add u32assert push.4 @@ -210,8 +369,8 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.3 + push.16 + dup.4 add u32assert push.4 @@ -230,18 +389,19 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) push.0 push.1 movup.2 - movup.4 + movup.5 eq neq neq if.true + drop drop drop push.0 else push.0 push.1 - push.99 + movup.2 movup.3 eq neq @@ -251,7 +411,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.1 drop else - push.16 + push.32 movup.2 u32wrapping_add push.1114144 @@ -352,3 +512,78 @@ proc wit_bindgen::rt::run_ctors_once( end end +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + diff --git a/tests/integration/expected/rust_sdk/component_macros_note.wat b/tests/integration/expected/rust_sdk/component_macros_note.wat index 5a551b2bf..b40d3ba41 100644 --- a/tests/integration/expected/rust_sdk/component_macros_note.wat +++ b/tests/integration/expected/rust_sdk/component_macros_note.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -36,9 +35,9 @@ (type (;1;) (func)) (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param f32 f32) (result i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param i64) (result f32))) - (import "miden:component-macros-account/component-macros-account@0.1.0" "test-custom-types" (func $component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 (;0;) (type 0))) + (type (;4;) (func (param i64) (result f32))) + (type (;5;) (func (param i32 i32))) + (import "miden:component-macros-account/component-macros-account@0.1.0" "test-custom-types" (func $component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import19 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -51,7 +50,7 @@ (func $miden:base/note-script@1.0.0#run (;3;) (type 2) (param f32 f32 f32 f32) (local i32 f32 f32 f32 f32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 4 global.set $__stack_pointer @@ -68,21 +67,48 @@ i64.const 44 call $intrinsics::felt::from_u64_unchecked local.set 8 - i32.const 99 - call $intrinsics::felt::from_u32 + i64.const 99 + call $intrinsics::felt::from_u64_unchecked local.set 9 - i32.const 88 - call $intrinsics::felt::from_u32 + i64.const 88 + call $intrinsics::felt::from_u64_unchecked local.set 10 - i32.const 77 - call $intrinsics::felt::from_u32 + i64.const 77 + call $intrinsics::felt::from_u64_unchecked local.set 11 - i32.const 66 - call $intrinsics::felt::from_u32 + local.get 4 + i64.const 66 + call $intrinsics::felt::from_u64_unchecked + f32.store offset=28 + local.get 4 + local.get 11 + f32.store offset=24 + local.get 4 + local.get 10 + f32.store offset=20 + local.get 4 + local.get 9 + f32.store offset=16 + local.get 4 + local.get 4 + i32.const 16 + i32.add + call $>::from + local.get 4 + f32.load + local.set 9 + local.get 4 + f32.load offset=4 + local.set 10 + local.get 4 + f32.load offset=8 + local.set 11 + local.get 4 + f32.load offset=12 local.set 12 local.get 4 i64.const 0 - i64.store offset=8 + i64.store offset=16 local.get 5 local.get 6 local.get 7 @@ -96,15 +122,15 @@ local.get 11 local.get 12 local.get 4 - i32.const 8 + i32.const 16 i32.add - call $component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import22 + call $component_macros_note::bindings::miden::component_macros_account::component_macros_account::test_custom_types::wit_import19 local.get 4 - f32.load offset=12 + f32.load offset=20 local.set 10 block ;; label = @1 local.get 4 - f32.load offset=8 + f32.load offset=16 local.get 5 call $intrinsics::felt::eq i32.const 1 @@ -117,7 +143,7 @@ i32.ne br_if 0 (;@1;) local.get 4 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer return @@ -145,11 +171,18 @@ (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;7;) (type 5) (param i64) (result f32) - unreachable + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) @@ -212,15 +245,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.hir b/tests/integration/expected/rust_sdk/cross_ctx_account.hir index 4f6341176..24f3e5117 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.hir @@ -22,51 +22,53 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { v9 = arith.constant 4 : u32; v10 = arith.mod v8, v9 : u32; hir.assertz v10 #[code = 250]; - v11 = hir.int_to_ptr v8 : ptr; - v12 = hir.load v11 : i32; - v13 = hir.bitcast v12 : felt; - v14 = arith.add v0, v13 : felt #[overflow = unchecked]; - v18 = hir.bitcast v7 : u32; - v47 = arith.constant 4 : u32; - v20 = arith.mod v18, v47 : u32; - hir.assertz v20 #[code = 250]; - v15 = hir.cast v14 : i64; - v16 = hir.bitcast v15 : u64; - v17 = arith.trunc v16 : u32; - v21 = hir.int_to_ptr v18 : ptr; - hir.store v21, v17; - builtin.ret v14; + v11 = hir.int_to_ptr v8 : ptr; + v12 = hir.load v11 : u32; + v13 = arith.zext v12 : u64; + v14 = hir.bitcast v13 : i64; + v15 = arith.trunc v14 : felt; + v16 = arith.add v0, v15 : felt #[overflow = unchecked]; + v20 = hir.bitcast v7 : u32; + v49 = arith.constant 4 : u32; + v22 = arith.mod v20, v49 : u32; + hir.assertz v22 #[code = 250]; + v17 = hir.cast v16 : i64; + v18 = hir.bitcast v17 : u64; + v19 = arith.trunc v18 : u32; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v19; + builtin.ret v16; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block11: - v23 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr - v24 = hir.bitcast v23 : ptr; - v25 = hir.load v24 : i32; - v26 = arith.constant 1048588 : i32; - v27 = arith.add v25, v26 : i32 #[overflow = wrapping]; - v28 = hir.bitcast v27 : u32; - v29 = hir.int_to_ptr v28 : ptr; - v30 = hir.load v29 : u8; - v22 = arith.constant 0 : i32; - v31 = arith.zext v30 : u32; - v32 = hir.bitcast v31 : i32; - v34 = arith.neq v32, v22 : i1; - scf.if v34{ + v25 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr + v26 = hir.bitcast v25 : ptr; + v27 = hir.load v26 : i32; + v28 = arith.constant 1048588 : i32; + v29 = arith.add v27, v28 : i32 #[overflow = wrapping]; + v30 = hir.bitcast v29 : u32; + v31 = hir.int_to_ptr v30 : ptr; + v32 = hir.load v31 : u8; + v24 = arith.constant 0 : i32; + v33 = arith.zext v32 : u32; + v34 = hir.bitcast v33 : i32; + v36 = arith.neq v34, v24 : i1; + scf.if v36{ ^block13: scf.yield ; } else { ^block14: - v35 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr - v36 = hir.bitcast v35 : ptr; - v37 = hir.load v36 : i32; + v37 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr + v38 = hir.bitcast v37 : ptr; + v39 = hir.load v38 : i32; hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/__wasm_call_ctors() - v49 = arith.constant 1 : u8; - v51 = arith.constant 1048588 : i32; - v39 = arith.add v37, v51 : i32 #[overflow = wrapping]; - v43 = hir.bitcast v39 : u32; - v44 = hir.int_to_ptr v43 : ptr; - hir.store v44, v49; + v51 = arith.constant 1 : u8; + v53 = arith.constant 1048588 : i32; + v41 = arith.add v39, v53 : i32 #[overflow = wrapping]; + v45 = hir.bitcast v41 : u32; + v46 = hir.int_to_ptr v45 : ptr; + hir.store v46, v51; scf.yield ; }; builtin.ret ; @@ -83,9 +85,9 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { builtin.segment @1048576 = 0x0000002a0000000100000001; }; - public builtin.function @process-felt(v45: felt) -> felt { - ^block15(v45: felt): - v46 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/miden:cross-ctx-account/foo@1.0.0#process-felt(v45) : felt - builtin.ret v46; + public builtin.function @process-felt(v47: felt) -> felt { + ^block15(v47: felt): + v48 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/miden:cross-ctx-account/foo@1.0.0#process-felt(v47) : felt + builtin.ret v48; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.masm b/tests/integration/expected/rust_sdk/cross_ctx_account.masm index 90ef46a13..f4c862069 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.masm @@ -79,6 +79,9 @@ proc miden:cross-ctx-account/foo@1.0.0#process-felt(felt) -> felt exec.::intrinsics::mem::load_sw trace.252 nop + push.0 + mul.4294967296 + add movup.2 add swap.1 diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.wat b/tests/integration/expected/rust_sdk/cross_ctx_account.wat index 4baffb323..589e0cca6 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.wat @@ -11,7 +11,7 @@ (type (;1;) (func (param f32) (result f32))) (type (;2;) (func (param f32 f32) (result f32))) (type (;3;) (func (param f32) (result i64))) - (type (;4;) (func (param i32) (result f32))) + (type (;4;) (func (param i64) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -31,8 +31,8 @@ local.get 1 local.get 0 local.get 1 - i32.load - call $intrinsics::felt::from_u32 + i64.load32_u + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.tee 0 call $intrinsics::felt::as_u64 @@ -63,7 +63,7 @@ (func $intrinsics::felt::as_u64 (;5;) (type 3) (param f32) (result i64) unreachable ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00*\00\00\00") diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir b/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir index 85c0daaa2..edb4933b1 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir @@ -24,36 +24,40 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; - v477 = arith.constant 5 : felt; - v22 = arith.add v3, v477 : felt #[overflow = unchecked]; + v20 = arith.constant 5 : i64; + v21 = arith.trunc v20 : felt; + v22 = arith.add v3, v21 : felt #[overflow = unchecked]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v30 = arith.constant 8 : u32; v29 = hir.bitcast v19 : u32; v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v484 = arith.constant 4 : u32; - v33 = arith.mod v31, v484 : u32; + v476 = arith.constant 4 : u32; + v33 = arith.mod v31, v476 : u32; hir.assertz v33 #[code = 250]; - v478 = arith.constant 4 : felt; - v17 = arith.add v2, v478 : felt #[overflow = unchecked]; + v15 = arith.constant 4 : i64; + v16 = arith.trunc v15 : felt; + v17 = arith.add v2, v16 : felt #[overflow = unchecked]; v34 = hir.int_to_ptr v31 : ptr; hir.store v34, v17; - v483 = arith.constant 4 : u32; + v475 = arith.constant 4 : u32; v35 = hir.bitcast v19 : u32; - v37 = arith.add v35, v483 : u32 #[overflow = checked]; - v482 = arith.constant 4 : u32; - v39 = arith.mod v37, v482 : u32; + v37 = arith.add v35, v475 : u32 #[overflow = checked]; + v474 = arith.constant 4 : u32; + v39 = arith.mod v37, v474 : u32; hir.assertz v39 #[code = 250]; - v479 = arith.constant 3 : felt; - v14 = arith.add v1, v479 : felt #[overflow = unchecked]; + v12 = arith.constant 3 : i64; + v13 = arith.trunc v12 : felt; + v14 = arith.add v1, v13 : felt #[overflow = unchecked]; v40 = hir.int_to_ptr v37 : ptr; hir.store v40, v14; v41 = hir.bitcast v19 : u32; - v481 = arith.constant 4 : u32; - v43 = arith.mod v41, v481 : u32; + v473 = arith.constant 4 : u32; + v43 = arith.mod v41, v473 : u32; hir.assertz v43 #[code = 250]; - v480 = arith.constant 2 : felt; - v11 = arith.add v0, v480 : felt #[overflow = unchecked]; + v9 = arith.constant 2 : i64; + v10 = arith.trunc v9 : felt; + v11 = arith.add v0, v10 : felt #[overflow = unchecked]; v44 = hir.int_to_ptr v41 : ptr; hir.store v44, v11; builtin.ret v19; @@ -62,8 +66,9 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { private builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-felt(v45: felt) -> felt { ^block11(v45: felt): hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen::rt::run_ctors_once() - v485 = arith.constant 3 : felt; - v49 = arith.add v45, v485 : felt #[overflow = unchecked]; + v47 = arith.constant 3 : i64; + v48 = arith.trunc v47 : felt; + v49 = arith.add v45, v48 : felt #[overflow = unchecked]; builtin.ret v49; }; @@ -115,15 +120,16 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v103 = arith.constant 4 : u32; v104 = arith.mod v102, v103 : u32; hir.assertz v104 #[code = 250]; - v486 = arith.constant 7 : felt; - v67 = arith.add v53, v486 : felt #[overflow = unchecked]; + v65 = arith.constant 7 : i64; + v66 = arith.trunc v65 : felt; + v67 = arith.add v53, v66 : felt #[overflow = unchecked]; v105 = hir.int_to_ptr v102 : ptr; hir.store v105, v67; v109 = arith.constant 12 : u32; v108 = hir.bitcast v69 : u32; v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v490 = arith.constant 4 : u32; - v112 = arith.mod v110, v490 : u32; + v479 = arith.constant 4 : u32; + v112 = arith.mod v110, v479 : u32; hir.assertz v112 #[code = 250]; v106 = arith.constant 10 : i32; v107 = arith.add v52, v106 : i32 #[overflow = wrapping]; @@ -132,16 +138,17 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v115 = arith.constant 8 : u32; v114 = hir.bitcast v69 : u32; v116 = arith.add v114, v115 : u32 #[overflow = checked]; - v489 = arith.constant 4 : u32; - v118 = arith.mod v116, v489 : u32; + v478 = arith.constant 4 : u32; + v118 = arith.mod v116, v478 : u32; hir.assertz v118 #[code = 250]; - v487 = arith.constant 6 : felt; - v64 = arith.add v51, v487 : felt #[overflow = unchecked]; + v62 = arith.constant 6 : i64; + v63 = arith.trunc v62 : felt; + v64 = arith.add v51, v63 : felt #[overflow = unchecked]; v119 = hir.int_to_ptr v116 : ptr; hir.store v119, v64; v122 = hir.bitcast v69 : u32; - v488 = arith.constant 8 : u32; - v124 = arith.mod v122, v488 : u32; + v477 = arith.constant 8 : u32; + v124 = arith.mod v122, v477 : u32; hir.assertz v124 #[code = 250]; v120 = arith.constant 1000 : i64; v121 = arith.add v50, v120 : i64 #[overflow = wrapping]; @@ -164,26 +171,29 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v148 = arith.constant 4 : u32; v149 = arith.mod v147, v148 : u32; hir.assertz v149 #[code = 250]; - v493 = arith.constant 8 : felt; - v144 = arith.add v128, v493 : felt #[overflow = unchecked]; + v134 = arith.constant 8 : i64; + v143 = arith.trunc v134 : felt; + v144 = arith.add v128, v143 : felt #[overflow = unchecked]; v150 = hir.int_to_ptr v147 : ptr; hir.store v150, v144; - v498 = arith.constant 4 : u32; + v484 = arith.constant 4 : u32; v151 = hir.bitcast v141 : u32; - v153 = arith.add v151, v498 : u32 #[overflow = checked]; - v497 = arith.constant 4 : u32; - v155 = arith.mod v153, v497 : u32; + v153 = arith.add v151, v484 : u32 #[overflow = checked]; + v483 = arith.constant 4 : u32; + v155 = arith.mod v153, v483 : u32; hir.assertz v155 #[code = 250]; - v496 = arith.constant 8 : felt; - v139 = arith.add v127, v496 : felt #[overflow = unchecked]; + v482 = arith.constant 8 : i64; + v138 = arith.trunc v482 : felt; + v139 = arith.add v127, v138 : felt #[overflow = unchecked]; v156 = hir.int_to_ptr v153 : ptr; hir.store v156, v139; v157 = hir.bitcast v141 : u32; - v495 = arith.constant 4 : u32; - v159 = arith.mod v157, v495 : u32; + v481 = arith.constant 4 : u32; + v159 = arith.mod v157, v481 : u32; hir.assertz v159 #[code = 250]; - v494 = arith.constant 8 : felt; - v136 = arith.add v126, v494 : felt #[overflow = unchecked]; + v480 = arith.constant 8 : i64; + v135 = arith.trunc v480 : felt; + v136 = arith.add v126, v135 : felt #[overflow = unchecked]; v160 = hir.int_to_ptr v157 : ptr; hir.store v160, v136; builtin.ret v141; @@ -200,19 +210,21 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v177 = arith.constant 4 : u32; v176 = hir.bitcast v172 : u32; v178 = arith.add v176, v177 : u32 #[overflow = checked]; - v503 = arith.constant 4 : u32; - v180 = arith.mod v178, v503 : u32; + v487 = arith.constant 4 : u32; + v180 = arith.mod v178, v487 : u32; hir.assertz v180 #[code = 250]; - v500 = arith.constant 4 : felt; - v175 = arith.add v162, v500 : felt #[overflow = unchecked]; + v168 = arith.constant 4 : i64; + v174 = arith.trunc v168 : felt; + v175 = arith.add v162, v174 : felt #[overflow = unchecked]; v181 = hir.int_to_ptr v178 : ptr; hir.store v181, v175; v182 = hir.bitcast v172 : u32; - v502 = arith.constant 4 : u32; - v184 = arith.mod v182, v502 : u32; + v486 = arith.constant 4 : u32; + v184 = arith.mod v182, v486 : u32; hir.assertz v184 #[code = 250]; - v501 = arith.constant 4 : felt; - v170 = arith.add v161, v501 : felt #[overflow = unchecked]; + v485 = arith.constant 4 : i64; + v169 = arith.trunc v485 : felt; + v170 = arith.add v161, v169 : felt #[overflow = unchecked]; v185 = hir.int_to_ptr v182 : ptr; hir.store v185, v170; builtin.ret v172; @@ -232,26 +244,29 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v208 = arith.constant 4 : u32; v209 = arith.mod v207, v208 : u32; hir.assertz v209 #[code = 250]; - v506 = arith.constant 5 : felt; - v204 = arith.add v188, v506 : felt #[overflow = unchecked]; + v194 = arith.constant 5 : i64; + v203 = arith.trunc v194 : felt; + v204 = arith.add v188, v203 : felt #[overflow = unchecked]; v210 = hir.int_to_ptr v207 : ptr; hir.store v210, v204; - v511 = arith.constant 4 : u32; + v492 = arith.constant 4 : u32; v211 = hir.bitcast v201 : u32; - v213 = arith.add v211, v511 : u32 #[overflow = checked]; - v510 = arith.constant 4 : u32; - v215 = arith.mod v213, v510 : u32; + v213 = arith.add v211, v492 : u32 #[overflow = checked]; + v491 = arith.constant 4 : u32; + v215 = arith.mod v213, v491 : u32; hir.assertz v215 #[code = 250]; - v509 = arith.constant 5 : felt; - v199 = arith.add v187, v509 : felt #[overflow = unchecked]; + v490 = arith.constant 5 : i64; + v198 = arith.trunc v490 : felt; + v199 = arith.add v187, v198 : felt #[overflow = unchecked]; v216 = hir.int_to_ptr v213 : ptr; hir.store v216, v199; v217 = hir.bitcast v201 : u32; - v508 = arith.constant 4 : u32; - v219 = arith.mod v217, v508 : u32; + v489 = arith.constant 4 : u32; + v219 = arith.mod v217, v489 : u32; hir.assertz v219 #[code = 250]; - v507 = arith.constant 5 : felt; - v196 = arith.add v186, v507 : felt #[overflow = unchecked]; + v488 = arith.constant 5 : i64; + v195 = arith.trunc v488 : felt; + v196 = arith.add v186, v195 : felt #[overflow = unchecked]; v220 = hir.int_to_ptr v217 : ptr; hir.store v220, v196; builtin.ret v201; @@ -271,36 +286,40 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v247 = arith.constant 4 : u32; v248 = arith.mod v246, v247 : u32; hir.assertz v248 #[code = 250]; - v512 = arith.constant 4 : felt; - v243 = arith.add v224, v512 : felt #[overflow = unchecked]; + v241 = arith.constant 4 : i64; + v242 = arith.trunc v241 : felt; + v243 = arith.add v224, v242 : felt #[overflow = unchecked]; v249 = hir.int_to_ptr v246 : ptr; hir.store v249, v243; v251 = arith.constant 8 : u32; v250 = hir.bitcast v240 : u32; v252 = arith.add v250, v251 : u32 #[overflow = checked]; - v519 = arith.constant 4 : u32; - v254 = arith.mod v252, v519 : u32; + v496 = arith.constant 4 : u32; + v254 = arith.mod v252, v496 : u32; hir.assertz v254 #[code = 250]; - v513 = arith.constant 3 : felt; - v238 = arith.add v223, v513 : felt #[overflow = unchecked]; + v236 = arith.constant 3 : i64; + v237 = arith.trunc v236 : felt; + v238 = arith.add v223, v237 : felt #[overflow = unchecked]; v255 = hir.int_to_ptr v252 : ptr; hir.store v255, v238; - v518 = arith.constant 4 : u32; + v495 = arith.constant 4 : u32; v256 = hir.bitcast v240 : u32; - v258 = arith.add v256, v518 : u32 #[overflow = checked]; - v517 = arith.constant 4 : u32; - v260 = arith.mod v258, v517 : u32; + v258 = arith.add v256, v495 : u32 #[overflow = checked]; + v494 = arith.constant 4 : u32; + v260 = arith.mod v258, v494 : u32; hir.assertz v260 #[code = 250]; - v514 = arith.constant 2 : felt; - v235 = arith.add v222, v514 : felt #[overflow = unchecked]; + v233 = arith.constant 2 : i64; + v234 = arith.trunc v233 : felt; + v235 = arith.add v222, v234 : felt #[overflow = unchecked]; v261 = hir.int_to_ptr v258 : ptr; hir.store v261, v235; v262 = hir.bitcast v240 : u32; - v516 = arith.constant 4 : u32; - v264 = arith.mod v262, v516 : u32; + v493 = arith.constant 4 : u32; + v264 = arith.mod v262, v493 : u32; hir.assertz v264 #[code = 250]; - v515 = arith.constant 1 : felt; - v232 = arith.add v221, v515 : felt #[overflow = unchecked]; + v230 = arith.constant 1 : i64; + v231 = arith.trunc v230 : felt; + v232 = arith.add v221, v231 : felt #[overflow = unchecked]; v265 = hir.int_to_ptr v262 : ptr; hir.store v265, v232; builtin.ret v240; @@ -329,12 +348,12 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v280 = hir.bitcast v279 : ptr; v281 = hir.load v280 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/__wasm_call_ctors() - v521 = arith.constant 1 : u8; - v523 = arith.constant 1048608 : i32; - v283 = arith.add v281, v523 : i32 #[overflow = wrapping]; + v498 = arith.constant 1 : u8; + v500 = arith.constant 1048608 : i32; + v283 = arith.add v281, v500 : i32 #[overflow = wrapping]; v287 = hir.bitcast v283 : u32; v288 = hir.int_to_ptr v287 : ptr; - hir.store v288, v521; + hir.store v288, v498; scf.yield ; }; builtin.ret ; @@ -354,176 +373,172 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { public builtin.function @process-word(v289: felt, v290: felt, v291: felt, v292: felt) -> felt, felt, felt, felt { ^block27(v289: felt, v290: felt, v291: felt, v292: felt): v293 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-word(v289, v290, v291, v292) : i32 + v504 = arith.constant 0 : i32; v294 = arith.constant 0 : i32; v295 = arith.add v293, v294 : i32 #[overflow = unchecked]; - v527 = arith.constant 0 : i32; - v528 = arith.constant 0 : i32; - v297 = arith.add v295, v528 : i32 #[overflow = unchecked]; - v299 = arith.add v297, v527 : i32 #[overflow = unchecked]; - v300 = hir.int_to_ptr v299 : ptr; - v301 = hir.load v300 : felt; - v526 = arith.constant 0 : i32; - v302 = arith.constant 4 : i32; - v303 = arith.add v295, v302 : i32 #[overflow = unchecked]; - v305 = arith.add v303, v526 : i32 #[overflow = unchecked]; - v306 = hir.int_to_ptr v305 : ptr; - v307 = hir.load v306 : felt; - v525 = arith.constant 0 : i32; - v308 = arith.constant 8 : i32; - v309 = arith.add v295, v308 : i32 #[overflow = unchecked]; - v311 = arith.add v309, v525 : i32 #[overflow = unchecked]; - v312 = hir.int_to_ptr v311 : ptr; - v313 = hir.load v312 : felt; - v524 = arith.constant 0 : i32; - v314 = arith.constant 12 : i32; - v315 = arith.add v295, v314 : i32 #[overflow = unchecked]; - v317 = arith.add v315, v524 : i32 #[overflow = unchecked]; - v318 = hir.int_to_ptr v317 : ptr; - v319 = hir.load v318 : felt; - builtin.ret v301, v307, v313, v319; + v297 = arith.add v295, v504 : i32 #[overflow = unchecked]; + v298 = hir.int_to_ptr v297 : ptr; + v299 = hir.load v298 : felt; + v503 = arith.constant 0 : i32; + v300 = arith.constant 4 : i32; + v301 = arith.add v293, v300 : i32 #[overflow = unchecked]; + v303 = arith.add v301, v503 : i32 #[overflow = unchecked]; + v304 = hir.int_to_ptr v303 : ptr; + v305 = hir.load v304 : felt; + v502 = arith.constant 0 : i32; + v306 = arith.constant 8 : i32; + v307 = arith.add v293, v306 : i32 #[overflow = unchecked]; + v309 = arith.add v307, v502 : i32 #[overflow = unchecked]; + v310 = hir.int_to_ptr v309 : ptr; + v311 = hir.load v310 : felt; + v501 = arith.constant 0 : i32; + v312 = arith.constant 12 : i32; + v313 = arith.add v293, v312 : i32 #[overflow = unchecked]; + v315 = arith.add v313, v501 : i32 #[overflow = unchecked]; + v316 = hir.int_to_ptr v315 : ptr; + v317 = hir.load v316 : felt; + builtin.ret v299, v305, v311, v317; }; - public builtin.function @process-another-word(v324: felt, v325: felt, v326: felt, v327: felt) -> felt, felt, felt, felt { - ^block29(v324: felt, v325: felt, v326: felt, v327: felt): - v328 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-another-word(v324, v325, v326, v327) : i32 - v329 = arith.constant 0 : i32; - v330 = arith.add v328, v329 : i32 #[overflow = unchecked]; - v532 = arith.constant 0 : i32; - v533 = arith.constant 0 : i32; - v332 = arith.add v330, v533 : i32 #[overflow = unchecked]; - v334 = arith.add v332, v532 : i32 #[overflow = unchecked]; - v335 = hir.int_to_ptr v334 : ptr; - v336 = hir.load v335 : felt; - v531 = arith.constant 0 : i32; - v337 = arith.constant 4 : i32; - v338 = arith.add v330, v337 : i32 #[overflow = unchecked]; - v340 = arith.add v338, v531 : i32 #[overflow = unchecked]; - v341 = hir.int_to_ptr v340 : ptr; - v342 = hir.load v341 : felt; - v530 = arith.constant 0 : i32; - v343 = arith.constant 8 : i32; - v344 = arith.add v330, v343 : i32 #[overflow = unchecked]; - v346 = arith.add v344, v530 : i32 #[overflow = unchecked]; - v347 = hir.int_to_ptr v346 : ptr; - v348 = hir.load v347 : felt; - v529 = arith.constant 0 : i32; - v349 = arith.constant 12 : i32; - v350 = arith.add v330, v349 : i32 #[overflow = unchecked]; - v352 = arith.add v350, v529 : i32 #[overflow = unchecked]; - v353 = hir.int_to_ptr v352 : ptr; - v354 = hir.load v353 : felt; - builtin.ret v336, v342, v348, v354; + public builtin.function @process-another-word(v322: felt, v323: felt, v324: felt, v325: felt) -> felt, felt, felt, felt { + ^block29(v322: felt, v323: felt, v324: felt, v325: felt): + v326 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-another-word(v322, v323, v324, v325) : i32 + v508 = arith.constant 0 : i32; + v327 = arith.constant 0 : i32; + v328 = arith.add v326, v327 : i32 #[overflow = unchecked]; + v330 = arith.add v328, v508 : i32 #[overflow = unchecked]; + v331 = hir.int_to_ptr v330 : ptr; + v332 = hir.load v331 : felt; + v507 = arith.constant 0 : i32; + v333 = arith.constant 4 : i32; + v334 = arith.add v326, v333 : i32 #[overflow = unchecked]; + v336 = arith.add v334, v507 : i32 #[overflow = unchecked]; + v337 = hir.int_to_ptr v336 : ptr; + v338 = hir.load v337 : felt; + v506 = arith.constant 0 : i32; + v339 = arith.constant 8 : i32; + v340 = arith.add v326, v339 : i32 #[overflow = unchecked]; + v342 = arith.add v340, v506 : i32 #[overflow = unchecked]; + v343 = hir.int_to_ptr v342 : ptr; + v344 = hir.load v343 : felt; + v505 = arith.constant 0 : i32; + v345 = arith.constant 12 : i32; + v346 = arith.add v326, v345 : i32 #[overflow = unchecked]; + v348 = arith.add v346, v505 : i32 #[overflow = unchecked]; + v349 = hir.int_to_ptr v348 : ptr; + v350 = hir.load v349 : felt; + builtin.ret v332, v338, v344, v350; }; - public builtin.function @process-felt(v359: felt) -> felt { - ^block31(v359: felt): - v360 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-felt(v359) : felt - builtin.ret v360; + public builtin.function @process-felt(v355: felt) -> felt { + ^block31(v355: felt): + v356 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-felt(v355) : felt + builtin.ret v356; }; - public builtin.function @process-pair(v361: felt, v362: felt) -> felt, felt { - ^block33(v361: felt, v362: felt): - v363 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-pair(v361, v362) : i32 - v535 = arith.constant 0 : i32; - v364 = arith.constant 0 : i32; - v365 = arith.add v363, v364 : i32 #[overflow = unchecked]; - v367 = arith.add v365, v535 : i32 #[overflow = unchecked]; - v368 = hir.int_to_ptr v367 : ptr; - v369 = hir.load v368 : felt; - v534 = arith.constant 0 : i32; - v370 = arith.constant 4 : i32; - v371 = arith.add v363, v370 : i32 #[overflow = unchecked]; - v373 = arith.add v371, v534 : i32 #[overflow = unchecked]; - v374 = hir.int_to_ptr v373 : ptr; - v375 = hir.load v374 : felt; - builtin.ret v369, v375; + public builtin.function @process-pair(v357: felt, v358: felt) -> felt, felt { + ^block33(v357: felt, v358: felt): + v359 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-pair(v357, v358) : i32 + v510 = arith.constant 0 : i32; + v360 = arith.constant 0 : i32; + v361 = arith.add v359, v360 : i32 #[overflow = unchecked]; + v363 = arith.add v361, v510 : i32 #[overflow = unchecked]; + v364 = hir.int_to_ptr v363 : ptr; + v365 = hir.load v364 : felt; + v509 = arith.constant 0 : i32; + v366 = arith.constant 4 : i32; + v367 = arith.add v359, v366 : i32 #[overflow = unchecked]; + v369 = arith.add v367, v509 : i32 #[overflow = unchecked]; + v370 = hir.int_to_ptr v369 : ptr; + v371 = hir.load v370 : felt; + builtin.ret v365, v371; }; - public builtin.function @process-triple(v378: felt, v379: felt, v380: felt) -> felt, felt, felt { - ^block35(v378: felt, v379: felt, v380: felt): - v381 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-triple(v378, v379, v380) : i32 - v538 = arith.constant 0 : i32; - v382 = arith.constant 0 : i32; - v383 = arith.add v381, v382 : i32 #[overflow = unchecked]; - v385 = arith.add v383, v538 : i32 #[overflow = unchecked]; - v386 = hir.int_to_ptr v385 : ptr; - v387 = hir.load v386 : felt; - v537 = arith.constant 0 : i32; - v388 = arith.constant 4 : i32; - v389 = arith.add v381, v388 : i32 #[overflow = unchecked]; - v391 = arith.add v389, v537 : i32 #[overflow = unchecked]; - v392 = hir.int_to_ptr v391 : ptr; - v393 = hir.load v392 : felt; - v536 = arith.constant 0 : i32; - v394 = arith.constant 8 : i32; - v395 = arith.add v381, v394 : i32 #[overflow = unchecked]; - v397 = arith.add v395, v536 : i32 #[overflow = unchecked]; - v398 = hir.int_to_ptr v397 : ptr; - v399 = hir.load v398 : felt; - builtin.ret v387, v393, v399; + public builtin.function @process-triple(v374: felt, v375: felt, v376: felt) -> felt, felt, felt { + ^block35(v374: felt, v375: felt, v376: felt): + v377 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-triple(v374, v375, v376) : i32 + v513 = arith.constant 0 : i32; + v378 = arith.constant 0 : i32; + v379 = arith.add v377, v378 : i32 #[overflow = unchecked]; + v381 = arith.add v379, v513 : i32 #[overflow = unchecked]; + v382 = hir.int_to_ptr v381 : ptr; + v383 = hir.load v382 : felt; + v512 = arith.constant 0 : i32; + v384 = arith.constant 4 : i32; + v385 = arith.add v377, v384 : i32 #[overflow = unchecked]; + v387 = arith.add v385, v512 : i32 #[overflow = unchecked]; + v388 = hir.int_to_ptr v387 : ptr; + v389 = hir.load v388 : felt; + v511 = arith.constant 0 : i32; + v390 = arith.constant 8 : i32; + v391 = arith.add v377, v390 : i32 #[overflow = unchecked]; + v393 = arith.add v391, v511 : i32 #[overflow = unchecked]; + v394 = hir.int_to_ptr v393 : ptr; + v395 = hir.load v394 : felt; + builtin.ret v383, v389, v395; }; - public builtin.function @process-mixed(v403: i64, v404: felt, v405: i32, v406: felt, v407: i32, v408: i32, v409: i32) -> i64, felt, i32, felt, i32, i32, i32 { - ^block37(v403: i64, v404: felt, v405: i32, v406: felt, v407: i32, v408: i32, v409: i32): - v410 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v403, v404, v405, v406, v407, v408, v409) : i32 - v411 = arith.constant 0 : i32; - v412 = arith.add v410, v411 : i32 #[overflow = unchecked]; - v413 = hir.int_to_ptr v412 : ptr; - v414 = hir.load v413 : u64; - v540 = arith.constant 0 : i32; - v415 = arith.constant 8 : i32; - v416 = arith.add v410, v415 : i32 #[overflow = unchecked]; - v418 = arith.add v416, v540 : i32 #[overflow = unchecked]; - v419 = hir.int_to_ptr v418 : ptr; - v420 = hir.load v419 : felt; - v421 = arith.constant 12 : i32; - v422 = arith.add v410, v421 : i32 #[overflow = unchecked]; - v423 = hir.int_to_ptr v422 : ptr; - v424 = hir.load v423 : u32; - v539 = arith.constant 0 : i32; - v425 = arith.constant 16 : i32; - v426 = arith.add v410, v425 : i32 #[overflow = unchecked]; - v428 = arith.add v426, v539 : i32 #[overflow = unchecked]; - v429 = hir.int_to_ptr v428 : ptr; - v430 = hir.load v429 : felt; - v431 = arith.constant 20 : i32; - v432 = arith.add v410, v431 : i32 #[overflow = unchecked]; - v433 = hir.int_to_ptr v432 : ptr; - v434 = hir.load v433 : u8; - v435 = arith.constant 21 : i32; - v436 = arith.add v410, v435 : i32 #[overflow = unchecked]; - v437 = hir.int_to_ptr v436 : ptr; - v438 = hir.load v437 : i1; - v439 = arith.constant 22 : i32; - v440 = arith.add v410, v439 : i32 #[overflow = unchecked]; - v441 = hir.int_to_ptr v440 : ptr; - v442 = hir.load v441 : u16; - builtin.ret v414, v420, v424, v430, v434, v438, v442; + public builtin.function @process-mixed(v399: i64, v400: felt, v401: i32, v402: felt, v403: i32, v404: i32, v405: i32) -> i64, felt, i32, felt, i32, i32, i32 { + ^block37(v399: i64, v400: felt, v401: i32, v402: felt, v403: i32, v404: i32, v405: i32): + v406 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-mixed(v399, v400, v401, v402, v403, v404, v405) : i32 + v407 = arith.constant 0 : i32; + v408 = arith.add v406, v407 : i32 #[overflow = unchecked]; + v409 = hir.int_to_ptr v408 : ptr; + v410 = hir.load v409 : u64; + v515 = arith.constant 0 : i32; + v411 = arith.constant 8 : i32; + v412 = arith.add v406, v411 : i32 #[overflow = unchecked]; + v414 = arith.add v412, v515 : i32 #[overflow = unchecked]; + v415 = hir.int_to_ptr v414 : ptr; + v416 = hir.load v415 : felt; + v417 = arith.constant 12 : i32; + v418 = arith.add v406, v417 : i32 #[overflow = unchecked]; + v419 = hir.int_to_ptr v418 : ptr; + v420 = hir.load v419 : u32; + v514 = arith.constant 0 : i32; + v421 = arith.constant 16 : i32; + v422 = arith.add v406, v421 : i32 #[overflow = unchecked]; + v424 = arith.add v422, v514 : i32 #[overflow = unchecked]; + v425 = hir.int_to_ptr v424 : ptr; + v426 = hir.load v425 : felt; + v427 = arith.constant 20 : i32; + v428 = arith.add v406, v427 : i32 #[overflow = unchecked]; + v429 = hir.int_to_ptr v428 : ptr; + v430 = hir.load v429 : u8; + v431 = arith.constant 21 : i32; + v432 = arith.add v406, v431 : i32 #[overflow = unchecked]; + v433 = hir.int_to_ptr v432 : ptr; + v434 = hir.load v433 : i1; + v435 = arith.constant 22 : i32; + v436 = arith.add v406, v435 : i32 #[overflow = unchecked]; + v437 = hir.int_to_ptr v436 : ptr; + v438 = hir.load v437 : u16; + builtin.ret v410, v416, v420, v426, v430, v434, v438; }; - public builtin.function @process-nested(v450: felt, v451: felt, v452: felt) -> felt, felt, felt { - ^block39(v450: felt, v451: felt, v452: felt): - v453 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-nested(v450, v451, v452) : i32 - v454 = arith.constant 0 : i32; - v455 = arith.add v453, v454 : i32 #[overflow = unchecked]; - v543 = arith.constant 0 : i32; - v544 = arith.constant 0 : i32; - v457 = arith.add v455, v544 : i32 #[overflow = unchecked]; - v459 = arith.add v457, v543 : i32 #[overflow = unchecked]; - v460 = hir.int_to_ptr v459 : ptr; - v461 = hir.load v460 : felt; - v542 = arith.constant 0 : i32; - v462 = arith.constant 4 : i32; - v463 = arith.add v455, v462 : i32 #[overflow = unchecked]; - v465 = arith.add v463, v542 : i32 #[overflow = unchecked]; - v466 = hir.int_to_ptr v465 : ptr; - v467 = hir.load v466 : felt; - v541 = arith.constant 0 : i32; - v468 = arith.constant 8 : i32; - v469 = arith.add v453, v468 : i32 #[overflow = unchecked]; - v471 = arith.add v469, v541 : i32 #[overflow = unchecked]; - v472 = hir.int_to_ptr v471 : ptr; - v473 = hir.load v472 : felt; - builtin.ret v461, v467, v473; + public builtin.function @process-nested(v446: felt, v447: felt, v448: felt) -> felt, felt, felt { + ^block39(v446: felt, v447: felt, v448: felt): + v449 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/miden:cross-ctx-account-word/foo@1.0.0#process-nested(v446, v447, v448) : i32 + v450 = arith.constant 0 : i32; + v451 = arith.add v449, v450 : i32 #[overflow = unchecked]; + v518 = arith.constant 0 : i32; + v519 = arith.constant 0 : i32; + v453 = arith.add v451, v519 : i32 #[overflow = unchecked]; + v455 = arith.add v453, v518 : i32 #[overflow = unchecked]; + v456 = hir.int_to_ptr v455 : ptr; + v457 = hir.load v456 : felt; + v517 = arith.constant 0 : i32; + v458 = arith.constant 4 : i32; + v459 = arith.add v451, v458 : i32 #[overflow = unchecked]; + v461 = arith.add v459, v517 : i32 #[overflow = unchecked]; + v462 = hir.int_to_ptr v461 : ptr; + v463 = hir.load v462 : felt; + v516 = arith.constant 0 : i32; + v464 = arith.constant 8 : i32; + v465 = arith.add v449, v464 : i32 #[overflow = unchecked]; + v467 = arith.add v465, v516 : i32 #[overflow = unchecked]; + v468 = hir.int_to_ptr v467 : ptr; + v469 = hir.load v468 : felt; + builtin.ret v457, v463, v469; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm index c34145479..849c35ee3 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm @@ -9,8 +9,6 @@ pub proc process-word(felt, felt, felt, felt) -> (felt, felt, felt, felt) trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -77,8 +75,6 @@ pub proc process-another-word( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -468,6 +464,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32assert assertz push.5 + push.0 + mul.4294967296 + add movup.6 add swap.1 @@ -489,6 +488,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32assert assertz push.4 + push.0 + mul.4294967296 + add movup.5 add swap.1 @@ -510,6 +512,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32assert assertz push.3 + push.0 + mul.4294967296 + add movup.4 add swap.1 @@ -528,6 +533,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-another-word( u32assert assertz push.2 + push.0 + mul.4294967296 + add movup.3 add swap.1 @@ -548,6 +556,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-felt(felt) -> felt trace.252 nop push.3 + push.0 + mul.4294967296 + add add end @@ -686,6 +697,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32assert assertz push.7 + push.0 + mul.4294967296 + add movup.7 add swap.1 @@ -728,6 +742,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-mixed( u32assert assertz push.6 + push.0 + mul.4294967296 + add movup.5 add swap.1 @@ -798,6 +815,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( u32assert assertz push.8 + push.0 + mul.4294967296 + add movup.5 add swap.1 @@ -819,6 +839,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( u32assert assertz push.8 + push.0 + mul.4294967296 + add movup.4 add swap.1 @@ -837,6 +860,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-nested( u32assert assertz push.8 + push.0 + mul.4294967296 + add movup.3 add swap.1 @@ -877,6 +903,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 u32assert assertz push.4 + push.0 + mul.4294967296 + add movup.4 add swap.1 @@ -895,6 +924,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-pair(felt, felt) -> i32 u32assert assertz push.4 + push.0 + mul.4294967296 + add movup.3 add swap.1 @@ -939,6 +971,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( u32assert assertz push.5 + push.0 + mul.4294967296 + add movup.5 add swap.1 @@ -960,6 +995,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( u32assert assertz push.5 + push.0 + mul.4294967296 + add movup.4 add swap.1 @@ -978,6 +1016,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-triple( u32assert assertz push.5 + push.0 + mul.4294967296 + add movup.3 add swap.1 @@ -1023,6 +1064,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32assert assertz push.4 + push.0 + mul.4294967296 + add movup.6 add swap.1 @@ -1044,6 +1088,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32assert assertz push.3 + push.0 + mul.4294967296 + add movup.5 add swap.1 @@ -1065,6 +1112,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32assert assertz push.2 + push.0 + mul.4294967296 + add movup.4 add swap.1 @@ -1083,6 +1133,9 @@ proc miden:cross-ctx-account-word/foo@1.0.0#process-word( u32assert assertz push.1 + push.0 + mul.4294967296 + add movup.3 add swap.1 diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat b/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat index 2f67b1789..6ffb670be 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -17,7 +16,7 @@ (type (;4;) (func (param f32 f32 f32) (result i32))) (type (;5;) (func (param f32 f32) (result i32))) (type (;6;) (func (param f32 f32) (result f32))) - (type (;7;) (func (param i32) (result f32))) + (type (;7;) (func (param i64) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -39,18 +38,18 @@ local.set 4 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 2 - call $intrinsics::felt::from_u32 + i64.const 2 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 0 local.get 1 - i32.const 3 - call $intrinsics::felt::from_u32 + i64.const 3 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 1 local.get 2 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 2 local.get 4 @@ -58,8 +57,8 @@ i32.add local.tee 4 local.get 3 - i32.const 5 - call $intrinsics::felt::from_u32 + i64.const 5 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add f32.store offset=12 local.get 4 @@ -76,8 +75,8 @@ (func $miden:cross-ctx-account-word/foo@1.0.0#process-felt (;3;) (type 2) (param f32) (result f32) call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 3 - call $intrinsics::felt::from_u32 + i64.const 3 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add ) (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed (;4;) (type 3) (param i64 f32 i32 f32 i32 i32 i32) (result i32) @@ -86,13 +85,13 @@ local.set 7 call $wit_bindgen::rt::run_ctors_once local.get 1 - i32.const 6 - call $intrinsics::felt::from_u32 + i64.const 6 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 1 local.get 3 - i32.const 7 - call $intrinsics::felt::from_u32 + i64.const 7 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 3 local.get 7 @@ -138,13 +137,13 @@ local.set 3 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 8 - call $intrinsics::felt::from_u32 + i64.const 8 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 0 local.get 1 - i32.const 8 - call $intrinsics::felt::from_u32 + i64.const 8 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 1 local.get 3 @@ -152,8 +151,8 @@ i32.add local.tee 3 local.get 2 - i32.const 8 - call $intrinsics::felt::from_u32 + i64.const 8 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add f32.store offset=8 local.get 3 @@ -170,8 +169,8 @@ local.set 2 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 0 local.get 2 @@ -179,8 +178,8 @@ i32.add local.tee 2 local.get 1 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add f32.store offset=4 local.get 2 @@ -194,13 +193,13 @@ local.set 3 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 5 - call $intrinsics::felt::from_u32 + i64.const 5 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 0 local.get 1 - i32.const 5 - call $intrinsics::felt::from_u32 + i64.const 5 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 1 local.get 3 @@ -208,8 +207,8 @@ i32.add local.tee 3 local.get 2 - i32.const 5 - call $intrinsics::felt::from_u32 + i64.const 5 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add f32.store offset=8 local.get 3 @@ -226,18 +225,18 @@ local.set 4 call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 1 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 0 local.get 1 - i32.const 2 - call $intrinsics::felt::from_u32 + i64.const 2 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 1 local.get 2 - i32.const 3 - call $intrinsics::felt::from_u32 + i64.const 3 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add local.set 2 local.get 4 @@ -245,8 +244,8 @@ i32.add local.tee 4 local.get 3 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::add f32.store offset=12 local.get 4 @@ -281,7 +280,7 @@ (func $intrinsics::felt::add (;10;) (type 6) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;11;) (type 7) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;11;) (type 7) (param i64) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") @@ -319,55 +318,54 @@ (component $miden:cross-ctx-account-word/foo@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "input" 5) (result 5))) - (import "import-func-process-word" (func (;0;) (type 6))) - (import "import-func-process-another-word" (func (;1;) (type 6))) - (import "import-type-felt0" (type (;7;) (eq 1))) - (type (;8;) (func (param "input" 7) (result 7))) - (import "import-func-process-felt" (func (;2;) (type 8))) - (type (;9;) (record (field "first" 7) (field "second" 7))) - (import "import-type-pair" (type (;10;) (eq 9))) - (type (;11;) (func (param "input" 10) (result 10))) - (import "import-func-process-pair" (func (;3;) (type 11))) - (type (;12;) (record (field "x" 7) (field "y" 7) (field "z" 7))) - (import "import-type-triple" (type (;13;) (eq 12))) - (type (;14;) (func (param "input" 13) (result 13))) - (import "import-func-process-triple" (func (;4;) (type 14))) - (type (;15;) (record (field "f" u64) (field "a" 7) (field "b" u32) (field "c" 7) (field "d" u8) (field "e" bool) (field "g" u16))) - (import "import-type-mixed-struct" (type (;16;) (eq 15))) - (type (;17;) (func (param "input" 16) (result 16))) - (import "import-func-process-mixed" (func (;5;) (type 17))) - (type (;18;) (record (field "inner" 10) (field "value" 7))) - (import "import-type-nested-struct" (type (;19;) (eq 18))) - (type (;20;) (func (param "input" 19) (result 19))) - (import "import-func-process-nested" (func (;6;) (type 20))) - (export (;21;) "word" (type 4)) - (export (;22;) "felt" (type 1)) - (type (;23;) (record (field "first" 22) (field "second" 22))) - (export (;24;) "pair" (type 23)) - (type (;25;) (record (field "x" 22) (field "y" 22) (field "z" 22))) - (export (;26;) "triple" (type 25)) - (type (;27;) (record (field "f" u64) (field "a" 22) (field "b" u32) (field "c" 22) (field "d" u8) (field "e" bool) (field "g" u16))) - (export (;28;) "mixed-struct" (type 27)) - (type (;29;) (record (field "inner" 24) (field "value" 22))) - (export (;30;) "nested-struct" (type 29)) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "input" 4) (result 4))) + (import "import-func-process-word" (func (;0;) (type 5))) + (import "import-func-process-another-word" (func (;1;) (type 5))) + (import "import-type-felt0" (type (;6;) (eq 1))) + (type (;7;) (func (param "input" 6) (result 6))) + (import "import-func-process-felt" (func (;2;) (type 7))) + (type (;8;) (record (field "first" 6) (field "second" 6))) + (import "import-type-pair" (type (;9;) (eq 8))) + (type (;10;) (func (param "input" 9) (result 9))) + (import "import-func-process-pair" (func (;3;) (type 10))) + (type (;11;) (record (field "x" 6) (field "y" 6) (field "z" 6))) + (import "import-type-triple" (type (;12;) (eq 11))) + (type (;13;) (func (param "input" 12) (result 12))) + (import "import-func-process-triple" (func (;4;) (type 13))) + (type (;14;) (record (field "f" u64) (field "a" 6) (field "b" u32) (field "c" 6) (field "d" u8) (field "e" bool) (field "g" u16))) + (import "import-type-mixed-struct" (type (;15;) (eq 14))) + (type (;16;) (func (param "input" 15) (result 15))) + (import "import-func-process-mixed" (func (;5;) (type 16))) + (type (;17;) (record (field "inner" 9) (field "value" 6))) + (import "import-type-nested-struct" (type (;18;) (eq 17))) + (type (;19;) (func (param "input" 18) (result 18))) + (import "import-func-process-nested" (func (;6;) (type 19))) + (export (;20;) "word" (type 3)) + (export (;21;) "felt" (type 1)) + (type (;22;) (record (field "first" 21) (field "second" 21))) + (export (;23;) "pair" (type 22)) + (type (;24;) (record (field "x" 21) (field "y" 21) (field "z" 21))) + (export (;25;) "triple" (type 24)) + (type (;26;) (record (field "f" u64) (field "a" 21) (field "b" u32) (field "c" 21) (field "d" u8) (field "e" bool) (field "g" u16))) + (export (;27;) "mixed-struct" (type 26)) + (type (;28;) (record (field "inner" 23) (field "value" 21))) + (export (;29;) "nested-struct" (type 28)) + (type (;30;) (func (param "input" 20) (result 20))) + (export (;7;) "process-word" (func 0) (func (type 30))) + (export (;8;) "process-another-word" (func 1) (func (type 30))) (type (;31;) (func (param "input" 21) (result 21))) - (export (;7;) "process-word" (func 0) (func (type 31))) - (export (;8;) "process-another-word" (func 1) (func (type 31))) - (type (;32;) (func (param "input" 22) (result 22))) - (export (;9;) "process-felt" (func 2) (func (type 32))) - (type (;33;) (func (param "input" 24) (result 24))) - (export (;10;) "process-pair" (func 3) (func (type 33))) - (type (;34;) (func (param "input" 26) (result 26))) - (export (;11;) "process-triple" (func 4) (func (type 34))) - (type (;35;) (func (param "input" 28) (result 28))) - (export (;12;) "process-mixed" (func 5) (func (type 35))) - (type (;36;) (func (param "input" 30) (result 30))) - (export (;13;) "process-nested" (func 6) (func (type 36))) + (export (;9;) "process-felt" (func 2) (func (type 31))) + (type (;32;) (func (param "input" 23) (result 23))) + (export (;10;) "process-pair" (func 3) (func (type 32))) + (type (;33;) (func (param "input" 25) (result 25))) + (export (;11;) "process-triple" (func 4) (func (type 33))) + (type (;34;) (func (param "input" 27) (result 27))) + (export (;12;) "process-mixed" (func 5) (func (type 34))) + (type (;35;) (func (param "input" 29) (result 29))) + (export (;13;) "process-nested" (func 6) (func (type 35))) ) (instance $miden:cross-ctx-account-word/foo@1.0.0-shim-instance (;1;) (instantiate $miden:cross-ctx-account-word/foo@1.0.0-shim-component (with "import-func-process-word" (func $process-word)) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir index 5a6e8e533..28203f805 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.hir @@ -14,52 +14,69 @@ builtin.component miden:cross-ctx-account-word-arg/foo@1.0.0 { ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: felt, v13: felt, v14: felt, v15: felt): hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/wit_bindgen::rt::run_ctors_once() hir.store_local v15 #[local = lv0]; - v117 = arith.constant 16384 : felt; - v71 = arith.mul v14, v117 : felt #[overflow = unchecked]; - v118 = arith.constant 8192 : felt; - v67 = arith.mul v13, v118 : felt #[overflow = unchecked]; - v119 = arith.constant 4096 : felt; - v64 = arith.mul v12, v119 : felt #[overflow = unchecked]; + hir.store_local v0 #[local = lv1]; + v69 = arith.constant 16384 : i64; + v70 = arith.trunc v69 : felt; + v71 = arith.mul v14, v70 : felt #[overflow = unchecked]; + v65 = arith.constant 8192 : i64; + v66 = arith.trunc v65 : felt; + v67 = arith.mul v13, v66 : felt #[overflow = unchecked]; + v62 = arith.constant 4096 : i64; + v63 = arith.trunc v62 : felt; + v64 = arith.mul v12, v63 : felt #[overflow = unchecked]; v68 = arith.add v64, v67 : felt #[overflow = unchecked]; v72 = arith.add v68, v71 : felt #[overflow = unchecked]; - v120 = arith.constant 2048 : felt; - v60 = arith.mul v11, v120 : felt #[overflow = unchecked]; - v121 = arith.constant 1024 : felt; - v56 = arith.mul v10, v121 : felt #[overflow = unchecked]; - v122 = arith.constant 512 : felt; - v52 = arith.mul v9, v122 : felt #[overflow = unchecked]; - v123 = arith.constant 256 : felt; - v49 = arith.mul v8, v123 : felt #[overflow = unchecked]; + v58 = arith.constant 2048 : i64; + v59 = arith.trunc v58 : felt; + v60 = arith.mul v11, v59 : felt #[overflow = unchecked]; + v54 = arith.constant 1024 : i64; + v55 = arith.trunc v54 : felt; + v56 = arith.mul v10, v55 : felt #[overflow = unchecked]; + v50 = arith.constant 512 : i64; + v51 = arith.trunc v50 : felt; + v52 = arith.mul v9, v51 : felt #[overflow = unchecked]; + v47 = arith.constant 256 : i64; + v48 = arith.trunc v47 : felt; + v49 = arith.mul v8, v48 : felt #[overflow = unchecked]; v53 = arith.add v49, v52 : felt #[overflow = unchecked]; v57 = arith.add v53, v56 : felt #[overflow = unchecked]; v61 = arith.add v57, v60 : felt #[overflow = unchecked]; - v124 = arith.constant 128 : felt; - v45 = arith.mul v7, v124 : felt #[overflow = unchecked]; - v125 = arith.constant 64 : felt; - v41 = arith.mul v6, v125 : felt #[overflow = unchecked]; - v126 = arith.constant 32 : felt; - v37 = arith.mul v5, v126 : felt #[overflow = unchecked]; - v127 = arith.constant 16 : felt; - v34 = arith.mul v4, v127 : felt #[overflow = unchecked]; + v43 = arith.constant 128 : i64; + v44 = arith.trunc v43 : felt; + v45 = arith.mul v7, v44 : felt #[overflow = unchecked]; + v39 = arith.constant 64 : i64; + v40 = arith.trunc v39 : felt; + v41 = arith.mul v6, v40 : felt #[overflow = unchecked]; + v35 = arith.constant 32 : i64; + v36 = arith.trunc v35 : felt; + v37 = arith.mul v5, v36 : felt #[overflow = unchecked]; + v32 = arith.constant 16 : i64; + v33 = arith.trunc v32 : felt; + v34 = arith.mul v4, v33 : felt #[overflow = unchecked]; v38 = arith.add v34, v37 : felt #[overflow = unchecked]; v42 = arith.add v38, v41 : felt #[overflow = unchecked]; v46 = arith.add v42, v45 : felt #[overflow = unchecked]; - v128 = arith.constant 8 : felt; - v30 = arith.mul v3, v128 : felt #[overflow = unchecked]; - v129 = arith.constant 4 : felt; - v26 = arith.mul v2, v129 : felt #[overflow = unchecked]; - v130 = arith.constant 2 : felt; - v22 = arith.mul v1, v130 : felt #[overflow = unchecked]; - v131 = arith.constant 1 : felt; - v19 = arith.mul v0, v131 : felt #[overflow = unchecked]; + v28 = arith.constant 8 : i64; + v29 = arith.trunc v28 : felt; + v30 = arith.mul v3, v29 : felt #[overflow = unchecked]; + v24 = arith.constant 4 : i64; + v25 = arith.trunc v24 : felt; + v26 = arith.mul v2, v25 : felt #[overflow = unchecked]; + v20 = arith.constant 2 : i64; + v21 = arith.trunc v20 : felt; + v22 = arith.mul v1, v21 : felt #[overflow = unchecked]; + v17 = arith.constant 1 : i64; + v18 = arith.trunc v17 : felt; + v119 = hir.load_local : felt #[local = lv1]; + v19 = arith.mul v119, v18 : felt #[overflow = unchecked]; v23 = arith.add v19, v22 : felt #[overflow = unchecked]; v27 = arith.add v23, v26 : felt #[overflow = unchecked]; v31 = arith.add v27, v30 : felt #[overflow = unchecked]; v73 = arith.add v31, v46 : felt #[overflow = unchecked]; v74 = arith.add v73, v61 : felt #[overflow = unchecked]; v75 = arith.add v74, v72 : felt #[overflow = unchecked]; - v133 = hir.load_local : felt #[local = lv0]; - v76 = arith.add v75, v133 : felt #[overflow = unchecked]; + v120 = hir.load_local : felt #[local = lv0]; + v76 = arith.add v75, v120 : felt #[overflow = unchecked]; builtin.ret v76; }; @@ -86,12 +103,12 @@ builtin.component miden:cross-ctx-account-word-arg/foo@1.0.0 { v91 = hir.bitcast v90 : ptr; v92 = hir.load v91 : i32; hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/__wasm_call_ctors() - v135 = arith.constant 1 : u8; - v137 = arith.constant 1048584 : i32; - v94 = arith.add v92, v137 : i32 #[overflow = wrapping]; + v122 = arith.constant 1 : u8; + v124 = arith.constant 1048584 : i32; + v94 = arith.add v92, v124 : i32 #[overflow = wrapping]; v98 = hir.bitcast v94 : u32; v99 = hir.int_to_ptr v98 : ptr; - hir.store v99, v135; + hir.store v99, v122; scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm index 87ae38edf..325fe2aa0 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.masm @@ -65,7 +65,7 @@ proc cross_ctx_account_word_arg::bindings::__link_custom_section_describing_impo nop end -@locals("1") +@locals("2") @callconv("C") proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word( felt, @@ -99,58 +99,118 @@ proc miden:cross-ctx-account-word-arg/foo@1.0.0#process-word( exec.::intrinsics::mem::store_felt trace.252 nop + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.16384 - movup.15 + push.0 + mul.4294967296 + add + movup.14 mul push.8192 - movup.15 + push.0 + mul.4294967296 + add + movup.14 mul push.4096 - movup.15 + push.0 + mul.4294967296 + add + movup.14 mul add add push.2048 - movup.13 + push.0 + mul.4294967296 + add + movup.12 mul push.1024 - movup.13 + push.0 + mul.4294967296 + add + movup.12 mul push.512 - movup.13 + push.0 + mul.4294967296 + add + movup.12 mul push.256 - movup.13 + push.0 + mul.4294967296 + add + movup.12 mul add add add push.128 - movup.10 + push.0 + mul.4294967296 + add + movup.9 mul push.64 - movup.10 + push.0 + mul.4294967296 + add + movup.9 mul push.32 - movup.10 + push.0 + mul.4294967296 + add + movup.9 mul push.16 - movup.10 + push.0 + mul.4294967296 + add + movup.9 mul add add add push.8 - movup.7 + push.0 + mul.4294967296 + add + movup.6 mul push.4 - movup.7 + push.0 + mul.4294967296 + add + movup.6 mul push.2 - movup.7 + push.0 + mul.4294967296 + add + movup.6 mul push.1 - movup.7 + push.0 + mul.4294967296 + add + locaddr.1 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop mul add add diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat index 297ba0a3a..a253b2650 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word_arg.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) (type (;2;) (func (param f32 f32) (result f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -26,77 +25,77 @@ (func $miden:cross-ctx-account-word-arg/foo@1.0.0#process-word (;2;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32) call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 1 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul local.get 1 - i32.const 2 - call $intrinsics::felt::from_u32 + i64.const 2 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 2 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 3 - i32.const 8 - call $intrinsics::felt::from_u32 + i64.const 8 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.set 3 local.get 4 - i32.const 16 - call $intrinsics::felt::from_u32 + i64.const 16 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul local.get 5 - i32.const 32 - call $intrinsics::felt::from_u32 + i64.const 32 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 6 - i32.const 64 - call $intrinsics::felt::from_u32 + i64.const 64 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 7 - i32.const 128 - call $intrinsics::felt::from_u32 + i64.const 128 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.set 7 local.get 8 - i32.const 256 - call $intrinsics::felt::from_u32 + i64.const 256 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul local.get 9 - i32.const 512 - call $intrinsics::felt::from_u32 + i64.const 512 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 10 - i32.const 1024 - call $intrinsics::felt::from_u32 + i64.const 1024 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 11 - i32.const 2048 - call $intrinsics::felt::from_u32 + i64.const 2048 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.set 11 local.get 12 - i32.const 4096 - call $intrinsics::felt::from_u32 + i64.const 4096 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul local.get 13 - i32.const 8192 - call $intrinsics::felt::from_u32 + i64.const 8192 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.get 14 - i32.const 16384 - call $intrinsics::felt::from_u32 + i64.const 16384 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::mul call $intrinsics::felt::add local.set 14 @@ -131,7 +130,7 @@ (func $intrinsics::felt::add (;4;) (type 2) (param f32 f32) (result f32) unreachable ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $intrinsics::felt::mul (;6;) (type 2) (param f32 f32) (result f32) @@ -151,17 +150,16 @@ (component $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (import "import-type-felt0" (type (;6;) (eq 1))) - (type (;7;) (func (param "input1" 5) (param "input2" 5) (param "input3" 5) (param "felt1" 6) (param "felt2" 6) (param "felt3" 6) (param "felt4" 6) (result 6))) - (import "import-func-process-word" (func (;0;) (type 7))) - (export (;8;) "word" (type 4)) - (export (;9;) "felt" (type 1)) - (type (;10;) (func (param "input1" 8) (param "input2" 8) (param "input3" 8) (param "felt1" 9) (param "felt2" 9) (param "felt3" 9) (param "felt4" 9) (result 9))) - (export (;1;) "process-word" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (import "import-type-felt0" (type (;5;) (eq 1))) + (type (;6;) (func (param "input1" 4) (param "input2" 4) (param "input3" 4) (param "felt1" 5) (param "felt2" 5) (param "felt3" 5) (param "felt4" 5) (result 5))) + (import "import-func-process-word" (func (;0;) (type 6))) + (export (;7;) "word" (type 3)) + (export (;8;) "felt" (type 1)) + (type (;9;) (func (param "input1" 7) (param "input2" 7) (param "input3" 7) (param "felt1" 8) (param "felt2" 8) (param "felt3" 8) (param "felt4" 8) (result 8))) + (export (;1;) "process-word" (func 0) (func (type 9))) ) (instance $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-instance (;1;) (instantiate $miden:cross-ctx-account-word-arg/foo@1.0.0-shim-component (with "import-func-process-word" (func $process-word)) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.hir b/tests/integration/expected/rust_sdk/cross_ctx_note.hir index e7a5826b5..5a7e4d25b 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.hir @@ -28,55 +28,59 @@ builtin.component miden:base/note-script@1.0.0 { v14 = arith.constant 4 : u32; v15 = arith.mod v13, v14 : u32; hir.assertz v15 #[code = 250]; - v16 = hir.int_to_ptr v13 : ptr; - v17 = hir.load v16 : i32; - v18 = hir.bitcast v17 : felt; - v59 = arith.constant 11 : felt; - hir.assert_eq v18, v59; - v21 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1(v18) : felt - v58 = arith.constant 53 : felt; - hir.assert_eq v21, v58; - v27 = hir.bitcast v12 : u32; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : u32; + v18 = arith.zext v17 : u64; + v19 = hir.bitcast v18 : i64; + v20 = arith.trunc v19 : felt; + v21 = arith.constant 11 : i64; + v22 = arith.trunc v21 : felt; + hir.assert_eq v20, v22; + v23 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1(v20) : felt + v24 = arith.constant 53 : i64; + v25 = arith.trunc v24 : felt; + hir.assert_eq v23, v25; + v29 = hir.bitcast v12 : u32; v60 = arith.constant 4 : u32; - v29 = arith.mod v27, v60 : u32; - hir.assertz v29 #[code = 250]; - v24 = hir.cast v21 : i64; - v25 = hir.bitcast v24 : u64; - v26 = arith.trunc v25 : u32; - v30 = hir.int_to_ptr v27 : ptr; - hir.store v30, v26; + v31 = arith.mod v29, v60 : u32; + hir.assertz v31 #[code = 250]; + v26 = hir.cast v23 : i64; + v27 = hir.bitcast v26 : u64; + v28 = arith.trunc v27 : u32; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v28; builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block14: - v32 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr - v33 = hir.bitcast v32 : ptr; - v34 = hir.load v33 : i32; - v35 = arith.constant 1048592 : i32; - v36 = arith.add v34, v35 : i32 #[overflow = wrapping]; - v37 = hir.bitcast v36 : u32; - v38 = hir.int_to_ptr v37 : ptr; - v39 = hir.load v38 : u8; - v31 = arith.constant 0 : i32; - v40 = arith.zext v39 : u32; - v41 = hir.bitcast v40 : i32; - v43 = arith.neq v41, v31 : i1; - scf.if v43{ + v34 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr + v35 = hir.bitcast v34 : ptr; + v36 = hir.load v35 : i32; + v37 = arith.constant 1048592 : i32; + v38 = arith.add v36, v37 : i32 #[overflow = wrapping]; + v39 = hir.bitcast v38 : u32; + v40 = hir.int_to_ptr v39 : ptr; + v41 = hir.load v40 : u8; + v33 = arith.constant 0 : i32; + v42 = arith.zext v41 : u32; + v43 = hir.bitcast v42 : i32; + v45 = arith.neq v43, v33 : i1; + scf.if v45{ ^block16: scf.yield ; } else { ^block17: - v44 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr - v45 = hir.bitcast v44 : ptr; - v46 = hir.load v45 : i32; + v46 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note/GOT.data.internal.__memory_base : ptr + v47 = hir.bitcast v46 : ptr; + v48 = hir.load v47 : i32; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/__wasm_call_ctors() v62 = arith.constant 1 : u8; v64 = arith.constant 1048592 : i32; - v48 = arith.add v46, v64 : i32 #[overflow = wrapping]; - v52 = hir.bitcast v48 : u32; - v53 = hir.int_to_ptr v52 : ptr; - hir.store v53, v62; + v50 = arith.add v48, v64 : i32 #[overflow = wrapping]; + v54 = hir.bitcast v50 : u32; + v55 = hir.int_to_ptr v54 : ptr; + hir.store v55, v62; scf.yield ; }; builtin.ret ; @@ -93,9 +97,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x0000000b000000010000000100000001; }; - public builtin.function @run(v54: felt, v55: felt, v56: felt, v57: felt) { - ^block18(v54: felt, v55: felt, v56: felt, v57: felt): - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/miden:base/note-script@1.0.0#run(v54, v55, v56, v57) + public builtin.function @run(v56: felt, v57: felt, v58: felt, v59: felt) { + ^block18(v56: felt, v57: felt, v58: felt, v59: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/miden:base/note-script@1.0.0#run(v56, v57, v58, v59) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.masm b/tests/integration/expected/rust_sdk/cross_ctx_note.masm index cc5c86f59..fd2834142 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.masm @@ -94,7 +94,13 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop + push.0 + mul.4294967296 + add push.11 + push.0 + mul.4294967296 + add dup.1 assert_eq trace.240 @@ -103,6 +109,9 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.53 + push.0 + mul.4294967296 + add dup.1 assert_eq swap.1 diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.wat b/tests/integration/expected/rust_sdk/cross_ctx_note.wat index 714e1470c..c125793c2 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -25,7 +24,7 @@ (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param f32) (result i64))) (type (;4;) (func (param f32 f32))) - (type (;5;) (func (param i32) (result f32))) + (type (;5;) (func (param i64) (result f32))) (import "miden:cross-ctx-account/foo@1.0.0" "process-felt" (func $cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -45,17 +44,17 @@ i32.const 1048588 i32.add local.tee 4 - i32.load - call $intrinsics::felt::from_u32 + i64.load32_u + call $intrinsics::felt::from_u64_unchecked local.tee 5 - i32.const 11 - call $intrinsics::felt::from_u32 + i64.const 11 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 call $cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 local.tee 5 - i32.const 53 - call $intrinsics::felt::from_u32 + i64.const 53 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 4 local.get 5 @@ -86,7 +85,7 @@ (func $intrinsics::felt::assert_eq (;6;) (type 4) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;7;) (type 5) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;7;) (type 5) (param i64) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\0b\00\00\00") @@ -110,15 +109,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir b/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir index 1c71fddae..05304093c 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir @@ -1,183 +1,179 @@ builtin.component miden:base/note-script@1.0.0 { builtin.module public @cross_ctx_note_word { - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7(v0: felt, v1: felt, v2: felt, v3: felt, v4: i32) { + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import6(v0: felt, v1: felt, v2: felt, v3: felt, v4: i32) { ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: i32): v5, v6, v7, v8 = hir.call v0, v1, v2, v3 : felt, felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-word] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)]; + v510 = arith.constant 0 : i32; v9 = arith.constant 0 : i32; v10 = arith.add v4, v9 : i32 #[overflow = unchecked]; - v511 = arith.constant 0 : i32; - v512 = arith.constant 0 : i32; - v12 = arith.add v10, v512 : i32 #[overflow = unchecked]; - v14 = arith.add v12, v511 : i32 #[overflow = unchecked]; - v15 = hir.int_to_ptr v14 : ptr; - hir.store v15, v5; - v510 = arith.constant 0 : i32; - v16 = arith.constant 4 : i32; - v17 = arith.add v10, v16 : i32 #[overflow = unchecked]; - v19 = arith.add v17, v510 : i32 #[overflow = unchecked]; - v20 = hir.int_to_ptr v19 : ptr; - hir.store v20, v6; + v12 = arith.add v10, v510 : i32 #[overflow = unchecked]; + v13 = hir.int_to_ptr v12 : ptr; + hir.store v13, v5; v509 = arith.constant 0 : i32; - v21 = arith.constant 8 : i32; - v22 = arith.add v10, v21 : i32 #[overflow = unchecked]; - v24 = arith.add v22, v509 : i32 #[overflow = unchecked]; - v25 = hir.int_to_ptr v24 : ptr; - hir.store v25, v7; + v14 = arith.constant 4 : i32; + v15 = arith.add v4, v14 : i32 #[overflow = unchecked]; + v17 = arith.add v15, v509 : i32 #[overflow = unchecked]; + v18 = hir.int_to_ptr v17 : ptr; + hir.store v18, v6; v508 = arith.constant 0 : i32; - v26 = arith.constant 12 : i32; - v27 = arith.add v10, v26 : i32 #[overflow = unchecked]; - v29 = arith.add v27, v508 : i32 #[overflow = unchecked]; - v30 = hir.int_to_ptr v29 : ptr; - hir.store v30, v8; + v19 = arith.constant 8 : i32; + v20 = arith.add v4, v19 : i32 #[overflow = unchecked]; + v22 = arith.add v20, v508 : i32 #[overflow = unchecked]; + v23 = hir.int_to_ptr v22 : ptr; + hir.store v23, v7; + v507 = arith.constant 0 : i32; + v24 = arith.constant 12 : i32; + v25 = arith.add v4, v24 : i32 #[overflow = unchecked]; + v27 = arith.add v25, v507 : i32 #[overflow = unchecked]; + v28 = hir.int_to_ptr v27 : ptr; + hir.store v28, v8; builtin.ret ; }; - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7(v31: felt, v32: felt, v33: felt, v34: felt, v35: i32) { - ^block6(v31: felt, v32: felt, v33: felt, v34: felt, v35: i32): - v36, v37, v38, v39 = hir.call v31, v32, v33, v34 : felt, felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-another-word] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)]; - v40 = arith.constant 0 : i32; - v41 = arith.add v35, v40 : i32 #[overflow = unchecked]; - v516 = arith.constant 0 : i32; - v517 = arith.constant 0 : i32; - v43 = arith.add v41, v517 : i32 #[overflow = unchecked]; - v45 = arith.add v43, v516 : i32 #[overflow = unchecked]; - v46 = hir.int_to_ptr v45 : ptr; - hir.store v46, v36; - v515 = arith.constant 0 : i32; - v47 = arith.constant 4 : i32; - v48 = arith.add v41, v47 : i32 #[overflow = unchecked]; - v50 = arith.add v48, v515 : i32 #[overflow = unchecked]; - v51 = hir.int_to_ptr v50 : ptr; - hir.store v51, v37; + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import6(v29: felt, v30: felt, v31: felt, v32: felt, v33: i32) { + ^block6(v29: felt, v30: felt, v31: felt, v32: felt, v33: i32): + v34, v35, v36, v37 = hir.call v29, v30, v31, v32 : felt, felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-another-word] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (param felt) (result felt felt felt felt)]; v514 = arith.constant 0 : i32; - v52 = arith.constant 8 : i32; - v53 = arith.add v41, v52 : i32 #[overflow = unchecked]; - v55 = arith.add v53, v514 : i32 #[overflow = unchecked]; - v56 = hir.int_to_ptr v55 : ptr; - hir.store v56, v38; + v38 = arith.constant 0 : i32; + v39 = arith.add v33, v38 : i32 #[overflow = unchecked]; + v41 = arith.add v39, v514 : i32 #[overflow = unchecked]; + v42 = hir.int_to_ptr v41 : ptr; + hir.store v42, v34; v513 = arith.constant 0 : i32; - v57 = arith.constant 12 : i32; - v58 = arith.add v41, v57 : i32 #[overflow = unchecked]; - v60 = arith.add v58, v513 : i32 #[overflow = unchecked]; - v61 = hir.int_to_ptr v60 : ptr; - hir.store v61, v39; + v43 = arith.constant 4 : i32; + v44 = arith.add v33, v43 : i32 #[overflow = unchecked]; + v46 = arith.add v44, v513 : i32 #[overflow = unchecked]; + v47 = hir.int_to_ptr v46 : ptr; + hir.store v47, v35; + v512 = arith.constant 0 : i32; + v48 = arith.constant 8 : i32; + v49 = arith.add v33, v48 : i32 #[overflow = unchecked]; + v51 = arith.add v49, v512 : i32 #[overflow = unchecked]; + v52 = hir.int_to_ptr v51 : ptr; + hir.store v52, v36; + v511 = arith.constant 0 : i32; + v53 = arith.constant 12 : i32; + v54 = arith.add v33, v53 : i32 #[overflow = unchecked]; + v56 = arith.add v54, v511 : i32 #[overflow = unchecked]; + v57 = hir.int_to_ptr v56 : ptr; + hir.store v57, v37; builtin.ret ; }; - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1(v62: felt) -> felt { - ^block8(v62: felt): - v63 = hir.call v62 : felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-felt] #[signature = (param felt) (result felt)]; - builtin.ret v63; + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1(v58: felt) -> felt { + ^block8(v58: felt): + v59 = hir.call v58 : felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-felt] #[signature = (param felt) (result felt)]; + builtin.ret v59; + }; + + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v60: felt, v61: felt, v62: i32) { + ^block10(v60: felt, v61: felt, v62: i32): + v63, v64 = hir.call v60, v61 : felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-pair] #[signature = (cc canon-lower) (param felt) (param felt) (result felt felt)]; + v516 = arith.constant 0 : i32; + v65 = arith.constant 0 : i32; + v66 = arith.add v62, v65 : i32 #[overflow = unchecked]; + v68 = arith.add v66, v516 : i32 #[overflow = unchecked]; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v63; + v515 = arith.constant 0 : i32; + v70 = arith.constant 4 : i32; + v71 = arith.add v62, v70 : i32 #[overflow = unchecked]; + v73 = arith.add v71, v515 : i32 #[overflow = unchecked]; + v74 = hir.int_to_ptr v73 : ptr; + hir.store v74, v64; + builtin.ret ; }; - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v64: felt, v65: felt, v66: i32) { - ^block10(v64: felt, v65: felt, v66: i32): - v67, v68 = hir.call v64, v65 : felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-pair] #[signature = (cc canon-lower) (param felt) (param felt) (result felt felt)]; + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v75: felt, v76: felt, v77: felt, v78: i32) { + ^block12(v75: felt, v76: felt, v77: felt, v78: i32): + v79, v80, v81 = hir.call v75, v76, v77 : felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-triple] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (result felt felt felt)]; v519 = arith.constant 0 : i32; - v69 = arith.constant 0 : i32; - v70 = arith.add v66, v69 : i32 #[overflow = unchecked]; - v72 = arith.add v70, v519 : i32 #[overflow = unchecked]; - v73 = hir.int_to_ptr v72 : ptr; - hir.store v73, v67; + v82 = arith.constant 0 : i32; + v83 = arith.add v78, v82 : i32 #[overflow = unchecked]; + v85 = arith.add v83, v519 : i32 #[overflow = unchecked]; + v86 = hir.int_to_ptr v85 : ptr; + hir.store v86, v79; v518 = arith.constant 0 : i32; - v74 = arith.constant 4 : i32; - v75 = arith.add v66, v74 : i32 #[overflow = unchecked]; - v77 = arith.add v75, v518 : i32 #[overflow = unchecked]; - v78 = hir.int_to_ptr v77 : ptr; - hir.store v78, v68; + v87 = arith.constant 4 : i32; + v88 = arith.add v78, v87 : i32 #[overflow = unchecked]; + v90 = arith.add v88, v518 : i32 #[overflow = unchecked]; + v91 = hir.int_to_ptr v90 : ptr; + hir.store v91, v80; + v517 = arith.constant 0 : i32; + v92 = arith.constant 8 : i32; + v93 = arith.add v78, v92 : i32 #[overflow = unchecked]; + v95 = arith.add v93, v517 : i32 #[overflow = unchecked]; + v96 = hir.int_to_ptr v95 : ptr; + hir.store v96, v81; builtin.ret ; }; - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v79: felt, v80: felt, v81: felt, v82: i32) { - ^block12(v79: felt, v80: felt, v81: felt, v82: i32): - v83, v84, v85 = hir.call v79, v80, v81 : felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-triple] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (result felt felt felt)]; - v522 = arith.constant 0 : i32; - v86 = arith.constant 0 : i32; - v87 = arith.add v82, v86 : i32 #[overflow = unchecked]; - v89 = arith.add v87, v522 : i32 #[overflow = unchecked]; - v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v83; + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4(v97: i64, v98: felt, v99: i32, v100: felt, v101: i32, v102: i32, v103: i32, v104: i32) { + ^block14(v97: i64, v98: felt, v99: i32, v100: felt, v101: i32, v102: i32, v103: i32, v104: i32): + v105, v106, v107, v108, v109, v110, v111 = hir.call v97, v98, v99, v100, v101, v102, v103 : i64, felt, i32, felt, i32, i32, i32 #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-mixed] #[signature = (cc canon-lower) (param i64) (param felt) (param i32) (param felt) (param (zext) i32) (param (zext) i32) (param (zext) i32) (result i64 felt i32 felt i32 i32 i32)]; + v115 = hir.bitcast v105 : u64; + v112 = arith.constant 0 : i32; + v113 = arith.add v104, v112 : i32 #[overflow = unchecked]; + v114 = hir.int_to_ptr v113 : ptr; + hir.store v114, v115; v521 = arith.constant 0 : i32; - v91 = arith.constant 4 : i32; - v92 = arith.add v82, v91 : i32 #[overflow = unchecked]; - v94 = arith.add v92, v521 : i32 #[overflow = unchecked]; - v95 = hir.int_to_ptr v94 : ptr; - hir.store v95, v84; + v116 = arith.constant 8 : i32; + v117 = arith.add v104, v116 : i32 #[overflow = unchecked]; + v119 = arith.add v117, v521 : i32 #[overflow = unchecked]; + v120 = hir.int_to_ptr v119 : ptr; + hir.store v120, v106; + v124 = hir.bitcast v107 : u32; + v121 = arith.constant 12 : i32; + v122 = arith.add v104, v121 : i32 #[overflow = unchecked]; + v123 = hir.int_to_ptr v122 : ptr; + hir.store v123, v124; v520 = arith.constant 0 : i32; - v96 = arith.constant 8 : i32; - v97 = arith.add v82, v96 : i32 #[overflow = unchecked]; - v99 = arith.add v97, v520 : i32 #[overflow = unchecked]; - v100 = hir.int_to_ptr v99 : ptr; - hir.store v100, v85; - builtin.ret ; - }; - - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4(v101: i64, v102: felt, v103: i32, v104: felt, v105: i32, v106: i32, v107: i32, v108: i32) { - ^block14(v101: i64, v102: felt, v103: i32, v104: felt, v105: i32, v106: i32, v107: i32, v108: i32): - v109, v110, v111, v112, v113, v114, v115 = hir.call v101, v102, v103, v104, v105, v106, v107 : i64, felt, i32, felt, i32, i32, i32 #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-mixed] #[signature = (cc canon-lower) (param i64) (param felt) (param i32) (param felt) (param (zext) i32) (param (zext) i32) (param (zext) i32) (result i64 felt i32 felt i32 i32 i32)]; - v119 = hir.bitcast v109 : u64; - v116 = arith.constant 0 : i32; - v117 = arith.add v108, v116 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - hir.store v118, v119; - v524 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v108, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v524 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - hir.store v124, v110; - v128 = hir.bitcast v111 : u32; - v125 = arith.constant 12 : i32; - v126 = arith.add v108, v125 : i32 #[overflow = unchecked]; - v127 = hir.int_to_ptr v126 : ptr; - hir.store v127, v128; - v523 = arith.constant 0 : i32; - v129 = arith.constant 16 : i32; - v130 = arith.add v108, v129 : i32 #[overflow = unchecked]; - v132 = arith.add v130, v523 : i32 #[overflow = unchecked]; - v133 = hir.int_to_ptr v132 : ptr; - hir.store v133, v112; - v137 = hir.bitcast v113 : u8; - v134 = arith.constant 20 : i32; - v135 = arith.add v108, v134 : i32 #[overflow = unchecked]; - v136 = hir.int_to_ptr v135 : ptr; + v125 = arith.constant 16 : i32; + v126 = arith.add v104, v125 : i32 #[overflow = unchecked]; + v128 = arith.add v126, v520 : i32 #[overflow = unchecked]; + v129 = hir.int_to_ptr v128 : ptr; + hir.store v129, v108; + v133 = hir.bitcast v109 : u8; + v130 = arith.constant 20 : i32; + v131 = arith.add v104, v130 : i32 #[overflow = unchecked]; + v132 = hir.int_to_ptr v131 : ptr; + hir.store v132, v133; + v137 = hir.bitcast v110 : i1; + v134 = arith.constant 21 : i32; + v135 = arith.add v104, v134 : i32 #[overflow = unchecked]; + v136 = hir.int_to_ptr v135 : ptr; hir.store v136, v137; - v141 = hir.bitcast v114 : i1; - v138 = arith.constant 21 : i32; - v139 = arith.add v108, v138 : i32 #[overflow = unchecked]; - v140 = hir.int_to_ptr v139 : ptr; + v141 = hir.bitcast v111 : u16; + v138 = arith.constant 22 : i32; + v139 = arith.add v104, v138 : i32 #[overflow = unchecked]; + v140 = hir.int_to_ptr v139 : ptr; hir.store v140, v141; - v145 = hir.bitcast v115 : u16; - v142 = arith.constant 22 : i32; - v143 = arith.add v108, v142 : i32 #[overflow = unchecked]; - v144 = hir.int_to_ptr v143 : ptr; - hir.store v144, v145; builtin.ret ; }; - private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v146: felt, v147: felt, v148: felt, v149: i32) { - ^block16(v146: felt, v147: felt, v148: felt, v149: i32): - v150, v151, v152 = hir.call v146, v147, v148 : felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-nested] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (result felt felt felt)]; - v153 = arith.constant 0 : i32; - v154 = arith.add v149, v153 : i32 #[overflow = unchecked]; - v527 = arith.constant 0 : i32; - v528 = arith.constant 0 : i32; - v156 = arith.add v154, v528 : i32 #[overflow = unchecked]; - v158 = arith.add v156, v527 : i32 #[overflow = unchecked]; - v159 = hir.int_to_ptr v158 : ptr; - hir.store v159, v150; - v526 = arith.constant 0 : i32; - v160 = arith.constant 4 : i32; - v161 = arith.add v154, v160 : i32 #[overflow = unchecked]; - v163 = arith.add v161, v526 : i32 #[overflow = unchecked]; - v164 = hir.int_to_ptr v163 : ptr; - hir.store v164, v151; + private builtin.function @cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v142: felt, v143: felt, v144: felt, v145: i32) { + ^block16(v142: felt, v143: felt, v144: felt, v145: i32): + v146, v147, v148 = hir.call v142, v143, v144 : felt, felt, felt #[callee = miden:cross-ctx-account-word/foo@1.0.0/process-nested] #[signature = (cc canon-lower) (param felt) (param felt) (param felt) (result felt felt felt)]; + v149 = arith.constant 0 : i32; + v150 = arith.add v145, v149 : i32 #[overflow = unchecked]; + v524 = arith.constant 0 : i32; v525 = arith.constant 0 : i32; - v165 = arith.constant 8 : i32; - v166 = arith.add v149, v165 : i32 #[overflow = unchecked]; - v168 = arith.add v166, v525 : i32 #[overflow = unchecked]; - v169 = hir.int_to_ptr v168 : ptr; - hir.store v169, v152; + v152 = arith.add v150, v525 : i32 #[overflow = unchecked]; + v154 = arith.add v152, v524 : i32 #[overflow = unchecked]; + v155 = hir.int_to_ptr v154 : ptr; + hir.store v155, v146; + v523 = arith.constant 0 : i32; + v156 = arith.constant 4 : i32; + v157 = arith.add v150, v156 : i32 #[overflow = unchecked]; + v159 = arith.add v157, v523 : i32 #[overflow = unchecked]; + v160 = hir.int_to_ptr v159 : ptr; + hir.store v160, v147; + v522 = arith.constant 0 : i32; + v161 = arith.constant 8 : i32; + v162 = arith.add v145, v161 : i32 #[overflow = unchecked]; + v164 = arith.add v162, v522 : i32 #[overflow = unchecked]; + v165 = hir.int_to_ptr v164 : ptr; + hir.store v165, v148; builtin.ret ; }; @@ -191,325 +187,359 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden:base/note-script@1.0.0#run(v170: felt, v171: felt, v172: felt, v173: felt) { - ^block24(v170: felt, v171: felt, v172: felt, v173: felt): - v177 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr - v178 = hir.bitcast v177 : ptr; - v179 = hir.load v178 : i32; - v180 = arith.constant 32 : i32; - v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; - v182 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr - v183 = hir.bitcast v182 : ptr; - hir.store v183, v181; + private builtin.function @miden:base/note-script@1.0.0#run(v166: felt, v167: felt, v168: felt, v169: felt) { + ^block24(v166: felt, v167: felt, v168: felt, v169: felt): + v173 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr + v174 = hir.bitcast v173 : ptr; + v175 = hir.load v174 : i32; + v176 = arith.constant 32 : i32; + v177 = arith.sub v175, v176 : i32 #[overflow = wrapping]; + v178 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr + v179 = hir.bitcast v178 : ptr; + hir.store v179, v177; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/wit_bindgen::rt::run_ctors_once() - v192 = arith.constant 8 : i32; - v193 = arith.add v181, v192 : i32 #[overflow = wrapping]; - v560 = arith.constant 5 : felt; - v561 = arith.constant 4 : felt; - v562 = arith.constant 3 : felt; - v563 = arith.constant 2 : felt; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7(v563, v562, v561, v560, v193) - v195 = arith.constant 20 : u32; - v194 = hir.bitcast v181 : u32; - v196 = arith.add v194, v195 : u32 #[overflow = checked]; - v197 = arith.constant 4 : u32; - v198 = arith.mod v196, v197 : u32; - hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - v200 = hir.load v199 : felt; - v202 = arith.constant 16 : u32; - v201 = hir.bitcast v181 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v619 = arith.constant 4 : u32; - v205 = arith.mod v203, v619 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - v207 = hir.load v206 : felt; - v209 = arith.constant 12 : u32; - v208 = hir.bitcast v181 : u32; - v210 = arith.add v208, v209 : u32 #[overflow = checked]; - v618 = arith.constant 4 : u32; - v212 = arith.mod v210, v618 : u32; - hir.assertz v212 #[code = 250]; - v213 = hir.int_to_ptr v210 : ptr; - v214 = hir.load v213 : felt; - v216 = arith.constant 8 : u32; - v215 = hir.bitcast v181 : u32; - v217 = arith.add v215, v216 : u32 #[overflow = checked]; - v617 = arith.constant 4 : u32; - v219 = arith.mod v217, v617 : u32; - hir.assertz v219 #[code = 250]; - v220 = hir.int_to_ptr v217 : ptr; - v221 = hir.load v220 : felt; - v616 = arith.constant 3 : felt; - hir.assert_eq v221, v616; - v615 = arith.constant 5 : felt; - hir.assert_eq v214, v615; - v557 = arith.constant 7 : felt; - hir.assert_eq v207, v557; - v556 = arith.constant 9 : felt; - hir.assert_eq v200, v556; - v610 = arith.constant 8 : i32; - v231 = arith.add v181, v610 : i32 #[overflow = wrapping]; - v611 = arith.constant 5 : felt; - v612 = arith.constant 4 : felt; - v613 = arith.constant 3 : felt; - v614 = arith.constant 2 : felt; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7(v614, v613, v612, v611, v231) - v609 = arith.constant 20 : u32; - v232 = hir.bitcast v181 : u32; - v234 = arith.add v232, v609 : u32 #[overflow = checked]; - v608 = arith.constant 4 : u32; - v236 = arith.mod v234, v608 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : felt; - v607 = arith.constant 16 : u32; - v239 = hir.bitcast v181 : u32; - v241 = arith.add v239, v607 : u32 #[overflow = checked]; - v606 = arith.constant 4 : u32; - v243 = arith.mod v241, v606 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - v245 = hir.load v244 : felt; - v605 = arith.constant 12 : u32; - v246 = hir.bitcast v181 : u32; - v248 = arith.add v246, v605 : u32 #[overflow = checked]; - v604 = arith.constant 4 : u32; - v250 = arith.mod v248, v604 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : felt; - v603 = arith.constant 8 : u32; - v253 = hir.bitcast v181 : u32; - v255 = arith.add v253, v603 : u32 #[overflow = checked]; - v602 = arith.constant 4 : u32; - v257 = arith.mod v255, v602 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - v259 = hir.load v258 : felt; - v601 = arith.constant 4 : felt; - hir.assert_eq v259, v601; - v554 = arith.constant 6 : felt; - hir.assert_eq v252, v554; - v553 = arith.constant 8 : felt; - hir.assert_eq v245, v553; - v552 = arith.constant 10 : felt; - hir.assert_eq v238, v552; - v600 = arith.constant 9 : felt; - v270 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1(v600) : felt - v550 = arith.constant 12 : felt; - hir.assert_eq v270, v550; - v599 = arith.constant 8 : u32; - v278 = hir.bitcast v181 : u32; - v280 = arith.add v278, v599 : u32 #[overflow = checked]; - v598 = arith.constant 8 : u32; - v282 = arith.mod v280, v598 : u32; - hir.assertz v282 #[code = 250]; - v277 = arith.constant 0 : i64; - v283 = hir.int_to_ptr v280 : ptr; - hir.store v283, v277; - v596 = arith.constant 8 : i32; - v285 = arith.add v181, v596 : i32 #[overflow = wrapping]; - v548 = arith.constant 20 : felt; - v597 = arith.constant 10 : felt; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v597, v548, v285) - v595 = arith.constant 12 : u32; - v286 = hir.bitcast v181 : u32; - v288 = arith.add v286, v595 : u32 #[overflow = checked]; - v594 = arith.constant 4 : u32; - v290 = arith.mod v288, v594 : u32; - hir.assertz v290 #[code = 250]; - v291 = hir.int_to_ptr v288 : ptr; - v292 = hir.load v291 : felt; - v593 = arith.constant 8 : u32; - v293 = hir.bitcast v181 : u32; - v295 = arith.add v293, v593 : u32 #[overflow = checked]; - v592 = arith.constant 4 : u32; - v297 = arith.mod v295, v592 : u32; - hir.assertz v297 #[code = 250]; - v298 = hir.int_to_ptr v295 : ptr; - v299 = hir.load v298 : felt; - v547 = arith.constant 14 : felt; - hir.assert_eq v299, v547; - v546 = arith.constant 24 : felt; - hir.assert_eq v292, v546; - v591 = arith.constant 8 : i32; - v311 = arith.add v181, v591 : i32 #[overflow = wrapping]; - v543 = arith.constant 300 : felt; - v544 = arith.constant 200 : felt; - v545 = arith.constant 100 : felt; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v545, v544, v543, v311) - v590 = arith.constant 16 : u32; - v312 = hir.bitcast v181 : u32; - v314 = arith.add v312, v590 : u32 #[overflow = checked]; - v589 = arith.constant 4 : u32; - v316 = arith.mod v314, v589 : u32; - hir.assertz v316 #[code = 250]; - v317 = hir.int_to_ptr v314 : ptr; - v318 = hir.load v317 : felt; - v588 = arith.constant 12 : u32; - v319 = hir.bitcast v181 : u32; - v321 = arith.add v319, v588 : u32 #[overflow = checked]; - v587 = arith.constant 4 : u32; - v323 = arith.mod v321, v587 : u32; - hir.assertz v323 #[code = 250]; - v324 = hir.int_to_ptr v321 : ptr; - v325 = hir.load v324 : felt; - v586 = arith.constant 8 : u32; - v326 = hir.bitcast v181 : u32; - v328 = arith.add v326, v586 : u32 #[overflow = checked]; - v585 = arith.constant 4 : u32; - v330 = arith.mod v328, v585 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - v332 = hir.load v331 : felt; - v542 = arith.constant 105 : felt; - hir.assert_eq v332, v542; - v541 = arith.constant 205 : felt; - hir.assert_eq v325, v541; - v540 = arith.constant 305 : felt; - hir.assert_eq v318, v540; - v584 = arith.constant 8 : i32; - v349 = arith.add v181, v584 : i32 #[overflow = wrapping]; - v186 = arith.constant 3 : i32; - v174 = arith.constant 0 : i32; - v345 = arith.constant 111 : i32; - v539 = arith.constant 50 : felt; - v342 = arith.constant -11 : i32; - v340 = arith.constant -4294967302 : i64; - v341 = arith.trunc v340 : felt; - v339 = arith.constant -1001 : i64; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4(v339, v341, v342, v539, v345, v174, v186, v349) - v583 = arith.constant 8 : u32; - v350 = hir.bitcast v181 : u32; - v352 = arith.add v350, v583 : u32 #[overflow = checked]; - v582 = arith.constant 8 : u32; - v354 = arith.mod v352, v582 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - v356 = hir.load v355 : i64; - v581 = arith.constant 0 : i32; - v357 = arith.constant -1 : i64; - v358 = arith.eq v356, v357 : i1; - v359 = arith.zext v358 : u32; - v360 = hir.bitcast v359 : i32; - v362 = arith.neq v360, v581 : i1; - cf.cond_br v362 ^block26, ^block27; - ^block26: - v364 = arith.constant 30 : u32; - v363 = hir.bitcast v181 : u32; - v365 = arith.add v363, v364 : u32 #[overflow = checked]; - v366 = arith.constant 2 : u32; - v367 = arith.mod v365, v366 : u32; - hir.assertz v367 #[code = 250]; - v368 = hir.int_to_ptr v365 : ptr; - v369 = hir.load v368 : u16; - v373 = arith.constant 29 : u32; - v372 = hir.bitcast v181 : u32; - v374 = arith.add v372, v373 : u32 #[overflow = checked]; - v375 = hir.int_to_ptr v374 : ptr; - v376 = hir.load v375 : u8; - v380 = arith.constant 28 : u32; - v379 = hir.bitcast v181 : u32; - v381 = arith.add v379, v380 : u32 #[overflow = checked]; - v382 = hir.int_to_ptr v381 : ptr; - v383 = hir.load v382 : u8; - v387 = arith.constant 24 : u32; - v386 = hir.bitcast v181 : u32; - v388 = arith.add v386, v387 : u32 #[overflow = checked]; - v580 = arith.constant 4 : u32; - v390 = arith.mod v388, v580 : u32; - hir.assertz v390 #[code = 250]; - v391 = hir.int_to_ptr v388 : ptr; - v392 = hir.load v391 : felt; - v579 = arith.constant 20 : u32; - v393 = hir.bitcast v181 : u32; - v395 = arith.add v393, v579 : u32 #[overflow = checked]; - v578 = arith.constant 4 : u32; - v397 = arith.mod v395, v578 : u32; - hir.assertz v397 #[code = 250]; - v398 = hir.int_to_ptr v395 : ptr; - v399 = hir.load v398 : i32; - v577 = arith.constant 16 : u32; - v400 = hir.bitcast v181 : u32; - v402 = arith.add v400, v577 : u32 #[overflow = checked]; + v180 = arith.constant 2 : i64; + v181 = arith.trunc v180 : felt; + v182 = arith.constant 3 : i64; + v183 = arith.trunc v182 : felt; + v184 = arith.constant 4 : i64; + v185 = arith.trunc v184 : felt; + v186 = arith.constant 5 : i64; + v187 = arith.trunc v186 : felt; + v188 = arith.constant 8 : i32; + v189 = arith.add v177, v188 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import6(v181, v183, v185, v187, v189) + v191 = arith.constant 20 : u32; + v190 = hir.bitcast v177 : u32; + v192 = arith.add v190, v191 : u32 #[overflow = checked]; + v193 = arith.constant 4 : u32; + v194 = arith.mod v192, v193 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + v196 = hir.load v195 : felt; + v198 = arith.constant 16 : u32; + v197 = hir.bitcast v177 : u32; + v199 = arith.add v197, v198 : u32 #[overflow = checked]; + v577 = arith.constant 4 : u32; + v201 = arith.mod v199, v577 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + v203 = hir.load v202 : felt; + v205 = arith.constant 12 : u32; + v204 = hir.bitcast v177 : u32; + v206 = arith.add v204, v205 : u32 #[overflow = checked]; v576 = arith.constant 4 : u32; - v404 = arith.mod v402, v576 : u32; - hir.assertz v404 #[code = 250]; - v405 = hir.int_to_ptr v402 : ptr; - v406 = hir.load v405 : felt; - v407 = arith.constant -4294967296 : i64; - v408 = arith.trunc v407 : felt; - hir.assert_eq v406, v408; - v409 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v399) : felt - v410 = arith.constant -1 : i32; - v411 = hir.bitcast v410 : felt; - hir.assert_eq v409, v411; - v538 = arith.constant 57 : felt; - hir.assert_eq v392, v538; - v384 = arith.zext v383 : u32; - v385 = hir.bitcast v384 : i32; - v414 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v385) : felt - v537 = arith.constant 122 : felt; - hir.assert_eq v414, v537; - v536 = arith.constant 1 : felt; - v575 = arith.constant 0 : i32; - v417 = arith.constant 255 : i32; - v377 = arith.zext v376 : u32; - v378 = hir.bitcast v377 : i32; - v418 = arith.band v378, v417 : i32; - v420 = arith.neq v418, v575 : i1; - v421 = arith.zext v420 : u32; - v422 = hir.bitcast v421 : i32; - v423 = hir.bitcast v422 : felt; - hir.assert_eq v423, v536; - v370 = arith.zext v369 : u32; - v371 = hir.bitcast v370 : i32; - v426 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v371) : felt - v574 = arith.constant 12 : felt; - hir.assert_eq v426, v574; + v208 = arith.mod v206, v576 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + v210 = hir.load v209 : felt; + v212 = arith.constant 8 : u32; + v211 = hir.bitcast v177 : u32; + v213 = arith.add v211, v212 : u32 #[overflow = checked]; + v575 = arith.constant 4 : u32; + v215 = arith.mod v213, v575 : u32; + hir.assertz v215 #[code = 250]; + v216 = hir.int_to_ptr v213 : ptr; + v217 = hir.load v216 : felt; + v574 = arith.constant 3 : i64; + v219 = arith.trunc v574 : felt; + hir.assert_eq v217, v219; + v573 = arith.constant 5 : i64; + v221 = arith.trunc v573 : felt; + hir.assert_eq v210, v221; + v222 = arith.constant 7 : i64; + v223 = arith.trunc v222 : felt; + hir.assert_eq v203, v223; + v224 = arith.constant 9 : i64; + v225 = arith.trunc v224 : felt; + hir.assert_eq v196, v225; v572 = arith.constant 8 : i32; - v436 = arith.add v181, v572 : i32 #[overflow = wrapping]; - v573 = arith.constant 50 : felt; - v533 = arith.constant 40 : felt; - v534 = arith.constant 30 : felt; - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v534, v533, v573, v436) - v571 = arith.constant 16 : u32; - v437 = hir.bitcast v181 : u32; - v439 = arith.add v437, v571 : u32 #[overflow = checked]; + v227 = arith.add v177, v572 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import6(v181, v183, v185, v187, v227) + v571 = arith.constant 20 : u32; + v228 = hir.bitcast v177 : u32; + v230 = arith.add v228, v571 : u32 #[overflow = checked]; v570 = arith.constant 4 : u32; - v441 = arith.mod v439, v570 : u32; - hir.assertz v441 #[code = 250]; - v442 = hir.int_to_ptr v439 : ptr; - v443 = hir.load v442 : felt; - v569 = arith.constant 12 : u32; - v444 = hir.bitcast v181 : u32; - v446 = arith.add v444, v569 : u32 #[overflow = checked]; + v232 = arith.mod v230, v570 : u32; + hir.assertz v232 #[code = 250]; + v233 = hir.int_to_ptr v230 : ptr; + v234 = hir.load v233 : felt; + v569 = arith.constant 16 : u32; + v235 = hir.bitcast v177 : u32; + v237 = arith.add v235, v569 : u32 #[overflow = checked]; v568 = arith.constant 4 : u32; - v448 = arith.mod v446, v568 : u32; - hir.assertz v448 #[code = 250]; - v449 = hir.int_to_ptr v446 : ptr; - v450 = hir.load v449 : felt; - v567 = arith.constant 8 : u32; - v451 = hir.bitcast v181 : u32; - v453 = arith.add v451, v567 : u32 #[overflow = checked]; + v239 = arith.mod v237, v568 : u32; + hir.assertz v239 #[code = 250]; + v240 = hir.int_to_ptr v237 : ptr; + v241 = hir.load v240 : felt; + v567 = arith.constant 12 : u32; + v242 = hir.bitcast v177 : u32; + v244 = arith.add v242, v567 : u32 #[overflow = checked]; v566 = arith.constant 4 : u32; - v455 = arith.mod v453, v566 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - v457 = hir.load v456 : felt; - v531 = arith.constant 38 : felt; - hir.assert_eq v457, v531; - v530 = arith.constant 48 : felt; - hir.assert_eq v450, v530; - v529 = arith.constant 58 : felt; - hir.assert_eq v443, v529; - v565 = arith.constant 32 : i32; - v465 = arith.add v181, v565 : i32 #[overflow = wrapping]; - v466 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr - v467 = hir.bitcast v466 : ptr; - hir.store v467, v465; + v246 = arith.mod v244, v566 : u32; + hir.assertz v246 #[code = 250]; + v247 = hir.int_to_ptr v244 : ptr; + v248 = hir.load v247 : felt; + v565 = arith.constant 8 : u32; + v249 = hir.bitcast v177 : u32; + v251 = arith.add v249, v565 : u32 #[overflow = checked]; + v564 = arith.constant 4 : u32; + v253 = arith.mod v251, v564 : u32; + hir.assertz v253 #[code = 250]; + v254 = hir.int_to_ptr v251 : ptr; + v255 = hir.load v254 : felt; + v563 = arith.constant 4 : i64; + v257 = arith.trunc v563 : felt; + hir.assert_eq v255, v257; + v258 = arith.constant 6 : i64; + v259 = arith.trunc v258 : felt; + hir.assert_eq v248, v259; + v260 = arith.constant 8 : i64; + v261 = arith.trunc v260 : felt; + hir.assert_eq v241, v261; + v262 = arith.constant 10 : i64; + v263 = arith.trunc v262 : felt; + hir.assert_eq v234, v263; + v562 = arith.constant 9 : i64; + v265 = arith.trunc v562 : felt; + v266 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1(v265) : felt + v267 = arith.constant 12 : i64; + v268 = arith.trunc v267 : felt; + hir.assert_eq v266, v268; + v561 = arith.constant 8 : u32; + v274 = hir.bitcast v177 : u32; + v276 = arith.add v274, v561 : u32 #[overflow = checked]; + v560 = arith.constant 8 : u32; + v278 = arith.mod v276, v560 : u32; + hir.assertz v278 #[code = 250]; + v273 = arith.constant 0 : i64; + v279 = hir.int_to_ptr v276 : ptr; + hir.store v279, v273; + v558 = arith.constant 8 : i32; + v281 = arith.add v177, v558 : i32 #[overflow = wrapping]; + v271 = arith.constant 20 : i64; + v272 = arith.trunc v271 : felt; + v559 = arith.constant 10 : i64; + v270 = arith.trunc v559 : felt; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4(v270, v272, v281) + v557 = arith.constant 12 : u32; + v282 = hir.bitcast v177 : u32; + v284 = arith.add v282, v557 : u32 #[overflow = checked]; + v556 = arith.constant 4 : u32; + v286 = arith.mod v284, v556 : u32; + hir.assertz v286 #[code = 250]; + v287 = hir.int_to_ptr v284 : ptr; + v288 = hir.load v287 : felt; + v555 = arith.constant 8 : u32; + v289 = hir.bitcast v177 : u32; + v291 = arith.add v289, v555 : u32 #[overflow = checked]; + v554 = arith.constant 4 : u32; + v293 = arith.mod v291, v554 : u32; + hir.assertz v293 #[code = 250]; + v294 = hir.int_to_ptr v291 : ptr; + v295 = hir.load v294 : felt; + v296 = arith.constant 14 : i64; + v297 = arith.trunc v296 : felt; + hir.assert_eq v295, v297; + v298 = arith.constant 24 : i64; + v299 = arith.trunc v298 : felt; + hir.assert_eq v288, v299; + v553 = arith.constant 8 : i32; + v307 = arith.add v177, v553 : i32 #[overflow = wrapping]; + v304 = arith.constant 300 : i64; + v305 = arith.trunc v304 : felt; + v302 = arith.constant 200 : i64; + v303 = arith.trunc v302 : felt; + v300 = arith.constant 100 : i64; + v301 = arith.trunc v300 : felt; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5(v301, v303, v305, v307) + v552 = arith.constant 16 : u32; + v308 = hir.bitcast v177 : u32; + v310 = arith.add v308, v552 : u32 #[overflow = checked]; + v551 = arith.constant 4 : u32; + v312 = arith.mod v310, v551 : u32; + hir.assertz v312 #[code = 250]; + v313 = hir.int_to_ptr v310 : ptr; + v314 = hir.load v313 : felt; + v550 = arith.constant 12 : u32; + v315 = hir.bitcast v177 : u32; + v317 = arith.add v315, v550 : u32 #[overflow = checked]; + v549 = arith.constant 4 : u32; + v319 = arith.mod v317, v549 : u32; + hir.assertz v319 #[code = 250]; + v320 = hir.int_to_ptr v317 : ptr; + v321 = hir.load v320 : felt; + v548 = arith.constant 8 : u32; + v322 = hir.bitcast v177 : u32; + v324 = arith.add v322, v548 : u32 #[overflow = checked]; + v547 = arith.constant 4 : u32; + v326 = arith.mod v324, v547 : u32; + hir.assertz v326 #[code = 250]; + v327 = hir.int_to_ptr v324 : ptr; + v328 = hir.load v327 : felt; + v329 = arith.constant 105 : i64; + v330 = arith.trunc v329 : felt; + hir.assert_eq v328, v330; + v331 = arith.constant 205 : i64; + v332 = arith.trunc v331 : felt; + hir.assert_eq v321, v332; + v333 = arith.constant 305 : i64; + v334 = arith.trunc v333 : felt; + hir.assert_eq v314, v334; + v546 = arith.constant 8 : i32; + v345 = arith.add v177, v546 : i32 #[overflow = wrapping]; + v343 = arith.constant 3 : i32; + v170 = arith.constant 0 : i32; + v341 = arith.constant 111 : i32; + v339 = arith.constant 50 : i64; + v340 = arith.trunc v339 : felt; + v338 = arith.constant -11 : i32; + v336 = arith.constant -4294967302 : i64; + v337 = arith.trunc v336 : felt; + v335 = arith.constant -1001 : i64; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4(v335, v337, v338, v340, v341, v170, v343, v345) + v545 = arith.constant 8 : u32; + v346 = hir.bitcast v177 : u32; + v348 = arith.add v346, v545 : u32 #[overflow = checked]; + v544 = arith.constant 8 : u32; + v350 = arith.mod v348, v544 : u32; + hir.assertz v350 #[code = 250]; + v351 = hir.int_to_ptr v348 : ptr; + v352 = hir.load v351 : i64; + v543 = arith.constant 0 : i32; + v353 = arith.constant -1 : i64; + v354 = arith.eq v352, v353 : i1; + v355 = arith.zext v354 : u32; + v356 = hir.bitcast v355 : i32; + v358 = arith.neq v356, v543 : i1; + cf.cond_br v358 ^block26, ^block27; + ^block26: + v360 = arith.constant 30 : u32; + v359 = hir.bitcast v177 : u32; + v361 = arith.add v359, v360 : u32 #[overflow = checked]; + v362 = arith.constant 2 : u32; + v363 = arith.mod v361, v362 : u32; + hir.assertz v363 #[code = 250]; + v364 = hir.int_to_ptr v361 : ptr; + v365 = hir.load v364 : u16; + v369 = arith.constant 29 : u32; + v368 = hir.bitcast v177 : u32; + v370 = arith.add v368, v369 : u32 #[overflow = checked]; + v371 = hir.int_to_ptr v370 : ptr; + v372 = hir.load v371 : u8; + v376 = arith.constant 28 : u32; + v375 = hir.bitcast v177 : u32; + v377 = arith.add v375, v376 : u32 #[overflow = checked]; + v378 = hir.int_to_ptr v377 : ptr; + v379 = hir.load v378 : u8; + v383 = arith.constant 24 : u32; + v382 = hir.bitcast v177 : u32; + v384 = arith.add v382, v383 : u32 #[overflow = checked]; + v542 = arith.constant 4 : u32; + v386 = arith.mod v384, v542 : u32; + hir.assertz v386 #[code = 250]; + v387 = hir.int_to_ptr v384 : ptr; + v388 = hir.load v387 : felt; + v541 = arith.constant 20 : u32; + v389 = hir.bitcast v177 : u32; + v391 = arith.add v389, v541 : u32 #[overflow = checked]; + v540 = arith.constant 4 : u32; + v393 = arith.mod v391, v540 : u32; + hir.assertz v393 #[code = 250]; + v394 = hir.int_to_ptr v391 : ptr; + v395 = hir.load v394 : i32; + v539 = arith.constant 16 : u32; + v396 = hir.bitcast v177 : u32; + v398 = arith.add v396, v539 : u32 #[overflow = checked]; + v538 = arith.constant 4 : u32; + v400 = arith.mod v398, v538 : u32; + hir.assertz v400 #[code = 250]; + v401 = hir.int_to_ptr v398 : ptr; + v402 = hir.load v401 : felt; + v403 = arith.constant -4294967296 : i64; + v404 = arith.trunc v403 : felt; + hir.assert_eq v402, v404; + v405 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/::from_u32(v395) : felt + v406 = arith.constant 4294967295 : i64; + v407 = arith.trunc v406 : felt; + hir.assert_eq v405, v407; + v408 = arith.constant 57 : i64; + v409 = arith.trunc v408 : felt; + hir.assert_eq v388, v409; + v380 = arith.zext v379 : u32; + v381 = hir.bitcast v380 : i32; + v410 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v381) : felt + v411 = arith.constant 122 : i64; + v412 = arith.trunc v411 : felt; + hir.assert_eq v410, v412; + v423 = arith.constant 1 : i64; + v424 = arith.trunc v423 : felt; + v537 = arith.constant 0 : i32; + v413 = arith.constant 255 : i32; + v373 = arith.zext v372 : u32; + v374 = hir.bitcast v373 : i32; + v414 = arith.band v374, v413 : i32; + v416 = arith.neq v414, v537 : i1; + v417 = arith.zext v416 : u32; + v418 = hir.bitcast v417 : i32; + v419 = hir.bitcast v418 : u32; + v420 = arith.zext v419 : u64; + v421 = hir.bitcast v420 : i64; + v422 = arith.trunc v421 : felt; + hir.assert_eq v422, v424; + v366 = arith.zext v365 : u32; + v367 = hir.bitcast v366 : i32; + v425 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/>::from(v367) : felt + v536 = arith.constant 12 : i64; + v427 = arith.trunc v536 : felt; + hir.assert_eq v425, v427; + v534 = arith.constant 8 : i32; + v435 = arith.add v177, v534 : i32 #[overflow = wrapping]; + v535 = arith.constant 50 : i64; + v433 = arith.trunc v535 : felt; + v430 = arith.constant 40 : i64; + v431 = arith.trunc v430 : felt; + v428 = arith.constant 30 : i64; + v429 = arith.trunc v428 : felt; + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6(v429, v431, v433, v435) + v533 = arith.constant 16 : u32; + v436 = hir.bitcast v177 : u32; + v438 = arith.add v436, v533 : u32 #[overflow = checked]; + v532 = arith.constant 4 : u32; + v440 = arith.mod v438, v532 : u32; + hir.assertz v440 #[code = 250]; + v441 = hir.int_to_ptr v438 : ptr; + v442 = hir.load v441 : felt; + v531 = arith.constant 12 : u32; + v443 = hir.bitcast v177 : u32; + v445 = arith.add v443, v531 : u32 #[overflow = checked]; + v530 = arith.constant 4 : u32; + v447 = arith.mod v445, v530 : u32; + hir.assertz v447 #[code = 250]; + v448 = hir.int_to_ptr v445 : ptr; + v449 = hir.load v448 : felt; + v529 = arith.constant 8 : u32; + v450 = hir.bitcast v177 : u32; + v452 = arith.add v450, v529 : u32 #[overflow = checked]; + v528 = arith.constant 4 : u32; + v454 = arith.mod v452, v528 : u32; + hir.assertz v454 #[code = 250]; + v455 = hir.int_to_ptr v452 : ptr; + v456 = hir.load v455 : felt; + v457 = arith.constant 38 : i64; + v458 = arith.trunc v457 : felt; + hir.assert_eq v456, v458; + v459 = arith.constant 48 : i64; + v460 = arith.trunc v459 : felt; + hir.assert_eq v449, v460; + v461 = arith.constant 58 : i64; + v462 = arith.trunc v461 : felt; + hir.assert_eq v442, v462; + v527 = arith.constant 32 : i32; + v464 = arith.add v177, v527 : i32 #[overflow = wrapping]; + v465 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/__stack_pointer : ptr + v466 = hir.bitcast v465 : ptr; + hir.store v466, v464; builtin.ret ; ^block27: ub.unreachable ; @@ -517,58 +547,58 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block28: - v469 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr - v470 = hir.bitcast v469 : ptr; - v471 = hir.load v470 : i32; - v472 = arith.constant 1048588 : i32; - v473 = arith.add v471, v472 : i32 #[overflow = wrapping]; - v474 = hir.bitcast v473 : u32; - v475 = hir.int_to_ptr v474 : ptr; - v476 = hir.load v475 : u8; - v468 = arith.constant 0 : i32; - v477 = arith.zext v476 : u32; - v478 = hir.bitcast v477 : i32; - v480 = arith.neq v478, v468 : i1; - scf.if v480{ + v468 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr + v469 = hir.bitcast v468 : ptr; + v470 = hir.load v469 : i32; + v471 = arith.constant 1048588 : i32; + v472 = arith.add v470, v471 : i32 #[overflow = wrapping]; + v473 = hir.bitcast v472 : u32; + v474 = hir.int_to_ptr v473 : ptr; + v475 = hir.load v474 : u8; + v467 = arith.constant 0 : i32; + v476 = arith.zext v475 : u32; + v477 = hir.bitcast v476 : i32; + v479 = arith.neq v477, v467 : i1; + scf.if v479{ ^block30: scf.yield ; } else { ^block31: - v481 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr - v482 = hir.bitcast v481 : ptr; - v483 = hir.load v482 : i32; + v480 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word/GOT.data.internal.__memory_base : ptr + v481 = hir.bitcast v480 : ptr; + v482 = hir.load v481 : i32; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/__wasm_call_ctors() - v621 = arith.constant 1 : u8; - v623 = arith.constant 1048588 : i32; - v485 = arith.add v483, v623 : i32 #[overflow = wrapping]; - v489 = hir.bitcast v485 : u32; - v490 = hir.int_to_ptr v489 : ptr; - hir.store v490, v621; + v579 = arith.constant 1 : u8; + v581 = arith.constant 1048588 : i32; + v484 = arith.add v482, v581 : i32 #[overflow = wrapping]; + v488 = hir.bitcast v484 : u32; + v489 = hir.int_to_ptr v488 : ptr; + hir.store v489, v579; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v491: i32) -> felt { - ^block32(v491: i32): - v493 = hir.bitcast v491 : felt; - builtin.ret v493; + private builtin.function @::from_u32(v490: i32) -> felt { + ^block32(v490: i32): + v492 = hir.bitcast v490 : felt; + builtin.ret v492; }; - private builtin.function @>::from(v494: i32) -> felt { - ^block34(v494: i32): - v496 = arith.constant 65535 : i32; - v497 = arith.band v494, v496 : i32; - v498 = hir.bitcast v497 : felt; - builtin.ret v498; + private builtin.function @>::from(v493: i32) -> felt { + ^block34(v493: i32): + v495 = arith.constant 65535 : i32; + v496 = arith.band v493, v495 : i32; + v497 = hir.bitcast v496 : felt; + builtin.ret v497; }; - private builtin.function @>::from(v499: i32) -> felt { - ^block36(v499: i32): - v501 = arith.constant 255 : i32; - v502 = arith.band v499, v501 : i32; - v503 = hir.bitcast v502 : felt; - builtin.ret v503; + private builtin.function @>::from(v498: i32) -> felt { + ^block36(v498: i32): + v500 = arith.constant 255 : i32; + v501 = arith.band v498, v500 : i32; + v502 = hir.bitcast v501 : felt; + builtin.ret v502; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -582,9 +612,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048576 = 0x000000010000000100000001; }; - public builtin.function @run(v504: felt, v505: felt, v506: felt, v507: felt) { - ^block38(v504: felt, v505: felt, v506: felt, v507: felt): - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/miden:base/note-script@1.0.0#run(v504, v505, v506, v507) + public builtin.function @run(v503: felt, v504: felt, v505: felt, v506: felt) { + ^block38(v503: felt, v504: felt, v505: felt, v506: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/miden:base/note-script@1.0.0#run(v503, v504, v505, v506) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm index e8afd8c6e..fe4b24bae 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm @@ -35,7 +35,7 @@ end # mod ::"miden:base/note-script@1.0.0"::cross_ctx_note_word @callconv("C") -proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7( +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import6( felt, felt, felt, @@ -48,15 +48,10 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ trace.252 nop push.0 - movup.5 - u32wrapping_add - push.0 push.0 - dup.2 + dup.6 u32wrapping_add u32wrapping_add - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -66,11 +61,9 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop push.0 push.4 - dup.2 + dup.5 u32wrapping_add u32wrapping_add - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -80,11 +73,9 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop push.0 push.8 - dup.2 + dup.4 u32wrapping_add u32wrapping_add - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -94,7 +85,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop push.0 push.12 - movup.2 + movup.3 u32wrapping_add u32wrapping_add u32divmod.4 @@ -107,7 +98,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ end @callconv("C") -proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7( +proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import6( felt, felt, felt, @@ -120,15 +111,10 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ trace.252 nop push.0 - movup.5 - u32wrapping_add push.0 - push.0 - dup.2 + dup.6 u32wrapping_add u32wrapping_add - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -138,11 +124,9 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop push.0 push.4 - dup.2 + dup.5 u32wrapping_add u32wrapping_add - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -152,11 +136,9 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop push.0 push.8 - dup.2 + dup.4 u32wrapping_add u32wrapping_add - movup.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -166,7 +148,7 @@ proc cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_ nop push.0 push.12 - movup.2 + movup.3 u32wrapping_add u32wrapping_add u32divmod.4 @@ -512,20 +494,40 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::wit_bindgen::rt::run_ctors_once trace.252 nop + push.2 + push.0 + mul.4294967296 + add + push.3 + push.0 + mul.4294967296 + add + push.4 + push.0 + mul.4294967296 + add + push.5 + push.0 + mul.4294967296 + add push.8 - dup.1 + dup.5 u32wrapping_add - push.5 - push.4 - push.3 - push.2 + dup.4 + dup.4 + dup.4 + dup.4 + swap.1 + swap.2 + swap.1 + swap.3 trace.240 nop - exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import6 trace.252 nop push.20 - dup.1 + dup.5 add u32assert push.4 @@ -542,7 +544,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.16 - dup.2 + dup.6 add u32assert push.4 @@ -559,7 +561,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.12 - dup.3 + dup.7 add u32assert push.4 @@ -576,7 +578,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.8 - dup.4 + dup.8 add u32assert push.4 @@ -593,23 +595,35 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.3 + push.0 + mul.4294967296 + add assert_eq push.5 + push.0 + mul.4294967296 + add assert_eq push.7 + push.0 + mul.4294967296 + add assert_eq push.9 + push.0 + mul.4294967296 + add assert_eq push.8 - dup.1 + dup.5 u32wrapping_add - push.5 - push.4 - push.3 - push.2 + swap.1 + swap.3 + swap.1 + swap.4 trace.240 nop - exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import6 trace.252 nop push.20 @@ -681,20 +695,38 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.4 + push.0 + mul.4294967296 + add assert_eq push.6 + push.0 + mul.4294967296 + add assert_eq push.8 + push.0 + mul.4294967296 + add assert_eq push.10 + push.0 + mul.4294967296 + add assert_eq push.9 + push.0 + mul.4294967296 + add trace.240 nop exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 trace.252 nop push.12 + push.0 + mul.4294967296 + add assert_eq push.8 dup.1 @@ -722,7 +754,13 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) dup.1 u32wrapping_add push.20 + push.0 + mul.4294967296 + add push.10 + push.0 + mul.4294967296 + add trace.240 nop exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4 @@ -763,15 +801,30 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.14 + push.0 + mul.4294967296 + add assert_eq push.24 + push.0 + mul.4294967296 + add assert_eq push.8 dup.1 u32wrapping_add push.300 + push.0 + mul.4294967296 + add push.200 + push.0 + mul.4294967296 + add push.100 + push.0 + mul.4294967296 + add trace.240 nop exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5 @@ -829,10 +882,19 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.105 + push.0 + mul.4294967296 + add assert_eq push.205 + push.0 + mul.4294967296 + add assert_eq push.305 + push.0 + mul.4294967296 + add assert_eq push.8 dup.1 @@ -841,6 +903,9 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) push.0 push.111 push.50 + push.0 + mul.4294967296 + add push.4294967285 push.4294967290 push.4294967294 @@ -998,40 +1063,67 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) assert_eq trace.240 nop - exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::::from_u32 trace.252 nop push.4294967295 + push.0 + mul.4294967296 + add assert_eq push.57 + push.0 + mul.4294967296 + add assert_eq trace.240 nop - exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from trace.252 nop push.122 + push.0 + mul.4294967296 + add assert_eq push.1 push.0 + mul.4294967296 + add + push.0 push.255 movup.3 u32and neq + push.0 + mul.4294967296 + add assert_eq trace.240 nop - exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::>::from trace.252 nop push.12 + push.0 + mul.4294967296 + add assert_eq push.8 dup.1 u32wrapping_add push.50 + push.0 + mul.4294967296 + add push.40 + push.0 + mul.4294967296 + add push.30 + push.0 + mul.4294967296 + add trace.240 nop exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word::cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6 @@ -1089,10 +1181,19 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.38 + push.0 + mul.4294967296 + add assert_eq push.48 + push.0 + mul.4294967296 + add assert_eq push.58 + push.0 + mul.4294967296 + add assert_eq push.32 u32wrapping_add @@ -1186,14 +1287,14 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( +proc ::from_u32( i32 ) -> felt nop end @callconv("C") -proc >::from( +proc >::from( i32 ) -> felt push.65535 @@ -1201,7 +1302,7 @@ proc >::from( end @callconv("C") -proc >::from( +proc >::from( i32 ) -> felt push.255 diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat b/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat index 7e9542dcb..a6ab8ccdf 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -52,8 +51,8 @@ (type (;7;) (func (param f32 f32))) (type (;8;) (func (param i32) (result f32))) (type (;9;) (func (param i64) (result f32))) - (import "miden:cross-ctx-account-word/foo@1.0.0" "process-word" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 (;0;) (type 0))) - (import "miden:cross-ctx-account-word/foo@1.0.0" "process-another-word" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 (;1;) (type 0))) + (import "miden:cross-ctx-account-word/foo@1.0.0" "process-word" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import6 (;0;) (type 0))) + (import "miden:cross-ctx-account-word/foo@1.0.0" "process-another-word" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import6 (;1;) (type 0))) (import "miden:cross-ctx-account-word/foo@1.0.0" "process-felt" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 (;2;) (type 1))) (import "miden:cross-ctx-account-word/foo@1.0.0" "process-pair" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_pair::wit_import4 (;3;) (type 2))) (import "miden:cross-ctx-account-word/foo@1.0.0" "process-triple" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_triple::wit_import5 (;4;) (type 3))) @@ -76,22 +75,22 @@ local.tee 4 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 2 - call $intrinsics::felt::from_u32 + i64.const 2 + call $intrinsics::felt::from_u64_unchecked local.tee 5 - i32.const 3 - call $intrinsics::felt::from_u32 + i64.const 3 + call $intrinsics::felt::from_u64_unchecked local.tee 6 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked local.tee 7 - i32.const 5 - call $intrinsics::felt::from_u32 + i64.const 5 + call $intrinsics::felt::from_u64_unchecked local.tee 8 local.get 4 i32.const 8 i32.add - call $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import7 + call $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_word::wit_import6 local.get 4 f32.load offset=20 local.set 9 @@ -103,20 +102,20 @@ local.set 11 local.get 4 f32.load offset=8 - i32.const 3 - call $intrinsics::felt::from_u32 + i64.const 3 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 11 - i32.const 5 - call $intrinsics::felt::from_u32 + i64.const 5 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 10 - i32.const 7 - call $intrinsics::felt::from_u32 + i64.const 7 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 9 - i32.const 9 - call $intrinsics::felt::from_u32 + i64.const 9 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 local.get 6 @@ -125,7 +124,7 @@ local.get 4 i32.const 8 i32.add - call $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import7 + call $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_another_word::wit_import6 local.get 4 f32.load offset=20 local.set 5 @@ -137,32 +136,32 @@ local.set 7 local.get 4 f32.load offset=8 - i32.const 4 - call $intrinsics::felt::from_u32 + i64.const 4 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 7 - i32.const 6 - call $intrinsics::felt::from_u32 + i64.const 6 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 6 - i32.const 8 - call $intrinsics::felt::from_u32 + i64.const 8 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 - i32.const 10 - call $intrinsics::felt::from_u32 + i64.const 10 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - i32.const 9 - call $intrinsics::felt::from_u32 + i64.const 9 + call $intrinsics::felt::from_u64_unchecked call $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 - i32.const 12 - call $intrinsics::felt::from_u32 + i64.const 12 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - i32.const 10 - call $intrinsics::felt::from_u32 + i64.const 10 + call $intrinsics::felt::from_u64_unchecked local.set 5 - i32.const 20 - call $intrinsics::felt::from_u32 + i64.const 20 + call $intrinsics::felt::from_u64_unchecked local.set 6 local.get 4 i64.const 0 @@ -178,19 +177,19 @@ local.set 5 local.get 4 f32.load offset=8 - i32.const 14 - call $intrinsics::felt::from_u32 + i64.const 14 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 - i32.const 24 - call $intrinsics::felt::from_u32 + i64.const 24 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - i32.const 100 - call $intrinsics::felt::from_u32 - i32.const 200 - call $intrinsics::felt::from_u32 - i32.const 300 - call $intrinsics::felt::from_u32 + i64.const 100 + call $intrinsics::felt::from_u64_unchecked + i64.const 200 + call $intrinsics::felt::from_u64_unchecked + i64.const 300 + call $intrinsics::felt::from_u64_unchecked local.get 4 i32.const 8 i32.add @@ -203,23 +202,23 @@ local.set 6 local.get 4 f32.load offset=8 - i32.const 105 - call $intrinsics::felt::from_u32 + i64.const 105 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 6 - i32.const 205 - call $intrinsics::felt::from_u32 + i64.const 205 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 - i32.const 305 - call $intrinsics::felt::from_u32 + i64.const 305 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq i64.const -1001 i64.const -4294967302 call $intrinsics::felt::from_u64_unchecked i32.const -11 - i32.const 50 - call $intrinsics::felt::from_u32 + i64.const 50 + call $intrinsics::felt::from_u64_unchecked i32.const 111 i32.const 0 i32.const 3 @@ -256,39 +255,40 @@ call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 15 - call $>::from - i32.const -1 - call $intrinsics::felt::from_u32 + call $::from_u32 + i64.const 4294967295 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 - i32.const 57 - call $intrinsics::felt::from_u32 + i64.const 57 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 14 - call $>::from - i32.const 122 - call $intrinsics::felt::from_u32 + call $>::from + i64.const 122 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 13 i32.const 255 i32.and i32.const 0 i32.ne - call $intrinsics::felt::from_u32 - i32.const 1 - call $intrinsics::felt::from_u32 + i64.extend_i32_u + call $intrinsics::felt::from_u64_unchecked + i64.const 1 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 12 - call $>::from - i32.const 12 - call $intrinsics::felt::from_u32 + call $>::from + i64.const 12 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq - i32.const 30 - call $intrinsics::felt::from_u32 - i32.const 40 - call $intrinsics::felt::from_u32 - i32.const 50 - call $intrinsics::felt::from_u32 + i64.const 30 + call $intrinsics::felt::from_u64_unchecked + i64.const 40 + call $intrinsics::felt::from_u64_unchecked + i64.const 50 + call $intrinsics::felt::from_u64_unchecked local.get 4 i32.const 8 i32.add @@ -301,16 +301,16 @@ local.set 6 local.get 4 f32.load offset=8 - i32.const 38 - call $intrinsics::felt::from_u32 + i64.const 38 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 6 - i32.const 48 - call $intrinsics::felt::from_u32 + i64.const 48 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 5 - i32.const 58 - call $intrinsics::felt::from_u32 + i64.const 58 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq local.get 4 i32.const 32 @@ -344,21 +344,21 @@ (func $intrinsics::felt::from_u64_unchecked (;13;) (type 9) (param i64) (result f32) unreachable ) - (func $>::from (;14;) (type 8) (param i32) (result f32) + (func $::from_u32 (;14;) (type 8) (param i32) (result f32) local.get 0 - f32.reinterpret_i32 + call $intrinsics::felt::from_u32 ) - (func $>::from (;15;) (type 8) (param i32) (result f32) + (func $>::from (;15;) (type 8) (param i32) (result f32) local.get 0 i32.const 65535 i32.and - f32.reinterpret_i32 + call $intrinsics::felt::from_u32 ) - (func $>::from (;16;) (type 8) (param i32) (result f32) + (func $>::from (;16;) (type 8) (param i32) (result f32) local.get 0 i32.const 255 i32.and - f32.reinterpret_i32 + call $intrinsics::felt::from_u32 ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) @@ -501,15 +501,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir index 96519aee8..e257a5697 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.hir @@ -1,6 +1,6 @@ builtin.component miden:base/note-script@1.0.0 { builtin.module public @cross_ctx_note_word_arg { - private builtin.function @cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: felt, v13: felt, v14: felt, v15: felt) -> felt { + private builtin.function @cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import19(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: felt, v13: felt, v14: felt, v15: felt) -> felt { ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt, v9: felt, v10: felt, v11: felt, v12: felt, v13: felt, v14: felt, v15: felt): v16 = hir.call v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 : felt #[callee = miden:cross-ctx-account-word-arg/foo@1.0.0/process-word] #[signature = (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)]; builtin.ret v16; @@ -19,24 +19,44 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden:base/note-script@1.0.0#run(v17: felt, v18: felt, v19: felt, v20: felt) { ^block12(v17: felt, v18: felt, v19: felt, v20: felt): hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/wit_bindgen::rt::run_ctors_once() - v93 = arith.constant 7 : felt; - v85 = arith.constant 15 : felt; - v86 = arith.constant 14 : felt; - v87 = arith.constant 13 : felt; - v88 = arith.constant 12 : felt; - v89 = arith.constant 11 : felt; - v90 = arith.constant 10 : felt; - v91 = arith.constant 9 : felt; - v92 = arith.constant 8 : felt; - v94 = arith.constant 6 : felt; - v95 = arith.constant 5 : felt; - v96 = arith.constant 4 : felt; - v97 = arith.constant 3 : felt; - v98 = arith.constant 2 : felt; - v99 = arith.constant 1 : felt; - v53 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22(v99, v98, v97, v96, v95, v94, v93, v92, v91, v90, v89, v88, v87, v86, v85, v93) : felt - v83 = arith.constant 458760 : felt; - hir.assert_eq v53, v83; + v83 = arith.constant 7 : i64; + v52 = arith.trunc v83 : felt; + v49 = arith.constant 15 : i64; + v50 = arith.trunc v49 : felt; + v47 = arith.constant 14 : i64; + v48 = arith.trunc v47 : felt; + v45 = arith.constant 13 : i64; + v46 = arith.trunc v45 : felt; + v43 = arith.constant 12 : i64; + v44 = arith.trunc v43 : felt; + v41 = arith.constant 11 : i64; + v42 = arith.trunc v41 : felt; + v39 = arith.constant 10 : i64; + v40 = arith.trunc v39 : felt; + v37 = arith.constant 9 : i64; + v38 = arith.trunc v37 : felt; + v35 = arith.constant 8 : i64; + v36 = arith.trunc v35 : felt; + v33 = arith.constant 7 : i64; + v34 = arith.trunc v33 : felt; + v31 = arith.constant 6 : i64; + v32 = arith.trunc v31 : felt; + v29 = arith.constant 5 : i64; + v30 = arith.trunc v29 : felt; + v27 = arith.constant 4 : i64; + v28 = arith.trunc v27 : felt; + v25 = arith.constant 3 : i64; + v26 = arith.trunc v25 : felt; + v23 = arith.constant 2 : i64; + v24 = arith.trunc v23 : felt; + hir.store_local v24 #[local = lv0]; + v21 = arith.constant 1 : i64; + v22 = arith.trunc v21 : felt; + v85 = hir.load_local : felt #[local = lv0]; + v53 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import19(v22, v85, v26, v28, v30, v32, v34, v36, v38, v40, v42, v44, v46, v48, v50, v52) : felt + v54 = arith.constant 458760 : i64; + v55 = arith.trunc v54 : felt; + hir.assert_eq v53, v55; builtin.ret ; }; @@ -63,12 +83,12 @@ builtin.component miden:base/note-script@1.0.0 { v70 = hir.bitcast v69 : ptr; v71 = hir.load v70 : i32; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/__wasm_call_ctors() - v101 = arith.constant 1 : u8; - v103 = arith.constant 1048588 : i32; - v73 = arith.add v71, v103 : i32 #[overflow = wrapping]; + v87 = arith.constant 1 : u8; + v89 = arith.constant 1048588 : i32; + v73 = arith.add v71, v89 : i32 #[overflow = wrapping]; v77 = hir.bitcast v73 : u32; v78 = hir.int_to_ptr v77 : ptr; - hir.store v78, v101; + hir.store v78, v87; scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm index 266e01044..b1be697a6 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.masm @@ -35,7 +35,7 @@ end # mod ::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg @callconv("C") -proc cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22( +proc cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import19( felt, felt, felt, @@ -74,6 +74,7 @@ proc cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports nop end +@locals("1") @callconv("C") proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) drop @@ -86,34 +87,95 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.7 + push.0 + mul.4294967296 + add push.15 + push.0 + mul.4294967296 + add push.14 + push.0 + mul.4294967296 + add push.13 + push.0 + mul.4294967296 + add push.12 + push.0 + mul.4294967296 + add push.11 + push.0 + mul.4294967296 + add push.10 + push.0 + mul.4294967296 + add push.9 + push.0 + mul.4294967296 + add push.8 + push.0 + mul.4294967296 + add + push.7 + push.0 + mul.4294967296 + add push.6 + push.0 + mul.4294967296 + add push.5 + push.0 + mul.4294967296 + add push.4 + push.0 + mul.4294967296 + add push.3 + push.0 + mul.4294967296 + add push.2 + push.0 + mul.4294967296 + add + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop push.1 - dup.14 - swap.15 - swap.6 - swap.5 - swap.4 - swap.3 - swap.2 + push.0 + mul.4294967296 + add + locaddr.0 + push.0 swap.1 trace.240 nop - exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg::cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::cross_ctx_note_word_arg::cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import19 trace.252 nop push.458760 + push.0 + mul.4294967296 + add assert_eq end diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat index 695773839..df830e182 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word_arg.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -27,8 +26,8 @@ (type (;1;) (func)) (type (;2;) (func (param f32 f32 f32 f32))) (type (;3;) (func (param f32 f32))) - (type (;4;) (func (param i32) (result f32))) - (import "miden:cross-ctx-account-word-arg/foo@1.0.0" "process-word" (func $cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 (;0;) (type 0))) + (type (;4;) (func (param i64) (result f32))) + (import "miden:cross-ctx-account-word-arg/foo@1.0.0" "process-word" (func $cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import19 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -40,41 +39,41 @@ (func $cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports (;2;) (type 1)) (func $miden:base/note-script@1.0.0#run (;3;) (type 2) (param f32 f32 f32 f32) call $wit_bindgen::rt::run_ctors_once - i32.const 1 - call $intrinsics::felt::from_u32 - i32.const 2 - call $intrinsics::felt::from_u32 - i32.const 3 - call $intrinsics::felt::from_u32 - i32.const 4 - call $intrinsics::felt::from_u32 - i32.const 5 - call $intrinsics::felt::from_u32 - i32.const 6 - call $intrinsics::felt::from_u32 - i32.const 7 - call $intrinsics::felt::from_u32 - i32.const 8 - call $intrinsics::felt::from_u32 - i32.const 9 - call $intrinsics::felt::from_u32 - i32.const 10 - call $intrinsics::felt::from_u32 - i32.const 11 - call $intrinsics::felt::from_u32 - i32.const 12 - call $intrinsics::felt::from_u32 - i32.const 13 - call $intrinsics::felt::from_u32 - i32.const 14 - call $intrinsics::felt::from_u32 - i32.const 15 - call $intrinsics::felt::from_u32 - i32.const 7 - call $intrinsics::felt::from_u32 - call $cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import22 - i32.const 458760 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked + i64.const 2 + call $intrinsics::felt::from_u64_unchecked + i64.const 3 + call $intrinsics::felt::from_u64_unchecked + i64.const 4 + call $intrinsics::felt::from_u64_unchecked + i64.const 5 + call $intrinsics::felt::from_u64_unchecked + i64.const 6 + call $intrinsics::felt::from_u64_unchecked + i64.const 7 + call $intrinsics::felt::from_u64_unchecked + i64.const 8 + call $intrinsics::felt::from_u64_unchecked + i64.const 9 + call $intrinsics::felt::from_u64_unchecked + i64.const 10 + call $intrinsics::felt::from_u64_unchecked + i64.const 11 + call $intrinsics::felt::from_u64_unchecked + i64.const 12 + call $intrinsics::felt::from_u64_unchecked + i64.const 13 + call $intrinsics::felt::from_u64_unchecked + i64.const 14 + call $intrinsics::felt::from_u64_unchecked + i64.const 15 + call $intrinsics::felt::from_u64_unchecked + i64.const 7 + call $intrinsics::felt::from_u64_unchecked + call $cross_ctx_note_word_arg::bindings::miden::cross_ctx_account_word_arg::foo::process_word::wit_import19 + i64.const 458760 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::assert_eq ) (func $wit_bindgen::rt::run_ctors_once (;4;) (type 1) @@ -98,7 +97,7 @@ (func $intrinsics::felt::assert_eq (;5;) (type 3) (param f32 f32) unreachable ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) unreachable ) (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") @@ -122,15 +121,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;2;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir index 166c02f16..e1d87bbee 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.hir @@ -21,10 +21,13 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v150 = arith.constant 10 : felt; - v151 = arith.constant 0 : felt; - v152 = arith.constant 1 : felt; - hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden_base_sys::bindings::asset::build_fungible_asset(v6, v152, v151, v150) + v13 = arith.constant 10 : i64; + v14 = arith.trunc v13 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; + v9 = arith.constant 1 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden_base_sys::bindings::asset::build_fungible_asset(v6, v10, v12, v14) v15 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/GOT.data.internal.__memory_base : ptr v16 = hir.bitcast v15 : ptr; v17 = hir.load v16 : i32; @@ -33,33 +36,33 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust v21 = arith.constant 8 : u32; v20 = hir.bitcast v6 : u32; v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v157 = arith.constant 8 : u32; - v24 = arith.mod v22, v157 : u32; + v152 = arith.constant 8 : u32; + v24 = arith.mod v22, v152 : u32; hir.assertz v24 #[code = 250]; v25 = hir.int_to_ptr v22 : ptr; v26 = hir.load v25 : i64; - v156 = arith.constant 8 : u32; + v151 = arith.constant 8 : u32; v27 = hir.bitcast v19 : u32; - v29 = arith.add v27, v156 : u32 #[overflow = checked]; + v29 = arith.add v27, v151 : u32 #[overflow = checked]; v30 = arith.constant 4 : u32; v31 = arith.mod v29, v30 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; hir.store v32, v26; v33 = hir.bitcast v6 : u32; - v155 = arith.constant 8 : u32; - v35 = arith.mod v33, v155 : u32; + v150 = arith.constant 8 : u32; + v35 = arith.mod v33, v150 : u32; hir.assertz v35 #[code = 250]; v36 = hir.int_to_ptr v33 : ptr; v37 = hir.load v36 : i64; v38 = hir.bitcast v19 : u32; - v154 = arith.constant 4 : u32; - v40 = arith.mod v38, v154 : u32; + v149 = arith.constant 4 : u32; + v40 = arith.mod v38, v149 : u32; hir.assertz v40 #[code = 250]; v41 = hir.int_to_ptr v38 : ptr; hir.store v41, v37; - v153 = arith.constant 16 : i32; - v43 = arith.add v6, v153 : i32 #[overflow = wrapping]; + v148 = arith.constant 16 : i32; + v43 = arith.add v6, v148 : i32 #[overflow = wrapping]; v44 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr v45 = hir.bitcast v44 : ptr; hir.store v45, v43; @@ -89,12 +92,12 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust v60 = hir.bitcast v59 : ptr; v61 = hir.load v60 : i32; hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__wasm_call_ctors() - v159 = arith.constant 1 : u8; - v161 = arith.constant 1048600 : i32; - v63 = arith.add v61, v161 : i32 #[overflow = wrapping]; + v154 = arith.constant 1 : u8; + v156 = arith.constant 1048600 : i32; + v63 = arith.add v61, v156 : i32 #[overflow = wrapping]; v67 = hir.bitcast v63 : u32; v68 = hir.int_to_ptr v67 : ptr; - hir.store v68, v159; + hir.store v68, v154; scf.yield ; }; builtin.ret ; @@ -117,34 +120,34 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust hir.assertz v83 #[code = 250]; v84 = hir.int_to_ptr v81 : ptr; v85 = hir.load v84 : i64; - v165, v166 = arith.split v85 : felt, felt; - v173 = arith.constant 8 : u32; + v160, v161 = arith.split v85 : felt, felt; + v168 = arith.constant 8 : u32; v89 = hir.bitcast v69 : u32; - v91 = arith.add v89, v173 : u32 #[overflow = checked]; - v172 = arith.constant 8 : u32; - v93 = arith.mod v91, v172 : u32; + v91 = arith.add v89, v168 : u32 #[overflow = checked]; + v167 = arith.constant 8 : u32; + v93 = arith.mod v91, v167 : u32; hir.assertz v93 #[code = 250]; - v167 = arith.join v166, v165 : i64; + v162 = arith.join v161, v160 : i64; v94 = hir.int_to_ptr v91 : ptr; - hir.store v94, v167; - v171 = arith.constant 8 : u32; + hir.store v94, v162; + v166 = arith.constant 8 : u32; v95 = hir.bitcast v78 : u32; - v97 = arith.add v95, v171 : u32 #[overflow = checked]; - v170 = arith.constant 8 : u32; - v99 = arith.mod v97, v170 : u32; + v97 = arith.add v95, v166 : u32 #[overflow = checked]; + v165 = arith.constant 8 : u32; + v99 = arith.mod v97, v165 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : i64; - v162, v163 = arith.split v101 : felt, felt; + v157, v158 = arith.split v101 : felt, felt; v105 = hir.bitcast v69 : u32; - v169 = arith.constant 8 : u32; - v107 = arith.mod v105, v169 : u32; + v164 = arith.constant 8 : u32; + v107 = arith.mod v105, v164 : u32; hir.assertz v107 #[code = 250]; - v164 = arith.join v163, v162 : i64; + v159 = arith.join v158, v157 : i64; v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v164; - v168 = arith.constant 16 : i32; - v110 = arith.add v78, v168 : i32 #[overflow = wrapping]; + hir.store v108, v159; + v163 = arith.constant 16 : i32; + v110 = arith.add v78, v163 : i32 #[overflow = wrapping]; v111 = builtin.global_symbol @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/__stack_pointer : ptr v112 = hir.bitcast v111 : ptr; hir.store v112, v110; @@ -170,34 +173,32 @@ builtin.component miden:rust-sdk-account-asset-build-fungible-asset-binding/rust public builtin.function @binding() -> felt, felt, felt, felt { ^block19: v117 = hir.exec @miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_fungible_asset_binding/miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1#binding() : i32 - v179 = arith.constant 0 : i32; v118 = arith.constant 0 : i32; v119 = arith.add v117, v118 : i32 #[overflow = unchecked]; - v121 = arith.add v119, v179 : i32 #[overflow = unchecked]; - v177 = arith.constant 0 : i32; - v178 = arith.constant 0 : i32; - v123 = arith.add v121, v178 : i32 #[overflow = unchecked]; - v125 = arith.add v123, v177 : i32 #[overflow = unchecked]; - v126 = hir.int_to_ptr v125 : ptr; - v127 = hir.load v126 : felt; - v176 = arith.constant 0 : i32; - v128 = arith.constant 4 : i32; - v129 = arith.add v121, v128 : i32 #[overflow = unchecked]; - v131 = arith.add v129, v176 : i32 #[overflow = unchecked]; - v132 = hir.int_to_ptr v131 : ptr; - v133 = hir.load v132 : felt; - v175 = arith.constant 0 : i32; - v134 = arith.constant 8 : i32; - v135 = arith.add v121, v134 : i32 #[overflow = unchecked]; - v137 = arith.add v135, v175 : i32 #[overflow = unchecked]; - v138 = hir.int_to_ptr v137 : ptr; - v139 = hir.load v138 : felt; - v174 = arith.constant 0 : i32; - v140 = arith.constant 12 : i32; - v141 = arith.add v121, v140 : i32 #[overflow = unchecked]; - v143 = arith.add v141, v174 : i32 #[overflow = unchecked]; - v144 = hir.int_to_ptr v143 : ptr; - v145 = hir.load v144 : felt; - builtin.ret v127, v133, v139, v145; + v172 = arith.constant 0 : i32; + v173 = arith.constant 0 : i32; + v121 = arith.add v119, v173 : i32 #[overflow = unchecked]; + v123 = arith.add v121, v172 : i32 #[overflow = unchecked]; + v124 = hir.int_to_ptr v123 : ptr; + v125 = hir.load v124 : felt; + v171 = arith.constant 0 : i32; + v126 = arith.constant 4 : i32; + v127 = arith.add v119, v126 : i32 #[overflow = unchecked]; + v129 = arith.add v127, v171 : i32 #[overflow = unchecked]; + v130 = hir.int_to_ptr v129 : ptr; + v131 = hir.load v130 : felt; + v170 = arith.constant 0 : i32; + v132 = arith.constant 8 : i32; + v133 = arith.add v119, v132 : i32 #[overflow = unchecked]; + v135 = arith.add v133, v170 : i32 #[overflow = unchecked]; + v136 = hir.int_to_ptr v135 : ptr; + v137 = hir.load v136 : felt; + v169 = arith.constant 0 : i32; + v138 = arith.constant 12 : i32; + v139 = arith.add v119, v138 : i32 #[overflow = unchecked]; + v141 = arith.add v139, v169 : i32 #[overflow = unchecked]; + v142 = hir.int_to_ptr v141 : ptr; + v143 = hir.load v142 : felt; + builtin.ret v125, v131, v137, v143; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm index 96888a3bb..c08bbd754 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -136,7 +133,16 @@ proc miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account- nop push.10 push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add push.1 + push.0 + mul.4294967296 + add dup.3 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat index 52becdace..0e3dad572 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_fungible_asset_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,7 +14,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32 f32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -35,12 +34,12 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 1 - call $intrinsics::felt::from_u32 - i32.const 0 - call $intrinsics::felt::from_u32 - i32.const 10 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + i64.const 10 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::asset::build_fungible_asset global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -106,7 +105,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::asset::build_fungible_asset (;6;) (type 4) (param f32 f32 f32 i32) @@ -127,17 +126,16 @@ (component $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-asset0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "asset" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-asset0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "asset" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-asset-build-fungible-asset-binding/rust-sdk-account-asset-build-fungible-asset-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir index f60e160e4..f538d8e69 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.hir @@ -12,255 +12,291 @@ builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/ private builtin.function @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() -> i32 { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v5 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 32 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v229 = arith.constant 0 : felt; - v230 = arith.constant 1 : felt; + v356 = arith.constant 0 : i64; + v15 = arith.trunc v356 : felt; + v12 = arith.constant 1 : i64; + v13 = arith.trunc v12 : felt; + v14 = arith.constant 0 : i64; + v18 = arith.trunc v14 : felt; v1 = arith.constant 0 : i32; - v301, v302, v303, v304, v305, v306, v307, v308 = scf.while v1, v7, v229, v230, v229 : i32, i32, felt, felt, felt, i32, felt, felt { - ^block32(v309: i32, v310: i32, v311: felt, v312: felt, v313: felt): - v339 = arith.constant 0 : i32; - v59 = arith.constant 16 : i32; - v19 = arith.eq v309, v59 : i1; - v20 = arith.zext v19 : u32; - v21 = hir.bitcast v20 : i32; - v23 = arith.neq v21, v339 : i1; - v294 = scf.if v23 : i32 { - ^block31: - v241 = ub.poison i32 : i32; - scf.yield v241; + v323, v324, v325, v326, v327, v328, v329, v330 = scf.while v1, v9, v18, v13, v15 : i32, i32, felt, felt, felt, i32, felt, felt { + ^block38(v331: i32, v332: i32, v333: felt, v334: felt, v335: felt): + v355 = arith.constant 0 : i32; + v37 = arith.constant 16 : i32; + v21 = arith.eq v331, v37 : i1; + v22 = arith.zext v21 : u32; + v23 = hir.bitcast v22 : i32; + v25 = arith.neq v23, v355 : i1; + v316 = scf.if v25 : i32 { + ^block37: + v263 = ub.poison i32 : i32; + scf.yield v263; } else { ^block14: - v338 = arith.constant 16 : i32; - v26 = arith.add v310, v338 : i32 #[overflow = wrapping]; - v27 = arith.add v26, v309 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v27 : u32; - v38 = arith.constant 4 : u32; - v31 = arith.mod v29, v38 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v311; - v33 = arith.constant 4 : i32; - v34 = arith.add v309, v33 : i32 #[overflow = wrapping]; - scf.yield v34; + v354 = arith.constant 16 : i32; + v28 = arith.add v332, v354 : i32 #[overflow = wrapping]; + v29 = arith.add v28, v331 : i32 #[overflow = wrapping]; + v31 = hir.bitcast v29 : u32; + v58 = arith.constant 4 : u32; + v33 = arith.mod v31, v58 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + hir.store v34, v333; + v35 = arith.constant 4 : i32; + v36 = arith.add v331, v35 : i32 #[overflow = wrapping]; + scf.yield v36; }; - v335 = ub.poison felt : felt; - v298 = cf.select v23, v335, v313 : felt; - v336 = ub.poison felt : felt; - v297 = cf.select v23, v336, v312 : felt; - v242 = ub.poison felt : felt; - v296 = cf.select v23, v242, v311 : felt; - v337 = ub.poison i32 : i32; - v295 = cf.select v23, v337, v310 : i32; - v240 = arith.constant 1 : u32; - v232 = arith.constant 0 : u32; - v300 = cf.select v23, v232, v240 : u32; - v286 = arith.trunc v300 : i1; - scf.condition v286, v294, v295, v296, v297, v298, v310, v312, v313; + v351 = ub.poison felt : felt; + v320 = cf.select v25, v351, v335 : felt; + v352 = ub.poison felt : felt; + v319 = cf.select v25, v352, v334 : felt; + v264 = ub.poison felt : felt; + v318 = cf.select v25, v264, v333 : felt; + v353 = ub.poison i32 : i32; + v317 = cf.select v25, v353, v332 : i32; + v262 = arith.constant 1 : u32; + v254 = arith.constant 0 : u32; + v322 = cf.select v25, v254, v262 : u32; + v308 = arith.trunc v322 : i1; + scf.condition v308, v316, v317, v318, v319, v320, v332, v334, v335; } do { - ^block33(v314: i32, v315: i32, v316: felt, v317: felt, v318: felt, v319: i32, v320: felt, v321: felt): - scf.yield v314, v315, v316, v317, v318; + ^block39(v336: i32, v337: i32, v338: felt, v339: felt, v340: felt, v341: i32, v342: felt, v343: felt): + scf.yield v336, v337, v338, v339, v340; }; - v36 = arith.constant 24 : u32; - v35 = hir.bitcast v306 : u32; - v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v334 = arith.constant 4 : u32; - v39 = arith.mod v37, v334 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - v41 = hir.load v40 : i64; - v43 = arith.constant 8 : u32; - v42 = hir.bitcast v306 : u32; - v44 = arith.add v42, v43 : u32 #[overflow = checked]; - v333 = arith.constant 8 : u32; - v46 = arith.mod v44, v333 : u32; - hir.assertz v46 #[code = 250]; - v47 = hir.int_to_ptr v44 : ptr; - hir.store v47, v41; - v49 = arith.constant 16 : u32; - v48 = hir.bitcast v306 : u32; + v350 = arith.constant 16 : i32; + v38 = arith.add v328, v350 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/>::from(v328, v38) + v349 = arith.constant 16 : i32; + v40 = arith.add v328, v349 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden_base_sys::bindings::asset::build_non_fungible_asset(v40, v329, v330, v328) + v43 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v44 = hir.bitcast v43 : ptr; + v45 = hir.load v44 : i32; + v46 = arith.constant 1048612 : i32; + v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; + v49 = arith.constant 24 : u32; + v48 = hir.bitcast v328 : u32; v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v332 = arith.constant 4 : u32; - v52 = arith.mod v50, v332 : u32; + v51 = arith.constant 8 : u32; + v52 = arith.mod v50, v51 : u32; hir.assertz v52 #[code = 250]; v53 = hir.int_to_ptr v50 : ptr; v54 = hir.load v53 : i64; - v55 = hir.bitcast v306 : u32; - v331 = arith.constant 8 : u32; - v57 = arith.mod v55, v331 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v54; - v330 = arith.constant 16 : i32; - v60 = arith.add v306, v330 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden_base_sys::bindings::asset::build_non_fungible_asset(v60, v307, v308, v306) - v63 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v64 = hir.bitcast v63 : ptr; - v65 = hir.load v64 : i32; - v66 = arith.constant 1048584 : i32; - v67 = arith.add v65, v66 : i32 #[overflow = wrapping]; - v329 = arith.constant 24 : u32; - v68 = hir.bitcast v306 : u32; - v70 = arith.add v68, v329 : u32 #[overflow = checked]; - v328 = arith.constant 8 : u32; - v72 = arith.mod v70, v328 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i64; - v327 = arith.constant 8 : u32; - v75 = hir.bitcast v67 : u32; - v77 = arith.add v75, v327 : u32 #[overflow = checked]; - v326 = arith.constant 4 : u32; - v79 = arith.mod v77, v326 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - hir.store v80, v74; - v325 = arith.constant 16 : u32; - v81 = hir.bitcast v306 : u32; - v83 = arith.add v81, v325 : u32 #[overflow = checked]; - v324 = arith.constant 8 : u32; - v85 = arith.mod v83, v324 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : i64; - v88 = hir.bitcast v67 : u32; - v323 = arith.constant 4 : u32; - v90 = arith.mod v88, v323 : u32; - hir.assertz v90 #[code = 250]; - v91 = hir.int_to_ptr v88 : ptr; - hir.store v91, v87; - v322 = arith.constant 32 : i32; - v93 = arith.add v306, v322 : i32 #[overflow = wrapping]; - v94 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - hir.store v95, v93; - builtin.ret v67; + v348 = arith.constant 8 : u32; + v55 = hir.bitcast v47 : u32; + v57 = arith.add v55, v348 : u32 #[overflow = checked]; + v347 = arith.constant 4 : u32; + v59 = arith.mod v57, v347 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + hir.store v60, v54; + v62 = arith.constant 16 : u32; + v61 = hir.bitcast v328 : u32; + v63 = arith.add v61, v62 : u32 #[overflow = checked]; + v346 = arith.constant 8 : u32; + v65 = arith.mod v63, v346 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : i64; + v68 = hir.bitcast v47 : u32; + v345 = arith.constant 4 : u32; + v70 = arith.mod v68, v345 : u32; + hir.assertz v70 #[code = 250]; + v71 = hir.int_to_ptr v68 : ptr; + hir.store v71, v67; + v344 = arith.constant 32 : i32; + v73 = arith.add v328, v344 : i32 #[overflow = wrapping]; + v74 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + hir.store v75, v73; + builtin.ret v47; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v97 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v98 = hir.bitcast v97 : ptr; - v99 = hir.load v98 : i32; - v100 = arith.constant 1048600 : i32; - v101 = arith.add v99, v100 : i32 #[overflow = wrapping]; - v102 = hir.bitcast v101 : u32; - v103 = hir.int_to_ptr v102 : ptr; - v104 = hir.load v103 : u8; - v96 = arith.constant 0 : i32; - v105 = arith.zext v104 : u32; - v106 = hir.bitcast v105 : i32; - v108 = arith.neq v106, v96 : i1; - scf.if v108{ + v77 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v78 = hir.bitcast v77 : ptr; + v79 = hir.load v78 : i32; + v80 = arith.constant 1048628 : i32; + v81 = arith.add v79, v80 : i32 #[overflow = wrapping]; + v82 = hir.bitcast v81 : u32; + v83 = hir.int_to_ptr v82 : ptr; + v84 = hir.load v83 : u8; + v76 = arith.constant 0 : i32; + v85 = arith.zext v84 : u32; + v86 = hir.bitcast v85 : i32; + v88 = arith.neq v86, v76 : i1; + scf.if v88{ ^block17: scf.yield ; } else { ^block18: - v109 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v110 = hir.bitcast v109 : ptr; - v111 = hir.load v110 : i32; + v89 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v90 = hir.bitcast v89 : ptr; + v91 = hir.load v90 : i32; hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__wasm_call_ctors() - v341 = arith.constant 1 : u8; - v343 = arith.constant 1048600 : i32; - v113 = arith.add v111, v343 : i32 #[overflow = wrapping]; - v117 = hir.bitcast v113 : u32; - v118 = hir.int_to_ptr v117 : ptr; - hir.store v118, v341; + v358 = arith.constant 1 : u8; + v360 = arith.constant 1048628 : i32; + v93 = arith.add v91, v360 : i32 #[overflow = wrapping]; + v97 = hir.bitcast v93 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v358; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::asset::build_non_fungible_asset(v119: i32, v120: felt, v121: felt, v122: i32) { - ^block19(v119: i32, v120: felt, v121: felt, v122: i32): - v124 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v125 = hir.bitcast v124 : ptr; - v126 = hir.load v125 : i32; - v127 = arith.constant 16 : i32; - v128 = arith.sub v126, v127 : i32 #[overflow = wrapping]; - v129 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v130 = hir.bitcast v129 : ptr; - hir.store v130, v128; - v132 = arith.constant 12 : u32; - v131 = hir.bitcast v122 : u32; - v133 = arith.add v131, v132 : u32 #[overflow = checked]; - v134 = arith.constant 4 : u32; - v135 = arith.mod v133, v134 : u32; - hir.assertz v135 #[code = 250]; - v136 = hir.int_to_ptr v133 : ptr; - v137 = hir.load v136 : felt; - v139 = arith.constant 8 : u32; - v138 = hir.bitcast v122 : u32; - v140 = arith.add v138, v139 : u32 #[overflow = checked]; - v360 = arith.constant 4 : u32; - v142 = arith.mod v140, v360 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : felt; - v359 = arith.constant 4 : u32; - v145 = hir.bitcast v122 : u32; - v147 = arith.add v145, v359 : u32 #[overflow = checked]; - v358 = arith.constant 4 : u32; - v149 = arith.mod v147, v358 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : felt; - v152 = hir.bitcast v122 : u32; - v357 = arith.constant 4 : u32; - v154 = arith.mod v152, v357 : u32; - hir.assertz v154 #[code = 250]; - v155 = hir.int_to_ptr v152 : ptr; - v156 = hir.load v155 : felt; - hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden::protocol::asset::build_non_fungible_asset(v120, v137, v144, v151, v156, v128) - v157 = hir.bitcast v128 : u32; - v356 = arith.constant 8 : u32; - v159 = arith.mod v157, v356 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - v161 = hir.load v160 : i64; - v347, v348 = arith.split v161 : felt, felt; - v355 = arith.constant 8 : u32; - v165 = hir.bitcast v119 : u32; - v167 = arith.add v165, v355 : u32 #[overflow = checked]; - v354 = arith.constant 8 : u32; - v169 = arith.mod v167, v354 : u32; - hir.assertz v169 #[code = 250]; - v349 = arith.join v348, v347 : i64; - v170 = hir.int_to_ptr v167 : ptr; - hir.store v170, v349; - v353 = arith.constant 8 : u32; - v171 = hir.bitcast v128 : u32; - v173 = arith.add v171, v353 : u32 #[overflow = checked]; - v352 = arith.constant 8 : u32; - v175 = arith.mod v173, v352 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v344, v345 = arith.split v177 : felt, felt; - v181 = hir.bitcast v119 : u32; - v351 = arith.constant 8 : u32; - v183 = arith.mod v181, v351 : u32; - hir.assertz v183 #[code = 250]; - v346 = arith.join v345, v344 : i64; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v346; - v350 = arith.constant 16 : i32; - v186 = arith.add v128, v350 : i32 #[overflow = wrapping]; - v187 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr - v188 = hir.bitcast v187 : ptr; - hir.store v188, v186; + private builtin.function @miden_base_sys::bindings::asset::build_non_fungible_asset(v99: i32, v100: felt, v101: felt, v102: i32) { + ^block19(v99: i32, v100: felt, v101: felt, v102: i32): + v104 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v105 = hir.bitcast v104 : ptr; + v106 = hir.load v105 : i32; + v107 = arith.constant 16 : i32; + v108 = arith.sub v106, v107 : i32 #[overflow = wrapping]; + v109 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v110 = hir.bitcast v109 : ptr; + hir.store v110, v108; + v112 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v113 = hir.bitcast v112 : ptr; + v114 = hir.load v113 : i32; + v115 = arith.constant 1048596 : i32; + v116 = arith.add v114, v115 : i32 #[overflow = wrapping]; + v111 = arith.constant 3 : i32; + v117 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/>::index(v102, v111, v116) : i32 + v118 = hir.bitcast v117 : u32; + v119 = arith.constant 4 : u32; + v120 = arith.mod v118, v119 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + v122 = hir.load v121 : felt; + v123 = arith.constant 2 : i32; + v124 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/>::index(v102, v123, v116) : i32 + v125 = hir.bitcast v124 : u32; + v375 = arith.constant 4 : u32; + v127 = arith.mod v125, v375 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + v129 = hir.load v128 : felt; + v130 = arith.constant 1 : i32; + v131 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/>::index(v102, v130, v116) : i32 + v132 = hir.bitcast v131 : u32; + v374 = arith.constant 4 : u32; + v134 = arith.mod v132, v374 : u32; + hir.assertz v134 #[code = 250]; + v135 = hir.int_to_ptr v132 : ptr; + v136 = hir.load v135 : felt; + v103 = arith.constant 0 : i32; + v138 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/>::index(v102, v103, v116) : i32 + v139 = hir.bitcast v138 : u32; + v373 = arith.constant 4 : u32; + v141 = arith.mod v139, v373 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : felt; + hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden::protocol::asset::build_non_fungible_asset(v100, v122, v129, v136, v143, v108) + v144 = hir.bitcast v108 : u32; + v145 = arith.constant 8 : u32; + v146 = arith.mod v144, v145 : u32; + hir.assertz v146 #[code = 250]; + v147 = hir.int_to_ptr v144 : ptr; + v148 = hir.load v147 : i64; + v364, v365 = arith.split v148 : felt, felt; + v372 = arith.constant 8 : u32; + v152 = hir.bitcast v99 : u32; + v154 = arith.add v152, v372 : u32 #[overflow = checked]; + v371 = arith.constant 8 : u32; + v156 = arith.mod v154, v371 : u32; + hir.assertz v156 #[code = 250]; + v366 = arith.join v365, v364 : i64; + v157 = hir.int_to_ptr v154 : ptr; + hir.store v157, v366; + v370 = arith.constant 8 : u32; + v158 = hir.bitcast v108 : u32; + v160 = arith.add v158, v370 : u32 #[overflow = checked]; + v369 = arith.constant 8 : u32; + v162 = arith.mod v160, v369 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + v164 = hir.load v163 : i64; + v361, v362 = arith.split v164 : felt, felt; + v168 = hir.bitcast v99 : u32; + v368 = arith.constant 8 : u32; + v170 = arith.mod v168, v368 : u32; + hir.assertz v170 #[code = 250]; + v363 = arith.join v362, v361 : i64; + v171 = hir.int_to_ptr v168 : ptr; + hir.store v171, v363; + v367 = arith.constant 16 : i32; + v173 = arith.add v108, v367 : i32 #[overflow = wrapping]; + v174 = builtin.global_symbol @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/__stack_pointer : ptr + v175 = hir.bitcast v174 : ptr; + hir.store v175, v173; builtin.ret ; }; - private builtin.function @miden::protocol::asset::build_non_fungible_asset(v189: felt, v190: felt, v191: felt, v192: felt, v193: felt, v194: i32) { - ^block21(v189: felt, v190: felt, v191: felt, v192: felt, v193: felt, v194: i32): + private builtin.function @>::index(v176: i32, v177: i32, v178: i32) -> i32 { + ^block21(v176: i32, v177: i32, v178: i32): + v186 = arith.constant 0 : i32; + v377 = arith.constant 3 : u32; + v181 = hir.bitcast v177 : u32; + v183 = arith.gt v181, v377 : i1; + v184 = arith.zext v183 : u32; + v185 = hir.bitcast v184 : i32; + v187 = arith.neq v185, v186 : i1; + cf.cond_br v187 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v376 = arith.constant 2 : u32; + v190 = arith.shl v177, v376 : i32; + v191 = arith.add v176, v190 : i32 #[overflow = wrapping]; + builtin.ret v191; + }; + + private builtin.function @>::from(v192: i32, v193: i32) { + ^block25(v192: i32, v193: i32): + v195 = arith.constant 8 : u32; + v194 = hir.bitcast v193 : u32; + v196 = arith.add v194, v195 : u32 #[overflow = checked]; + v197 = arith.constant 4 : u32; + v198 = arith.mod v196, v197 : u32; + hir.assertz v198 #[code = 250]; + v199 = hir.int_to_ptr v196 : ptr; + v200 = hir.load v199 : i64; + v383 = arith.constant 8 : u32; + v201 = hir.bitcast v192 : u32; + v203 = arith.add v201, v383 : u32 #[overflow = checked]; + v382 = arith.constant 8 : u32; + v205 = arith.mod v203, v382 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v200; + v207 = hir.bitcast v193 : u32; + v381 = arith.constant 4 : u32; + v209 = arith.mod v207, v381 : u32; + hir.assertz v209 #[code = 250]; + v210 = hir.int_to_ptr v207 : ptr; + v211 = hir.load v210 : i64; + v212 = hir.bitcast v192 : u32; + v380 = arith.constant 8 : u32; + v214 = arith.mod v212, v380 : u32; + hir.assertz v214 #[code = 250]; + v215 = hir.int_to_ptr v212 : ptr; + hir.store v215, v211; + builtin.ret ; + }; + + private builtin.function @miden::protocol::asset::build_non_fungible_asset(v216: felt, v217: felt, v218: felt, v219: felt, v220: felt, v221: i32) { + ^block27(v216: felt, v217: felt, v218: felt, v219: felt, v220: felt, v221: i32): ub.unreachable ; }; @@ -272,40 +308,40 @@ builtin.component miden:rust-sdk-account-asset-build-non-fungible-asset-binding/ builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block23: - v195 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() : i32 - v366 = arith.constant 0 : i32; - v196 = arith.constant 0 : i32; - v197 = arith.add v195, v196 : i32 #[overflow = unchecked]; - v199 = arith.add v197, v366 : i32 #[overflow = unchecked]; - v364 = arith.constant 0 : i32; - v365 = arith.constant 0 : i32; - v201 = arith.add v199, v365 : i32 #[overflow = unchecked]; - v203 = arith.add v201, v364 : i32 #[overflow = unchecked]; - v204 = hir.int_to_ptr v203 : ptr; - v205 = hir.load v204 : felt; - v363 = arith.constant 0 : i32; - v206 = arith.constant 4 : i32; - v207 = arith.add v199, v206 : i32 #[overflow = unchecked]; - v209 = arith.add v207, v363 : i32 #[overflow = unchecked]; - v210 = hir.int_to_ptr v209 : ptr; - v211 = hir.load v210 : felt; - v362 = arith.constant 0 : i32; - v212 = arith.constant 8 : i32; - v213 = arith.add v199, v212 : i32 #[overflow = unchecked]; - v215 = arith.add v213, v362 : i32 #[overflow = unchecked]; - v216 = hir.int_to_ptr v215 : ptr; - v217 = hir.load v216 : felt; - v361 = arith.constant 0 : i32; - v218 = arith.constant 12 : i32; - v219 = arith.add v199, v218 : i32 #[overflow = unchecked]; - v221 = arith.add v219, v361 : i32 #[overflow = unchecked]; - v222 = hir.int_to_ptr v221 : ptr; - v223 = hir.load v222 : felt; - builtin.ret v205, v211, v217, v223; + ^block29: + v222 = hir.exec @miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1/rust_sdk_account_asset_build_non_fungible_asset_binding/miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding() : i32 + v223 = arith.constant 0 : i32; + v224 = arith.add v222, v223 : i32 #[overflow = unchecked]; + v387 = arith.constant 0 : i32; + v388 = arith.constant 0 : i32; + v226 = arith.add v224, v388 : i32 #[overflow = unchecked]; + v228 = arith.add v226, v387 : i32 #[overflow = unchecked]; + v229 = hir.int_to_ptr v228 : ptr; + v230 = hir.load v229 : felt; + v386 = arith.constant 0 : i32; + v231 = arith.constant 4 : i32; + v232 = arith.add v224, v231 : i32 #[overflow = unchecked]; + v234 = arith.add v232, v386 : i32 #[overflow = unchecked]; + v235 = hir.int_to_ptr v234 : ptr; + v236 = hir.load v235 : felt; + v385 = arith.constant 0 : i32; + v237 = arith.constant 8 : i32; + v238 = arith.add v224, v237 : i32 #[overflow = unchecked]; + v240 = arith.add v238, v385 : i32 #[overflow = unchecked]; + v241 = hir.int_to_ptr v240 : ptr; + v242 = hir.load v241 : felt; + v384 = arith.constant 0 : i32; + v243 = arith.constant 12 : i32; + v244 = arith.add v224, v243 : i32 #[overflow = unchecked]; + v246 = arith.add v244, v384 : i32 #[overflow = unchecked]; + v247 = hir.int_to_ptr v246 : ptr; + v248 = hir.load v247 : felt; + builtin.ret v230, v236, v242, v248; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm index 96e283ffc..e09da23c7 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -73,20 +70,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding @@ -109,7 +106,7 @@ end proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding( ) -> i32 - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -119,7 +116,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -135,13 +132,19 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco trace.252 nop push.0 + push.0 + mul.4294967296 + add push.1 push.0 - dup.2 - movup.2 - swap.3 - movdn.2 - swap.4 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + movup.4 swap.1 push.1 while.true @@ -234,75 +237,13 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco drop drop drop - push.24 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop push.16 dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.8 + u32wrapping_add dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::>::from trace.252 nop push.16 @@ -319,7 +260,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::miden_base_sys::bindings::asset::build_non_fungible_asset trace.252 nop - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -327,7 +268,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add push.24 dup.2 @@ -403,7 +344,7 @@ proc miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-acco push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -417,7 +358,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -425,7 +366,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048628 u32wrapping_add u32divmod.4 swap.1 @@ -446,7 +387,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -460,7 +401,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048600 + push.1048628 movup.2 u32wrapping_add u32divmod.4 @@ -496,7 +437,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( ) movup.2 drop - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -506,7 +447,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -516,10 +457,26 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.4 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.5 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -533,10 +490,16 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.5 - add - u32assert + push.2 + dup.6 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -550,10 +513,16 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.6 - add - u32assert + push.1 + dup.7 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -567,7 +536,17 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.6 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.8 + trace.240 + nop + exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -581,15 +560,15 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 - movup.2 - swap.3 - movdn.2 + dup.3 swap.1 swap.4 + swap.7 + swap.3 + swap.2 swap.1 swap.5 - swap.7 + swap.6 trace.240 nop exec.::"miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1"::rust_sdk_account_asset_build_non_fungible_asset_binding::"miden::protocol::asset::build_non_fungible_asset" @@ -669,7 +648,7 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -679,6 +658,109 @@ proc miden_base_sys::bindings::asset::build_non_fungible_asset( nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + @callconv("C") proc miden::protocol::asset::build_non_fungible_asset( felt, diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat index d0a504600..a60d538f8 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_asset_build_non_fungible_asset_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,8 +14,10 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32 f32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 f32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -27,67 +28,64 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_account_asset_build_non_fungible_asset_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1#binding (;2;) (type 1) (result i32) - (local i32 i32 f32 f32 f32) + (local i32 f32 f32 i32 f32) global.get $__stack_pointer i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked local.set 1 - i32.const 1 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 i32.const 0 - call $intrinsics::felt::from_u32 local.set 3 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 4 block ;; label = @1 loop ;; label = @2 - local.get 1 + local.get 3 i32.const 16 i32.eq br_if 1 (;@1;) local.get 0 i32.const 16 i32.add - local.get 1 + local.get 3 i32.add local.get 4 f32.store - local.get 1 + local.get 3 i32.const 4 i32.add - local.set 1 + local.set 3 br 0 (;@2;) end end local.get 0 local.get 0 - i64.load offset=24 align=4 - i64.store offset=8 - local.get 0 - local.get 0 - i64.load offset=16 align=4 - i64.store + i32.const 16 + i32.add + call $>::from local.get 0 i32.const 16 i32.add + local.get 1 local.get 2 - local.get 3 local.get 0 call $miden_base_sys::bindings::asset::build_non_fungible_asset global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add - local.tee 1 + local.tee 3 local.get 0 i64.load offset=24 i64.store offset=8 align=4 - local.get 1 + local.get 3 local.get 0 i64.load offset=16 i64.store align=4 @@ -95,13 +93,13 @@ i32.const 32 i32.add global.set $__stack_pointer - local.get 1 + local.get 3 ) (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048600 + i32.const 1048628 i32.add i32.load8_u br_if 0 (;@1;) @@ -109,14 +107,14 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048600 + i32.const 1048628 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::asset::build_non_fungible_asset (;4;) (type 2) (param i32 f32 f32 i32) - (local i32) + (local i32 i32) global.get $__stack_pointer i32.const 16 i32.sub @@ -124,12 +122,27 @@ global.set $__stack_pointer local.get 1 local.get 3 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 5 + call $>::index + f32.load local.get 3 - f32.load offset=8 + i32.const 2 + local.get 5 + call $>::index + f32.load local.get 3 - f32.load offset=4 + i32.const 1 + local.get 5 + call $>::index + f32.load local.get 3 + i32.const 0 + local.get 5 + call $>::index f32.load local.get 4 call $miden::protocol::asset::build_non_fungible_asset @@ -150,13 +163,39 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) + unreachable + ) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end unreachable ) - (func $miden::protocol::asset::build_non_fungible_asset (;6;) (type 4) (param f32 f32 f32 f32 f32 i32) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::asset::build_non_fungible_asset (;8;) (type 6) (param f32 f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "orust_sdk_account_asset_build_non_fungible_asset_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) @@ -171,17 +210,16 @@ (component $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-asset0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "asset" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-asset0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "asset" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-asset-build-non-fungible-asset-binding/rust-sdk-account-asset-build-non-fungible-asset-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir index d2d4e55f1..adffe3176 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-compute-commitment-binding/rust-sdk-acc public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1/rust_sdk_account_compute_commitment_binding/miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm index 78fd82a40..b3941b3bf 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat index 074437e4c..341b07c01 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-compute-commitment-binding/rust-sdk-account-compute-commitment-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir index 4faebc237..0bbe7265e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-compute-delta-commitment-binding/rust-s public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1/rust_sdk_account_compute_delta_commitment_binding/miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm index 43cf1c017..5f4dfc2fd 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat index e4da3b821..d1c3831c8 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_delta_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-compute-delta-commitment-binding/rust-sdk-account-compute-delta-commitment-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir index bf4c688bd..8f1bf02fc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-compute-storage-commitment-binding/rust public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1/rust_sdk_account_compute_storage_commitment_binding/miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm index c6b735be6..9186a7288 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat index 209fd7029..b2c23aebc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_compute_storage_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-compute-storage-commitment-binding/rust-sdk-account-compute-storage-commitment-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir index 1d645894b..0df35d029 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.hir @@ -21,91 +21,92 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/wit_bindgen::rt::run_ctors_once() - v221 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v264, v265, v266, v267 = scf.while v1, v7, v221 : i32, i32, felt, i32 { - ^block34(v268: i32, v269: i32, v270: felt): - v284 = arith.constant 0 : i32; + v286, v287, v288, v289 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block40(v290: i32, v291: i32, v292: felt): + v306 = arith.constant 0 : i32; v34 = arith.constant 16 : i32; - v15 = arith.eq v268, v34 : i1; + v15 = arith.eq v290, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v284 : i1; - v259 = scf.if v19 : i32 { - ^block33: - v230 = ub.poison i32 : i32; - scf.yield v230; + v19 = arith.neq v17, v306 : i1; + v281 = scf.if v19 : i32 { + ^block39: + v252 = ub.poison i32 : i32; + scf.yield v252; } else { ^block14: - v283 = arith.constant 16 : i32; - v22 = arith.add v269, v283 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v268 : i32 #[overflow = wrapping]; + v305 = arith.constant 16 : i32; + v22 = arith.add v291, v305 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v290 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; v50 = arith.constant 4 : u32; v27 = arith.mod v25, v50 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v270; + hir.store v28, v292; v29 = arith.constant 4 : i32; - v30 = arith.add v268, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v290, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v231 = ub.poison felt : felt; - v261 = cf.select v19, v231, v270 : felt; - v282 = ub.poison i32 : i32; - v260 = cf.select v19, v282, v269 : i32; - v229 = arith.constant 1 : u32; - v223 = arith.constant 0 : u32; - v263 = cf.select v19, v223, v229 : u32; - v253 = arith.trunc v263 : i1; - scf.condition v253, v259, v260, v261, v269; + v253 = ub.poison felt : felt; + v283 = cf.select v19, v253, v292 : felt; + v304 = ub.poison i32 : i32; + v282 = cf.select v19, v304, v291 : i32; + v251 = arith.constant 1 : u32; + v245 = arith.constant 0 : u32; + v285 = cf.select v19, v245, v251 : u32; + v275 = arith.trunc v285 : i1; + scf.condition v275, v281, v282, v283, v291; } do { - ^block35(v271: i32, v272: i32, v273: felt, v274: i32): - scf.yield v271, v272, v273; + ^block41(v293: i32, v294: i32, v295: felt, v296: i32): + scf.yield v293, v294, v295; }; v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr v32 = hir.bitcast v31 : ptr; v33 = hir.load v32 : i32; - v281 = arith.constant 16 : i32; - v35 = arith.add v267, v281 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::from(v267, v35) - v280 = arith.constant 16 : i32; - v37 = arith.add v267, v280 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden_base_sys::bindings::faucet::burn(v37, v267) - v38 = arith.constant 1048584 : i32; + v303 = arith.constant 16 : i32; + v35 = arith.add v289, v303 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::from(v289, v35) + v302 = arith.constant 16 : i32; + v37 = arith.add v289, v302 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden_base_sys::bindings::faucet::burn(v37, v289) + v38 = arith.constant 1048612 : i32; v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; v41 = arith.constant 24 : u32; - v40 = hir.bitcast v267 : u32; + v40 = hir.bitcast v289 : u32; v42 = arith.add v40, v41 : u32 #[overflow = checked]; v43 = arith.constant 8 : u32; v44 = arith.mod v42, v43 : u32; hir.assertz v44 #[code = 250]; v45 = hir.int_to_ptr v42 : ptr; v46 = hir.load v45 : i64; - v279 = arith.constant 8 : u32; + v301 = arith.constant 8 : u32; v47 = hir.bitcast v39 : u32; - v49 = arith.add v47, v279 : u32 #[overflow = checked]; - v278 = arith.constant 4 : u32; - v51 = arith.mod v49, v278 : u32; + v49 = arith.add v47, v301 : u32 #[overflow = checked]; + v300 = arith.constant 4 : u32; + v51 = arith.mod v49, v300 : u32; hir.assertz v51 #[code = 250]; v52 = hir.int_to_ptr v49 : ptr; hir.store v52, v46; v54 = arith.constant 16 : u32; - v53 = hir.bitcast v267 : u32; + v53 = hir.bitcast v289 : u32; v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v277 = arith.constant 8 : u32; - v57 = arith.mod v55, v277 : u32; + v299 = arith.constant 8 : u32; + v57 = arith.mod v55, v299 : u32; hir.assertz v57 #[code = 250]; v58 = hir.int_to_ptr v55 : ptr; v59 = hir.load v58 : i64; v60 = hir.bitcast v39 : u32; - v276 = arith.constant 4 : u32; - v62 = arith.mod v60, v276 : u32; + v298 = arith.constant 4 : u32; + v62 = arith.mod v60, v298 : u32; hir.assertz v62 #[code = 250]; v63 = hir.int_to_ptr v60 : ptr; hir.store v63, v59; - v275 = arith.constant 32 : i32; - v65 = arith.add v267, v275 : i32 #[overflow = wrapping]; + v297 = arith.constant 32 : i32; + v65 = arith.add v289, v297 : i32 #[overflow = wrapping]; v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr v67 = hir.bitcast v66 : ptr; hir.store v67, v65; @@ -117,7 +118,7 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr v70 = hir.bitcast v69 : ptr; v71 = hir.load v70 : i32; - v72 = arith.constant 1048600 : i32; + v72 = arith.constant 1048628 : i32; v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; v74 = hir.bitcast v73 : u32; v75 = hir.int_to_ptr v74 : ptr; @@ -135,12 +136,12 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa v82 = hir.bitcast v81 : ptr; v83 = hir.load v82 : i32; hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__wasm_call_ctors() - v286 = arith.constant 1 : u8; - v288 = arith.constant 1048600 : i32; - v85 = arith.add v83, v288 : i32 #[overflow = wrapping]; + v308 = arith.constant 1 : u8; + v310 = arith.constant 1048628 : i32; + v85 = arith.add v83, v310 : i32 #[overflow = wrapping]; v89 = hir.bitcast v85 : u32; v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v286; + hir.store v90, v308; scf.yield ; }; builtin.ret ; @@ -156,112 +157,144 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr v100 = hir.bitcast v99 : ptr; hir.store v100, v98; - v102 = arith.constant 12 : u32; - v101 = hir.bitcast v92 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v92 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v305 = arith.constant 4 : u32; - v112 = arith.mod v110, v305 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v304 = arith.constant 4 : u32; - v115 = hir.bitcast v92 : u32; - v117 = arith.add v115, v304 : u32 #[overflow = checked]; - v303 = arith.constant 4 : u32; - v119 = arith.mod v117, v303 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.bitcast v92 : u32; - v302 = arith.constant 4 : u32; - v124 = arith.mod v122, v302 : u32; + v102 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/GOT.data.internal.__memory_base : ptr + v103 = hir.bitcast v102 : ptr; + v104 = hir.load v103 : i32; + v105 = arith.constant 1048596 : i32; + v106 = arith.add v104, v105 : i32 #[overflow = wrapping]; + v101 = arith.constant 3 : i32; + v107 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::index(v92, v101, v106) : i32 + v108 = hir.bitcast v107 : u32; + v109 = arith.constant 4 : u32; + v110 = arith.mod v108, v109 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : felt; + v113 = arith.constant 2 : i32; + v114 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::index(v92, v113, v106) : i32 + v115 = hir.bitcast v114 : u32; + v325 = arith.constant 4 : u32; + v117 = arith.mod v115, v325 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : felt; + v120 = arith.constant 1 : i32; + v121 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::index(v92, v120, v106) : i32 + v122 = hir.bitcast v121 : u32; + v324 = arith.constant 4 : u32; + v124 = arith.mod v122, v324 : u32; hir.assertz v124 #[code = 250]; v125 = hir.int_to_ptr v122 : ptr; v126 = hir.load v125 : felt; - hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden::protocol::faucet::burn(v107, v114, v121, v126, v98) - v127 = hir.bitcast v98 : u32; - v301 = arith.constant 8 : u32; - v129 = arith.mod v127, v301 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v292, v293 = arith.split v131 : felt, felt; - v300 = arith.constant 8 : u32; - v135 = hir.bitcast v91 : u32; - v137 = arith.add v135, v300 : u32 #[overflow = checked]; - v299 = arith.constant 8 : u32; - v139 = arith.mod v137, v299 : u32; - hir.assertz v139 #[code = 250]; - v294 = arith.join v293, v292 : i64; - v140 = hir.int_to_ptr v137 : ptr; - hir.store v140, v294; - v298 = arith.constant 8 : u32; - v141 = hir.bitcast v98 : u32; - v143 = arith.add v141, v298 : u32 #[overflow = checked]; - v297 = arith.constant 8 : u32; - v145 = arith.mod v143, v297 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : i64; - v289, v290 = arith.split v147 : felt, felt; - v151 = hir.bitcast v91 : u32; - v296 = arith.constant 8 : u32; - v153 = arith.mod v151, v296 : u32; - hir.assertz v153 #[code = 250]; - v291 = arith.join v290, v289 : i64; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v291; - v295 = arith.constant 16 : i32; - v156 = arith.add v98, v295 : i32 #[overflow = wrapping]; - v157 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr - v158 = hir.bitcast v157 : ptr; - hir.store v158, v156; + v93 = arith.constant 0 : i32; + v128 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::index(v92, v93, v106) : i32 + v129 = hir.bitcast v128 : u32; + v323 = arith.constant 4 : u32; + v131 = arith.mod v129, v323 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden::protocol::faucet::burn(v112, v119, v126, v133, v98) + v134 = hir.bitcast v98 : u32; + v135 = arith.constant 8 : u32; + v136 = arith.mod v134, v135 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + v138 = hir.load v137 : i64; + v314, v315 = arith.split v138 : felt, felt; + v322 = arith.constant 8 : u32; + v142 = hir.bitcast v91 : u32; + v144 = arith.add v142, v322 : u32 #[overflow = checked]; + v321 = arith.constant 8 : u32; + v146 = arith.mod v144, v321 : u32; + hir.assertz v146 #[code = 250]; + v316 = arith.join v315, v314 : i64; + v147 = hir.int_to_ptr v144 : ptr; + hir.store v147, v316; + v320 = arith.constant 8 : u32; + v148 = hir.bitcast v98 : u32; + v150 = arith.add v148, v320 : u32 #[overflow = checked]; + v319 = arith.constant 8 : u32; + v152 = arith.mod v150, v319 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : i64; + v311, v312 = arith.split v154 : felt, felt; + v158 = hir.bitcast v91 : u32; + v318 = arith.constant 8 : u32; + v160 = arith.mod v158, v318 : u32; + hir.assertz v160 #[code = 250]; + v313 = arith.join v312, v311 : i64; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v313; + v317 = arith.constant 16 : i32; + v163 = arith.add v98, v317 : i32 #[overflow = wrapping]; + v164 = builtin.global_symbol @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/__stack_pointer : ptr + v165 = hir.bitcast v164 : ptr; + hir.store v165, v163; builtin.ret ; }; - private builtin.function @>::from(v159: i32, v160: i32) { - ^block21(v159: i32, v160: i32): - v162 = arith.constant 8 : u32; - v161 = hir.bitcast v160 : u32; - v163 = arith.add v161, v162 : u32 #[overflow = checked]; - v164 = arith.constant 4 : u32; - v165 = arith.mod v163, v164 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - v167 = hir.load v166 : i64; - v309 = arith.constant 8 : u32; - v168 = hir.bitcast v159 : u32; - v170 = arith.add v168, v309 : u32 #[overflow = checked]; - v308 = arith.constant 8 : u32; - v172 = arith.mod v170, v308 : u32; - hir.assertz v172 #[code = 250]; - v173 = hir.int_to_ptr v170 : ptr; - hir.store v173, v167; - v174 = hir.bitcast v160 : u32; - v307 = arith.constant 4 : u32; - v176 = arith.mod v174, v307 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v179 = hir.bitcast v159 : u32; - v306 = arith.constant 8 : u32; - v181 = arith.mod v179, v306 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - hir.store v182, v178; + private builtin.function @>::from(v166: i32, v167: i32) { + ^block21(v166: i32, v167: i32): + hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/>::from(v166, v167) builtin.ret ; }; - private builtin.function @miden::protocol::faucet::burn(v183: felt, v184: felt, v185: felt, v186: felt, v187: i32) { - ^block23(v183: felt, v184: felt, v185: felt, v186: felt, v187: i32): + private builtin.function @>::index(v168: i32, v169: i32, v170: i32) -> i32 { + ^block23(v168: i32, v169: i32, v170: i32): + v178 = arith.constant 0 : i32; + v327 = arith.constant 3 : u32; + v173 = hir.bitcast v169 : u32; + v175 = arith.gt v173, v327 : i1; + v176 = arith.zext v175 : u32; + v177 = hir.bitcast v176 : i32; + v179 = arith.neq v177, v178 : i1; + cf.cond_br v179 ^block25, ^block26; + ^block25: + ub.unreachable ; + ^block26: + v326 = arith.constant 2 : u32; + v182 = arith.shl v169, v326 : i32; + v183 = arith.add v168, v182 : i32 #[overflow = wrapping]; + builtin.ret v183; + }; + + private builtin.function @>::from(v184: i32, v185: i32) { + ^block27(v184: i32, v185: i32): + v187 = arith.constant 8 : u32; + v186 = hir.bitcast v185 : u32; + v188 = arith.add v186, v187 : u32 #[overflow = checked]; + v189 = arith.constant 4 : u32; + v190 = arith.mod v188, v189 : u32; + hir.assertz v190 #[code = 250]; + v191 = hir.int_to_ptr v188 : ptr; + v192 = hir.load v191 : i64; + v333 = arith.constant 8 : u32; + v193 = hir.bitcast v184 : u32; + v195 = arith.add v193, v333 : u32 #[overflow = checked]; + v332 = arith.constant 8 : u32; + v197 = arith.mod v195, v332 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + hir.store v198, v192; + v199 = hir.bitcast v185 : u32; + v331 = arith.constant 4 : u32; + v201 = arith.mod v199, v331 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + v203 = hir.load v202 : i64; + v204 = hir.bitcast v184 : u32; + v330 = arith.constant 8 : u32; + v206 = arith.mod v204, v330 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + hir.store v207, v203; + builtin.ret ; + }; + + private builtin.function @miden::protocol::faucet::burn(v208: felt, v209: felt, v210: felt, v211: felt, v212: i32) { + ^block29(v208: felt, v209: felt, v210: felt, v211: felt, v212: i32): ub.unreachable ; }; @@ -273,40 +306,40 @@ builtin.component miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-fa builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v188 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() : i32 - v315 = arith.constant 0 : i32; - v189 = arith.constant 0 : i32; - v190 = arith.add v188, v189 : i32 #[overflow = unchecked]; - v192 = arith.add v190, v315 : i32 #[overflow = unchecked]; - v313 = arith.constant 0 : i32; - v314 = arith.constant 0 : i32; - v194 = arith.add v192, v314 : i32 #[overflow = unchecked]; - v196 = arith.add v194, v313 : i32 #[overflow = unchecked]; - v197 = hir.int_to_ptr v196 : ptr; - v198 = hir.load v197 : felt; - v312 = arith.constant 0 : i32; - v199 = arith.constant 4 : i32; - v200 = arith.add v192, v199 : i32 #[overflow = unchecked]; - v202 = arith.add v200, v312 : i32 #[overflow = unchecked]; - v203 = hir.int_to_ptr v202 : ptr; - v204 = hir.load v203 : felt; - v311 = arith.constant 0 : i32; - v205 = arith.constant 8 : i32; - v206 = arith.add v192, v205 : i32 #[overflow = unchecked]; - v208 = arith.add v206, v311 : i32 #[overflow = unchecked]; - v209 = hir.int_to_ptr v208 : ptr; - v210 = hir.load v209 : felt; - v310 = arith.constant 0 : i32; - v211 = arith.constant 12 : i32; - v212 = arith.add v192, v211 : i32 #[overflow = unchecked]; - v214 = arith.add v212, v310 : i32 #[overflow = unchecked]; - v215 = hir.int_to_ptr v214 : ptr; - v216 = hir.load v215 : felt; - builtin.ret v198, v204, v210, v216; + ^block31: + v213 = hir.exec @miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1/rust_sdk_account_faucet_burn_binding/miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding() : i32 + v214 = arith.constant 0 : i32; + v215 = arith.add v213, v214 : i32 #[overflow = unchecked]; + v337 = arith.constant 0 : i32; + v338 = arith.constant 0 : i32; + v217 = arith.add v215, v338 : i32 #[overflow = unchecked]; + v219 = arith.add v217, v337 : i32 #[overflow = unchecked]; + v220 = hir.int_to_ptr v219 : ptr; + v221 = hir.load v220 : felt; + v336 = arith.constant 0 : i32; + v222 = arith.constant 4 : i32; + v223 = arith.add v215, v222 : i32 #[overflow = unchecked]; + v225 = arith.add v223, v336 : i32 #[overflow = unchecked]; + v226 = hir.int_to_ptr v225 : ptr; + v227 = hir.load v226 : felt; + v335 = arith.constant 0 : i32; + v228 = arith.constant 8 : i32; + v229 = arith.add v215, v228 : i32 #[overflow = unchecked]; + v231 = arith.add v229, v335 : i32 #[overflow = unchecked]; + v232 = hir.int_to_ptr v231 : ptr; + v233 = hir.load v232 : felt; + v334 = arith.constant 0 : i32; + v234 = arith.constant 12 : i32; + v235 = arith.add v215, v234 : i32 #[overflow = unchecked]; + v237 = arith.add v235, v334 : i32 #[overflow = unchecked]; + v238 = hir.int_to_ptr v237 : ptr; + v239 = hir.load v238 : felt; + builtin.ret v221, v227, v233, v239; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm index a38b00ac4..f35903654 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -73,20 +70,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding @@ -109,7 +106,7 @@ end proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1#binding( ) -> i32 - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -119,7 +116,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -136,6 +133,9 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -206,7 +206,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin drop drop drop - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -220,7 +220,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin dup.2 trace.240 nop - exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::from + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::from trace.252 nop push.16 @@ -233,7 +233,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::miden_base_sys::bindings::faucet::burn trace.252 nop - push.1048584 + push.1048612 u32wrapping_add push.24 dup.2 @@ -309,7 +309,7 @@ proc miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-bin push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -323,7 +323,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -331,7 +331,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048628 u32wrapping_add u32divmod.4 swap.1 @@ -352,7 +352,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -366,7 +366,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048600 + push.1048628 movup.2 u32wrapping_add u32divmod.4 @@ -395,7 +395,7 @@ end @callconv("C") proc miden_base_sys::bindings::faucet::burn(i32, i32) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -405,7 +405,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -415,10 +415,26 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.3 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -432,10 +448,16 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -449,10 +471,16 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -466,7 +494,17 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -480,17 +518,19 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + dup.3 swap.1 swap.3 swap.1 swap.4 + swap.6 + swap.2 trace.240 nop exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::"miden::protocol::faucet::burn" trace.252 nop - dup.0 + dup.1 push.8 dup.1 swap.1 @@ -506,7 +546,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) nop swap.1 push.8 - dup.4 + dup.3 add u32assert push.8 @@ -527,7 +567,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) trace.252 nop push.8 - dup.1 + dup.2 add u32assert push.8 @@ -544,7 +584,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -564,7 +604,7 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -575,7 +615,47 @@ proc miden_base_sys::bindings::faucet::burn(i32, i32) end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1"::rust_sdk_account_faucet_burn_binding::>::from + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat index efa59c439..792da9c6d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_burn_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,8 +14,9 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -36,8 +36,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -65,14 +65,14 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 i32.const 16 i32.add local.get 0 call $miden_base_sys::bindings::faucet::burn local.get 1 - i32.const 1048584 + i32.const 1048612 i32.add local.tee 1 local.get 0 @@ -92,7 +92,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048600 + i32.const 1048628 i32.add i32.load8_u br_if 0 (;@1;) @@ -100,26 +100,41 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048600 + i32.const 1048628 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::faucet::burn (;4;) (type 2) (param i32 i32) - (local i32) + (local i32 i32) global.get $__stack_pointer i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 1 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 1 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 1 + i32.const 0 + local.get 3 + call $>::index f32.load local.get 2 call $miden::protocol::faucet::burn @@ -140,7 +155,30 @@ i32.add global.set $__stack_pointer ) - (func $>::from (;5;) (type 2) (param i32 i32) + (func $>::from (;5;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + call $>::from + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 3) (param i64) (result f32) + unreachable + ) + (func $>::index (;7;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;8;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -150,13 +188,11 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) - unreachable - ) - (func $miden::protocol::faucet::burn (;7;) (type 4) (param f32 f32 f32 f32 i32) + (func $miden::protocol::faucet::burn (;9;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_burn_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) @@ -171,17 +207,16 @@ (component $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-asset0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "asset" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-asset0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "asset" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-burn-binding/rust-sdk-account-faucet-burn-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir index 171e45c4a..4253a2693 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v142 = arith.constant 10 : felt; - hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden_base_sys::bindings::faucet::create_fungible_asset(v6, v142) + v9 = arith.constant 10 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden_base_sys::bindings::faucet::create_fungible_asset(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v147 = arith.constant 8 : u32; - v20 = arith.mod v18, v147 : u32; + v144 = arith.constant 8 : u32; + v20 = arith.mod v18, v144 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v146 = arith.constant 8 : u32; + v143 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v146 : u32 #[overflow = checked]; + v25 = arith.add v23, v143 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v145 = arith.constant 8 : u32; - v31 = arith.mod v29, v145 : u32; + v142 = arith.constant 8 : u32; + v31 = arith.mod v29, v142 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v141 = arith.constant 4 : u32; + v36 = arith.mod v34, v141 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v143 = arith.constant 16 : i32; - v39 = arith.add v6, v143 : i32 #[overflow = wrapping]; + v140 = arith.constant 16 : i32; + v39 = arith.add v6, v140 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v59 = arith.add v57, v151 : i32 #[overflow = wrapping]; + v146 = arith.constant 1 : u8; + v148 = arith.constant 1048600 : i32; + v59 = arith.add v57, v148 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v149; + hir.store v64, v146; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v155, v156 = arith.split v79 : felt, felt; - v163 = arith.constant 8 : u32; + v152, v153 = arith.split v79 : felt, felt; + v160 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v163 : u32 #[overflow = checked]; - v162 = arith.constant 8 : u32; - v87 = arith.mod v85, v162 : u32; + v85 = arith.add v83, v160 : u32 #[overflow = checked]; + v159 = arith.constant 8 : u32; + v87 = arith.mod v85, v159 : u32; hir.assertz v87 #[code = 250]; - v157 = arith.join v156, v155 : i64; + v154 = arith.join v153, v152 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v157; - v161 = arith.constant 8 : u32; + hir.store v88, v154; + v158 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v161 : u32 #[overflow = checked]; - v160 = arith.constant 8 : u32; - v93 = arith.mod v91, v160 : u32; + v91 = arith.add v89, v158 : u32 #[overflow = checked]; + v157 = arith.constant 8 : u32; + v93 = arith.mod v91, v157 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v152, v153 = arith.split v95 : felt, felt; + v149, v150 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v159 = arith.constant 8 : u32; - v101 = arith.mod v99, v159 : u32; + v156 = arith.constant 8 : u32; + v101 = arith.mod v99, v156 : u32; hir.assertz v101 #[code = 250]; - v154 = arith.join v153, v152 : i64; + v151 = arith.join v150, v149 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v154; - v158 = arith.constant 16 : i32; - v104 = arith.add v72, v158 : i32 #[overflow = wrapping]; + hir.store v102, v151; + v155 = arith.constant 16 : i32; + v104 = arith.add v72, v155 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -168,34 +169,32 @@ builtin.component miden:rust-sdk-account-faucet-create-fungible-asset-binding/ru public builtin.function @binding() -> felt, felt, felt, felt { ^block19: v109 = hir.exec @miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_fungible_asset_binding/miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1#binding() : i32 - v169 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; v111 = arith.add v109, v110 : i32 #[overflow = unchecked]; - v113 = arith.add v111, v169 : i32 #[overflow = unchecked]; - v167 = arith.constant 0 : i32; - v168 = arith.constant 0 : i32; - v115 = arith.add v113, v168 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v167 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v166 = arith.constant 0 : i32; - v120 = arith.constant 4 : i32; - v121 = arith.add v113, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v166 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; - v165 = arith.constant 0 : i32; - v126 = arith.constant 8 : i32; - v127 = arith.add v113, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v165 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; v164 = arith.constant 0 : i32; - v132 = arith.constant 12 : i32; - v133 = arith.add v113, v132 : i32 #[overflow = unchecked]; - v135 = arith.add v133, v164 : i32 #[overflow = unchecked]; - v136 = hir.int_to_ptr v135 : ptr; - v137 = hir.load v136 : felt; - builtin.ret v119, v125, v131, v137; + v165 = arith.constant 0 : i32; + v113 = arith.add v111, v165 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v164 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v163 = arith.constant 0 : i32; + v118 = arith.constant 4 : i32; + v119 = arith.add v111, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v163 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v162 = arith.constant 0 : i32; + v124 = arith.constant 8 : i32; + v125 = arith.add v111, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v162 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v161 = arith.constant 0 : i32; + v130 = arith.constant 12 : i32; + v131 = arith.add v111, v130 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v161 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + builtin.ret v117, v123, v129, v135; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm index ce1a65e7c..de8cc8ad1 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -135,6 +132,9 @@ proc miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-accoun trace.252 nop push.10 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat index aee457930..05341aac4 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_fungible_asset_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,7 +14,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -35,8 +34,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 10 - call $intrinsics::felt::from_u32 + i64.const 10 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::faucet::create_fungible_asset global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -100,7 +99,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::faucet::create_fungible_asset (;6;) (type 4) (param f32 i32) @@ -121,17 +120,16 @@ (component $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-asset0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "asset" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-asset0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "asset" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-create-fungible-asset-binding/rust-sdk-account-faucet-create-fungible-asset-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir index 1683c9eea..cae77556f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.hir @@ -21,241 +21,274 @@ builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-bindin v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v219 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v262, v263, v264, v265 = scf.while v1, v7, v219 : i32, i32, felt, i32 { - ^block32(v266: i32, v267: i32, v268: felt): - v288 = arith.constant 0 : i32; - v58 = arith.constant 16 : i32; - v15 = arith.eq v266, v58 : i1; + v284, v285, v286, v287 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block38(v288: i32, v289: i32, v290: felt): + v304 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v288, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v288 : i1; - v257 = scf.if v19 : i32 { - ^block31: - v228 = ub.poison i32 : i32; - scf.yield v228; + v19 = arith.neq v17, v304 : i1; + v279 = scf.if v19 : i32 { + ^block37: + v250 = ub.poison i32 : i32; + scf.yield v250; } else { ^block14: - v287 = arith.constant 16 : i32; - v22 = arith.add v267, v287 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v266 : i32 #[overflow = wrapping]; + v303 = arith.constant 16 : i32; + v22 = arith.add v289, v303 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v288 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; - v34 = arith.constant 4 : u32; - v27 = arith.mod v25, v34 : u32; + v50 = arith.constant 4 : u32; + v27 = arith.mod v25, v50 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v268; + hir.store v28, v290; v29 = arith.constant 4 : i32; - v30 = arith.add v266, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v288, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v229 = ub.poison felt : felt; - v259 = cf.select v19, v229, v268 : felt; - v286 = ub.poison i32 : i32; - v258 = cf.select v19, v286, v267 : i32; - v227 = arith.constant 1 : u32; - v221 = arith.constant 0 : u32; - v261 = cf.select v19, v221, v227 : u32; - v251 = arith.trunc v261 : i1; - scf.condition v251, v257, v258, v259, v267; + v251 = ub.poison felt : felt; + v281 = cf.select v19, v251, v290 : felt; + v302 = ub.poison i32 : i32; + v280 = cf.select v19, v302, v289 : i32; + v249 = arith.constant 1 : u32; + v243 = arith.constant 0 : u32; + v283 = cf.select v19, v243, v249 : u32; + v273 = arith.trunc v283 : i1; + scf.condition v273, v279, v280, v281, v289; } do { - ^block33(v269: i32, v270: i32, v271: felt, v272: i32): - scf.yield v269, v270, v271; + ^block39(v291: i32, v292: i32, v293: felt, v294: i32): + scf.yield v291, v292, v293; }; - v32 = arith.constant 24 : u32; - v31 = hir.bitcast v265 : u32; - v33 = arith.add v31, v32 : u32 #[overflow = checked]; - v285 = arith.constant 4 : u32; - v35 = arith.mod v33, v285 : u32; - hir.assertz v35 #[code = 250]; - v36 = hir.int_to_ptr v33 : ptr; - v37 = hir.load v36 : i64; - v39 = arith.constant 8 : u32; - v38 = hir.bitcast v265 : u32; - v40 = arith.add v38, v39 : u32 #[overflow = checked]; - v284 = arith.constant 8 : u32; - v42 = arith.mod v40, v284 : u32; - hir.assertz v42 #[code = 250]; - v43 = hir.int_to_ptr v40 : ptr; - hir.store v43, v37; - v45 = arith.constant 16 : u32; - v44 = hir.bitcast v265 : u32; - v46 = arith.add v44, v45 : u32 #[overflow = checked]; - v283 = arith.constant 4 : u32; - v48 = arith.mod v46, v283 : u32; - hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i64; - v51 = hir.bitcast v265 : u32; - v282 = arith.constant 8 : u32; - v53 = arith.mod v51, v282 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - hir.store v54, v50; - v55 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v56 = hir.bitcast v55 : ptr; - v57 = hir.load v56 : i32; - v281 = arith.constant 16 : i32; - v59 = arith.add v265, v281 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden_base_sys::bindings::faucet::create_non_fungible_asset(v59, v265) - v60 = arith.constant 1048584 : i32; - v61 = arith.add v57, v60 : i32 #[overflow = wrapping]; - v280 = arith.constant 24 : u32; - v62 = hir.bitcast v265 : u32; - v64 = arith.add v62, v280 : u32 #[overflow = checked]; - v279 = arith.constant 8 : u32; - v66 = arith.mod v64, v279 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - v68 = hir.load v67 : i64; - v278 = arith.constant 8 : u32; - v69 = hir.bitcast v61 : u32; - v71 = arith.add v69, v278 : u32 #[overflow = checked]; - v277 = arith.constant 4 : u32; - v73 = arith.mod v71, v277 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - hir.store v74, v68; - v276 = arith.constant 16 : u32; - v75 = hir.bitcast v265 : u32; - v77 = arith.add v75, v276 : u32 #[overflow = checked]; - v275 = arith.constant 8 : u32; - v79 = arith.mod v77, v275 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : i64; - v82 = hir.bitcast v61 : u32; - v274 = arith.constant 4 : u32; - v84 = arith.mod v82, v274 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - hir.store v85, v81; - v273 = arith.constant 32 : i32; - v87 = arith.add v265, v273 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret v61; + v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v301 = arith.constant 16 : i32; + v35 = arith.add v287, v301 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/>::from(v287, v35) + v300 = arith.constant 16 : i32; + v37 = arith.add v287, v300 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden_base_sys::bindings::faucet::create_non_fungible_asset(v37, v287) + v38 = arith.constant 1048612 : i32; + v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; + v41 = arith.constant 24 : u32; + v40 = hir.bitcast v287 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v43 = arith.constant 8 : u32; + v44 = arith.mod v42, v43 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + v46 = hir.load v45 : i64; + v299 = arith.constant 8 : u32; + v47 = hir.bitcast v39 : u32; + v49 = arith.add v47, v299 : u32 #[overflow = checked]; + v298 = arith.constant 4 : u32; + v51 = arith.mod v49, v298 : u32; + hir.assertz v51 #[code = 250]; + v52 = hir.int_to_ptr v49 : ptr; + hir.store v52, v46; + v54 = arith.constant 16 : u32; + v53 = hir.bitcast v287 : u32; + v55 = arith.add v53, v54 : u32 #[overflow = checked]; + v297 = arith.constant 8 : u32; + v57 = arith.mod v55, v297 : u32; + hir.assertz v57 #[code = 250]; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : i64; + v60 = hir.bitcast v39 : u32; + v296 = arith.constant 4 : u32; + v62 = arith.mod v60, v296 : u32; + hir.assertz v62 #[code = 250]; + v63 = hir.int_to_ptr v60 : ptr; + hir.store v63, v59; + v295 = arith.constant 32 : i32; + v65 = arith.add v287, v295 : i32 #[overflow = wrapping]; + v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; + builtin.ret v39; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v91 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v92 = hir.bitcast v91 : ptr; - v93 = hir.load v92 : i32; - v94 = arith.constant 1048600 : i32; - v95 = arith.add v93, v94 : i32 #[overflow = wrapping]; - v96 = hir.bitcast v95 : u32; - v97 = hir.int_to_ptr v96 : ptr; - v98 = hir.load v97 : u8; - v90 = arith.constant 0 : i32; - v99 = arith.zext v98 : u32; - v100 = hir.bitcast v99 : i32; - v102 = arith.neq v100, v90 : i1; - scf.if v102{ + v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v70 = hir.bitcast v69 : ptr; + v71 = hir.load v70 : i32; + v72 = arith.constant 1048628 : i32; + v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; + v74 = hir.bitcast v73 : u32; + v75 = hir.int_to_ptr v74 : ptr; + v76 = hir.load v75 : u8; + v68 = arith.constant 0 : i32; + v77 = arith.zext v76 : u32; + v78 = hir.bitcast v77 : i32; + v80 = arith.neq v78, v68 : i1; + scf.if v80{ ^block17: scf.yield ; } else { ^block18: - v103 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v104 = hir.bitcast v103 : ptr; - v105 = hir.load v104 : i32; + v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v82 = hir.bitcast v81 : ptr; + v83 = hir.load v82 : i32; hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__wasm_call_ctors() - v290 = arith.constant 1 : u8; - v292 = arith.constant 1048600 : i32; - v107 = arith.add v105, v292 : i32 #[overflow = wrapping]; - v111 = hir.bitcast v107 : u32; - v112 = hir.int_to_ptr v111 : ptr; - hir.store v112, v290; + v306 = arith.constant 1 : u8; + v308 = arith.constant 1048628 : i32; + v85 = arith.add v83, v308 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v85 : u32; + v90 = hir.int_to_ptr v89 : ptr; + hir.store v90, v306; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::faucet::create_non_fungible_asset(v113: i32, v114: i32) { - ^block19(v113: i32, v114: i32): - v116 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v117 = hir.bitcast v116 : ptr; - v118 = hir.load v117 : i32; - v119 = arith.constant 16 : i32; - v120 = arith.sub v118, v119 : i32 #[overflow = wrapping]; - v121 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v122 = hir.bitcast v121 : ptr; - hir.store v122, v120; - v124 = arith.constant 12 : u32; - v123 = hir.bitcast v114 : u32; - v125 = arith.add v123, v124 : u32 #[overflow = checked]; - v126 = arith.constant 4 : u32; - v127 = arith.mod v125, v126 : u32; - hir.assertz v127 #[code = 250]; - v128 = hir.int_to_ptr v125 : ptr; - v129 = hir.load v128 : felt; - v131 = arith.constant 8 : u32; - v130 = hir.bitcast v114 : u32; - v132 = arith.add v130, v131 : u32 #[overflow = checked]; - v309 = arith.constant 4 : u32; - v134 = arith.mod v132, v309 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - v136 = hir.load v135 : felt; - v308 = arith.constant 4 : u32; - v137 = hir.bitcast v114 : u32; - v139 = arith.add v137, v308 : u32 #[overflow = checked]; - v307 = arith.constant 4 : u32; - v141 = arith.mod v139, v307 : u32; - hir.assertz v141 #[code = 250]; - v142 = hir.int_to_ptr v139 : ptr; - v143 = hir.load v142 : felt; - v144 = hir.bitcast v114 : u32; - v306 = arith.constant 4 : u32; - v146 = arith.mod v144, v306 : u32; + private builtin.function @miden_base_sys::bindings::faucet::create_non_fungible_asset(v91: i32, v92: i32) { + ^block19(v91: i32, v92: i32): + v94 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + v96 = hir.load v95 : i32; + v97 = arith.constant 16 : i32; + v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v102 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v103 = hir.bitcast v102 : ptr; + v104 = hir.load v103 : i32; + v105 = arith.constant 1048596 : i32; + v106 = arith.add v104, v105 : i32 #[overflow = wrapping]; + v101 = arith.constant 3 : i32; + v107 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/>::index(v92, v101, v106) : i32 + v108 = hir.bitcast v107 : u32; + v109 = arith.constant 4 : u32; + v110 = arith.mod v108, v109 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : felt; + v113 = arith.constant 2 : i32; + v114 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/>::index(v92, v113, v106) : i32 + v115 = hir.bitcast v114 : u32; + v323 = arith.constant 4 : u32; + v117 = arith.mod v115, v323 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : felt; + v120 = arith.constant 1 : i32; + v121 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/>::index(v92, v120, v106) : i32 + v122 = hir.bitcast v121 : u32; + v322 = arith.constant 4 : u32; + v124 = arith.mod v122, v322 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + v93 = arith.constant 0 : i32; + v128 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/>::index(v92, v93, v106) : i32 + v129 = hir.bitcast v128 : u32; + v321 = arith.constant 4 : u32; + v131 = arith.mod v129, v321 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden::protocol::faucet::create_non_fungible_asset(v112, v119, v126, v133, v98) + v134 = hir.bitcast v98 : u32; + v135 = arith.constant 8 : u32; + v136 = arith.mod v134, v135 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + v138 = hir.load v137 : i64; + v312, v313 = arith.split v138 : felt, felt; + v320 = arith.constant 8 : u32; + v142 = hir.bitcast v91 : u32; + v144 = arith.add v142, v320 : u32 #[overflow = checked]; + v319 = arith.constant 8 : u32; + v146 = arith.mod v144, v319 : u32; hir.assertz v146 #[code = 250]; - v147 = hir.int_to_ptr v144 : ptr; - v148 = hir.load v147 : felt; - hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden::protocol::faucet::create_non_fungible_asset(v129, v136, v143, v148, v120) - v149 = hir.bitcast v120 : u32; - v305 = arith.constant 8 : u32; - v151 = arith.mod v149, v305 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : i64; - v296, v297 = arith.split v153 : felt, felt; - v304 = arith.constant 8 : u32; - v157 = hir.bitcast v113 : u32; - v159 = arith.add v157, v304 : u32 #[overflow = checked]; - v303 = arith.constant 8 : u32; - v161 = arith.mod v159, v303 : u32; - hir.assertz v161 #[code = 250]; - v298 = arith.join v297, v296 : i64; - v162 = hir.int_to_ptr v159 : ptr; - hir.store v162, v298; - v302 = arith.constant 8 : u32; - v163 = hir.bitcast v120 : u32; - v165 = arith.add v163, v302 : u32 #[overflow = checked]; - v301 = arith.constant 8 : u32; - v167 = arith.mod v165, v301 : u32; - hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - v169 = hir.load v168 : i64; - v293, v294 = arith.split v169 : felt, felt; - v173 = hir.bitcast v113 : u32; - v300 = arith.constant 8 : u32; - v175 = arith.mod v173, v300 : u32; - hir.assertz v175 #[code = 250]; - v295 = arith.join v294, v293 : i64; - v176 = hir.int_to_ptr v173 : ptr; - hir.store v176, v295; - v299 = arith.constant 16 : i32; - v178 = arith.add v120, v299 : i32 #[overflow = wrapping]; - v179 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr - v180 = hir.bitcast v179 : ptr; - hir.store v180, v178; + v314 = arith.join v313, v312 : i64; + v147 = hir.int_to_ptr v144 : ptr; + hir.store v147, v314; + v318 = arith.constant 8 : u32; + v148 = hir.bitcast v98 : u32; + v150 = arith.add v148, v318 : u32 #[overflow = checked]; + v317 = arith.constant 8 : u32; + v152 = arith.mod v150, v317 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : i64; + v309, v310 = arith.split v154 : felt, felt; + v158 = hir.bitcast v91 : u32; + v316 = arith.constant 8 : u32; + v160 = arith.mod v158, v316 : u32; + hir.assertz v160 #[code = 250]; + v311 = arith.join v310, v309 : i64; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v311; + v315 = arith.constant 16 : i32; + v163 = arith.add v98, v315 : i32 #[overflow = wrapping]; + v164 = builtin.global_symbol @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/__stack_pointer : ptr + v165 = hir.bitcast v164 : ptr; + hir.store v165, v163; builtin.ret ; }; - private builtin.function @miden::protocol::faucet::create_non_fungible_asset(v181: felt, v182: felt, v183: felt, v184: felt, v185: i32) { - ^block21(v181: felt, v182: felt, v183: felt, v184: felt, v185: i32): + private builtin.function @>::index(v166: i32, v167: i32, v168: i32) -> i32 { + ^block21(v166: i32, v167: i32, v168: i32): + v176 = arith.constant 0 : i32; + v325 = arith.constant 3 : u32; + v171 = hir.bitcast v167 : u32; + v173 = arith.gt v171, v325 : i1; + v174 = arith.zext v173 : u32; + v175 = hir.bitcast v174 : i32; + v177 = arith.neq v175, v176 : i1; + cf.cond_br v177 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v324 = arith.constant 2 : u32; + v180 = arith.shl v167, v324 : i32; + v181 = arith.add v166, v180 : i32 #[overflow = wrapping]; + builtin.ret v181; + }; + + private builtin.function @>::from(v182: i32, v183: i32) { + ^block25(v182: i32, v183: i32): + v185 = arith.constant 8 : u32; + v184 = hir.bitcast v183 : u32; + v186 = arith.add v184, v185 : u32 #[overflow = checked]; + v187 = arith.constant 4 : u32; + v188 = arith.mod v186, v187 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + v190 = hir.load v189 : i64; + v331 = arith.constant 8 : u32; + v191 = hir.bitcast v182 : u32; + v193 = arith.add v191, v331 : u32 #[overflow = checked]; + v330 = arith.constant 8 : u32; + v195 = arith.mod v193, v330 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + hir.store v196, v190; + v197 = hir.bitcast v183 : u32; + v329 = arith.constant 4 : u32; + v199 = arith.mod v197, v329 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + v201 = hir.load v200 : i64; + v202 = hir.bitcast v182 : u32; + v328 = arith.constant 8 : u32; + v204 = arith.mod v202, v328 : u32; + hir.assertz v204 #[code = 250]; + v205 = hir.int_to_ptr v202 : ptr; + hir.store v205, v201; + builtin.ret ; + }; + + private builtin.function @miden::protocol::faucet::create_non_fungible_asset(v206: felt, v207: felt, v208: felt, v209: felt, v210: i32) { + ^block27(v206: felt, v207: felt, v208: felt, v209: felt, v210: i32): ub.unreachable ; }; @@ -267,40 +300,40 @@ builtin.component miden:rust-sdk-account-faucet-create-non-fungible-asset-bindin builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block23: - v186 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() : i32 - v315 = arith.constant 0 : i32; - v187 = arith.constant 0 : i32; - v188 = arith.add v186, v187 : i32 #[overflow = unchecked]; - v190 = arith.add v188, v315 : i32 #[overflow = unchecked]; - v313 = arith.constant 0 : i32; - v314 = arith.constant 0 : i32; - v192 = arith.add v190, v314 : i32 #[overflow = unchecked]; - v194 = arith.add v192, v313 : i32 #[overflow = unchecked]; - v195 = hir.int_to_ptr v194 : ptr; - v196 = hir.load v195 : felt; - v312 = arith.constant 0 : i32; - v197 = arith.constant 4 : i32; - v198 = arith.add v190, v197 : i32 #[overflow = unchecked]; - v200 = arith.add v198, v312 : i32 #[overflow = unchecked]; - v201 = hir.int_to_ptr v200 : ptr; - v202 = hir.load v201 : felt; - v311 = arith.constant 0 : i32; - v203 = arith.constant 8 : i32; - v204 = arith.add v190, v203 : i32 #[overflow = unchecked]; - v206 = arith.add v204, v311 : i32 #[overflow = unchecked]; - v207 = hir.int_to_ptr v206 : ptr; - v208 = hir.load v207 : felt; - v310 = arith.constant 0 : i32; - v209 = arith.constant 12 : i32; - v210 = arith.add v190, v209 : i32 #[overflow = unchecked]; - v212 = arith.add v210, v310 : i32 #[overflow = unchecked]; - v213 = hir.int_to_ptr v212 : ptr; - v214 = hir.load v213 : felt; - builtin.ret v196, v202, v208, v214; + ^block29: + v211 = hir.exec @miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1/rust_sdk_account_faucet_create_non_fungible_asset_binding/miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding() : i32 + v212 = arith.constant 0 : i32; + v213 = arith.add v211, v212 : i32 #[overflow = unchecked]; + v335 = arith.constant 0 : i32; + v336 = arith.constant 0 : i32; + v215 = arith.add v213, v336 : i32 #[overflow = unchecked]; + v217 = arith.add v215, v335 : i32 #[overflow = unchecked]; + v218 = hir.int_to_ptr v217 : ptr; + v219 = hir.load v218 : felt; + v334 = arith.constant 0 : i32; + v220 = arith.constant 4 : i32; + v221 = arith.add v213, v220 : i32 #[overflow = unchecked]; + v223 = arith.add v221, v334 : i32 #[overflow = unchecked]; + v224 = hir.int_to_ptr v223 : ptr; + v225 = hir.load v224 : felt; + v333 = arith.constant 0 : i32; + v226 = arith.constant 8 : i32; + v227 = arith.add v213, v226 : i32 #[overflow = unchecked]; + v229 = arith.add v227, v333 : i32 #[overflow = unchecked]; + v230 = hir.int_to_ptr v229 : ptr; + v231 = hir.load v230 : felt; + v332 = arith.constant 0 : i32; + v232 = arith.constant 12 : i32; + v233 = arith.add v213, v232 : i32 #[overflow = unchecked]; + v235 = arith.add v233, v332 : i32 #[overflow = unchecked]; + v236 = hir.int_to_ptr v235 : ptr; + v237 = hir.load v236 : felt; + builtin.ret v219, v225, v231, v237; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm index cdc405bf1..2a04bc8d4 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -73,20 +70,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding @@ -109,7 +106,7 @@ end proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1#binding( ) -> i32 - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -119,7 +116,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -136,6 +133,9 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -206,83 +206,21 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac drop drop drop - push.24 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.1114180 u32divmod.4 swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::intrinsics::mem::load_sw trace.252 nop push.16 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 dup.2 - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.1114148 - u32divmod.4 - swap.1 + u32wrapping_add + dup.2 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::>::from trace.252 nop push.16 @@ -295,7 +233,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::miden_base_sys::bindings::faucet::create_non_fungible_asset trace.252 nop - push.1048584 + push.1048612 u32wrapping_add push.24 dup.2 @@ -371,7 +309,7 @@ proc miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-ac push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -385,7 +323,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -393,7 +331,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048628 u32wrapping_add u32divmod.4 swap.1 @@ -414,7 +352,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -428,7 +366,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048600 + push.1048628 movup.2 u32wrapping_add u32divmod.4 @@ -460,7 +398,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( i32, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -470,7 +408,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -480,10 +418,26 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.3 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -497,10 +451,16 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -514,10 +474,16 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -531,7 +497,17 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -545,17 +521,19 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + dup.3 swap.1 swap.3 swap.1 swap.4 + swap.6 + swap.2 trace.240 nop exec.::"miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1"::rust_sdk_account_faucet_create_non_fungible_asset_binding::"miden::protocol::faucet::create_non_fungible_asset" trace.252 nop - dup.0 + dup.1 push.8 dup.1 swap.1 @@ -571,7 +549,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( nop swap.1 push.8 - dup.4 + dup.3 add u32assert push.8 @@ -592,7 +570,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( trace.252 nop push.8 - dup.1 + dup.2 add u32assert push.8 @@ -609,7 +587,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -629,7 +607,7 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -639,6 +617,109 @@ proc miden_base_sys::bindings::faucet::create_non_fungible_asset( nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + @callconv("C") proc miden::protocol::faucet::create_non_fungible_asset( felt, diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat index 2b439c7b3..a7b1d6ef5 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_create_non_fungible_asset_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,8 +14,9 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -36,8 +36,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -59,23 +59,20 @@ br 0 (;@2;) end end - local.get 0 - local.get 0 - i64.load offset=24 align=4 - i64.store offset=8 - local.get 0 - local.get 0 - i64.load offset=16 align=4 - i64.store global.get $GOT.data.internal.__memory_base local.set 1 local.get 0 + local.get 0 + i32.const 16 + i32.add + call $>::from + local.get 0 i32.const 16 i32.add local.get 0 call $miden_base_sys::bindings::faucet::create_non_fungible_asset local.get 1 - i32.const 1048584 + i32.const 1048612 i32.add local.tee 1 local.get 0 @@ -95,7 +92,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048600 + i32.const 1048628 i32.add i32.load8_u br_if 0 (;@1;) @@ -103,26 +100,41 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048600 + i32.const 1048628 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::faucet::create_non_fungible_asset (;4;) (type 2) (param i32 i32) - (local i32) + (local i32 i32) global.get $__stack_pointer i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 1 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 1 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 1 + i32.const 0 + local.get 3 + call $>::index f32.load local.get 2 call $miden::protocol::faucet::create_non_fungible_asset @@ -143,13 +155,39 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) + unreachable + ) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end unreachable ) - (func $miden::protocol::faucet::create_non_fungible_asset (;6;) (type 4) (param f32 f32 f32 f32 i32) + (func $>::from (;7;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::faucet::create_non_fungible_asset (;8;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "srust_sdk_account_faucet_create_non_fungible_asset_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) @@ -164,17 +202,16 @@ (component $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-asset0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "asset" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-asset0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "asset" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-create-non-fungible-asset-binding/rust-sdk-account-faucet-create-non-fungible-asset-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir index ade970282..61dd6b31b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.hir @@ -21,167 +21,204 @@ builtin.component miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-bin v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/wit_bindgen::rt::run_ctors_once() - v127 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v170, v171, v172, v173 = scf.while v1, v7, v127 : i32, i32, felt, i32 { - ^block32(v174: i32, v175: i32, v176: felt): - v191 = arith.constant 0 : i32; - v31 = arith.constant 16 : i32; - v15 = arith.eq v174, v31 : i1; + v196, v197, v198, v199 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block38(v200: i32, v201: i32, v202: felt): + v218 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v200, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v191 : i1; - v165 = scf.if v19 : i32 { - ^block31: - v136 = ub.poison i32 : i32; - scf.yield v136; + v19 = arith.neq v17, v218 : i1; + v191 = scf.if v19 : i32 { + ^block37: + v162 = ub.poison i32 : i32; + scf.yield v162; } else { ^block14: - v190 = arith.constant 16 : i32; - v22 = arith.add v175, v190 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v174 : i32 #[overflow = wrapping]; + v217 = arith.constant 16 : i32; + v22 = arith.add v201, v217 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v200 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; - v36 = arith.constant 4 : u32; - v27 = arith.mod v25, v36 : u32; + v41 = arith.constant 4 : u32; + v27 = arith.mod v25, v41 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v176; + hir.store v28, v202; v29 = arith.constant 4 : i32; - v30 = arith.add v174, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v200, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v137 = ub.poison felt : felt; - v167 = cf.select v19, v137, v176 : felt; - v189 = ub.poison i32 : i32; - v166 = cf.select v19, v189, v175 : i32; - v135 = arith.constant 1 : u32; - v129 = arith.constant 0 : u32; - v169 = cf.select v19, v129, v135 : u32; - v159 = arith.trunc v169 : i1; - scf.condition v159, v165, v166, v167, v175; + v163 = ub.poison felt : felt; + v193 = cf.select v19, v163, v202 : felt; + v216 = ub.poison i32 : i32; + v192 = cf.select v19, v216, v201 : i32; + v161 = arith.constant 1 : u32; + v155 = arith.constant 0 : u32; + v195 = cf.select v19, v155, v161 : u32; + v185 = arith.trunc v195 : i1; + scf.condition v185, v191, v192, v193, v201; } do { - ^block33(v177: i32, v178: i32, v179: felt, v180: i32): - scf.yield v177, v178, v179; + ^block39(v203: i32, v204: i32, v205: felt, v206: i32): + scf.yield v203, v204, v205; }; - v188 = arith.constant 16 : i32; - v32 = arith.add v173, v188 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::from(v173, v32) - v34 = arith.constant 12 : u32; - v33 = hir.bitcast v173 : u32; - v35 = arith.add v33, v34 : u32 #[overflow = checked]; - v187 = arith.constant 4 : u32; - v37 = arith.mod v35, v187 : u32; - hir.assertz v37 #[code = 250]; - v38 = hir.int_to_ptr v35 : ptr; - v39 = hir.load v38 : felt; - v41 = arith.constant 8 : u32; - v40 = hir.bitcast v173 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v186 = arith.constant 4 : u32; - v44 = arith.mod v42, v186 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : felt; - v185 = arith.constant 4 : u32; - v47 = hir.bitcast v173 : u32; - v49 = arith.add v47, v185 : u32 #[overflow = checked]; - v184 = arith.constant 4 : u32; - v51 = arith.mod v49, v184 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - v53 = hir.load v52 : felt; - v54 = hir.bitcast v173 : u32; - v183 = arith.constant 4 : u32; - v56 = arith.mod v54, v183 : u32; + v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v215 = arith.constant 16 : i32; + v35 = arith.add v199, v215 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::from(v199, v35) + v37 = arith.constant 1048596 : i32; + v38 = arith.add v33, v37 : i32 #[overflow = wrapping]; + v36 = arith.constant 3 : i32; + v39 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::index(v199, v36, v38) : i32 + v40 = hir.bitcast v39 : u32; + v214 = arith.constant 4 : u32; + v42 = arith.mod v40, v214 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v45 = arith.constant 2 : i32; + v46 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::index(v199, v45, v38) : i32 + v47 = hir.bitcast v46 : u32; + v213 = arith.constant 4 : u32; + v49 = arith.mod v47, v213 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + v51 = hir.load v50 : felt; + v52 = arith.constant 1 : i32; + v53 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::index(v199, v52, v38) : i32 + v54 = hir.bitcast v53 : u32; + v212 = arith.constant 4 : u32; + v56 = arith.mod v54, v212 : u32; hir.assertz v56 #[code = 250]; v57 = hir.int_to_ptr v54 : ptr; v58 = hir.load v57 : felt; - v59 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden::protocol::faucet::is_non_fungible_asset_issued(v39, v46, v53, v58) : felt - v182 = arith.constant 32 : i32; - v70 = arith.add v173, v182 : i32 #[overflow = wrapping]; - v71 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr - v72 = hir.bitcast v71 : ptr; - hir.store v72, v70; - v64 = arith.constant 1 : i32; - v181 = arith.constant 0 : felt; - v62 = arith.eq v59, v181 : i1; - v63 = hir.cast v62 : i32; - v65 = arith.neq v63, v64 : i1; - v66 = arith.zext v65 : u32; - v67 = hir.bitcast v66 : i32; - v68 = hir.bitcast v67 : felt; - builtin.ret v68; + v211 = arith.constant 0 : i32; + v60 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::index(v199, v211, v38) : i32 + v61 = hir.bitcast v60 : u32; + v210 = arith.constant 4 : u32; + v63 = arith.mod v61, v210 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden::protocol::faucet::is_non_fungible_asset_issued(v44, v51, v58, v65) : felt + v209 = arith.constant 32 : i32; + v80 = arith.add v199, v209 : i32 #[overflow = wrapping]; + v81 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__stack_pointer : ptr + v82 = hir.bitcast v81 : ptr; + hir.store v82, v80; + v207 = arith.constant 1 : i32; + v208 = arith.constant 0 : i64; + v68 = arith.trunc v208 : felt; + v69 = arith.eq v66, v68 : i1; + v70 = hir.cast v69 : i32; + v72 = arith.neq v70, v207 : i1; + v73 = arith.zext v72 : u32; + v74 = hir.bitcast v73 : i32; + v75 = hir.bitcast v74 : u32; + v76 = arith.zext v75 : u64; + v77 = hir.bitcast v76 : i64; + v78 = arith.trunc v77 : felt; + builtin.ret v78; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v74 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr - v75 = hir.bitcast v74 : ptr; - v76 = hir.load v75 : i32; - v77 = arith.constant 1048584 : i32; - v78 = arith.add v76, v77 : i32 #[overflow = wrapping]; - v79 = hir.bitcast v78 : u32; - v80 = hir.int_to_ptr v79 : ptr; - v81 = hir.load v80 : u8; - v73 = arith.constant 0 : i32; - v82 = arith.zext v81 : u32; - v83 = hir.bitcast v82 : i32; - v85 = arith.neq v83, v73 : i1; - scf.if v85{ + v84 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v85 = hir.bitcast v84 : ptr; + v86 = hir.load v85 : i32; + v87 = arith.constant 1048612 : i32; + v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v88 : u32; + v90 = hir.int_to_ptr v89 : ptr; + v91 = hir.load v90 : u8; + v83 = arith.constant 0 : i32; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + v95 = arith.neq v93, v83 : i1; + scf.if v95{ ^block17: scf.yield ; } else { ^block18: - v86 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr - v87 = hir.bitcast v86 : ptr; - v88 = hir.load v87 : i32; + v96 = builtin.global_symbol @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/GOT.data.internal.__memory_base : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/__wasm_call_ctors() - v193 = arith.constant 1 : u8; - v195 = arith.constant 1048584 : i32; - v90 = arith.add v88, v195 : i32 #[overflow = wrapping]; - v94 = hir.bitcast v90 : u32; - v95 = hir.int_to_ptr v94 : ptr; - hir.store v95, v193; + v220 = arith.constant 1 : u8; + v222 = arith.constant 1048612 : i32; + v100 = arith.add v98, v222 : i32 #[overflow = wrapping]; + v104 = hir.bitcast v100 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v220; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v96: i32, v97: i32) { - ^block19(v96: i32, v97: i32): - v99 = arith.constant 8 : u32; - v98 = hir.bitcast v97 : u32; - v100 = arith.add v98, v99 : u32 #[overflow = checked]; - v101 = arith.constant 4 : u32; - v102 = arith.mod v100, v101 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i64; - v199 = arith.constant 8 : u32; - v105 = hir.bitcast v96 : u32; - v107 = arith.add v105, v199 : u32 #[overflow = checked]; - v198 = arith.constant 8 : u32; - v109 = arith.mod v107, v198 : u32; - hir.assertz v109 #[code = 250]; - v110 = hir.int_to_ptr v107 : ptr; - hir.store v110, v104; - v111 = hir.bitcast v97 : u32; - v197 = arith.constant 4 : u32; - v113 = arith.mod v111, v197 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : i64; - v116 = hir.bitcast v96 : u32; - v196 = arith.constant 8 : u32; - v118 = arith.mod v116, v196 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - hir.store v119, v115; + private builtin.function @>::from(v106: i32, v107: i32) { + ^block19(v106: i32, v107: i32): + hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/>::from(v106, v107) builtin.ret ; }; - private builtin.function @miden::protocol::faucet::is_non_fungible_asset_issued(v120: felt, v121: felt, v122: felt, v123: felt) -> felt { - ^block21(v120: felt, v121: felt, v122: felt, v123: felt): + private builtin.function @>::index(v108: i32, v109: i32, v110: i32) -> i32 { + ^block21(v108: i32, v109: i32, v110: i32): + v118 = arith.constant 0 : i32; + v224 = arith.constant 3 : u32; + v113 = hir.bitcast v109 : u32; + v115 = arith.gt v113, v224 : i1; + v116 = arith.zext v115 : u32; + v117 = hir.bitcast v116 : i32; + v119 = arith.neq v117, v118 : i1; + cf.cond_br v119 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v223 = arith.constant 2 : u32; + v122 = arith.shl v109, v223 : i32; + v123 = arith.add v108, v122 : i32 #[overflow = wrapping]; + builtin.ret v123; + }; + + private builtin.function @>::from(v124: i32, v125: i32) { + ^block25(v124: i32, v125: i32): + v127 = arith.constant 8 : u32; + v126 = hir.bitcast v125 : u32; + v128 = arith.add v126, v127 : u32 #[overflow = checked]; + v129 = arith.constant 4 : u32; + v130 = arith.mod v128, v129 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + v132 = hir.load v131 : i64; + v230 = arith.constant 8 : u32; + v133 = hir.bitcast v124 : u32; + v135 = arith.add v133, v230 : u32 #[overflow = checked]; + v229 = arith.constant 8 : u32; + v137 = arith.mod v135, v229 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + hir.store v138, v132; + v139 = hir.bitcast v125 : u32; + v228 = arith.constant 4 : u32; + v141 = arith.mod v139, v228 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : i64; + v144 = hir.bitcast v124 : u32; + v227 = arith.constant 8 : u32; + v146 = arith.mod v144, v227 : u32; + hir.assertz v146 #[code = 250]; + v147 = hir.int_to_ptr v144 : ptr; + hir.store v147, v143; + builtin.ret ; + }; + + private builtin.function @miden::protocol::faucet::is_non_fungible_asset_issued(v148: felt, v149: felt, v150: felt, v151: felt) -> felt { + ^block27(v148: felt, v149: felt, v150: felt, v151: felt): ub.unreachable ; }; @@ -193,12 +230,14 @@ builtin.component miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-bin builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block23: - v125 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() : felt - builtin.ret v125; + ^block29: + v153 = hir.exec @miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding/miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding() : felt + builtin.ret v153; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm index e344665e0..c7b0ec3fb 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,6 +81,9 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -151,19 +154,35 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk drop drop drop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.1 + dup.2 u32wrapping_add - dup.1 + dup.2 trace.240 nop - exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::from + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::from + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.2 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::index trace.252 nop - push.12 - dup.1 - add - u32assert push.4 dup.1 swap.1 @@ -177,10 +196,16 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert + push.2 + dup.3 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -194,10 +219,16 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 - add - u32assert + push.1 + dup.4 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -211,7 +242,16 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + push.0 + dup.5 + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -226,7 +266,7 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk trace.252 nop movdn.3 - swap.2 + swap.1 trace.240 nop exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::"miden::protocol::faucet::is_non_fungible_asset_issued" @@ -235,7 +275,7 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -245,16 +285,22 @@ proc miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk nop push.1 push.0 + push.0 + mul.4294967296 + add movup.2 eq neq + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -262,7 +308,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -283,7 +329,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -297,7 +343,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -325,7 +371,47 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-is-non-fungible-asset-issued-binding/rust-sdk-account-faucet-is-non-fungible-asset-issued-binding@0.0.1"::rust_sdk_account_faucet_is_non_fungible_asset_issued_binding::>::from + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat index 540d9163f..882285654 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_is_non_fungible_asset_issued_binding.wat @@ -11,8 +11,9 @@ (type (;1;) (func (result f32))) (type (;2;) (func (param i32 i32))) (type (;3;) (func (param f32 f32) (result i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32) (result f32))) + (type (;4;) (func (param i64) (result f32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;6;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -32,8 +33,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -55,26 +56,44 @@ br 0 (;@2;) end end + global.get $GOT.data.internal.__memory_base + local.set 1 local.get 0 local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 - f32.load offset=12 + i32.const 3 + local.get 1 + i32.const 1048596 + i32.add + local.tee 1 + call $>::index + f32.load local.get 0 - f32.load offset=8 + i32.const 2 + local.get 1 + call $>::index + f32.load local.get 0 - f32.load offset=4 + i32.const 1 + local.get 1 + call $>::index + f32.load local.get 0 + i32.const 0 + local.get 1 + call $>::index f32.load call $miden::protocol::faucet::is_non_fungible_asset_issued - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::eq i32.const 1 i32.ne - call $intrinsics::felt::from_u32 + i64.extend_i32_u + call $intrinsics::felt::from_u64_unchecked local.set 2 local.get 0 i32.const 32 @@ -86,7 +105,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -94,13 +113,39 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32 i32) + (func $>::from (;4;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + call $>::from + ) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + unreachable + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) + unreachable + ) + (func $>::index (;7;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;8;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -110,16 +155,11 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) - unreachable - ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) - unreachable - ) - (func $miden::protocol::faucet::is_non_fungible_asset_issued (;7;) (type 5) (param f32 f32 f32 f32) (result f32) + (func $miden::protocol::faucet::is_non_fungible_asset_issued (;9;) (type 6) (param f32 f32 f32 f32) (result f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "yrust_sdk_account_faucet_is_non_fungible_asset_issued_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir index 17501a774..2ec3c3ce4 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.hir @@ -21,91 +21,92 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/wit_bindgen::rt::run_ctors_once() - v221 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v264, v265, v266, v267 = scf.while v1, v7, v221 : i32, i32, felt, i32 { - ^block34(v268: i32, v269: i32, v270: felt): - v284 = arith.constant 0 : i32; + v286, v287, v288, v289 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block40(v290: i32, v291: i32, v292: felt): + v306 = arith.constant 0 : i32; v34 = arith.constant 16 : i32; - v15 = arith.eq v268, v34 : i1; + v15 = arith.eq v290, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v284 : i1; - v259 = scf.if v19 : i32 { - ^block33: - v230 = ub.poison i32 : i32; - scf.yield v230; + v19 = arith.neq v17, v306 : i1; + v281 = scf.if v19 : i32 { + ^block39: + v252 = ub.poison i32 : i32; + scf.yield v252; } else { ^block14: - v283 = arith.constant 16 : i32; - v22 = arith.add v269, v283 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v268 : i32 #[overflow = wrapping]; + v305 = arith.constant 16 : i32; + v22 = arith.add v291, v305 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v290 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; v50 = arith.constant 4 : u32; v27 = arith.mod v25, v50 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v270; + hir.store v28, v292; v29 = arith.constant 4 : i32; - v30 = arith.add v268, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v290, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v231 = ub.poison felt : felt; - v261 = cf.select v19, v231, v270 : felt; - v282 = ub.poison i32 : i32; - v260 = cf.select v19, v282, v269 : i32; - v229 = arith.constant 1 : u32; - v223 = arith.constant 0 : u32; - v263 = cf.select v19, v223, v229 : u32; - v253 = arith.trunc v263 : i1; - scf.condition v253, v259, v260, v261, v269; + v253 = ub.poison felt : felt; + v283 = cf.select v19, v253, v292 : felt; + v304 = ub.poison i32 : i32; + v282 = cf.select v19, v304, v291 : i32; + v251 = arith.constant 1 : u32; + v245 = arith.constant 0 : u32; + v285 = cf.select v19, v245, v251 : u32; + v275 = arith.trunc v285 : i1; + scf.condition v275, v281, v282, v283, v291; } do { - ^block35(v271: i32, v272: i32, v273: felt, v274: i32): - scf.yield v271, v272, v273; + ^block41(v293: i32, v294: i32, v295: felt, v296: i32): + scf.yield v293, v294, v295; }; v31 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr v32 = hir.bitcast v31 : ptr; v33 = hir.load v32 : i32; - v281 = arith.constant 16 : i32; - v35 = arith.add v267, v281 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::from(v267, v35) - v280 = arith.constant 16 : i32; - v37 = arith.add v267, v280 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden_base_sys::bindings::faucet::mint(v37, v267) - v38 = arith.constant 1048584 : i32; + v303 = arith.constant 16 : i32; + v35 = arith.add v289, v303 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::from(v289, v35) + v302 = arith.constant 16 : i32; + v37 = arith.add v289, v302 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden_base_sys::bindings::faucet::mint(v37, v289) + v38 = arith.constant 1048612 : i32; v39 = arith.add v33, v38 : i32 #[overflow = wrapping]; v41 = arith.constant 24 : u32; - v40 = hir.bitcast v267 : u32; + v40 = hir.bitcast v289 : u32; v42 = arith.add v40, v41 : u32 #[overflow = checked]; v43 = arith.constant 8 : u32; v44 = arith.mod v42, v43 : u32; hir.assertz v44 #[code = 250]; v45 = hir.int_to_ptr v42 : ptr; v46 = hir.load v45 : i64; - v279 = arith.constant 8 : u32; + v301 = arith.constant 8 : u32; v47 = hir.bitcast v39 : u32; - v49 = arith.add v47, v279 : u32 #[overflow = checked]; - v278 = arith.constant 4 : u32; - v51 = arith.mod v49, v278 : u32; + v49 = arith.add v47, v301 : u32 #[overflow = checked]; + v300 = arith.constant 4 : u32; + v51 = arith.mod v49, v300 : u32; hir.assertz v51 #[code = 250]; v52 = hir.int_to_ptr v49 : ptr; hir.store v52, v46; v54 = arith.constant 16 : u32; - v53 = hir.bitcast v267 : u32; + v53 = hir.bitcast v289 : u32; v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v277 = arith.constant 8 : u32; - v57 = arith.mod v55, v277 : u32; + v299 = arith.constant 8 : u32; + v57 = arith.mod v55, v299 : u32; hir.assertz v57 #[code = 250]; v58 = hir.int_to_ptr v55 : ptr; v59 = hir.load v58 : i64; v60 = hir.bitcast v39 : u32; - v276 = arith.constant 4 : u32; - v62 = arith.mod v60, v276 : u32; + v298 = arith.constant 4 : u32; + v62 = arith.mod v60, v298 : u32; hir.assertz v62 #[code = 250]; v63 = hir.int_to_ptr v60 : ptr; hir.store v63, v59; - v275 = arith.constant 32 : i32; - v65 = arith.add v267, v275 : i32 #[overflow = wrapping]; + v297 = arith.constant 32 : i32; + v65 = arith.add v289, v297 : i32 #[overflow = wrapping]; v66 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr v67 = hir.bitcast v66 : ptr; hir.store v67, v65; @@ -117,7 +118,7 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa v69 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr v70 = hir.bitcast v69 : ptr; v71 = hir.load v70 : i32; - v72 = arith.constant 1048600 : i32; + v72 = arith.constant 1048628 : i32; v73 = arith.add v71, v72 : i32 #[overflow = wrapping]; v74 = hir.bitcast v73 : u32; v75 = hir.int_to_ptr v74 : ptr; @@ -135,12 +136,12 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa v82 = hir.bitcast v81 : ptr; v83 = hir.load v82 : i32; hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__wasm_call_ctors() - v286 = arith.constant 1 : u8; - v288 = arith.constant 1048600 : i32; - v85 = arith.add v83, v288 : i32 #[overflow = wrapping]; + v308 = arith.constant 1 : u8; + v310 = arith.constant 1048628 : i32; + v85 = arith.add v83, v310 : i32 #[overflow = wrapping]; v89 = hir.bitcast v85 : u32; v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v286; + hir.store v90, v308; scf.yield ; }; builtin.ret ; @@ -156,112 +157,144 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa v99 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr v100 = hir.bitcast v99 : ptr; hir.store v100, v98; - v102 = arith.constant 12 : u32; - v101 = hir.bitcast v92 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v92 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v305 = arith.constant 4 : u32; - v112 = arith.mod v110, v305 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v304 = arith.constant 4 : u32; - v115 = hir.bitcast v92 : u32; - v117 = arith.add v115, v304 : u32 #[overflow = checked]; - v303 = arith.constant 4 : u32; - v119 = arith.mod v117, v303 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.bitcast v92 : u32; - v302 = arith.constant 4 : u32; - v124 = arith.mod v122, v302 : u32; + v102 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/GOT.data.internal.__memory_base : ptr + v103 = hir.bitcast v102 : ptr; + v104 = hir.load v103 : i32; + v105 = arith.constant 1048596 : i32; + v106 = arith.add v104, v105 : i32 #[overflow = wrapping]; + v101 = arith.constant 3 : i32; + v107 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::index(v92, v101, v106) : i32 + v108 = hir.bitcast v107 : u32; + v109 = arith.constant 4 : u32; + v110 = arith.mod v108, v109 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : felt; + v113 = arith.constant 2 : i32; + v114 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::index(v92, v113, v106) : i32 + v115 = hir.bitcast v114 : u32; + v325 = arith.constant 4 : u32; + v117 = arith.mod v115, v325 : u32; + hir.assertz v117 #[code = 250]; + v118 = hir.int_to_ptr v115 : ptr; + v119 = hir.load v118 : felt; + v120 = arith.constant 1 : i32; + v121 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::index(v92, v120, v106) : i32 + v122 = hir.bitcast v121 : u32; + v324 = arith.constant 4 : u32; + v124 = arith.mod v122, v324 : u32; hir.assertz v124 #[code = 250]; v125 = hir.int_to_ptr v122 : ptr; v126 = hir.load v125 : felt; - hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden::protocol::faucet::mint(v107, v114, v121, v126, v98) - v127 = hir.bitcast v98 : u32; - v301 = arith.constant 8 : u32; - v129 = arith.mod v127, v301 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i64; - v292, v293 = arith.split v131 : felt, felt; - v300 = arith.constant 8 : u32; - v135 = hir.bitcast v91 : u32; - v137 = arith.add v135, v300 : u32 #[overflow = checked]; - v299 = arith.constant 8 : u32; - v139 = arith.mod v137, v299 : u32; - hir.assertz v139 #[code = 250]; - v294 = arith.join v293, v292 : i64; - v140 = hir.int_to_ptr v137 : ptr; - hir.store v140, v294; - v298 = arith.constant 8 : u32; - v141 = hir.bitcast v98 : u32; - v143 = arith.add v141, v298 : u32 #[overflow = checked]; - v297 = arith.constant 8 : u32; - v145 = arith.mod v143, v297 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : i64; - v289, v290 = arith.split v147 : felt, felt; - v151 = hir.bitcast v91 : u32; - v296 = arith.constant 8 : u32; - v153 = arith.mod v151, v296 : u32; - hir.assertz v153 #[code = 250]; - v291 = arith.join v290, v289 : i64; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v291; - v295 = arith.constant 16 : i32; - v156 = arith.add v98, v295 : i32 #[overflow = wrapping]; - v157 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr - v158 = hir.bitcast v157 : ptr; - hir.store v158, v156; + v93 = arith.constant 0 : i32; + v128 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::index(v92, v93, v106) : i32 + v129 = hir.bitcast v128 : u32; + v323 = arith.constant 4 : u32; + v131 = arith.mod v129, v323 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden::protocol::faucet::mint(v112, v119, v126, v133, v98) + v134 = hir.bitcast v98 : u32; + v135 = arith.constant 8 : u32; + v136 = arith.mod v134, v135 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + v138 = hir.load v137 : i64; + v314, v315 = arith.split v138 : felt, felt; + v322 = arith.constant 8 : u32; + v142 = hir.bitcast v91 : u32; + v144 = arith.add v142, v322 : u32 #[overflow = checked]; + v321 = arith.constant 8 : u32; + v146 = arith.mod v144, v321 : u32; + hir.assertz v146 #[code = 250]; + v316 = arith.join v315, v314 : i64; + v147 = hir.int_to_ptr v144 : ptr; + hir.store v147, v316; + v320 = arith.constant 8 : u32; + v148 = hir.bitcast v98 : u32; + v150 = arith.add v148, v320 : u32 #[overflow = checked]; + v319 = arith.constant 8 : u32; + v152 = arith.mod v150, v319 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : i64; + v311, v312 = arith.split v154 : felt, felt; + v158 = hir.bitcast v91 : u32; + v318 = arith.constant 8 : u32; + v160 = arith.mod v158, v318 : u32; + hir.assertz v160 #[code = 250]; + v313 = arith.join v312, v311 : i64; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v313; + v317 = arith.constant 16 : i32; + v163 = arith.add v98, v317 : i32 #[overflow = wrapping]; + v164 = builtin.global_symbol @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/__stack_pointer : ptr + v165 = hir.bitcast v164 : ptr; + hir.store v165, v163; builtin.ret ; }; - private builtin.function @>::from(v159: i32, v160: i32) { - ^block21(v159: i32, v160: i32): - v162 = arith.constant 8 : u32; - v161 = hir.bitcast v160 : u32; - v163 = arith.add v161, v162 : u32 #[overflow = checked]; - v164 = arith.constant 4 : u32; - v165 = arith.mod v163, v164 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - v167 = hir.load v166 : i64; - v309 = arith.constant 8 : u32; - v168 = hir.bitcast v159 : u32; - v170 = arith.add v168, v309 : u32 #[overflow = checked]; - v308 = arith.constant 8 : u32; - v172 = arith.mod v170, v308 : u32; - hir.assertz v172 #[code = 250]; - v173 = hir.int_to_ptr v170 : ptr; - hir.store v173, v167; - v174 = hir.bitcast v160 : u32; - v307 = arith.constant 4 : u32; - v176 = arith.mod v174, v307 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : i64; - v179 = hir.bitcast v159 : u32; - v306 = arith.constant 8 : u32; - v181 = arith.mod v179, v306 : u32; - hir.assertz v181 #[code = 250]; - v182 = hir.int_to_ptr v179 : ptr; - hir.store v182, v178; + private builtin.function @>::from(v166: i32, v167: i32) { + ^block21(v166: i32, v167: i32): + hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/>::from(v166, v167) builtin.ret ; }; - private builtin.function @miden::protocol::faucet::mint(v183: felt, v184: felt, v185: felt, v186: felt, v187: i32) { - ^block23(v183: felt, v184: felt, v185: felt, v186: felt, v187: i32): + private builtin.function @>::index(v168: i32, v169: i32, v170: i32) -> i32 { + ^block23(v168: i32, v169: i32, v170: i32): + v178 = arith.constant 0 : i32; + v327 = arith.constant 3 : u32; + v173 = hir.bitcast v169 : u32; + v175 = arith.gt v173, v327 : i1; + v176 = arith.zext v175 : u32; + v177 = hir.bitcast v176 : i32; + v179 = arith.neq v177, v178 : i1; + cf.cond_br v179 ^block25, ^block26; + ^block25: + ub.unreachable ; + ^block26: + v326 = arith.constant 2 : u32; + v182 = arith.shl v169, v326 : i32; + v183 = arith.add v168, v182 : i32 #[overflow = wrapping]; + builtin.ret v183; + }; + + private builtin.function @>::from(v184: i32, v185: i32) { + ^block27(v184: i32, v185: i32): + v187 = arith.constant 8 : u32; + v186 = hir.bitcast v185 : u32; + v188 = arith.add v186, v187 : u32 #[overflow = checked]; + v189 = arith.constant 4 : u32; + v190 = arith.mod v188, v189 : u32; + hir.assertz v190 #[code = 250]; + v191 = hir.int_to_ptr v188 : ptr; + v192 = hir.load v191 : i64; + v333 = arith.constant 8 : u32; + v193 = hir.bitcast v184 : u32; + v195 = arith.add v193, v333 : u32 #[overflow = checked]; + v332 = arith.constant 8 : u32; + v197 = arith.mod v195, v332 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + hir.store v198, v192; + v199 = hir.bitcast v185 : u32; + v331 = arith.constant 4 : u32; + v201 = arith.mod v199, v331 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + v203 = hir.load v202 : i64; + v204 = hir.bitcast v184 : u32; + v330 = arith.constant 8 : u32; + v206 = arith.mod v204, v330 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + hir.store v207, v203; + builtin.ret ; + }; + + private builtin.function @miden::protocol::faucet::mint(v208: felt, v209: felt, v210: felt, v211: felt, v212: i32) { + ^block29(v208: felt, v209: felt, v210: felt, v211: felt, v212: i32): ub.unreachable ; }; @@ -273,40 +306,40 @@ builtin.component miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-fa builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block25: - v188 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() : i32 - v315 = arith.constant 0 : i32; - v189 = arith.constant 0 : i32; - v190 = arith.add v188, v189 : i32 #[overflow = unchecked]; - v192 = arith.add v190, v315 : i32 #[overflow = unchecked]; - v313 = arith.constant 0 : i32; - v314 = arith.constant 0 : i32; - v194 = arith.add v192, v314 : i32 #[overflow = unchecked]; - v196 = arith.add v194, v313 : i32 #[overflow = unchecked]; - v197 = hir.int_to_ptr v196 : ptr; - v198 = hir.load v197 : felt; - v312 = arith.constant 0 : i32; - v199 = arith.constant 4 : i32; - v200 = arith.add v192, v199 : i32 #[overflow = unchecked]; - v202 = arith.add v200, v312 : i32 #[overflow = unchecked]; - v203 = hir.int_to_ptr v202 : ptr; - v204 = hir.load v203 : felt; - v311 = arith.constant 0 : i32; - v205 = arith.constant 8 : i32; - v206 = arith.add v192, v205 : i32 #[overflow = unchecked]; - v208 = arith.add v206, v311 : i32 #[overflow = unchecked]; - v209 = hir.int_to_ptr v208 : ptr; - v210 = hir.load v209 : felt; - v310 = arith.constant 0 : i32; - v211 = arith.constant 12 : i32; - v212 = arith.add v192, v211 : i32 #[overflow = unchecked]; - v214 = arith.add v212, v310 : i32 #[overflow = unchecked]; - v215 = hir.int_to_ptr v214 : ptr; - v216 = hir.load v215 : felt; - builtin.ret v198, v204, v210, v216; + ^block31: + v213 = hir.exec @miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1/rust_sdk_account_faucet_mint_binding/miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding() : i32 + v214 = arith.constant 0 : i32; + v215 = arith.add v213, v214 : i32 #[overflow = unchecked]; + v337 = arith.constant 0 : i32; + v338 = arith.constant 0 : i32; + v217 = arith.add v215, v338 : i32 #[overflow = unchecked]; + v219 = arith.add v217, v337 : i32 #[overflow = unchecked]; + v220 = hir.int_to_ptr v219 : ptr; + v221 = hir.load v220 : felt; + v336 = arith.constant 0 : i32; + v222 = arith.constant 4 : i32; + v223 = arith.add v215, v222 : i32 #[overflow = unchecked]; + v225 = arith.add v223, v336 : i32 #[overflow = unchecked]; + v226 = hir.int_to_ptr v225 : ptr; + v227 = hir.load v226 : felt; + v335 = arith.constant 0 : i32; + v228 = arith.constant 8 : i32; + v229 = arith.add v215, v228 : i32 #[overflow = unchecked]; + v231 = arith.add v229, v335 : i32 #[overflow = unchecked]; + v232 = hir.int_to_ptr v231 : ptr; + v233 = hir.load v232 : felt; + v334 = arith.constant 0 : i32; + v234 = arith.constant 12 : i32; + v235 = arith.add v215, v234 : i32 #[overflow = unchecked]; + v237 = arith.add v235, v334 : i32 #[overflow = unchecked]; + v238 = hir.int_to_ptr v237 : ptr; + v239 = hir.load v238 : felt; + builtin.ret v221, v227, v233, v239; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm index e2b13700c..8cc6784d3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -73,20 +70,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding @@ -109,7 +106,7 @@ end proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1#binding( ) -> i32 - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -119,7 +116,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -136,6 +133,9 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -206,7 +206,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin drop drop drop - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -220,7 +220,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin dup.2 trace.240 nop - exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::from + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::from trace.252 nop push.16 @@ -233,7 +233,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::miden_base_sys::bindings::faucet::mint trace.252 nop - push.1048584 + push.1048612 u32wrapping_add push.24 dup.2 @@ -309,7 +309,7 @@ proc miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-bin push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -323,7 +323,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -331,7 +331,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048628 u32wrapping_add u32divmod.4 swap.1 @@ -352,7 +352,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -366,7 +366,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048600 + push.1048628 movup.2 u32wrapping_add u32divmod.4 @@ -395,7 +395,7 @@ end @callconv("C") proc miden_base_sys::bindings::faucet::mint(i32, i32) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -405,7 +405,7 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -415,10 +415,26 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.3 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -432,10 +448,16 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -449,10 +471,16 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -466,7 +494,17 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -480,17 +518,19 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - dup.4 + dup.3 swap.1 swap.3 swap.1 swap.4 + swap.6 + swap.2 trace.240 nop exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::"miden::protocol::faucet::mint" trace.252 nop - dup.0 + dup.1 push.8 dup.1 swap.1 @@ -506,7 +546,7 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) nop swap.1 push.8 - dup.4 + dup.3 add u32assert push.8 @@ -527,7 +567,7 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) trace.252 nop push.8 - dup.1 + dup.2 add u32assert push.8 @@ -544,7 +584,7 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) trace.252 nop swap.1 - movup.3 + movup.2 push.8 dup.1 swap.1 @@ -564,7 +604,7 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -575,7 +615,47 @@ proc miden_base_sys::bindings::faucet::mint(i32, i32) end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1"::rust_sdk_account_faucet_mint_binding::>::from + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat index 83f918091..bdc4de796 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_faucet_mint_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "asset" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "asset" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,8 +14,9 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -36,8 +36,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -65,14 +65,14 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 i32.const 16 i32.add local.get 0 call $miden_base_sys::bindings::faucet::mint local.get 1 - i32.const 1048584 + i32.const 1048612 i32.add local.tee 1 local.get 0 @@ -92,7 +92,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048600 + i32.const 1048628 i32.add i32.load8_u br_if 0 (;@1;) @@ -100,26 +100,41 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048600 + i32.const 1048628 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::faucet::mint (;4;) (type 2) (param i32 i32) - (local i32) + (local i32 i32) global.get $__stack_pointer i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 1 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 1 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 1 + i32.const 0 + local.get 3 + call $>::index f32.load local.get 2 call $miden::protocol::faucet::mint @@ -140,7 +155,30 @@ i32.add global.set $__stack_pointer ) - (func $>::from (;5;) (type 2) (param i32 i32) + (func $>::from (;5;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + call $>::from + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 3) (param i64) (result f32) + unreachable + ) + (func $>::index (;7;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;8;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -150,13 +188,11 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;6;) (type 3) (param i32) (result f32) - unreachable - ) - (func $miden::protocol::faucet::mint (;7;) (type 4) (param f32 f32 f32 f32 i32) + (func $miden::protocol::faucet::mint (;9;) (type 5) (param f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "Irust_sdk_account_faucet_mint_binding\01\0b0.0.1\05\02\03\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "asset" (type $asset (;1;))) @@ -171,17 +207,16 @@ (component $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-asset" (type (;6;) (eq 5))) - (import "import-type-asset0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "asset" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-asset" (type (;5;) (eq 4))) + (import "import-type-asset0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "asset" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-faucet-mint-binding/rust-sdk-account-faucet-mint-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir index 2efd52cc7..1e34ad5be 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-ac public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1/rust_sdk_account_get_code_commitment_binding/miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm index e089deccd..8f7a31f0f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat index 6c28cd845..39565dfad 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_code_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-code-commitment-binding/rust-sdk-account-get-code-commitment-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir index a2813437a..2248166bc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.hir @@ -13,9 +13,11 @@ builtin.component miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-ac private builtin.function @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding() -> felt { ^block9: hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/wit_bindgen::rt::run_ctors_once() - v34 = arith.constant 0 : felt; - v35 = arith.constant 1 : felt; - v5 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden::protocol::active_account::get_initial_balance(v35, v34) : felt + v3 = arith.constant 0 : i64; + v4 = arith.trunc v3 : felt; + v1 = arith.constant 1 : i64; + v2 = arith.trunc v1 : felt; + v5 = hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/miden::protocol::active_account::get_initial_balance(v2, v4) : felt builtin.ret v5; }; @@ -42,12 +44,12 @@ builtin.component miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-ac v20 = hir.bitcast v19 : ptr; v21 = hir.load v20 : i32; hir.exec @miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1/rust_sdk_account_get_initial_balance_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v23 = arith.add v21, v39 : i32 #[overflow = wrapping]; + v35 = arith.constant 1 : u8; + v37 = arith.constant 1048584 : i32; + v23 = arith.add v21, v37 : i32 #[overflow = wrapping]; v27 = hir.bitcast v23 : u32; v28 = hir.int_to_ptr v27 : ptr; - hir.store v28, v37; + hir.store v28, v35; scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm index 2a76e7e5c..bfa45ed6e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.masm @@ -60,7 +60,13 @@ proc miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-ini trace.252 nop push.0 + push.0 + mul.4294967296 + add push.1 + push.0 + mul.4294967296 + add trace.240 nop exec.::"miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1"::rust_sdk_account_get_initial_balance_binding::"miden::protocol::active_account::get_initial_balance" diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat index 735623e2c..0079164fb 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_balance_binding.wat @@ -9,7 +9,7 @@ (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result f32))) - (type (;2;) (func (param i32) (result f32))) + (type (;2;) (func (param i64) (result f32))) (type (;3;) (func (param f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -22,10 +22,10 @@ (func $rust_sdk_account_get_initial_balance_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-account-get-initial-balance-binding/rust-sdk-account-get-initial-balance-binding@0.0.1#binding (;2;) (type 1) (result f32) call $wit_bindgen::rt::run_ctors_once - i32.const 1 - call $intrinsics::felt::from_u32 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden::protocol::active_account::get_initial_balance ) (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) @@ -46,7 +46,7 @@ i32.store8 end ) - (func $intrinsics::felt::from_u32 (;4;) (type 2) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;4;) (type 2) (param i64) (result f32) unreachable ) (func $miden::protocol::active_account::get_initial_balance (;5;) (type 3) (param f32 f32) (result f32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir index c8b1640a1..de6d3c76e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-get-initial-storage-commitment-binding/ public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1/rust_sdk_account_get_initial_storage_commitment_binding/miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm index 0d3ef8b7a..568c7cb92 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat index aaa4611f4..830d17dd2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_storage_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-initial-storage-commitment-binding/rust-sdk-account-get-initial-storage-commitment-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir index 7f0bdc96a..ea4cd1b0d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1/rust_sdk_account_get_initial_vault_root_binding/miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm index 483cd1def..979455e19 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat index 84b33ad8c..7c682eda2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_initial_vault_root_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-initial-vault-root-binding/rust-sdk-account-get-initial-vault-root-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir index 6af0d0973..4f09a1b48 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.hir @@ -21,8 +21,8 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/wit_bindgen::rt::run_ctors_once() - v1 = arith.constant 0 : i32; - v10 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/>::from(v1) : felt + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden::protocol::active_account::get_procedure_root(v10, v6) v11 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; @@ -38,59 +38,59 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc v22 = arith.constant 12 : u32; v21 = hir.bitcast v15 : u32; v23 = arith.add v21, v22 : u32 #[overflow = checked]; - v155 = arith.constant 4 : u32; - v25 = arith.mod v23, v155 : u32; + v148 = arith.constant 4 : u32; + v25 = arith.mod v23, v148 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; hir.store v26, v20; - v154 = arith.constant 4 : u32; + v147 = arith.constant 4 : u32; v27 = hir.bitcast v6 : u32; - v29 = arith.add v27, v154 : u32 #[overflow = checked]; - v153 = arith.constant 4 : u32; - v31 = arith.mod v29, v153 : u32; + v29 = arith.add v27, v147 : u32 #[overflow = checked]; + v146 = arith.constant 4 : u32; + v31 = arith.mod v29, v146 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : felt; v35 = arith.constant 8 : u32; v34 = hir.bitcast v15 : u32; v36 = arith.add v34, v35 : u32 #[overflow = checked]; - v152 = arith.constant 4 : u32; - v38 = arith.mod v36, v152 : u32; + v145 = arith.constant 4 : u32; + v38 = arith.mod v36, v145 : u32; hir.assertz v38 #[code = 250]; v39 = hir.int_to_ptr v36 : ptr; hir.store v39, v33; - v151 = arith.constant 8 : u32; + v144 = arith.constant 8 : u32; v40 = hir.bitcast v6 : u32; - v42 = arith.add v40, v151 : u32 #[overflow = checked]; - v150 = arith.constant 4 : u32; - v44 = arith.mod v42, v150 : u32; + v42 = arith.add v40, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v44 = arith.mod v42, v143 : u32; hir.assertz v44 #[code = 250]; v45 = hir.int_to_ptr v42 : ptr; v46 = hir.load v45 : felt; - v149 = arith.constant 4 : u32; + v142 = arith.constant 4 : u32; v47 = hir.bitcast v15 : u32; - v49 = arith.add v47, v149 : u32 #[overflow = checked]; - v148 = arith.constant 4 : u32; - v51 = arith.mod v49, v148 : u32; + v49 = arith.add v47, v142 : u32 #[overflow = checked]; + v141 = arith.constant 4 : u32; + v51 = arith.mod v49, v141 : u32; hir.assertz v51 #[code = 250]; v52 = hir.int_to_ptr v49 : ptr; hir.store v52, v46; - v147 = arith.constant 12 : u32; + v140 = arith.constant 12 : u32; v53 = hir.bitcast v6 : u32; - v55 = arith.add v53, v147 : u32 #[overflow = checked]; - v146 = arith.constant 4 : u32; - v57 = arith.mod v55, v146 : u32; + v55 = arith.add v53, v140 : u32 #[overflow = checked]; + v139 = arith.constant 4 : u32; + v57 = arith.mod v55, v139 : u32; hir.assertz v57 #[code = 250]; v58 = hir.int_to_ptr v55 : ptr; v59 = hir.load v58 : felt; v60 = hir.bitcast v15 : u32; - v145 = arith.constant 4 : u32; - v62 = arith.mod v60, v145 : u32; + v138 = arith.constant 4 : u32; + v62 = arith.mod v60, v138 : u32; hir.assertz v62 #[code = 250]; v63 = hir.int_to_ptr v60 : ptr; hir.store v63, v59; - v144 = arith.constant 16 : i32; - v65 = arith.add v6, v144 : i32 #[overflow = wrapping]; + v137 = arith.constant 16 : i32; + v65 = arith.add v6, v137 : i32 #[overflow = wrapping]; v66 = builtin.global_symbol @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__stack_pointer : ptr v67 = hir.bitcast v66 : ptr; hir.store v67, v65; @@ -120,43 +120,35 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc v82 = hir.bitcast v81 : ptr; v83 = hir.load v82 : i32; hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/__wasm_call_ctors() - v157 = arith.constant 1 : u8; - v159 = arith.constant 1048600 : i32; - v85 = arith.add v83, v159 : i32 #[overflow = wrapping]; + v150 = arith.constant 1 : u8; + v152 = arith.constant 1048600 : i32; + v85 = arith.add v83, v152 : i32 #[overflow = wrapping]; v89 = hir.bitcast v85 : u32; v90 = hir.int_to_ptr v89 : ptr; - hir.store v90, v157; + hir.store v90, v150; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v91: i32) -> felt { - ^block15(v91: i32): - v93 = arith.constant 255 : i32; - v94 = arith.band v91, v93 : i32; - v95 = hir.bitcast v94 : felt; - builtin.ret v95; - }; - - private builtin.function @miden::protocol::active_account::get_procedure_root(v96: felt, v97: i32) { - ^block17(v96: felt, v97: i32): - v98, v99, v100, v101 = hir.exec @miden/protocol/active_account/get_procedure_root(v96) : felt, felt, felt, felt - v102 = hir.bitcast v97 : u32; - v103 = hir.int_to_ptr v102 : ptr; - hir.store v103, v98; - v104 = arith.constant 4 : u32; - v105 = arith.add v102, v104 : u32 #[overflow = checked]; - v106 = hir.int_to_ptr v105 : ptr; - hir.store v106, v99; - v107 = arith.constant 8 : u32; - v108 = arith.add v102, v107 : u32 #[overflow = checked]; - v109 = hir.int_to_ptr v108 : ptr; - hir.store v109, v100; - v110 = arith.constant 12 : u32; - v111 = arith.add v102, v110 : u32 #[overflow = checked]; - v112 = hir.int_to_ptr v111 : ptr; - hir.store v112, v101; + private builtin.function @miden::protocol::active_account::get_procedure_root(v91: felt, v92: i32) { + ^block15(v91: felt, v92: i32): + v93, v94, v95, v96 = hir.exec @miden/protocol/active_account/get_procedure_root(v91) : felt, felt, felt, felt + v97 = hir.bitcast v92 : u32; + v98 = hir.int_to_ptr v97 : ptr; + hir.store v98, v93; + v99 = arith.constant 4 : u32; + v100 = arith.add v97, v99 : u32 #[overflow = checked]; + v101 = hir.int_to_ptr v100 : ptr; + hir.store v101, v94; + v102 = arith.constant 8 : u32; + v103 = arith.add v97, v102 : u32 #[overflow = checked]; + v104 = hir.int_to_ptr v103 : ptr; + hir.store v104, v95; + v105 = arith.constant 12 : u32; + v106 = arith.add v97, v105 : u32 #[overflow = checked]; + v107 = hir.int_to_ptr v106 : ptr; + hir.store v107, v96; builtin.ret ; }; @@ -172,34 +164,32 @@ builtin.component miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-acc }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block22: - v113 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() : i32 - v114 = arith.constant 0 : i32; - v115 = arith.add v113, v114 : i32 #[overflow = unchecked]; - v163 = arith.constant 0 : i32; - v164 = arith.constant 0 : i32; - v117 = arith.add v115, v164 : i32 #[overflow = unchecked]; - v119 = arith.add v117, v163 : i32 #[overflow = unchecked]; - v120 = hir.int_to_ptr v119 : ptr; - v121 = hir.load v120 : felt; - v162 = arith.constant 0 : i32; - v122 = arith.constant 4 : i32; - v123 = arith.add v115, v122 : i32 #[overflow = unchecked]; - v125 = arith.add v123, v162 : i32 #[overflow = unchecked]; - v126 = hir.int_to_ptr v125 : ptr; - v127 = hir.load v126 : felt; - v161 = arith.constant 0 : i32; - v128 = arith.constant 8 : i32; - v129 = arith.add v115, v128 : i32 #[overflow = unchecked]; - v131 = arith.add v129, v161 : i32 #[overflow = unchecked]; - v132 = hir.int_to_ptr v131 : ptr; - v133 = hir.load v132 : felt; - v160 = arith.constant 0 : i32; - v134 = arith.constant 12 : i32; - v135 = arith.add v115, v134 : i32 #[overflow = unchecked]; - v137 = arith.add v135, v160 : i32 #[overflow = unchecked]; - v138 = hir.int_to_ptr v137 : ptr; - v139 = hir.load v138 : felt; - builtin.ret v121, v127, v133, v139; + ^block20: + v108 = hir.exec @miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1/rust_sdk_account_get_procedure_root_binding/miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1#binding() : i32 + v156 = arith.constant 0 : i32; + v109 = arith.constant 0 : i32; + v110 = arith.add v108, v109 : i32 #[overflow = unchecked]; + v112 = arith.add v110, v156 : i32 #[overflow = unchecked]; + v113 = hir.int_to_ptr v112 : ptr; + v114 = hir.load v113 : felt; + v155 = arith.constant 0 : i32; + v115 = arith.constant 4 : i32; + v116 = arith.add v108, v115 : i32 #[overflow = unchecked]; + v118 = arith.add v116, v155 : i32 #[overflow = unchecked]; + v119 = hir.int_to_ptr v118 : ptr; + v120 = hir.load v119 : felt; + v154 = arith.constant 0 : i32; + v121 = arith.constant 8 : i32; + v122 = arith.add v108, v121 : i32 #[overflow = unchecked]; + v124 = arith.add v122, v154 : i32 #[overflow = unchecked]; + v125 = hir.int_to_ptr v124 : ptr; + v126 = hir.load v125 : felt; + v153 = arith.constant 0 : i32; + v127 = arith.constant 12 : i32; + v128 = arith.add v108, v127 : i32 #[overflow = unchecked]; + v130 = arith.add v128, v153 : i32 #[overflow = unchecked]; + v131 = hir.int_to_ptr v130 : ptr; + v132 = hir.load v131 : felt; + builtin.ret v114, v120, v126, v132; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm index 1f1660310..eff4b601c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -132,11 +130,9 @@ proc miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-proc trace.252 nop push.0 - trace.240 - nop - exec.::"miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1"::rust_sdk_account_get_procedure_root_binding::>::from - trace.252 - nop + push.0 + mul.4294967296 + add dup.1 swap.1 trace.240 @@ -371,14 +367,6 @@ proc wit_bindgen::rt::run_ctors_once( end end -@callconv("C") -proc >::from( - i32 -) -> felt - push.255 - u32and -end - @callconv("C") proc miden::protocol::active_account::get_procedure_root(felt, i32) trace.240 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat index 39c4bea14..cb018e35e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_procedure_root_binding.wat @@ -3,16 +3,15 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) (core module $main (;0;) (type (;0;) (func)) (type (;1;) (func (result i32))) - (type (;2;) (func (param i32) (result f32))) + (type (;2;) (func (param i64) (result f32))) (type (;3;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -31,8 +30,8 @@ local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 - call $>::from + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.get 0 call $miden::protocol::active_account::get_procedure_root global.get $GOT.data.internal.__memory_base @@ -78,11 +77,8 @@ i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32) (result f32) - local.get 0 - i32.const 255 - i32.and - f32.reinterpret_i32 + (func $intrinsics::felt::from_u64_unchecked (;4;) (type 2) (param i64) (result f32) + unreachable ) (func $miden::protocol::active_account::get_procedure_root (;5;) (type 3) (param f32 i32) unreachable @@ -101,15 +97,14 @@ (component $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-procedure-root-binding/rust-sdk-account-get-procedure-root-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir index ca4118d23..58e6079e4 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.hir @@ -36,59 +36,59 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account v20 = arith.constant 12 : u32; v19 = hir.bitcast v13 : u32; v21 = arith.add v19, v20 : u32 #[overflow = checked]; - v147 = arith.constant 4 : u32; - v23 = arith.mod v21, v147 : u32; + v145 = arith.constant 4 : u32; + v23 = arith.mod v21, v145 : u32; hir.assertz v23 #[code = 250]; v24 = hir.int_to_ptr v21 : ptr; hir.store v24, v18; - v146 = arith.constant 4 : u32; + v144 = arith.constant 4 : u32; v25 = hir.bitcast v6 : u32; - v27 = arith.add v25, v146 : u32 #[overflow = checked]; - v145 = arith.constant 4 : u32; - v29 = arith.mod v27, v145 : u32; + v27 = arith.add v25, v144 : u32 #[overflow = checked]; + v143 = arith.constant 4 : u32; + v29 = arith.mod v27, v143 : u32; hir.assertz v29 #[code = 250]; v30 = hir.int_to_ptr v27 : ptr; v31 = hir.load v30 : felt; v33 = arith.constant 8 : u32; v32 = hir.bitcast v13 : u32; v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v142 = arith.constant 4 : u32; + v36 = arith.mod v34, v142 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v31; - v143 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v38 = hir.bitcast v6 : u32; - v40 = arith.add v38, v143 : u32 #[overflow = checked]; - v142 = arith.constant 4 : u32; - v42 = arith.mod v40, v142 : u32; + v40 = arith.add v38, v141 : u32 #[overflow = checked]; + v140 = arith.constant 4 : u32; + v42 = arith.mod v40, v140 : u32; hir.assertz v42 #[code = 250]; v43 = hir.int_to_ptr v40 : ptr; v44 = hir.load v43 : felt; - v141 = arith.constant 4 : u32; + v139 = arith.constant 4 : u32; v45 = hir.bitcast v13 : u32; - v47 = arith.add v45, v141 : u32 #[overflow = checked]; - v140 = arith.constant 4 : u32; - v49 = arith.mod v47, v140 : u32; + v47 = arith.add v45, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v49 = arith.mod v47, v138 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; hir.store v50, v44; - v139 = arith.constant 12 : u32; + v137 = arith.constant 12 : u32; v51 = hir.bitcast v6 : u32; - v53 = arith.add v51, v139 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v55 = arith.mod v53, v138 : u32; + v53 = arith.add v51, v137 : u32 #[overflow = checked]; + v136 = arith.constant 4 : u32; + v55 = arith.mod v53, v136 : u32; hir.assertz v55 #[code = 250]; v56 = hir.int_to_ptr v53 : ptr; v57 = hir.load v56 : felt; v58 = hir.bitcast v13 : u32; - v137 = arith.constant 4 : u32; - v60 = arith.mod v58, v137 : u32; + v135 = arith.constant 4 : u32; + v60 = arith.mod v58, v135 : u32; hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; hir.store v61, v57; - v136 = arith.constant 16 : i32; - v63 = arith.add v6, v136 : i32 #[overflow = wrapping]; + v134 = arith.constant 16 : i32; + v63 = arith.add v6, v134 : i32 #[overflow = wrapping]; v64 = builtin.global_symbol @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__stack_pointer : ptr v65 = hir.bitcast v64 : ptr; hir.store v65, v63; @@ -118,12 +118,12 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account v80 = hir.bitcast v79 : ptr; v81 = hir.load v80 : i32; hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v83 = arith.add v81, v151 : i32 #[overflow = wrapping]; + v147 = arith.constant 1 : u8; + v149 = arith.constant 1048600 : i32; + v83 = arith.add v81, v149 : i32 #[overflow = wrapping]; v87 = hir.bitcast v83 : u32; v88 = hir.int_to_ptr v87 : ptr; - hir.store v88, v149; + hir.store v88, v147; scf.yield ; }; builtin.ret ; @@ -164,32 +164,30 @@ builtin.component miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account public builtin.function @binding() -> felt, felt, felt, felt { ^block20: v105 = hir.exec @miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1/rust_sdk_account_get_vault_root_binding/miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1#binding() : i32 + v153 = arith.constant 0 : i32; v106 = arith.constant 0 : i32; v107 = arith.add v105, v106 : i32 #[overflow = unchecked]; - v155 = arith.constant 0 : i32; - v156 = arith.constant 0 : i32; - v109 = arith.add v107, v156 : i32 #[overflow = unchecked]; - v111 = arith.add v109, v155 : i32 #[overflow = unchecked]; - v112 = hir.int_to_ptr v111 : ptr; - v113 = hir.load v112 : felt; - v154 = arith.constant 0 : i32; - v114 = arith.constant 4 : i32; - v115 = arith.add v107, v114 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v154 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v153 = arith.constant 0 : i32; - v120 = arith.constant 8 : i32; - v121 = arith.add v107, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v153 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; + v109 = arith.add v107, v153 : i32 #[overflow = unchecked]; + v110 = hir.int_to_ptr v109 : ptr; + v111 = hir.load v110 : felt; v152 = arith.constant 0 : i32; - v126 = arith.constant 12 : i32; - v127 = arith.add v107, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v152 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; - builtin.ret v113, v119, v125, v131; + v112 = arith.constant 4 : i32; + v113 = arith.add v105, v112 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v152 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v151 = arith.constant 0 : i32; + v118 = arith.constant 8 : i32; + v119 = arith.add v105, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v151 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v150 = arith.constant 0 : i32; + v124 = arith.constant 12 : i32; + v125 = arith.add v105, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v150 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + builtin.ret v111, v117, v123, v129; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm index 038e83bf5..10ee3a59a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat index cedfe56c6..a808dba52 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_get_vault_root_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -94,15 +93,14 @@ (component $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-get-vault-root-binding/rust-sdk-account-get-vault-root-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir index 86846f67f..3c7247968 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.hir @@ -21,169 +21,206 @@ builtin.component miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/wit_bindgen::rt::run_ctors_once() - v128 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v171, v172, v173, v174 = scf.while v1, v7, v128 : i32, i32, felt, i32 { - ^block35(v175: i32, v176: i32, v177: felt): - v192 = arith.constant 0 : i32; - v31 = arith.constant 16 : i32; - v15 = arith.eq v175, v31 : i1; + v197, v198, v199, v200 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block41(v201: i32, v202: i32, v203: felt): + v219 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v201, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v192 : i1; - v166 = scf.if v19 : i32 { - ^block34: - v137 = ub.poison i32 : i32; - scf.yield v137; + v19 = arith.neq v17, v219 : i1; + v192 = scf.if v19 : i32 { + ^block40: + v163 = ub.poison i32 : i32; + scf.yield v163; } else { ^block14: - v191 = arith.constant 16 : i32; - v22 = arith.add v176, v191 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v175 : i32 #[overflow = wrapping]; + v218 = arith.constant 16 : i32; + v22 = arith.add v202, v218 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v201 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; - v36 = arith.constant 4 : u32; - v27 = arith.mod v25, v36 : u32; + v41 = arith.constant 4 : u32; + v27 = arith.mod v25, v41 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v177; + hir.store v28, v203; v29 = arith.constant 4 : i32; - v30 = arith.add v175, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v201, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v138 = ub.poison felt : felt; - v168 = cf.select v19, v138, v177 : felt; - v190 = ub.poison i32 : i32; - v167 = cf.select v19, v190, v176 : i32; - v136 = arith.constant 1 : u32; - v130 = arith.constant 0 : u32; - v170 = cf.select v19, v130, v136 : u32; - v160 = arith.trunc v170 : i1; - scf.condition v160, v166, v167, v168, v176; + v164 = ub.poison felt : felt; + v194 = cf.select v19, v164, v203 : felt; + v217 = ub.poison i32 : i32; + v193 = cf.select v19, v217, v202 : i32; + v162 = arith.constant 1 : u32; + v156 = arith.constant 0 : u32; + v196 = cf.select v19, v156, v162 : u32; + v186 = arith.trunc v196 : i1; + scf.condition v186, v192, v193, v194, v202; } do { - ^block36(v178: i32, v179: i32, v180: felt, v181: i32): - scf.yield v178, v179, v180; + ^block42(v204: i32, v205: i32, v206: felt, v207: i32): + scf.yield v204, v205, v206; }; - v189 = arith.constant 16 : i32; - v32 = arith.add v174, v189 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::from(v174, v32) - v34 = arith.constant 12 : u32; - v33 = hir.bitcast v174 : u32; - v35 = arith.add v33, v34 : u32 #[overflow = checked]; - v188 = arith.constant 4 : u32; - v37 = arith.mod v35, v188 : u32; - hir.assertz v37 #[code = 250]; - v38 = hir.int_to_ptr v35 : ptr; - v39 = hir.load v38 : felt; - v41 = arith.constant 8 : u32; - v40 = hir.bitcast v174 : u32; - v42 = arith.add v40, v41 : u32 #[overflow = checked]; - v187 = arith.constant 4 : u32; - v44 = arith.mod v42, v187 : u32; - hir.assertz v44 #[code = 250]; - v45 = hir.int_to_ptr v42 : ptr; - v46 = hir.load v45 : felt; - v186 = arith.constant 4 : u32; - v47 = hir.bitcast v174 : u32; - v49 = arith.add v47, v186 : u32 #[overflow = checked]; - v185 = arith.constant 4 : u32; - v51 = arith.mod v49, v185 : u32; - hir.assertz v51 #[code = 250]; - v52 = hir.int_to_ptr v49 : ptr; - v53 = hir.load v52 : felt; - v54 = hir.bitcast v174 : u32; - v184 = arith.constant 4 : u32; - v56 = arith.mod v54, v184 : u32; + v31 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v216 = arith.constant 16 : i32; + v35 = arith.add v200, v216 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::from(v200, v35) + v37 = arith.constant 1048596 : i32; + v38 = arith.add v33, v37 : i32 #[overflow = wrapping]; + v36 = arith.constant 3 : i32; + v39 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::index(v200, v36, v38) : i32 + v40 = hir.bitcast v39 : u32; + v215 = arith.constant 4 : u32; + v42 = arith.mod v40, v215 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v45 = arith.constant 2 : i32; + v46 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::index(v200, v45, v38) : i32 + v47 = hir.bitcast v46 : u32; + v214 = arith.constant 4 : u32; + v49 = arith.mod v47, v214 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + v51 = hir.load v50 : felt; + v52 = arith.constant 1 : i32; + v53 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::index(v200, v52, v38) : i32 + v54 = hir.bitcast v53 : u32; + v213 = arith.constant 4 : u32; + v56 = arith.mod v54, v213 : u32; hir.assertz v56 #[code = 250]; v57 = hir.int_to_ptr v54 : ptr; v58 = hir.load v57 : felt; - v59 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden::protocol::active_account::has_non_fungible_asset(v39, v46, v53, v58) : felt - v183 = arith.constant 32 : i32; - v70 = arith.add v174, v183 : i32 #[overflow = wrapping]; - v71 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr - v72 = hir.bitcast v71 : ptr; - hir.store v72, v70; - v64 = arith.constant 1 : i32; - v182 = arith.constant 0 : felt; - v62 = arith.eq v59, v182 : i1; - v63 = hir.cast v62 : i32; - v65 = arith.neq v63, v64 : i1; - v66 = arith.zext v65 : u32; - v67 = hir.bitcast v66 : i32; - v68 = hir.bitcast v67 : felt; - builtin.ret v68; + v212 = arith.constant 0 : i32; + v60 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::index(v200, v212, v38) : i32 + v61 = hir.bitcast v60 : u32; + v211 = arith.constant 4 : u32; + v63 = arith.mod v61, v211 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden::protocol::active_account::has_non_fungible_asset(v44, v51, v58, v65) : felt + v210 = arith.constant 32 : i32; + v80 = arith.add v200, v210 : i32 #[overflow = wrapping]; + v81 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__stack_pointer : ptr + v82 = hir.bitcast v81 : ptr; + hir.store v82, v80; + v208 = arith.constant 1 : i32; + v209 = arith.constant 0 : i64; + v68 = arith.trunc v209 : felt; + v69 = arith.eq v66, v68 : i1; + v70 = hir.cast v69 : i32; + v72 = arith.neq v70, v208 : i1; + v73 = arith.zext v72 : u32; + v74 = hir.bitcast v73 : i32; + v75 = hir.bitcast v74 : u32; + v76 = arith.zext v75 : u64; + v77 = hir.bitcast v76 : i64; + v78 = arith.trunc v77 : felt; + builtin.ret v78; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v74 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v75 = hir.bitcast v74 : ptr; - v76 = hir.load v75 : i32; - v77 = arith.constant 1048584 : i32; - v78 = arith.add v76, v77 : i32 #[overflow = wrapping]; - v79 = hir.bitcast v78 : u32; - v80 = hir.int_to_ptr v79 : ptr; - v81 = hir.load v80 : u8; - v73 = arith.constant 0 : i32; - v82 = arith.zext v81 : u32; - v83 = hir.bitcast v82 : i32; - v85 = arith.neq v83, v73 : i1; - scf.if v85{ + v84 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v85 = hir.bitcast v84 : ptr; + v86 = hir.load v85 : i32; + v87 = arith.constant 1048612 : i32; + v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v88 : u32; + v90 = hir.int_to_ptr v89 : ptr; + v91 = hir.load v90 : u8; + v83 = arith.constant 0 : i32; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + v95 = arith.neq v93, v83 : i1; + scf.if v95{ ^block17: scf.yield ; } else { ^block18: - v86 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr - v87 = hir.bitcast v86 : ptr; - v88 = hir.load v87 : i32; + v96 = builtin.global_symbol @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/GOT.data.internal.__memory_base : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/__wasm_call_ctors() - v194 = arith.constant 1 : u8; - v196 = arith.constant 1048584 : i32; - v90 = arith.add v88, v196 : i32 #[overflow = wrapping]; - v94 = hir.bitcast v90 : u32; - v95 = hir.int_to_ptr v94 : ptr; - hir.store v95, v194; + v221 = arith.constant 1 : u8; + v223 = arith.constant 1048612 : i32; + v100 = arith.add v98, v223 : i32 #[overflow = wrapping]; + v104 = hir.bitcast v100 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v221; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v96: i32, v97: i32) { - ^block19(v96: i32, v97: i32): - v99 = arith.constant 8 : u32; - v98 = hir.bitcast v97 : u32; - v100 = arith.add v98, v99 : u32 #[overflow = checked]; - v101 = arith.constant 4 : u32; - v102 = arith.mod v100, v101 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i64; - v200 = arith.constant 8 : u32; - v105 = hir.bitcast v96 : u32; - v107 = arith.add v105, v200 : u32 #[overflow = checked]; - v199 = arith.constant 8 : u32; - v109 = arith.mod v107, v199 : u32; - hir.assertz v109 #[code = 250]; - v110 = hir.int_to_ptr v107 : ptr; - hir.store v110, v104; - v111 = hir.bitcast v97 : u32; - v198 = arith.constant 4 : u32; - v113 = arith.mod v111, v198 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : i64; - v116 = hir.bitcast v96 : u32; - v197 = arith.constant 8 : u32; - v118 = arith.mod v116, v197 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - hir.store v119, v115; + private builtin.function @>::from(v106: i32, v107: i32) { + ^block19(v106: i32, v107: i32): + hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/>::from(v106, v107) builtin.ret ; }; - private builtin.function @miden::protocol::active_account::has_non_fungible_asset(v120: felt, v121: felt, v122: felt, v123: felt) -> felt { - ^block21(v120: felt, v121: felt, v122: felt, v123: felt): - v124 = hir.exec @miden/protocol/active_account/has_non_fungible_asset(v120, v121, v122, v123) : felt - builtin.ret v124; + private builtin.function @>::index(v108: i32, v109: i32, v110: i32) -> i32 { + ^block21(v108: i32, v109: i32, v110: i32): + v118 = arith.constant 0 : i32; + v225 = arith.constant 3 : u32; + v113 = hir.bitcast v109 : u32; + v115 = arith.gt v113, v225 : i1; + v116 = arith.zext v115 : u32; + v117 = hir.bitcast v116 : i32; + v119 = arith.neq v117, v118 : i1; + cf.cond_br v119 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v224 = arith.constant 2 : u32; + v122 = arith.shl v109, v224 : i32; + v123 = arith.add v108, v122 : i32 #[overflow = wrapping]; + builtin.ret v123; + }; + + private builtin.function @>::from(v124: i32, v125: i32) { + ^block25(v124: i32, v125: i32): + v127 = arith.constant 8 : u32; + v126 = hir.bitcast v125 : u32; + v128 = arith.add v126, v127 : u32 #[overflow = checked]; + v129 = arith.constant 4 : u32; + v130 = arith.mod v128, v129 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + v132 = hir.load v131 : i64; + v231 = arith.constant 8 : u32; + v133 = hir.bitcast v124 : u32; + v135 = arith.add v133, v231 : u32 #[overflow = checked]; + v230 = arith.constant 8 : u32; + v137 = arith.mod v135, v230 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + hir.store v138, v132; + v139 = hir.bitcast v125 : u32; + v229 = arith.constant 4 : u32; + v141 = arith.mod v139, v229 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : i64; + v144 = hir.bitcast v124 : u32; + v228 = arith.constant 8 : u32; + v146 = arith.mod v144, v228 : u32; + hir.assertz v146 #[code = 250]; + v147 = hir.int_to_ptr v144 : ptr; + hir.store v147, v143; + builtin.ret ; + }; + + private builtin.function @miden::protocol::active_account::has_non_fungible_asset(v148: felt, v149: felt, v150: felt, v151: felt) -> felt { + ^block27(v148: felt, v149: felt, v150: felt, v151: felt): + v152 = hir.exec @miden/protocol/active_account/has_non_fungible_asset(v148, v149, v150, v151) : felt + builtin.ret v152; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -194,12 +231,14 @@ builtin.component miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block26: - v126 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() : felt - builtin.ret v126; + ^block32: + v154 = hir.exec @miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1/rust_sdk_account_has_non_fungible_asset_binding/miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding() : felt + builtin.ret v154; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm index f99bdcbd9..7975214e2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,6 +81,9 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -151,19 +154,35 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- drop drop drop + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop push.16 - dup.1 + dup.2 u32wrapping_add - dup.1 + dup.2 trace.240 nop - exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::from + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::from + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.2 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::index trace.252 nop - push.12 - dup.1 - add - u32assert push.4 dup.1 swap.1 @@ -177,10 +196,16 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert + push.2 + dup.3 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -194,10 +219,16 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 - add - u32assert + push.1 + dup.4 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -211,7 +242,16 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + push.0 + dup.5 + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -226,7 +266,7 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- trace.252 nop movdn.3 - swap.2 + swap.1 trace.240 nop exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::"miden::protocol::active_account::has_non_fungible_asset" @@ -235,7 +275,7 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -245,16 +285,22 @@ proc miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has- nop push.1 push.0 + push.0 + mul.4294967296 + add movup.2 eq neq + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -262,7 +308,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -283,7 +329,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -297,7 +343,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -325,7 +371,47 @@ proc wit_bindgen::rt::run_ctors_once( end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:rust-sdk-account-has-non-fungible-asset-binding/rust-sdk-account-has-non-fungible-asset-binding@0.0.1"::rust_sdk_account_has_non_fungible_asset_binding::>::from + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat index f963c5cdc..4a96486da 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_non_fungible_asset_binding.wat @@ -11,8 +11,9 @@ (type (;1;) (func (result f32))) (type (;2;) (func (param i32 i32))) (type (;3;) (func (param f32 f32) (result i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32) (result f32))) + (type (;4;) (func (param i64) (result f32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;6;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -32,8 +33,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -55,26 +56,44 @@ br 0 (;@2;) end end + global.get $GOT.data.internal.__memory_base + local.set 1 local.get 0 local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 - f32.load offset=12 + i32.const 3 + local.get 1 + i32.const 1048596 + i32.add + local.tee 1 + call $>::index + f32.load local.get 0 - f32.load offset=8 + i32.const 2 + local.get 1 + call $>::index + f32.load local.get 0 - f32.load offset=4 + i32.const 1 + local.get 1 + call $>::index + f32.load local.get 0 + i32.const 0 + local.get 1 + call $>::index f32.load call $miden::protocol::active_account::has_non_fungible_asset - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::eq i32.const 1 i32.ne - call $intrinsics::felt::from_u32 + i64.extend_i32_u + call $intrinsics::felt::from_u64_unchecked local.set 2 local.get 0 i32.const 32 @@ -86,7 +105,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -94,13 +113,39 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;4;) (type 2) (param i32 i32) + (func $>::from (;4;) (type 2) (param i32 i32) + local.get 0 + local.get 1 + call $>::from + ) + (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) + unreachable + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) + unreachable + ) + (func $>::index (;7;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;8;) (type 2) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -110,16 +155,11 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::eq (;5;) (type 3) (param f32 f32) (result i32) - unreachable - ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) - unreachable - ) - (func $miden::protocol::active_account::has_non_fungible_asset (;7;) (type 5) (param f32 f32 f32 f32) (result f32) + (func $miden::protocol::active_account::has_non_fungible_asset (;9;) (type 6) (param f32 f32 f32 f32) (result f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "_rust_sdk_account_has_non_fungible_asset_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir index e5fdb7000..8d18c4908 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.hir @@ -15,137 +15,206 @@ builtin.component miden:rust-sdk-account-has-procedure-binding/rust-sdk-account- v3 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 16 : i32; + v6 = arith.constant 32 : i32; v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; v8 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/wit_bindgen::rt::run_ctors_once() - v100 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v143, v144, v145, v146 = scf.while v1, v7, v100 : i32, i32, felt, i32 { - ^block33(v147: i32, v148: i32, v149: felt): - v162 = arith.constant 0 : i32; - v163 = arith.constant 16 : i32; - v15 = arith.eq v147, v163 : i1; + v195, v196, v197, v198 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block39(v199: i32, v200: i32, v201: felt): + v217 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v199, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v162 : i1; - v138 = scf.if v19 : i32 { - ^block32: - v109 = ub.poison i32 : i32; - scf.yield v109; + v19 = arith.neq v17, v217 : i1; + v190 = scf.if v19 : i32 { + ^block38: + v161 = ub.poison i32 : i32; + scf.yield v161; } else { ^block14: - v21 = arith.add v148, v147 : i32 #[overflow = wrapping]; - v23 = hir.bitcast v21 : u32; - v32 = arith.constant 4 : u32; - v25 = arith.mod v23, v32 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v149; - v27 = arith.constant 4 : i32; - v28 = arith.add v147, v27 : i32 #[overflow = wrapping]; - scf.yield v28; + v216 = arith.constant 16 : i32; + v22 = arith.add v200, v216 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v199 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v41 = arith.constant 4 : u32; + v27 = arith.mod v25, v41 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v201; + v29 = arith.constant 4 : i32; + v30 = arith.add v199, v29 : i32 #[overflow = wrapping]; + scf.yield v30; }; - v110 = ub.poison felt : felt; - v140 = cf.select v19, v110, v149 : felt; - v161 = ub.poison i32 : i32; - v139 = cf.select v19, v161, v148 : i32; - v108 = arith.constant 1 : u32; - v102 = arith.constant 0 : u32; - v142 = cf.select v19, v102, v108 : u32; - v132 = arith.trunc v142 : i1; - scf.condition v132, v138, v139, v140, v148; + v162 = ub.poison felt : felt; + v192 = cf.select v19, v162, v201 : felt; + v215 = ub.poison i32 : i32; + v191 = cf.select v19, v215, v200 : i32; + v160 = arith.constant 1 : u32; + v154 = arith.constant 0 : u32; + v194 = cf.select v19, v154, v160 : u32; + v184 = arith.trunc v194 : i1; + scf.condition v184, v190, v191, v192, v200; } do { - ^block34(v150: i32, v151: i32, v152: felt, v153: i32): - scf.yield v150, v151, v152; + ^block40(v202: i32, v203: i32, v204: felt, v205: i32): + scf.yield v202, v203, v204; }; - v30 = arith.constant 12 : u32; - v29 = hir.bitcast v146 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v160 = arith.constant 4 : u32; - v33 = arith.mod v31, v160 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v37 = arith.constant 8 : u32; - v36 = hir.bitcast v146 : u32; - v38 = arith.add v36, v37 : u32 #[overflow = checked]; - v159 = arith.constant 4 : u32; - v40 = arith.mod v38, v159 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - v42 = hir.load v41 : felt; - v158 = arith.constant 4 : u32; - v43 = hir.bitcast v146 : u32; - v45 = arith.add v43, v158 : u32 #[overflow = checked]; - v157 = arith.constant 4 : u32; - v47 = arith.mod v45, v157 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v50 = hir.bitcast v146 : u32; - v156 = arith.constant 4 : u32; - v52 = arith.mod v50, v156 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : felt; - v55 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden::protocol::active_account::has_procedure(v35, v42, v49, v54) : felt - v155 = arith.constant 16 : i32; - v66 = arith.add v146, v155 : i32 #[overflow = wrapping]; - v67 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr - v68 = hir.bitcast v67 : ptr; - hir.store v68, v66; - v60 = arith.constant 1 : i32; - v154 = arith.constant 0 : felt; - v58 = arith.eq v55, v154 : i1; - v59 = hir.cast v58 : i32; - v61 = arith.neq v59, v60 : i1; - v62 = arith.zext v61 : u32; - v63 = hir.bitcast v62 : i32; - v64 = hir.bitcast v63 : felt; - builtin.ret v64; + v31 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v214 = arith.constant 16 : i32; + v35 = arith.add v198, v214 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/>::from(v198, v35) + v37 = arith.constant 1048596 : i32; + v38 = arith.add v33, v37 : i32 #[overflow = wrapping]; + v36 = arith.constant 3 : i32; + v39 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/>::index(v198, v36, v38) : i32 + v40 = hir.bitcast v39 : u32; + v213 = arith.constant 4 : u32; + v42 = arith.mod v40, v213 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v45 = arith.constant 2 : i32; + v46 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/>::index(v198, v45, v38) : i32 + v47 = hir.bitcast v46 : u32; + v212 = arith.constant 4 : u32; + v49 = arith.mod v47, v212 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + v51 = hir.load v50 : felt; + v52 = arith.constant 1 : i32; + v53 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/>::index(v198, v52, v38) : i32 + v54 = hir.bitcast v53 : u32; + v211 = arith.constant 4 : u32; + v56 = arith.mod v54, v211 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v210 = arith.constant 0 : i32; + v60 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/>::index(v198, v210, v38) : i32 + v61 = hir.bitcast v60 : u32; + v209 = arith.constant 4 : u32; + v63 = arith.mod v61, v209 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden::protocol::active_account::has_procedure(v44, v51, v58, v65) : felt + v208 = arith.constant 32 : i32; + v80 = arith.add v198, v208 : i32 #[overflow = wrapping]; + v81 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__stack_pointer : ptr + v82 = hir.bitcast v81 : ptr; + hir.store v82, v80; + v206 = arith.constant 1 : i32; + v207 = arith.constant 0 : i64; + v68 = arith.trunc v207 : felt; + v69 = arith.eq v66, v68 : i1; + v70 = hir.cast v69 : i32; + v72 = arith.neq v70, v206 : i1; + v73 = arith.zext v72 : u32; + v74 = hir.bitcast v73 : i32; + v75 = hir.bitcast v74 : u32; + v76 = arith.zext v75 : u64; + v77 = hir.bitcast v76 : i64; + v78 = arith.trunc v77 : felt; + builtin.ret v78; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v70 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr - v71 = hir.bitcast v70 : ptr; - v72 = hir.load v71 : i32; - v73 = arith.constant 1048584 : i32; - v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; - v75 = hir.bitcast v74 : u32; - v76 = hir.int_to_ptr v75 : ptr; - v77 = hir.load v76 : u8; - v69 = arith.constant 0 : i32; - v78 = arith.zext v77 : u32; - v79 = hir.bitcast v78 : i32; - v81 = arith.neq v79, v69 : i1; - scf.if v81{ + v84 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v85 = hir.bitcast v84 : ptr; + v86 = hir.load v85 : i32; + v87 = arith.constant 1048612 : i32; + v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v88 : u32; + v90 = hir.int_to_ptr v89 : ptr; + v91 = hir.load v90 : u8; + v83 = arith.constant 0 : i32; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + v95 = arith.neq v93, v83 : i1; + scf.if v95{ ^block17: scf.yield ; } else { ^block18: - v82 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; + v96 = builtin.global_symbol @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/GOT.data.internal.__memory_base : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/__wasm_call_ctors() - v165 = arith.constant 1 : u8; - v167 = arith.constant 1048584 : i32; - v86 = arith.add v84, v167 : i32 #[overflow = wrapping]; - v90 = hir.bitcast v86 : u32; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v165; + v219 = arith.constant 1 : u8; + v221 = arith.constant 1048612 : i32; + v100 = arith.add v98, v221 : i32 #[overflow = wrapping]; + v104 = hir.bitcast v100 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v219; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden::protocol::active_account::has_procedure(v92: felt, v93: felt, v94: felt, v95: felt) -> felt { - ^block19(v92: felt, v93: felt, v94: felt, v95: felt): - v96 = hir.exec @miden/protocol/active_account/has_procedure(v92, v93, v94, v95) : felt - builtin.ret v96; + private builtin.function @>::index(v106: i32, v107: i32, v108: i32) -> i32 { + ^block19(v106: i32, v107: i32, v108: i32): + v116 = arith.constant 0 : i32; + v223 = arith.constant 3 : u32; + v111 = hir.bitcast v107 : u32; + v113 = arith.gt v111, v223 : i1; + v114 = arith.zext v113 : u32; + v115 = hir.bitcast v114 : i32; + v117 = arith.neq v115, v116 : i1; + cf.cond_br v117 ^block21, ^block22; + ^block21: + ub.unreachable ; + ^block22: + v222 = arith.constant 2 : u32; + v120 = arith.shl v107, v222 : i32; + v121 = arith.add v106, v120 : i32 #[overflow = wrapping]; + builtin.ret v121; + }; + + private builtin.function @>::from(v122: i32, v123: i32) { + ^block23(v122: i32, v123: i32): + v125 = arith.constant 8 : u32; + v124 = hir.bitcast v123 : u32; + v126 = arith.add v124, v125 : u32 #[overflow = checked]; + v127 = arith.constant 4 : u32; + v128 = arith.mod v126, v127 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : i64; + v229 = arith.constant 8 : u32; + v131 = hir.bitcast v122 : u32; + v133 = arith.add v131, v229 : u32 #[overflow = checked]; + v228 = arith.constant 8 : u32; + v135 = arith.mod v133, v228 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v130; + v137 = hir.bitcast v123 : u32; + v227 = arith.constant 4 : u32; + v139 = arith.mod v137, v227 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : i64; + v142 = hir.bitcast v122 : u32; + v226 = arith.constant 8 : u32; + v144 = arith.mod v142, v226 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + hir.store v145, v141; + builtin.ret ; + }; + + private builtin.function @miden::protocol::active_account::has_procedure(v146: felt, v147: felt, v148: felt, v149: felt) -> felt { + ^block25(v146: felt, v147: felt, v148: felt, v149: felt): + v150 = hir.exec @miden/protocol/active_account/has_procedure(v146, v147, v148, v149) : felt + builtin.ret v150; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -156,12 +225,14 @@ builtin.component miden:rust-sdk-account-has-procedure-binding/rust-sdk-account- builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block24: - v98 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() : felt - builtin.ret v98; + ^block30: + v152 = hir.exec @miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1/rust_sdk_account_has_procedure_binding/miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding() : felt + builtin.ret v152; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm index af234856a..76a014774 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -62,9 +62,9 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,6 +81,9 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -96,7 +99,9 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure drop push.3735929054 else - dup.2 + push.16 + dup.3 + u32wrapping_add dup.2 u32wrapping_add push.4 @@ -149,10 +154,35 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure drop drop drop - push.12 - dup.1 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::>::from + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.2 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -166,10 +196,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert + push.2 + dup.3 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -183,10 +219,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 - add - u32assert + push.1 + dup.4 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -200,7 +242,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + push.0 + dup.5 + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -215,16 +266,16 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure trace.252 nop movdn.3 - swap.2 + swap.1 trace.240 nop exec.::"miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1"::rust_sdk_account_has_procedure_binding::"miden::protocol::active_account::has_procedure" trace.252 nop - push.16 + push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -234,16 +285,22 @@ proc miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure nop push.1 push.0 + push.0 + mul.4294967296 + add movup.2 eq neq + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -251,7 +308,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -272,7 +329,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -286,7 +343,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -313,6 +370,109 @@ proc wit_bindgen::rt::run_ctors_once( end end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + @callconv("C") proc miden::protocol::active_account::has_procedure( felt, diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat index 5d571d418..9055e6055 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_has_procedure_binding.wat @@ -10,8 +10,10 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param f32 f32) (result i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32) (result f32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -24,15 +26,15 @@ (func $miden:rust-sdk-account-has-procedure-binding/rust-sdk-account-has-procedure-binding@0.0.1#binding (;2;) (type 1) (result f32) (local i32 i32 f32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -41,6 +43,8 @@ i32.eq br_if 1 (;@1;) local.get 0 + i32.const 16 + i32.add local.get 1 i32.add local.get 2 @@ -52,24 +56,47 @@ br 0 (;@2;) end end + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 local.get 0 - f32.load offset=12 + i32.const 16 + i32.add + call $>::from local.get 0 - f32.load offset=8 + i32.const 3 + local.get 1 + i32.const 1048596 + i32.add + local.tee 1 + call $>::index + f32.load local.get 0 - f32.load offset=4 + i32.const 2 + local.get 1 + call $>::index + f32.load local.get 0 + i32.const 1 + local.get 1 + call $>::index f32.load - call $miden::protocol::active_account::has_procedure + local.get 0 i32.const 0 - call $intrinsics::felt::from_u32 + local.get 1 + call $>::index + f32.load + call $miden::protocol::active_account::has_procedure + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::eq i32.const 1 i32.ne - call $intrinsics::felt::from_u32 + i64.extend_i32_u + call $intrinsics::felt::from_u64_unchecked local.set 2 local.get 0 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer local.get 2 @@ -78,7 +105,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -86,7 +113,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 @@ -95,13 +122,39 @@ (func $intrinsics::felt::eq (;4;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) - (func $miden::protocol::active_account::has_procedure (;6;) (type 4) (param f32 f32 f32 f32) (result f32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::active_account::has_procedure (;8;) (type 6) (param f32 f32 f32 f32) (result f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "Mrust_sdk_account_has_procedure_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir index 3630a0d8f..0bd8a4b8a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.hir @@ -15,16 +15,16 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s v7 = arith.constant 4 : u32; v6 = hir.bitcast v0 : u32; v8 = arith.add v6, v7 : u32 #[overflow = checked]; - v173 = arith.constant 4 : u32; - v10 = arith.mod v8, v173 : u32; + v171 = arith.constant 4 : u32; + v10 = arith.mod v8, v171 : u32; hir.assertz v10 #[code = 250]; v4 = arith.constant -5367624396274338764 : i64; v5 = arith.trunc v4 : felt; v11 = hir.int_to_ptr v8 : ptr; hir.store v11, v5; v12 = hir.bitcast v0 : u32; - v172 = arith.constant 4 : u32; - v14 = arith.mod v12, v172 : u32; + v170 = arith.constant 4 : u32; + v14 = arith.mod v12, v170 : u32; hir.assertz v14 #[code = 250]; v2 = arith.constant -4543582349731832257 : i64; v3 = arith.trunc v2 : felt; @@ -51,14 +51,14 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s v28 = arith.constant 4 : u32; v27 = hir.bitcast v22 : u32; v29 = arith.add v27, v28 : u32 #[overflow = checked]; - v185 = arith.constant 4 : u32; - v31 = arith.mod v29, v185 : u32; + v183 = arith.constant 4 : u32; + v31 = arith.mod v29, v183 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : felt; v34 = hir.bitcast v22 : u32; - v184 = arith.constant 4 : u32; - v36 = arith.mod v34, v184 : u32; + v182 = arith.constant 4 : u32; + v36 = arith.mod v34, v182 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; v38 = hir.load v37 : felt; @@ -73,67 +73,67 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s v47 = arith.constant 16 : u32; v46 = hir.bitcast v22 : u32; v48 = arith.add v46, v47 : u32 #[overflow = checked]; - v183 = arith.constant 4 : u32; - v50 = arith.mod v48, v183 : u32; + v181 = arith.constant 4 : u32; + v50 = arith.mod v48, v181 : u32; hir.assertz v50 #[code = 250]; v51 = hir.int_to_ptr v48 : ptr; v52 = hir.load v51 : felt; v54 = arith.constant 12 : u32; v53 = hir.bitcast v45 : u32; v55 = arith.add v53, v54 : u32 #[overflow = checked]; - v182 = arith.constant 4 : u32; - v57 = arith.mod v55, v182 : u32; + v180 = arith.constant 4 : u32; + v57 = arith.mod v55, v180 : u32; hir.assertz v57 #[code = 250]; v58 = hir.int_to_ptr v55 : ptr; hir.store v58, v52; v60 = arith.constant 20 : u32; v59 = hir.bitcast v22 : u32; v61 = arith.add v59, v60 : u32 #[overflow = checked]; - v181 = arith.constant 4 : u32; - v63 = arith.mod v61, v181 : u32; + v179 = arith.constant 4 : u32; + v63 = arith.mod v61, v179 : u32; hir.assertz v63 #[code = 250]; v64 = hir.int_to_ptr v61 : ptr; v65 = hir.load v64 : felt; v67 = arith.constant 8 : u32; v66 = hir.bitcast v45 : u32; v68 = arith.add v66, v67 : u32 #[overflow = checked]; - v180 = arith.constant 4 : u32; - v70 = arith.mod v68, v180 : u32; + v178 = arith.constant 4 : u32; + v70 = arith.mod v68, v178 : u32; hir.assertz v70 #[code = 250]; v71 = hir.int_to_ptr v68 : ptr; hir.store v71, v65; v73 = arith.constant 24 : u32; v72 = hir.bitcast v22 : u32; v74 = arith.add v72, v73 : u32 #[overflow = checked]; - v179 = arith.constant 4 : u32; - v76 = arith.mod v74, v179 : u32; + v177 = arith.constant 4 : u32; + v76 = arith.mod v74, v177 : u32; hir.assertz v76 #[code = 250]; v77 = hir.int_to_ptr v74 : ptr; v78 = hir.load v77 : felt; - v178 = arith.constant 4 : u32; + v176 = arith.constant 4 : u32; v79 = hir.bitcast v45 : u32; - v81 = arith.add v79, v178 : u32 #[overflow = checked]; - v177 = arith.constant 4 : u32; - v83 = arith.mod v81, v177 : u32; + v81 = arith.add v79, v176 : u32 #[overflow = checked]; + v175 = arith.constant 4 : u32; + v83 = arith.mod v81, v175 : u32; hir.assertz v83 #[code = 250]; v84 = hir.int_to_ptr v81 : ptr; hir.store v84, v78; v86 = arith.constant 28 : u32; v85 = hir.bitcast v22 : u32; v87 = arith.add v85, v86 : u32 #[overflow = checked]; - v176 = arith.constant 4 : u32; - v89 = arith.mod v87, v176 : u32; + v174 = arith.constant 4 : u32; + v89 = arith.mod v87, v174 : u32; hir.assertz v89 #[code = 250]; v90 = hir.int_to_ptr v87 : ptr; v91 = hir.load v90 : felt; v92 = hir.bitcast v45 : u32; - v175 = arith.constant 4 : u32; - v94 = arith.mod v92, v175 : u32; + v173 = arith.constant 4 : u32; + v94 = arith.mod v92, v173 : u32; hir.assertz v94 #[code = 250]; v95 = hir.int_to_ptr v92 : ptr; hir.store v95, v91; - v174 = arith.constant 32 : i32; - v97 = arith.add v22, v174 : i32 #[overflow = wrapping]; + v172 = arith.constant 32 : i32; + v97 = arith.add v22, v172 : i32 #[overflow = wrapping]; v98 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__stack_pointer : ptr v99 = hir.bitcast v98 : ptr; hir.store v99, v97; @@ -163,12 +163,12 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s v114 = hir.bitcast v113 : ptr; v115 = hir.load v114 : i32; hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/__wasm_call_ctors() - v187 = arith.constant 1 : u8; - v189 = arith.constant 1048600 : i32; - v117 = arith.add v115, v189 : i32 #[overflow = wrapping]; + v185 = arith.constant 1 : u8; + v187 = arith.constant 1048600 : i32; + v117 = arith.add v115, v187 : i32 #[overflow = wrapping]; v121 = hir.bitcast v117 : u32; v122 = hir.int_to_ptr v121 : ptr; - hir.store v122, v187; + hir.store v122, v185; scf.yield ; }; builtin.ret ; @@ -209,32 +209,30 @@ builtin.component miden:rust-sdk-account-storage-get-initial-item-binding/rust-s public builtin.function @binding() -> felt, felt, felt, felt { ^block22: v141 = hir.exec @miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1/rust_sdk_account_storage_get_initial_item_binding/miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1#binding() : i32 + v191 = arith.constant 0 : i32; v142 = arith.constant 0 : i32; v143 = arith.add v141, v142 : i32 #[overflow = unchecked]; - v193 = arith.constant 0 : i32; - v194 = arith.constant 0 : i32; - v145 = arith.add v143, v194 : i32 #[overflow = unchecked]; - v147 = arith.add v145, v193 : i32 #[overflow = unchecked]; - v148 = hir.int_to_ptr v147 : ptr; - v149 = hir.load v148 : felt; - v192 = arith.constant 0 : i32; - v150 = arith.constant 4 : i32; - v151 = arith.add v143, v150 : i32 #[overflow = unchecked]; - v153 = arith.add v151, v192 : i32 #[overflow = unchecked]; - v154 = hir.int_to_ptr v153 : ptr; - v155 = hir.load v154 : felt; - v191 = arith.constant 0 : i32; - v156 = arith.constant 8 : i32; - v157 = arith.add v143, v156 : i32 #[overflow = unchecked]; - v159 = arith.add v157, v191 : i32 #[overflow = unchecked]; - v160 = hir.int_to_ptr v159 : ptr; - v161 = hir.load v160 : felt; + v145 = arith.add v143, v191 : i32 #[overflow = unchecked]; + v146 = hir.int_to_ptr v145 : ptr; + v147 = hir.load v146 : felt; v190 = arith.constant 0 : i32; - v162 = arith.constant 12 : i32; - v163 = arith.add v143, v162 : i32 #[overflow = unchecked]; - v165 = arith.add v163, v190 : i32 #[overflow = unchecked]; - v166 = hir.int_to_ptr v165 : ptr; - v167 = hir.load v166 : felt; - builtin.ret v149, v155, v161, v167; + v148 = arith.constant 4 : i32; + v149 = arith.add v141, v148 : i32 #[overflow = unchecked]; + v151 = arith.add v149, v190 : i32 #[overflow = unchecked]; + v152 = hir.int_to_ptr v151 : ptr; + v153 = hir.load v152 : felt; + v189 = arith.constant 0 : i32; + v154 = arith.constant 8 : i32; + v155 = arith.add v141, v154 : i32 #[overflow = unchecked]; + v157 = arith.add v155, v189 : i32 #[overflow = unchecked]; + v158 = hir.int_to_ptr v157 : ptr; + v159 = hir.load v158 : felt; + v188 = arith.constant 0 : i32; + v160 = arith.constant 12 : i32; + v161 = arith.add v141, v160 : i32 #[overflow = unchecked]; + v163 = arith.add v161, v188 : i32 #[overflow = unchecked]; + v164 = hir.int_to_ptr v163 : ptr; + v165 = hir.load v164 : felt; + builtin.ret v147, v153, v159, v165; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm index 157373e4b..0ccd6a38a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat index a9a195171..3e22806ce 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_item_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -122,15 +121,14 @@ (component $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-storage-get-initial-item-binding/rust-sdk-account-storage-get-initial-item-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir index 69bd5e30c..e3abf1c98 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.hir @@ -15,16 +15,16 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru v7 = arith.constant 4 : u32; v6 = hir.bitcast v0 : u32; v8 = arith.add v6, v7 : u32 #[overflow = checked]; - v227 = arith.constant 4 : u32; - v10 = arith.mod v8, v227 : u32; + v280 = arith.constant 4 : u32; + v10 = arith.mod v8, v280 : u32; hir.assertz v10 #[code = 250]; v4 = arith.constant -8911505773112514939 : i64; v5 = arith.trunc v4 : felt; v11 = hir.int_to_ptr v8 : ptr; hir.store v11, v5; v12 = hir.bitcast v0 : u32; - v226 = arith.constant 4 : u32; - v14 = arith.mod v12, v226 : u32; + v279 = arith.constant 4 : u32; + v14 = arith.mod v12, v279 : u32; hir.assertz v14 #[code = 250]; v2 = arith.constant 2764190884472685073 : i64; v3 = arith.trunc v2 : felt; @@ -35,237 +35,305 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru private builtin.function @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() -> i32 { ^block11: - v19 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v20 = hir.bitcast v19 : ptr; - v21 = hir.load v20 : i32; - v22 = arith.constant 32 : i32; - v23 = arith.sub v21, v22 : i32 #[overflow = wrapping]; - v24 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v25 = hir.bitcast v24 : ptr; - hir.store v25, v23; + v20 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v21 = hir.bitcast v20 : ptr; + v22 = hir.load v21 : i32; + v23 = arith.constant 48 : i32; + v24 = arith.sub v22, v23 : i32 #[overflow = wrapping]; + v25 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v26 = hir.bitcast v25 : ptr; + hir.store v26, v24; hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/wit_bindgen::rt::run_ctors_once() - v26 = arith.constant 8 : i32; - v27 = arith.add v23, v26 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::default(v27) - v228 = arith.constant 0 : felt; + v27 = arith.constant 8 : i32; + v28 = arith.add v24, v27 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::default(v28) + v30 = arith.constant 0 : i64; + v31 = arith.trunc v30 : felt; v17 = arith.constant 0 : i32; - v271, v272, v273, v274 = scf.while v17, v23, v228 : i32, i32, felt, i32 { - ^block35(v275: i32, v276: i32, v277: felt): - v306 = arith.constant 0 : i32; - v89 = arith.constant 16 : i32; - v33 = arith.eq v275, v89 : i1; - v34 = arith.zext v33 : u32; - v35 = hir.bitcast v34 : i32; - v37 = arith.neq v35, v306 : i1; - v266 = scf.if v37 : i32 { - ^block34: - v237 = ub.poison i32 : i32; - scf.yield v237; + v323, v324, v325, v326 = scf.while v17, v24, v31 : i32, i32, felt, i32 { + ^block41(v327: i32, v328: i32, v329: felt): + v360 = arith.constant 0 : i32; + v53 = arith.constant 16 : i32; + v34 = arith.eq v327, v53 : i1; + v35 = arith.zext v34 : u32; + v36 = hir.bitcast v35 : i32; + v38 = arith.neq v36, v360 : i1; + v318 = scf.if v38 : i32 { + ^block40: + v289 = ub.poison i32 : i32; + scf.yield v289; } else { ^block16: - v305 = arith.constant 16 : i32; - v40 = arith.add v276, v305 : i32 #[overflow = wrapping]; - v41 = arith.add v40, v275 : i32 #[overflow = wrapping]; - v43 = hir.bitcast v41 : u32; - v52 = arith.constant 4 : u32; - v45 = arith.mod v43, v52 : u32; - hir.assertz v45 #[code = 250]; - v46 = hir.int_to_ptr v43 : ptr; - hir.store v46, v277; - v47 = arith.constant 4 : i32; - v48 = arith.add v275, v47 : i32 #[overflow = wrapping]; - scf.yield v48; + v55 = arith.constant 32 : i32; + v41 = arith.add v328, v55 : i32 #[overflow = wrapping]; + v42 = arith.add v41, v327 : i32 #[overflow = wrapping]; + v44 = hir.bitcast v42 : u32; + v58 = arith.constant 4 : u32; + v46 = arith.mod v44, v58 : u32; + hir.assertz v46 #[code = 250]; + v47 = hir.int_to_ptr v44 : ptr; + hir.store v47, v329; + v48 = arith.constant 4 : i32; + v49 = arith.add v327, v48 : i32 #[overflow = wrapping]; + scf.yield v49; }; - v238 = ub.poison felt : felt; - v268 = cf.select v37, v238, v277 : felt; - v304 = ub.poison i32 : i32; - v267 = cf.select v37, v304, v276 : i32; - v236 = arith.constant 1 : u32; - v230 = arith.constant 0 : u32; - v270 = cf.select v37, v230, v236 : u32; - v260 = arith.trunc v270 : i1; - scf.condition v260, v266, v267, v268, v276; + v290 = ub.poison felt : felt; + v320 = cf.select v38, v290, v329 : felt; + v359 = ub.poison i32 : i32; + v319 = cf.select v38, v359, v328 : i32; + v288 = arith.constant 1 : u32; + v282 = arith.constant 0 : u32; + v322 = cf.select v38, v282, v288 : u32; + v312 = arith.trunc v322 : i1; + scf.condition v312, v318, v319, v320, v328; } do { - ^block36(v278: i32, v279: i32, v280: felt, v281: i32): - scf.yield v278, v279, v280; + ^block42(v330: i32, v331: i32, v332: felt, v333: i32): + scf.yield v330, v331, v332; }; - v50 = arith.constant 28 : u32; - v49 = hir.bitcast v274 : u32; - v51 = arith.add v49, v50 : u32 #[overflow = checked]; - v303 = arith.constant 4 : u32; - v53 = arith.mod v51, v303 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - v55 = hir.load v54 : felt; - v57 = arith.constant 24 : u32; - v56 = hir.bitcast v274 : u32; - v58 = arith.add v56, v57 : u32 #[overflow = checked]; - v302 = arith.constant 4 : u32; - v60 = arith.mod v58, v302 : u32; - hir.assertz v60 #[code = 250]; - v61 = hir.int_to_ptr v58 : ptr; - v62 = hir.load v61 : felt; - v64 = arith.constant 20 : u32; - v63 = hir.bitcast v274 : u32; - v65 = arith.add v63, v64 : u32 #[overflow = checked]; - v301 = arith.constant 4 : u32; - v67 = arith.mod v65, v301 : u32; - hir.assertz v67 #[code = 250]; - v68 = hir.int_to_ptr v65 : ptr; - v69 = hir.load v68 : felt; - v71 = arith.constant 16 : u32; - v70 = hir.bitcast v274 : u32; - v72 = arith.add v70, v71 : u32 #[overflow = checked]; - v300 = arith.constant 4 : u32; - v74 = arith.mod v72, v300 : u32; - hir.assertz v74 #[code = 250]; - v75 = hir.int_to_ptr v72 : ptr; - v76 = hir.load v75 : felt; - hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::default(v274) - v299 = arith.constant 4 : u32; - v77 = hir.bitcast v274 : u32; - v79 = arith.add v77, v299 : u32 #[overflow = checked]; - v298 = arith.constant 4 : u32; - v81 = arith.mod v79, v298 : u32; - hir.assertz v81 #[code = 250]; - v82 = hir.int_to_ptr v79 : ptr; - v83 = hir.load v82 : felt; - v84 = hir.bitcast v274 : u32; - v297 = arith.constant 4 : u32; - v86 = arith.mod v84, v297 : u32; + v50 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v357 = arith.constant 32 : i32; + v56 = arith.add v326, v357 : i32 #[overflow = wrapping]; + v358 = arith.constant 16 : i32; + v54 = arith.add v326, v358 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::from(v54, v56) + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/::default(v326) + v356 = arith.constant 4 : u32; + v57 = hir.bitcast v326 : u32; + v59 = arith.add v57, v356 : u32 #[overflow = checked]; + v355 = arith.constant 4 : u32; + v61 = arith.mod v59, v355 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + v63 = hir.load v62 : felt; + v64 = hir.bitcast v326 : u32; + v354 = arith.constant 4 : u32; + v66 = arith.mod v64, v354 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : felt; + v72 = arith.constant 1048596 : i32; + v73 = arith.add v52, v72 : i32 #[overflow = wrapping]; + v71 = arith.constant 3 : i32; + v353 = arith.constant 16 : i32; + v70 = arith.add v326, v353 : i32 #[overflow = wrapping]; + v74 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::index(v70, v71, v73) : i32 + v75 = hir.bitcast v74 : u32; + v352 = arith.constant 4 : u32; + v77 = arith.mod v75, v352 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + v79 = hir.load v78 : felt; + v82 = arith.constant 2 : i32; + v351 = arith.constant 16 : i32; + v81 = arith.add v326, v351 : i32 #[overflow = wrapping]; + v83 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::index(v81, v82, v73) : i32 + v84 = hir.bitcast v83 : u32; + v350 = arith.constant 4 : u32; + v86 = arith.mod v84, v350 : u32; hir.assertz v86 #[code = 250]; v87 = hir.int_to_ptr v84 : ptr; v88 = hir.load v87 : felt; - v296 = arith.constant 16 : i32; - v90 = arith.add v274, v296 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden::protocol::active_account::get_initial_map_item(v83, v88, v55, v62, v69, v76, v90) - v91 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr - v92 = hir.bitcast v91 : ptr; - v93 = hir.load v92 : i32; - v94 = arith.constant 1048584 : i32; - v95 = arith.add v93, v94 : i32 #[overflow = wrapping]; - v295 = arith.constant 16 : u32; - v96 = hir.bitcast v274 : u32; - v98 = arith.add v96, v295 : u32 #[overflow = checked]; - v294 = arith.constant 4 : u32; - v100 = arith.mod v98, v294 : u32; - hir.assertz v100 #[code = 250]; - v101 = hir.int_to_ptr v98 : ptr; - v102 = hir.load v101 : felt; - v104 = arith.constant 12 : u32; - v103 = hir.bitcast v95 : u32; - v105 = arith.add v103, v104 : u32 #[overflow = checked]; - v293 = arith.constant 4 : u32; - v107 = arith.mod v105, v293 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - hir.store v108, v102; - v292 = arith.constant 20 : u32; - v109 = hir.bitcast v274 : u32; - v111 = arith.add v109, v292 : u32 #[overflow = checked]; - v291 = arith.constant 4 : u32; - v113 = arith.mod v111, v291 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : felt; - v117 = arith.constant 8 : u32; - v116 = hir.bitcast v95 : u32; - v118 = arith.add v116, v117 : u32 #[overflow = checked]; - v290 = arith.constant 4 : u32; - v120 = arith.mod v118, v290 : u32; - hir.assertz v120 #[code = 250]; - v121 = hir.int_to_ptr v118 : ptr; - hir.store v121, v115; - v289 = arith.constant 24 : u32; - v122 = hir.bitcast v274 : u32; - v124 = arith.add v122, v289 : u32 #[overflow = checked]; - v288 = arith.constant 4 : u32; - v126 = arith.mod v124, v288 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - v128 = hir.load v127 : felt; - v287 = arith.constant 4 : u32; - v129 = hir.bitcast v95 : u32; - v131 = arith.add v129, v287 : u32 #[overflow = checked]; - v286 = arith.constant 4 : u32; - v133 = arith.mod v131, v286 : u32; - hir.assertz v133 #[code = 250]; - v134 = hir.int_to_ptr v131 : ptr; - hir.store v134, v128; - v285 = arith.constant 28 : u32; - v135 = hir.bitcast v274 : u32; - v137 = arith.add v135, v285 : u32 #[overflow = checked]; - v284 = arith.constant 4 : u32; - v139 = arith.mod v137, v284 : u32; - hir.assertz v139 #[code = 250]; - v140 = hir.int_to_ptr v137 : ptr; - v141 = hir.load v140 : felt; - v142 = hir.bitcast v95 : u32; - v283 = arith.constant 4 : u32; - v144 = arith.mod v142, v283 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - hir.store v145, v141; - v282 = arith.constant 32 : i32; - v147 = arith.add v274, v282 : i32 #[overflow = wrapping]; - v148 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr - v149 = hir.bitcast v148 : ptr; - hir.store v149, v147; - builtin.ret v95; + v91 = arith.constant 1 : i32; + v349 = arith.constant 16 : i32; + v90 = arith.add v326, v349 : i32 #[overflow = wrapping]; + v92 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::index(v90, v91, v73) : i32 + v93 = hir.bitcast v92 : u32; + v348 = arith.constant 4 : u32; + v95 = arith.mod v93, v348 : u32; + hir.assertz v95 #[code = 250]; + v96 = hir.int_to_ptr v93 : ptr; + v97 = hir.load v96 : felt; + v346 = arith.constant 0 : i32; + v347 = arith.constant 16 : i32; + v99 = arith.add v326, v347 : i32 #[overflow = wrapping]; + v101 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/>::index(v99, v346, v73) : i32 + v102 = hir.bitcast v101 : u32; + v345 = arith.constant 4 : u32; + v104 = arith.mod v102, v345 : u32; + hir.assertz v104 #[code = 250]; + v105 = hir.int_to_ptr v102 : ptr; + v106 = hir.load v105 : felt; + v344 = arith.constant 32 : i32; + v108 = arith.add v326, v344 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden::protocol::active_account::get_initial_map_item(v63, v68, v79, v88, v97, v106, v108) + v109 = arith.constant 1048612 : i32; + v110 = arith.add v52, v109 : i32 #[overflow = wrapping]; + v112 = arith.constant 32 : u32; + v111 = hir.bitcast v326 : u32; + v113 = arith.add v111, v112 : u32 #[overflow = checked]; + v343 = arith.constant 4 : u32; + v115 = arith.mod v113, v343 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + v117 = hir.load v116 : felt; + v119 = arith.constant 12 : u32; + v118 = hir.bitcast v110 : u32; + v120 = arith.add v118, v119 : u32 #[overflow = checked]; + v342 = arith.constant 4 : u32; + v122 = arith.mod v120, v342 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + hir.store v123, v117; + v125 = arith.constant 36 : u32; + v124 = hir.bitcast v326 : u32; + v126 = arith.add v124, v125 : u32 #[overflow = checked]; + v341 = arith.constant 4 : u32; + v128 = arith.mod v126, v341 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : felt; + v132 = arith.constant 8 : u32; + v131 = hir.bitcast v110 : u32; + v133 = arith.add v131, v132 : u32 #[overflow = checked]; + v340 = arith.constant 4 : u32; + v135 = arith.mod v133, v340 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v130; + v138 = arith.constant 40 : u32; + v137 = hir.bitcast v326 : u32; + v139 = arith.add v137, v138 : u32 #[overflow = checked]; + v339 = arith.constant 4 : u32; + v141 = arith.mod v139, v339 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : felt; + v338 = arith.constant 4 : u32; + v144 = hir.bitcast v110 : u32; + v146 = arith.add v144, v338 : u32 #[overflow = checked]; + v337 = arith.constant 4 : u32; + v148 = arith.mod v146, v337 : u32; + hir.assertz v148 #[code = 250]; + v149 = hir.int_to_ptr v146 : ptr; + hir.store v149, v143; + v151 = arith.constant 44 : u32; + v150 = hir.bitcast v326 : u32; + v152 = arith.add v150, v151 : u32 #[overflow = checked]; + v336 = arith.constant 4 : u32; + v154 = arith.mod v152, v336 : u32; + hir.assertz v154 #[code = 250]; + v155 = hir.int_to_ptr v152 : ptr; + v156 = hir.load v155 : felt; + v157 = hir.bitcast v110 : u32; + v335 = arith.constant 4 : u32; + v159 = arith.mod v157, v335 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + hir.store v160, v156; + v334 = arith.constant 48 : i32; + v162 = arith.add v326, v334 : i32 #[overflow = wrapping]; + v163 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__stack_pointer : ptr + v164 = hir.bitcast v163 : ptr; + hir.store v164, v162; + builtin.ret v110; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block17: - v151 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr - v152 = hir.bitcast v151 : ptr; - v153 = hir.load v152 : i32; - v154 = arith.constant 1048600 : i32; - v155 = arith.add v153, v154 : i32 #[overflow = wrapping]; - v156 = hir.bitcast v155 : u32; - v157 = hir.int_to_ptr v156 : ptr; - v158 = hir.load v157 : u8; - v150 = arith.constant 0 : i32; - v159 = arith.zext v158 : u32; - v160 = hir.bitcast v159 : i32; - v162 = arith.neq v160, v150 : i1; - scf.if v162{ + v166 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v167 = hir.bitcast v166 : ptr; + v168 = hir.load v167 : i32; + v169 = arith.constant 1048628 : i32; + v170 = arith.add v168, v169 : i32 #[overflow = wrapping]; + v171 = hir.bitcast v170 : u32; + v172 = hir.int_to_ptr v171 : ptr; + v173 = hir.load v172 : u8; + v165 = arith.constant 0 : i32; + v174 = arith.zext v173 : u32; + v175 = hir.bitcast v174 : i32; + v177 = arith.neq v175, v165 : i1; + scf.if v177{ ^block19: scf.yield ; } else { ^block20: - v163 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr - v164 = hir.bitcast v163 : ptr; - v165 = hir.load v164 : i32; + v178 = builtin.global_symbol @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/GOT.data.internal.__memory_base : ptr + v179 = hir.bitcast v178 : ptr; + v180 = hir.load v179 : i32; hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/__wasm_call_ctors() - v308 = arith.constant 1 : u8; - v310 = arith.constant 1048600 : i32; - v167 = arith.add v165, v310 : i32 #[overflow = wrapping]; - v171 = hir.bitcast v167 : u32; - v172 = hir.int_to_ptr v171 : ptr; - hir.store v172, v308; + v362 = arith.constant 1 : u8; + v364 = arith.constant 1048628 : i32; + v182 = arith.add v180, v364 : i32 #[overflow = wrapping]; + v186 = hir.bitcast v182 : u32; + v187 = hir.int_to_ptr v186 : ptr; + hir.store v187, v362; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden::protocol::active_account::get_initial_map_item(v173: felt, v174: felt, v175: felt, v176: felt, v177: felt, v178: felt, v179: i32) { - ^block21(v173: felt, v174: felt, v175: felt, v176: felt, v177: felt, v178: felt, v179: i32): - v180, v181, v182, v183 = hir.exec @miden/protocol/active_account/get_initial_map_item(v173, v174, v175, v176, v177, v178) : felt, felt, felt, felt - v184 = hir.bitcast v179 : u32; - v185 = hir.int_to_ptr v184 : ptr; - hir.store v185, v180; - v186 = arith.constant 4 : u32; - v187 = arith.add v184, v186 : u32 #[overflow = checked]; - v188 = hir.int_to_ptr v187 : ptr; - hir.store v188, v181; - v189 = arith.constant 8 : u32; - v190 = arith.add v184, v189 : u32 #[overflow = checked]; - v191 = hir.int_to_ptr v190 : ptr; - hir.store v191, v182; - v192 = arith.constant 12 : u32; - v193 = arith.add v184, v192 : u32 #[overflow = checked]; - v194 = hir.int_to_ptr v193 : ptr; - hir.store v194, v183; + private builtin.function @>::index(v188: i32, v189: i32, v190: i32) -> i32 { + ^block21(v188: i32, v189: i32, v190: i32): + v198 = arith.constant 0 : i32; + v366 = arith.constant 3 : u32; + v193 = hir.bitcast v189 : u32; + v195 = arith.gt v193, v366 : i1; + v196 = arith.zext v195 : u32; + v197 = hir.bitcast v196 : i32; + v199 = arith.neq v197, v198 : i1; + cf.cond_br v199 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v365 = arith.constant 2 : u32; + v202 = arith.shl v189, v365 : i32; + v203 = arith.add v188, v202 : i32 #[overflow = wrapping]; + builtin.ret v203; + }; + + private builtin.function @>::from(v204: i32, v205: i32) { + ^block25(v204: i32, v205: i32): + v207 = arith.constant 8 : u32; + v206 = hir.bitcast v205 : u32; + v208 = arith.add v206, v207 : u32 #[overflow = checked]; + v209 = arith.constant 4 : u32; + v210 = arith.mod v208, v209 : u32; + hir.assertz v210 #[code = 250]; + v211 = hir.int_to_ptr v208 : ptr; + v212 = hir.load v211 : i64; + v372 = arith.constant 8 : u32; + v213 = hir.bitcast v204 : u32; + v215 = arith.add v213, v372 : u32 #[overflow = checked]; + v371 = arith.constant 8 : u32; + v217 = arith.mod v215, v371 : u32; + hir.assertz v217 #[code = 250]; + v218 = hir.int_to_ptr v215 : ptr; + hir.store v218, v212; + v219 = hir.bitcast v205 : u32; + v370 = arith.constant 4 : u32; + v221 = arith.mod v219, v370 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + v223 = hir.load v222 : i64; + v224 = hir.bitcast v204 : u32; + v369 = arith.constant 8 : u32; + v226 = arith.mod v224, v369 : u32; + hir.assertz v226 #[code = 250]; + v227 = hir.int_to_ptr v224 : ptr; + hir.store v227, v223; + builtin.ret ; + }; + + private builtin.function @miden::protocol::active_account::get_initial_map_item(v228: felt, v229: felt, v230: felt, v231: felt, v232: felt, v233: felt, v234: i32) { + ^block27(v228: felt, v229: felt, v230: felt, v231: felt, v232: felt, v233: felt, v234: i32): + v235, v236, v237, v238 = hir.exec @miden/protocol/active_account/get_initial_map_item(v228, v229, v230, v231, v232, v233) : felt, felt, felt, felt + v239 = hir.bitcast v234 : u32; + v240 = hir.int_to_ptr v239 : ptr; + hir.store v240, v235; + v241 = arith.constant 4 : u32; + v242 = arith.add v239, v241 : u32 #[overflow = checked]; + v243 = hir.int_to_ptr v242 : ptr; + hir.store v243, v236; + v244 = arith.constant 8 : u32; + v245 = arith.add v239, v244 : u32 #[overflow = checked]; + v246 = hir.int_to_ptr v245 : ptr; + hir.store v246, v237; + v247 = arith.constant 12 : u32; + v248 = arith.add v239, v247 : u32 #[overflow = checked]; + v249 = hir.int_to_ptr v248 : ptr; + hir.store v249, v238; builtin.ret ; }; @@ -277,38 +345,38 @@ builtin.component miden:rust-sdk-account-storage-get-initial-map-item-binding/ru builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt, felt, felt, felt { - ^block26: - v195 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() : i32 - v196 = arith.constant 0 : i32; - v197 = arith.add v195, v196 : i32 #[overflow = unchecked]; - v314 = arith.constant 0 : i32; - v315 = arith.constant 0 : i32; - v199 = arith.add v197, v315 : i32 #[overflow = unchecked]; - v201 = arith.add v199, v314 : i32 #[overflow = unchecked]; - v202 = hir.int_to_ptr v201 : ptr; - v203 = hir.load v202 : felt; - v313 = arith.constant 0 : i32; - v204 = arith.constant 4 : i32; - v205 = arith.add v197, v204 : i32 #[overflow = unchecked]; - v207 = arith.add v205, v313 : i32 #[overflow = unchecked]; - v208 = hir.int_to_ptr v207 : ptr; - v209 = hir.load v208 : felt; - v312 = arith.constant 0 : i32; - v210 = arith.constant 8 : i32; - v211 = arith.add v197, v210 : i32 #[overflow = unchecked]; - v213 = arith.add v211, v312 : i32 #[overflow = unchecked]; - v214 = hir.int_to_ptr v213 : ptr; - v215 = hir.load v214 : felt; - v311 = arith.constant 0 : i32; - v216 = arith.constant 12 : i32; - v217 = arith.add v197, v216 : i32 #[overflow = unchecked]; - v219 = arith.add v217, v311 : i32 #[overflow = unchecked]; - v220 = hir.int_to_ptr v219 : ptr; - v221 = hir.load v220 : felt; - builtin.ret v203, v209, v215, v221; + ^block32: + v250 = hir.exec @miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1/rust_sdk_account_storage_get_initial_map_item_binding/miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding() : i32 + v376 = arith.constant 0 : i32; + v251 = arith.constant 0 : i32; + v252 = arith.add v250, v251 : i32 #[overflow = unchecked]; + v254 = arith.add v252, v376 : i32 #[overflow = unchecked]; + v255 = hir.int_to_ptr v254 : ptr; + v256 = hir.load v255 : felt; + v375 = arith.constant 0 : i32; + v257 = arith.constant 4 : i32; + v258 = arith.add v250, v257 : i32 #[overflow = unchecked]; + v260 = arith.add v258, v375 : i32 #[overflow = unchecked]; + v261 = hir.int_to_ptr v260 : ptr; + v262 = hir.load v261 : felt; + v374 = arith.constant 0 : i32; + v263 = arith.constant 8 : i32; + v264 = arith.add v250, v263 : i32 #[overflow = unchecked]; + v266 = arith.add v264, v374 : i32 #[overflow = unchecked]; + v267 = hir.int_to_ptr v266 : ptr; + v268 = hir.load v267 : felt; + v373 = arith.constant 0 : i32; + v269 = arith.constant 12 : i32; + v270 = arith.add v250, v269 : i32 #[overflow = unchecked]; + v272 = arith.add v270, v373 : i32 #[overflow = unchecked]; + v273 = hir.int_to_ptr v272 : ptr; + v274 = hir.load v273 : felt; + builtin.ret v256, v262, v268, v274; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm index 942ea29a1..125b64654 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -70,20 +68,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding @@ -152,7 +150,7 @@ end proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding( ) -> i32 - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -160,9 +158,9 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.48 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -187,6 +185,9 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -202,7 +203,7 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun drop push.3735929054 else - push.16 + push.32 dup.3 u32wrapping_add dup.2 @@ -257,8 +258,33 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun drop drop drop - push.28 + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.2 + u32wrapping_add + push.16 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::>::from + trace.252 + nop dup.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::::default + trace.252 + nop + push.4 + dup.2 add u32assert push.4 @@ -274,10 +300,7 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop - push.24 dup.2 - add - u32assert push.4 dup.1 swap.1 @@ -291,10 +314,21 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop - push.20 + push.1048596 dup.3 - add - u32assert + u32wrapping_add + push.3 + push.16 + dup.6 + u32wrapping_add + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -308,10 +342,18 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop + push.2 push.16 - dup.4 - add - u32assert + dup.7 + u32wrapping_add + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -325,17 +367,19 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop + push.1 + push.16 + dup.8 + u32wrapping_add dup.4 + swap.2 + swap.1 trace.240 nop - exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::::default + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::>::index trace.252 nop push.4 - dup.5 - add - u32assert - push.4 dup.1 swap.1 u32mod @@ -348,7 +392,18 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop - dup.5 + push.0 + push.16 + dup.9 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -362,30 +417,24 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::load_felt trace.252 nop - push.16 - dup.7 + push.32 + dup.8 u32wrapping_add - movup.3 + movup.2 + swap.3 + movdn.2 + swap.1 swap.5 - movdn.3 + swap.1 swap.6 - swap.2 trace.240 nop exec.::"miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1"::rust_sdk_account_storage_get_initial_map_item_binding::"miden::protocol::active_account::get_initial_map_item" trace.252 nop - push.1114148 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048584 + push.1048612 u32wrapping_add - push.16 + push.32 dup.2 add u32assert @@ -419,7 +468,7 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::store_felt trace.252 nop - push.20 + push.36 dup.2 add u32assert @@ -453,7 +502,7 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::store_felt trace.252 nop - push.24 + push.40 dup.2 add u32assert @@ -487,7 +536,7 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::store_felt trace.252 nop - push.28 + push.44 dup.2 add u32assert @@ -518,10 +567,10 @@ proc miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-accoun exec.::intrinsics::mem::store_felt trace.252 nop - push.32 + push.48 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -535,7 +584,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -543,7 +592,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048600 + push.1048628 u32wrapping_add u32divmod.4 swap.1 @@ -564,7 +613,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -578,7 +627,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048600 + push.1048628 movup.2 u32wrapping_add u32divmod.4 @@ -605,6 +654,109 @@ proc wit_bindgen::rt::run_ctors_once( end end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + @callconv("C") proc miden::protocol::active_account::get_initial_map_item( felt, diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat index 81155ba61..312fd3f1d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_storage_get_initial_map_item_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,9 +12,10 @@ (type (;0;) (func)) (type (;1;) (func (param i32))) (type (;2;) (func (result i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param i64) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32 f32 i32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -39,9 +39,9 @@ f32.store ) (func $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1#binding (;3;) (type 2) (result i32) - (local i32 i32 f32 f32 f32 f32) + (local i32 i32 f32 i32) global.get $__stack_pointer - i32.const 32 + i32.const 48 i32.sub local.tee 0 global.set $__stack_pointer @@ -52,8 +52,8 @@ call $::default i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -62,7 +62,7 @@ i32.eq br_if 1 (;@1;) local.get 0 - i32.const 16 + i32.const 32 i32.add local.get 1 i32.add @@ -75,53 +75,77 @@ br 0 (;@2;) end end - local.get 0 - f32.load offset=28 - local.set 2 - local.get 0 - f32.load offset=24 + global.get $GOT.data.internal.__memory_base local.set 3 local.get 0 - f32.load offset=20 - local.set 4 + i32.const 16 + i32.add local.get 0 - f32.load offset=16 - local.set 5 + i32.const 32 + i32.add + call $>::from local.get 0 call $::default local.get 0 f32.load offset=4 local.get 0 f32.load - local.get 2 + local.get 0 + i32.const 16 + i32.add + i32.const 3 local.get 3 - local.get 4 - local.get 5 + i32.const 1048596 + i32.add + local.tee 1 + call $>::index + f32.load local.get 0 i32.const 16 i32.add + i32.const 2 + local.get 1 + call $>::index + f32.load + local.get 0 + i32.const 16 + i32.add + i32.const 1 + local.get 1 + call $>::index + f32.load + local.get 0 + i32.const 16 + i32.add + i32.const 0 + local.get 1 + call $>::index + f32.load + local.get 0 + i32.const 32 + i32.add call $miden::protocol::active_account::get_initial_map_item - global.get $GOT.data.internal.__memory_base - i32.const 1048584 + local.get 3 + i32.const 1048612 i32.add local.tee 1 local.get 0 - f32.load offset=16 + f32.load offset=32 f32.store offset=12 local.get 1 local.get 0 - f32.load offset=20 + f32.load offset=36 f32.store offset=8 local.get 1 local.get 0 - f32.load offset=24 + f32.load offset=40 f32.store offset=4 local.get 1 local.get 0 - f32.load offset=28 + f32.load offset=44 f32.store local.get 0 - i32.const 32 + i32.const 48 i32.add global.set $__stack_pointer local.get 1 @@ -130,7 +154,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048600 + i32.const 1048628 i32.add i32.load8_u br_if 0 (;@1;) @@ -138,22 +162,45 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048600 + i32.const 1048628 i32.add i32.const 1 i32.store8 end ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) - (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end unreachable ) - (func $miden::protocol::active_account::get_initial_map_item (;7;) (type 5) (param f32 f32 f32 f32 f32 f32 i32) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::active_account::get_initial_map_item (;8;) (type 6) (param f32 f32 f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "krust_sdk_account_storage_get_initial_map_item_binding\01\0b0.0.1\03\01\01\00Rmiden::component::miden_rust_sdk_account_storage_get_initial_map_item_binding::map\01\01\11test map\00\00\09word\00\00\09word\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) @@ -167,15 +214,14 @@ (component $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-account-storage-get-initial-map-item-binding/rust-sdk-account-storage-get-initial-map-item-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat index 1007e1f72..fff05324f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -97,15 +96,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat index 0b82801cf..7009c7825 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_number_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -64,15 +63,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat index d4064577a..acb287d8d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_block_timestamp_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -64,15 +63,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat index da95ee1c5..237df47e9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_expiration_block_delta_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -64,15 +63,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat index 8ad054d0b..9cfbc2c40 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_input_notes_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -97,15 +96,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat index d76280bfc..f3ab58c4d 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_input_notes_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -64,15 +63,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat index e15b3541f..7f5c3eead 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_num_output_notes_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -64,15 +63,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat index cd184b74f..3fbcaa829 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_get_output_notes_commitment_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -97,15 +96,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir index 448a9158e..523e1d7e9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.hir @@ -13,8 +13,9 @@ builtin.component miden:base/transaction-script@1.0.0 { private builtin.function @miden:base/transaction-script@1.0.0#run(v0: felt, v1: felt, v2: felt, v3: felt) { ^block9(v0: felt, v1: felt, v2: felt, v3: felt): hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/wit_bindgen::rt::run_ctors_once() - v35 = arith.constant 42 : felt; - hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden_base_sys::bindings::tx::update_expiration_block_delta(v35) + v4 = arith.constant 42 : i64; + v5 = arith.trunc v4 : felt; + hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/miden_base_sys::bindings::tx::update_expiration_block_delta(v5) builtin.ret ; }; @@ -41,12 +42,12 @@ builtin.component miden:base/transaction-script@1.0.0 { v20 = hir.bitcast v19 : ptr; v21 = hir.load v20 : i32; hir.exec @miden:base/transaction-script@1.0.0/rust_sdk_account_tx_update_expiration_block_delta_binding/__wasm_call_ctors() - v37 = arith.constant 1 : u8; - v39 = arith.constant 1048584 : i32; - v23 = arith.add v21, v39 : i32 #[overflow = wrapping]; + v36 = arith.constant 1 : u8; + v38 = arith.constant 1048584 : i32; + v23 = arith.add v21, v38 : i32 #[overflow = wrapping]; v27 = hir.bitcast v23 : u32; v28 = hir.int_to_ptr v27 : ptr; - hir.store v28, v37; + hir.store v28, v36; scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm index 0156ed553..afd9d8e72 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.masm @@ -60,6 +60,9 @@ proc miden:base/transaction-script@1.0.0#run(felt, felt, felt, felt) trace.252 nop push.42 + push.0 + mul.4294967296 + add trace.240 nop exec.::"miden:base/transaction-script@1.0.0"::rust_sdk_account_tx_update_expiration_block_delta_binding::miden_base_sys::bindings::tx::update_expiration_block_delta diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat index 2371c1fe5..9c479e4ac 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_tx_update_expiration_block_delta_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (param f32 f32 f32 f32))) (type (;2;) (func (param f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -25,8 +24,8 @@ (func $rust_sdk_account_tx_update_expiration_block_delta_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:base/transaction-script@1.0.0#run (;2;) (type 1) (param f32 f32 f32 f32) call $wit_bindgen::rt::run_ctors_once - i32.const 42 - call $intrinsics::felt::from_u32 + i64.const 42 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::tx::update_expiration_block_delta ) (func $wit_bindgen::rt::run_ctors_once (;3;) (type 0) @@ -51,7 +50,7 @@ local.get 0 call $miden::protocol::tx::update_expiration_block_delta ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::tx::update_expiration_block_delta (;6;) (type 2) (param f32) @@ -70,15 +69,14 @@ (component $miden:base/transaction-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/transaction-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/transaction-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir index b59d7e08e..6fe541b1f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.hir @@ -15,137 +15,206 @@ builtin.component miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-a v3 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 16 : i32; + v6 = arith.constant 32 : i32; v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; v8 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/wit_bindgen::rt::run_ctors_once() - v100 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v143, v144, v145, v146 = scf.while v1, v7, v100 : i32, i32, felt, i32 { - ^block33(v147: i32, v148: i32, v149: felt): - v162 = arith.constant 0 : i32; - v163 = arith.constant 16 : i32; - v15 = arith.eq v147, v163 : i1; + v195, v196, v197, v198 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block39(v199: i32, v200: i32, v201: felt): + v217 = arith.constant 0 : i32; + v34 = arith.constant 16 : i32; + v15 = arith.eq v199, v34 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v162 : i1; - v138 = scf.if v19 : i32 { - ^block32: - v109 = ub.poison i32 : i32; - scf.yield v109; + v19 = arith.neq v17, v217 : i1; + v190 = scf.if v19 : i32 { + ^block38: + v161 = ub.poison i32 : i32; + scf.yield v161; } else { ^block14: - v21 = arith.add v148, v147 : i32 #[overflow = wrapping]; - v23 = hir.bitcast v21 : u32; - v32 = arith.constant 4 : u32; - v25 = arith.mod v23, v32 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - hir.store v26, v149; - v27 = arith.constant 4 : i32; - v28 = arith.add v147, v27 : i32 #[overflow = wrapping]; - scf.yield v28; + v216 = arith.constant 16 : i32; + v22 = arith.add v200, v216 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v199 : i32 #[overflow = wrapping]; + v25 = hir.bitcast v23 : u32; + v41 = arith.constant 4 : u32; + v27 = arith.mod v25, v41 : u32; + hir.assertz v27 #[code = 250]; + v28 = hir.int_to_ptr v25 : ptr; + hir.store v28, v201; + v29 = arith.constant 4 : i32; + v30 = arith.add v199, v29 : i32 #[overflow = wrapping]; + scf.yield v30; }; - v110 = ub.poison felt : felt; - v140 = cf.select v19, v110, v149 : felt; - v161 = ub.poison i32 : i32; - v139 = cf.select v19, v161, v148 : i32; - v108 = arith.constant 1 : u32; - v102 = arith.constant 0 : u32; - v142 = cf.select v19, v102, v108 : u32; - v132 = arith.trunc v142 : i1; - scf.condition v132, v138, v139, v140, v148; + v162 = ub.poison felt : felt; + v192 = cf.select v19, v162, v201 : felt; + v215 = ub.poison i32 : i32; + v191 = cf.select v19, v215, v200 : i32; + v160 = arith.constant 1 : u32; + v154 = arith.constant 0 : u32; + v194 = cf.select v19, v154, v160 : u32; + v184 = arith.trunc v194 : i1; + scf.condition v184, v190, v191, v192, v200; } do { - ^block34(v150: i32, v151: i32, v152: felt, v153: i32): - scf.yield v150, v151, v152; + ^block40(v202: i32, v203: i32, v204: felt, v205: i32): + scf.yield v202, v203, v204; }; - v30 = arith.constant 12 : u32; - v29 = hir.bitcast v146 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v160 = arith.constant 4 : u32; - v33 = arith.mod v31, v160 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : felt; - v37 = arith.constant 8 : u32; - v36 = hir.bitcast v146 : u32; - v38 = arith.add v36, v37 : u32 #[overflow = checked]; - v159 = arith.constant 4 : u32; - v40 = arith.mod v38, v159 : u32; - hir.assertz v40 #[code = 250]; - v41 = hir.int_to_ptr v38 : ptr; - v42 = hir.load v41 : felt; - v158 = arith.constant 4 : u32; - v43 = hir.bitcast v146 : u32; - v45 = arith.add v43, v158 : u32 #[overflow = checked]; - v157 = arith.constant 4 : u32; - v47 = arith.mod v45, v157 : u32; - hir.assertz v47 #[code = 250]; - v48 = hir.int_to_ptr v45 : ptr; - v49 = hir.load v48 : felt; - v50 = hir.bitcast v146 : u32; - v156 = arith.constant 4 : u32; - v52 = arith.mod v50, v156 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : felt; - v55 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden::protocol::native_account::was_procedure_called(v35, v42, v49, v54) : felt - v155 = arith.constant 16 : i32; - v66 = arith.add v146, v155 : i32 #[overflow = wrapping]; - v67 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr - v68 = hir.bitcast v67 : ptr; - hir.store v68, v66; - v60 = arith.constant 1 : i32; - v154 = arith.constant 0 : felt; - v58 = arith.eq v55, v154 : i1; - v59 = hir.cast v58 : i32; - v61 = arith.neq v59, v60 : i1; - v62 = arith.zext v61 : u32; - v63 = hir.bitcast v62 : i32; - v64 = hir.bitcast v63 : felt; - builtin.ret v64; + v31 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v32 = hir.bitcast v31 : ptr; + v33 = hir.load v32 : i32; + v214 = arith.constant 16 : i32; + v35 = arith.add v198, v214 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/>::from(v198, v35) + v37 = arith.constant 1048596 : i32; + v38 = arith.add v33, v37 : i32 #[overflow = wrapping]; + v36 = arith.constant 3 : i32; + v39 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/>::index(v198, v36, v38) : i32 + v40 = hir.bitcast v39 : u32; + v213 = arith.constant 4 : u32; + v42 = arith.mod v40, v213 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : felt; + v45 = arith.constant 2 : i32; + v46 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/>::index(v198, v45, v38) : i32 + v47 = hir.bitcast v46 : u32; + v212 = arith.constant 4 : u32; + v49 = arith.mod v47, v212 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + v51 = hir.load v50 : felt; + v52 = arith.constant 1 : i32; + v53 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/>::index(v198, v52, v38) : i32 + v54 = hir.bitcast v53 : u32; + v211 = arith.constant 4 : u32; + v56 = arith.mod v54, v211 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : felt; + v210 = arith.constant 0 : i32; + v60 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/>::index(v198, v210, v38) : i32 + v61 = hir.bitcast v60 : u32; + v209 = arith.constant 4 : u32; + v63 = arith.mod v61, v209 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : felt; + v66 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden::protocol::native_account::was_procedure_called(v44, v51, v58, v65) : felt + v208 = arith.constant 32 : i32; + v80 = arith.add v198, v208 : i32 #[overflow = wrapping]; + v81 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__stack_pointer : ptr + v82 = hir.bitcast v81 : ptr; + hir.store v82, v80; + v206 = arith.constant 1 : i32; + v207 = arith.constant 0 : i64; + v68 = arith.trunc v207 : felt; + v69 = arith.eq v66, v68 : i1; + v70 = hir.cast v69 : i32; + v72 = arith.neq v70, v206 : i1; + v73 = arith.zext v72 : u32; + v74 = hir.bitcast v73 : i32; + v75 = hir.bitcast v74 : u32; + v76 = arith.zext v75 : u64; + v77 = hir.bitcast v76 : i64; + v78 = arith.trunc v77 : felt; + builtin.ret v78; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v70 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr - v71 = hir.bitcast v70 : ptr; - v72 = hir.load v71 : i32; - v73 = arith.constant 1048584 : i32; - v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; - v75 = hir.bitcast v74 : u32; - v76 = hir.int_to_ptr v75 : ptr; - v77 = hir.load v76 : u8; - v69 = arith.constant 0 : i32; - v78 = arith.zext v77 : u32; - v79 = hir.bitcast v78 : i32; - v81 = arith.neq v79, v69 : i1; - scf.if v81{ + v84 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v85 = hir.bitcast v84 : ptr; + v86 = hir.load v85 : i32; + v87 = arith.constant 1048612 : i32; + v88 = arith.add v86, v87 : i32 #[overflow = wrapping]; + v89 = hir.bitcast v88 : u32; + v90 = hir.int_to_ptr v89 : ptr; + v91 = hir.load v90 : u8; + v83 = arith.constant 0 : i32; + v92 = arith.zext v91 : u32; + v93 = hir.bitcast v92 : i32; + v95 = arith.neq v93, v83 : i1; + scf.if v95{ ^block17: scf.yield ; } else { ^block18: - v82 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr - v83 = hir.bitcast v82 : ptr; - v84 = hir.load v83 : i32; + v96 = builtin.global_symbol @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/GOT.data.internal.__memory_base : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/__wasm_call_ctors() - v165 = arith.constant 1 : u8; - v167 = arith.constant 1048584 : i32; - v86 = arith.add v84, v167 : i32 #[overflow = wrapping]; - v90 = hir.bitcast v86 : u32; - v91 = hir.int_to_ptr v90 : ptr; - hir.store v91, v165; + v219 = arith.constant 1 : u8; + v221 = arith.constant 1048612 : i32; + v100 = arith.add v98, v221 : i32 #[overflow = wrapping]; + v104 = hir.bitcast v100 : u32; + v105 = hir.int_to_ptr v104 : ptr; + hir.store v105, v219; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden::protocol::native_account::was_procedure_called(v92: felt, v93: felt, v94: felt, v95: felt) -> felt { - ^block19(v92: felt, v93: felt, v94: felt, v95: felt): - v96 = hir.exec @miden/protocol/native_account/was_procedure_called(v92, v93, v94, v95) : felt - builtin.ret v96; + private builtin.function @>::index(v106: i32, v107: i32, v108: i32) -> i32 { + ^block19(v106: i32, v107: i32, v108: i32): + v116 = arith.constant 0 : i32; + v223 = arith.constant 3 : u32; + v111 = hir.bitcast v107 : u32; + v113 = arith.gt v111, v223 : i1; + v114 = arith.zext v113 : u32; + v115 = hir.bitcast v114 : i32; + v117 = arith.neq v115, v116 : i1; + cf.cond_br v117 ^block21, ^block22; + ^block21: + ub.unreachable ; + ^block22: + v222 = arith.constant 2 : u32; + v120 = arith.shl v107, v222 : i32; + v121 = arith.add v106, v120 : i32 #[overflow = wrapping]; + builtin.ret v121; + }; + + private builtin.function @>::from(v122: i32, v123: i32) { + ^block23(v122: i32, v123: i32): + v125 = arith.constant 8 : u32; + v124 = hir.bitcast v123 : u32; + v126 = arith.add v124, v125 : u32 #[overflow = checked]; + v127 = arith.constant 4 : u32; + v128 = arith.mod v126, v127 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : i64; + v229 = arith.constant 8 : u32; + v131 = hir.bitcast v122 : u32; + v133 = arith.add v131, v229 : u32 #[overflow = checked]; + v228 = arith.constant 8 : u32; + v135 = arith.mod v133, v228 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v130; + v137 = hir.bitcast v123 : u32; + v227 = arith.constant 4 : u32; + v139 = arith.mod v137, v227 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : i64; + v142 = hir.bitcast v122 : u32; + v226 = arith.constant 8 : u32; + v144 = arith.mod v142, v226 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + hir.store v145, v141; + builtin.ret ; + }; + + private builtin.function @miden::protocol::native_account::was_procedure_called(v146: felt, v147: felt, v148: felt, v149: felt) -> felt { + ^block25(v146: felt, v147: felt, v148: felt, v149: felt): + v150 = hir.exec @miden/protocol/native_account/was_procedure_called(v146, v147, v148, v149) : felt + builtin.ret v150; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -156,12 +225,14 @@ builtin.component miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-a builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block24: - v98 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() : felt - builtin.ret v98; + ^block30: + v152 = hir.exec @miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1/rust_sdk_account_was_procedure_called_binding/miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding() : felt + builtin.ret v152; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm index b4d11f161..b35b3510b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -62,9 +62,9 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,6 +81,9 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -96,7 +99,9 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr drop push.3735929054 else - dup.2 + push.16 + dup.3 + u32wrapping_add dup.2 u32wrapping_add push.4 @@ -149,10 +154,35 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr drop drop drop - push.12 - dup.1 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + dup.2 + u32wrapping_add + dup.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::>::from + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.2 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -166,10 +196,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert + push.2 + dup.3 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -183,10 +219,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 - add - u32assert + push.1 + dup.4 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -200,7 +242,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + push.0 + dup.5 + movup.2 + swap.5 + movdn.2 + trace.240 + nop + exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -215,16 +266,16 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr trace.252 nop movdn.3 - swap.2 + swap.1 trace.240 nop exec.::"miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1"::rust_sdk_account_was_procedure_called_binding::"miden::protocol::native_account::was_procedure_called" trace.252 nop - push.16 + push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -234,16 +285,22 @@ proc miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-pr nop push.1 push.0 + push.0 + mul.4294967296 + add movup.2 eq neq + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -251,7 +308,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -272,7 +329,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -286,7 +343,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -313,6 +370,109 @@ proc wit_bindgen::rt::run_ctors_once( end end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop +end + @callconv("C") proc miden::protocol::native_account::was_procedure_called( felt, diff --git a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat index 7f829e874..fea9aa9bc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_account_was_procedure_called_binding.wat @@ -10,8 +10,10 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param f32 f32) (result i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32) (result f32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -24,15 +26,15 @@ (func $miden:rust-sdk-account-was-procedure-called-binding/rust-sdk-account-was-procedure-called-binding@0.0.1#binding (;2;) (type 1) (result f32) (local i32 i32 f32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -41,6 +43,8 @@ i32.eq br_if 1 (;@1;) local.get 0 + i32.const 16 + i32.add local.get 1 i32.add local.get 2 @@ -52,24 +56,47 @@ br 0 (;@2;) end end + global.get $GOT.data.internal.__memory_base + local.set 1 + local.get 0 local.get 0 - f32.load offset=12 + i32.const 16 + i32.add + call $>::from local.get 0 - f32.load offset=8 + i32.const 3 + local.get 1 + i32.const 1048596 + i32.add + local.tee 1 + call $>::index + f32.load local.get 0 - f32.load offset=4 + i32.const 2 + local.get 1 + call $>::index + f32.load local.get 0 + i32.const 1 + local.get 1 + call $>::index f32.load - call $miden::protocol::native_account::was_procedure_called + local.get 0 i32.const 0 - call $intrinsics::felt::from_u32 + local.get 1 + call $>::index + f32.load + call $miden::protocol::native_account::was_procedure_called + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $intrinsics::felt::eq i32.const 1 i32.ne - call $intrinsics::felt::from_u32 + i64.extend_i32_u + call $intrinsics::felt::from_u64_unchecked local.set 2 local.get 0 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer local.get 2 @@ -78,7 +105,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -86,7 +113,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 @@ -95,13 +122,39 @@ (func $intrinsics::felt::eq (;4;) (type 2) (param f32 f32) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) - (func $miden::protocol::native_account::was_procedure_called (;6;) (type 4) (param f32 f32 f32 f32) (result f32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::native_account::was_procedure_called (;8;) (type 6) (param f32 f32 f32 f32) (result f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "[rust_sdk_account_was_procedure_called_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir index 433f74cb6..d8cfd9af0 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.hir @@ -29,33 +29,33 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v18 = arith.constant 1048584 : i32; v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; v20 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc(v19, v13, v12) : i32 - v653 = arith.constant 0 : i32; + v655 = arith.constant 0 : i32; v21 = arith.constant 0 : i32; v22 = arith.eq v20, v21 : i1; v23 = arith.zext v22 : u32; v24 = hir.bitcast v23 : i32; - v26 = arith.neq v24, v653 : i1; + v26 = arith.neq v24, v655 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v651 = arith.constant 0 : i32; - v652 = arith.constant 0 : i32; - v28 = arith.eq v12, v652 : i1; + v653 = arith.constant 0 : i32; + v654 = arith.constant 0 : i32; + v28 = arith.eq v12, v654 : i1; v29 = arith.zext v28 : u32; v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v651 : i1; + v32 = arith.neq v30, v653 : i1; scf.if v32{ ^block92: scf.yield ; } else { ^block15: - v645 = arith.constant 0 : u8; + v647 = arith.constant 0 : u8; v35 = hir.bitcast v12 : u32; v36 = hir.bitcast v20 : u32; v37 = hir.int_to_ptr v36 : ptr; - hir.mem_set v37, v35, v645; + hir.mem_set v37, v35, v647; scf.yield ; }; scf.yield ; @@ -79,28 +79,31 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no v48 = hir.bitcast v47 : ptr; hir.store v48, v46; hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/wit_bindgen::rt::run_ctors_once() - v654 = arith.constant 0 : felt; + v51 = arith.constant 0 : i64; + v52 = arith.trunc v51 : felt; v49 = arith.constant 4 : i32; v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden_base_sys::bindings::input_note::get_assets(v50, v654) + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden_base_sys::bindings::input_note::get_assets(v50, v52) v54 = arith.constant 12 : u32; v53 = hir.bitcast v46 : u32; v55 = arith.add v53, v54 : u32 #[overflow = checked]; v56 = arith.constant 4 : u32; v57 = arith.mod v55, v56 : u32; hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i32; - v656 = arith.constant 4 : i32; - v62 = arith.add v46, v656 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/ as core::ops::drop::Drop>::drop(v62) - v655 = arith.constant 16 : i32; - v64 = arith.add v46, v655 : i32 #[overflow = wrapping]; - v65 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v66 = hir.bitcast v65 : ptr; - hir.store v66, v64; - v60 = hir.bitcast v59 : felt; - builtin.ret v60; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : u32; + v657 = arith.constant 4 : i32; + v64 = arith.add v46, v657 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/ as core::ops::drop::Drop>::drop(v64) + v656 = arith.constant 16 : i32; + v66 = arith.add v46, v656 : i32 #[overflow = wrapping]; + v67 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v68 = hir.bitcast v67 : ptr; + hir.store v68, v66; + v60 = arith.zext v59 : u64; + v61 = hir.bitcast v60 : i64; + v62 = arith.trunc v61 : felt; + builtin.ret v62; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -110,819 +113,819 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block22: - v68 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 1048588 : i32; - v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; - v73 = hir.bitcast v72 : u32; - v74 = hir.int_to_ptr v73 : ptr; - v75 = hir.load v74 : u8; - v67 = arith.constant 0 : i32; - v76 = arith.zext v75 : u32; - v77 = hir.bitcast v76 : i32; - v79 = arith.neq v77, v67 : i1; - scf.if v79{ + v70 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v71 = hir.bitcast v70 : ptr; + v72 = hir.load v71 : i32; + v73 = arith.constant 1048588 : i32; + v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; + v75 = hir.bitcast v74 : u32; + v76 = hir.int_to_ptr v75 : ptr; + v77 = hir.load v76 : u8; + v69 = arith.constant 0 : i32; + v78 = arith.zext v77 : u32; + v79 = hir.bitcast v78 : i32; + v81 = arith.neq v79, v69 : i1; + scf.if v81{ ^block24: scf.yield ; } else { ^block25: - v80 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v81 = hir.bitcast v80 : ptr; - v82 = hir.load v81 : i32; + v82 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__wasm_call_ctors() - v658 = arith.constant 1 : u8; - v660 = arith.constant 1048588 : i32; - v84 = arith.add v82, v660 : i32 #[overflow = wrapping]; - v88 = hir.bitcast v84 : u32; - v89 = hir.int_to_ptr v88 : ptr; - hir.store v89, v658; + v659 = arith.constant 1 : u8; + v661 = arith.constant 1048588 : i32; + v86 = arith.add v84, v661 : i32 #[overflow = wrapping]; + v90 = hir.bitcast v86 : u32; + v91 = hir.int_to_ptr v90 : ptr; + hir.store v91, v659; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v90: i32, v91: i32, v92: i32) -> i32 { - ^block26(v90: i32, v91: i32, v92: i32): - v95 = arith.constant 16 : i32; - v94 = arith.constant 0 : i32; - v662 = arith.constant 16 : u32; - v97 = hir.bitcast v91 : u32; - v99 = arith.gt v97, v662 : i1; - v100 = arith.zext v99 : u32; - v101 = hir.bitcast v100 : i32; - v103 = arith.neq v101, v94 : i1; - v104 = cf.select v103, v91, v95 : i32; - v702 = arith.constant 0 : i32; - v105 = arith.constant -1 : i32; - v106 = arith.add v104, v105 : i32 #[overflow = wrapping]; - v107 = arith.band v104, v106 : i32; - v109 = arith.neq v107, v702 : i1; - v671, v672 = scf.if v109 : i32, u32 { + private builtin.function @::alloc(v92: i32, v93: i32, v94: i32) -> i32 { + ^block26(v92: i32, v93: i32, v94: i32): + v97 = arith.constant 16 : i32; + v96 = arith.constant 0 : i32; + v663 = arith.constant 16 : u32; + v99 = hir.bitcast v93 : u32; + v101 = arith.gt v99, v663 : i1; + v102 = arith.zext v101 : u32; + v103 = hir.bitcast v102 : i32; + v105 = arith.neq v103, v96 : i1; + v106 = cf.select v105, v93, v97 : i32; + v703 = arith.constant 0 : i32; + v107 = arith.constant -1 : i32; + v108 = arith.add v106, v107 : i32 #[overflow = wrapping]; + v109 = arith.band v106, v108 : i32; + v111 = arith.neq v109, v703 : i1; + v672, v673 = scf.if v111 : i32, u32 { ^block98: - v663 = arith.constant 0 : u32; - v667 = ub.poison i32 : i32; - scf.yield v667, v663; + v664 = arith.constant 0 : u32; + v668 = ub.poison i32 : i32; + scf.yield v668, v664; } else { ^block29: - v111 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::max(v91, v104) : i32 - v701 = arith.constant 0 : i32; - v110 = arith.constant -2147483648 : i32; - v112 = arith.sub v110, v111 : i32 #[overflow = wrapping]; - v114 = hir.bitcast v112 : u32; - v113 = hir.bitcast v92 : u32; - v115 = arith.gt v113, v114 : i1; - v116 = arith.zext v115 : u32; - v117 = hir.bitcast v116 : i32; - v119 = arith.neq v117, v701 : i1; - v686 = scf.if v119 : i32 { + v113 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::max(v93, v106) : i32 + v702 = arith.constant 0 : i32; + v112 = arith.constant -2147483648 : i32; + v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; + v116 = hir.bitcast v114 : u32; + v115 = hir.bitcast v94 : u32; + v117 = arith.gt v115, v116 : i1; + v118 = arith.zext v117 : u32; + v119 = hir.bitcast v118 : i32; + v121 = arith.neq v119, v702 : i1; + v687 = scf.if v121 : i32 { ^block97: - v700 = ub.poison i32 : i32; - scf.yield v700; + v701 = ub.poison i32 : i32; + scf.yield v701; } else { ^block30: + v699 = arith.constant 0 : i32; + v127 = arith.sub v699, v113 : i32 #[overflow = wrapping]; + v700 = arith.constant -1 : i32; + v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; + v125 = arith.add v123, v700 : i32 #[overflow = wrapping]; + v128 = arith.band v125, v127 : i32; + v129 = hir.bitcast v92 : u32; + v130 = arith.constant 4 : u32; + v131 = arith.mod v129, v130 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i32; v698 = arith.constant 0 : i32; - v125 = arith.sub v698, v111 : i32 #[overflow = wrapping]; - v699 = arith.constant -1 : i32; - v121 = arith.add v92, v111 : i32 #[overflow = wrapping]; - v123 = arith.add v121, v699 : i32 #[overflow = wrapping]; - v126 = arith.band v123, v125 : i32; - v127 = hir.bitcast v90 : u32; - v128 = arith.constant 4 : u32; - v129 = arith.mod v127, v128 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i32; - v697 = arith.constant 0 : i32; - v133 = arith.neq v131, v697 : i1; - scf.if v133{ + v135 = arith.neq v133, v698 : i1; + scf.if v135{ ^block96: scf.yield ; } else { ^block32: - v134 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::mem::heap_base() : i32 - v135 = hir.mem_size : u32; - v141 = hir.bitcast v90 : u32; - v696 = arith.constant 4 : u32; - v143 = arith.mod v141, v696 : u32; - hir.assertz v143 #[code = 250]; - v695 = arith.constant 16 : u32; - v136 = hir.bitcast v135 : i32; - v139 = arith.shl v136, v695 : i32; - v140 = arith.add v134, v139 : i32 #[overflow = wrapping]; - v144 = hir.int_to_ptr v141 : ptr; - hir.store v144, v140; + v136 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/intrinsics::mem::heap_base() : i32 + v137 = hir.mem_size : u32; + v143 = hir.bitcast v92 : u32; + v697 = arith.constant 4 : u32; + v145 = arith.mod v143, v697 : u32; + hir.assertz v145 #[code = 250]; + v696 = arith.constant 16 : u32; + v138 = hir.bitcast v137 : i32; + v141 = arith.shl v138, v696 : i32; + v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v142; scf.yield ; }; - v147 = hir.bitcast v90 : u32; - v694 = arith.constant 4 : u32; - v149 = arith.mod v147, v694 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : i32; - v692 = arith.constant 0 : i32; - v693 = arith.constant -1 : i32; - v153 = arith.bxor v151, v693 : i32; - v155 = hir.bitcast v153 : u32; - v154 = hir.bitcast v126 : u32; - v156 = arith.gt v154, v155 : i1; - v157 = arith.zext v156 : u32; - v158 = hir.bitcast v157 : i32; - v160 = arith.neq v158, v692 : i1; - v685 = scf.if v160 : i32 { + v149 = hir.bitcast v92 : u32; + v695 = arith.constant 4 : u32; + v151 = arith.mod v149, v695 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v693 = arith.constant 0 : i32; + v694 = arith.constant -1 : i32; + v155 = arith.bxor v153, v694 : i32; + v157 = hir.bitcast v155 : u32; + v156 = hir.bitcast v128 : u32; + v158 = arith.gt v156, v157 : i1; + v159 = arith.zext v158 : u32; + v160 = hir.bitcast v159 : i32; + v162 = arith.neq v160, v693 : i1; + v686 = scf.if v162 : i32 { ^block33: - v691 = arith.constant 0 : i32; - scf.yield v691; + v692 = arith.constant 0 : i32; + scf.yield v692; } else { ^block34: - v162 = hir.bitcast v90 : u32; - v690 = arith.constant 4 : u32; - v164 = arith.mod v162, v690 : u32; - hir.assertz v164 #[code = 250]; - v161 = arith.add v151, v126 : i32 #[overflow = wrapping]; - v165 = hir.int_to_ptr v162 : ptr; - hir.store v165, v161; - v167 = arith.add v151, v111 : i32 #[overflow = wrapping]; - scf.yield v167; + v164 = hir.bitcast v92 : u32; + v691 = arith.constant 4 : u32; + v166 = arith.mod v164, v691 : u32; + hir.assertz v166 #[code = 250]; + v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; + v167 = hir.int_to_ptr v164 : ptr; + hir.store v167, v163; + v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; + scf.yield v169; }; - scf.yield v685; + scf.yield v686; }; - v668 = arith.constant 1 : u32; - v689 = arith.constant 0 : u32; - v687 = cf.select v119, v689, v668 : u32; - scf.yield v686, v687; + v669 = arith.constant 1 : u32; + v690 = arith.constant 0 : u32; + v688 = cf.select v121, v690, v669 : u32; + scf.yield v687, v688; }; - v688 = arith.constant 0 : u32; - v684 = arith.eq v672, v688 : i1; - cf.cond_br v684 ^block28, ^block100(v671); + v689 = arith.constant 0 : u32; + v685 = arith.eq v673, v689 : i1; + cf.cond_br v685 ^block28, ^block100(v672); ^block28: ub.unreachable ; - ^block100(v664: i32): - builtin.ret v664; + ^block100(v665: i32): + builtin.ret v665; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block35: - v170 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v170; + v172 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v172; }; - private builtin.function @>::with_capacity(v172: i32) { - ^block39(v172: i32): - v175 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v176 = hir.bitcast v175 : ptr; - v177 = hir.load v176 : i32; - v178 = arith.constant 16 : i32; - v179 = arith.sub v177, v178 : i32 #[overflow = wrapping]; - v180 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v181 = hir.bitcast v180 : ptr; - hir.store v181, v179; - v707 = arith.constant 16 : i32; - v184 = arith.constant 256 : i32; - v182 = arith.constant 8 : i32; - v183 = arith.add v179, v182 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::with_capacity_in(v183, v184, v707, v707) - v188 = arith.constant 8 : u32; - v187 = hir.bitcast v179 : u32; - v189 = arith.add v187, v188 : u32 #[overflow = checked]; + private builtin.function @>::with_capacity(v174: i32) { + ^block39(v174: i32): + v177 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v178 = hir.bitcast v177 : ptr; + v179 = hir.load v178 : i32; + v180 = arith.constant 16 : i32; + v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; + v182 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v183 = hir.bitcast v182 : ptr; + hir.store v183, v181; + v708 = arith.constant 16 : i32; + v186 = arith.constant 256 : i32; + v184 = arith.constant 8 : i32; + v185 = arith.add v181, v184 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::with_capacity_in(v185, v186, v708, v708) + v190 = arith.constant 8 : u32; + v189 = hir.bitcast v181 : u32; + v191 = arith.add v189, v190 : u32 #[overflow = checked]; + v707 = arith.constant 8 : u32; + v193 = arith.mod v191, v707 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + v195 = hir.load v194 : i64; v706 = arith.constant 8 : u32; - v191 = arith.mod v189, v706 : u32; - hir.assertz v191 #[code = 250]; - v192 = hir.int_to_ptr v189 : ptr; - v193 = hir.load v192 : i64; - v705 = arith.constant 8 : u32; - v195 = hir.bitcast v172 : u32; - v197 = arith.add v195, v705 : u32 #[overflow = checked]; - v198 = arith.constant 4 : u32; - v199 = arith.mod v197, v198 : u32; - hir.assertz v199 #[code = 250]; - v173 = arith.constant 0 : i32; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v173; - v201 = hir.bitcast v172 : u32; - v704 = arith.constant 4 : u32; - v203 = arith.mod v201, v704 : u32; - hir.assertz v203 #[code = 250]; - v204 = hir.int_to_ptr v201 : ptr; - hir.store v204, v193; - v703 = arith.constant 16 : i32; - v206 = arith.add v179, v703 : i32 #[overflow = wrapping]; - v207 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v208 = hir.bitcast v207 : ptr; - hir.store v208, v206; + v197 = hir.bitcast v174 : u32; + v199 = arith.add v197, v706 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v201 = arith.mod v199, v200 : u32; + hir.assertz v201 #[code = 250]; + v175 = arith.constant 0 : i32; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v175; + v203 = hir.bitcast v174 : u32; + v705 = arith.constant 4 : u32; + v205 = arith.mod v203, v705 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v195; + v704 = arith.constant 16 : i32; + v208 = arith.add v181, v704 : i32 #[overflow = wrapping]; + v209 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v210 = hir.bitcast v209 : ptr; + hir.store v210, v208; builtin.ret ; }; - private builtin.function @::with_capacity_in(v209: i32, v210: i32, v211: i32, v212: i32) { - ^block41(v209: i32, v210: i32, v211: i32, v212: i32): - v214 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v215 = hir.bitcast v214 : ptr; - v216 = hir.load v215 : i32; - v217 = arith.constant 16 : i32; - v218 = arith.sub v216, v217 : i32 #[overflow = wrapping]; - v219 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v220 = hir.bitcast v219 : ptr; - hir.store v220, v218; - v213 = arith.constant 0 : i32; - v221 = arith.constant 4 : i32; - v222 = arith.add v218, v221 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::try_allocate_in(v222, v210, v213, v211, v212) - v225 = arith.constant 8 : u32; - v224 = hir.bitcast v218 : u32; - v226 = arith.add v224, v225 : u32 #[overflow = checked]; - v227 = arith.constant 4 : u32; - v228 = arith.mod v226, v227 : u32; - hir.assertz v228 #[code = 250]; - v229 = hir.int_to_ptr v226 : ptr; - v230 = hir.load v229 : i32; + private builtin.function @::with_capacity_in(v211: i32, v212: i32, v213: i32, v214: i32) { + ^block41(v211: i32, v212: i32, v213: i32, v214: i32): + v216 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v217 = hir.bitcast v216 : ptr; + v218 = hir.load v217 : i32; + v219 = arith.constant 16 : i32; + v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; + v221 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v222 = hir.bitcast v221 : ptr; + hir.store v222, v220; + v215 = arith.constant 0 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v220, v223 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::try_allocate_in(v224, v212, v215, v213, v214) + v227 = arith.constant 8 : u32; + v226 = hir.bitcast v220 : u32; + v228 = arith.add v226, v227 : u32 #[overflow = checked]; + v229 = arith.constant 4 : u32; + v230 = arith.mod v228, v229 : u32; + hir.assertz v230 #[code = 250]; + v231 = hir.int_to_ptr v228 : ptr; + v232 = hir.load v231 : i32; + v719 = arith.constant 4 : u32; + v233 = hir.bitcast v220 : u32; + v235 = arith.add v233, v719 : u32 #[overflow = checked]; v718 = arith.constant 4 : u32; - v231 = hir.bitcast v218 : u32; - v233 = arith.add v231, v718 : u32 #[overflow = checked]; - v717 = arith.constant 4 : u32; - v235 = arith.mod v233, v717 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - v237 = hir.load v236 : i32; - v716 = arith.constant 0 : i32; - v238 = arith.constant 1 : i32; - v239 = arith.neq v237, v238 : i1; - v240 = arith.zext v239 : u32; - v241 = hir.bitcast v240 : i32; - v243 = arith.neq v241, v716 : i1; - cf.cond_br v243 ^block43, ^block44; + v237 = arith.mod v235, v718 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + v239 = hir.load v238 : i32; + v717 = arith.constant 0 : i32; + v240 = arith.constant 1 : i32; + v241 = arith.neq v239, v240 : i1; + v242 = arith.zext v241 : u32; + v243 = hir.bitcast v242 : i32; + v245 = arith.neq v243, v717 : i1; + cf.cond_br v245 ^block43, ^block44; ^block43: - v252 = arith.constant 12 : u32; - v251 = hir.bitcast v218 : u32; - v253 = arith.add v251, v252 : u32 #[overflow = checked]; + v254 = arith.constant 12 : u32; + v253 = hir.bitcast v220 : u32; + v255 = arith.add v253, v254 : u32 #[overflow = checked]; + v716 = arith.constant 4 : u32; + v257 = arith.mod v255, v716 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + v259 = hir.load v258 : i32; v715 = arith.constant 4 : u32; - v255 = arith.mod v253, v715 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - v257 = hir.load v256 : i32; + v260 = hir.bitcast v211 : u32; + v262 = arith.add v260, v715 : u32 #[overflow = checked]; v714 = arith.constant 4 : u32; - v258 = hir.bitcast v209 : u32; - v260 = arith.add v258, v714 : u32 #[overflow = checked]; + v264 = arith.mod v262, v714 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + hir.store v265, v259; + v266 = hir.bitcast v211 : u32; v713 = arith.constant 4 : u32; - v262 = arith.mod v260, v713 : u32; - hir.assertz v262 #[code = 250]; - v263 = hir.int_to_ptr v260 : ptr; - hir.store v263, v257; - v264 = hir.bitcast v209 : u32; - v712 = arith.constant 4 : u32; - v266 = arith.mod v264, v712 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - hir.store v267, v230; - v711 = arith.constant 16 : i32; - v269 = arith.add v218, v711 : i32 #[overflow = wrapping]; - v270 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v271 = hir.bitcast v270 : ptr; - hir.store v271, v269; + v268 = arith.mod v266, v713 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v232; + v712 = arith.constant 16 : i32; + v271 = arith.add v220, v712 : i32 #[overflow = wrapping]; + v272 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v273 = hir.bitcast v272 : ptr; + hir.store v273, v271; builtin.ret ; ^block44: - v710 = arith.constant 12 : u32; - v244 = hir.bitcast v218 : u32; - v246 = arith.add v244, v710 : u32 #[overflow = checked]; - v709 = arith.constant 4 : u32; - v248 = arith.mod v246, v709 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - v250 = hir.load v249 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::handle_error(v230, v250) + v711 = arith.constant 12 : u32; + v246 = hir.bitcast v220 : u32; + v248 = arith.add v246, v711 : u32 #[overflow = checked]; + v710 = arith.constant 4 : u32; + v250 = arith.mod v248, v710 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + v252 = hir.load v251 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/alloc::raw_vec::handle_error(v232, v252) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::input_note::get_assets(v272: i32, v273: felt) { - ^block45(v272: i32, v273: felt): - v275 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v276 = hir.bitcast v275 : ptr; - v277 = hir.load v276 : i32; - v278 = arith.constant 16 : i32; - v279 = arith.sub v277, v278 : i32 #[overflow = wrapping]; - v280 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v281 = hir.bitcast v280 : ptr; - hir.store v281, v279; - v282 = arith.constant 4 : i32; - v283 = arith.add v279, v282 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/>::with_capacity(v283) - v287 = arith.constant 8 : u32; - v286 = hir.bitcast v279 : u32; - v288 = arith.add v286, v287 : u32 #[overflow = checked]; - v289 = arith.constant 4 : u32; - v290 = arith.mod v288, v289 : u32; - hir.assertz v290 #[code = 250]; - v291 = hir.int_to_ptr v288 : ptr; - v292 = hir.load v291 : i32; - v719 = arith.constant 2 : u32; - v294 = hir.bitcast v292 : u32; - v296 = arith.shr v294, v719 : u32; - v297 = hir.bitcast v296 : i32; - v298 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden::protocol::input_note::get_assets(v297, v273) : i32 - v284 = arith.constant 8 : i32; - v285 = arith.add v272, v284 : i32 #[overflow = wrapping]; - v299 = hir.bitcast v285 : u32; + private builtin.function @miden_base_sys::bindings::input_note::get_assets(v274: i32, v275: felt) { + ^block45(v274: i32, v275: felt): + v277 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v278 = hir.bitcast v277 : ptr; + v279 = hir.load v278 : i32; + v280 = arith.constant 16 : i32; + v281 = arith.sub v279, v280 : i32 #[overflow = wrapping]; + v282 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v283 = hir.bitcast v282 : ptr; + hir.store v283, v281; + v284 = arith.constant 4 : i32; + v285 = arith.add v281, v284 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/>::with_capacity(v285) + v289 = arith.constant 8 : u32; + v288 = hir.bitcast v281 : u32; + v290 = arith.add v288, v289 : u32 #[overflow = checked]; + v291 = arith.constant 4 : u32; + v292 = arith.mod v290, v291 : u32; + hir.assertz v292 #[code = 250]; + v293 = hir.int_to_ptr v290 : ptr; + v294 = hir.load v293 : i32; + v720 = arith.constant 2 : u32; + v296 = hir.bitcast v294 : u32; + v298 = arith.shr v296, v720 : u32; + v299 = hir.bitcast v298 : i32; + v300 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden::protocol::input_note::get_assets(v299, v275) : i32 + v286 = arith.constant 8 : i32; + v287 = arith.add v274, v286 : i32 #[overflow = wrapping]; + v301 = hir.bitcast v287 : u32; + v725 = arith.constant 4 : u32; + v303 = arith.mod v301, v725 : u32; + hir.assertz v303 #[code = 250]; + v304 = hir.int_to_ptr v301 : ptr; + hir.store v304, v300; v724 = arith.constant 4 : u32; - v301 = arith.mod v299, v724 : u32; - hir.assertz v301 #[code = 250]; - v302 = hir.int_to_ptr v299 : ptr; - hir.store v302, v298; + v305 = hir.bitcast v281 : u32; + v307 = arith.add v305, v724 : u32 #[overflow = checked]; v723 = arith.constant 4 : u32; - v303 = hir.bitcast v279 : u32; - v305 = arith.add v303, v723 : u32 #[overflow = checked]; + v309 = arith.mod v307, v723 : u32; + hir.assertz v309 #[code = 250]; + v310 = hir.int_to_ptr v307 : ptr; + v311 = hir.load v310 : i64; + v312 = hir.bitcast v274 : u32; v722 = arith.constant 4 : u32; - v307 = arith.mod v305, v722 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - v309 = hir.load v308 : i64; - v310 = hir.bitcast v272 : u32; - v721 = arith.constant 4 : u32; - v312 = arith.mod v310, v721 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - hir.store v313, v309; - v720 = arith.constant 16 : i32; - v315 = arith.add v279, v720 : i32 #[overflow = wrapping]; - v316 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v317 = hir.bitcast v316 : ptr; - hir.store v317, v315; + v314 = arith.mod v312, v722 : u32; + hir.assertz v314 #[code = 250]; + v315 = hir.int_to_ptr v312 : ptr; + hir.store v315, v311; + v721 = arith.constant 16 : i32; + v317 = arith.add v281, v721 : i32 #[overflow = wrapping]; + v318 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v319 = hir.bitcast v318 : ptr; + hir.store v319, v317; builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v318: i32) { - ^block47(v318: i32): - v319 = arith.constant 16 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v318, v319, v319) + private builtin.function @ as core::ops::drop::Drop>::drop(v320: i32) { + ^block47(v320: i32): + v321 = arith.constant 16 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v320, v321, v321) builtin.ret ; }; - private builtin.function @::alloc_impl(v321: i32, v322: i32, v323: i32, v324: i32) { - ^block49(v321: i32, v322: i32, v323: i32, v324: i32): - v740 = arith.constant 0 : i32; - v325 = arith.constant 0 : i32; - v326 = arith.eq v323, v325 : i1; - v327 = arith.zext v326 : u32; - v328 = hir.bitcast v327 : i32; - v330 = arith.neq v328, v740 : i1; - v736 = scf.if v330 : i32 { + private builtin.function @::alloc_impl(v323: i32, v324: i32, v325: i32, v326: i32) { + ^block49(v323: i32, v324: i32, v325: i32, v326: i32): + v741 = arith.constant 0 : i32; + v327 = arith.constant 0 : i32; + v328 = arith.eq v325, v327 : i1; + v329 = arith.zext v328 : u32; + v330 = hir.bitcast v329 : i32; + v332 = arith.neq v330, v741 : i1; + v737 = scf.if v332 : i32 { ^block106: - scf.yield v322; + scf.yield v324; } else { ^block52: hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v739 = arith.constant 0 : i32; - v332 = arith.neq v324, v739 : i1; - v735 = scf.if v332 : i32 { + v740 = arith.constant 0 : i32; + v334 = arith.neq v326, v740 : i1; + v736 = scf.if v334 : i32 { ^block53: - v334 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v323, v322) : i32 - scf.yield v334; + v336 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v325, v324) : i32 + scf.yield v336; } else { ^block54: - v333 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc(v323, v322) : i32 - scf.yield v333; + v335 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_alloc(v325, v324) : i32 + scf.yield v335; }; - scf.yield v735; + scf.yield v736; }; - v338 = arith.constant 4 : u32; - v337 = hir.bitcast v321 : u32; - v339 = arith.add v337, v338 : u32 #[overflow = checked]; + v340 = arith.constant 4 : u32; + v339 = hir.bitcast v323 : u32; + v341 = arith.add v339, v340 : u32 #[overflow = checked]; + v739 = arith.constant 4 : u32; + v343 = arith.mod v341, v739 : u32; + hir.assertz v343 #[code = 250]; + v344 = hir.int_to_ptr v341 : ptr; + hir.store v344, v325; + v346 = hir.bitcast v323 : u32; v738 = arith.constant 4 : u32; - v341 = arith.mod v339, v738 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v323; - v344 = hir.bitcast v321 : u32; - v737 = arith.constant 4 : u32; - v346 = arith.mod v344, v737 : u32; - hir.assertz v346 #[code = 250]; - v347 = hir.int_to_ptr v344 : ptr; - hir.store v347, v736; + v348 = arith.mod v346, v738 : u32; + hir.assertz v348 #[code = 250]; + v349 = hir.int_to_ptr v346 : ptr; + hir.store v349, v737; builtin.ret ; }; - private builtin.function @::deallocate(v348: i32, v349: i32, v350: i32) { - ^block55(v348: i32, v349: i32, v350: i32): - v352 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v353 = hir.bitcast v352 : ptr; - v354 = hir.load v353 : i32; - v355 = arith.constant 16 : i32; - v356 = arith.sub v354, v355 : i32 #[overflow = wrapping]; - v357 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v358 = hir.bitcast v357 : ptr; - hir.store v358, v356; - v359 = arith.constant 4 : i32; - v360 = arith.add v356, v359 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::current_memory(v360, v348, v349, v350) - v362 = arith.constant 8 : u32; - v361 = hir.bitcast v356 : u32; - v363 = arith.add v361, v362 : u32 #[overflow = checked]; - v364 = arith.constant 4 : u32; - v365 = arith.mod v363, v364 : u32; - hir.assertz v365 #[code = 250]; - v366 = hir.int_to_ptr v363 : ptr; - v367 = hir.load v366 : i32; - v747 = arith.constant 0 : i32; - v351 = arith.constant 0 : i32; - v369 = arith.eq v367, v351 : i1; - v370 = arith.zext v369 : u32; - v371 = hir.bitcast v370 : i32; - v373 = arith.neq v371, v747 : i1; - scf.if v373{ + private builtin.function @::deallocate(v350: i32, v351: i32, v352: i32) { + ^block55(v350: i32, v351: i32, v352: i32): + v354 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v355 = hir.bitcast v354 : ptr; + v356 = hir.load v355 : i32; + v357 = arith.constant 16 : i32; + v358 = arith.sub v356, v357 : i32 #[overflow = wrapping]; + v359 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v360 = hir.bitcast v359 : ptr; + hir.store v360, v358; + v361 = arith.constant 4 : i32; + v362 = arith.add v358, v361 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::current_memory(v362, v350, v351, v352) + v364 = arith.constant 8 : u32; + v363 = hir.bitcast v358 : u32; + v365 = arith.add v363, v364 : u32 #[overflow = checked]; + v366 = arith.constant 4 : u32; + v367 = arith.mod v365, v366 : u32; + hir.assertz v367 #[code = 250]; + v368 = hir.int_to_ptr v365 : ptr; + v369 = hir.load v368 : i32; + v748 = arith.constant 0 : i32; + v353 = arith.constant 0 : i32; + v371 = arith.eq v369, v353 : i1; + v372 = arith.zext v371 : u32; + v373 = hir.bitcast v372 : i32; + v375 = arith.neq v373, v748 : i1; + scf.if v375{ ^block109: scf.yield ; } else { ^block58: + v747 = arith.constant 4 : u32; + v376 = hir.bitcast v358 : u32; + v378 = arith.add v376, v747 : u32 #[overflow = checked]; v746 = arith.constant 4 : u32; - v374 = hir.bitcast v356 : u32; - v376 = arith.add v374, v746 : u32 #[overflow = checked]; + v380 = arith.mod v378, v746 : u32; + hir.assertz v380 #[code = 250]; + v381 = hir.int_to_ptr v378 : ptr; + v382 = hir.load v381 : i32; + v384 = arith.constant 12 : u32; + v383 = hir.bitcast v358 : u32; + v385 = arith.add v383, v384 : u32 #[overflow = checked]; v745 = arith.constant 4 : u32; - v378 = arith.mod v376, v745 : u32; - hir.assertz v378 #[code = 250]; - v379 = hir.int_to_ptr v376 : ptr; - v380 = hir.load v379 : i32; - v382 = arith.constant 12 : u32; - v381 = hir.bitcast v356 : u32; - v383 = arith.add v381, v382 : u32 #[overflow = checked]; - v744 = arith.constant 4 : u32; - v385 = arith.mod v383, v744 : u32; - hir.assertz v385 #[code = 250]; - v386 = hir.int_to_ptr v383 : ptr; - v387 = hir.load v386 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v380, v367, v387) + v387 = arith.mod v385, v745 : u32; + hir.assertz v387 #[code = 250]; + v388 = hir.int_to_ptr v385 : ptr; + v389 = hir.load v388 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::deallocate(v382, v369, v389) scf.yield ; }; - v743 = arith.constant 16 : i32; - v390 = arith.add v356, v743 : i32 #[overflow = wrapping]; - v391 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v392 = hir.bitcast v391 : ptr; - hir.store v392, v390; + v744 = arith.constant 16 : i32; + v392 = arith.add v358, v744 : i32 #[overflow = wrapping]; + v393 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v394 = hir.bitcast v393 : ptr; + hir.store v394, v392; builtin.ret ; }; - private builtin.function @::current_memory(v393: i32, v394: i32, v395: i32, v396: i32) { - ^block59(v393: i32, v394: i32, v395: i32, v396: i32): - v773 = arith.constant 0 : i32; - v397 = arith.constant 0 : i32; - v401 = arith.eq v396, v397 : i1; - v402 = arith.zext v401 : u32; - v403 = hir.bitcast v402 : i32; - v405 = arith.neq v403, v773 : i1; - v760, v761 = scf.if v405 : i32, i32 { + private builtin.function @::current_memory(v395: i32, v396: i32, v397: i32, v398: i32) { + ^block59(v395: i32, v396: i32, v397: i32, v398: i32): + v774 = arith.constant 0 : i32; + v399 = arith.constant 0 : i32; + v403 = arith.eq v398, v399 : i1; + v404 = arith.zext v403 : u32; + v405 = hir.bitcast v404 : i32; + v407 = arith.neq v405, v774 : i1; + v761, v762 = scf.if v407 : i32, i32 { ^block112: - v772 = arith.constant 0 : i32; - v399 = arith.constant 4 : i32; - scf.yield v399, v772; + v773 = arith.constant 0 : i32; + v401 = arith.constant 4 : i32; + scf.yield v401, v773; } else { ^block62: - v406 = hir.bitcast v394 : u32; - v441 = arith.constant 4 : u32; - v408 = arith.mod v406, v441 : u32; - hir.assertz v408 #[code = 250]; - v409 = hir.int_to_ptr v406 : ptr; - v410 = hir.load v409 : i32; - v770 = arith.constant 0 : i32; + v408 = hir.bitcast v396 : u32; + v443 = arith.constant 4 : u32; + v410 = arith.mod v408, v443 : u32; + hir.assertz v410 #[code = 250]; + v411 = hir.int_to_ptr v408 : ptr; + v412 = hir.load v411 : i32; v771 = arith.constant 0 : i32; - v412 = arith.eq v410, v771 : i1; - v413 = arith.zext v412 : u32; - v414 = hir.bitcast v413 : i32; - v416 = arith.neq v414, v770 : i1; - v758 = scf.if v416 : i32 { + v772 = arith.constant 0 : i32; + v414 = arith.eq v412, v772 : i1; + v415 = arith.zext v414 : u32; + v416 = hir.bitcast v415 : i32; + v418 = arith.neq v416, v771 : i1; + v759 = scf.if v418 : i32 { ^block111: - v769 = arith.constant 0 : i32; - scf.yield v769; + v770 = arith.constant 0 : i32; + scf.yield v770; } else { ^block63: + v769 = arith.constant 4 : u32; + v419 = hir.bitcast v395 : u32; + v421 = arith.add v419, v769 : u32 #[overflow = checked]; v768 = arith.constant 4 : u32; - v417 = hir.bitcast v393 : u32; - v419 = arith.add v417, v768 : u32 #[overflow = checked]; + v423 = arith.mod v421, v768 : u32; + hir.assertz v423 #[code = 250]; + v424 = hir.int_to_ptr v421 : ptr; + hir.store v424, v397; v767 = arith.constant 4 : u32; - v421 = arith.mod v419, v767 : u32; - hir.assertz v421 #[code = 250]; - v422 = hir.int_to_ptr v419 : ptr; - hir.store v422, v395; + v425 = hir.bitcast v396 : u32; + v427 = arith.add v425, v767 : u32 #[overflow = checked]; v766 = arith.constant 4 : u32; - v423 = hir.bitcast v394 : u32; - v425 = arith.add v423, v766 : u32 #[overflow = checked]; + v429 = arith.mod v427, v766 : u32; + hir.assertz v429 #[code = 250]; + v430 = hir.int_to_ptr v427 : ptr; + v431 = hir.load v430 : i32; + v432 = hir.bitcast v395 : u32; v765 = arith.constant 4 : u32; - v427 = arith.mod v425, v765 : u32; - hir.assertz v427 #[code = 250]; - v428 = hir.int_to_ptr v425 : ptr; - v429 = hir.load v428 : i32; - v430 = hir.bitcast v393 : u32; - v764 = arith.constant 4 : u32; - v432 = arith.mod v430, v764 : u32; - hir.assertz v432 #[code = 250]; - v433 = hir.int_to_ptr v430 : ptr; - hir.store v433, v429; - v434 = arith.mul v410, v396 : i32 #[overflow = wrapping]; - scf.yield v434; + v434 = arith.mod v432, v765 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + hir.store v435, v431; + v436 = arith.mul v412, v398 : i32 #[overflow = wrapping]; + scf.yield v436; }; - v435 = arith.constant 8 : i32; - v763 = arith.constant 4 : i32; - v759 = cf.select v416, v763, v435 : i32; - scf.yield v759, v758; + v437 = arith.constant 8 : i32; + v764 = arith.constant 4 : i32; + v760 = cf.select v418, v764, v437 : i32; + scf.yield v760, v759; }; - v438 = arith.add v393, v760 : i32 #[overflow = wrapping]; - v440 = hir.bitcast v438 : u32; - v762 = arith.constant 4 : u32; - v442 = arith.mod v440, v762 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v761; + v440 = arith.add v395, v761 : i32 #[overflow = wrapping]; + v442 = hir.bitcast v440 : u32; + v763 = arith.constant 4 : u32; + v444 = arith.mod v442, v763 : u32; + hir.assertz v444 #[code = 250]; + v445 = hir.int_to_ptr v442 : ptr; + hir.store v445, v762; builtin.ret ; }; - private builtin.function @::deallocate(v444: i32, v445: i32, v446: i32) { - ^block64(v444: i32, v445: i32, v446: i32): - v775 = arith.constant 0 : i32; - v447 = arith.constant 0 : i32; - v448 = arith.eq v446, v447 : i1; - v449 = arith.zext v448 : u32; - v450 = hir.bitcast v449 : i32; - v452 = arith.neq v450, v775 : i1; - scf.if v452{ + private builtin.function @::deallocate(v446: i32, v447: i32, v448: i32) { + ^block64(v446: i32, v447: i32, v448: i32): + v776 = arith.constant 0 : i32; + v449 = arith.constant 0 : i32; + v450 = arith.eq v448, v449 : i1; + v451 = arith.zext v450 : u32; + v452 = hir.bitcast v451 : i32; + v454 = arith.neq v452, v776 : i1; + scf.if v454{ ^block66: scf.yield ; } else { ^block67: - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_dealloc(v444, v446, v445) + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__rustc::__rust_dealloc(v446, v448, v447) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v453: i32, v454: i32, v455: i32) { - ^block68(v453: i32, v454: i32, v455: i32): - v457 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v458 = hir.bitcast v457 : ptr; - v459 = hir.load v458 : i32; - v460 = arith.constant 16 : i32; - v461 = arith.sub v459, v460 : i32 #[overflow = wrapping]; - v462 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v463 = hir.bitcast v462 : ptr; - hir.store v463, v461; - v456 = arith.constant 0 : i32; - v464 = arith.constant 8 : i32; - v465 = arith.add v461, v464 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v465, v454, v455, v456) - v468 = arith.constant 12 : u32; - v467 = hir.bitcast v461 : u32; - v469 = arith.add v467, v468 : u32 #[overflow = checked]; - v470 = arith.constant 4 : u32; - v471 = arith.mod v469, v470 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - v473 = hir.load v472 : i32; - v475 = arith.constant 8 : u32; - v474 = hir.bitcast v461 : u32; - v476 = arith.add v474, v475 : u32 #[overflow = checked]; + private builtin.function @::allocate(v455: i32, v456: i32, v457: i32) { + ^block68(v455: i32, v456: i32, v457: i32): + v459 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v460 = hir.bitcast v459 : ptr; + v461 = hir.load v460 : i32; + v462 = arith.constant 16 : i32; + v463 = arith.sub v461, v462 : i32 #[overflow = wrapping]; + v464 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v465 = hir.bitcast v464 : ptr; + hir.store v465, v463; + v458 = arith.constant 0 : i32; + v466 = arith.constant 8 : i32; + v467 = arith.add v463, v466 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v467, v456, v457, v458) + v470 = arith.constant 12 : u32; + v469 = hir.bitcast v463 : u32; + v471 = arith.add v469, v470 : u32 #[overflow = checked]; + v472 = arith.constant 4 : u32; + v473 = arith.mod v471, v472 : u32; + hir.assertz v473 #[code = 250]; + v474 = hir.int_to_ptr v471 : ptr; + v475 = hir.load v474 : i32; + v477 = arith.constant 8 : u32; + v476 = hir.bitcast v463 : u32; + v478 = arith.add v476, v477 : u32 #[overflow = checked]; + v781 = arith.constant 4 : u32; + v480 = arith.mod v478, v781 : u32; + hir.assertz v480 #[code = 250]; + v481 = hir.int_to_ptr v478 : ptr; + v482 = hir.load v481 : i32; + v483 = hir.bitcast v455 : u32; v780 = arith.constant 4 : u32; - v478 = arith.mod v476, v780 : u32; - hir.assertz v478 #[code = 250]; - v479 = hir.int_to_ptr v476 : ptr; - v480 = hir.load v479 : i32; - v481 = hir.bitcast v453 : u32; + v485 = arith.mod v483, v780 : u32; + hir.assertz v485 #[code = 250]; + v486 = hir.int_to_ptr v483 : ptr; + hir.store v486, v482; v779 = arith.constant 4 : u32; - v483 = arith.mod v481, v779 : u32; - hir.assertz v483 #[code = 250]; - v484 = hir.int_to_ptr v481 : ptr; - hir.store v484, v480; + v487 = hir.bitcast v455 : u32; + v489 = arith.add v487, v779 : u32 #[overflow = checked]; v778 = arith.constant 4 : u32; - v485 = hir.bitcast v453 : u32; - v487 = arith.add v485, v778 : u32 #[overflow = checked]; - v777 = arith.constant 4 : u32; - v489 = arith.mod v487, v777 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - hir.store v490, v473; - v776 = arith.constant 16 : i32; - v492 = arith.add v461, v776 : i32 #[overflow = wrapping]; - v493 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v494 = hir.bitcast v493 : ptr; - hir.store v494, v492; + v491 = arith.mod v489, v778 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + hir.store v492, v475; + v777 = arith.constant 16 : i32; + v494 = arith.add v463, v777 : i32 #[overflow = wrapping]; + v495 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v496 = hir.bitcast v495 : ptr; + hir.store v496, v494; builtin.ret ; }; - private builtin.function @::try_allocate_in(v495: i32, v496: i32, v497: i32, v498: i32, v499: i32) { - ^block70(v495: i32, v496: i32, v497: i32, v498: i32, v499: i32): - v502 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v503 = hir.bitcast v502 : ptr; - v504 = hir.load v503 : i32; - v505 = arith.constant 16 : i32; - v506 = arith.sub v504, v505 : i32 #[overflow = wrapping]; - v507 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v508 = hir.bitcast v507 : ptr; - hir.store v508, v506; - v518 = hir.bitcast v496 : u32; - v519 = arith.zext v518 : u64; - v520 = hir.bitcast v519 : i64; - v500 = arith.constant 0 : i32; - v513 = arith.sub v500, v498 : i32 #[overflow = wrapping]; - v510 = arith.constant -1 : i32; - v509 = arith.add v498, v499 : i32 #[overflow = wrapping]; - v511 = arith.add v509, v510 : i32 #[overflow = wrapping]; - v514 = arith.band v511, v513 : i32; - v515 = hir.bitcast v514 : u32; - v516 = arith.zext v515 : u64; - v517 = hir.bitcast v516 : i64; - v521 = arith.mul v517, v520 : i64 #[overflow = wrapping]; - v883 = arith.constant 0 : i32; - v522 = arith.constant 32 : i64; - v524 = hir.cast v522 : u32; - v523 = hir.bitcast v521 : u64; - v525 = arith.shr v523, v524 : u64; - v526 = hir.bitcast v525 : i64; - v527 = arith.trunc v526 : i32; - v529 = arith.neq v527, v883 : i1; - v796, v797, v798, v799, v800, v801 = scf.if v529 : i32, i32, i32, i32, i32, u32 { + private builtin.function @::try_allocate_in(v497: i32, v498: i32, v499: i32, v500: i32, v501: i32) { + ^block70(v497: i32, v498: i32, v499: i32, v500: i32, v501: i32): + v504 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v505 = hir.bitcast v504 : ptr; + v506 = hir.load v505 : i32; + v507 = arith.constant 16 : i32; + v508 = arith.sub v506, v507 : i32 #[overflow = wrapping]; + v509 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v510 = hir.bitcast v509 : ptr; + hir.store v510, v508; + v520 = hir.bitcast v498 : u32; + v521 = arith.zext v520 : u64; + v522 = hir.bitcast v521 : i64; + v502 = arith.constant 0 : i32; + v515 = arith.sub v502, v500 : i32 #[overflow = wrapping]; + v512 = arith.constant -1 : i32; + v511 = arith.add v500, v501 : i32 #[overflow = wrapping]; + v513 = arith.add v511, v512 : i32 #[overflow = wrapping]; + v516 = arith.band v513, v515 : i32; + v517 = hir.bitcast v516 : u32; + v518 = arith.zext v517 : u64; + v519 = hir.bitcast v518 : i64; + v523 = arith.mul v519, v522 : i64 #[overflow = wrapping]; + v884 = arith.constant 0 : i32; + v524 = arith.constant 32 : i64; + v526 = hir.cast v524 : u32; + v525 = hir.bitcast v523 : u64; + v527 = arith.shr v525, v526 : u64; + v528 = hir.bitcast v527 : i64; + v529 = arith.trunc v528 : i32; + v531 = arith.neq v529, v884 : i1; + v797, v798, v799, v800, v801, v802 = scf.if v531 : i32, i32, i32, i32, i32, u32 { ^block116: - v781 = arith.constant 0 : u32; - v788 = ub.poison i32 : i32; - scf.yield v495, v506, v788, v788, v788, v781; + v782 = arith.constant 0 : u32; + v789 = ub.poison i32 : i32; + scf.yield v497, v508, v789, v789, v789, v782; } else { ^block75: - v530 = arith.trunc v521 : i32; - v882 = arith.constant 0 : i32; - v531 = arith.constant -2147483648 : i32; - v532 = arith.sub v531, v498 : i32 #[overflow = wrapping]; - v534 = hir.bitcast v532 : u32; - v533 = hir.bitcast v530 : u32; - v535 = arith.lte v533, v534 : i1; - v536 = arith.zext v535 : u32; - v537 = hir.bitcast v536 : i32; - v539 = arith.neq v537, v882 : i1; - v844 = scf.if v539 : i32 { + v532 = arith.trunc v523 : i32; + v883 = arith.constant 0 : i32; + v533 = arith.constant -2147483648 : i32; + v534 = arith.sub v533, v500 : i32 #[overflow = wrapping]; + v536 = hir.bitcast v534 : u32; + v535 = hir.bitcast v532 : u32; + v537 = arith.lte v535, v536 : i1; + v538 = arith.zext v537 : u32; + v539 = hir.bitcast v538 : i32; + v541 = arith.neq v539, v883 : i1; + v845 = scf.if v541 : i32 { ^block73: - v881 = arith.constant 0 : i32; - v550 = arith.neq v530, v881 : i1; - v843 = scf.if v550 : i32 { + v882 = arith.constant 0 : i32; + v552 = arith.neq v532, v882 : i1; + v844 = scf.if v552 : i32 { ^block77: - v880 = arith.constant 0 : i32; - v566 = arith.neq v497, v880 : i1; - v842 = scf.if v566 : i32 { + v881 = arith.constant 0 : i32; + v568 = arith.neq v499, v881 : i1; + v843 = scf.if v568 : i32 { ^block80: - v548 = arith.constant 1 : i32; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v506, v498, v530, v548) - v577 = hir.bitcast v506 : u32; - v618 = arith.constant 4 : u32; - v579 = arith.mod v577, v618 : u32; - hir.assertz v579 #[code = 250]; - v580 = hir.int_to_ptr v577 : ptr; - v581 = hir.load v580 : i32; - scf.yield v581; + v550 = arith.constant 1 : i32; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::alloc_impl(v508, v500, v532, v550) + v579 = hir.bitcast v508 : u32; + v620 = arith.constant 4 : u32; + v581 = arith.mod v579, v620 : u32; + hir.assertz v581 #[code = 250]; + v582 = hir.int_to_ptr v579 : ptr; + v583 = hir.load v582 : i32; + scf.yield v583; } else { ^block81: - v567 = arith.constant 8 : i32; - v568 = arith.add v506, v567 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::allocate(v568, v498, v530) - v552 = arith.constant 8 : u32; - v569 = hir.bitcast v506 : u32; - v571 = arith.add v569, v552 : u32 #[overflow = checked]; - v879 = arith.constant 4 : u32; - v573 = arith.mod v571, v879 : u32; - hir.assertz v573 #[code = 250]; - v574 = hir.int_to_ptr v571 : ptr; - v575 = hir.load v574 : i32; - scf.yield v575; + v569 = arith.constant 8 : i32; + v570 = arith.add v508, v569 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/::allocate(v570, v500, v532) + v554 = arith.constant 8 : u32; + v571 = hir.bitcast v508 : u32; + v573 = arith.add v571, v554 : u32 #[overflow = checked]; + v880 = arith.constant 4 : u32; + v575 = arith.mod v573, v880 : u32; + hir.assertz v575 #[code = 250]; + v576 = hir.int_to_ptr v573 : ptr; + v577 = hir.load v576 : i32; + scf.yield v577; }; - v878 = arith.constant 0 : i32; - v584 = arith.neq v842, v878 : i1; - scf.if v584{ + v879 = arith.constant 0 : i32; + v586 = arith.neq v843, v879 : i1; + scf.if v586{ ^block82: - v877 = arith.constant 8 : u32; - v601 = hir.bitcast v495 : u32; - v603 = arith.add v601, v877 : u32 #[overflow = checked]; + v878 = arith.constant 8 : u32; + v603 = hir.bitcast v497 : u32; + v605 = arith.add v603, v878 : u32 #[overflow = checked]; + v877 = arith.constant 4 : u32; + v607 = arith.mod v605, v877 : u32; + hir.assertz v607 #[code = 250]; + v608 = hir.int_to_ptr v605 : ptr; + hir.store v608, v843; v876 = arith.constant 4 : u32; - v605 = arith.mod v603, v876 : u32; - hir.assertz v605 #[code = 250]; - v606 = hir.int_to_ptr v603 : ptr; - hir.store v606, v842; + v610 = hir.bitcast v497 : u32; + v612 = arith.add v610, v876 : u32 #[overflow = checked]; v875 = arith.constant 4 : u32; - v608 = hir.bitcast v495 : u32; - v610 = arith.add v608, v875 : u32 #[overflow = checked]; - v874 = arith.constant 4 : u32; - v612 = arith.mod v610, v874 : u32; - hir.assertz v612 #[code = 250]; - v613 = hir.int_to_ptr v610 : ptr; - hir.store v613, v496; + v614 = arith.mod v612, v875 : u32; + hir.assertz v614 #[code = 250]; + v615 = hir.int_to_ptr v612 : ptr; + hir.store v615, v498; scf.yield ; } else { ^block83: - v873 = arith.constant 8 : u32; - v587 = hir.bitcast v495 : u32; - v589 = arith.add v587, v873 : u32 #[overflow = checked]; + v874 = arith.constant 8 : u32; + v589 = hir.bitcast v497 : u32; + v591 = arith.add v589, v874 : u32 #[overflow = checked]; + v873 = arith.constant 4 : u32; + v593 = arith.mod v591, v873 : u32; + hir.assertz v593 #[code = 250]; + v594 = hir.int_to_ptr v591 : ptr; + hir.store v594, v532; v872 = arith.constant 4 : u32; - v591 = arith.mod v589, v872 : u32; - hir.assertz v591 #[code = 250]; - v592 = hir.int_to_ptr v589 : ptr; - hir.store v592, v530; + v596 = hir.bitcast v497 : u32; + v598 = arith.add v596, v872 : u32 #[overflow = checked]; v871 = arith.constant 4 : u32; - v594 = hir.bitcast v495 : u32; - v596 = arith.add v594, v871 : u32 #[overflow = checked]; - v870 = arith.constant 4 : u32; - v598 = arith.mod v596, v870 : u32; - hir.assertz v598 #[code = 250]; - v599 = hir.int_to_ptr v596 : ptr; - hir.store v599, v498; + v600 = arith.mod v598, v871 : u32; + hir.assertz v600 #[code = 250]; + v601 = hir.int_to_ptr v598 : ptr; + hir.store v601, v500; scf.yield ; }; - v868 = arith.constant 1 : i32; - v869 = arith.constant 0 : i32; - v841 = cf.select v584, v869, v868 : i32; - scf.yield v841; + v869 = arith.constant 1 : i32; + v870 = arith.constant 0 : i32; + v842 = cf.select v586, v870, v869 : i32; + scf.yield v842; } else { ^block78: - v867 = arith.constant 8 : u32; - v551 = hir.bitcast v495 : u32; - v553 = arith.add v551, v867 : u32 #[overflow = checked]; + v868 = arith.constant 8 : u32; + v553 = hir.bitcast v497 : u32; + v555 = arith.add v553, v868 : u32 #[overflow = checked]; + v867 = arith.constant 4 : u32; + v557 = arith.mod v555, v867 : u32; + hir.assertz v557 #[code = 250]; + v558 = hir.int_to_ptr v555 : ptr; + hir.store v558, v500; v866 = arith.constant 4 : u32; - v555 = arith.mod v553, v866 : u32; - hir.assertz v555 #[code = 250]; - v556 = hir.int_to_ptr v553 : ptr; - hir.store v556, v498; + v561 = hir.bitcast v497 : u32; + v563 = arith.add v561, v866 : u32 #[overflow = checked]; v865 = arith.constant 4 : u32; - v559 = hir.bitcast v495 : u32; - v561 = arith.add v559, v865 : u32 #[overflow = checked]; - v864 = arith.constant 4 : u32; - v563 = arith.mod v561, v864 : u32; - hir.assertz v563 #[code = 250]; + v565 = arith.mod v563, v865 : u32; + hir.assertz v565 #[code = 250]; + v864 = arith.constant 0 : i32; + v566 = hir.int_to_ptr v563 : ptr; + hir.store v566, v864; v863 = arith.constant 0 : i32; - v564 = hir.int_to_ptr v561 : ptr; - hir.store v564, v863; - v862 = arith.constant 0 : i32; - scf.yield v862; + scf.yield v863; }; - scf.yield v843; + scf.yield v844; } else { ^block76: - v861 = ub.poison i32 : i32; - scf.yield v861; + v862 = ub.poison i32 : i32; + scf.yield v862; }; - v856 = arith.constant 0 : u32; - v789 = arith.constant 1 : u32; - v849 = cf.select v539, v789, v856 : u32; - v857 = ub.poison i32 : i32; - v848 = cf.select v539, v506, v857 : i32; + v857 = arith.constant 0 : u32; + v790 = arith.constant 1 : u32; + v850 = cf.select v541, v790, v857 : u32; v858 = ub.poison i32 : i32; - v847 = cf.select v539, v495, v858 : i32; + v849 = cf.select v541, v508, v858 : i32; v859 = ub.poison i32 : i32; - v846 = cf.select v539, v859, v506 : i32; + v848 = cf.select v541, v497, v859 : i32; v860 = ub.poison i32 : i32; - v845 = cf.select v539, v860, v495 : i32; - scf.yield v845, v846, v847, v844, v848, v849; + v847 = cf.select v541, v860, v508 : i32; + v861 = ub.poison i32 : i32; + v846 = cf.select v541, v861, v497 : i32; + scf.yield v846, v847, v848, v845, v849, v850; }; - v802, v803, v804 = scf.index_switch v801 : i32, i32, i32 + v803, v804, v805 = scf.index_switch v802 : i32, i32, i32 case 0 { ^block74: + v856 = arith.constant 4 : u32; + v544 = hir.bitcast v797 : u32; + v546 = arith.add v544, v856 : u32 #[overflow = checked]; v855 = arith.constant 4 : u32; - v542 = hir.bitcast v796 : u32; - v544 = arith.add v542, v855 : u32 #[overflow = checked]; - v854 = arith.constant 4 : u32; - v546 = arith.mod v544, v854 : u32; - hir.assertz v546 #[code = 250]; - v853 = arith.constant 0 : i32; - v547 = hir.int_to_ptr v544 : ptr; - hir.store v547, v853; - v852 = arith.constant 1 : i32; - scf.yield v796, v852, v797; + v548 = arith.mod v546, v855 : u32; + hir.assertz v548 #[code = 250]; + v854 = arith.constant 0 : i32; + v549 = hir.int_to_ptr v546 : ptr; + hir.store v549, v854; + v853 = arith.constant 1 : i32; + scf.yield v797, v853, v798; } default { ^block120: - scf.yield v798, v799, v800; + scf.yield v799, v800, v801; }; - v617 = hir.bitcast v802 : u32; - v851 = arith.constant 4 : u32; - v619 = arith.mod v617, v851 : u32; - hir.assertz v619 #[code = 250]; - v620 = hir.int_to_ptr v617 : ptr; - hir.store v620, v803; - v850 = arith.constant 16 : i32; - v625 = arith.add v804, v850 : i32 #[overflow = wrapping]; - v626 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr - v627 = hir.bitcast v626 : ptr; - hir.store v627, v625; + v619 = hir.bitcast v803 : u32; + v852 = arith.constant 4 : u32; + v621 = arith.mod v619, v852 : u32; + hir.assertz v621 #[code = 250]; + v622 = hir.int_to_ptr v619 : ptr; + hir.store v622, v804; + v851 = arith.constant 16 : i32; + v627 = arith.add v805, v851 : i32 #[overflow = wrapping]; + v628 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/__stack_pointer : ptr + v629 = hir.bitcast v628 : ptr; + hir.store v629, v627; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v628: i32, v629: i32) { - ^block84(v628: i32, v629: i32): + private builtin.function @alloc::raw_vec::handle_error(v630: i32, v631: i32) { + ^block84(v630: i32, v631: i32): ub.unreachable ; }; - private builtin.function @::max(v630: i32, v631: i32) -> i32 { - ^block86(v630: i32, v631: i32): - v638 = arith.constant 0 : i32; - v634 = hir.bitcast v631 : u32; - v633 = hir.bitcast v630 : u32; - v635 = arith.gt v633, v634 : i1; - v636 = arith.zext v635 : u32; - v637 = hir.bitcast v636 : i32; - v639 = arith.neq v637, v638 : i1; - v640 = cf.select v639, v630, v631 : i32; - builtin.ret v640; + private builtin.function @::max(v632: i32, v633: i32) -> i32 { + ^block86(v632: i32, v633: i32): + v640 = arith.constant 0 : i32; + v636 = hir.bitcast v633 : u32; + v635 = hir.bitcast v632 : u32; + v637 = arith.gt v635, v636 : i1; + v638 = arith.zext v637 : u32; + v639 = hir.bitcast v638 : i32; + v641 = arith.neq v639, v640 : i1; + v642 = cf.select v641, v632, v633 : i32; + builtin.ret v642; }; - private builtin.function @miden::protocol::input_note::get_assets(v641: i32, v642: felt) -> i32 { - ^block88(v641: i32, v642: felt): + private builtin.function @miden::protocol::input_note::get_assets(v643: i32, v644: felt) -> i32 { + ^block88(v643: i32, v644: felt): ub.unreachable ; }; @@ -939,7 +942,7 @@ builtin.component miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-no public builtin.function @binding() -> felt { ^block90: - v644 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() : felt - builtin.ret v644; + v646 = hir.exec @miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1/rust_sdk_input_note_get_assets_binding/miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets-binding@0.0.1#binding() : felt + builtin.ret v646; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm index 26b2d9f31..b3cf57b91 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.masm @@ -193,6 +193,9 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets trace.252 nop push.0 + push.0 + mul.4294967296 + add push.4 dup.2 u32wrapping_add @@ -237,6 +240,9 @@ proc miden:rust-sdk-input-note-get-assets-binding/rust-sdk-input-note-get-assets exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + mul.4294967296 + add end @callconv("C") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat index afdf636f4..c9d3df171 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_binding.wat @@ -16,7 +16,7 @@ (type (;6;) (func (param i32))) (type (;7;) (func (param i32 i32 i32 i32))) (type (;8;) (func (param i32 f32))) - (type (;9;) (func (param i32) (result f32))) + (type (;9;) (func (param i64) (result f32))) (type (;10;) (func (param i32 i32 i32 i32 i32))) (type (;11;) (func (param i32 i32))) (type (;12;) (func (param i32 f32) (result i32))) @@ -70,12 +70,12 @@ local.get 0 i32.const 4 i32.add - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_assets local.get 0 - i32.load offset=12 - call $intrinsics::felt::from_u32 + i64.load32_u offset=12 + call $intrinsics::felt::from_u64_unchecked local.set 1 local.get 0 i32.const 4 @@ -289,7 +289,7 @@ i32.const 16 call $::deallocate ) - (func $intrinsics::felt::from_u32 (;14;) (type 9) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;14;) (type 9) (param i64) (result f32) unreachable ) (func $::alloc_impl (;15;) (type 7) (param i32 i32 i32 i32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir index 9b1fe47ec..d67c791f2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/wit_bindgen::rt::run_ctors_once() - v124 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden_base_sys::bindings::input_note::get_assets_info(v7, v124) + v10 = arith.constant 0 : i64; + v11 = arith.trunc v10 : felt; + hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/miden_base_sys::bindings::input_note::get_assets_info(v7, v11) v13 = arith.constant 16 : u32; v12 = hir.bitcast v7 : u32; v14 = arith.add v12, v13 : u32 #[overflow = checked]; @@ -31,8 +32,8 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp hir.assertz v16 #[code = 250]; v17 = hir.int_to_ptr v14 : ptr; v18 = hir.load v17 : felt; - v125 = arith.constant 32 : i32; - v20 = arith.add v7, v125 : i32 #[overflow = wrapping]; + v124 = arith.constant 32 : i32; + v20 = arith.add v7, v124 : i32 #[overflow = wrapping]; v21 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr v22 = hir.bitcast v21 : ptr; hir.store v22, v20; @@ -62,12 +63,12 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp v37 = hir.bitcast v36 : ptr; v38 = hir.load v37 : i32; hir.exec @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__wasm_call_ctors() - v127 = arith.constant 1 : u8; - v129 = arith.constant 1048584 : i32; - v40 = arith.add v38, v129 : i32 #[overflow = wrapping]; + v126 = arith.constant 1 : u8; + v128 = arith.constant 1048584 : i32; + v40 = arith.add v38, v128 : i32 #[overflow = wrapping]; v44 = hir.bitcast v40 : u32; v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v127; + hir.store v45, v126; scf.yield ; }; builtin.ret ; @@ -92,76 +93,76 @@ builtin.component miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-inp hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; v62 = hir.load v61 : felt; - v144 = arith.constant 16 : u32; + v143 = arith.constant 16 : u32; v63 = hir.bitcast v46 : u32; - v65 = arith.add v63, v144 : u32 #[overflow = checked]; - v143 = arith.constant 4 : u32; - v67 = arith.mod v65, v143 : u32; + v65 = arith.add v63, v143 : u32 #[overflow = checked]; + v142 = arith.constant 4 : u32; + v67 = arith.mod v65, v142 : u32; hir.assertz v67 #[code = 250]; v68 = hir.int_to_ptr v65 : ptr; hir.store v68, v62; v69 = hir.bitcast v53 : u32; - v142 = arith.constant 4 : u32; - v71 = arith.mod v69, v142 : u32; + v141 = arith.constant 4 : u32; + v71 = arith.mod v69, v141 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : felt; v75 = arith.constant 12 : u32; v74 = hir.bitcast v46 : u32; v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v141 = arith.constant 4 : u32; - v78 = arith.mod v76, v141 : u32; + v140 = arith.constant 4 : u32; + v78 = arith.mod v76, v140 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; hir.store v79, v73; - v140 = arith.constant 4 : u32; - v80 = hir.bitcast v53 : u32; - v82 = arith.add v80, v140 : u32 #[overflow = checked]; v139 = arith.constant 4 : u32; - v84 = arith.mod v82, v139 : u32; + v80 = hir.bitcast v53 : u32; + v82 = arith.add v80, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v84 = arith.mod v82, v138 : u32; hir.assertz v84 #[code = 250]; v85 = hir.int_to_ptr v82 : ptr; v86 = hir.load v85 : felt; v88 = arith.constant 8 : u32; v87 = hir.bitcast v46 : u32; v89 = arith.add v87, v88 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v91 = arith.mod v89, v138 : u32; + v137 = arith.constant 4 : u32; + v91 = arith.mod v89, v137 : u32; hir.assertz v91 #[code = 250]; v92 = hir.int_to_ptr v89 : ptr; hir.store v92, v86; - v137 = arith.constant 8 : u32; + v136 = arith.constant 8 : u32; v93 = hir.bitcast v53 : u32; - v95 = arith.add v93, v137 : u32 #[overflow = checked]; - v136 = arith.constant 4 : u32; - v97 = arith.mod v95, v136 : u32; + v95 = arith.add v93, v136 : u32 #[overflow = checked]; + v135 = arith.constant 4 : u32; + v97 = arith.mod v95, v135 : u32; hir.assertz v97 #[code = 250]; v98 = hir.int_to_ptr v95 : ptr; v99 = hir.load v98 : felt; - v135 = arith.constant 4 : u32; - v100 = hir.bitcast v46 : u32; - v102 = arith.add v100, v135 : u32 #[overflow = checked]; v134 = arith.constant 4 : u32; - v104 = arith.mod v102, v134 : u32; + v100 = hir.bitcast v46 : u32; + v102 = arith.add v100, v134 : u32 #[overflow = checked]; + v133 = arith.constant 4 : u32; + v104 = arith.mod v102, v133 : u32; hir.assertz v104 #[code = 250]; v105 = hir.int_to_ptr v102 : ptr; hir.store v105, v99; - v133 = arith.constant 12 : u32; + v132 = arith.constant 12 : u32; v106 = hir.bitcast v53 : u32; - v108 = arith.add v106, v133 : u32 #[overflow = checked]; - v132 = arith.constant 4 : u32; - v110 = arith.mod v108, v132 : u32; + v108 = arith.add v106, v132 : u32 #[overflow = checked]; + v131 = arith.constant 4 : u32; + v110 = arith.mod v108, v131 : u32; hir.assertz v110 #[code = 250]; v111 = hir.int_to_ptr v108 : ptr; v112 = hir.load v111 : felt; v113 = hir.bitcast v46 : u32; - v131 = arith.constant 4 : u32; - v115 = arith.mod v113, v131 : u32; + v130 = arith.constant 4 : u32; + v115 = arith.mod v113, v130 : u32; hir.assertz v115 #[code = 250]; v116 = hir.int_to_ptr v113 : ptr; hir.store v116, v112; - v130 = arith.constant 32 : i32; - v118 = arith.add v53, v130 : i32 #[overflow = wrapping]; + v129 = arith.constant 32 : i32; + v118 = arith.add v53, v129 : i32 #[overflow = wrapping]; v119 = builtin.global_symbol @miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-assets-info-binding@0.0.1/rust_sdk_input_note_get_assets_info_binding/__stack_pointer : ptr v120 = hir.bitcast v119 : ptr; hir.store v120, v118; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm index 6e8fff65c..7126d3b44 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.masm @@ -80,6 +80,9 @@ proc miden:rust-sdk-input-note-get-assets-info-binding/rust-sdk-input-note-get-a trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat index 2078de91e..001d32067 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_assets_info_binding.wat @@ -10,7 +10,7 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -30,8 +30,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_assets_info local.get 0 f32.load offset=16 @@ -95,7 +95,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_assets_info (;6;) (type 4) (param f32 i32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir index 59ad56254..e40381e09 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/wit_bindgen::rt::run_ctors_once() - v124 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden_base_sys::bindings::input_note::get_inputs_info(v7, v124) + v10 = arith.constant 0 : i64; + v11 = arith.trunc v10 : felt; + hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/miden_base_sys::bindings::input_note::get_inputs_info(v7, v11) v13 = arith.constant 16 : u32; v12 = hir.bitcast v7 : u32; v14 = arith.add v12, v13 : u32 #[overflow = checked]; @@ -31,8 +32,8 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp hir.assertz v16 #[code = 250]; v17 = hir.int_to_ptr v14 : ptr; v18 = hir.load v17 : felt; - v125 = arith.constant 32 : i32; - v20 = arith.add v7, v125 : i32 #[overflow = wrapping]; + v124 = arith.constant 32 : i32; + v20 = arith.add v7, v124 : i32 #[overflow = wrapping]; v21 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr v22 = hir.bitcast v21 : ptr; hir.store v22, v20; @@ -62,12 +63,12 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp v37 = hir.bitcast v36 : ptr; v38 = hir.load v37 : i32; hir.exec @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__wasm_call_ctors() - v127 = arith.constant 1 : u8; - v129 = arith.constant 1048584 : i32; - v40 = arith.add v38, v129 : i32 #[overflow = wrapping]; + v126 = arith.constant 1 : u8; + v128 = arith.constant 1048584 : i32; + v40 = arith.add v38, v128 : i32 #[overflow = wrapping]; v44 = hir.bitcast v40 : u32; v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v127; + hir.store v45, v126; scf.yield ; }; builtin.ret ; @@ -92,76 +93,76 @@ builtin.component miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-inp hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; v62 = hir.load v61 : felt; - v144 = arith.constant 16 : u32; + v143 = arith.constant 16 : u32; v63 = hir.bitcast v46 : u32; - v65 = arith.add v63, v144 : u32 #[overflow = checked]; - v143 = arith.constant 4 : u32; - v67 = arith.mod v65, v143 : u32; + v65 = arith.add v63, v143 : u32 #[overflow = checked]; + v142 = arith.constant 4 : u32; + v67 = arith.mod v65, v142 : u32; hir.assertz v67 #[code = 250]; v68 = hir.int_to_ptr v65 : ptr; hir.store v68, v62; v69 = hir.bitcast v53 : u32; - v142 = arith.constant 4 : u32; - v71 = arith.mod v69, v142 : u32; + v141 = arith.constant 4 : u32; + v71 = arith.mod v69, v141 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : felt; v75 = arith.constant 12 : u32; v74 = hir.bitcast v46 : u32; v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v141 = arith.constant 4 : u32; - v78 = arith.mod v76, v141 : u32; + v140 = arith.constant 4 : u32; + v78 = arith.mod v76, v140 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; hir.store v79, v73; - v140 = arith.constant 4 : u32; - v80 = hir.bitcast v53 : u32; - v82 = arith.add v80, v140 : u32 #[overflow = checked]; v139 = arith.constant 4 : u32; - v84 = arith.mod v82, v139 : u32; + v80 = hir.bitcast v53 : u32; + v82 = arith.add v80, v139 : u32 #[overflow = checked]; + v138 = arith.constant 4 : u32; + v84 = arith.mod v82, v138 : u32; hir.assertz v84 #[code = 250]; v85 = hir.int_to_ptr v82 : ptr; v86 = hir.load v85 : felt; v88 = arith.constant 8 : u32; v87 = hir.bitcast v46 : u32; v89 = arith.add v87, v88 : u32 #[overflow = checked]; - v138 = arith.constant 4 : u32; - v91 = arith.mod v89, v138 : u32; + v137 = arith.constant 4 : u32; + v91 = arith.mod v89, v137 : u32; hir.assertz v91 #[code = 250]; v92 = hir.int_to_ptr v89 : ptr; hir.store v92, v86; - v137 = arith.constant 8 : u32; + v136 = arith.constant 8 : u32; v93 = hir.bitcast v53 : u32; - v95 = arith.add v93, v137 : u32 #[overflow = checked]; - v136 = arith.constant 4 : u32; - v97 = arith.mod v95, v136 : u32; + v95 = arith.add v93, v136 : u32 #[overflow = checked]; + v135 = arith.constant 4 : u32; + v97 = arith.mod v95, v135 : u32; hir.assertz v97 #[code = 250]; v98 = hir.int_to_ptr v95 : ptr; v99 = hir.load v98 : felt; - v135 = arith.constant 4 : u32; - v100 = hir.bitcast v46 : u32; - v102 = arith.add v100, v135 : u32 #[overflow = checked]; v134 = arith.constant 4 : u32; - v104 = arith.mod v102, v134 : u32; + v100 = hir.bitcast v46 : u32; + v102 = arith.add v100, v134 : u32 #[overflow = checked]; + v133 = arith.constant 4 : u32; + v104 = arith.mod v102, v133 : u32; hir.assertz v104 #[code = 250]; v105 = hir.int_to_ptr v102 : ptr; hir.store v105, v99; - v133 = arith.constant 12 : u32; + v132 = arith.constant 12 : u32; v106 = hir.bitcast v53 : u32; - v108 = arith.add v106, v133 : u32 #[overflow = checked]; - v132 = arith.constant 4 : u32; - v110 = arith.mod v108, v132 : u32; + v108 = arith.add v106, v132 : u32 #[overflow = checked]; + v131 = arith.constant 4 : u32; + v110 = arith.mod v108, v131 : u32; hir.assertz v110 #[code = 250]; v111 = hir.int_to_ptr v108 : ptr; v112 = hir.load v111 : felt; v113 = hir.bitcast v46 : u32; - v131 = arith.constant 4 : u32; - v115 = arith.mod v113, v131 : u32; + v130 = arith.constant 4 : u32; + v115 = arith.mod v113, v130 : u32; hir.assertz v115 #[code = 250]; v116 = hir.int_to_ptr v113 : ptr; hir.store v116, v112; - v130 = arith.constant 32 : i32; - v118 = arith.add v53, v130 : i32 #[overflow = wrapping]; + v129 = arith.constant 32 : i32; + v118 = arith.add v53, v129 : i32 #[overflow = wrapping]; v119 = builtin.global_symbol @miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-inputs-info-binding@0.0.1/rust_sdk_input_note_get_inputs_info_binding/__stack_pointer : ptr v120 = hir.bitcast v119 : ptr; hir.store v120, v118; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm index 939b2e6d0..504f7df79 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.masm @@ -80,6 +80,9 @@ proc miden:rust-sdk-input-note-get-inputs-info-binding/rust-sdk-input-note-get-i trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat index 3270138da..307705e1e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_inputs_info_binding.wat @@ -10,7 +10,7 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -30,8 +30,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_inputs_info local.get 0 f32.load offset=16 @@ -95,7 +95,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_inputs_info (;6;) (type 4) (param f32 i32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir index 4bac23439..09df3fb47 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/wit_bindgen::rt::run_ctors_once() - v140 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden_base_sys::bindings::input_note::get_metadata(v6, v140) + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden_base_sys::bindings::input_note::get_metadata(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v145 = arith.constant 8 : u32; - v20 = arith.mod v18, v145 : u32; + v142 = arith.constant 8 : u32; + v20 = arith.mod v18, v142 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v144 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v144 : u32 #[overflow = checked]; + v25 = arith.add v23, v141 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v143 = arith.constant 8 : u32; - v31 = arith.mod v29, v143 : u32; + v140 = arith.constant 8 : u32; + v31 = arith.mod v29, v140 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v142 = arith.constant 4 : u32; - v36 = arith.mod v34, v142 : u32; + v139 = arith.constant 4 : u32; + v36 = arith.mod v34, v139 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v141 = arith.constant 16 : i32; - v39 = arith.add v6, v141 : i32 #[overflow = wrapping]; + v138 = arith.constant 16 : i32; + v39 = arith.add v6, v138 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__wasm_call_ctors() - v147 = arith.constant 1 : u8; - v149 = arith.constant 1048600 : i32; - v59 = arith.add v57, v149 : i32 #[overflow = wrapping]; + v144 = arith.constant 1 : u8; + v146 = arith.constant 1048600 : i32; + v59 = arith.add v57, v146 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v147; + hir.store v64, v144; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v153, v154 = arith.split v79 : felt, felt; - v161 = arith.constant 8 : u32; + v150, v151 = arith.split v79 : felt, felt; + v158 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v161 : u32 #[overflow = checked]; - v160 = arith.constant 8 : u32; - v87 = arith.mod v85, v160 : u32; + v85 = arith.add v83, v158 : u32 #[overflow = checked]; + v157 = arith.constant 8 : u32; + v87 = arith.mod v85, v157 : u32; hir.assertz v87 #[code = 250]; - v155 = arith.join v154, v153 : i64; + v152 = arith.join v151, v150 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v155; - v159 = arith.constant 8 : u32; + hir.store v88, v152; + v156 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v159 : u32 #[overflow = checked]; - v158 = arith.constant 8 : u32; - v93 = arith.mod v91, v158 : u32; + v91 = arith.add v89, v156 : u32 #[overflow = checked]; + v155 = arith.constant 8 : u32; + v93 = arith.mod v91, v155 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v150, v151 = arith.split v95 : felt, felt; + v147, v148 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v157 = arith.constant 8 : u32; - v101 = arith.mod v99, v157 : u32; + v154 = arith.constant 8 : u32; + v101 = arith.mod v99, v154 : u32; hir.assertz v101 #[code = 250]; - v152 = arith.join v151, v150 : i64; + v149 = arith.join v148, v147 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v152; - v156 = arith.constant 16 : i32; - v104 = arith.add v72, v156 : i32 #[overflow = wrapping]; + hir.store v102, v149; + v153 = arith.constant 16 : i32; + v104 = arith.add v72, v153 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -168,32 +169,30 @@ builtin.component miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input- public builtin.function @binding() -> felt, felt, felt, felt { ^block19: v109 = hir.exec @miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1/rust_sdk_input_note_get_metadata_binding/miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1#binding() : i32 + v162 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; v111 = arith.add v109, v110 : i32 #[overflow = unchecked]; - v165 = arith.constant 0 : i32; - v166 = arith.constant 0 : i32; - v113 = arith.add v111, v166 : i32 #[overflow = unchecked]; - v115 = arith.add v113, v165 : i32 #[overflow = unchecked]; - v116 = hir.int_to_ptr v115 : ptr; - v117 = hir.load v116 : felt; - v164 = arith.constant 0 : i32; - v118 = arith.constant 4 : i32; - v119 = arith.add v111, v118 : i32 #[overflow = unchecked]; - v121 = arith.add v119, v164 : i32 #[overflow = unchecked]; - v122 = hir.int_to_ptr v121 : ptr; - v123 = hir.load v122 : felt; - v163 = arith.constant 0 : i32; - v124 = arith.constant 8 : i32; - v125 = arith.add v111, v124 : i32 #[overflow = unchecked]; - v127 = arith.add v125, v163 : i32 #[overflow = unchecked]; - v128 = hir.int_to_ptr v127 : ptr; - v129 = hir.load v128 : felt; - v162 = arith.constant 0 : i32; - v130 = arith.constant 12 : i32; - v131 = arith.add v111, v130 : i32 #[overflow = unchecked]; - v133 = arith.add v131, v162 : i32 #[overflow = unchecked]; - v134 = hir.int_to_ptr v133 : ptr; - v135 = hir.load v134 : felt; - builtin.ret v117, v123, v129, v135; + v113 = arith.add v111, v162 : i32 #[overflow = unchecked]; + v114 = hir.int_to_ptr v113 : ptr; + v115 = hir.load v114 : felt; + v161 = arith.constant 0 : i32; + v116 = arith.constant 4 : i32; + v117 = arith.add v109, v116 : i32 #[overflow = unchecked]; + v119 = arith.add v117, v161 : i32 #[overflow = unchecked]; + v120 = hir.int_to_ptr v119 : ptr; + v121 = hir.load v120 : felt; + v160 = arith.constant 0 : i32; + v122 = arith.constant 8 : i32; + v123 = arith.add v109, v122 : i32 #[overflow = unchecked]; + v125 = arith.add v123, v160 : i32 #[overflow = unchecked]; + v126 = hir.int_to_ptr v125 : ptr; + v127 = hir.load v126 : felt; + v159 = arith.constant 0 : i32; + v128 = arith.constant 12 : i32; + v129 = arith.add v109, v128 : i32 #[overflow = unchecked]; + v131 = arith.add v129, v159 : i32 #[overflow = unchecked]; + v132 = hir.int_to_ptr v131 : ptr; + v133 = hir.load v132 : felt; + builtin.ret v115, v121, v127, v133; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm index 5eee65e8c..7dcb9933b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -132,6 +130,9 @@ proc miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-meta trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat index f4802995e..0709ae463 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_metadata_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -33,8 +32,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_metadata global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -98,7 +97,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_metadata (;6;) (type 4) (param f32 i32) @@ -118,15 +117,14 @@ (component $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-metadata-binding/rust-sdk-input-note-get-metadata-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir index ce5aa65e1..ef92318e3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/wit_bindgen::rt::run_ctors_once() - v142 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden_base_sys::bindings::input_note::get_recipient(v6, v142) + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden_base_sys::bindings::input_note::get_recipient(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v147 = arith.constant 8 : u32; - v20 = arith.mod v18, v147 : u32; + v144 = arith.constant 8 : u32; + v20 = arith.mod v18, v144 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v146 = arith.constant 8 : u32; + v143 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v146 : u32 #[overflow = checked]; + v25 = arith.add v23, v143 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v145 = arith.constant 8 : u32; - v31 = arith.mod v29, v145 : u32; + v142 = arith.constant 8 : u32; + v31 = arith.mod v29, v142 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v144 = arith.constant 4 : u32; - v36 = arith.mod v34, v144 : u32; + v141 = arith.constant 4 : u32; + v36 = arith.mod v34, v141 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v143 = arith.constant 16 : i32; - v39 = arith.add v6, v143 : i32 #[overflow = wrapping]; + v140 = arith.constant 16 : i32; + v39 = arith.add v6, v140 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__wasm_call_ctors() - v149 = arith.constant 1 : u8; - v151 = arith.constant 1048600 : i32; - v59 = arith.add v57, v151 : i32 #[overflow = wrapping]; + v146 = arith.constant 1 : u8; + v148 = arith.constant 1048600 : i32; + v59 = arith.add v57, v148 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v149; + hir.store v64, v146; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v155, v156 = arith.split v79 : felt, felt; - v163 = arith.constant 8 : u32; + v152, v153 = arith.split v79 : felt, felt; + v160 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v163 : u32 #[overflow = checked]; - v162 = arith.constant 8 : u32; - v87 = arith.mod v85, v162 : u32; + v85 = arith.add v83, v160 : u32 #[overflow = checked]; + v159 = arith.constant 8 : u32; + v87 = arith.mod v85, v159 : u32; hir.assertz v87 #[code = 250]; - v157 = arith.join v156, v155 : i64; + v154 = arith.join v153, v152 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v157; - v161 = arith.constant 8 : u32; + hir.store v88, v154; + v158 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v161 : u32 #[overflow = checked]; - v160 = arith.constant 8 : u32; - v93 = arith.mod v91, v160 : u32; + v91 = arith.add v89, v158 : u32 #[overflow = checked]; + v157 = arith.constant 8 : u32; + v93 = arith.mod v91, v157 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v152, v153 = arith.split v95 : felt, felt; + v149, v150 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v159 = arith.constant 8 : u32; - v101 = arith.mod v99, v159 : u32; + v156 = arith.constant 8 : u32; + v101 = arith.mod v99, v156 : u32; hir.assertz v101 #[code = 250]; - v154 = arith.join v153, v152 : i64; + v151 = arith.join v150, v149 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v154; - v158 = arith.constant 16 : i32; - v104 = arith.add v72, v158 : i32 #[overflow = wrapping]; + hir.store v102, v151; + v155 = arith.constant 16 : i32; + v104 = arith.add v72, v155 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -168,34 +169,32 @@ builtin.component miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input public builtin.function @binding() -> felt, felt, felt, felt { ^block19: v109 = hir.exec @miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1/rust_sdk_input_note_get_recipient_binding/miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1#binding() : i32 - v169 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; v111 = arith.add v109, v110 : i32 #[overflow = unchecked]; - v113 = arith.add v111, v169 : i32 #[overflow = unchecked]; - v167 = arith.constant 0 : i32; - v168 = arith.constant 0 : i32; - v115 = arith.add v113, v168 : i32 #[overflow = unchecked]; - v117 = arith.add v115, v167 : i32 #[overflow = unchecked]; - v118 = hir.int_to_ptr v117 : ptr; - v119 = hir.load v118 : felt; - v166 = arith.constant 0 : i32; - v120 = arith.constant 4 : i32; - v121 = arith.add v113, v120 : i32 #[overflow = unchecked]; - v123 = arith.add v121, v166 : i32 #[overflow = unchecked]; - v124 = hir.int_to_ptr v123 : ptr; - v125 = hir.load v124 : felt; - v165 = arith.constant 0 : i32; - v126 = arith.constant 8 : i32; - v127 = arith.add v113, v126 : i32 #[overflow = unchecked]; - v129 = arith.add v127, v165 : i32 #[overflow = unchecked]; - v130 = hir.int_to_ptr v129 : ptr; - v131 = hir.load v130 : felt; v164 = arith.constant 0 : i32; - v132 = arith.constant 12 : i32; - v133 = arith.add v113, v132 : i32 #[overflow = unchecked]; - v135 = arith.add v133, v164 : i32 #[overflow = unchecked]; - v136 = hir.int_to_ptr v135 : ptr; - v137 = hir.load v136 : felt; - builtin.ret v119, v125, v131, v137; + v165 = arith.constant 0 : i32; + v113 = arith.add v111, v165 : i32 #[overflow = unchecked]; + v115 = arith.add v113, v164 : i32 #[overflow = unchecked]; + v116 = hir.int_to_ptr v115 : ptr; + v117 = hir.load v116 : felt; + v163 = arith.constant 0 : i32; + v118 = arith.constant 4 : i32; + v119 = arith.add v111, v118 : i32 #[overflow = unchecked]; + v121 = arith.add v119, v163 : i32 #[overflow = unchecked]; + v122 = hir.int_to_ptr v121 : ptr; + v123 = hir.load v122 : felt; + v162 = arith.constant 0 : i32; + v124 = arith.constant 8 : i32; + v125 = arith.add v111, v124 : i32 #[overflow = unchecked]; + v127 = arith.add v125, v162 : i32 #[overflow = unchecked]; + v128 = hir.int_to_ptr v127 : ptr; + v129 = hir.load v128 : felt; + v161 = arith.constant 0 : i32; + v130 = arith.constant 12 : i32; + v131 = arith.add v111, v130 : i32 #[overflow = unchecked]; + v133 = arith.add v131, v161 : i32 #[overflow = unchecked]; + v134 = hir.int_to_ptr v133 : ptr; + v135 = hir.load v134 : felt; + builtin.ret v117, v123, v129, v135; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm index 1cfda5c4c..8467ad3fc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -135,6 +132,9 @@ proc miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-rec trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat index 12e0a830f..019600be9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_recipient_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "recipient" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "recipient" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,7 +14,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -35,8 +34,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_recipient global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -100,7 +99,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_recipient (;6;) (type 4) (param f32 i32) @@ -121,17 +120,16 @@ (component $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-recipient" (type (;6;) (eq 5))) - (import "import-type-recipient0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "recipient" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-recipient" (type (;5;) (eq 4))) + (import "import-type-recipient0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "recipient" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-recipient-binding/rust-sdk-input-note-get-recipient-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir index a734638c5..3a08657dc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/wit_bindgen::rt::run_ctors_once() - v140 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden_base_sys::bindings::input_note::get_script_root(v6, v140) + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden_base_sys::bindings::input_note::get_script_root(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v145 = arith.constant 8 : u32; - v20 = arith.mod v18, v145 : u32; + v142 = arith.constant 8 : u32; + v20 = arith.mod v18, v142 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v144 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v144 : u32 #[overflow = checked]; + v25 = arith.add v23, v141 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v143 = arith.constant 8 : u32; - v31 = arith.mod v29, v143 : u32; + v140 = arith.constant 8 : u32; + v31 = arith.mod v29, v140 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v142 = arith.constant 4 : u32; - v36 = arith.mod v34, v142 : u32; + v139 = arith.constant 4 : u32; + v36 = arith.mod v34, v139 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v141 = arith.constant 16 : i32; - v39 = arith.add v6, v141 : i32 #[overflow = wrapping]; + v138 = arith.constant 16 : i32; + v39 = arith.add v6, v138 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__wasm_call_ctors() - v147 = arith.constant 1 : u8; - v149 = arith.constant 1048600 : i32; - v59 = arith.add v57, v149 : i32 #[overflow = wrapping]; + v144 = arith.constant 1 : u8; + v146 = arith.constant 1048600 : i32; + v59 = arith.add v57, v146 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v147; + hir.store v64, v144; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v153, v154 = arith.split v79 : felt, felt; - v161 = arith.constant 8 : u32; + v150, v151 = arith.split v79 : felt, felt; + v158 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v161 : u32 #[overflow = checked]; - v160 = arith.constant 8 : u32; - v87 = arith.mod v85, v160 : u32; + v85 = arith.add v83, v158 : u32 #[overflow = checked]; + v157 = arith.constant 8 : u32; + v87 = arith.mod v85, v157 : u32; hir.assertz v87 #[code = 250]; - v155 = arith.join v154, v153 : i64; + v152 = arith.join v151, v150 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v155; - v159 = arith.constant 8 : u32; + hir.store v88, v152; + v156 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v159 : u32 #[overflow = checked]; - v158 = arith.constant 8 : u32; - v93 = arith.mod v91, v158 : u32; + v91 = arith.add v89, v156 : u32 #[overflow = checked]; + v155 = arith.constant 8 : u32; + v93 = arith.mod v91, v155 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v150, v151 = arith.split v95 : felt, felt; + v147, v148 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v157 = arith.constant 8 : u32; - v101 = arith.mod v99, v157 : u32; + v154 = arith.constant 8 : u32; + v101 = arith.mod v99, v154 : u32; hir.assertz v101 #[code = 250]; - v152 = arith.join v151, v150 : i64; + v149 = arith.join v148, v147 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v152; - v156 = arith.constant 16 : i32; - v104 = arith.add v72, v156 : i32 #[overflow = wrapping]; + hir.store v102, v149; + v153 = arith.constant 16 : i32; + v104 = arith.add v72, v153 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -168,32 +169,30 @@ builtin.component miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-inp public builtin.function @binding() -> felt, felt, felt, felt { ^block19: v109 = hir.exec @miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1/rust_sdk_input_note_get_script_root_binding/miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1#binding() : i32 + v162 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; v111 = arith.add v109, v110 : i32 #[overflow = unchecked]; - v165 = arith.constant 0 : i32; - v166 = arith.constant 0 : i32; - v113 = arith.add v111, v166 : i32 #[overflow = unchecked]; - v115 = arith.add v113, v165 : i32 #[overflow = unchecked]; - v116 = hir.int_to_ptr v115 : ptr; - v117 = hir.load v116 : felt; - v164 = arith.constant 0 : i32; - v118 = arith.constant 4 : i32; - v119 = arith.add v111, v118 : i32 #[overflow = unchecked]; - v121 = arith.add v119, v164 : i32 #[overflow = unchecked]; - v122 = hir.int_to_ptr v121 : ptr; - v123 = hir.load v122 : felt; - v163 = arith.constant 0 : i32; - v124 = arith.constant 8 : i32; - v125 = arith.add v111, v124 : i32 #[overflow = unchecked]; - v127 = arith.add v125, v163 : i32 #[overflow = unchecked]; - v128 = hir.int_to_ptr v127 : ptr; - v129 = hir.load v128 : felt; - v162 = arith.constant 0 : i32; - v130 = arith.constant 12 : i32; - v131 = arith.add v111, v130 : i32 #[overflow = unchecked]; - v133 = arith.add v131, v162 : i32 #[overflow = unchecked]; - v134 = hir.int_to_ptr v133 : ptr; - v135 = hir.load v134 : felt; - builtin.ret v117, v123, v129, v135; + v113 = arith.add v111, v162 : i32 #[overflow = unchecked]; + v114 = hir.int_to_ptr v113 : ptr; + v115 = hir.load v114 : felt; + v161 = arith.constant 0 : i32; + v116 = arith.constant 4 : i32; + v117 = arith.add v109, v116 : i32 #[overflow = unchecked]; + v119 = arith.add v117, v161 : i32 #[overflow = unchecked]; + v120 = hir.int_to_ptr v119 : ptr; + v121 = hir.load v120 : felt; + v160 = arith.constant 0 : i32; + v122 = arith.constant 8 : i32; + v123 = arith.add v109, v122 : i32 #[overflow = unchecked]; + v125 = arith.add v123, v160 : i32 #[overflow = unchecked]; + v126 = hir.int_to_ptr v125 : ptr; + v127 = hir.load v126 : felt; + v159 = arith.constant 0 : i32; + v128 = arith.constant 12 : i32; + v129 = arith.add v109, v128 : i32 #[overflow = unchecked]; + v131 = arith.add v129, v159 : i32 #[overflow = unchecked]; + v132 = hir.int_to_ptr v131 : ptr; + v133 = hir.load v132 : felt; + builtin.ret v115, v121, v127, v133; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm index 345a79a43..989fe2597 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -132,6 +130,9 @@ proc miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-s trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat index 989cf1532..48f3d1d63 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_script_root_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -33,8 +32,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_script_root global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -98,7 +97,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_script_root (;6;) (type 4) (param f32 i32) @@ -118,15 +117,14 @@ (component $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-script-root-binding/rust-sdk-input-note-get-script-root-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir index a040ecb68..9572deadc 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.hir @@ -21,10 +21,11 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/wit_bindgen::rt::run_ctors_once() - v100 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v9 = arith.constant 8 : i32; v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden_base_sys::bindings::input_note::get_sender(v10, v100) + hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden_base_sys::bindings::input_note::get_sender(v10, v12) v13 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/GOT.data.internal.__memory_base : ptr v14 = hir.bitcast v13 : ptr; v15 = hir.load v14 : i32; @@ -33,8 +34,8 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no v19 = arith.constant 8 : u32; v18 = hir.bitcast v6 : u32; v20 = arith.add v18, v19 : u32 #[overflow = checked]; - v102 = arith.constant 8 : u32; - v22 = arith.mod v20, v102 : u32; + v101 = arith.constant 8 : u32; + v22 = arith.mod v20, v101 : u32; hir.assertz v22 #[code = 250]; v23 = hir.int_to_ptr v20 : ptr; v24 = hir.load v23 : i64; @@ -44,8 +45,8 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v24; - v101 = arith.constant 16 : i32; - v30 = arith.add v6, v101 : i32 #[overflow = wrapping]; + v100 = arith.constant 16 : i32; + v30 = arith.add v6, v100 : i32 #[overflow = wrapping]; v31 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr v32 = hir.bitcast v31 : ptr; hir.store v32, v30; @@ -75,12 +76,12 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no v47 = hir.bitcast v46 : ptr; v48 = hir.load v47 : i32; hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__wasm_call_ctors() - v104 = arith.constant 1 : u8; - v106 = arith.constant 1048592 : i32; - v50 = arith.add v48, v106 : i32 #[overflow = wrapping]; + v103 = arith.constant 1 : u8; + v105 = arith.constant 1048592 : i32; + v50 = arith.add v48, v105 : i32 #[overflow = wrapping]; v54 = hir.bitcast v50 : u32; v55 = hir.int_to_ptr v54 : ptr; - hir.store v55, v104; + hir.store v55, v103; scf.yield ; }; builtin.ret ; @@ -108,13 +109,13 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no v73 = hir.int_to_ptr v70 : ptr; v74 = hir.load v73 : i64; v75 = hir.bitcast v56 : u32; - v108 = arith.constant 8 : u32; - v77 = arith.mod v75, v108 : u32; + v107 = arith.constant 8 : u32; + v77 = arith.mod v75, v107 : u32; hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; hir.store v78, v74; - v107 = arith.constant 16 : i32; - v80 = arith.add v63, v107 : i32 #[overflow = wrapping]; + v106 = arith.constant 16 : i32; + v80 = arith.add v63, v106 : i32 #[overflow = wrapping]; v81 = builtin.global_symbol @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/__stack_pointer : ptr v82 = hir.bitcast v81 : ptr; hir.store v82, v80; @@ -140,16 +141,16 @@ builtin.component miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-no public builtin.function @binding() -> felt, felt { ^block19: v85 = hir.exec @miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1/rust_sdk_input_note_get_sender_binding/miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender-binding@0.0.1#binding() : i32 - v110 = arith.constant 0 : i32; + v109 = arith.constant 0 : i32; v86 = arith.constant 0 : i32; v87 = arith.add v85, v86 : i32 #[overflow = unchecked]; - v89 = arith.add v87, v110 : i32 #[overflow = unchecked]; + v89 = arith.add v87, v109 : i32 #[overflow = unchecked]; v90 = hir.int_to_ptr v89 : ptr; v91 = hir.load v90 : felt; - v109 = arith.constant 0 : i32; + v108 = arith.constant 0 : i32; v92 = arith.constant 4 : i32; v93 = arith.add v85, v92 : i32 #[overflow = unchecked]; - v95 = arith.add v93, v109 : i32 #[overflow = unchecked]; + v95 = arith.add v93, v108 : i32 #[overflow = unchecked]; v96 = hir.int_to_ptr v95 : ptr; v97 = hir.load v96 : felt; builtin.ret v91, v97; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm index de9719f2a..af796c52f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.masm @@ -105,6 +105,9 @@ proc miden:rust-sdk-input-note-get-sender-binding/rust-sdk-input-note-get-sender trace.252 nop push.0 + push.0 + mul.4294967296 + add push.8 dup.2 u32wrapping_add diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat index 081ca3e98..f6e3728cd 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_sender_binding.wat @@ -12,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -34,8 +34,8 @@ local.get 0 i32.const 8 i32.add - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_sender global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -89,7 +89,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_sender (;6;) (type 4) (param f32 i32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir index 4cbf5a5d4..61a66afa9 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/wit_bindgen::rt::run_ctors_once() - v140 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden_base_sys::bindings::input_note::get_serial_number(v6, v140) + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden_base_sys::bindings::input_note::get_serial_number(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v145 = arith.constant 8 : u32; - v20 = arith.mod v18, v145 : u32; + v142 = arith.constant 8 : u32; + v20 = arith.mod v18, v142 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v144 = arith.constant 8 : u32; + v141 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v144 : u32 #[overflow = checked]; + v25 = arith.add v23, v141 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v143 = arith.constant 8 : u32; - v31 = arith.mod v29, v143 : u32; + v140 = arith.constant 8 : u32; + v31 = arith.mod v29, v140 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v142 = arith.constant 4 : u32; - v36 = arith.mod v34, v142 : u32; + v139 = arith.constant 4 : u32; + v36 = arith.mod v34, v139 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v141 = arith.constant 16 : i32; - v39 = arith.add v6, v141 : i32 #[overflow = wrapping]; + v138 = arith.constant 16 : i32; + v39 = arith.add v6, v138 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__wasm_call_ctors() - v147 = arith.constant 1 : u8; - v149 = arith.constant 1048600 : i32; - v59 = arith.add v57, v149 : i32 #[overflow = wrapping]; + v144 = arith.constant 1 : u8; + v146 = arith.constant 1048600 : i32; + v59 = arith.add v57, v146 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v147; + hir.store v64, v144; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v153, v154 = arith.split v79 : felt, felt; - v161 = arith.constant 8 : u32; + v150, v151 = arith.split v79 : felt, felt; + v158 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v161 : u32 #[overflow = checked]; - v160 = arith.constant 8 : u32; - v87 = arith.mod v85, v160 : u32; + v85 = arith.add v83, v158 : u32 #[overflow = checked]; + v157 = arith.constant 8 : u32; + v87 = arith.mod v85, v157 : u32; hir.assertz v87 #[code = 250]; - v155 = arith.join v154, v153 : i64; + v152 = arith.join v151, v150 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v155; - v159 = arith.constant 8 : u32; + hir.store v88, v152; + v156 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v159 : u32 #[overflow = checked]; - v158 = arith.constant 8 : u32; - v93 = arith.mod v91, v158 : u32; + v91 = arith.add v89, v156 : u32 #[overflow = checked]; + v155 = arith.constant 8 : u32; + v93 = arith.mod v91, v155 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v150, v151 = arith.split v95 : felt, felt; + v147, v148 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v157 = arith.constant 8 : u32; - v101 = arith.mod v99, v157 : u32; + v154 = arith.constant 8 : u32; + v101 = arith.mod v99, v154 : u32; hir.assertz v101 #[code = 250]; - v152 = arith.join v151, v150 : i64; + v149 = arith.join v148, v147 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v152; - v156 = arith.constant 16 : i32; - v104 = arith.add v72, v156 : i32 #[overflow = wrapping]; + hir.store v102, v149; + v153 = arith.constant 16 : i32; + v104 = arith.add v72, v153 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -168,32 +169,30 @@ builtin.component miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-i public builtin.function @binding() -> felt, felt, felt, felt { ^block19: v109 = hir.exec @miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1/rust_sdk_input_note_get_serial_number_binding/miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1#binding() : i32 + v162 = arith.constant 0 : i32; v110 = arith.constant 0 : i32; v111 = arith.add v109, v110 : i32 #[overflow = unchecked]; - v165 = arith.constant 0 : i32; - v166 = arith.constant 0 : i32; - v113 = arith.add v111, v166 : i32 #[overflow = unchecked]; - v115 = arith.add v113, v165 : i32 #[overflow = unchecked]; - v116 = hir.int_to_ptr v115 : ptr; - v117 = hir.load v116 : felt; - v164 = arith.constant 0 : i32; - v118 = arith.constant 4 : i32; - v119 = arith.add v111, v118 : i32 #[overflow = unchecked]; - v121 = arith.add v119, v164 : i32 #[overflow = unchecked]; - v122 = hir.int_to_ptr v121 : ptr; - v123 = hir.load v122 : felt; - v163 = arith.constant 0 : i32; - v124 = arith.constant 8 : i32; - v125 = arith.add v111, v124 : i32 #[overflow = unchecked]; - v127 = arith.add v125, v163 : i32 #[overflow = unchecked]; - v128 = hir.int_to_ptr v127 : ptr; - v129 = hir.load v128 : felt; - v162 = arith.constant 0 : i32; - v130 = arith.constant 12 : i32; - v131 = arith.add v111, v130 : i32 #[overflow = unchecked]; - v133 = arith.add v131, v162 : i32 #[overflow = unchecked]; - v134 = hir.int_to_ptr v133 : ptr; - v135 = hir.load v134 : felt; - builtin.ret v117, v123, v129, v135; + v113 = arith.add v111, v162 : i32 #[overflow = unchecked]; + v114 = hir.int_to_ptr v113 : ptr; + v115 = hir.load v114 : felt; + v161 = arith.constant 0 : i32; + v116 = arith.constant 4 : i32; + v117 = arith.add v109, v116 : i32 #[overflow = unchecked]; + v119 = arith.add v117, v161 : i32 #[overflow = unchecked]; + v120 = hir.int_to_ptr v119 : ptr; + v121 = hir.load v120 : felt; + v160 = arith.constant 0 : i32; + v122 = arith.constant 8 : i32; + v123 = arith.add v109, v122 : i32 #[overflow = unchecked]; + v125 = arith.add v123, v160 : i32 #[overflow = unchecked]; + v126 = hir.int_to_ptr v125 : ptr; + v127 = hir.load v126 : felt; + v159 = arith.constant 0 : i32; + v128 = arith.constant 12 : i32; + v129 = arith.add v109, v128 : i32 #[overflow = unchecked]; + v131 = arith.add v129, v159 : i32 #[overflow = unchecked]; + v132 = hir.int_to_ptr v131 : ptr; + v133 = hir.load v132 : felt; + builtin.ret v115, v121, v127, v133; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm index 18ccb9887..9a3923ac0 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -132,6 +130,9 @@ proc miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat index 0ccb77d92..85906d8fb 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_input_note_get_serial_number_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -33,8 +32,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::input_note::get_serial_number global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -98,7 +97,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::input_note::get_serial_number (;6;) (type 4) (param f32 i32) @@ -118,15 +117,14 @@ (component $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-input-note-get-serial-number-binding/rust-sdk-input-note-get-serial-number-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir index 1910c3694..703907a09 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.hir @@ -10,7 +10,7 @@ builtin.component miden:base/note-script@1.0.0 { v3 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 1048584 : i32; + v6 = arith.constant 1048612 : i32; v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; v8 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc(v7, v1, v0) : i32 builtin.ret v8; @@ -26,36 +26,36 @@ builtin.component miden:base/note-script@1.0.0 { v15 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr v16 = hir.bitcast v15 : ptr; v17 = hir.load v16 : i32; - v18 = arith.constant 1048584 : i32; + v18 = arith.constant 1048612 : i32; v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; v20 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc(v19, v13, v12) : i32 - v853 = arith.constant 0 : i32; + v877 = arith.constant 0 : i32; v21 = arith.constant 0 : i32; v22 = arith.eq v20, v21 : i1; v23 = arith.zext v22 : u32; v24 = hir.bitcast v23 : i32; - v26 = arith.neq v24, v853 : i1; + v26 = arith.neq v24, v877 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v851 = arith.constant 0 : i32; - v852 = arith.constant 0 : i32; - v28 = arith.eq v12, v852 : i1; + v875 = arith.constant 0 : i32; + v876 = arith.constant 0 : i32; + v28 = arith.eq v12, v876 : i1; v29 = arith.zext v28 : u32; v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v851 : i1; + v32 = arith.neq v30, v875 : i1; scf.if v32{ - ^block110: + ^block114: scf.yield ; } else { ^block15: - v845 = arith.constant 0 : u8; + v869 = arith.constant 0 : u8; v35 = hir.bitcast v12 : u32; v36 = hir.bitcast v20 : u32; v37 = hir.int_to_ptr v36 : ptr; - hir.mem_set v37, v35, v845; + hir.mem_set v37, v35, v869; scf.yield ; }; scf.yield ; @@ -85,7 +85,7 @@ builtin.component miden:base/note-script@1.0.0 { v44 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr v45 = hir.bitcast v44 : ptr; v46 = hir.load v45 : i32; - v47 = arith.constant 1048588 : i32; + v47 = arith.constant 1048616 : i32; v48 = arith.add v46, v47 : i32 #[overflow = wrapping]; v49 = hir.bitcast v48 : u32; v50 = hir.int_to_ptr v49 : ptr; @@ -103,12 +103,12 @@ builtin.component miden:base/note-script@1.0.0 { v57 = hir.bitcast v56 : ptr; v58 = hir.load v57 : i32; hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__wasm_call_ctors() - v855 = arith.constant 1 : u8; - v857 = arith.constant 1048588 : i32; - v60 = arith.add v58, v857 : i32 #[overflow = wrapping]; + v879 = arith.constant 1 : u8; + v881 = arith.constant 1048616 : i32; + v60 = arith.add v58, v881 : i32 #[overflow = wrapping]; v64 = hir.bitcast v60 : u32; v65 = hir.int_to_ptr v64 : ptr; - hir.store v65, v855; + hir.store v65, v879; scf.yield ; }; builtin.ret ; @@ -118,27 +118,27 @@ builtin.component miden:base/note-script@1.0.0 { ^block26(v66: i32, v67: i32, v68: i32): v71 = arith.constant 16 : i32; v70 = arith.constant 0 : i32; - v859 = arith.constant 16 : u32; + v883 = arith.constant 16 : u32; v73 = hir.bitcast v67 : u32; - v75 = arith.gt v73, v859 : i1; + v75 = arith.gt v73, v883 : i1; v76 = arith.zext v75 : u32; v77 = hir.bitcast v76 : i32; v79 = arith.neq v77, v70 : i1; v80 = cf.select v79, v67, v71 : i32; - v899 = arith.constant 0 : i32; + v923 = arith.constant 0 : i32; v81 = arith.constant -1 : i32; v82 = arith.add v80, v81 : i32 #[overflow = wrapping]; v83 = arith.band v80, v82 : i32; - v85 = arith.neq v83, v899 : i1; - v868, v869 = scf.if v85 : i32, u32 { - ^block116: - v860 = arith.constant 0 : u32; - v864 = ub.poison i32 : i32; - scf.yield v864, v860; + v85 = arith.neq v83, v923 : i1; + v892, v893 = scf.if v85 : i32, u32 { + ^block120: + v884 = arith.constant 0 : u32; + v888 = ub.poison i32 : i32; + scf.yield v888, v884; } else { ^block29: v87 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::max(v67, v80) : i32 - v898 = arith.constant 0 : i32; + v922 = arith.constant 0 : i32; v86 = arith.constant -2147483648 : i32; v88 = arith.sub v86, v87 : i32 #[overflow = wrapping]; v90 = hir.bitcast v88 : u32; @@ -146,18 +146,18 @@ builtin.component miden:base/note-script@1.0.0 { v91 = arith.gt v89, v90 : i1; v92 = arith.zext v91 : u32; v93 = hir.bitcast v92 : i32; - v95 = arith.neq v93, v898 : i1; - v883 = scf.if v95 : i32 { - ^block115: - v897 = ub.poison i32 : i32; - scf.yield v897; + v95 = arith.neq v93, v922 : i1; + v907 = scf.if v95 : i32 { + ^block119: + v921 = ub.poison i32 : i32; + scf.yield v921; } else { ^block30: - v895 = arith.constant 0 : i32; - v101 = arith.sub v895, v87 : i32 #[overflow = wrapping]; - v896 = arith.constant -1 : i32; + v919 = arith.constant 0 : i32; + v101 = arith.sub v919, v87 : i32 #[overflow = wrapping]; + v920 = arith.constant -1 : i32; v97 = arith.add v68, v87 : i32 #[overflow = wrapping]; - v99 = arith.add v97, v896 : i32 #[overflow = wrapping]; + v99 = arith.add v97, v920 : i32 #[overflow = wrapping]; v102 = arith.band v99, v101 : i32; v103 = hir.bitcast v66 : u32; v104 = arith.constant 4 : u32; @@ -165,51 +165,51 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v105 #[code = 250]; v106 = hir.int_to_ptr v103 : ptr; v107 = hir.load v106 : i32; - v894 = arith.constant 0 : i32; - v109 = arith.neq v107, v894 : i1; + v918 = arith.constant 0 : i32; + v109 = arith.neq v107, v918 : i1; scf.if v109{ - ^block114: + ^block118: scf.yield ; } else { ^block32: v110 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/intrinsics::mem::heap_base() : i32 v111 = hir.mem_size : u32; v117 = hir.bitcast v66 : u32; - v893 = arith.constant 4 : u32; - v119 = arith.mod v117, v893 : u32; + v917 = arith.constant 4 : u32; + v119 = arith.mod v117, v917 : u32; hir.assertz v119 #[code = 250]; - v892 = arith.constant 16 : u32; + v916 = arith.constant 16 : u32; v112 = hir.bitcast v111 : i32; - v115 = arith.shl v112, v892 : i32; + v115 = arith.shl v112, v916 : i32; v116 = arith.add v110, v115 : i32 #[overflow = wrapping]; v120 = hir.int_to_ptr v117 : ptr; hir.store v120, v116; scf.yield ; }; v123 = hir.bitcast v66 : u32; - v891 = arith.constant 4 : u32; - v125 = arith.mod v123, v891 : u32; + v915 = arith.constant 4 : u32; + v125 = arith.mod v123, v915 : u32; hir.assertz v125 #[code = 250]; v126 = hir.int_to_ptr v123 : ptr; v127 = hir.load v126 : i32; - v889 = arith.constant 0 : i32; - v890 = arith.constant -1 : i32; - v129 = arith.bxor v127, v890 : i32; + v913 = arith.constant 0 : i32; + v914 = arith.constant -1 : i32; + v129 = arith.bxor v127, v914 : i32; v131 = hir.bitcast v129 : u32; v130 = hir.bitcast v102 : u32; v132 = arith.gt v130, v131 : i1; v133 = arith.zext v132 : u32; v134 = hir.bitcast v133 : i32; - v136 = arith.neq v134, v889 : i1; - v882 = scf.if v136 : i32 { + v136 = arith.neq v134, v913 : i1; + v906 = scf.if v136 : i32 { ^block33: - v888 = arith.constant 0 : i32; - scf.yield v888; + v912 = arith.constant 0 : i32; + scf.yield v912; } else { ^block34: v138 = hir.bitcast v66 : u32; - v887 = arith.constant 4 : u32; - v140 = arith.mod v138, v887 : u32; + v911 = arith.constant 4 : u32; + v140 = arith.mod v138, v911 : u32; hir.assertz v140 #[code = 250]; v137 = arith.add v127, v102 : i32 #[overflow = wrapping]; v141 = hir.int_to_ptr v138 : ptr; @@ -217,20 +217,20 @@ builtin.component miden:base/note-script@1.0.0 { v143 = arith.add v127, v87 : i32 #[overflow = wrapping]; scf.yield v143; }; - scf.yield v882; + scf.yield v906; }; - v865 = arith.constant 1 : u32; - v886 = arith.constant 0 : u32; - v884 = cf.select v95, v886, v865 : u32; - scf.yield v883, v884; + v889 = arith.constant 1 : u32; + v910 = arith.constant 0 : u32; + v908 = cf.select v95, v910, v889 : u32; + scf.yield v907, v908; }; - v885 = arith.constant 0 : u32; - v881 = arith.eq v869, v885 : i1; - cf.cond_br v881 ^block28, ^block118(v868); + v909 = arith.constant 0 : u32; + v905 = arith.eq v893, v909 : i1; + cf.cond_br v905 ^block28, ^block122(v892); ^block28: ub.unreachable ; - ^block118(v861: i32): - builtin.ret v861; + ^block122(v885: i32): + builtin.ret v885; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -249,22 +249,22 @@ builtin.component miden:base/note-script@1.0.0 { v156 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr v157 = hir.bitcast v156 : ptr; hir.store v157, v155; - v904 = arith.constant 16 : i32; + v928 = arith.constant 16 : i32; v160 = arith.constant 256 : i32; v158 = arith.constant 8 : i32; v159 = arith.add v155, v158 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::with_capacity_in(v159, v160, v904, v904) + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::with_capacity_in(v159, v160, v928, v928) v164 = arith.constant 8 : u32; v163 = hir.bitcast v155 : u32; v165 = arith.add v163, v164 : u32 #[overflow = checked]; - v903 = arith.constant 8 : u32; - v167 = arith.mod v165, v903 : u32; + v927 = arith.constant 8 : u32; + v167 = arith.mod v165, v927 : u32; hir.assertz v167 #[code = 250]; v168 = hir.int_to_ptr v165 : ptr; v169 = hir.load v168 : i64; - v902 = arith.constant 8 : u32; + v926 = arith.constant 8 : u32; v171 = hir.bitcast v148 : u32; - v173 = arith.add v171, v902 : u32 #[overflow = checked]; + v173 = arith.add v171, v926 : u32 #[overflow = checked]; v174 = arith.constant 4 : u32; v175 = arith.mod v173, v174 : u32; hir.assertz v175 #[code = 250]; @@ -272,13 +272,13 @@ builtin.component miden:base/note-script@1.0.0 { v176 = hir.int_to_ptr v173 : ptr; hir.store v176, v149; v177 = hir.bitcast v148 : u32; - v901 = arith.constant 4 : u32; - v179 = arith.mod v177, v901 : u32; + v925 = arith.constant 4 : u32; + v179 = arith.mod v177, v925 : u32; hir.assertz v179 #[code = 250]; v180 = hir.int_to_ptr v177 : ptr; hir.store v180, v169; - v900 = arith.constant 16 : i32; - v182 = arith.add v155, v900 : i32 #[overflow = wrapping]; + v924 = arith.constant 16 : i32; + v182 = arith.add v155, v924 : i32 #[overflow = wrapping]; v183 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr v184 = hir.bitcast v183 : ptr; hir.store v184, v182; @@ -307,56 +307,56 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v204 #[code = 250]; v205 = hir.int_to_ptr v202 : ptr; v206 = hir.load v205 : i32; - v915 = arith.constant 4 : u32; + v939 = arith.constant 4 : u32; v207 = hir.bitcast v194 : u32; - v209 = arith.add v207, v915 : u32 #[overflow = checked]; - v914 = arith.constant 4 : u32; - v211 = arith.mod v209, v914 : u32; + v209 = arith.add v207, v939 : u32 #[overflow = checked]; + v938 = arith.constant 4 : u32; + v211 = arith.mod v209, v938 : u32; hir.assertz v211 #[code = 250]; v212 = hir.int_to_ptr v209 : ptr; v213 = hir.load v212 : i32; - v913 = arith.constant 0 : i32; + v937 = arith.constant 0 : i32; v214 = arith.constant 1 : i32; v215 = arith.neq v213, v214 : i1; v216 = arith.zext v215 : u32; v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v913 : i1; + v219 = arith.neq v217, v937 : i1; cf.cond_br v219 ^block43, ^block44; ^block43: v228 = arith.constant 12 : u32; v227 = hir.bitcast v194 : u32; v229 = arith.add v227, v228 : u32 #[overflow = checked]; - v912 = arith.constant 4 : u32; - v231 = arith.mod v229, v912 : u32; + v936 = arith.constant 4 : u32; + v231 = arith.mod v229, v936 : u32; hir.assertz v231 #[code = 250]; v232 = hir.int_to_ptr v229 : ptr; v233 = hir.load v232 : i32; - v911 = arith.constant 4 : u32; + v935 = arith.constant 4 : u32; v234 = hir.bitcast v185 : u32; - v236 = arith.add v234, v911 : u32 #[overflow = checked]; - v910 = arith.constant 4 : u32; - v238 = arith.mod v236, v910 : u32; + v236 = arith.add v234, v935 : u32 #[overflow = checked]; + v934 = arith.constant 4 : u32; + v238 = arith.mod v236, v934 : u32; hir.assertz v238 #[code = 250]; v239 = hir.int_to_ptr v236 : ptr; hir.store v239, v233; v240 = hir.bitcast v185 : u32; - v909 = arith.constant 4 : u32; - v242 = arith.mod v240, v909 : u32; + v933 = arith.constant 4 : u32; + v242 = arith.mod v240, v933 : u32; hir.assertz v242 #[code = 250]; v243 = hir.int_to_ptr v240 : ptr; hir.store v243, v206; - v908 = arith.constant 16 : i32; - v245 = arith.add v194, v908 : i32 #[overflow = wrapping]; + v932 = arith.constant 16 : i32; + v245 = arith.add v194, v932 : i32 #[overflow = wrapping]; v246 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr v247 = hir.bitcast v246 : ptr; hir.store v247, v245; builtin.ret ; ^block44: - v907 = arith.constant 12 : u32; + v931 = arith.constant 12 : u32; v220 = hir.bitcast v194 : u32; - v222 = arith.add v220, v907 : u32 #[overflow = checked]; - v906 = arith.constant 4 : u32; - v224 = arith.mod v222, v906 : u32; + v222 = arith.add v220, v931 : u32 #[overflow = checked]; + v930 = arith.constant 4 : u32; + v224 = arith.mod v222, v930 : u32; hir.assertz v224 #[code = 250]; v225 = hir.int_to_ptr v222 : ptr; v226 = hir.load v225 : i32; @@ -385,35 +385,35 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v265 #[code = 250]; v266 = hir.int_to_ptr v263 : ptr; v267 = hir.load v266 : i32; - v916 = arith.constant 2 : u32; + v940 = arith.constant 2 : u32; v269 = hir.bitcast v267 : u32; - v271 = arith.shr v269, v916 : u32; + v271 = arith.shr v269, v940 : u32; v272 = hir.bitcast v271 : i32; v273 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::protocol::active_note::get_assets(v272) : i32 v259 = arith.constant 8 : i32; v260 = arith.add v248, v259 : i32 #[overflow = wrapping]; v274 = hir.bitcast v260 : u32; - v921 = arith.constant 4 : u32; - v276 = arith.mod v274, v921 : u32; + v945 = arith.constant 4 : u32; + v276 = arith.mod v274, v945 : u32; hir.assertz v276 #[code = 250]; v277 = hir.int_to_ptr v274 : ptr; hir.store v277, v273; - v920 = arith.constant 4 : u32; + v944 = arith.constant 4 : u32; v278 = hir.bitcast v254 : u32; - v280 = arith.add v278, v920 : u32 #[overflow = checked]; - v919 = arith.constant 4 : u32; - v282 = arith.mod v280, v919 : u32; + v280 = arith.add v278, v944 : u32 #[overflow = checked]; + v943 = arith.constant 4 : u32; + v282 = arith.mod v280, v943 : u32; hir.assertz v282 #[code = 250]; v283 = hir.int_to_ptr v280 : ptr; v284 = hir.load v283 : i64; v285 = hir.bitcast v248 : u32; - v918 = arith.constant 4 : u32; - v287 = arith.mod v285, v918 : u32; + v942 = arith.constant 4 : u32; + v287 = arith.mod v285, v942 : u32; hir.assertz v287 #[code = 250]; v288 = hir.int_to_ptr v285 : ptr; hir.store v288, v284; - v917 = arith.constant 16 : i32; - v290 = arith.add v254, v917 : i32 #[overflow = wrapping]; + v941 = arith.constant 16 : i32; + v290 = arith.add v254, v941 : i32 #[overflow = wrapping]; v291 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr v292 = hir.bitcast v291 : ptr; hir.store v292, v290; @@ -444,26 +444,26 @@ builtin.component miden:base/note-script@1.0.0 { v311 = arith.constant 36 : u32; v310 = hir.bitcast v298 : u32; v312 = arith.add v310, v311 : u32 #[overflow = checked]; - v992 = arith.constant 4 : u32; - v314 = arith.mod v312, v992 : u32; + v1016 = arith.constant 4 : u32; + v314 = arith.mod v312, v1016 : u32; hir.assertz v314 #[code = 250]; v315 = hir.int_to_ptr v312 : ptr; v316 = hir.load v315 : i32; v318 = arith.constant 40 : u32; v317 = hir.bitcast v298 : u32; v319 = arith.add v317, v318 : u32 #[overflow = checked]; - v991 = arith.constant 4 : u32; - v321 = arith.mod v319, v991 : u32; + v1015 = arith.constant 4 : u32; + v321 = arith.mod v319, v1015 : u32; hir.assertz v321 #[code = 250]; v322 = hir.int_to_ptr v319 : ptr; v323 = hir.load v322 : i32; - v990 = arith.constant 4 : u32; - v326 = arith.shl v323, v990 : i32; + v1014 = arith.constant 4 : u32; + v326 = arith.shl v323, v1014 : i32; v329 = arith.constant 12 : u32; v328 = hir.bitcast v298 : u32; v330 = arith.add v328, v329 : u32 #[overflow = checked]; - v989 = arith.constant 4 : u32; - v332 = arith.mod v330, v989 : u32; + v1013 = arith.constant 4 : u32; + v332 = arith.mod v330, v1013 : u32; hir.assertz v332 #[code = 250]; v327 = arith.add v316, v326 : i32 #[overflow = wrapping]; v333 = hir.int_to_ptr v330 : ptr; @@ -471,102 +471,102 @@ builtin.component miden:base/note-script@1.0.0 { v335 = arith.constant 8 : u32; v334 = hir.bitcast v298 : u32; v336 = arith.add v334, v335 : u32 #[overflow = checked]; - v988 = arith.constant 4 : u32; - v338 = arith.mod v336, v988 : u32; + v1012 = arith.constant 4 : u32; + v338 = arith.mod v336, v1012 : u32; hir.assertz v338 #[code = 250]; v339 = hir.int_to_ptr v336 : ptr; hir.store v339, v309; - v987 = arith.constant 4 : u32; + v1011 = arith.constant 4 : u32; v340 = hir.bitcast v298 : u32; - v342 = arith.add v340, v987 : u32 #[overflow = checked]; - v986 = arith.constant 4 : u32; - v344 = arith.mod v342, v986 : u32; + v342 = arith.add v340, v1011 : u32 #[overflow = checked]; + v1010 = arith.constant 4 : u32; + v344 = arith.mod v342, v1010 : u32; hir.assertz v344 #[code = 250]; v345 = hir.int_to_ptr v342 : ptr; hir.store v345, v316; v346 = hir.bitcast v298 : u32; - v985 = arith.constant 4 : u32; - v348 = arith.mod v346, v985 : u32; + v1009 = arith.constant 4 : u32; + v348 = arith.mod v346, v1009 : u32; hir.assertz v348 #[code = 250]; v349 = hir.int_to_ptr v346 : ptr; hir.store v349, v316; - v963, v964, v965, v966 = scf.while v326, v298, v316 : i32, i32, i32, i32 { - ^block131(v967: i32, v968: i32, v969: i32): - v984 = arith.constant 0 : i32; + v987, v988, v989, v990 = scf.while v326, v298, v316 : i32, i32, i32, i32 { + ^block135(v991: i32, v992: i32, v993: i32): + v1008 = arith.constant 0 : i32; v293 = arith.constant 0 : i32; - v352 = arith.eq v967, v293 : i1; + v352 = arith.eq v991, v293 : i1; v353 = arith.zext v352 : u32; v354 = hir.bitcast v353 : i32; - v356 = arith.neq v354, v984 : i1; - v958, v959 = scf.if v356 : i32, i32 { - ^block130: - v930 = ub.poison i32 : i32; - scf.yield v930, v930; + v356 = arith.neq v354, v1008 : i1; + v982, v983 = scf.if v356 : i32, i32 { + ^block134: + v954 = ub.poison i32 : i32; + scf.yield v954, v954; } else { ^block52: v359 = arith.constant 16 : i32; - v360 = arith.add v969, v359 : i32 #[overflow = wrapping]; - v983 = arith.constant 4 : u32; - v361 = hir.bitcast v968 : u32; - v363 = arith.add v361, v983 : u32 #[overflow = checked]; - v982 = arith.constant 4 : u32; - v365 = arith.mod v363, v982 : u32; + v360 = arith.add v993, v359 : i32 #[overflow = wrapping]; + v1007 = arith.constant 4 : u32; + v361 = hir.bitcast v992 : u32; + v363 = arith.add v361, v1007 : u32 #[overflow = checked]; + v1006 = arith.constant 4 : u32; + v365 = arith.mod v363, v1006 : u32; hir.assertz v365 #[code = 250]; v366 = hir.int_to_ptr v363 : ptr; hir.store v366, v360; - v367 = hir.bitcast v969 : u32; - v981 = arith.constant 8 : u32; - v369 = arith.mod v367, v981 : u32; + v367 = hir.bitcast v993 : u32; + v1005 = arith.constant 8 : u32; + v369 = arith.mod v367, v1005 : u32; hir.assertz v369 #[code = 250]; v370 = hir.int_to_ptr v367 : ptr; v371 = hir.load v370 : i64; v373 = arith.constant 16 : u32; - v372 = hir.bitcast v968 : u32; + v372 = hir.bitcast v992 : u32; v374 = arith.add v372, v373 : u32 #[overflow = checked]; - v980 = arith.constant 8 : u32; - v376 = arith.mod v374, v980 : u32; + v1004 = arith.constant 8 : u32; + v376 = arith.mod v374, v1004 : u32; hir.assertz v376 #[code = 250]; v377 = hir.int_to_ptr v374 : ptr; hir.store v377, v371; v378 = arith.constant 8 : i32; - v379 = arith.add v969, v378 : i32 #[overflow = wrapping]; + v379 = arith.add v993, v378 : i32 #[overflow = wrapping]; v380 = hir.bitcast v379 : u32; - v979 = arith.constant 8 : u32; - v382 = arith.mod v380, v979 : u32; + v1003 = arith.constant 8 : u32; + v382 = arith.mod v380, v1003 : u32; hir.assertz v382 #[code = 250]; v383 = hir.int_to_ptr v380 : ptr; v384 = hir.load v383 : i64; v386 = arith.constant 24 : u32; - v385 = hir.bitcast v968 : u32; + v385 = hir.bitcast v992 : u32; v387 = arith.add v385, v386 : u32 #[overflow = checked]; - v978 = arith.constant 8 : u32; - v389 = arith.mod v387, v978 : u32; + v1002 = arith.constant 8 : u32; + v389 = arith.mod v387, v1002 : u32; hir.assertz v389 #[code = 250]; v390 = hir.int_to_ptr v387 : ptr; hir.store v390, v384; - v976 = arith.constant 16 : i32; - v396 = arith.add v968, v976 : i32 #[overflow = wrapping]; - v977 = arith.constant 32 : i32; - v394 = arith.add v968, v977 : i32 #[overflow = wrapping]; + v1000 = arith.constant 16 : i32; + v396 = arith.add v992, v1000 : i32 #[overflow = wrapping]; + v1001 = arith.constant 32 : i32; + v394 = arith.add v992, v1001 : i32 #[overflow = wrapping]; hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden_base_sys::bindings::native_account::add_asset(v394, v396) v391 = arith.constant -16 : i32; - v392 = arith.add v967, v391 : i32 #[overflow = wrapping]; + v392 = arith.add v991, v391 : i32 #[overflow = wrapping]; scf.yield v392, v360; }; - v975 = ub.poison i32 : i32; - v960 = cf.select v356, v975, v968 : i32; - v929 = arith.constant 1 : u32; - v923 = arith.constant 0 : u32; - v962 = cf.select v356, v923, v929 : u32; - v952 = arith.trunc v962 : i1; - scf.condition v952, v958, v960, v959, v968; + v999 = ub.poison i32 : i32; + v984 = cf.select v356, v999, v992 : i32; + v953 = arith.constant 1 : u32; + v947 = arith.constant 0 : u32; + v986 = cf.select v356, v947, v953 : u32; + v976 = arith.trunc v986 : i1; + scf.condition v976, v982, v984, v983, v992; } do { - ^block132(v970: i32, v971: i32, v972: i32, v973: i32): - scf.yield v970, v971, v972; + ^block136(v994: i32, v995: i32, v996: i32, v997: i32): + scf.yield v994, v995, v996; }; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/ as core::ops::drop::Drop>::drop(v966) - v974 = arith.constant 48 : i32; - v398 = arith.add v966, v974 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/ as core::ops::drop::Drop>::drop(v990) + v998 = arith.constant 48 : i32; + v398 = arith.add v990, v998 : i32 #[overflow = wrapping]; v399 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr v400 = hir.bitcast v399 : ptr; hir.store v400, v398; @@ -575,623 +575,649 @@ builtin.component miden:base/note-script@1.0.0 { private builtin.function @miden_base_sys::bindings::native_account::add_asset(v401: i32, v402: i32) { ^block53(v401: i32, v402: i32): - v404 = arith.constant 12 : u32; - v403 = hir.bitcast v402 : u32; - v405 = arith.add v403, v404 : u32 #[overflow = checked]; - v406 = arith.constant 4 : u32; - v407 = arith.mod v405, v406 : u32; - hir.assertz v407 #[code = 250]; - v408 = hir.int_to_ptr v405 : ptr; - v409 = hir.load v408 : felt; - v411 = arith.constant 8 : u32; - v410 = hir.bitcast v402 : u32; - v412 = arith.add v410, v411 : u32 #[overflow = checked]; - v996 = arith.constant 4 : u32; - v414 = arith.mod v412, v996 : u32; - hir.assertz v414 #[code = 250]; - v415 = hir.int_to_ptr v412 : ptr; - v416 = hir.load v415 : felt; - v995 = arith.constant 4 : u32; - v417 = hir.bitcast v402 : u32; - v419 = arith.add v417, v995 : u32 #[overflow = checked]; - v994 = arith.constant 4 : u32; - v421 = arith.mod v419, v994 : u32; - hir.assertz v421 #[code = 250]; - v422 = hir.int_to_ptr v419 : ptr; - v423 = hir.load v422 : felt; - v424 = hir.bitcast v402 : u32; - v993 = arith.constant 4 : u32; - v426 = arith.mod v424, v993 : u32; - hir.assertz v426 #[code = 250]; - v427 = hir.int_to_ptr v424 : ptr; - v428 = hir.load v427 : felt; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::protocol::native_account::add_asset(v409, v416, v423, v428, v401) + v405 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/GOT.data.internal.__memory_base : ptr + v406 = hir.bitcast v405 : ptr; + v407 = hir.load v406 : i32; + v408 = arith.constant 1048596 : i32; + v409 = arith.add v407, v408 : i32 #[overflow = wrapping]; + v404 = arith.constant 3 : i32; + v410 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/>::index(v402, v404, v409) : i32 + v411 = hir.bitcast v410 : u32; + v412 = arith.constant 4 : u32; + v413 = arith.mod v411, v412 : u32; + hir.assertz v413 #[code = 250]; + v414 = hir.int_to_ptr v411 : ptr; + v415 = hir.load v414 : felt; + v416 = arith.constant 2 : i32; + v417 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/>::index(v402, v416, v409) : i32 + v418 = hir.bitcast v417 : u32; + v1019 = arith.constant 4 : u32; + v420 = arith.mod v418, v1019 : u32; + hir.assertz v420 #[code = 250]; + v421 = hir.int_to_ptr v418 : ptr; + v422 = hir.load v421 : felt; + v423 = arith.constant 1 : i32; + v424 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/>::index(v402, v423, v409) : i32 + v425 = hir.bitcast v424 : u32; + v1018 = arith.constant 4 : u32; + v427 = arith.mod v425, v1018 : u32; + hir.assertz v427 #[code = 250]; + v428 = hir.int_to_ptr v425 : ptr; + v429 = hir.load v428 : felt; + v403 = arith.constant 0 : i32; + v431 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/>::index(v402, v403, v409) : i32 + v432 = hir.bitcast v431 : u32; + v1017 = arith.constant 4 : u32; + v434 = arith.mod v432, v1017 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + v436 = hir.load v435 : felt; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden::protocol::native_account::add_asset(v415, v422, v429, v436, v401) builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v429: i32) { - ^block55(v429: i32): - v431 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v432 = hir.bitcast v431 : ptr; - v433 = hir.load v432 : i32; - v434 = arith.constant 16 : i32; - v435 = arith.sub v433, v434 : i32 #[overflow = wrapping]; - v436 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v437 = hir.bitcast v436 : ptr; - hir.store v437, v435; - v439 = arith.constant 12 : u32; - v438 = hir.bitcast v435 : u32; - v440 = arith.add v438, v439 : u32 #[overflow = checked]; - v441 = arith.constant 4 : u32; - v442 = arith.mod v440, v441 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v429; - v444 = arith.constant 12 : i32; - v445 = arith.add v435, v444 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop(v445) - v997 = arith.constant 16 : i32; - v447 = arith.add v435, v997 : i32 #[overflow = wrapping]; - v448 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v449 = hir.bitcast v448 : ptr; - hir.store v449, v447; + private builtin.function @ as core::ops::drop::Drop>::drop(v437: i32) { + ^block55(v437: i32): + v439 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v440 = hir.bitcast v439 : ptr; + v441 = hir.load v440 : i32; + v442 = arith.constant 16 : i32; + v443 = arith.sub v441, v442 : i32 #[overflow = wrapping]; + v444 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v445 = hir.bitcast v444 : ptr; + hir.store v445, v443; + v447 = arith.constant 12 : u32; + v446 = hir.bitcast v443 : u32; + v448 = arith.add v446, v447 : u32 #[overflow = checked]; + v449 = arith.constant 4 : u32; + v450 = arith.mod v448, v449 : u32; + hir.assertz v450 #[code = 250]; + v451 = hir.int_to_ptr v448 : ptr; + hir.store v451, v437; + v452 = arith.constant 12 : i32; + v453 = arith.add v443, v452 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop(v453) + v1020 = arith.constant 16 : i32; + v455 = arith.add v443, v1020 : i32 #[overflow = wrapping]; + v456 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v457 = hir.bitcast v456 : ptr; + hir.store v457, v455; builtin.ret ; }; - private builtin.function @< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop(v450: i32) { - ^block57(v450: i32): - v452 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v453 = hir.bitcast v452 : ptr; - v454 = hir.load v453 : i32; - v455 = arith.constant 16 : i32; - v456 = arith.sub v454, v455 : i32 #[overflow = wrapping]; - v457 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v458 = hir.bitcast v457 : ptr; - hir.store v458, v456; - v459 = hir.bitcast v450 : u32; - v460 = arith.constant 4 : u32; - v461 = arith.mod v459, v460 : u32; - hir.assertz v461 #[code = 250]; - v462 = hir.int_to_ptr v459 : ptr; - v463 = hir.load v462 : i32; - v464 = hir.bitcast v463 : u32; - v1003 = arith.constant 4 : u32; - v466 = arith.mod v464, v1003 : u32; - hir.assertz v466 #[code = 250]; - v467 = hir.int_to_ptr v464 : ptr; - v468 = hir.load v467 : i32; - v470 = arith.constant 12 : u32; - v469 = hir.bitcast v456 : u32; - v471 = arith.add v469, v470 : u32 #[overflow = checked]; - v1002 = arith.constant 4 : u32; - v473 = arith.mod v471, v1002 : u32; - hir.assertz v473 #[code = 250]; - v474 = hir.int_to_ptr v471 : ptr; - hir.store v474, v468; - v476 = arith.constant 8 : u32; - v475 = hir.bitcast v463 : u32; - v477 = arith.add v475, v476 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v479 = arith.mod v477, v1001 : u32; - hir.assertz v479 #[code = 250]; - v480 = hir.int_to_ptr v477 : ptr; - v481 = hir.load v480 : i32; - v1000 = arith.constant 8 : u32; - v482 = hir.bitcast v456 : u32; - v484 = arith.add v482, v1000 : u32 #[overflow = checked]; - v999 = arith.constant 4 : u32; - v486 = arith.mod v484, v999 : u32; - hir.assertz v486 #[code = 250]; - v487 = hir.int_to_ptr v484 : ptr; - hir.store v487, v481; - v488 = arith.constant 8 : i32; - v489 = arith.add v456, v488 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/ as core::ops::drop::Drop>::drop(v489) - v998 = arith.constant 16 : i32; - v491 = arith.add v456, v998 : i32 #[overflow = wrapping]; - v492 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v493 = hir.bitcast v492 : ptr; - hir.store v493, v491; + private builtin.function @< as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop(v458: i32) { + ^block57(v458: i32): + v460 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v461 = hir.bitcast v460 : ptr; + v462 = hir.load v461 : i32; + v463 = arith.constant 16 : i32; + v464 = arith.sub v462, v463 : i32 #[overflow = wrapping]; + v465 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v466 = hir.bitcast v465 : ptr; + hir.store v466, v464; + v467 = hir.bitcast v458 : u32; + v468 = arith.constant 4 : u32; + v469 = arith.mod v467, v468 : u32; + hir.assertz v469 #[code = 250]; + v470 = hir.int_to_ptr v467 : ptr; + v471 = hir.load v470 : i32; + v472 = hir.bitcast v471 : u32; + v1026 = arith.constant 4 : u32; + v474 = arith.mod v472, v1026 : u32; + hir.assertz v474 #[code = 250]; + v475 = hir.int_to_ptr v472 : ptr; + v476 = hir.load v475 : i32; + v478 = arith.constant 12 : u32; + v477 = hir.bitcast v464 : u32; + v479 = arith.add v477, v478 : u32 #[overflow = checked]; + v1025 = arith.constant 4 : u32; + v481 = arith.mod v479, v1025 : u32; + hir.assertz v481 #[code = 250]; + v482 = hir.int_to_ptr v479 : ptr; + hir.store v482, v476; + v484 = arith.constant 8 : u32; + v483 = hir.bitcast v471 : u32; + v485 = arith.add v483, v484 : u32 #[overflow = checked]; + v1024 = arith.constant 4 : u32; + v487 = arith.mod v485, v1024 : u32; + hir.assertz v487 #[code = 250]; + v488 = hir.int_to_ptr v485 : ptr; + v489 = hir.load v488 : i32; + v1023 = arith.constant 8 : u32; + v490 = hir.bitcast v464 : u32; + v492 = arith.add v490, v1023 : u32 #[overflow = checked]; + v1022 = arith.constant 4 : u32; + v494 = arith.mod v492, v1022 : u32; + hir.assertz v494 #[code = 250]; + v495 = hir.int_to_ptr v492 : ptr; + hir.store v495, v489; + v496 = arith.constant 8 : i32; + v497 = arith.add v464, v496 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/ as core::ops::drop::Drop>::drop(v497) + v1021 = arith.constant 16 : i32; + v499 = arith.add v464, v1021 : i32 #[overflow = wrapping]; + v500 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v501 = hir.bitcast v500 : ptr; + hir.store v501, v499; builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v494: i32) { - ^block59(v494: i32): - v495 = arith.constant 16 : i32; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::deallocate(v494, v495, v495) + private builtin.function @ as core::ops::drop::Drop>::drop(v502: i32) { + ^block59(v502: i32): + v503 = arith.constant 16 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::deallocate(v502, v503, v503) builtin.ret ; }; - private builtin.function @::alloc_impl(v497: i32, v498: i32, v499: i32, v500: i32) { - ^block61(v497: i32, v498: i32, v499: i32, v500: i32): - v1019 = arith.constant 0 : i32; - v501 = arith.constant 0 : i32; - v502 = arith.eq v499, v501 : i1; - v503 = arith.zext v502 : u32; - v504 = hir.bitcast v503 : i32; - v506 = arith.neq v504, v1019 : i1; - v1015 = scf.if v506 : i32 { - ^block133: - scf.yield v498; + private builtin.function @>::index(v505: i32, v506: i32, v507: i32) -> i32 { + ^block61(v505: i32, v506: i32, v507: i32): + v515 = arith.constant 0 : i32; + v1028 = arith.constant 3 : u32; + v510 = hir.bitcast v506 : u32; + v512 = arith.gt v510, v1028 : i1; + v513 = arith.zext v512 : u32; + v514 = hir.bitcast v513 : i32; + v516 = arith.neq v514, v515 : i1; + cf.cond_br v516 ^block63, ^block64; + ^block63: + ub.unreachable ; + ^block64: + v1027 = arith.constant 2 : u32; + v519 = arith.shl v506, v1027 : i32; + v520 = arith.add v505, v519 : i32 #[overflow = wrapping]; + builtin.ret v520; + }; + + private builtin.function @::alloc_impl(v521: i32, v522: i32, v523: i32, v524: i32) { + ^block65(v521: i32, v522: i32, v523: i32, v524: i32): + v1046 = arith.constant 0 : i32; + v525 = arith.constant 0 : i32; + v526 = arith.eq v523, v525 : i1; + v527 = arith.zext v526 : u32; + v528 = hir.bitcast v527 : i32; + v530 = arith.neq v528, v1046 : i1; + v1042 = scf.if v530 : i32 { + ^block139: + scf.yield v522; } else { - ^block64: + ^block68: hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1018 = arith.constant 0 : i32; - v508 = arith.neq v500, v1018 : i1; - v1014 = scf.if v508 : i32 { - ^block65: - v510 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_alloc_zeroed(v499, v498) : i32 - scf.yield v510; + v1045 = arith.constant 0 : i32; + v532 = arith.neq v524, v1045 : i1; + v1041 = scf.if v532 : i32 { + ^block69: + v534 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_alloc_zeroed(v523, v522) : i32 + scf.yield v534; } else { - ^block66: - v509 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_alloc(v499, v498) : i32 - scf.yield v509; + ^block70: + v533 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_alloc(v523, v522) : i32 + scf.yield v533; }; - scf.yield v1014; + scf.yield v1041; }; - v514 = arith.constant 4 : u32; - v513 = hir.bitcast v497 : u32; - v515 = arith.add v513, v514 : u32 #[overflow = checked]; - v1017 = arith.constant 4 : u32; - v517 = arith.mod v515, v1017 : u32; - hir.assertz v517 #[code = 250]; - v518 = hir.int_to_ptr v515 : ptr; - hir.store v518, v499; - v520 = hir.bitcast v497 : u32; - v1016 = arith.constant 4 : u32; - v522 = arith.mod v520, v1016 : u32; - hir.assertz v522 #[code = 250]; - v523 = hir.int_to_ptr v520 : ptr; - hir.store v523, v1015; - builtin.ret ; - }; - - private builtin.function @::deallocate(v524: i32, v525: i32, v526: i32) { - ^block67(v524: i32, v525: i32, v526: i32): - v528 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v529 = hir.bitcast v528 : ptr; - v530 = hir.load v529 : i32; - v531 = arith.constant 16 : i32; - v532 = arith.sub v530, v531 : i32 #[overflow = wrapping]; - v533 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v534 = hir.bitcast v533 : ptr; - hir.store v534, v532; - v535 = arith.constant 4 : i32; - v536 = arith.add v532, v535 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::current_memory(v536, v524, v525, v526) - v538 = arith.constant 8 : u32; - v537 = hir.bitcast v532 : u32; + v538 = arith.constant 4 : u32; + v537 = hir.bitcast v521 : u32; v539 = arith.add v537, v538 : u32 #[overflow = checked]; - v540 = arith.constant 4 : u32; - v541 = arith.mod v539, v540 : u32; + v1044 = arith.constant 4 : u32; + v541 = arith.mod v539, v1044 : u32; hir.assertz v541 #[code = 250]; v542 = hir.int_to_ptr v539 : ptr; - v543 = hir.load v542 : i32; - v1026 = arith.constant 0 : i32; - v527 = arith.constant 0 : i32; - v545 = arith.eq v543, v527 : i1; - v546 = arith.zext v545 : u32; - v547 = hir.bitcast v546 : i32; - v549 = arith.neq v547, v1026 : i1; - scf.if v549{ - ^block136: + hir.store v542, v523; + v544 = hir.bitcast v521 : u32; + v1043 = arith.constant 4 : u32; + v546 = arith.mod v544, v1043 : u32; + hir.assertz v546 #[code = 250]; + v547 = hir.int_to_ptr v544 : ptr; + hir.store v547, v1042; + builtin.ret ; + }; + + private builtin.function @::deallocate(v548: i32, v549: i32, v550: i32) { + ^block71(v548: i32, v549: i32, v550: i32): + v552 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v553 = hir.bitcast v552 : ptr; + v554 = hir.load v553 : i32; + v555 = arith.constant 16 : i32; + v556 = arith.sub v554, v555 : i32 #[overflow = wrapping]; + v557 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v558 = hir.bitcast v557 : ptr; + hir.store v558, v556; + v559 = arith.constant 4 : i32; + v560 = arith.add v556, v559 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::current_memory(v560, v548, v549, v550) + v562 = arith.constant 8 : u32; + v561 = hir.bitcast v556 : u32; + v563 = arith.add v561, v562 : u32 #[overflow = checked]; + v564 = arith.constant 4 : u32; + v565 = arith.mod v563, v564 : u32; + hir.assertz v565 #[code = 250]; + v566 = hir.int_to_ptr v563 : ptr; + v567 = hir.load v566 : i32; + v1053 = arith.constant 0 : i32; + v551 = arith.constant 0 : i32; + v569 = arith.eq v567, v551 : i1; + v570 = arith.zext v569 : u32; + v571 = hir.bitcast v570 : i32; + v573 = arith.neq v571, v1053 : i1; + scf.if v573{ + ^block142: scf.yield ; } else { - ^block70: - v1025 = arith.constant 4 : u32; - v550 = hir.bitcast v532 : u32; - v552 = arith.add v550, v1025 : u32 #[overflow = checked]; - v1024 = arith.constant 4 : u32; - v554 = arith.mod v552, v1024 : u32; - hir.assertz v554 #[code = 250]; - v555 = hir.int_to_ptr v552 : ptr; - v556 = hir.load v555 : i32; - v558 = arith.constant 12 : u32; - v557 = hir.bitcast v532 : u32; - v559 = arith.add v557, v558 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v561 = arith.mod v559, v1023 : u32; - hir.assertz v561 #[code = 250]; - v562 = hir.int_to_ptr v559 : ptr; - v563 = hir.load v562 : i32; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::deallocate(v556, v543, v563) + ^block74: + v1052 = arith.constant 4 : u32; + v574 = hir.bitcast v556 : u32; + v576 = arith.add v574, v1052 : u32 #[overflow = checked]; + v1051 = arith.constant 4 : u32; + v578 = arith.mod v576, v1051 : u32; + hir.assertz v578 #[code = 250]; + v579 = hir.int_to_ptr v576 : ptr; + v580 = hir.load v579 : i32; + v582 = arith.constant 12 : u32; + v581 = hir.bitcast v556 : u32; + v583 = arith.add v581, v582 : u32 #[overflow = checked]; + v1050 = arith.constant 4 : u32; + v585 = arith.mod v583, v1050 : u32; + hir.assertz v585 #[code = 250]; + v586 = hir.int_to_ptr v583 : ptr; + v587 = hir.load v586 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::deallocate(v580, v567, v587) scf.yield ; }; - v1022 = arith.constant 16 : i32; - v566 = arith.add v532, v1022 : i32 #[overflow = wrapping]; - v567 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v568 = hir.bitcast v567 : ptr; - hir.store v568, v566; + v1049 = arith.constant 16 : i32; + v590 = arith.add v556, v1049 : i32 #[overflow = wrapping]; + v591 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v592 = hir.bitcast v591 : ptr; + hir.store v592, v590; builtin.ret ; }; - private builtin.function @::current_memory(v569: i32, v570: i32, v571: i32, v572: i32) { - ^block71(v569: i32, v570: i32, v571: i32, v572: i32): - v1052 = arith.constant 0 : i32; - v573 = arith.constant 0 : i32; - v577 = arith.eq v572, v573 : i1; - v578 = arith.zext v577 : u32; - v579 = hir.bitcast v578 : i32; - v581 = arith.neq v579, v1052 : i1; - v1039, v1040 = scf.if v581 : i32, i32 { - ^block139: - v1051 = arith.constant 0 : i32; - v575 = arith.constant 4 : i32; - scf.yield v575, v1051; + private builtin.function @::current_memory(v593: i32, v594: i32, v595: i32, v596: i32) { + ^block75(v593: i32, v594: i32, v595: i32, v596: i32): + v1079 = arith.constant 0 : i32; + v597 = arith.constant 0 : i32; + v601 = arith.eq v596, v597 : i1; + v602 = arith.zext v601 : u32; + v603 = hir.bitcast v602 : i32; + v605 = arith.neq v603, v1079 : i1; + v1066, v1067 = scf.if v605 : i32, i32 { + ^block145: + v1078 = arith.constant 0 : i32; + v599 = arith.constant 4 : i32; + scf.yield v599, v1078; } else { - ^block74: - v582 = hir.bitcast v570 : u32; - v617 = arith.constant 4 : u32; - v584 = arith.mod v582, v617 : u32; - hir.assertz v584 #[code = 250]; - v585 = hir.int_to_ptr v582 : ptr; - v586 = hir.load v585 : i32; - v1049 = arith.constant 0 : i32; - v1050 = arith.constant 0 : i32; - v588 = arith.eq v586, v1050 : i1; - v589 = arith.zext v588 : u32; - v590 = hir.bitcast v589 : i32; - v592 = arith.neq v590, v1049 : i1; - v1037 = scf.if v592 : i32 { - ^block138: - v1048 = arith.constant 0 : i32; - scf.yield v1048; + ^block78: + v606 = hir.bitcast v594 : u32; + v641 = arith.constant 4 : u32; + v608 = arith.mod v606, v641 : u32; + hir.assertz v608 #[code = 250]; + v609 = hir.int_to_ptr v606 : ptr; + v610 = hir.load v609 : i32; + v1076 = arith.constant 0 : i32; + v1077 = arith.constant 0 : i32; + v612 = arith.eq v610, v1077 : i1; + v613 = arith.zext v612 : u32; + v614 = hir.bitcast v613 : i32; + v616 = arith.neq v614, v1076 : i1; + v1064 = scf.if v616 : i32 { + ^block144: + v1075 = arith.constant 0 : i32; + scf.yield v1075; } else { - ^block75: - v1047 = arith.constant 4 : u32; - v593 = hir.bitcast v569 : u32; - v595 = arith.add v593, v1047 : u32 #[overflow = checked]; - v1046 = arith.constant 4 : u32; - v597 = arith.mod v595, v1046 : u32; - hir.assertz v597 #[code = 250]; - v598 = hir.int_to_ptr v595 : ptr; - hir.store v598, v571; - v1045 = arith.constant 4 : u32; - v599 = hir.bitcast v570 : u32; - v601 = arith.add v599, v1045 : u32 #[overflow = checked]; - v1044 = arith.constant 4 : u32; - v603 = arith.mod v601, v1044 : u32; - hir.assertz v603 #[code = 250]; - v604 = hir.int_to_ptr v601 : ptr; - v605 = hir.load v604 : i32; - v606 = hir.bitcast v569 : u32; - v1043 = arith.constant 4 : u32; - v608 = arith.mod v606, v1043 : u32; - hir.assertz v608 #[code = 250]; - v609 = hir.int_to_ptr v606 : ptr; - hir.store v609, v605; - v610 = arith.mul v586, v572 : i32 #[overflow = wrapping]; - scf.yield v610; + ^block79: + v1074 = arith.constant 4 : u32; + v617 = hir.bitcast v593 : u32; + v619 = arith.add v617, v1074 : u32 #[overflow = checked]; + v1073 = arith.constant 4 : u32; + v621 = arith.mod v619, v1073 : u32; + hir.assertz v621 #[code = 250]; + v622 = hir.int_to_ptr v619 : ptr; + hir.store v622, v595; + v1072 = arith.constant 4 : u32; + v623 = hir.bitcast v594 : u32; + v625 = arith.add v623, v1072 : u32 #[overflow = checked]; + v1071 = arith.constant 4 : u32; + v627 = arith.mod v625, v1071 : u32; + hir.assertz v627 #[code = 250]; + v628 = hir.int_to_ptr v625 : ptr; + v629 = hir.load v628 : i32; + v630 = hir.bitcast v593 : u32; + v1070 = arith.constant 4 : u32; + v632 = arith.mod v630, v1070 : u32; + hir.assertz v632 #[code = 250]; + v633 = hir.int_to_ptr v630 : ptr; + hir.store v633, v629; + v634 = arith.mul v610, v596 : i32 #[overflow = wrapping]; + scf.yield v634; }; - v611 = arith.constant 8 : i32; - v1042 = arith.constant 4 : i32; - v1038 = cf.select v592, v1042, v611 : i32; - scf.yield v1038, v1037; + v635 = arith.constant 8 : i32; + v1069 = arith.constant 4 : i32; + v1065 = cf.select v616, v1069, v635 : i32; + scf.yield v1065, v1064; }; - v614 = arith.add v569, v1039 : i32 #[overflow = wrapping]; - v616 = hir.bitcast v614 : u32; - v1041 = arith.constant 4 : u32; - v618 = arith.mod v616, v1041 : u32; - hir.assertz v618 #[code = 250]; - v619 = hir.int_to_ptr v616 : ptr; - hir.store v619, v1040; + v638 = arith.add v593, v1066 : i32 #[overflow = wrapping]; + v640 = hir.bitcast v638 : u32; + v1068 = arith.constant 4 : u32; + v642 = arith.mod v640, v1068 : u32; + hir.assertz v642 #[code = 250]; + v643 = hir.int_to_ptr v640 : ptr; + hir.store v643, v1067; builtin.ret ; }; - private builtin.function @::deallocate(v620: i32, v621: i32, v622: i32) { - ^block76(v620: i32, v621: i32, v622: i32): - v1054 = arith.constant 0 : i32; - v623 = arith.constant 0 : i32; - v624 = arith.eq v622, v623 : i1; - v625 = arith.zext v624 : u32; - v626 = hir.bitcast v625 : i32; - v628 = arith.neq v626, v1054 : i1; - scf.if v628{ - ^block78: + private builtin.function @::deallocate(v644: i32, v645: i32, v646: i32) { + ^block80(v644: i32, v645: i32, v646: i32): + v1081 = arith.constant 0 : i32; + v647 = arith.constant 0 : i32; + v648 = arith.eq v646, v647 : i1; + v649 = arith.zext v648 : u32; + v650 = hir.bitcast v649 : i32; + v652 = arith.neq v650, v1081 : i1; + scf.if v652{ + ^block82: scf.yield ; } else { - ^block79: - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_dealloc(v620, v622, v621) + ^block83: + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__rustc::__rust_dealloc(v644, v646, v645) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v629: i32, v630: i32, v631: i32) { - ^block80(v629: i32, v630: i32, v631: i32): - v633 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v634 = hir.bitcast v633 : ptr; - v635 = hir.load v634 : i32; - v636 = arith.constant 16 : i32; - v637 = arith.sub v635, v636 : i32 #[overflow = wrapping]; - v638 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v639 = hir.bitcast v638 : ptr; - hir.store v639, v637; - v632 = arith.constant 0 : i32; - v640 = arith.constant 8 : i32; - v641 = arith.add v637, v640 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc_impl(v641, v630, v631, v632) - v644 = arith.constant 12 : u32; - v643 = hir.bitcast v637 : u32; - v645 = arith.add v643, v644 : u32 #[overflow = checked]; - v646 = arith.constant 4 : u32; - v647 = arith.mod v645, v646 : u32; - hir.assertz v647 #[code = 250]; - v648 = hir.int_to_ptr v645 : ptr; - v649 = hir.load v648 : i32; - v651 = arith.constant 8 : u32; - v650 = hir.bitcast v637 : u32; - v652 = arith.add v650, v651 : u32 #[overflow = checked]; - v1059 = arith.constant 4 : u32; - v654 = arith.mod v652, v1059 : u32; - hir.assertz v654 #[code = 250]; - v655 = hir.int_to_ptr v652 : ptr; - v656 = hir.load v655 : i32; - v657 = hir.bitcast v629 : u32; - v1058 = arith.constant 4 : u32; - v659 = arith.mod v657, v1058 : u32; - hir.assertz v659 #[code = 250]; - v660 = hir.int_to_ptr v657 : ptr; - hir.store v660, v656; - v1057 = arith.constant 4 : u32; - v661 = hir.bitcast v629 : u32; - v663 = arith.add v661, v1057 : u32 #[overflow = checked]; - v1056 = arith.constant 4 : u32; - v665 = arith.mod v663, v1056 : u32; - hir.assertz v665 #[code = 250]; - v666 = hir.int_to_ptr v663 : ptr; - hir.store v666, v649; - v1055 = arith.constant 16 : i32; - v668 = arith.add v637, v1055 : i32 #[overflow = wrapping]; - v669 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v670 = hir.bitcast v669 : ptr; - hir.store v670, v668; + private builtin.function @::allocate(v653: i32, v654: i32, v655: i32) { + ^block84(v653: i32, v654: i32, v655: i32): + v657 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v658 = hir.bitcast v657 : ptr; + v659 = hir.load v658 : i32; + v660 = arith.constant 16 : i32; + v661 = arith.sub v659, v660 : i32 #[overflow = wrapping]; + v662 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v663 = hir.bitcast v662 : ptr; + hir.store v663, v661; + v656 = arith.constant 0 : i32; + v664 = arith.constant 8 : i32; + v665 = arith.add v661, v664 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc_impl(v665, v654, v655, v656) + v668 = arith.constant 12 : u32; + v667 = hir.bitcast v661 : u32; + v669 = arith.add v667, v668 : u32 #[overflow = checked]; + v670 = arith.constant 4 : u32; + v671 = arith.mod v669, v670 : u32; + hir.assertz v671 #[code = 250]; + v672 = hir.int_to_ptr v669 : ptr; + v673 = hir.load v672 : i32; + v675 = arith.constant 8 : u32; + v674 = hir.bitcast v661 : u32; + v676 = arith.add v674, v675 : u32 #[overflow = checked]; + v1086 = arith.constant 4 : u32; + v678 = arith.mod v676, v1086 : u32; + hir.assertz v678 #[code = 250]; + v679 = hir.int_to_ptr v676 : ptr; + v680 = hir.load v679 : i32; + v681 = hir.bitcast v653 : u32; + v1085 = arith.constant 4 : u32; + v683 = arith.mod v681, v1085 : u32; + hir.assertz v683 #[code = 250]; + v684 = hir.int_to_ptr v681 : ptr; + hir.store v684, v680; + v1084 = arith.constant 4 : u32; + v685 = hir.bitcast v653 : u32; + v687 = arith.add v685, v1084 : u32 #[overflow = checked]; + v1083 = arith.constant 4 : u32; + v689 = arith.mod v687, v1083 : u32; + hir.assertz v689 #[code = 250]; + v690 = hir.int_to_ptr v687 : ptr; + hir.store v690, v673; + v1082 = arith.constant 16 : i32; + v692 = arith.add v661, v1082 : i32 #[overflow = wrapping]; + v693 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v694 = hir.bitcast v693 : ptr; + hir.store v694, v692; builtin.ret ; }; - private builtin.function @::try_allocate_in(v671: i32, v672: i32, v673: i32, v674: i32, v675: i32) { - ^block82(v671: i32, v672: i32, v673: i32, v674: i32, v675: i32): - v678 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v679 = hir.bitcast v678 : ptr; - v680 = hir.load v679 : i32; - v681 = arith.constant 16 : i32; - v682 = arith.sub v680, v681 : i32 #[overflow = wrapping]; - v683 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v684 = hir.bitcast v683 : ptr; - hir.store v684, v682; - v694 = hir.bitcast v672 : u32; - v695 = arith.zext v694 : u64; - v696 = hir.bitcast v695 : i64; - v676 = arith.constant 0 : i32; - v689 = arith.sub v676, v674 : i32 #[overflow = wrapping]; - v686 = arith.constant -1 : i32; - v685 = arith.add v674, v675 : i32 #[overflow = wrapping]; - v687 = arith.add v685, v686 : i32 #[overflow = wrapping]; - v690 = arith.band v687, v689 : i32; - v691 = hir.bitcast v690 : u32; - v692 = arith.zext v691 : u64; - v693 = hir.bitcast v692 : i64; - v697 = arith.mul v693, v696 : i64 #[overflow = wrapping]; - v1162 = arith.constant 0 : i32; - v698 = arith.constant 32 : i64; - v700 = hir.cast v698 : u32; - v699 = hir.bitcast v697 : u64; - v701 = arith.shr v699, v700 : u64; - v702 = hir.bitcast v701 : i64; - v703 = arith.trunc v702 : i32; - v705 = arith.neq v703, v1162 : i1; - v1075, v1076, v1077, v1078, v1079, v1080 = scf.if v705 : i32, i32, i32, i32, i32, u32 { - ^block143: - v1060 = arith.constant 0 : u32; - v1067 = ub.poison i32 : i32; - scf.yield v671, v682, v1067, v1067, v1067, v1060; + private builtin.function @::try_allocate_in(v695: i32, v696: i32, v697: i32, v698: i32, v699: i32) { + ^block86(v695: i32, v696: i32, v697: i32, v698: i32, v699: i32): + v702 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v703 = hir.bitcast v702 : ptr; + v704 = hir.load v703 : i32; + v705 = arith.constant 16 : i32; + v706 = arith.sub v704, v705 : i32 #[overflow = wrapping]; + v707 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v708 = hir.bitcast v707 : ptr; + hir.store v708, v706; + v718 = hir.bitcast v696 : u32; + v719 = arith.zext v718 : u64; + v720 = hir.bitcast v719 : i64; + v700 = arith.constant 0 : i32; + v713 = arith.sub v700, v698 : i32 #[overflow = wrapping]; + v710 = arith.constant -1 : i32; + v709 = arith.add v698, v699 : i32 #[overflow = wrapping]; + v711 = arith.add v709, v710 : i32 #[overflow = wrapping]; + v714 = arith.band v711, v713 : i32; + v715 = hir.bitcast v714 : u32; + v716 = arith.zext v715 : u64; + v717 = hir.bitcast v716 : i64; + v721 = arith.mul v717, v720 : i64 #[overflow = wrapping]; + v1189 = arith.constant 0 : i32; + v722 = arith.constant 32 : i64; + v724 = hir.cast v722 : u32; + v723 = hir.bitcast v721 : u64; + v725 = arith.shr v723, v724 : u64; + v726 = hir.bitcast v725 : i64; + v727 = arith.trunc v726 : i32; + v729 = arith.neq v727, v1189 : i1; + v1102, v1103, v1104, v1105, v1106, v1107 = scf.if v729 : i32, i32, i32, i32, i32, u32 { + ^block149: + v1087 = arith.constant 0 : u32; + v1094 = ub.poison i32 : i32; + scf.yield v695, v706, v1094, v1094, v1094, v1087; } else { - ^block87: - v706 = arith.trunc v697 : i32; - v1161 = arith.constant 0 : i32; - v707 = arith.constant -2147483648 : i32; - v708 = arith.sub v707, v674 : i32 #[overflow = wrapping]; - v710 = hir.bitcast v708 : u32; - v709 = hir.bitcast v706 : u32; - v711 = arith.lte v709, v710 : i1; - v712 = arith.zext v711 : u32; - v713 = hir.bitcast v712 : i32; - v715 = arith.neq v713, v1161 : i1; - v1123 = scf.if v715 : i32 { - ^block85: - v1160 = arith.constant 0 : i32; - v726 = arith.neq v706, v1160 : i1; - v1122 = scf.if v726 : i32 { - ^block89: - v1159 = arith.constant 0 : i32; - v742 = arith.neq v673, v1159 : i1; - v1121 = scf.if v742 : i32 { - ^block92: - v724 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc_impl(v682, v674, v706, v724) - v753 = hir.bitcast v682 : u32; - v794 = arith.constant 4 : u32; - v755 = arith.mod v753, v794 : u32; - hir.assertz v755 #[code = 250]; - v756 = hir.int_to_ptr v753 : ptr; - v757 = hir.load v756 : i32; - scf.yield v757; + ^block91: + v730 = arith.trunc v721 : i32; + v1188 = arith.constant 0 : i32; + v731 = arith.constant -2147483648 : i32; + v732 = arith.sub v731, v698 : i32 #[overflow = wrapping]; + v734 = hir.bitcast v732 : u32; + v733 = hir.bitcast v730 : u32; + v735 = arith.lte v733, v734 : i1; + v736 = arith.zext v735 : u32; + v737 = hir.bitcast v736 : i32; + v739 = arith.neq v737, v1188 : i1; + v1150 = scf.if v739 : i32 { + ^block89: + v1187 = arith.constant 0 : i32; + v750 = arith.neq v730, v1187 : i1; + v1149 = scf.if v750 : i32 { + ^block93: + v1186 = arith.constant 0 : i32; + v766 = arith.neq v697, v1186 : i1; + v1148 = scf.if v766 : i32 { + ^block96: + v748 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::alloc_impl(v706, v698, v730, v748) + v777 = hir.bitcast v706 : u32; + v818 = arith.constant 4 : u32; + v779 = arith.mod v777, v818 : u32; + hir.assertz v779 #[code = 250]; + v780 = hir.int_to_ptr v777 : ptr; + v781 = hir.load v780 : i32; + scf.yield v781; } else { - ^block93: - v743 = arith.constant 8 : i32; - v744 = arith.add v682, v743 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::allocate(v744, v674, v706) - v728 = arith.constant 8 : u32; - v745 = hir.bitcast v682 : u32; - v747 = arith.add v745, v728 : u32 #[overflow = checked]; - v1158 = arith.constant 4 : u32; - v749 = arith.mod v747, v1158 : u32; - hir.assertz v749 #[code = 250]; - v750 = hir.int_to_ptr v747 : ptr; - v751 = hir.load v750 : i32; - scf.yield v751; + ^block97: + v767 = arith.constant 8 : i32; + v768 = arith.add v706, v767 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/::allocate(v768, v698, v730) + v752 = arith.constant 8 : u32; + v769 = hir.bitcast v706 : u32; + v771 = arith.add v769, v752 : u32 #[overflow = checked]; + v1185 = arith.constant 4 : u32; + v773 = arith.mod v771, v1185 : u32; + hir.assertz v773 #[code = 250]; + v774 = hir.int_to_ptr v771 : ptr; + v775 = hir.load v774 : i32; + scf.yield v775; }; - v1157 = arith.constant 0 : i32; - v760 = arith.neq v1121, v1157 : i1; - scf.if v760{ - ^block94: - v1156 = arith.constant 8 : u32; - v777 = hir.bitcast v671 : u32; - v779 = arith.add v777, v1156 : u32 #[overflow = checked]; - v1155 = arith.constant 4 : u32; - v781 = arith.mod v779, v1155 : u32; - hir.assertz v781 #[code = 250]; - v782 = hir.int_to_ptr v779 : ptr; - hir.store v782, v1121; - v1154 = arith.constant 4 : u32; - v784 = hir.bitcast v671 : u32; - v786 = arith.add v784, v1154 : u32 #[overflow = checked]; - v1153 = arith.constant 4 : u32; - v788 = arith.mod v786, v1153 : u32; - hir.assertz v788 #[code = 250]; - v789 = hir.int_to_ptr v786 : ptr; - hir.store v789, v672; + v1184 = arith.constant 0 : i32; + v784 = arith.neq v1148, v1184 : i1; + scf.if v784{ + ^block98: + v1183 = arith.constant 8 : u32; + v801 = hir.bitcast v695 : u32; + v803 = arith.add v801, v1183 : u32 #[overflow = checked]; + v1182 = arith.constant 4 : u32; + v805 = arith.mod v803, v1182 : u32; + hir.assertz v805 #[code = 250]; + v806 = hir.int_to_ptr v803 : ptr; + hir.store v806, v1148; + v1181 = arith.constant 4 : u32; + v808 = hir.bitcast v695 : u32; + v810 = arith.add v808, v1181 : u32 #[overflow = checked]; + v1180 = arith.constant 4 : u32; + v812 = arith.mod v810, v1180 : u32; + hir.assertz v812 #[code = 250]; + v813 = hir.int_to_ptr v810 : ptr; + hir.store v813, v696; scf.yield ; } else { - ^block95: - v1152 = arith.constant 8 : u32; - v763 = hir.bitcast v671 : u32; - v765 = arith.add v763, v1152 : u32 #[overflow = checked]; - v1151 = arith.constant 4 : u32; - v767 = arith.mod v765, v1151 : u32; - hir.assertz v767 #[code = 250]; - v768 = hir.int_to_ptr v765 : ptr; - hir.store v768, v706; - v1150 = arith.constant 4 : u32; - v770 = hir.bitcast v671 : u32; - v772 = arith.add v770, v1150 : u32 #[overflow = checked]; - v1149 = arith.constant 4 : u32; - v774 = arith.mod v772, v1149 : u32; - hir.assertz v774 #[code = 250]; - v775 = hir.int_to_ptr v772 : ptr; - hir.store v775, v674; + ^block99: + v1179 = arith.constant 8 : u32; + v787 = hir.bitcast v695 : u32; + v789 = arith.add v787, v1179 : u32 #[overflow = checked]; + v1178 = arith.constant 4 : u32; + v791 = arith.mod v789, v1178 : u32; + hir.assertz v791 #[code = 250]; + v792 = hir.int_to_ptr v789 : ptr; + hir.store v792, v730; + v1177 = arith.constant 4 : u32; + v794 = hir.bitcast v695 : u32; + v796 = arith.add v794, v1177 : u32 #[overflow = checked]; + v1176 = arith.constant 4 : u32; + v798 = arith.mod v796, v1176 : u32; + hir.assertz v798 #[code = 250]; + v799 = hir.int_to_ptr v796 : ptr; + hir.store v799, v698; scf.yield ; }; - v1147 = arith.constant 1 : i32; - v1148 = arith.constant 0 : i32; - v1120 = cf.select v760, v1148, v1147 : i32; - scf.yield v1120; + v1174 = arith.constant 1 : i32; + v1175 = arith.constant 0 : i32; + v1147 = cf.select v784, v1175, v1174 : i32; + scf.yield v1147; } else { - ^block90: - v1146 = arith.constant 8 : u32; - v727 = hir.bitcast v671 : u32; - v729 = arith.add v727, v1146 : u32 #[overflow = checked]; - v1145 = arith.constant 4 : u32; - v731 = arith.mod v729, v1145 : u32; - hir.assertz v731 #[code = 250]; - v732 = hir.int_to_ptr v729 : ptr; - hir.store v732, v674; - v1144 = arith.constant 4 : u32; - v735 = hir.bitcast v671 : u32; - v737 = arith.add v735, v1144 : u32 #[overflow = checked]; - v1143 = arith.constant 4 : u32; - v739 = arith.mod v737, v1143 : u32; - hir.assertz v739 #[code = 250]; - v1142 = arith.constant 0 : i32; - v740 = hir.int_to_ptr v737 : ptr; - hir.store v740, v1142; - v1141 = arith.constant 0 : i32; - scf.yield v1141; + ^block94: + v1173 = arith.constant 8 : u32; + v751 = hir.bitcast v695 : u32; + v753 = arith.add v751, v1173 : u32 #[overflow = checked]; + v1172 = arith.constant 4 : u32; + v755 = arith.mod v753, v1172 : u32; + hir.assertz v755 #[code = 250]; + v756 = hir.int_to_ptr v753 : ptr; + hir.store v756, v698; + v1171 = arith.constant 4 : u32; + v759 = hir.bitcast v695 : u32; + v761 = arith.add v759, v1171 : u32 #[overflow = checked]; + v1170 = arith.constant 4 : u32; + v763 = arith.mod v761, v1170 : u32; + hir.assertz v763 #[code = 250]; + v1169 = arith.constant 0 : i32; + v764 = hir.int_to_ptr v761 : ptr; + hir.store v764, v1169; + v1168 = arith.constant 0 : i32; + scf.yield v1168; }; - scf.yield v1122; + scf.yield v1149; } else { - ^block88: - v1140 = ub.poison i32 : i32; - scf.yield v1140; + ^block92: + v1167 = ub.poison i32 : i32; + scf.yield v1167; }; - v1135 = arith.constant 0 : u32; - v1068 = arith.constant 1 : u32; - v1128 = cf.select v715, v1068, v1135 : u32; - v1136 = ub.poison i32 : i32; - v1127 = cf.select v715, v682, v1136 : i32; - v1137 = ub.poison i32 : i32; - v1126 = cf.select v715, v671, v1137 : i32; - v1138 = ub.poison i32 : i32; - v1125 = cf.select v715, v1138, v682 : i32; - v1139 = ub.poison i32 : i32; - v1124 = cf.select v715, v1139, v671 : i32; - scf.yield v1124, v1125, v1126, v1123, v1127, v1128; + v1162 = arith.constant 0 : u32; + v1095 = arith.constant 1 : u32; + v1155 = cf.select v739, v1095, v1162 : u32; + v1163 = ub.poison i32 : i32; + v1154 = cf.select v739, v706, v1163 : i32; + v1164 = ub.poison i32 : i32; + v1153 = cf.select v739, v695, v1164 : i32; + v1165 = ub.poison i32 : i32; + v1152 = cf.select v739, v1165, v706 : i32; + v1166 = ub.poison i32 : i32; + v1151 = cf.select v739, v1166, v695 : i32; + scf.yield v1151, v1152, v1153, v1150, v1154, v1155; }; - v1081, v1082, v1083 = scf.index_switch v1080 : i32, i32, i32 + v1108, v1109, v1110 = scf.index_switch v1107 : i32, i32, i32 case 0 { - ^block86: - v1134 = arith.constant 4 : u32; - v718 = hir.bitcast v1075 : u32; - v720 = arith.add v718, v1134 : u32 #[overflow = checked]; - v1133 = arith.constant 4 : u32; - v722 = arith.mod v720, v1133 : u32; - hir.assertz v722 #[code = 250]; - v1132 = arith.constant 0 : i32; - v723 = hir.int_to_ptr v720 : ptr; - hir.store v723, v1132; - v1131 = arith.constant 1 : i32; - scf.yield v1075, v1131, v1076; + ^block90: + v1161 = arith.constant 4 : u32; + v742 = hir.bitcast v1102 : u32; + v744 = arith.add v742, v1161 : u32 #[overflow = checked]; + v1160 = arith.constant 4 : u32; + v746 = arith.mod v744, v1160 : u32; + hir.assertz v746 #[code = 250]; + v1159 = arith.constant 0 : i32; + v747 = hir.int_to_ptr v744 : ptr; + hir.store v747, v1159; + v1158 = arith.constant 1 : i32; + scf.yield v1102, v1158, v1103; } default { - ^block147: - scf.yield v1077, v1078, v1079; + ^block153: + scf.yield v1104, v1105, v1106; }; - v793 = hir.bitcast v1081 : u32; - v1130 = arith.constant 4 : u32; - v795 = arith.mod v793, v1130 : u32; - hir.assertz v795 #[code = 250]; - v796 = hir.int_to_ptr v793 : ptr; - hir.store v796, v1082; - v1129 = arith.constant 16 : i32; - v801 = arith.add v1083, v1129 : i32 #[overflow = wrapping]; - v802 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr - v803 = hir.bitcast v802 : ptr; - hir.store v803, v801; + v817 = hir.bitcast v1108 : u32; + v1157 = arith.constant 4 : u32; + v819 = arith.mod v817, v1157 : u32; + hir.assertz v819 #[code = 250]; + v820 = hir.int_to_ptr v817 : ptr; + hir.store v820, v1109; + v1156 = arith.constant 16 : i32; + v825 = arith.add v1110, v1156 : i32 #[overflow = wrapping]; + v826 = builtin.global_symbol @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/__stack_pointer : ptr + v827 = hir.bitcast v826 : ptr; + hir.store v827, v825; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v804: i32, v805: i32) { - ^block96(v804: i32, v805: i32): + private builtin.function @alloc::raw_vec::handle_error(v828: i32, v829: i32) { + ^block100(v828: i32, v829: i32): ub.unreachable ; }; - private builtin.function @::max(v806: i32, v807: i32) -> i32 { - ^block98(v806: i32, v807: i32): - v814 = arith.constant 0 : i32; - v810 = hir.bitcast v807 : u32; - v809 = hir.bitcast v806 : u32; - v811 = arith.gt v809, v810 : i1; - v812 = arith.zext v811 : u32; - v813 = hir.bitcast v812 : i32; - v815 = arith.neq v813, v814 : i1; - v816 = cf.select v815, v806, v807 : i32; - builtin.ret v816; + private builtin.function @::max(v830: i32, v831: i32) -> i32 { + ^block102(v830: i32, v831: i32): + v838 = arith.constant 0 : i32; + v834 = hir.bitcast v831 : u32; + v833 = hir.bitcast v830 : u32; + v835 = arith.gt v833, v834 : i1; + v836 = arith.zext v835 : u32; + v837 = hir.bitcast v836 : i32; + v839 = arith.neq v837, v838 : i1; + v840 = cf.select v839, v830, v831 : i32; + builtin.ret v840; }; - private builtin.function @miden::protocol::active_note::get_assets(v817: i32) -> i32 { - ^block100(v817: i32): - v818, v819 = hir.exec @miden/protocol/active_note/get_assets(v817) : i32, i32 - builtin.ret v818; + private builtin.function @miden::protocol::active_note::get_assets(v841: i32) -> i32 { + ^block104(v841: i32): + v842, v843 = hir.exec @miden/protocol/active_note/get_assets(v841) : i32, i32 + builtin.ret v842; }; - private builtin.function @miden::protocol::native_account::add_asset(v821: felt, v822: felt, v823: felt, v824: felt, v825: i32) { - ^block105(v821: felt, v822: felt, v823: felt, v824: felt, v825: i32): - v826, v827, v828, v829 = hir.exec @miden/protocol/native_account/add_asset(v821, v822, v823, v824) : felt, felt, felt, felt - v830 = hir.bitcast v825 : u32; - v831 = hir.int_to_ptr v830 : ptr; - hir.store v831, v826; - v832 = arith.constant 4 : u32; - v833 = arith.add v830, v832 : u32 #[overflow = checked]; - v834 = hir.int_to_ptr v833 : ptr; - hir.store v834, v827; - v835 = arith.constant 8 : u32; - v836 = arith.add v830, v835 : u32 #[overflow = checked]; - v837 = hir.int_to_ptr v836 : ptr; - hir.store v837, v828; - v838 = arith.constant 12 : u32; - v839 = arith.add v830, v838 : u32 #[overflow = checked]; - v840 = hir.int_to_ptr v839 : ptr; - hir.store v840, v829; + private builtin.function @miden::protocol::native_account::add_asset(v845: felt, v846: felt, v847: felt, v848: felt, v849: i32) { + ^block109(v845: felt, v846: felt, v847: felt, v848: felt, v849: i32): + v850, v851, v852, v853 = hir.exec @miden/protocol/native_account/add_asset(v845, v846, v847, v848) : felt, felt, felt, felt + v854 = hir.bitcast v849 : u32; + v855 = hir.int_to_ptr v854 : ptr; + hir.store v855, v850; + v856 = arith.constant 4 : u32; + v857 = arith.add v854, v856 : u32 #[overflow = checked]; + v858 = hir.int_to_ptr v857 : ptr; + hir.store v858, v851; + v859 = arith.constant 8 : u32; + v860 = arith.add v854, v859 : u32 #[overflow = checked]; + v861 = hir.int_to_ptr v860 : ptr; + hir.store v861, v852; + v862 = arith.constant 12 : u32; + v863 = arith.add v854, v862 : u32 #[overflow = checked]; + v864 = hir.int_to_ptr v863 : ptr; + hir.store v864, v853; builtin.ret ; }; @@ -1203,12 +1229,14 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; - public builtin.function @run(v841: felt, v842: felt, v843: felt, v844: felt) { - ^block108(v841: felt, v842: felt, v843: felt, v844: felt): - hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden:base/note-script@1.0.0#run(v841, v842, v843, v844) + public builtin.function @run(v865: felt, v866: felt, v867: felt, v868: felt) { + ^block112(v865: felt, v866: felt, v867: felt, v868: felt): + hir.exec @miden:base/note-script@1.0.0/rust_sdk_note_add_assets_to_account_binding/miden:base/note-script@1.0.0#run(v865, v866, v867, v868) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm index 1f020314c..3c26e9b16 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.masm @@ -16,20 +16,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding @@ -43,7 +43,7 @@ end @callconv("C") proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -51,7 +51,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add movup.2 swap.1 @@ -71,7 +71,7 @@ end @callconv("C") proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -79,7 +79,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add dup.1 swap.2 @@ -190,7 +190,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -198,7 +198,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048588 + push.1048616 u32wrapping_add u32divmod.4 swap.1 @@ -219,7 +219,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -233,7 +233,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048588 + push.1048616 movup.2 u32wrapping_add u32divmod.4 @@ -455,7 +455,7 @@ end proc >::with_capacity( i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -465,7 +465,7 @@ proc >::with_capacity( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -544,7 +544,7 @@ proc >::with_capacity( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -561,7 +561,7 @@ proc ::with_capacity_in( i32, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -571,7 +571,7 @@ proc ::with_capacity_in( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -688,7 +688,7 @@ proc ::with_capacity_in( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -731,7 +731,7 @@ end proc miden_base_sys::bindings::active_note::get_assets( i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -741,7 +741,7 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -837,7 +837,7 @@ proc miden_base_sys::bindings::active_note::get_assets( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -851,7 +851,7 @@ end proc miden_base_sys::bindings::active_note::add_assets_to_account( ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -861,7 +861,7 @@ proc miden_base_sys::bindings::active_note::add_assets_to_account( nop push.48 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1165,7 +1165,7 @@ proc miden_base_sys::bindings::active_note::add_assets_to_account( nop push.48 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1180,10 +1180,26 @@ proc miden_base_sys::bindings::native_account::add_asset( i32, i32 ) - push.12 + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.3 dup.2 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1197,10 +1213,16 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.2 + dup.4 dup.3 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1214,10 +1236,16 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 + push.1 + dup.5 dup.4 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1231,7 +1259,17 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.4 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.6 + trace.240 + nop + exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -1245,8 +1283,10 @@ proc miden_base_sys::bindings::native_account::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movdn.3 + swap.3 + swap.4 swap.2 + swap.1 trace.240 nop exec.::"miden:base/note-script@1.0.0"::rust_sdk_note_add_assets_to_account_binding::"miden::protocol::native_account::add_asset" @@ -1258,7 +1298,7 @@ end proc as core::ops::drop::Drop>::drop( i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1268,7 +1308,7 @@ proc as nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1307,7 +1347,7 @@ proc as nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1321,7 +1361,7 @@ end proc < as core::ops::drop::Drop>::drop::DropGuard as core::ops::drop::Drop>::drop( i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1331,7 +1371,7 @@ proc < as core::ops::drop::Drop>::drop::Dr nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1430,7 +1470,7 @@ proc < as core::ops::drop::Drop>::drop::Dr nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1454,6 +1494,34 @@ proc as core::op nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + @callconv("C") proc ::alloc_impl( i32, @@ -1538,7 +1606,7 @@ proc ::deallocate( i32, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1548,7 +1616,7 @@ proc ::deallocate( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1639,7 +1707,7 @@ proc ::deallocate( end push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1813,7 +1881,7 @@ proc ::allocate( i32, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1823,7 +1891,7 @@ proc ::allocate( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -1916,7 +1984,7 @@ proc ::allocate( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1934,7 +2002,7 @@ proc ::try_allocate_in( i32, i32 ) - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -1944,7 +2012,7 @@ proc ::try_allocate_in( nop push.16 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -2325,7 +2393,7 @@ proc ::try_allocate_in( nop push.16 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat index 844824cba..1adc4b607 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_note_add_assets_to_account_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -32,7 +31,7 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add local.get 1 local.get 0 @@ -42,7 +41,7 @@ (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add local.get 1 local.get 0 @@ -72,7 +71,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048588 + i32.const 1048616 i32.add i32.load8_u br_if 0 (;@1;) @@ -80,7 +79,7 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048588 + i32.const 1048616 i32.add i32.const 1 i32.store8 @@ -339,13 +338,29 @@ global.set $__stack_pointer ) (func $miden_base_sys::bindings::native_account::add_asset (;14;) (type 8) (param i32 i32) + (local i32) local.get 1 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 2 + call $>::index + f32.load local.get 1 - f32.load offset=8 + i32.const 2 + local.get 2 + call $>::index + f32.load local.get 1 - f32.load offset=4 + i32.const 1 + local.get 2 + call $>::index + f32.load local.get 1 + i32.const 0 + local.get 2 + call $>::index f32.load local.get 0 call $miden::protocol::native_account::add_asset @@ -401,7 +416,22 @@ i32.const 16 call $::deallocate ) - (func $::alloc_impl (;18;) (type 7) (param i32 i32 i32 i32) + (func $>::index (;18;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $::alloc_impl (;19;) (type 7) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -428,7 +458,7 @@ local.get 1 i32.store ) - (func $::deallocate (;19;) (type 2) (param i32 i32 i32) + (func $::deallocate (;20;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -460,7 +490,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;20;) (type 7) (param i32 i32 i32 i32) + (func $::current_memory (;21;) (type 7) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -495,7 +525,7 @@ local.get 4 i32.store ) - (func $::deallocate (;21;) (type 2) (param i32 i32 i32) + (func $::deallocate (;22;) (type 2) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -506,7 +536,7 @@ call $__rustc::__rust_dealloc end ) - (func $::allocate (;22;) (type 2) (param i32 i32 i32) + (func $::allocate (;23;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -535,7 +565,7 @@ i32.add global.set $__stack_pointer ) - (func $::try_allocate_in (;23;) (type 9) (param i32 i32 i32 i32 i32) + (func $::try_allocate_in (;24;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -646,10 +676,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;24;) (type 8) (param i32 i32) + (func $alloc::raw_vec::handle_error (;25;) (type 8) (param i32 i32) unreachable ) - (func $::max (;25;) (type 1) (param i32 i32) (result i32) + (func $::max (;26;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -657,13 +687,14 @@ i32.gt_u select ) - (func $miden::protocol::active_note::get_assets (;26;) (type 10) (param i32) (result i32) + (func $miden::protocol::active_note::get_assets (;27;) (type 10) (param i32) (result i32) unreachable ) - (func $miden::protocol::native_account::add_asset (;27;) (type 11) (param f32 f32 f32 f32 i32) + (func $miden::protocol::native_account::add_asset (;28;) (type 11) (param f32 f32 f32 f32 i32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "word" (type $word (;1;))) (core instance $main (;0;) (instantiate $main)) @@ -676,15 +707,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir index 5d6797c76..ca0db94ca 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.hir @@ -21,60 +21,63 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/wit_bindgen::rt::run_ctors_once() - v124 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v167, v168, v169, v170 = scf.while v1, v7, v124 : i32, i32, felt, i32 { - ^block37(v171: i32, v172: i32, v173: felt): - v184 = arith.constant 0 : i32; + v190, v191, v192, v193 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block43(v194: i32, v195: i32, v196: felt): + v207 = arith.constant 0 : i32; v31 = arith.constant 16 : i32; - v15 = arith.eq v171, v31 : i1; + v15 = arith.eq v194, v31 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v184 : i1; - v162 = scf.if v19 : i32 { - ^block36: - v133 = ub.poison i32 : i32; - scf.yield v133; + v19 = arith.neq v17, v207 : i1; + v185 = scf.if v19 : i32 { + ^block42: + v156 = ub.poison i32 : i32; + scf.yield v156; } else { ^block14: - v183 = arith.constant 16 : i32; - v22 = arith.add v172, v183 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v171 : i32 #[overflow = wrapping]; + v206 = arith.constant 16 : i32; + v22 = arith.add v195, v206 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v194 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v173; + hir.store v28, v196; v29 = arith.constant 4 : i32; - v30 = arith.add v171, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v194, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v134 = ub.poison felt : felt; - v164 = cf.select v19, v134, v173 : felt; - v182 = ub.poison i32 : i32; - v163 = cf.select v19, v182, v172 : i32; - v132 = arith.constant 1 : u32; - v126 = arith.constant 0 : u32; - v166 = cf.select v19, v126, v132 : u32; - v156 = arith.trunc v166 : i1; - scf.condition v156, v162, v163, v164, v172; + v157 = ub.poison felt : felt; + v187 = cf.select v19, v157, v196 : felt; + v205 = ub.poison i32 : i32; + v186 = cf.select v19, v205, v195 : i32; + v155 = arith.constant 1 : u32; + v149 = arith.constant 0 : u32; + v189 = cf.select v19, v149, v155 : u32; + v179 = arith.trunc v189 : i1; + scf.condition v179, v185, v186, v187, v195; } do { - ^block38(v174: i32, v175: i32, v176: felt, v177: i32): - scf.yield v174, v175, v176; + ^block44(v197: i32, v198: i32, v199: felt, v200: i32): + scf.yield v197, v198, v199; }; - v181 = arith.constant 16 : i32; - v32 = arith.add v170, v181 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::from(v170, v32) - v180 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden_base_sys::bindings::output_note::add_asset(v170, v180) - v179 = arith.constant 32 : i32; - v38 = arith.add v170, v179 : i32 #[overflow = wrapping]; + v204 = arith.constant 16 : i32; + v32 = arith.add v193, v204 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::from(v193, v32) + v203 = arith.constant 0 : i64; + v34 = arith.trunc v203 : felt; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden_base_sys::bindings::output_note::add_asset(v193, v34) + v202 = arith.constant 32 : i32; + v38 = arith.add v193, v202 : i32 #[overflow = wrapping]; v39 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__stack_pointer : ptr v40 = hir.bitcast v39 : ptr; hir.store v40, v38; - v178 = arith.constant 0 : felt; - builtin.ret v178; + v201 = arith.constant 0 : i64; + v36 = arith.trunc v201 : felt; + builtin.ret v36; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { @@ -82,7 +85,7 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n v42 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr v43 = hir.bitcast v42 : ptr; v44 = hir.load v43 : i32; - v45 = arith.constant 1048584 : i32; + v45 = arith.constant 1048612 : i32; v46 = arith.add v44, v45 : i32 #[overflow = wrapping]; v47 = hir.bitcast v46 : u32; v48 = hir.int_to_ptr v47 : ptr; @@ -100,12 +103,12 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n v55 = hir.bitcast v54 : ptr; v56 = hir.load v55 : i32; hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/__wasm_call_ctors() - v186 = arith.constant 1 : u8; - v188 = arith.constant 1048584 : i32; - v58 = arith.add v56, v188 : i32 #[overflow = wrapping]; + v209 = arith.constant 1 : u8; + v211 = arith.constant 1048612 : i32; + v58 = arith.add v56, v211 : i32 #[overflow = wrapping]; v62 = hir.bitcast v58 : u32; v63 = hir.int_to_ptr v62 : ptr; - hir.store v63, v186; + hir.store v63, v209; scf.yield ; }; builtin.ret ; @@ -113,76 +116,108 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n private builtin.function @miden_base_sys::bindings::output_note::add_asset(v64: i32, v65: felt) { ^block19(v64: i32, v65: felt): - v67 = arith.constant 12 : u32; - v66 = hir.bitcast v64 : u32; - v68 = arith.add v66, v67 : u32 #[overflow = checked]; - v69 = arith.constant 4 : u32; - v70 = arith.mod v68, v69 : u32; - hir.assertz v70 #[code = 250]; - v71 = hir.int_to_ptr v68 : ptr; - v72 = hir.load v71 : felt; - v74 = arith.constant 8 : u32; - v73 = hir.bitcast v64 : u32; - v75 = arith.add v73, v74 : u32 #[overflow = checked]; - v192 = arith.constant 4 : u32; - v77 = arith.mod v75, v192 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - v79 = hir.load v78 : felt; - v191 = arith.constant 4 : u32; - v80 = hir.bitcast v64 : u32; - v82 = arith.add v80, v191 : u32 #[overflow = checked]; - v190 = arith.constant 4 : u32; - v84 = arith.mod v82, v190 : u32; - hir.assertz v84 #[code = 250]; - v85 = hir.int_to_ptr v82 : ptr; - v86 = hir.load v85 : felt; - v87 = hir.bitcast v64 : u32; - v189 = arith.constant 4 : u32; - v89 = arith.mod v87, v189 : u32; - hir.assertz v89 #[code = 250]; - v90 = hir.int_to_ptr v87 : ptr; - v91 = hir.load v90 : felt; - hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden::protocol::output_note::add_asset(v72, v79, v86, v91, v65) + v68 = builtin.global_symbol @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/GOT.data.internal.__memory_base : ptr + v69 = hir.bitcast v68 : ptr; + v70 = hir.load v69 : i32; + v71 = arith.constant 1048596 : i32; + v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; + v67 = arith.constant 3 : i32; + v73 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::index(v64, v67, v72) : i32 + v74 = hir.bitcast v73 : u32; + v75 = arith.constant 4 : u32; + v76 = arith.mod v74, v75 : u32; + hir.assertz v76 #[code = 250]; + v77 = hir.int_to_ptr v74 : ptr; + v78 = hir.load v77 : felt; + v79 = arith.constant 2 : i32; + v80 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::index(v64, v79, v72) : i32 + v81 = hir.bitcast v80 : u32; + v214 = arith.constant 4 : u32; + v83 = arith.mod v81, v214 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + v85 = hir.load v84 : felt; + v86 = arith.constant 1 : i32; + v87 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::index(v64, v86, v72) : i32 + v88 = hir.bitcast v87 : u32; + v213 = arith.constant 4 : u32; + v90 = arith.mod v88, v213 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : felt; + v66 = arith.constant 0 : i32; + v94 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::index(v64, v66, v72) : i32 + v95 = hir.bitcast v94 : u32; + v212 = arith.constant 4 : u32; + v97 = arith.mod v95, v212 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + v99 = hir.load v98 : felt; + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden::protocol::output_note::add_asset(v78, v85, v92, v99, v65) builtin.ret ; }; - private builtin.function @>::from(v92: i32, v93: i32) { - ^block21(v92: i32, v93: i32): - v95 = arith.constant 8 : u32; - v94 = hir.bitcast v93 : u32; - v96 = arith.add v94, v95 : u32 #[overflow = checked]; - v97 = arith.constant 4 : u32; - v98 = arith.mod v96, v97 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - v100 = hir.load v99 : i64; - v196 = arith.constant 8 : u32; - v101 = hir.bitcast v92 : u32; - v103 = arith.add v101, v196 : u32 #[overflow = checked]; - v195 = arith.constant 8 : u32; - v105 = arith.mod v103, v195 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - hir.store v106, v100; - v107 = hir.bitcast v93 : u32; - v194 = arith.constant 4 : u32; - v109 = arith.mod v107, v194 : u32; - hir.assertz v109 #[code = 250]; - v110 = hir.int_to_ptr v107 : ptr; - v111 = hir.load v110 : i64; - v112 = hir.bitcast v92 : u32; - v193 = arith.constant 8 : u32; - v114 = arith.mod v112, v193 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - hir.store v115, v111; + private builtin.function @>::from(v100: i32, v101: i32) { + ^block21(v100: i32, v101: i32): + hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/>::from(v100, v101) builtin.ret ; }; - private builtin.function @miden::protocol::output_note::add_asset(v116: felt, v117: felt, v118: felt, v119: felt, v120: felt) { - ^block23(v116: felt, v117: felt, v118: felt, v119: felt, v120: felt): - hir.exec @miden/protocol/output_note/add_asset(v116, v117, v118, v119, v120) + private builtin.function @>::index(v102: i32, v103: i32, v104: i32) -> i32 { + ^block23(v102: i32, v103: i32, v104: i32): + v112 = arith.constant 0 : i32; + v216 = arith.constant 3 : u32; + v107 = hir.bitcast v103 : u32; + v109 = arith.gt v107, v216 : i1; + v110 = arith.zext v109 : u32; + v111 = hir.bitcast v110 : i32; + v113 = arith.neq v111, v112 : i1; + cf.cond_br v113 ^block25, ^block26; + ^block25: + ub.unreachable ; + ^block26: + v215 = arith.constant 2 : u32; + v116 = arith.shl v103, v215 : i32; + v117 = arith.add v102, v116 : i32 #[overflow = wrapping]; + builtin.ret v117; + }; + + private builtin.function @>::from(v118: i32, v119: i32) { + ^block27(v118: i32, v119: i32): + v121 = arith.constant 8 : u32; + v120 = hir.bitcast v119 : u32; + v122 = arith.add v120, v121 : u32 #[overflow = checked]; + v123 = arith.constant 4 : u32; + v124 = arith.mod v122, v123 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i64; + v222 = arith.constant 8 : u32; + v127 = hir.bitcast v118 : u32; + v129 = arith.add v127, v222 : u32 #[overflow = checked]; + v221 = arith.constant 8 : u32; + v131 = arith.mod v129, v221 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + hir.store v132, v126; + v133 = hir.bitcast v119 : u32; + v220 = arith.constant 4 : u32; + v135 = arith.mod v133, v220 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + v137 = hir.load v136 : i64; + v138 = hir.bitcast v118 : u32; + v219 = arith.constant 8 : u32; + v140 = arith.mod v138, v219 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + hir.store v141, v137; + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::add_asset(v142: felt, v143: felt, v144: felt, v145: felt, v146: felt) { + ^block29(v142: felt, v143: felt, v144: felt, v145: felt, v146: felt): + hir.exec @miden/protocol/output_note/add_asset(v142, v143, v144, v145, v146) builtin.ret ; }; @@ -194,12 +229,14 @@ builtin.component miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-n builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block28: - v121 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() : felt - builtin.ret v121; + ^block34: + v147 = hir.exec @miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1/rust_sdk_output_note_add_asset_binding/miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding() : felt + builtin.ret v147; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm index ce5bb51d7..e12e80732 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,6 +81,9 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -157,10 +160,13 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset dup.1 trace.240 nop - exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::from + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::from trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop @@ -169,7 +175,7 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset nop push.32 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -178,13 +184,16 @@ proc miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset trace.252 nop push.0 + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -192,7 +201,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -213,7 +222,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -227,7 +236,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -259,10 +268,26 @@ proc miden_base_sys::bindings::output_note::add_asset( i32, felt ) - push.12 - dup.1 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.2 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -276,10 +301,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.2 - add - u32assert + push.2 + dup.3 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -293,10 +324,16 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.3 - add - u32assert + push.1 + dup.4 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -310,7 +347,17 @@ proc miden_base_sys::bindings::output_note::add_asset( exec.::intrinsics::mem::load_felt trace.252 nop - movup.3 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.5 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -325,7 +372,6 @@ proc miden_base_sys::bindings::output_note::add_asset( trace.252 nop movdn.3 - swap.2 trace.240 nop exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::"miden::protocol::output_note::add_asset" @@ -334,7 +380,47 @@ proc miden_base_sys::bindings::output_note::add_asset( end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:rust-sdk-output-note-add-asset-binding/rust-sdk-output-note-add-asset-binding@0.0.1"::rust_sdk_output_note_add_asset_binding::>::from + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat index 989018555..9e8776aa2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_add_asset_binding.wat @@ -11,8 +11,9 @@ (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32))) + (type (;4;) (func (param i64) (result f32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -32,8 +33,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -59,13 +60,13 @@ local.get 0 i32.const 16 i32.add - call $>::from + call $>::from local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::output_note::add_asset - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 local.get 0 i32.const 32 @@ -77,7 +78,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -85,25 +86,64 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::output_note::add_asset (;4;) (type 2) (param i32 f32) + (local i32) local.get 0 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 2 + call $>::index + f32.load local.get 0 - f32.load offset=8 + i32.const 2 + local.get 2 + call $>::index + f32.load local.get 0 - f32.load offset=4 + i32.const 1 + local.get 2 + call $>::index + f32.load local.get 0 + i32.const 0 + local.get 2 + call $>::index f32.load local.get 1 call $miden::protocol::output_note::add_asset ) - (func $>::from (;5;) (type 3) (param i32 i32) + (func $>::from (;5;) (type 3) (param i32 i32) + local.get 0 + local.get 1 + call $>::from + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) + unreachable + ) + (func $>::index (;7;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;8;) (type 3) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -113,13 +153,11 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) - unreachable - ) - (func $miden::protocol::output_note::add_asset (;7;) (type 5) (param f32 f32 f32 f32 f32) + (func $miden::protocol::output_note::add_asset (;9;) (type 6) (param f32 f32 f32 f32 f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "Mrust_sdk_output_note_add_asset_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir index 7880f92de..a358f30ca 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.hir @@ -21,56 +21,59 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/wit_bindgen::rt::run_ctors_once() - v131 = arith.constant 0 : felt; + v11 = arith.constant 0 : i64; + v12 = arith.trunc v11 : felt; v1 = arith.constant 0 : i32; - v174, v175, v176, v177 = scf.while v1, v7, v131 : i32, i32, felt, i32 { - ^block37(v178: i32, v179: i32, v180: felt): - v190 = arith.constant 0 : i32; + v197, v198, v199, v200 = scf.while v1, v7, v12 : i32, i32, felt, i32 { + ^block43(v201: i32, v202: i32, v203: felt): + v213 = arith.constant 0 : i32; v31 = arith.constant 16 : i32; - v15 = arith.eq v178, v31 : i1; + v15 = arith.eq v201, v31 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v190 : i1; - v169 = scf.if v19 : i32 { - ^block36: - v140 = ub.poison i32 : i32; - scf.yield v140; + v19 = arith.neq v17, v213 : i1; + v192 = scf.if v19 : i32 { + ^block42: + v163 = ub.poison i32 : i32; + scf.yield v163; } else { ^block14: - v189 = arith.constant 16 : i32; - v22 = arith.add v179, v189 : i32 #[overflow = wrapping]; - v23 = arith.add v22, v178 : i32 #[overflow = wrapping]; + v212 = arith.constant 16 : i32; + v22 = arith.add v202, v212 : i32 #[overflow = wrapping]; + v23 = arith.add v22, v201 : i32 #[overflow = wrapping]; v25 = hir.bitcast v23 : u32; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; - hir.store v28, v180; + hir.store v28, v203; v29 = arith.constant 4 : i32; - v30 = arith.add v178, v29 : i32 #[overflow = wrapping]; + v30 = arith.add v201, v29 : i32 #[overflow = wrapping]; scf.yield v30; }; - v141 = ub.poison felt : felt; - v171 = cf.select v19, v141, v180 : felt; - v188 = ub.poison i32 : i32; - v170 = cf.select v19, v188, v179 : i32; - v139 = arith.constant 1 : u32; - v133 = arith.constant 0 : u32; - v173 = cf.select v19, v133, v139 : u32; - v163 = arith.trunc v173 : i1; - scf.condition v163, v169, v170, v171, v179; + v164 = ub.poison felt : felt; + v194 = cf.select v19, v164, v203 : felt; + v211 = ub.poison i32 : i32; + v193 = cf.select v19, v211, v202 : i32; + v162 = arith.constant 1 : u32; + v156 = arith.constant 0 : u32; + v196 = cf.select v19, v156, v162 : u32; + v186 = arith.trunc v196 : i1; + scf.condition v186, v192, v193, v194, v202; } do { - ^block38(v181: i32, v182: i32, v183: felt, v184: i32): - scf.yield v181, v182, v183; + ^block44(v204: i32, v205: i32, v206: felt, v207: i32): + scf.yield v204, v205, v206; }; - v187 = arith.constant 16 : i32; - v32 = arith.add v177, v187 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::from(v177, v32) - v129 = arith.constant 1 : felt; - v186 = arith.constant 0 : felt; - v37 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden_base_sys::bindings::output_note::create(v186, v129, v177) : felt - v185 = arith.constant 32 : i32; - v39 = arith.add v177, v185 : i32 #[overflow = wrapping]; + v210 = arith.constant 16 : i32; + v32 = arith.add v200, v210 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::from(v200, v32) + v35 = arith.constant 1 : i64; + v36 = arith.trunc v35 : felt; + v209 = arith.constant 0 : i64; + v34 = arith.trunc v209 : felt; + v37 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden_base_sys::bindings::output_note::create(v34, v36, v200) : felt + v208 = arith.constant 32 : i32; + v39 = arith.add v200, v208 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -82,7 +85,7 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note v43 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/GOT.data.internal.__memory_base : ptr v44 = hir.bitcast v43 : ptr; v45 = hir.load v44 : i32; - v46 = arith.constant 1048584 : i32; + v46 = arith.constant 1048612 : i32; v47 = arith.add v45, v46 : i32 #[overflow = wrapping]; v48 = hir.bitcast v47 : u32; v49 = hir.int_to_ptr v48 : ptr; @@ -100,12 +103,12 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/__wasm_call_ctors() - v192 = arith.constant 1 : u8; - v194 = arith.constant 1048584 : i32; - v59 = arith.add v57, v194 : i32 #[overflow = wrapping]; + v215 = arith.constant 1 : u8; + v217 = arith.constant 1048612 : i32; + v59 = arith.add v57, v217 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v192; + hir.store v64, v215; scf.yield ; }; builtin.ret ; @@ -113,77 +116,109 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note private builtin.function @miden_base_sys::bindings::output_note::create(v65: felt, v66: felt, v67: i32) -> felt { ^block19(v65: felt, v66: felt, v67: i32): - v70 = arith.constant 12 : u32; - v69 = hir.bitcast v67 : u32; - v71 = arith.add v69, v70 : u32 #[overflow = checked]; - v72 = arith.constant 4 : u32; - v73 = arith.mod v71, v72 : u32; - hir.assertz v73 #[code = 250]; - v74 = hir.int_to_ptr v71 : ptr; - v75 = hir.load v74 : felt; - v77 = arith.constant 8 : u32; - v76 = hir.bitcast v67 : u32; - v78 = arith.add v76, v77 : u32 #[overflow = checked]; - v198 = arith.constant 4 : u32; - v80 = arith.mod v78, v198 : u32; - hir.assertz v80 #[code = 250]; - v81 = hir.int_to_ptr v78 : ptr; - v82 = hir.load v81 : felt; - v197 = arith.constant 4 : u32; - v83 = hir.bitcast v67 : u32; - v85 = arith.add v83, v197 : u32 #[overflow = checked]; - v196 = arith.constant 4 : u32; - v87 = arith.mod v85, v196 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - v89 = hir.load v88 : felt; - v90 = hir.bitcast v67 : u32; - v195 = arith.constant 4 : u32; - v92 = arith.mod v90, v195 : u32; - hir.assertz v92 #[code = 250]; - v93 = hir.int_to_ptr v90 : ptr; - v94 = hir.load v93 : felt; - v95 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden::protocol::output_note::create(v65, v66, v75, v82, v89, v94) : felt - builtin.ret v95; + v71 = builtin.global_symbol @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/GOT.data.internal.__memory_base : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 1048596 : i32; + v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; + v70 = arith.constant 3 : i32; + v76 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::index(v67, v70, v75) : i32 + v77 = hir.bitcast v76 : u32; + v78 = arith.constant 4 : u32; + v79 = arith.mod v77, v78 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : felt; + v82 = arith.constant 2 : i32; + v83 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::index(v67, v82, v75) : i32 + v84 = hir.bitcast v83 : u32; + v220 = arith.constant 4 : u32; + v86 = arith.mod v84, v220 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + v88 = hir.load v87 : felt; + v89 = arith.constant 1 : i32; + v90 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::index(v67, v89, v75) : i32 + v91 = hir.bitcast v90 : u32; + v219 = arith.constant 4 : u32; + v93 = arith.mod v91, v219 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + v95 = hir.load v94 : felt; + v69 = arith.constant 0 : i32; + v97 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::index(v67, v69, v75) : i32 + v98 = hir.bitcast v97 : u32; + v218 = arith.constant 4 : u32; + v100 = arith.mod v98, v218 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + v102 = hir.load v101 : felt; + v103 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden::protocol::output_note::create(v65, v66, v81, v88, v95, v102) : felt + builtin.ret v103; }; - private builtin.function @>::from(v96: i32, v97: i32) { - ^block21(v96: i32, v97: i32): - v99 = arith.constant 8 : u32; - v98 = hir.bitcast v97 : u32; - v100 = arith.add v98, v99 : u32 #[overflow = checked]; - v101 = arith.constant 4 : u32; - v102 = arith.mod v100, v101 : u32; - hir.assertz v102 #[code = 250]; - v103 = hir.int_to_ptr v100 : ptr; - v104 = hir.load v103 : i64; - v202 = arith.constant 8 : u32; - v105 = hir.bitcast v96 : u32; - v107 = arith.add v105, v202 : u32 #[overflow = checked]; - v201 = arith.constant 8 : u32; - v109 = arith.mod v107, v201 : u32; - hir.assertz v109 #[code = 250]; - v110 = hir.int_to_ptr v107 : ptr; - hir.store v110, v104; - v111 = hir.bitcast v97 : u32; - v200 = arith.constant 4 : u32; - v113 = arith.mod v111, v200 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : i64; - v116 = hir.bitcast v96 : u32; - v199 = arith.constant 8 : u32; - v118 = arith.mod v116, v199 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - hir.store v119, v115; + private builtin.function @>::from(v104: i32, v105: i32) { + ^block21(v104: i32, v105: i32): + hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/>::from(v104, v105) + builtin.ret ; + }; + + private builtin.function @>::index(v106: i32, v107: i32, v108: i32) -> i32 { + ^block23(v106: i32, v107: i32, v108: i32): + v116 = arith.constant 0 : i32; + v222 = arith.constant 3 : u32; + v111 = hir.bitcast v107 : u32; + v113 = arith.gt v111, v222 : i1; + v114 = arith.zext v113 : u32; + v115 = hir.bitcast v114 : i32; + v117 = arith.neq v115, v116 : i1; + cf.cond_br v117 ^block25, ^block26; + ^block25: + ub.unreachable ; + ^block26: + v221 = arith.constant 2 : u32; + v120 = arith.shl v107, v221 : i32; + v121 = arith.add v106, v120 : i32 #[overflow = wrapping]; + builtin.ret v121; + }; + + private builtin.function @>::from(v122: i32, v123: i32) { + ^block27(v122: i32, v123: i32): + v125 = arith.constant 8 : u32; + v124 = hir.bitcast v123 : u32; + v126 = arith.add v124, v125 : u32 #[overflow = checked]; + v127 = arith.constant 4 : u32; + v128 = arith.mod v126, v127 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : i64; + v228 = arith.constant 8 : u32; + v131 = hir.bitcast v122 : u32; + v133 = arith.add v131, v228 : u32 #[overflow = checked]; + v227 = arith.constant 8 : u32; + v135 = arith.mod v133, v227 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v130; + v137 = hir.bitcast v123 : u32; + v226 = arith.constant 4 : u32; + v139 = arith.mod v137, v226 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : i64; + v142 = hir.bitcast v122 : u32; + v225 = arith.constant 8 : u32; + v144 = arith.mod v142, v225 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + hir.store v145, v141; builtin.ret ; }; - private builtin.function @miden::protocol::output_note::create(v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt) -> felt { - ^block23(v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt): - v126 = hir.exec @miden/protocol/output_note/create(v120, v121, v122, v123, v124, v125) : felt - builtin.ret v126; + private builtin.function @miden::protocol::output_note::create(v146: felt, v147: felt, v148: felt, v149: felt, v150: felt, v151: felt) -> felt { + ^block29(v146: felt, v147: felt, v148: felt, v149: felt, v150: felt, v151: felt): + v152 = hir.exec @miden/protocol/output_note/create(v146, v147, v148, v149, v150, v151) : felt + builtin.ret v152; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -194,12 +229,14 @@ builtin.component miden:rust-sdk-output-note-create-binding/rust-sdk-output-note builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block28: - v128 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() : felt - builtin.ret v128; + ^block34: + v154 = hir.exec @miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1/rust_sdk_output_note_create_binding/miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding() : felt + builtin.ret v154; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm index 97b15c684..b19710fef 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,6 +81,9 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi nop push.0 push.0 + mul.4294967296 + add + push.0 movup.2 swap.1 push.1 @@ -157,11 +160,17 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi dup.1 trace.240 nop - exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::from + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::from trace.252 nop push.1 push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add dup.2 swap.2 swap.1 @@ -173,7 +182,7 @@ proc miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-bindi push.32 movup.2 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -187,7 +196,7 @@ end proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -195,7 +204,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -216,7 +225,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -230,7 +239,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -263,10 +272,26 @@ proc miden_base_sys::bindings::output_note::create( felt, i32 ) -> felt - push.12 - dup.3 - add - u32assert + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -280,10 +305,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - dup.4 - add - u32assert + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -297,10 +328,16 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.5 - add - u32assert + push.1 + dup.6 + dup.4 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -314,7 +351,17 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - movup.5 + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -328,12 +375,11 @@ proc miden_base_sys::bindings::output_note::create( exec.::intrinsics::mem::load_felt trace.252 nop - movup.2 - swap.3 - movdn.2 swap.5 - swap.1 swap.4 + swap.1 + swap.2 + swap.3 trace.240 nop exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::"miden::protocol::output_note::create" @@ -342,7 +388,47 @@ proc miden_base_sys::bindings::output_note::create( end @callconv("C") -proc >::from( +proc >::from( + i32, + i32 +) + trace.240 + nop + exec.::"miden:rust-sdk-output-note-create-binding/rust-sdk-output-note-create-binding@0.0.1"::rust_sdk_output_note_create_binding::>::from + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( i32, i32 ) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat index 63b75faee..daeb573c2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_create_binding.wat @@ -13,8 +13,9 @@ (type (;1;) (func (result f32))) (type (;2;) (func (param f32 f32 i32) (result f32))) (type (;3;) (func (param i32 i32))) - (type (;4;) (func (param i32) (result f32))) - (type (;5;) (func (param f32 f32 f32 f32 f32 f32) (result f32))) + (type (;4;) (func (param i64) (result f32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 f32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -34,8 +35,8 @@ call $wit_bindgen::rt::run_ctors_once i32.const 0 local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 block ;; label = @1 loop ;; label = @2 @@ -61,11 +62,11 @@ local.get 0 i32.const 16 i32.add - call $>::from - i32.const 0 - call $intrinsics::felt::from_u32 - i32.const 1 - call $intrinsics::felt::from_u32 + call $>::from + i64.const 0 + call $intrinsics::felt::from_u64_unchecked + i64.const 1 + call $intrinsics::felt::from_u64_unchecked local.get 0 call $miden_base_sys::bindings::output_note::create local.set 2 @@ -79,7 +80,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -87,26 +88,65 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::output_note::create (;4;) (type 2) (param f32 f32 i32) (result f32) + (local i32) local.get 0 local.get 1 local.get 2 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 2 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 2 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 2 + i32.const 0 + local.get 3 + call $>::index f32.load call $miden::protocol::output_note::create ) - (func $>::from (;5;) (type 3) (param i32 i32) + (func $>::from (;5;) (type 3) (param i32 i32) + local.get 0 + local.get 1 + call $>::from + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 4) (param i64) (result f32) + unreachable + ) + (func $>::index (;7;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;8;) (type 3) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -116,13 +156,11 @@ i64.load align=4 i64.store ) - (func $intrinsics::felt::from_u32 (;6;) (type 4) (param i32) (result f32) - unreachable - ) - (func $miden::protocol::output_note::create (;7;) (type 5) (param f32 f32 f32 f32 f32 f32) (result f32) + (func $miden::protocol::output_note::create (;9;) (type 6) (param f32 f32 f32 f32 f32 f32) (result f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "Grust_sdk_output_note_create_binding\01\0b0.0.1\03\01\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "note-idx" (type $note-idx (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir index 440c87fb4..f301bc757 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.hir @@ -29,33 +29,33 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v18 = arith.constant 1048584 : i32; v19 = arith.add v17, v18 : i32 #[overflow = wrapping]; v20 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc(v19, v13, v12) : i32 - v655 = arith.constant 0 : i32; + v657 = arith.constant 0 : i32; v21 = arith.constant 0 : i32; v22 = arith.eq v20, v21 : i1; v23 = arith.zext v22 : u32; v24 = hir.bitcast v23 : i32; - v26 = arith.neq v24, v655 : i1; + v26 = arith.neq v24, v657 : i1; scf.if v26{ ^block13: scf.yield ; } else { ^block14: - v653 = arith.constant 0 : i32; - v654 = arith.constant 0 : i32; - v28 = arith.eq v12, v654 : i1; + v655 = arith.constant 0 : i32; + v656 = arith.constant 0 : i32; + v28 = arith.eq v12, v656 : i1; v29 = arith.zext v28 : u32; v30 = hir.bitcast v29 : i32; - v32 = arith.neq v30, v653 : i1; + v32 = arith.neq v30, v655 : i1; scf.if v32{ ^block95: scf.yield ; } else { ^block15: - v647 = arith.constant 0 : u8; + v649 = arith.constant 0 : u8; v35 = hir.bitcast v12 : u32; v36 = hir.bitcast v20 : u32; v37 = hir.int_to_ptr v36 : ptr; - hir.mem_set v37, v35, v647; + hir.mem_set v37, v35, v649; scf.yield ; }; scf.yield ; @@ -79,28 +79,31 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- v48 = hir.bitcast v47 : ptr; hir.store v48, v46; hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/wit_bindgen::rt::run_ctors_once() - v656 = arith.constant 0 : felt; + v51 = arith.constant 0 : i64; + v52 = arith.trunc v51 : felt; v49 = arith.constant 4 : i32; v50 = arith.add v46, v49 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden_base_sys::bindings::output_note::get_assets(v50, v656) + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden_base_sys::bindings::output_note::get_assets(v50, v52) v54 = arith.constant 12 : u32; v53 = hir.bitcast v46 : u32; v55 = arith.add v53, v54 : u32 #[overflow = checked]; v56 = arith.constant 4 : u32; v57 = arith.mod v55, v56 : u32; hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i32; - v658 = arith.constant 4 : i32; - v62 = arith.add v46, v658 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/ as core::ops::drop::Drop>::drop(v62) - v657 = arith.constant 16 : i32; - v64 = arith.add v46, v657 : i32 #[overflow = wrapping]; - v65 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v66 = hir.bitcast v65 : ptr; - hir.store v66, v64; - v60 = hir.bitcast v59 : felt; - builtin.ret v60; + v58 = hir.int_to_ptr v55 : ptr; + v59 = hir.load v58 : u32; + v659 = arith.constant 4 : i32; + v64 = arith.add v46, v659 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/ as core::ops::drop::Drop>::drop(v64) + v658 = arith.constant 16 : i32; + v66 = arith.add v46, v658 : i32 #[overflow = wrapping]; + v67 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v68 = hir.bitcast v67 : ptr; + hir.store v68, v66; + v60 = arith.zext v59 : u64; + v61 = hir.bitcast v60 : i64; + v62 = arith.trunc v61 : felt; + builtin.ret v62; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -110,821 +113,821 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block22: - v68 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 1048588 : i32; - v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; - v73 = hir.bitcast v72 : u32; - v74 = hir.int_to_ptr v73 : ptr; - v75 = hir.load v74 : u8; - v67 = arith.constant 0 : i32; - v76 = arith.zext v75 : u32; - v77 = hir.bitcast v76 : i32; - v79 = arith.neq v77, v67 : i1; - scf.if v79{ + v70 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v71 = hir.bitcast v70 : ptr; + v72 = hir.load v71 : i32; + v73 = arith.constant 1048588 : i32; + v74 = arith.add v72, v73 : i32 #[overflow = wrapping]; + v75 = hir.bitcast v74 : u32; + v76 = hir.int_to_ptr v75 : ptr; + v77 = hir.load v76 : u8; + v69 = arith.constant 0 : i32; + v78 = arith.zext v77 : u32; + v79 = hir.bitcast v78 : i32; + v81 = arith.neq v79, v69 : i1; + scf.if v81{ ^block24: scf.yield ; } else { ^block25: - v80 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr - v81 = hir.bitcast v80 : ptr; - v82 = hir.load v81 : i32; + v82 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/GOT.data.internal.__memory_base : ptr + v83 = hir.bitcast v82 : ptr; + v84 = hir.load v83 : i32; hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__wasm_call_ctors() - v660 = arith.constant 1 : u8; - v662 = arith.constant 1048588 : i32; - v84 = arith.add v82, v662 : i32 #[overflow = wrapping]; - v88 = hir.bitcast v84 : u32; - v89 = hir.int_to_ptr v88 : ptr; - hir.store v89, v660; + v661 = arith.constant 1 : u8; + v663 = arith.constant 1048588 : i32; + v86 = arith.add v84, v663 : i32 #[overflow = wrapping]; + v90 = hir.bitcast v86 : u32; + v91 = hir.int_to_ptr v90 : ptr; + hir.store v91, v661; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v90: i32, v91: i32, v92: i32) -> i32 { - ^block26(v90: i32, v91: i32, v92: i32): - v95 = arith.constant 16 : i32; - v94 = arith.constant 0 : i32; - v664 = arith.constant 16 : u32; - v97 = hir.bitcast v91 : u32; - v99 = arith.gt v97, v664 : i1; - v100 = arith.zext v99 : u32; - v101 = hir.bitcast v100 : i32; - v103 = arith.neq v101, v94 : i1; - v104 = cf.select v103, v91, v95 : i32; - v704 = arith.constant 0 : i32; - v105 = arith.constant -1 : i32; - v106 = arith.add v104, v105 : i32 #[overflow = wrapping]; - v107 = arith.band v104, v106 : i32; - v109 = arith.neq v107, v704 : i1; - v673, v674 = scf.if v109 : i32, u32 { + private builtin.function @::alloc(v92: i32, v93: i32, v94: i32) -> i32 { + ^block26(v92: i32, v93: i32, v94: i32): + v97 = arith.constant 16 : i32; + v96 = arith.constant 0 : i32; + v665 = arith.constant 16 : u32; + v99 = hir.bitcast v93 : u32; + v101 = arith.gt v99, v665 : i1; + v102 = arith.zext v101 : u32; + v103 = hir.bitcast v102 : i32; + v105 = arith.neq v103, v96 : i1; + v106 = cf.select v105, v93, v97 : i32; + v705 = arith.constant 0 : i32; + v107 = arith.constant -1 : i32; + v108 = arith.add v106, v107 : i32 #[overflow = wrapping]; + v109 = arith.band v106, v108 : i32; + v111 = arith.neq v109, v705 : i1; + v674, v675 = scf.if v111 : i32, u32 { ^block101: - v665 = arith.constant 0 : u32; - v669 = ub.poison i32 : i32; - scf.yield v669, v665; + v666 = arith.constant 0 : u32; + v670 = ub.poison i32 : i32; + scf.yield v670, v666; } else { ^block29: - v111 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::max(v91, v104) : i32 - v703 = arith.constant 0 : i32; - v110 = arith.constant -2147483648 : i32; - v112 = arith.sub v110, v111 : i32 #[overflow = wrapping]; - v114 = hir.bitcast v112 : u32; - v113 = hir.bitcast v92 : u32; - v115 = arith.gt v113, v114 : i1; - v116 = arith.zext v115 : u32; - v117 = hir.bitcast v116 : i32; - v119 = arith.neq v117, v703 : i1; - v688 = scf.if v119 : i32 { + v113 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::max(v93, v106) : i32 + v704 = arith.constant 0 : i32; + v112 = arith.constant -2147483648 : i32; + v114 = arith.sub v112, v113 : i32 #[overflow = wrapping]; + v116 = hir.bitcast v114 : u32; + v115 = hir.bitcast v94 : u32; + v117 = arith.gt v115, v116 : i1; + v118 = arith.zext v117 : u32; + v119 = hir.bitcast v118 : i32; + v121 = arith.neq v119, v704 : i1; + v689 = scf.if v121 : i32 { ^block100: - v702 = ub.poison i32 : i32; - scf.yield v702; + v703 = ub.poison i32 : i32; + scf.yield v703; } else { ^block30: + v701 = arith.constant 0 : i32; + v127 = arith.sub v701, v113 : i32 #[overflow = wrapping]; + v702 = arith.constant -1 : i32; + v123 = arith.add v94, v113 : i32 #[overflow = wrapping]; + v125 = arith.add v123, v702 : i32 #[overflow = wrapping]; + v128 = arith.band v125, v127 : i32; + v129 = hir.bitcast v92 : u32; + v130 = arith.constant 4 : u32; + v131 = arith.mod v129, v130 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i32; v700 = arith.constant 0 : i32; - v125 = arith.sub v700, v111 : i32 #[overflow = wrapping]; - v701 = arith.constant -1 : i32; - v121 = arith.add v92, v111 : i32 #[overflow = wrapping]; - v123 = arith.add v121, v701 : i32 #[overflow = wrapping]; - v126 = arith.band v123, v125 : i32; - v127 = hir.bitcast v90 : u32; - v128 = arith.constant 4 : u32; - v129 = arith.mod v127, v128 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - v131 = hir.load v130 : i32; - v699 = arith.constant 0 : i32; - v133 = arith.neq v131, v699 : i1; - scf.if v133{ + v135 = arith.neq v133, v700 : i1; + scf.if v135{ ^block99: scf.yield ; } else { ^block32: - v134 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::mem::heap_base() : i32 - v135 = hir.mem_size : u32; - v141 = hir.bitcast v90 : u32; - v698 = arith.constant 4 : u32; - v143 = arith.mod v141, v698 : u32; - hir.assertz v143 #[code = 250]; - v697 = arith.constant 16 : u32; - v136 = hir.bitcast v135 : i32; - v139 = arith.shl v136, v697 : i32; - v140 = arith.add v134, v139 : i32 #[overflow = wrapping]; - v144 = hir.int_to_ptr v141 : ptr; - hir.store v144, v140; + v136 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/intrinsics::mem::heap_base() : i32 + v137 = hir.mem_size : u32; + v143 = hir.bitcast v92 : u32; + v699 = arith.constant 4 : u32; + v145 = arith.mod v143, v699 : u32; + hir.assertz v145 #[code = 250]; + v698 = arith.constant 16 : u32; + v138 = hir.bitcast v137 : i32; + v141 = arith.shl v138, v698 : i32; + v142 = arith.add v136, v141 : i32 #[overflow = wrapping]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v142; scf.yield ; }; - v147 = hir.bitcast v90 : u32; - v696 = arith.constant 4 : u32; - v149 = arith.mod v147, v696 : u32; - hir.assertz v149 #[code = 250]; - v150 = hir.int_to_ptr v147 : ptr; - v151 = hir.load v150 : i32; - v694 = arith.constant 0 : i32; - v695 = arith.constant -1 : i32; - v153 = arith.bxor v151, v695 : i32; - v155 = hir.bitcast v153 : u32; - v154 = hir.bitcast v126 : u32; - v156 = arith.gt v154, v155 : i1; - v157 = arith.zext v156 : u32; - v158 = hir.bitcast v157 : i32; - v160 = arith.neq v158, v694 : i1; - v687 = scf.if v160 : i32 { + v149 = hir.bitcast v92 : u32; + v697 = arith.constant 4 : u32; + v151 = arith.mod v149, v697 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : i32; + v695 = arith.constant 0 : i32; + v696 = arith.constant -1 : i32; + v155 = arith.bxor v153, v696 : i32; + v157 = hir.bitcast v155 : u32; + v156 = hir.bitcast v128 : u32; + v158 = arith.gt v156, v157 : i1; + v159 = arith.zext v158 : u32; + v160 = hir.bitcast v159 : i32; + v162 = arith.neq v160, v695 : i1; + v688 = scf.if v162 : i32 { ^block33: - v693 = arith.constant 0 : i32; - scf.yield v693; + v694 = arith.constant 0 : i32; + scf.yield v694; } else { ^block34: - v162 = hir.bitcast v90 : u32; - v692 = arith.constant 4 : u32; - v164 = arith.mod v162, v692 : u32; - hir.assertz v164 #[code = 250]; - v161 = arith.add v151, v126 : i32 #[overflow = wrapping]; - v165 = hir.int_to_ptr v162 : ptr; - hir.store v165, v161; - v167 = arith.add v151, v111 : i32 #[overflow = wrapping]; - scf.yield v167; + v164 = hir.bitcast v92 : u32; + v693 = arith.constant 4 : u32; + v166 = arith.mod v164, v693 : u32; + hir.assertz v166 #[code = 250]; + v163 = arith.add v153, v128 : i32 #[overflow = wrapping]; + v167 = hir.int_to_ptr v164 : ptr; + hir.store v167, v163; + v169 = arith.add v153, v113 : i32 #[overflow = wrapping]; + scf.yield v169; }; - scf.yield v687; + scf.yield v688; }; - v670 = arith.constant 1 : u32; - v691 = arith.constant 0 : u32; - v689 = cf.select v119, v691, v670 : u32; - scf.yield v688, v689; + v671 = arith.constant 1 : u32; + v692 = arith.constant 0 : u32; + v690 = cf.select v121, v692, v671 : u32; + scf.yield v689, v690; }; - v690 = arith.constant 0 : u32; - v686 = arith.eq v674, v690 : i1; - cf.cond_br v686 ^block28, ^block103(v673); + v691 = arith.constant 0 : u32; + v687 = arith.eq v675, v691 : i1; + cf.cond_br v687 ^block28, ^block103(v674); ^block28: ub.unreachable ; - ^block103(v666: i32): - builtin.ret v666; + ^block103(v667: i32): + builtin.ret v667; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block35: - v170 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v170; + v172 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v172; }; - private builtin.function @>::with_capacity(v172: i32) { - ^block39(v172: i32): - v175 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v176 = hir.bitcast v175 : ptr; - v177 = hir.load v176 : i32; - v178 = arith.constant 16 : i32; - v179 = arith.sub v177, v178 : i32 #[overflow = wrapping]; - v180 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v181 = hir.bitcast v180 : ptr; - hir.store v181, v179; - v709 = arith.constant 16 : i32; - v184 = arith.constant 256 : i32; - v182 = arith.constant 8 : i32; - v183 = arith.add v179, v182 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::with_capacity_in(v183, v184, v709, v709) - v188 = arith.constant 8 : u32; - v187 = hir.bitcast v179 : u32; - v189 = arith.add v187, v188 : u32 #[overflow = checked]; + private builtin.function @>::with_capacity(v174: i32) { + ^block39(v174: i32): + v177 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v178 = hir.bitcast v177 : ptr; + v179 = hir.load v178 : i32; + v180 = arith.constant 16 : i32; + v181 = arith.sub v179, v180 : i32 #[overflow = wrapping]; + v182 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v183 = hir.bitcast v182 : ptr; + hir.store v183, v181; + v710 = arith.constant 16 : i32; + v186 = arith.constant 256 : i32; + v184 = arith.constant 8 : i32; + v185 = arith.add v181, v184 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::with_capacity_in(v185, v186, v710, v710) + v190 = arith.constant 8 : u32; + v189 = hir.bitcast v181 : u32; + v191 = arith.add v189, v190 : u32 #[overflow = checked]; + v709 = arith.constant 8 : u32; + v193 = arith.mod v191, v709 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + v195 = hir.load v194 : i64; v708 = arith.constant 8 : u32; - v191 = arith.mod v189, v708 : u32; - hir.assertz v191 #[code = 250]; - v192 = hir.int_to_ptr v189 : ptr; - v193 = hir.load v192 : i64; - v707 = arith.constant 8 : u32; - v195 = hir.bitcast v172 : u32; - v197 = arith.add v195, v707 : u32 #[overflow = checked]; - v198 = arith.constant 4 : u32; - v199 = arith.mod v197, v198 : u32; - hir.assertz v199 #[code = 250]; - v173 = arith.constant 0 : i32; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v173; - v201 = hir.bitcast v172 : u32; - v706 = arith.constant 4 : u32; - v203 = arith.mod v201, v706 : u32; - hir.assertz v203 #[code = 250]; - v204 = hir.int_to_ptr v201 : ptr; - hir.store v204, v193; - v705 = arith.constant 16 : i32; - v206 = arith.add v179, v705 : i32 #[overflow = wrapping]; - v207 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v208 = hir.bitcast v207 : ptr; - hir.store v208, v206; + v197 = hir.bitcast v174 : u32; + v199 = arith.add v197, v708 : u32 #[overflow = checked]; + v200 = arith.constant 4 : u32; + v201 = arith.mod v199, v200 : u32; + hir.assertz v201 #[code = 250]; + v175 = arith.constant 0 : i32; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v175; + v203 = hir.bitcast v174 : u32; + v707 = arith.constant 4 : u32; + v205 = arith.mod v203, v707 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v195; + v706 = arith.constant 16 : i32; + v208 = arith.add v181, v706 : i32 #[overflow = wrapping]; + v209 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v210 = hir.bitcast v209 : ptr; + hir.store v210, v208; builtin.ret ; }; - private builtin.function @::with_capacity_in(v209: i32, v210: i32, v211: i32, v212: i32) { - ^block41(v209: i32, v210: i32, v211: i32, v212: i32): - v214 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v215 = hir.bitcast v214 : ptr; - v216 = hir.load v215 : i32; - v217 = arith.constant 16 : i32; - v218 = arith.sub v216, v217 : i32 #[overflow = wrapping]; - v219 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v220 = hir.bitcast v219 : ptr; - hir.store v220, v218; - v213 = arith.constant 0 : i32; - v221 = arith.constant 4 : i32; - v222 = arith.add v218, v221 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::try_allocate_in(v222, v210, v213, v211, v212) - v225 = arith.constant 8 : u32; - v224 = hir.bitcast v218 : u32; - v226 = arith.add v224, v225 : u32 #[overflow = checked]; - v227 = arith.constant 4 : u32; - v228 = arith.mod v226, v227 : u32; - hir.assertz v228 #[code = 250]; - v229 = hir.int_to_ptr v226 : ptr; - v230 = hir.load v229 : i32; + private builtin.function @::with_capacity_in(v211: i32, v212: i32, v213: i32, v214: i32) { + ^block41(v211: i32, v212: i32, v213: i32, v214: i32): + v216 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v217 = hir.bitcast v216 : ptr; + v218 = hir.load v217 : i32; + v219 = arith.constant 16 : i32; + v220 = arith.sub v218, v219 : i32 #[overflow = wrapping]; + v221 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v222 = hir.bitcast v221 : ptr; + hir.store v222, v220; + v215 = arith.constant 0 : i32; + v223 = arith.constant 4 : i32; + v224 = arith.add v220, v223 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::try_allocate_in(v224, v212, v215, v213, v214) + v227 = arith.constant 8 : u32; + v226 = hir.bitcast v220 : u32; + v228 = arith.add v226, v227 : u32 #[overflow = checked]; + v229 = arith.constant 4 : u32; + v230 = arith.mod v228, v229 : u32; + hir.assertz v230 #[code = 250]; + v231 = hir.int_to_ptr v228 : ptr; + v232 = hir.load v231 : i32; + v721 = arith.constant 4 : u32; + v233 = hir.bitcast v220 : u32; + v235 = arith.add v233, v721 : u32 #[overflow = checked]; v720 = arith.constant 4 : u32; - v231 = hir.bitcast v218 : u32; - v233 = arith.add v231, v720 : u32 #[overflow = checked]; - v719 = arith.constant 4 : u32; - v235 = arith.mod v233, v719 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - v237 = hir.load v236 : i32; - v718 = arith.constant 0 : i32; - v238 = arith.constant 1 : i32; - v239 = arith.neq v237, v238 : i1; - v240 = arith.zext v239 : u32; - v241 = hir.bitcast v240 : i32; - v243 = arith.neq v241, v718 : i1; - cf.cond_br v243 ^block43, ^block44; + v237 = arith.mod v235, v720 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + v239 = hir.load v238 : i32; + v719 = arith.constant 0 : i32; + v240 = arith.constant 1 : i32; + v241 = arith.neq v239, v240 : i1; + v242 = arith.zext v241 : u32; + v243 = hir.bitcast v242 : i32; + v245 = arith.neq v243, v719 : i1; + cf.cond_br v245 ^block43, ^block44; ^block43: - v252 = arith.constant 12 : u32; - v251 = hir.bitcast v218 : u32; - v253 = arith.add v251, v252 : u32 #[overflow = checked]; + v254 = arith.constant 12 : u32; + v253 = hir.bitcast v220 : u32; + v255 = arith.add v253, v254 : u32 #[overflow = checked]; + v718 = arith.constant 4 : u32; + v257 = arith.mod v255, v718 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + v259 = hir.load v258 : i32; v717 = arith.constant 4 : u32; - v255 = arith.mod v253, v717 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - v257 = hir.load v256 : i32; + v260 = hir.bitcast v211 : u32; + v262 = arith.add v260, v717 : u32 #[overflow = checked]; v716 = arith.constant 4 : u32; - v258 = hir.bitcast v209 : u32; - v260 = arith.add v258, v716 : u32 #[overflow = checked]; + v264 = arith.mod v262, v716 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + hir.store v265, v259; + v266 = hir.bitcast v211 : u32; v715 = arith.constant 4 : u32; - v262 = arith.mod v260, v715 : u32; - hir.assertz v262 #[code = 250]; - v263 = hir.int_to_ptr v260 : ptr; - hir.store v263, v257; - v264 = hir.bitcast v209 : u32; - v714 = arith.constant 4 : u32; - v266 = arith.mod v264, v714 : u32; - hir.assertz v266 #[code = 250]; - v267 = hir.int_to_ptr v264 : ptr; - hir.store v267, v230; - v713 = arith.constant 16 : i32; - v269 = arith.add v218, v713 : i32 #[overflow = wrapping]; - v270 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v271 = hir.bitcast v270 : ptr; - hir.store v271, v269; + v268 = arith.mod v266, v715 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + hir.store v269, v232; + v714 = arith.constant 16 : i32; + v271 = arith.add v220, v714 : i32 #[overflow = wrapping]; + v272 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v273 = hir.bitcast v272 : ptr; + hir.store v273, v271; builtin.ret ; ^block44: - v712 = arith.constant 12 : u32; - v244 = hir.bitcast v218 : u32; - v246 = arith.add v244, v712 : u32 #[overflow = checked]; - v711 = arith.constant 4 : u32; - v248 = arith.mod v246, v711 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - v250 = hir.load v249 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::handle_error(v230, v250) + v713 = arith.constant 12 : u32; + v246 = hir.bitcast v220 : u32; + v248 = arith.add v246, v713 : u32 #[overflow = checked]; + v712 = arith.constant 4 : u32; + v250 = arith.mod v248, v712 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + v252 = hir.load v251 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/alloc::raw_vec::handle_error(v232, v252) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::output_note::get_assets(v272: i32, v273: felt) { - ^block45(v272: i32, v273: felt): - v275 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v276 = hir.bitcast v275 : ptr; - v277 = hir.load v276 : i32; - v278 = arith.constant 16 : i32; - v279 = arith.sub v277, v278 : i32 #[overflow = wrapping]; - v280 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v281 = hir.bitcast v280 : ptr; - hir.store v281, v279; - v282 = arith.constant 4 : i32; - v283 = arith.add v279, v282 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/>::with_capacity(v283) - v287 = arith.constant 8 : u32; - v286 = hir.bitcast v279 : u32; - v288 = arith.add v286, v287 : u32 #[overflow = checked]; - v289 = arith.constant 4 : u32; - v290 = arith.mod v288, v289 : u32; - hir.assertz v290 #[code = 250]; - v291 = hir.int_to_ptr v288 : ptr; - v292 = hir.load v291 : i32; - v721 = arith.constant 2 : u32; - v294 = hir.bitcast v292 : u32; - v296 = arith.shr v294, v721 : u32; - v297 = hir.bitcast v296 : i32; - v298 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden::protocol::output_note::get_assets(v297, v273) : i32 - v284 = arith.constant 8 : i32; - v285 = arith.add v272, v284 : i32 #[overflow = wrapping]; - v299 = hir.bitcast v285 : u32; + private builtin.function @miden_base_sys::bindings::output_note::get_assets(v274: i32, v275: felt) { + ^block45(v274: i32, v275: felt): + v277 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v278 = hir.bitcast v277 : ptr; + v279 = hir.load v278 : i32; + v280 = arith.constant 16 : i32; + v281 = arith.sub v279, v280 : i32 #[overflow = wrapping]; + v282 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v283 = hir.bitcast v282 : ptr; + hir.store v283, v281; + v284 = arith.constant 4 : i32; + v285 = arith.add v281, v284 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/>::with_capacity(v285) + v289 = arith.constant 8 : u32; + v288 = hir.bitcast v281 : u32; + v290 = arith.add v288, v289 : u32 #[overflow = checked]; + v291 = arith.constant 4 : u32; + v292 = arith.mod v290, v291 : u32; + hir.assertz v292 #[code = 250]; + v293 = hir.int_to_ptr v290 : ptr; + v294 = hir.load v293 : i32; + v722 = arith.constant 2 : u32; + v296 = hir.bitcast v294 : u32; + v298 = arith.shr v296, v722 : u32; + v299 = hir.bitcast v298 : i32; + v300 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden::protocol::output_note::get_assets(v299, v275) : i32 + v286 = arith.constant 8 : i32; + v287 = arith.add v274, v286 : i32 #[overflow = wrapping]; + v301 = hir.bitcast v287 : u32; + v727 = arith.constant 4 : u32; + v303 = arith.mod v301, v727 : u32; + hir.assertz v303 #[code = 250]; + v304 = hir.int_to_ptr v301 : ptr; + hir.store v304, v300; v726 = arith.constant 4 : u32; - v301 = arith.mod v299, v726 : u32; - hir.assertz v301 #[code = 250]; - v302 = hir.int_to_ptr v299 : ptr; - hir.store v302, v298; + v305 = hir.bitcast v281 : u32; + v307 = arith.add v305, v726 : u32 #[overflow = checked]; v725 = arith.constant 4 : u32; - v303 = hir.bitcast v279 : u32; - v305 = arith.add v303, v725 : u32 #[overflow = checked]; + v309 = arith.mod v307, v725 : u32; + hir.assertz v309 #[code = 250]; + v310 = hir.int_to_ptr v307 : ptr; + v311 = hir.load v310 : i64; + v312 = hir.bitcast v274 : u32; v724 = arith.constant 4 : u32; - v307 = arith.mod v305, v724 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - v309 = hir.load v308 : i64; - v310 = hir.bitcast v272 : u32; - v723 = arith.constant 4 : u32; - v312 = arith.mod v310, v723 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - hir.store v313, v309; - v722 = arith.constant 16 : i32; - v315 = arith.add v279, v722 : i32 #[overflow = wrapping]; - v316 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v317 = hir.bitcast v316 : ptr; - hir.store v317, v315; + v314 = arith.mod v312, v724 : u32; + hir.assertz v314 #[code = 250]; + v315 = hir.int_to_ptr v312 : ptr; + hir.store v315, v311; + v723 = arith.constant 16 : i32; + v317 = arith.add v281, v723 : i32 #[overflow = wrapping]; + v318 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v319 = hir.bitcast v318 : ptr; + hir.store v319, v317; builtin.ret ; }; - private builtin.function @ as core::ops::drop::Drop>::drop(v318: i32) { - ^block47(v318: i32): - v319 = arith.constant 16 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v318, v319, v319) + private builtin.function @ as core::ops::drop::Drop>::drop(v320: i32) { + ^block47(v320: i32): + v321 = arith.constant 16 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v320, v321, v321) builtin.ret ; }; - private builtin.function @::alloc_impl(v321: i32, v322: i32, v323: i32, v324: i32) { - ^block49(v321: i32, v322: i32, v323: i32, v324: i32): - v742 = arith.constant 0 : i32; - v325 = arith.constant 0 : i32; - v326 = arith.eq v323, v325 : i1; - v327 = arith.zext v326 : u32; - v328 = hir.bitcast v327 : i32; - v330 = arith.neq v328, v742 : i1; - v738 = scf.if v330 : i32 { + private builtin.function @::alloc_impl(v323: i32, v324: i32, v325: i32, v326: i32) { + ^block49(v323: i32, v324: i32, v325: i32, v326: i32): + v743 = arith.constant 0 : i32; + v327 = arith.constant 0 : i32; + v328 = arith.eq v325, v327 : i1; + v329 = arith.zext v328 : u32; + v330 = hir.bitcast v329 : i32; + v332 = arith.neq v330, v743 : i1; + v739 = scf.if v332 : i32 { ^block109: - scf.yield v322; + scf.yield v324; } else { ^block52: hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v741 = arith.constant 0 : i32; - v332 = arith.neq v324, v741 : i1; - v737 = scf.if v332 : i32 { + v742 = arith.constant 0 : i32; + v334 = arith.neq v326, v742 : i1; + v738 = scf.if v334 : i32 { ^block53: - v334 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v323, v322) : i32 - scf.yield v334; + v336 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc_zeroed(v325, v324) : i32 + scf.yield v336; } else { ^block54: - v333 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc(v323, v322) : i32 - scf.yield v333; + v335 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_alloc(v325, v324) : i32 + scf.yield v335; }; - scf.yield v737; + scf.yield v738; }; - v338 = arith.constant 4 : u32; - v337 = hir.bitcast v321 : u32; - v339 = arith.add v337, v338 : u32 #[overflow = checked]; + v340 = arith.constant 4 : u32; + v339 = hir.bitcast v323 : u32; + v341 = arith.add v339, v340 : u32 #[overflow = checked]; + v741 = arith.constant 4 : u32; + v343 = arith.mod v341, v741 : u32; + hir.assertz v343 #[code = 250]; + v344 = hir.int_to_ptr v341 : ptr; + hir.store v344, v325; + v346 = hir.bitcast v323 : u32; v740 = arith.constant 4 : u32; - v341 = arith.mod v339, v740 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v323; - v344 = hir.bitcast v321 : u32; - v739 = arith.constant 4 : u32; - v346 = arith.mod v344, v739 : u32; - hir.assertz v346 #[code = 250]; - v347 = hir.int_to_ptr v344 : ptr; - hir.store v347, v738; + v348 = arith.mod v346, v740 : u32; + hir.assertz v348 #[code = 250]; + v349 = hir.int_to_ptr v346 : ptr; + hir.store v349, v739; builtin.ret ; }; - private builtin.function @::deallocate(v348: i32, v349: i32, v350: i32) { - ^block55(v348: i32, v349: i32, v350: i32): - v352 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v353 = hir.bitcast v352 : ptr; - v354 = hir.load v353 : i32; - v355 = arith.constant 16 : i32; - v356 = arith.sub v354, v355 : i32 #[overflow = wrapping]; - v357 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v358 = hir.bitcast v357 : ptr; - hir.store v358, v356; - v359 = arith.constant 4 : i32; - v360 = arith.add v356, v359 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::current_memory(v360, v348, v349, v350) - v362 = arith.constant 8 : u32; - v361 = hir.bitcast v356 : u32; - v363 = arith.add v361, v362 : u32 #[overflow = checked]; - v364 = arith.constant 4 : u32; - v365 = arith.mod v363, v364 : u32; - hir.assertz v365 #[code = 250]; - v366 = hir.int_to_ptr v363 : ptr; - v367 = hir.load v366 : i32; - v749 = arith.constant 0 : i32; - v351 = arith.constant 0 : i32; - v369 = arith.eq v367, v351 : i1; - v370 = arith.zext v369 : u32; - v371 = hir.bitcast v370 : i32; - v373 = arith.neq v371, v749 : i1; - scf.if v373{ + private builtin.function @::deallocate(v350: i32, v351: i32, v352: i32) { + ^block55(v350: i32, v351: i32, v352: i32): + v354 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v355 = hir.bitcast v354 : ptr; + v356 = hir.load v355 : i32; + v357 = arith.constant 16 : i32; + v358 = arith.sub v356, v357 : i32 #[overflow = wrapping]; + v359 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v360 = hir.bitcast v359 : ptr; + hir.store v360, v358; + v361 = arith.constant 4 : i32; + v362 = arith.add v358, v361 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::current_memory(v362, v350, v351, v352) + v364 = arith.constant 8 : u32; + v363 = hir.bitcast v358 : u32; + v365 = arith.add v363, v364 : u32 #[overflow = checked]; + v366 = arith.constant 4 : u32; + v367 = arith.mod v365, v366 : u32; + hir.assertz v367 #[code = 250]; + v368 = hir.int_to_ptr v365 : ptr; + v369 = hir.load v368 : i32; + v750 = arith.constant 0 : i32; + v353 = arith.constant 0 : i32; + v371 = arith.eq v369, v353 : i1; + v372 = arith.zext v371 : u32; + v373 = hir.bitcast v372 : i32; + v375 = arith.neq v373, v750 : i1; + scf.if v375{ ^block112: scf.yield ; } else { ^block58: + v749 = arith.constant 4 : u32; + v376 = hir.bitcast v358 : u32; + v378 = arith.add v376, v749 : u32 #[overflow = checked]; v748 = arith.constant 4 : u32; - v374 = hir.bitcast v356 : u32; - v376 = arith.add v374, v748 : u32 #[overflow = checked]; + v380 = arith.mod v378, v748 : u32; + hir.assertz v380 #[code = 250]; + v381 = hir.int_to_ptr v378 : ptr; + v382 = hir.load v381 : i32; + v384 = arith.constant 12 : u32; + v383 = hir.bitcast v358 : u32; + v385 = arith.add v383, v384 : u32 #[overflow = checked]; v747 = arith.constant 4 : u32; - v378 = arith.mod v376, v747 : u32; - hir.assertz v378 #[code = 250]; - v379 = hir.int_to_ptr v376 : ptr; - v380 = hir.load v379 : i32; - v382 = arith.constant 12 : u32; - v381 = hir.bitcast v356 : u32; - v383 = arith.add v381, v382 : u32 #[overflow = checked]; - v746 = arith.constant 4 : u32; - v385 = arith.mod v383, v746 : u32; - hir.assertz v385 #[code = 250]; - v386 = hir.int_to_ptr v383 : ptr; - v387 = hir.load v386 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v380, v367, v387) + v387 = arith.mod v385, v747 : u32; + hir.assertz v387 #[code = 250]; + v388 = hir.int_to_ptr v385 : ptr; + v389 = hir.load v388 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::deallocate(v382, v369, v389) scf.yield ; }; - v745 = arith.constant 16 : i32; - v390 = arith.add v356, v745 : i32 #[overflow = wrapping]; - v391 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v392 = hir.bitcast v391 : ptr; - hir.store v392, v390; + v746 = arith.constant 16 : i32; + v392 = arith.add v358, v746 : i32 #[overflow = wrapping]; + v393 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v394 = hir.bitcast v393 : ptr; + hir.store v394, v392; builtin.ret ; }; - private builtin.function @::current_memory(v393: i32, v394: i32, v395: i32, v396: i32) { - ^block59(v393: i32, v394: i32, v395: i32, v396: i32): - v775 = arith.constant 0 : i32; - v397 = arith.constant 0 : i32; - v401 = arith.eq v396, v397 : i1; - v402 = arith.zext v401 : u32; - v403 = hir.bitcast v402 : i32; - v405 = arith.neq v403, v775 : i1; - v762, v763 = scf.if v405 : i32, i32 { + private builtin.function @::current_memory(v395: i32, v396: i32, v397: i32, v398: i32) { + ^block59(v395: i32, v396: i32, v397: i32, v398: i32): + v776 = arith.constant 0 : i32; + v399 = arith.constant 0 : i32; + v403 = arith.eq v398, v399 : i1; + v404 = arith.zext v403 : u32; + v405 = hir.bitcast v404 : i32; + v407 = arith.neq v405, v776 : i1; + v763, v764 = scf.if v407 : i32, i32 { ^block115: - v774 = arith.constant 0 : i32; - v399 = arith.constant 4 : i32; - scf.yield v399, v774; + v775 = arith.constant 0 : i32; + v401 = arith.constant 4 : i32; + scf.yield v401, v775; } else { ^block62: - v406 = hir.bitcast v394 : u32; - v441 = arith.constant 4 : u32; - v408 = arith.mod v406, v441 : u32; - hir.assertz v408 #[code = 250]; - v409 = hir.int_to_ptr v406 : ptr; - v410 = hir.load v409 : i32; - v772 = arith.constant 0 : i32; + v408 = hir.bitcast v396 : u32; + v443 = arith.constant 4 : u32; + v410 = arith.mod v408, v443 : u32; + hir.assertz v410 #[code = 250]; + v411 = hir.int_to_ptr v408 : ptr; + v412 = hir.load v411 : i32; v773 = arith.constant 0 : i32; - v412 = arith.eq v410, v773 : i1; - v413 = arith.zext v412 : u32; - v414 = hir.bitcast v413 : i32; - v416 = arith.neq v414, v772 : i1; - v760 = scf.if v416 : i32 { + v774 = arith.constant 0 : i32; + v414 = arith.eq v412, v774 : i1; + v415 = arith.zext v414 : u32; + v416 = hir.bitcast v415 : i32; + v418 = arith.neq v416, v773 : i1; + v761 = scf.if v418 : i32 { ^block114: - v771 = arith.constant 0 : i32; - scf.yield v771; + v772 = arith.constant 0 : i32; + scf.yield v772; } else { ^block63: + v771 = arith.constant 4 : u32; + v419 = hir.bitcast v395 : u32; + v421 = arith.add v419, v771 : u32 #[overflow = checked]; v770 = arith.constant 4 : u32; - v417 = hir.bitcast v393 : u32; - v419 = arith.add v417, v770 : u32 #[overflow = checked]; + v423 = arith.mod v421, v770 : u32; + hir.assertz v423 #[code = 250]; + v424 = hir.int_to_ptr v421 : ptr; + hir.store v424, v397; v769 = arith.constant 4 : u32; - v421 = arith.mod v419, v769 : u32; - hir.assertz v421 #[code = 250]; - v422 = hir.int_to_ptr v419 : ptr; - hir.store v422, v395; + v425 = hir.bitcast v396 : u32; + v427 = arith.add v425, v769 : u32 #[overflow = checked]; v768 = arith.constant 4 : u32; - v423 = hir.bitcast v394 : u32; - v425 = arith.add v423, v768 : u32 #[overflow = checked]; + v429 = arith.mod v427, v768 : u32; + hir.assertz v429 #[code = 250]; + v430 = hir.int_to_ptr v427 : ptr; + v431 = hir.load v430 : i32; + v432 = hir.bitcast v395 : u32; v767 = arith.constant 4 : u32; - v427 = arith.mod v425, v767 : u32; - hir.assertz v427 #[code = 250]; - v428 = hir.int_to_ptr v425 : ptr; - v429 = hir.load v428 : i32; - v430 = hir.bitcast v393 : u32; - v766 = arith.constant 4 : u32; - v432 = arith.mod v430, v766 : u32; - hir.assertz v432 #[code = 250]; - v433 = hir.int_to_ptr v430 : ptr; - hir.store v433, v429; - v434 = arith.mul v410, v396 : i32 #[overflow = wrapping]; - scf.yield v434; + v434 = arith.mod v432, v767 : u32; + hir.assertz v434 #[code = 250]; + v435 = hir.int_to_ptr v432 : ptr; + hir.store v435, v431; + v436 = arith.mul v412, v398 : i32 #[overflow = wrapping]; + scf.yield v436; }; - v435 = arith.constant 8 : i32; - v765 = arith.constant 4 : i32; - v761 = cf.select v416, v765, v435 : i32; - scf.yield v761, v760; + v437 = arith.constant 8 : i32; + v766 = arith.constant 4 : i32; + v762 = cf.select v418, v766, v437 : i32; + scf.yield v762, v761; }; - v438 = arith.add v393, v762 : i32 #[overflow = wrapping]; - v440 = hir.bitcast v438 : u32; - v764 = arith.constant 4 : u32; - v442 = arith.mod v440, v764 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v763; + v440 = arith.add v395, v763 : i32 #[overflow = wrapping]; + v442 = hir.bitcast v440 : u32; + v765 = arith.constant 4 : u32; + v444 = arith.mod v442, v765 : u32; + hir.assertz v444 #[code = 250]; + v445 = hir.int_to_ptr v442 : ptr; + hir.store v445, v764; builtin.ret ; }; - private builtin.function @::deallocate(v444: i32, v445: i32, v446: i32) { - ^block64(v444: i32, v445: i32, v446: i32): - v777 = arith.constant 0 : i32; - v447 = arith.constant 0 : i32; - v448 = arith.eq v446, v447 : i1; - v449 = arith.zext v448 : u32; - v450 = hir.bitcast v449 : i32; - v452 = arith.neq v450, v777 : i1; - scf.if v452{ + private builtin.function @::deallocate(v446: i32, v447: i32, v448: i32) { + ^block64(v446: i32, v447: i32, v448: i32): + v778 = arith.constant 0 : i32; + v449 = arith.constant 0 : i32; + v450 = arith.eq v448, v449 : i1; + v451 = arith.zext v450 : u32; + v452 = hir.bitcast v451 : i32; + v454 = arith.neq v452, v778 : i1; + scf.if v454{ ^block66: scf.yield ; } else { ^block67: - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_dealloc(v444, v446, v445) + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__rustc::__rust_dealloc(v446, v448, v447) scf.yield ; }; builtin.ret ; }; - private builtin.function @::allocate(v453: i32, v454: i32, v455: i32) { - ^block68(v453: i32, v454: i32, v455: i32): - v457 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v458 = hir.bitcast v457 : ptr; - v459 = hir.load v458 : i32; - v460 = arith.constant 16 : i32; - v461 = arith.sub v459, v460 : i32 #[overflow = wrapping]; - v462 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v463 = hir.bitcast v462 : ptr; - hir.store v463, v461; - v456 = arith.constant 0 : i32; - v464 = arith.constant 8 : i32; - v465 = arith.add v461, v464 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v465, v454, v455, v456) - v468 = arith.constant 12 : u32; - v467 = hir.bitcast v461 : u32; - v469 = arith.add v467, v468 : u32 #[overflow = checked]; - v470 = arith.constant 4 : u32; - v471 = arith.mod v469, v470 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - v473 = hir.load v472 : i32; - v475 = arith.constant 8 : u32; - v474 = hir.bitcast v461 : u32; - v476 = arith.add v474, v475 : u32 #[overflow = checked]; + private builtin.function @::allocate(v455: i32, v456: i32, v457: i32) { + ^block68(v455: i32, v456: i32, v457: i32): + v459 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v460 = hir.bitcast v459 : ptr; + v461 = hir.load v460 : i32; + v462 = arith.constant 16 : i32; + v463 = arith.sub v461, v462 : i32 #[overflow = wrapping]; + v464 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v465 = hir.bitcast v464 : ptr; + hir.store v465, v463; + v458 = arith.constant 0 : i32; + v466 = arith.constant 8 : i32; + v467 = arith.add v463, v466 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v467, v456, v457, v458) + v470 = arith.constant 12 : u32; + v469 = hir.bitcast v463 : u32; + v471 = arith.add v469, v470 : u32 #[overflow = checked]; + v472 = arith.constant 4 : u32; + v473 = arith.mod v471, v472 : u32; + hir.assertz v473 #[code = 250]; + v474 = hir.int_to_ptr v471 : ptr; + v475 = hir.load v474 : i32; + v477 = arith.constant 8 : u32; + v476 = hir.bitcast v463 : u32; + v478 = arith.add v476, v477 : u32 #[overflow = checked]; + v783 = arith.constant 4 : u32; + v480 = arith.mod v478, v783 : u32; + hir.assertz v480 #[code = 250]; + v481 = hir.int_to_ptr v478 : ptr; + v482 = hir.load v481 : i32; + v483 = hir.bitcast v455 : u32; v782 = arith.constant 4 : u32; - v478 = arith.mod v476, v782 : u32; - hir.assertz v478 #[code = 250]; - v479 = hir.int_to_ptr v476 : ptr; - v480 = hir.load v479 : i32; - v481 = hir.bitcast v453 : u32; + v485 = arith.mod v483, v782 : u32; + hir.assertz v485 #[code = 250]; + v486 = hir.int_to_ptr v483 : ptr; + hir.store v486, v482; v781 = arith.constant 4 : u32; - v483 = arith.mod v481, v781 : u32; - hir.assertz v483 #[code = 250]; - v484 = hir.int_to_ptr v481 : ptr; - hir.store v484, v480; + v487 = hir.bitcast v455 : u32; + v489 = arith.add v487, v781 : u32 #[overflow = checked]; v780 = arith.constant 4 : u32; - v485 = hir.bitcast v453 : u32; - v487 = arith.add v485, v780 : u32 #[overflow = checked]; - v779 = arith.constant 4 : u32; - v489 = arith.mod v487, v779 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - hir.store v490, v473; - v778 = arith.constant 16 : i32; - v492 = arith.add v461, v778 : i32 #[overflow = wrapping]; - v493 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v494 = hir.bitcast v493 : ptr; - hir.store v494, v492; + v491 = arith.mod v489, v780 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + hir.store v492, v475; + v779 = arith.constant 16 : i32; + v494 = arith.add v463, v779 : i32 #[overflow = wrapping]; + v495 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v496 = hir.bitcast v495 : ptr; + hir.store v496, v494; builtin.ret ; }; - private builtin.function @::try_allocate_in(v495: i32, v496: i32, v497: i32, v498: i32, v499: i32) { - ^block70(v495: i32, v496: i32, v497: i32, v498: i32, v499: i32): - v502 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v503 = hir.bitcast v502 : ptr; - v504 = hir.load v503 : i32; - v505 = arith.constant 16 : i32; - v506 = arith.sub v504, v505 : i32 #[overflow = wrapping]; - v507 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v508 = hir.bitcast v507 : ptr; - hir.store v508, v506; - v518 = hir.bitcast v496 : u32; - v519 = arith.zext v518 : u64; - v520 = hir.bitcast v519 : i64; - v500 = arith.constant 0 : i32; - v513 = arith.sub v500, v498 : i32 #[overflow = wrapping]; - v510 = arith.constant -1 : i32; - v509 = arith.add v498, v499 : i32 #[overflow = wrapping]; - v511 = arith.add v509, v510 : i32 #[overflow = wrapping]; - v514 = arith.band v511, v513 : i32; - v515 = hir.bitcast v514 : u32; - v516 = arith.zext v515 : u64; - v517 = hir.bitcast v516 : i64; - v521 = arith.mul v517, v520 : i64 #[overflow = wrapping]; - v885 = arith.constant 0 : i32; - v522 = arith.constant 32 : i64; - v524 = hir.cast v522 : u32; - v523 = hir.bitcast v521 : u64; - v525 = arith.shr v523, v524 : u64; - v526 = hir.bitcast v525 : i64; - v527 = arith.trunc v526 : i32; - v529 = arith.neq v527, v885 : i1; - v798, v799, v800, v801, v802, v803 = scf.if v529 : i32, i32, i32, i32, i32, u32 { + private builtin.function @::try_allocate_in(v497: i32, v498: i32, v499: i32, v500: i32, v501: i32) { + ^block70(v497: i32, v498: i32, v499: i32, v500: i32, v501: i32): + v504 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v505 = hir.bitcast v504 : ptr; + v506 = hir.load v505 : i32; + v507 = arith.constant 16 : i32; + v508 = arith.sub v506, v507 : i32 #[overflow = wrapping]; + v509 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v510 = hir.bitcast v509 : ptr; + hir.store v510, v508; + v520 = hir.bitcast v498 : u32; + v521 = arith.zext v520 : u64; + v522 = hir.bitcast v521 : i64; + v502 = arith.constant 0 : i32; + v515 = arith.sub v502, v500 : i32 #[overflow = wrapping]; + v512 = arith.constant -1 : i32; + v511 = arith.add v500, v501 : i32 #[overflow = wrapping]; + v513 = arith.add v511, v512 : i32 #[overflow = wrapping]; + v516 = arith.band v513, v515 : i32; + v517 = hir.bitcast v516 : u32; + v518 = arith.zext v517 : u64; + v519 = hir.bitcast v518 : i64; + v523 = arith.mul v519, v522 : i64 #[overflow = wrapping]; + v886 = arith.constant 0 : i32; + v524 = arith.constant 32 : i64; + v526 = hir.cast v524 : u32; + v525 = hir.bitcast v523 : u64; + v527 = arith.shr v525, v526 : u64; + v528 = hir.bitcast v527 : i64; + v529 = arith.trunc v528 : i32; + v531 = arith.neq v529, v886 : i1; + v799, v800, v801, v802, v803, v804 = scf.if v531 : i32, i32, i32, i32, i32, u32 { ^block119: - v783 = arith.constant 0 : u32; - v790 = ub.poison i32 : i32; - scf.yield v495, v506, v790, v790, v790, v783; + v784 = arith.constant 0 : u32; + v791 = ub.poison i32 : i32; + scf.yield v497, v508, v791, v791, v791, v784; } else { ^block75: - v530 = arith.trunc v521 : i32; - v884 = arith.constant 0 : i32; - v531 = arith.constant -2147483648 : i32; - v532 = arith.sub v531, v498 : i32 #[overflow = wrapping]; - v534 = hir.bitcast v532 : u32; - v533 = hir.bitcast v530 : u32; - v535 = arith.lte v533, v534 : i1; - v536 = arith.zext v535 : u32; - v537 = hir.bitcast v536 : i32; - v539 = arith.neq v537, v884 : i1; - v846 = scf.if v539 : i32 { + v532 = arith.trunc v523 : i32; + v885 = arith.constant 0 : i32; + v533 = arith.constant -2147483648 : i32; + v534 = arith.sub v533, v500 : i32 #[overflow = wrapping]; + v536 = hir.bitcast v534 : u32; + v535 = hir.bitcast v532 : u32; + v537 = arith.lte v535, v536 : i1; + v538 = arith.zext v537 : u32; + v539 = hir.bitcast v538 : i32; + v541 = arith.neq v539, v885 : i1; + v847 = scf.if v541 : i32 { ^block73: - v883 = arith.constant 0 : i32; - v550 = arith.neq v530, v883 : i1; - v845 = scf.if v550 : i32 { + v884 = arith.constant 0 : i32; + v552 = arith.neq v532, v884 : i1; + v846 = scf.if v552 : i32 { ^block77: - v882 = arith.constant 0 : i32; - v566 = arith.neq v497, v882 : i1; - v844 = scf.if v566 : i32 { + v883 = arith.constant 0 : i32; + v568 = arith.neq v499, v883 : i1; + v845 = scf.if v568 : i32 { ^block80: - v548 = arith.constant 1 : i32; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v506, v498, v530, v548) - v577 = hir.bitcast v506 : u32; - v618 = arith.constant 4 : u32; - v579 = arith.mod v577, v618 : u32; - hir.assertz v579 #[code = 250]; - v580 = hir.int_to_ptr v577 : ptr; - v581 = hir.load v580 : i32; - scf.yield v581; + v550 = arith.constant 1 : i32; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::alloc_impl(v508, v500, v532, v550) + v579 = hir.bitcast v508 : u32; + v620 = arith.constant 4 : u32; + v581 = arith.mod v579, v620 : u32; + hir.assertz v581 #[code = 250]; + v582 = hir.int_to_ptr v579 : ptr; + v583 = hir.load v582 : i32; + scf.yield v583; } else { ^block81: - v567 = arith.constant 8 : i32; - v568 = arith.add v506, v567 : i32 #[overflow = wrapping]; - hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::allocate(v568, v498, v530) - v552 = arith.constant 8 : u32; - v569 = hir.bitcast v506 : u32; - v571 = arith.add v569, v552 : u32 #[overflow = checked]; - v881 = arith.constant 4 : u32; - v573 = arith.mod v571, v881 : u32; - hir.assertz v573 #[code = 250]; - v574 = hir.int_to_ptr v571 : ptr; - v575 = hir.load v574 : i32; - scf.yield v575; + v569 = arith.constant 8 : i32; + v570 = arith.add v508, v569 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/::allocate(v570, v500, v532) + v554 = arith.constant 8 : u32; + v571 = hir.bitcast v508 : u32; + v573 = arith.add v571, v554 : u32 #[overflow = checked]; + v882 = arith.constant 4 : u32; + v575 = arith.mod v573, v882 : u32; + hir.assertz v575 #[code = 250]; + v576 = hir.int_to_ptr v573 : ptr; + v577 = hir.load v576 : i32; + scf.yield v577; }; - v880 = arith.constant 0 : i32; - v584 = arith.neq v844, v880 : i1; - scf.if v584{ + v881 = arith.constant 0 : i32; + v586 = arith.neq v845, v881 : i1; + scf.if v586{ ^block82: - v879 = arith.constant 8 : u32; - v601 = hir.bitcast v495 : u32; - v603 = arith.add v601, v879 : u32 #[overflow = checked]; + v880 = arith.constant 8 : u32; + v603 = hir.bitcast v497 : u32; + v605 = arith.add v603, v880 : u32 #[overflow = checked]; + v879 = arith.constant 4 : u32; + v607 = arith.mod v605, v879 : u32; + hir.assertz v607 #[code = 250]; + v608 = hir.int_to_ptr v605 : ptr; + hir.store v608, v845; v878 = arith.constant 4 : u32; - v605 = arith.mod v603, v878 : u32; - hir.assertz v605 #[code = 250]; - v606 = hir.int_to_ptr v603 : ptr; - hir.store v606, v844; + v610 = hir.bitcast v497 : u32; + v612 = arith.add v610, v878 : u32 #[overflow = checked]; v877 = arith.constant 4 : u32; - v608 = hir.bitcast v495 : u32; - v610 = arith.add v608, v877 : u32 #[overflow = checked]; - v876 = arith.constant 4 : u32; - v612 = arith.mod v610, v876 : u32; - hir.assertz v612 #[code = 250]; - v613 = hir.int_to_ptr v610 : ptr; - hir.store v613, v496; + v614 = arith.mod v612, v877 : u32; + hir.assertz v614 #[code = 250]; + v615 = hir.int_to_ptr v612 : ptr; + hir.store v615, v498; scf.yield ; } else { ^block83: - v875 = arith.constant 8 : u32; - v587 = hir.bitcast v495 : u32; - v589 = arith.add v587, v875 : u32 #[overflow = checked]; + v876 = arith.constant 8 : u32; + v589 = hir.bitcast v497 : u32; + v591 = arith.add v589, v876 : u32 #[overflow = checked]; + v875 = arith.constant 4 : u32; + v593 = arith.mod v591, v875 : u32; + hir.assertz v593 #[code = 250]; + v594 = hir.int_to_ptr v591 : ptr; + hir.store v594, v532; v874 = arith.constant 4 : u32; - v591 = arith.mod v589, v874 : u32; - hir.assertz v591 #[code = 250]; - v592 = hir.int_to_ptr v589 : ptr; - hir.store v592, v530; + v596 = hir.bitcast v497 : u32; + v598 = arith.add v596, v874 : u32 #[overflow = checked]; v873 = arith.constant 4 : u32; - v594 = hir.bitcast v495 : u32; - v596 = arith.add v594, v873 : u32 #[overflow = checked]; - v872 = arith.constant 4 : u32; - v598 = arith.mod v596, v872 : u32; - hir.assertz v598 #[code = 250]; - v599 = hir.int_to_ptr v596 : ptr; - hir.store v599, v498; + v600 = arith.mod v598, v873 : u32; + hir.assertz v600 #[code = 250]; + v601 = hir.int_to_ptr v598 : ptr; + hir.store v601, v500; scf.yield ; }; - v870 = arith.constant 1 : i32; - v871 = arith.constant 0 : i32; - v843 = cf.select v584, v871, v870 : i32; - scf.yield v843; + v871 = arith.constant 1 : i32; + v872 = arith.constant 0 : i32; + v844 = cf.select v586, v872, v871 : i32; + scf.yield v844; } else { ^block78: - v869 = arith.constant 8 : u32; - v551 = hir.bitcast v495 : u32; - v553 = arith.add v551, v869 : u32 #[overflow = checked]; + v870 = arith.constant 8 : u32; + v553 = hir.bitcast v497 : u32; + v555 = arith.add v553, v870 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v557 = arith.mod v555, v869 : u32; + hir.assertz v557 #[code = 250]; + v558 = hir.int_to_ptr v555 : ptr; + hir.store v558, v500; v868 = arith.constant 4 : u32; - v555 = arith.mod v553, v868 : u32; - hir.assertz v555 #[code = 250]; - v556 = hir.int_to_ptr v553 : ptr; - hir.store v556, v498; + v561 = hir.bitcast v497 : u32; + v563 = arith.add v561, v868 : u32 #[overflow = checked]; v867 = arith.constant 4 : u32; - v559 = hir.bitcast v495 : u32; - v561 = arith.add v559, v867 : u32 #[overflow = checked]; - v866 = arith.constant 4 : u32; - v563 = arith.mod v561, v866 : u32; - hir.assertz v563 #[code = 250]; + v565 = arith.mod v563, v867 : u32; + hir.assertz v565 #[code = 250]; + v866 = arith.constant 0 : i32; + v566 = hir.int_to_ptr v563 : ptr; + hir.store v566, v866; v865 = arith.constant 0 : i32; - v564 = hir.int_to_ptr v561 : ptr; - hir.store v564, v865; - v864 = arith.constant 0 : i32; - scf.yield v864; + scf.yield v865; }; - scf.yield v845; + scf.yield v846; } else { ^block76: - v863 = ub.poison i32 : i32; - scf.yield v863; + v864 = ub.poison i32 : i32; + scf.yield v864; }; - v858 = arith.constant 0 : u32; - v791 = arith.constant 1 : u32; - v851 = cf.select v539, v791, v858 : u32; - v859 = ub.poison i32 : i32; - v850 = cf.select v539, v506, v859 : i32; + v859 = arith.constant 0 : u32; + v792 = arith.constant 1 : u32; + v852 = cf.select v541, v792, v859 : u32; v860 = ub.poison i32 : i32; - v849 = cf.select v539, v495, v860 : i32; + v851 = cf.select v541, v508, v860 : i32; v861 = ub.poison i32 : i32; - v848 = cf.select v539, v861, v506 : i32; + v850 = cf.select v541, v497, v861 : i32; v862 = ub.poison i32 : i32; - v847 = cf.select v539, v862, v495 : i32; - scf.yield v847, v848, v849, v846, v850, v851; + v849 = cf.select v541, v862, v508 : i32; + v863 = ub.poison i32 : i32; + v848 = cf.select v541, v863, v497 : i32; + scf.yield v848, v849, v850, v847, v851, v852; }; - v804, v805, v806 = scf.index_switch v803 : i32, i32, i32 + v805, v806, v807 = scf.index_switch v804 : i32, i32, i32 case 0 { ^block74: + v858 = arith.constant 4 : u32; + v544 = hir.bitcast v799 : u32; + v546 = arith.add v544, v858 : u32 #[overflow = checked]; v857 = arith.constant 4 : u32; - v542 = hir.bitcast v798 : u32; - v544 = arith.add v542, v857 : u32 #[overflow = checked]; - v856 = arith.constant 4 : u32; - v546 = arith.mod v544, v856 : u32; - hir.assertz v546 #[code = 250]; - v855 = arith.constant 0 : i32; - v547 = hir.int_to_ptr v544 : ptr; - hir.store v547, v855; - v854 = arith.constant 1 : i32; - scf.yield v798, v854, v799; + v548 = arith.mod v546, v857 : u32; + hir.assertz v548 #[code = 250]; + v856 = arith.constant 0 : i32; + v549 = hir.int_to_ptr v546 : ptr; + hir.store v549, v856; + v855 = arith.constant 1 : i32; + scf.yield v799, v855, v800; } default { ^block123: - scf.yield v800, v801, v802; + scf.yield v801, v802, v803; }; - v617 = hir.bitcast v804 : u32; - v853 = arith.constant 4 : u32; - v619 = arith.mod v617, v853 : u32; - hir.assertz v619 #[code = 250]; - v620 = hir.int_to_ptr v617 : ptr; - hir.store v620, v805; - v852 = arith.constant 16 : i32; - v625 = arith.add v806, v852 : i32 #[overflow = wrapping]; - v626 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr - v627 = hir.bitcast v626 : ptr; - hir.store v627, v625; + v619 = hir.bitcast v805 : u32; + v854 = arith.constant 4 : u32; + v621 = arith.mod v619, v854 : u32; + hir.assertz v621 #[code = 250]; + v622 = hir.int_to_ptr v619 : ptr; + hir.store v622, v806; + v853 = arith.constant 16 : i32; + v627 = arith.add v807, v853 : i32 #[overflow = wrapping]; + v628 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/__stack_pointer : ptr + v629 = hir.bitcast v628 : ptr; + hir.store v629, v627; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v628: i32, v629: i32) { - ^block84(v628: i32, v629: i32): + private builtin.function @alloc::raw_vec::handle_error(v630: i32, v631: i32) { + ^block84(v630: i32, v631: i32): ub.unreachable ; }; - private builtin.function @::max(v630: i32, v631: i32) -> i32 { - ^block86(v630: i32, v631: i32): - v638 = arith.constant 0 : i32; - v634 = hir.bitcast v631 : u32; - v633 = hir.bitcast v630 : u32; - v635 = arith.gt v633, v634 : i1; - v636 = arith.zext v635 : u32; - v637 = hir.bitcast v636 : i32; - v639 = arith.neq v637, v638 : i1; - v640 = cf.select v639, v630, v631 : i32; - builtin.ret v640; + private builtin.function @::max(v632: i32, v633: i32) -> i32 { + ^block86(v632: i32, v633: i32): + v640 = arith.constant 0 : i32; + v636 = hir.bitcast v633 : u32; + v635 = hir.bitcast v632 : u32; + v637 = arith.gt v635, v636 : i1; + v638 = arith.zext v637 : u32; + v639 = hir.bitcast v638 : i32; + v641 = arith.neq v639, v640 : i1; + v642 = cf.select v641, v632, v633 : i32; + builtin.ret v642; }; - private builtin.function @miden::protocol::output_note::get_assets(v641: i32, v642: felt) -> i32 { - ^block88(v641: i32, v642: felt): - v643, v644 = hir.exec @miden/protocol/output_note/get_assets(v641, v642) : i32, i32 - builtin.ret v643; + private builtin.function @miden::protocol::output_note::get_assets(v643: i32, v644: felt) -> i32 { + ^block88(v643: i32, v644: felt): + v645, v646 = hir.exec @miden/protocol/output_note/get_assets(v643, v644) : i32, i32 + builtin.ret v645; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -940,7 +943,7 @@ builtin.component miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output- public builtin.function @binding() -> felt { ^block93: - v646 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() : felt - builtin.ret v646; + v648 = hir.exec @miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1/rust_sdk_output_note_get_assets_binding/miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-assets-binding@0.0.1#binding() : felt + builtin.ret v648; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm index 1a9e5a352..9483974eb 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.masm @@ -193,6 +193,9 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse trace.252 nop push.0 + push.0 + mul.4294967296 + add push.4 dup.2 u32wrapping_add @@ -237,6 +240,9 @@ proc miden:rust-sdk-output-note-get-assets-binding/rust-sdk-output-note-get-asse exec.::intrinsics::mem::store_sw trace.252 nop + push.0 + mul.4294967296 + add end @callconv("C") diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat index 1e464f08b..81d753773 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_binding.wat @@ -16,7 +16,7 @@ (type (;6;) (func (param i32))) (type (;7;) (func (param i32 i32 i32 i32))) (type (;8;) (func (param i32 f32))) - (type (;9;) (func (param i32) (result f32))) + (type (;9;) (func (param i64) (result f32))) (type (;10;) (func (param i32 i32 i32 i32 i32))) (type (;11;) (func (param i32 i32))) (type (;12;) (func (param i32 f32) (result i32))) @@ -70,12 +70,12 @@ local.get 0 i32.const 4 i32.add - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::output_note::get_assets local.get 0 - i32.load offset=12 - call $intrinsics::felt::from_u32 + i64.load32_u offset=12 + call $intrinsics::felt::from_u64_unchecked local.set 1 local.get 0 i32.const 4 @@ -289,7 +289,7 @@ i32.const 16 call $::deallocate ) - (func $intrinsics::felt::from_u32 (;14;) (type 9) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;14;) (type 9) (param i64) (result f32) unreachable ) (func $::alloc_impl (;15;) (type 7) (param i32 i32 i32 i32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir index d06507d09..2c3a8ebe3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou v9 = hir.bitcast v8 : ptr; hir.store v9, v7; hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/wit_bindgen::rt::run_ctors_once() - v143 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden_base_sys::bindings::output_note::get_assets_info(v7, v143) + v10 = arith.constant 0 : i64; + v11 = arith.trunc v10 : felt; + hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/miden_base_sys::bindings::output_note::get_assets_info(v7, v11) v13 = arith.constant 16 : u32; v12 = hir.bitcast v7 : u32; v14 = arith.add v12, v13 : u32 #[overflow = checked]; @@ -31,8 +32,8 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou hir.assertz v16 #[code = 250]; v17 = hir.int_to_ptr v14 : ptr; v18 = hir.load v17 : felt; - v144 = arith.constant 32 : i32; - v20 = arith.add v7, v144 : i32 #[overflow = wrapping]; + v143 = arith.constant 32 : i32; + v20 = arith.add v7, v143 : i32 #[overflow = wrapping]; v21 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr v22 = hir.bitcast v21 : ptr; hir.store v22, v20; @@ -62,12 +63,12 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou v37 = hir.bitcast v36 : ptr; v38 = hir.load v37 : i32; hir.exec @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__wasm_call_ctors() - v146 = arith.constant 1 : u8; - v148 = arith.constant 1048584 : i32; - v40 = arith.add v38, v148 : i32 #[overflow = wrapping]; + v145 = arith.constant 1 : u8; + v147 = arith.constant 1048584 : i32; + v40 = arith.add v38, v147 : i32 #[overflow = wrapping]; v44 = hir.bitcast v40 : u32; v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v146; + hir.store v45, v145; scf.yield ; }; builtin.ret ; @@ -92,76 +93,76 @@ builtin.component miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-ou hir.assertz v60 #[code = 250]; v61 = hir.int_to_ptr v58 : ptr; v62 = hir.load v61 : felt; - v163 = arith.constant 16 : u32; + v162 = arith.constant 16 : u32; v63 = hir.bitcast v46 : u32; - v65 = arith.add v63, v163 : u32 #[overflow = checked]; - v162 = arith.constant 4 : u32; - v67 = arith.mod v65, v162 : u32; + v65 = arith.add v63, v162 : u32 #[overflow = checked]; + v161 = arith.constant 4 : u32; + v67 = arith.mod v65, v161 : u32; hir.assertz v67 #[code = 250]; v68 = hir.int_to_ptr v65 : ptr; hir.store v68, v62; v69 = hir.bitcast v53 : u32; - v161 = arith.constant 4 : u32; - v71 = arith.mod v69, v161 : u32; + v160 = arith.constant 4 : u32; + v71 = arith.mod v69, v160 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : felt; v75 = arith.constant 12 : u32; v74 = hir.bitcast v46 : u32; v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v160 = arith.constant 4 : u32; - v78 = arith.mod v76, v160 : u32; + v159 = arith.constant 4 : u32; + v78 = arith.mod v76, v159 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; hir.store v79, v73; - v159 = arith.constant 4 : u32; - v80 = hir.bitcast v53 : u32; - v82 = arith.add v80, v159 : u32 #[overflow = checked]; v158 = arith.constant 4 : u32; - v84 = arith.mod v82, v158 : u32; + v80 = hir.bitcast v53 : u32; + v82 = arith.add v80, v158 : u32 #[overflow = checked]; + v157 = arith.constant 4 : u32; + v84 = arith.mod v82, v157 : u32; hir.assertz v84 #[code = 250]; v85 = hir.int_to_ptr v82 : ptr; v86 = hir.load v85 : felt; v88 = arith.constant 8 : u32; v87 = hir.bitcast v46 : u32; v89 = arith.add v87, v88 : u32 #[overflow = checked]; - v157 = arith.constant 4 : u32; - v91 = arith.mod v89, v157 : u32; + v156 = arith.constant 4 : u32; + v91 = arith.mod v89, v156 : u32; hir.assertz v91 #[code = 250]; v92 = hir.int_to_ptr v89 : ptr; hir.store v92, v86; - v156 = arith.constant 8 : u32; + v155 = arith.constant 8 : u32; v93 = hir.bitcast v53 : u32; - v95 = arith.add v93, v156 : u32 #[overflow = checked]; - v155 = arith.constant 4 : u32; - v97 = arith.mod v95, v155 : u32; + v95 = arith.add v93, v155 : u32 #[overflow = checked]; + v154 = arith.constant 4 : u32; + v97 = arith.mod v95, v154 : u32; hir.assertz v97 #[code = 250]; v98 = hir.int_to_ptr v95 : ptr; v99 = hir.load v98 : felt; - v154 = arith.constant 4 : u32; - v100 = hir.bitcast v46 : u32; - v102 = arith.add v100, v154 : u32 #[overflow = checked]; v153 = arith.constant 4 : u32; - v104 = arith.mod v102, v153 : u32; + v100 = hir.bitcast v46 : u32; + v102 = arith.add v100, v153 : u32 #[overflow = checked]; + v152 = arith.constant 4 : u32; + v104 = arith.mod v102, v152 : u32; hir.assertz v104 #[code = 250]; v105 = hir.int_to_ptr v102 : ptr; hir.store v105, v99; - v152 = arith.constant 12 : u32; + v151 = arith.constant 12 : u32; v106 = hir.bitcast v53 : u32; - v108 = arith.add v106, v152 : u32 #[overflow = checked]; - v151 = arith.constant 4 : u32; - v110 = arith.mod v108, v151 : u32; + v108 = arith.add v106, v151 : u32 #[overflow = checked]; + v150 = arith.constant 4 : u32; + v110 = arith.mod v108, v150 : u32; hir.assertz v110 #[code = 250]; v111 = hir.int_to_ptr v108 : ptr; v112 = hir.load v111 : felt; v113 = hir.bitcast v46 : u32; - v150 = arith.constant 4 : u32; - v115 = arith.mod v113, v150 : u32; + v149 = arith.constant 4 : u32; + v115 = arith.mod v113, v149 : u32; hir.assertz v115 #[code = 250]; v116 = hir.int_to_ptr v113 : ptr; hir.store v116, v112; - v149 = arith.constant 32 : i32; - v118 = arith.add v53, v149 : i32 #[overflow = wrapping]; + v148 = arith.constant 32 : i32; + v118 = arith.add v53, v148 : i32 #[overflow = wrapping]; v119 = builtin.global_symbol @miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get-assets-info-binding@0.0.1/rust_sdk_output_note_get_assets_info_binding/__stack_pointer : ptr v120 = hir.bitcast v119 : ptr; hir.store v120, v118; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm index f4eaf8e2f..c92275db0 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.masm @@ -80,6 +80,9 @@ proc miden:rust-sdk-output-note-get-assets-info-binding/rust-sdk-output-note-get trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat index 7ee8159e0..7c008f41b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_assets_info_binding.wat @@ -10,7 +10,7 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -30,8 +30,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::output_note::get_assets_info local.get 0 f32.load offset=16 @@ -95,7 +95,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::output_note::get_assets_info (;6;) (type 4) (param f32 i32) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir index fbe59ea1e..9df4c69da 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/wit_bindgen::rt::run_ctors_once() - v155 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden_base_sys::bindings::output_note::get_metadata(v6, v155) + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden_base_sys::bindings::output_note::get_metadata(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v160 = arith.constant 8 : u32; - v20 = arith.mod v18, v160 : u32; + v157 = arith.constant 8 : u32; + v20 = arith.mod v18, v157 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v159 = arith.constant 8 : u32; + v156 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v159 : u32 #[overflow = checked]; + v25 = arith.add v23, v156 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v158 = arith.constant 8 : u32; - v31 = arith.mod v29, v158 : u32; + v155 = arith.constant 8 : u32; + v31 = arith.mod v29, v155 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v157 = arith.constant 4 : u32; - v36 = arith.mod v34, v157 : u32; + v154 = arith.constant 4 : u32; + v36 = arith.mod v34, v154 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v156 = arith.constant 16 : i32; - v39 = arith.add v6, v156 : i32 #[overflow = wrapping]; + v153 = arith.constant 16 : i32; + v39 = arith.add v6, v153 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__wasm_call_ctors() - v162 = arith.constant 1 : u8; - v164 = arith.constant 1048600 : i32; - v59 = arith.add v57, v164 : i32 #[overflow = wrapping]; + v159 = arith.constant 1 : u8; + v161 = arith.constant 1048600 : i32; + v59 = arith.add v57, v161 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v162; + hir.store v64, v159; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v168, v169 = arith.split v79 : felt, felt; - v176 = arith.constant 8 : u32; + v165, v166 = arith.split v79 : felt, felt; + v173 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v176 : u32 #[overflow = checked]; - v175 = arith.constant 8 : u32; - v87 = arith.mod v85, v175 : u32; + v85 = arith.add v83, v173 : u32 #[overflow = checked]; + v172 = arith.constant 8 : u32; + v87 = arith.mod v85, v172 : u32; hir.assertz v87 #[code = 250]; - v170 = arith.join v169, v168 : i64; + v167 = arith.join v166, v165 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v170; - v174 = arith.constant 8 : u32; + hir.store v88, v167; + v171 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v174 : u32 #[overflow = checked]; - v173 = arith.constant 8 : u32; - v93 = arith.mod v91, v173 : u32; + v91 = arith.add v89, v171 : u32 #[overflow = checked]; + v170 = arith.constant 8 : u32; + v93 = arith.mod v91, v170 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v165, v166 = arith.split v95 : felt, felt; + v162, v163 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v172 = arith.constant 8 : u32; - v101 = arith.mod v99, v172 : u32; + v169 = arith.constant 8 : u32; + v101 = arith.mod v99, v169 : u32; hir.assertz v101 #[code = 250]; - v167 = arith.join v166, v165 : i64; + v164 = arith.join v163, v162 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v167; - v171 = arith.constant 16 : i32; - v104 = arith.add v72, v171 : i32 #[overflow = wrapping]; + hir.store v102, v164; + v168 = arith.constant 16 : i32; + v104 = arith.add v72, v168 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -184,32 +185,30 @@ builtin.component miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-outpu public builtin.function @binding() -> felt, felt, felt, felt { ^block22: v124 = hir.exec @miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1/rust_sdk_output_note_get_metadata_binding/miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1#binding() : i32 + v177 = arith.constant 0 : i32; v125 = arith.constant 0 : i32; v126 = arith.add v124, v125 : i32 #[overflow = unchecked]; - v180 = arith.constant 0 : i32; - v181 = arith.constant 0 : i32; - v128 = arith.add v126, v181 : i32 #[overflow = unchecked]; - v130 = arith.add v128, v180 : i32 #[overflow = unchecked]; - v131 = hir.int_to_ptr v130 : ptr; - v132 = hir.load v131 : felt; - v179 = arith.constant 0 : i32; - v133 = arith.constant 4 : i32; - v134 = arith.add v126, v133 : i32 #[overflow = unchecked]; - v136 = arith.add v134, v179 : i32 #[overflow = unchecked]; - v137 = hir.int_to_ptr v136 : ptr; - v138 = hir.load v137 : felt; - v178 = arith.constant 0 : i32; - v139 = arith.constant 8 : i32; - v140 = arith.add v126, v139 : i32 #[overflow = unchecked]; - v142 = arith.add v140, v178 : i32 #[overflow = unchecked]; - v143 = hir.int_to_ptr v142 : ptr; - v144 = hir.load v143 : felt; - v177 = arith.constant 0 : i32; - v145 = arith.constant 12 : i32; - v146 = arith.add v126, v145 : i32 #[overflow = unchecked]; - v148 = arith.add v146, v177 : i32 #[overflow = unchecked]; - v149 = hir.int_to_ptr v148 : ptr; - v150 = hir.load v149 : felt; - builtin.ret v132, v138, v144, v150; + v128 = arith.add v126, v177 : i32 #[overflow = unchecked]; + v129 = hir.int_to_ptr v128 : ptr; + v130 = hir.load v129 : felt; + v176 = arith.constant 0 : i32; + v131 = arith.constant 4 : i32; + v132 = arith.add v124, v131 : i32 #[overflow = unchecked]; + v134 = arith.add v132, v176 : i32 #[overflow = unchecked]; + v135 = hir.int_to_ptr v134 : ptr; + v136 = hir.load v135 : felt; + v175 = arith.constant 0 : i32; + v137 = arith.constant 8 : i32; + v138 = arith.add v124, v137 : i32 #[overflow = unchecked]; + v140 = arith.add v138, v175 : i32 #[overflow = unchecked]; + v141 = hir.int_to_ptr v140 : ptr; + v142 = hir.load v141 : felt; + v174 = arith.constant 0 : i32; + v143 = arith.constant 12 : i32; + v144 = arith.add v124, v143 : i32 #[overflow = unchecked]; + v146 = arith.add v144, v174 : i32 #[overflow = unchecked]; + v147 = hir.int_to_ptr v146 : ptr; + v148 = hir.load v147 : felt; + builtin.ret v130, v136, v142, v148; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm index aaa4ddc33..8a51f9e9b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.masm @@ -11,8 +11,6 @@ pub proc binding( trace.252 nop push.0 - u32wrapping_add - push.0 push.0 dup.2 u32wrapping_add @@ -132,6 +130,9 @@ proc miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-me trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat index 3f6f67555..35164c9a1 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_metadata_binding.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -13,7 +12,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -33,8 +32,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::output_note::get_metadata global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -98,7 +97,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::output_note::get_metadata (;6;) (type 4) (param f32 i32) @@ -118,15 +117,14 @@ (component $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (result 5))) - (import "import-func-binding" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (result 7))) - (export (;1;) "binding" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (result 4))) + (import "import-func-binding" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (result 6))) + (export (;1;) "binding" (func 0) (func (type 7))) ) (instance $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-get-metadata-binding/rust-sdk-output-note-get-metadata-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir index 246808ee5..485d56604 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.hir @@ -21,8 +21,9 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp v8 = hir.bitcast v7 : ptr; hir.store v8, v6; hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/wit_bindgen::rt::run_ctors_once() - v157 = arith.constant 0 : felt; - hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden_base_sys::bindings::output_note::get_recipient(v6, v157) + v9 = arith.constant 0 : i64; + v10 = arith.trunc v9 : felt; + hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden_base_sys::bindings::output_note::get_recipient(v6, v10) v11 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/GOT.data.internal.__memory_base : ptr v12 = hir.bitcast v11 : ptr; v13 = hir.load v12 : i32; @@ -31,33 +32,33 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp v17 = arith.constant 8 : u32; v16 = hir.bitcast v6 : u32; v18 = arith.add v16, v17 : u32 #[overflow = checked]; - v162 = arith.constant 8 : u32; - v20 = arith.mod v18, v162 : u32; + v159 = arith.constant 8 : u32; + v20 = arith.mod v18, v159 : u32; hir.assertz v20 #[code = 250]; v21 = hir.int_to_ptr v18 : ptr; v22 = hir.load v21 : i64; - v161 = arith.constant 8 : u32; + v158 = arith.constant 8 : u32; v23 = hir.bitcast v15 : u32; - v25 = arith.add v23, v161 : u32 #[overflow = checked]; + v25 = arith.add v23, v158 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v22; v29 = hir.bitcast v6 : u32; - v160 = arith.constant 8 : u32; - v31 = arith.mod v29, v160 : u32; + v157 = arith.constant 8 : u32; + v31 = arith.mod v29, v157 : u32; hir.assertz v31 #[code = 250]; v32 = hir.int_to_ptr v29 : ptr; v33 = hir.load v32 : i64; v34 = hir.bitcast v15 : u32; - v159 = arith.constant 4 : u32; - v36 = arith.mod v34, v159 : u32; + v156 = arith.constant 4 : u32; + v36 = arith.mod v34, v156 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v33; - v158 = arith.constant 16 : i32; - v39 = arith.add v6, v158 : i32 #[overflow = wrapping]; + v155 = arith.constant 16 : i32; + v39 = arith.add v6, v155 : i32 #[overflow = wrapping]; v40 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr v41 = hir.bitcast v40 : ptr; hir.store v41, v39; @@ -87,12 +88,12 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp v56 = hir.bitcast v55 : ptr; v57 = hir.load v56 : i32; hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__wasm_call_ctors() - v164 = arith.constant 1 : u8; - v166 = arith.constant 1048600 : i32; - v59 = arith.add v57, v166 : i32 #[overflow = wrapping]; + v161 = arith.constant 1 : u8; + v163 = arith.constant 1048600 : i32; + v59 = arith.add v57, v163 : i32 #[overflow = wrapping]; v63 = hir.bitcast v59 : u32; v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v164; + hir.store v64, v161; scf.yield ; }; builtin.ret ; @@ -115,34 +116,34 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp hir.assertz v77 #[code = 250]; v78 = hir.int_to_ptr v75 : ptr; v79 = hir.load v78 : i64; - v170, v171 = arith.split v79 : felt, felt; - v178 = arith.constant 8 : u32; + v167, v168 = arith.split v79 : felt, felt; + v175 = arith.constant 8 : u32; v83 = hir.bitcast v65 : u32; - v85 = arith.add v83, v178 : u32 #[overflow = checked]; - v177 = arith.constant 8 : u32; - v87 = arith.mod v85, v177 : u32; + v85 = arith.add v83, v175 : u32 #[overflow = checked]; + v174 = arith.constant 8 : u32; + v87 = arith.mod v85, v174 : u32; hir.assertz v87 #[code = 250]; - v172 = arith.join v171, v170 : i64; + v169 = arith.join v168, v167 : i64; v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v172; - v176 = arith.constant 8 : u32; + hir.store v88, v169; + v173 = arith.constant 8 : u32; v89 = hir.bitcast v72 : u32; - v91 = arith.add v89, v176 : u32 #[overflow = checked]; - v175 = arith.constant 8 : u32; - v93 = arith.mod v91, v175 : u32; + v91 = arith.add v89, v173 : u32 #[overflow = checked]; + v172 = arith.constant 8 : u32; + v93 = arith.mod v91, v172 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : i64; - v167, v168 = arith.split v95 : felt, felt; + v164, v165 = arith.split v95 : felt, felt; v99 = hir.bitcast v65 : u32; - v174 = arith.constant 8 : u32; - v101 = arith.mod v99, v174 : u32; + v171 = arith.constant 8 : u32; + v101 = arith.mod v99, v171 : u32; hir.assertz v101 #[code = 250]; - v169 = arith.join v168, v167 : i64; + v166 = arith.join v165, v164 : i64; v102 = hir.int_to_ptr v99 : ptr; - hir.store v102, v169; - v173 = arith.constant 16 : i32; - v104 = arith.add v72, v173 : i32 #[overflow = wrapping]; + hir.store v102, v166; + v170 = arith.constant 16 : i32; + v104 = arith.add v72, v170 : i32 #[overflow = wrapping]; v105 = builtin.global_symbol @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; @@ -184,34 +185,32 @@ builtin.component miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-outp public builtin.function @binding() -> felt, felt, felt, felt { ^block22: v124 = hir.exec @miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1/rust_sdk_output_note_get_recipient_binding/miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1#binding() : i32 - v184 = arith.constant 0 : i32; v125 = arith.constant 0 : i32; v126 = arith.add v124, v125 : i32 #[overflow = unchecked]; - v128 = arith.add v126, v184 : i32 #[overflow = unchecked]; - v182 = arith.constant 0 : i32; - v183 = arith.constant 0 : i32; - v130 = arith.add v128, v183 : i32 #[overflow = unchecked]; - v132 = arith.add v130, v182 : i32 #[overflow = unchecked]; - v133 = hir.int_to_ptr v132 : ptr; - v134 = hir.load v133 : felt; - v181 = arith.constant 0 : i32; - v135 = arith.constant 4 : i32; - v136 = arith.add v128, v135 : i32 #[overflow = unchecked]; - v138 = arith.add v136, v181 : i32 #[overflow = unchecked]; - v139 = hir.int_to_ptr v138 : ptr; - v140 = hir.load v139 : felt; - v180 = arith.constant 0 : i32; - v141 = arith.constant 8 : i32; - v142 = arith.add v128, v141 : i32 #[overflow = unchecked]; - v144 = arith.add v142, v180 : i32 #[overflow = unchecked]; - v145 = hir.int_to_ptr v144 : ptr; - v146 = hir.load v145 : felt; v179 = arith.constant 0 : i32; - v147 = arith.constant 12 : i32; - v148 = arith.add v128, v147 : i32 #[overflow = unchecked]; - v150 = arith.add v148, v179 : i32 #[overflow = unchecked]; - v151 = hir.int_to_ptr v150 : ptr; - v152 = hir.load v151 : felt; - builtin.ret v134, v140, v146, v152; + v180 = arith.constant 0 : i32; + v128 = arith.add v126, v180 : i32 #[overflow = unchecked]; + v130 = arith.add v128, v179 : i32 #[overflow = unchecked]; + v131 = hir.int_to_ptr v130 : ptr; + v132 = hir.load v131 : felt; + v178 = arith.constant 0 : i32; + v133 = arith.constant 4 : i32; + v134 = arith.add v126, v133 : i32 #[overflow = unchecked]; + v136 = arith.add v134, v178 : i32 #[overflow = unchecked]; + v137 = hir.int_to_ptr v136 : ptr; + v138 = hir.load v137 : felt; + v177 = arith.constant 0 : i32; + v139 = arith.constant 8 : i32; + v140 = arith.add v126, v139 : i32 #[overflow = unchecked]; + v142 = arith.add v140, v177 : i32 #[overflow = unchecked]; + v143 = hir.int_to_ptr v142 : ptr; + v144 = hir.load v143 : felt; + v176 = arith.constant 0 : i32; + v145 = arith.constant 12 : i32; + v146 = arith.add v126, v145 : i32 #[overflow = unchecked]; + v148 = arith.add v146, v176 : i32 #[overflow = unchecked]; + v149 = hir.int_to_ptr v148 : ptr; + v150 = hir.load v149 : felt; + builtin.ret v132, v138, v144, v150; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm index 6fea661cc..64e4ada97 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.masm @@ -11,9 +11,6 @@ pub proc binding( trace.252 nop push.0 - push.0 - movup.2 - u32wrapping_add u32wrapping_add push.0 push.0 @@ -135,6 +132,9 @@ proc miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-r trace.252 nop push.0 + push.0 + mul.4294967296 + add dup.1 trace.240 nop diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat index 726a029a6..e6ca51077 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_get_recipient_binding.wat @@ -3,11 +3,10 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) - (type (;5;) (record (field "inner" 4))) - (export (;6;) "recipient" (type (eq 5))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) + (type (;4;) (record (field "inner" 3))) + (export (;5;) "recipient" (type (eq 4))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -15,7 +14,7 @@ (type (;0;) (func)) (type (;1;) (func (result i32))) (type (;2;) (func (param i32 f32))) - (type (;3;) (func (param i32) (result f32))) + (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 i32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -35,8 +34,8 @@ global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once local.get 0 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked call $miden_base_sys::bindings::output_note::get_recipient global.get $GOT.data.internal.__memory_base i32.const 1048584 @@ -100,7 +99,7 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) (func $miden::protocol::output_note::get_recipient (;6;) (type 4) (param f32 i32) @@ -121,17 +120,16 @@ (component $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (type (;5;) (record (field "inner" 4))) - (import "import-type-recipient" (type (;6;) (eq 5))) - (import "import-type-recipient0" (type (;7;) (eq 6))) - (type (;8;) (func (result 7))) - (import "import-func-binding" (func (;0;) (type 8))) - (export (;9;) "recipient" (type 6)) - (type (;10;) (func (result 9))) - (export (;1;) "binding" (func 0) (func (type 10))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (type (;4;) (record (field "inner" 3))) + (import "import-type-recipient" (type (;5;) (eq 4))) + (import "import-type-recipient0" (type (;6;) (eq 5))) + (type (;7;) (func (result 6))) + (import "import-func-binding" (func (;0;) (type 7))) + (export (;8;) "recipient" (type 5)) + (type (;9;) (func (result 8))) + (export (;1;) "binding" (func 0) (func (type 9))) ) (instance $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1-shim-instance (;1;) (instantiate $miden:rust-sdk-output-note-get-recipient-binding/rust-sdk-output-note-get-recipient-binding@0.0.1-shim-component (with "import-func-binding" (func $binding)) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir index 6141b2369..2ab577e5f 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.hir @@ -12,174 +12,212 @@ builtin.component miden:rust-sdk-output-note-set-array-attachment-binding/rust-s private builtin.function @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v5 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 32 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/wit_bindgen::rt::run_ctors_once() - v129 = arith.constant 0 : felt; + v253 = arith.constant 0 : i64; + v15 = arith.trunc v253 : felt; + v254 = arith.constant 0 : i64; + v13 = arith.trunc v254 : felt; + v12 = arith.constant 0 : i64; + v18 = arith.trunc v12 : felt; v1 = arith.constant 0 : i32; - v200, v201, v202, v203, v204, v205, v206, v207 = scf.while v1, v7, v129, v129, v129 : i32, i32, felt, felt, felt, i32, felt, felt { - ^block35(v208: i32, v209: i32, v210: felt, v211: felt, v212: felt): - v231 = arith.constant 0 : i32; - v18 = arith.constant 16 : i32; - v19 = arith.eq v208, v18 : i1; - v20 = arith.zext v19 : u32; - v21 = hir.bitcast v20 : i32; - v23 = arith.neq v21, v231 : i1; - v193 = scf.if v23 : i32 { - ^block34: - v140 = ub.poison i32 : i32; - scf.yield v140; + v224, v225, v226, v227, v228, v229, v230, v231 = scf.while v1, v9, v18, v13, v15 : i32, i32, felt, felt, felt, i32, felt, felt { + ^block41(v232: i32, v233: i32, v234: felt, v235: felt, v236: felt): + v252 = arith.constant 0 : i32; + v37 = arith.constant 16 : i32; + v21 = arith.eq v232, v37 : i1; + v22 = arith.zext v21 : u32; + v23 = hir.bitcast v22 : i32; + v25 = arith.neq v23, v252 : i1; + v217 = scf.if v25 : i32 { + ^block40: + v164 = ub.poison i32 : i32; + scf.yield v164; } else { ^block14: - v230 = arith.constant 16 : i32; - v26 = arith.add v209, v230 : i32 #[overflow = wrapping]; - v27 = arith.add v26, v208 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v27 : u32; - v38 = arith.constant 4 : u32; - v31 = arith.mod v29, v38 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v210; - v33 = arith.constant 4 : i32; - v34 = arith.add v208, v33 : i32 #[overflow = wrapping]; - scf.yield v34; + v251 = arith.constant 16 : i32; + v28 = arith.add v233, v251 : i32 #[overflow = wrapping]; + v29 = arith.add v28, v232 : i32 #[overflow = wrapping]; + v31 = hir.bitcast v29 : u32; + v32 = arith.constant 4 : u32; + v33 = arith.mod v31, v32 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + hir.store v34, v234; + v35 = arith.constant 4 : i32; + v36 = arith.add v232, v35 : i32 #[overflow = wrapping]; + scf.yield v36; }; - v227 = ub.poison felt : felt; - v197 = cf.select v23, v227, v212 : felt; - v228 = ub.poison felt : felt; - v196 = cf.select v23, v228, v211 : felt; - v141 = ub.poison felt : felt; - v195 = cf.select v23, v141, v210 : felt; - v229 = ub.poison i32 : i32; - v194 = cf.select v23, v229, v209 : i32; - v139 = arith.constant 1 : u32; - v131 = arith.constant 0 : u32; - v199 = cf.select v23, v131, v139 : u32; - v185 = arith.trunc v199 : i1; - scf.condition v185, v193, v194, v195, v196, v197, v209, v211, v212; + v248 = ub.poison felt : felt; + v221 = cf.select v25, v248, v236 : felt; + v249 = ub.poison felt : felt; + v220 = cf.select v25, v249, v235 : felt; + v165 = ub.poison felt : felt; + v219 = cf.select v25, v165, v234 : felt; + v250 = ub.poison i32 : i32; + v218 = cf.select v25, v250, v233 : i32; + v163 = arith.constant 1 : u32; + v155 = arith.constant 0 : u32; + v223 = cf.select v25, v155, v163 : u32; + v209 = arith.trunc v223 : i1; + scf.condition v209, v217, v218, v219, v220, v221, v233, v235, v236; } do { - ^block36(v213: i32, v214: i32, v215: felt, v216: felt, v217: felt, v218: i32, v219: felt, v220: felt): - scf.yield v213, v214, v215, v216, v217; + ^block42(v237: i32, v238: i32, v239: felt, v240: felt, v241: felt, v242: i32, v243: felt, v244: felt): + scf.yield v237, v238, v239, v240, v241; }; - v36 = arith.constant 24 : u32; - v35 = hir.bitcast v205 : u32; - v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v226 = arith.constant 4 : u32; - v39 = arith.mod v37, v226 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - v41 = hir.load v40 : i64; - v43 = arith.constant 8 : u32; - v42 = hir.bitcast v205 : u32; - v44 = arith.add v42, v43 : u32 #[overflow = checked]; - v225 = arith.constant 8 : u32; - v46 = arith.mod v44, v225 : u32; - hir.assertz v46 #[code = 250]; - v47 = hir.int_to_ptr v44 : ptr; - hir.store v47, v41; - v49 = arith.constant 16 : u32; - v48 = hir.bitcast v205 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v224 = arith.constant 4 : u32; - v52 = arith.mod v50, v224 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i64; - v55 = hir.bitcast v205 : u32; - v223 = arith.constant 8 : u32; - v57 = arith.mod v55, v223 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v54; - hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden_base_sys::bindings::output_note::set_array_attachment(v206, v207, v205) - v222 = arith.constant 32 : i32; - v64 = arith.add v205, v222 : i32 #[overflow = wrapping]; - v65 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr - v66 = hir.bitcast v65 : ptr; - hir.store v66, v64; - v221 = arith.constant 0 : felt; - builtin.ret v221; + v247 = arith.constant 16 : i32; + v38 = arith.add v229, v247 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/>::from(v229, v38) + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden_base_sys::bindings::output_note::set_array_attachment(v230, v231, v229) + v246 = arith.constant 32 : i32; + v44 = arith.add v229, v246 : i32 #[overflow = wrapping]; + v45 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__stack_pointer : ptr + v46 = hir.bitcast v45 : ptr; + hir.store v46, v44; + v245 = arith.constant 0 : i64; + v42 = arith.trunc v245 : felt; + builtin.ret v42; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v68 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 1048584 : i32; - v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; - v73 = hir.bitcast v72 : u32; - v74 = hir.int_to_ptr v73 : ptr; - v75 = hir.load v74 : u8; - v67 = arith.constant 0 : i32; - v76 = arith.zext v75 : u32; - v77 = hir.bitcast v76 : i32; - v79 = arith.neq v77, v67 : i1; - scf.if v79{ + v48 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 1048612 : i32; + v52 = arith.add v50, v51 : i32 #[overflow = wrapping]; + v53 = hir.bitcast v52 : u32; + v54 = hir.int_to_ptr v53 : ptr; + v55 = hir.load v54 : u8; + v47 = arith.constant 0 : i32; + v56 = arith.zext v55 : u32; + v57 = hir.bitcast v56 : i32; + v59 = arith.neq v57, v47 : i1; + scf.if v59{ ^block17: scf.yield ; } else { ^block18: - v80 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr - v81 = hir.bitcast v80 : ptr; - v82 = hir.load v81 : i32; + v60 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr + v61 = hir.bitcast v60 : ptr; + v62 = hir.load v61 : i32; hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/__wasm_call_ctors() - v233 = arith.constant 1 : u8; - v235 = arith.constant 1048584 : i32; - v84 = arith.add v82, v235 : i32 #[overflow = wrapping]; - v88 = hir.bitcast v84 : u32; - v89 = hir.int_to_ptr v88 : ptr; - hir.store v89, v233; + v256 = arith.constant 1 : u8; + v258 = arith.constant 1048612 : i32; + v64 = arith.add v62, v258 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v256; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::set_array_attachment(v90: felt, v91: felt, v92: i32) { - ^block19(v90: felt, v91: felt, v92: i32): - v94 = arith.constant 12 : u32; - v93 = hir.bitcast v92 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v96 = arith.constant 4 : u32; - v97 = arith.mod v95, v96 : u32; + private builtin.function @miden_base_sys::bindings::output_note::set_array_attachment(v70: felt, v71: felt, v72: i32) { + ^block19(v70: felt, v71: felt, v72: i32): + v75 = builtin.global_symbol @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/GOT.data.internal.__memory_base : ptr + v76 = hir.bitcast v75 : ptr; + v77 = hir.load v76 : i32; + v78 = arith.constant 1048596 : i32; + v79 = arith.add v77, v78 : i32 #[overflow = wrapping]; + v74 = arith.constant 3 : i32; + v80 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/>::index(v72, v74, v79) : i32 + v81 = hir.bitcast v80 : u32; + v82 = arith.constant 4 : u32; + v83 = arith.mod v81, v82 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + v85 = hir.load v84 : felt; + v86 = arith.constant 2 : i32; + v87 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/>::index(v72, v86, v79) : i32 + v88 = hir.bitcast v87 : u32; + v261 = arith.constant 4 : u32; + v90 = arith.mod v88, v261 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : felt; + v93 = arith.constant 1 : i32; + v94 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/>::index(v72, v93, v79) : i32 + v95 = hir.bitcast v94 : u32; + v260 = arith.constant 4 : u32; + v97 = arith.mod v95, v260 : u32; hir.assertz v97 #[code = 250]; v98 = hir.int_to_ptr v95 : ptr; v99 = hir.load v98 : felt; - v101 = arith.constant 8 : u32; - v100 = hir.bitcast v92 : u32; - v102 = arith.add v100, v101 : u32 #[overflow = checked]; - v239 = arith.constant 4 : u32; - v104 = arith.mod v102, v239 : u32; + v73 = arith.constant 0 : i32; + v101 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/>::index(v72, v73, v79) : i32 + v102 = hir.bitcast v101 : u32; + v259 = arith.constant 4 : u32; + v104 = arith.mod v102, v259 : u32; hir.assertz v104 #[code = 250]; v105 = hir.int_to_ptr v102 : ptr; v106 = hir.load v105 : felt; - v238 = arith.constant 4 : u32; - v107 = hir.bitcast v92 : u32; - v109 = arith.add v107, v238 : u32 #[overflow = checked]; - v237 = arith.constant 4 : u32; - v111 = arith.mod v109, v237 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - v113 = hir.load v112 : felt; - v114 = hir.bitcast v92 : u32; - v236 = arith.constant 4 : u32; - v116 = arith.mod v114, v236 : u32; - hir.assertz v116 #[code = 250]; - v117 = hir.int_to_ptr v114 : ptr; - v118 = hir.load v117 : felt; - hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden::protocol::output_note::set_array_attachment(v90, v91, v99, v106, v113, v118) + hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden::protocol::output_note::set_array_attachment(v70, v71, v85, v92, v99, v106) builtin.ret ; }; - private builtin.function @miden::protocol::output_note::set_array_attachment(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt) { - ^block21(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt): - hir.exec @miden/protocol/output_note/set_array_attachment(v119, v120, v121, v122, v123, v124) + private builtin.function @>::index(v107: i32, v108: i32, v109: i32) -> i32 { + ^block21(v107: i32, v108: i32, v109: i32): + v117 = arith.constant 0 : i32; + v263 = arith.constant 3 : u32; + v112 = hir.bitcast v108 : u32; + v114 = arith.gt v112, v263 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v117 : i1; + cf.cond_br v118 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v262 = arith.constant 2 : u32; + v121 = arith.shl v108, v262 : i32; + v122 = arith.add v107, v121 : i32 #[overflow = wrapping]; + builtin.ret v122; + }; + + private builtin.function @>::from(v123: i32, v124: i32) { + ^block25(v123: i32, v124: i32): + v126 = arith.constant 8 : u32; + v125 = hir.bitcast v124 : u32; + v127 = arith.add v125, v126 : u32 #[overflow = checked]; + v128 = arith.constant 4 : u32; + v129 = arith.mod v127, v128 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v269 = arith.constant 8 : u32; + v132 = hir.bitcast v123 : u32; + v134 = arith.add v132, v269 : u32 #[overflow = checked]; + v268 = arith.constant 8 : u32; + v136 = arith.mod v134, v268 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + hir.store v137, v131; + v138 = hir.bitcast v124 : u32; + v267 = arith.constant 4 : u32; + v140 = arith.mod v138, v267 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + v142 = hir.load v141 : i64; + v143 = hir.bitcast v123 : u32; + v266 = arith.constant 8 : u32; + v145 = arith.mod v143, v266 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v142; + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::set_array_attachment(v147: felt, v148: felt, v149: felt, v150: felt, v151: felt, v152: felt) { + ^block27(v147: felt, v148: felt, v149: felt, v150: felt, v151: felt, v152: felt): + hir.exec @miden/protocol/output_note/set_array_attachment(v147, v148, v149, v150, v151, v152) builtin.ret ; }; @@ -191,12 +229,14 @@ builtin.component miden:rust-sdk-output-note-set-array-attachment-binding/rust-s builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block26: - v125 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding() : felt - builtin.ret v125; + ^block32: + v153 = hir.exec @miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1/rust_sdk_output_note_set_array_attachment_binding/miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding() : felt + builtin.ret v153; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm index 8d1c2c14c..f2934379b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-not nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,12 +81,19 @@ proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-not nop push.0 push.0 - dup.1 - dup.2 - swap.4 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + movup.4 swap.1 - swap.3 - swap.2 push.1 while.true push.0 @@ -178,75 +185,13 @@ proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-not drop drop drop - push.24 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop push.16 dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.8 + u32wrapping_add dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::>::from trace.252 nop dup.0 @@ -261,7 +206,7 @@ proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-not nop push.32 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -270,13 +215,16 @@ proc miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-not trace.252 nop push.0 + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -284,7 +232,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -305,7 +253,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -319,7 +267,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -352,10 +300,49 @@ proc miden_base_sys::bindings::output_note::set_array_attachment( felt, i32 ) - push.12 - dup.3 - add + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -369,10 +356,16 @@ proc miden_base_sys::bindings::output_note::set_array_attachment( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.1 + dup.6 dup.4 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -386,8 +379,77 @@ proc miden_base_sys::bindings::output_note::set_array_attachment( exec.::intrinsics::mem::load_felt trace.252 nop + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::>::index + trace.252 + nop push.4 - dup.5 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.5 + swap.4 + swap.1 + swap.2 + swap.3 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::"miden::protocol::output_note::set_array_attachment" + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 add u32assert push.4 @@ -400,10 +462,30 @@ proc miden_base_sys::bindings::output_note::set_array_attachment( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw trace.252 nop - movup.5 + swap.1 push.4 dup.1 swap.1 @@ -414,18 +496,24 @@ proc miden_base_sys::bindings::output_note::set_array_attachment( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 - swap.3 - movdn.2 - swap.5 + push.8 + dup.1 swap.1 - swap.4 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::"miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1"::rust_sdk_output_note_set_array_attachment_binding::"miden::protocol::output_note::set_array_attachment" + exec.::intrinsics::mem::store_dw trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat index 616067e98..cad5790ed 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_array_attachment_binding.wat @@ -10,8 +10,10 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param f32 f32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 f32 f32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -22,58 +24,55 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_output_note_set_array_attachment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-output-note-set-array-attachment-binding/rust-sdk-output-note-set-array-attachment-binding@0.0.1#binding (;2;) (type 1) (result f32) - (local i32 i32 f32 f32 f32) + (local i32 f32 f32 i32 f32) global.get $__stack_pointer i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 i32.const 0 - call $intrinsics::felt::from_u32 local.set 3 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 4 block ;; label = @1 loop ;; label = @2 - local.get 1 + local.get 3 i32.const 16 i32.eq br_if 1 (;@1;) local.get 0 i32.const 16 i32.add - local.get 1 + local.get 3 i32.add local.get 4 f32.store - local.get 1 + local.get 3 i32.const 4 i32.add - local.set 1 + local.set 3 br 0 (;@2;) end end local.get 0 local.get 0 - i64.load offset=24 align=4 - i64.store offset=8 - local.get 0 - local.get 0 - i64.load offset=16 align=4 - i64.store + i32.const 16 + i32.add + call $>::from + local.get 1 local.get 2 - local.get 3 local.get 0 call $miden_base_sys::bindings::output_note::set_array_attachment - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 4 local.get 0 i32.const 32 @@ -85,7 +84,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -93,32 +92,74 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::output_note::set_array_attachment (;4;) (type 2) (param f32 f32 i32) + (local i32) local.get 0 local.get 1 local.get 2 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 2 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 2 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 2 + i32.const 0 + local.get 3 + call $>::index f32.load call $miden::protocol::output_note::set_array_attachment ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) - (func $miden::protocol::output_note::set_array_attachment (;6;) (type 4) (param f32 f32 f32 f32 f32 f32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::output_note::set_array_attachment (;8;) (type 6) (param f32 f32 f32 f32 f32 f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "crust_sdk_output_note_set_array_attachment_binding\01\0b0.0.1\03\01\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir index e978cda99..a4ce0cad2 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.hir @@ -12,176 +12,216 @@ builtin.component miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-out private builtin.function @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v5 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 32 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/wit_bindgen::rt::run_ctors_once() - v135 = arith.constant 0 : felt; + v278 = arith.constant 0 : i64; + v17 = arith.trunc v278 : felt; + v279 = arith.constant 0 : i64; + v15 = arith.trunc v279 : felt; + v280 = arith.constant 0 : i64; + v13 = arith.trunc v280 : felt; + v12 = arith.constant 0 : i64; + v20 = arith.trunc v12 : felt; v1 = arith.constant 0 : i32; - v220, v221, v222, v223, v224, v225, v226, v227, v228, v229 = scf.while v1, v7, v135, v135, v135, v135 : i32, i32, felt, felt, felt, felt, i32, felt, felt, felt { - ^block35(v230: i32, v231: i32, v232: felt, v233: felt, v234: felt, v235: felt): - v257 = arith.constant 0 : i32; - v20 = arith.constant 16 : i32; - v21 = arith.eq v230, v20 : i1; - v22 = arith.zext v21 : u32; - v23 = hir.bitcast v22 : i32; - v25 = arith.neq v23, v257 : i1; - v212 = scf.if v25 : i32 { - ^block34: - v147 = ub.poison i32 : i32; - scf.yield v147; + v243, v244, v245, v246, v247, v248, v249, v250, v251, v252 = scf.while v1, v9, v20, v13, v15, v17 : i32, i32, felt, felt, felt, felt, i32, felt, felt, felt { + ^block41(v253: i32, v254: i32, v255: felt, v256: felt, v257: felt, v258: felt): + v277 = arith.constant 0 : i32; + v39 = arith.constant 16 : i32; + v23 = arith.eq v253, v39 : i1; + v24 = arith.zext v23 : u32; + v25 = hir.bitcast v24 : i32; + v27 = arith.neq v25, v277 : i1; + v235 = scf.if v27 : i32 { + ^block40: + v170 = ub.poison i32 : i32; + scf.yield v170; } else { ^block14: - v256 = arith.constant 16 : i32; - v28 = arith.add v231, v256 : i32 #[overflow = wrapping]; - v29 = arith.add v28, v230 : i32 #[overflow = wrapping]; - v31 = hir.bitcast v29 : u32; - v40 = arith.constant 4 : u32; - v33 = arith.mod v31, v40 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - hir.store v34, v232; - v35 = arith.constant 4 : i32; - v36 = arith.add v230, v35 : i32 #[overflow = wrapping]; - scf.yield v36; + v276 = arith.constant 16 : i32; + v30 = arith.add v254, v276 : i32 #[overflow = wrapping]; + v31 = arith.add v30, v253 : i32 #[overflow = wrapping]; + v33 = hir.bitcast v31 : u32; + v34 = arith.constant 4 : u32; + v35 = arith.mod v33, v34 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + hir.store v36, v255; + v37 = arith.constant 4 : i32; + v38 = arith.add v253, v37 : i32 #[overflow = wrapping]; + scf.yield v38; }; - v252 = ub.poison felt : felt; - v217 = cf.select v25, v252, v235 : felt; - v253 = ub.poison felt : felt; - v216 = cf.select v25, v253, v234 : felt; - v254 = ub.poison felt : felt; - v215 = cf.select v25, v254, v233 : felt; - v148 = ub.poison felt : felt; - v214 = cf.select v25, v148, v232 : felt; - v255 = ub.poison i32 : i32; - v213 = cf.select v25, v255, v231 : i32; - v146 = arith.constant 1 : u32; - v137 = arith.constant 0 : u32; - v219 = cf.select v25, v137, v146 : u32; - v203 = arith.trunc v219 : i1; - scf.condition v203, v212, v213, v214, v215, v216, v217, v231, v233, v234, v235; + v272 = ub.poison felt : felt; + v240 = cf.select v27, v272, v258 : felt; + v273 = ub.poison felt : felt; + v239 = cf.select v27, v273, v257 : felt; + v274 = ub.poison felt : felt; + v238 = cf.select v27, v274, v256 : felt; + v171 = ub.poison felt : felt; + v237 = cf.select v27, v171, v255 : felt; + v275 = ub.poison i32 : i32; + v236 = cf.select v27, v275, v254 : i32; + v169 = arith.constant 1 : u32; + v160 = arith.constant 0 : u32; + v242 = cf.select v27, v160, v169 : u32; + v226 = arith.trunc v242 : i1; + scf.condition v226, v235, v236, v237, v238, v239, v240, v254, v256, v257, v258; } do { - ^block36(v236: i32, v237: i32, v238: felt, v239: felt, v240: felt, v241: felt, v242: i32, v243: felt, v244: felt, v245: felt): - scf.yield v236, v237, v238, v239, v240, v241; + ^block42(v259: i32, v260: i32, v261: felt, v262: felt, v263: felt, v264: felt, v265: i32, v266: felt, v267: felt, v268: felt): + scf.yield v259, v260, v261, v262, v263, v264; }; - v38 = arith.constant 24 : u32; - v37 = hir.bitcast v226 : u32; - v39 = arith.add v37, v38 : u32 #[overflow = checked]; - v251 = arith.constant 4 : u32; - v41 = arith.mod v39, v251 : u32; - hir.assertz v41 #[code = 250]; - v42 = hir.int_to_ptr v39 : ptr; - v43 = hir.load v42 : i64; - v45 = arith.constant 8 : u32; - v44 = hir.bitcast v226 : u32; - v46 = arith.add v44, v45 : u32 #[overflow = checked]; - v250 = arith.constant 8 : u32; - v48 = arith.mod v46, v250 : u32; - hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - hir.store v49, v43; - v51 = arith.constant 16 : u32; - v50 = hir.bitcast v226 : u32; - v52 = arith.add v50, v51 : u32 #[overflow = checked]; - v249 = arith.constant 4 : u32; - v54 = arith.mod v52, v249 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - v56 = hir.load v55 : i64; - v57 = hir.bitcast v226 : u32; - v248 = arith.constant 8 : u32; - v59 = arith.mod v57, v248 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - hir.store v60, v56; - hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden_base_sys::bindings::output_note::set_attachment(v227, v228, v229, v226) - v247 = arith.constant 32 : i32; - v67 = arith.add v226, v247 : i32 #[overflow = wrapping]; - v68 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr - v69 = hir.bitcast v68 : ptr; - hir.store v69, v67; - v246 = arith.constant 0 : felt; - builtin.ret v246; + v271 = arith.constant 16 : i32; + v40 = arith.add v249, v271 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/>::from(v249, v40) + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden_base_sys::bindings::output_note::set_attachment(v250, v251, v252, v249) + v270 = arith.constant 32 : i32; + v47 = arith.add v249, v270 : i32 #[overflow = wrapping]; + v48 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + hir.store v49, v47; + v269 = arith.constant 0 : i64; + v45 = arith.trunc v269 : felt; + builtin.ret v45; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v71 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr - v72 = hir.bitcast v71 : ptr; - v73 = hir.load v72 : i32; - v74 = arith.constant 1048584 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.bitcast v75 : u32; - v77 = hir.int_to_ptr v76 : ptr; - v78 = hir.load v77 : u8; - v70 = arith.constant 0 : i32; - v79 = arith.zext v78 : u32; - v80 = hir.bitcast v79 : i32; - v82 = arith.neq v80, v70 : i1; - scf.if v82{ + v51 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr + v52 = hir.bitcast v51 : ptr; + v53 = hir.load v52 : i32; + v54 = arith.constant 1048612 : i32; + v55 = arith.add v53, v54 : i32 #[overflow = wrapping]; + v56 = hir.bitcast v55 : u32; + v57 = hir.int_to_ptr v56 : ptr; + v58 = hir.load v57 : u8; + v50 = arith.constant 0 : i32; + v59 = arith.zext v58 : u32; + v60 = hir.bitcast v59 : i32; + v62 = arith.neq v60, v50 : i1; + scf.if v62{ ^block17: scf.yield ; } else { ^block18: - v83 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; + v63 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr + v64 = hir.bitcast v63 : ptr; + v65 = hir.load v64 : i32; hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/__wasm_call_ctors() - v259 = arith.constant 1 : u8; - v261 = arith.constant 1048584 : i32; - v87 = arith.add v85, v261 : i32 #[overflow = wrapping]; - v91 = hir.bitcast v87 : u32; - v92 = hir.int_to_ptr v91 : ptr; - hir.store v92, v259; + v282 = arith.constant 1 : u8; + v284 = arith.constant 1048612 : i32; + v67 = arith.add v65, v284 : i32 #[overflow = wrapping]; + v71 = hir.bitcast v67 : u32; + v72 = hir.int_to_ptr v71 : ptr; + hir.store v72, v282; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::set_attachment(v93: felt, v94: felt, v95: felt, v96: i32) { - ^block19(v93: felt, v94: felt, v95: felt, v96: i32): - v98 = arith.constant 12 : u32; - v97 = hir.bitcast v96 : u32; - v99 = arith.add v97, v98 : u32 #[overflow = checked]; - v100 = arith.constant 4 : u32; - v101 = arith.mod v99, v100 : u32; + private builtin.function @miden_base_sys::bindings::output_note::set_attachment(v73: felt, v74: felt, v75: felt, v76: i32) { + ^block19(v73: felt, v74: felt, v75: felt, v76: i32): + v79 = builtin.global_symbol @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/GOT.data.internal.__memory_base : ptr + v80 = hir.bitcast v79 : ptr; + v81 = hir.load v80 : i32; + v82 = arith.constant 1048596 : i32; + v83 = arith.add v81, v82 : i32 #[overflow = wrapping]; + v78 = arith.constant 3 : i32; + v84 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/>::index(v76, v78, v83) : i32 + v85 = hir.bitcast v84 : u32; + v86 = arith.constant 4 : u32; + v87 = arith.mod v85, v86 : u32; + hir.assertz v87 #[code = 250]; + v88 = hir.int_to_ptr v85 : ptr; + v89 = hir.load v88 : felt; + v90 = arith.constant 2 : i32; + v91 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/>::index(v76, v90, v83) : i32 + v92 = hir.bitcast v91 : u32; + v287 = arith.constant 4 : u32; + v94 = arith.mod v92, v287 : u32; + hir.assertz v94 #[code = 250]; + v95 = hir.int_to_ptr v92 : ptr; + v96 = hir.load v95 : felt; + v97 = arith.constant 1 : i32; + v98 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/>::index(v76, v97, v83) : i32 + v99 = hir.bitcast v98 : u32; + v286 = arith.constant 4 : u32; + v101 = arith.mod v99, v286 : u32; hir.assertz v101 #[code = 250]; v102 = hir.int_to_ptr v99 : ptr; v103 = hir.load v102 : felt; - v105 = arith.constant 8 : u32; - v104 = hir.bitcast v96 : u32; - v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v265 = arith.constant 4 : u32; - v108 = arith.mod v106, v265 : u32; + v77 = arith.constant 0 : i32; + v105 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/>::index(v76, v77, v83) : i32 + v106 = hir.bitcast v105 : u32; + v285 = arith.constant 4 : u32; + v108 = arith.mod v106, v285 : u32; hir.assertz v108 #[code = 250]; v109 = hir.int_to_ptr v106 : ptr; v110 = hir.load v109 : felt; - v264 = arith.constant 4 : u32; - v111 = hir.bitcast v96 : u32; - v113 = arith.add v111, v264 : u32 #[overflow = checked]; - v263 = arith.constant 4 : u32; - v115 = arith.mod v113, v263 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - v117 = hir.load v116 : felt; - v118 = hir.bitcast v96 : u32; - v262 = arith.constant 4 : u32; - v120 = arith.mod v118, v262 : u32; - hir.assertz v120 #[code = 250]; - v121 = hir.int_to_ptr v118 : ptr; - v122 = hir.load v121 : felt; - hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden::protocol::output_note::set_attachment(v93, v94, v95, v103, v110, v117, v122) + hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden::protocol::output_note::set_attachment(v73, v74, v75, v89, v96, v103, v110) builtin.ret ; }; - private builtin.function @miden::protocol::output_note::set_attachment(v123: felt, v124: felt, v125: felt, v126: felt, v127: felt, v128: felt, v129: felt) { - ^block21(v123: felt, v124: felt, v125: felt, v126: felt, v127: felt, v128: felt, v129: felt): - hir.exec @miden/protocol/output_note/set_attachment(v123, v124, v125, v126, v127, v128, v129) + private builtin.function @>::index(v111: i32, v112: i32, v113: i32) -> i32 { + ^block21(v111: i32, v112: i32, v113: i32): + v121 = arith.constant 0 : i32; + v289 = arith.constant 3 : u32; + v116 = hir.bitcast v112 : u32; + v118 = arith.gt v116, v289 : i1; + v119 = arith.zext v118 : u32; + v120 = hir.bitcast v119 : i32; + v122 = arith.neq v120, v121 : i1; + cf.cond_br v122 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v288 = arith.constant 2 : u32; + v125 = arith.shl v112, v288 : i32; + v126 = arith.add v111, v125 : i32 #[overflow = wrapping]; + builtin.ret v126; + }; + + private builtin.function @>::from(v127: i32, v128: i32) { + ^block25(v127: i32, v128: i32): + v130 = arith.constant 8 : u32; + v129 = hir.bitcast v128 : u32; + v131 = arith.add v129, v130 : u32 #[overflow = checked]; + v132 = arith.constant 4 : u32; + v133 = arith.mod v131, v132 : u32; + hir.assertz v133 #[code = 250]; + v134 = hir.int_to_ptr v131 : ptr; + v135 = hir.load v134 : i64; + v295 = arith.constant 8 : u32; + v136 = hir.bitcast v127 : u32; + v138 = arith.add v136, v295 : u32 #[overflow = checked]; + v294 = arith.constant 8 : u32; + v140 = arith.mod v138, v294 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + hir.store v141, v135; + v142 = hir.bitcast v128 : u32; + v293 = arith.constant 4 : u32; + v144 = arith.mod v142, v293 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i64; + v147 = hir.bitcast v127 : u32; + v292 = arith.constant 8 : u32; + v149 = arith.mod v147, v292 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v146; + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::set_attachment(v151: felt, v152: felt, v153: felt, v154: felt, v155: felt, v156: felt, v157: felt) { + ^block27(v151: felt, v152: felt, v153: felt, v154: felt, v155: felt, v156: felt, v157: felt): + hir.exec @miden/protocol/output_note/set_attachment(v151, v152, v153, v154, v155, v156, v157) builtin.ret ; }; @@ -193,12 +233,14 @@ builtin.component miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-out builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block26: - v130 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding() : felt - builtin.ret v130; + ^block32: + v158 = hir.exec @miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1/rust_sdk_output_note_set_attachment_binding/miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding() : felt + builtin.ret v158; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm index f2a2af8d3..d1bc2cd4a 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set- nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,14 +81,23 @@ proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set- nop push.0 push.0 - dup.1 - dup.2 - dup.3 - swap.5 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + movup.5 swap.1 - swap.4 - swap.2 - swap.3 push.1 while.true push.0 @@ -191,75 +200,13 @@ proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set- drop drop drop - push.24 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop push.16 dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.8 + u32wrapping_add dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::>::from trace.252 nop dup.0 @@ -274,7 +221,7 @@ proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set- nop push.32 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -283,13 +230,16 @@ proc miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set- trace.252 nop push.0 + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -297,7 +247,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -318,7 +268,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -332,7 +282,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -366,10 +316,96 @@ proc miden_base_sys::bindings::output_note::set_attachment( felt, i32 ) - push.12 + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.5 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + dup.6 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1 + dup.7 dup.4 - add + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.8 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -383,8 +419,54 @@ proc miden_base_sys::bindings::output_note::set_attachment( exec.::intrinsics::mem::load_felt trace.252 nop + swap.6 + swap.5 + swap.2 + swap.4 + swap.1 + swap.3 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::"miden::protocol::output_note::set_attachment" + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) push.8 - dup.5 + dup.2 add u32assert push.4 @@ -397,14 +479,15 @@ proc miden_base_sys::bindings::output_note::set_attachment( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop - push.4 - dup.6 + swap.1 + push.8 + dup.3 add u32assert - push.4 + push.8 dup.1 swap.1 u32mod @@ -412,12 +495,14 @@ proc miden_base_sys::bindings::output_note::set_attachment( assertz u32divmod.4 swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::store_dw trace.252 nop - movup.6 + swap.1 push.4 dup.1 swap.1 @@ -428,18 +513,24 @@ proc miden_base_sys::bindings::output_note::set_attachment( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop swap.1 - swap.5 + movup.2 + push.8 + dup.1 swap.1 - swap.6 - swap.2 - swap.4 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::"miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1"::rust_sdk_output_note_set_attachment_binding::"miden::protocol::output_note::set_attachment" + exec.::intrinsics::mem::store_dw trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat index edac2a1e7..4a2432c7c 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_attachment_binding.wat @@ -10,8 +10,10 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param f32 f32 f32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 f32 f32 f32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 f32 f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -22,62 +24,59 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_output_note_set_attachment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-output-note-set-attachment-binding/rust-sdk-output-note-set-attachment-binding@0.0.1#binding (;2;) (type 1) (result f32) - (local i32 i32 f32 f32 f32 f32) + (local i32 f32 f32 f32 i32 f32) global.get $__stack_pointer i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 3 i32.const 0 - call $intrinsics::felt::from_u32 local.set 4 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 5 block ;; label = @1 loop ;; label = @2 - local.get 1 + local.get 4 i32.const 16 i32.eq br_if 1 (;@1;) local.get 0 i32.const 16 i32.add - local.get 1 + local.get 4 i32.add local.get 5 f32.store - local.get 1 + local.get 4 i32.const 4 i32.add - local.set 1 + local.set 4 br 0 (;@2;) end end local.get 0 local.get 0 - i64.load offset=24 align=4 - i64.store offset=8 - local.get 0 - local.get 0 - i64.load offset=16 align=4 - i64.store + i32.const 16 + i32.add + call $>::from + local.get 1 local.get 2 local.get 3 - local.get 4 local.get 0 call $miden_base_sys::bindings::output_note::set_attachment - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 5 local.get 0 i32.const 32 @@ -89,7 +88,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -97,33 +96,75 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::output_note::set_attachment (;4;) (type 2) (param f32 f32 f32 i32) + (local i32) local.get 0 local.get 1 local.get 2 local.get 3 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 4 + call $>::index + f32.load local.get 3 - f32.load offset=8 + i32.const 2 + local.get 4 + call $>::index + f32.load local.get 3 - f32.load offset=4 + i32.const 1 + local.get 4 + call $>::index + f32.load local.get 3 + i32.const 0 + local.get 4 + call $>::index f32.load call $miden::protocol::output_note::set_attachment ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) - (func $miden::protocol::output_note::set_attachment (;6;) (type 4) (param f32 f32 f32 f32 f32 f32 f32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::output_note::set_attachment (;8;) (type 6) (param f32 f32 f32 f32 f32 f32 f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "Wrust_sdk_output_note_set_attachment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir index 68ccbfb71..186406afe 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.hir @@ -12,174 +12,212 @@ builtin.component miden:rust-sdk-output-note-set-word-attachment-binding/rust-sd private builtin.function @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding() -> felt { ^block9: - v3 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr - v4 = hir.bitcast v3 : ptr; - v5 = hir.load v4 : i32; - v6 = arith.constant 32 : i32; - v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; - v8 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr - v9 = hir.bitcast v8 : ptr; - hir.store v9, v7; + v5 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr + v6 = hir.bitcast v5 : ptr; + v7 = hir.load v6 : i32; + v8 = arith.constant 32 : i32; + v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; + v10 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/wit_bindgen::rt::run_ctors_once() - v129 = arith.constant 0 : felt; + v253 = arith.constant 0 : i64; + v15 = arith.trunc v253 : felt; + v254 = arith.constant 0 : i64; + v13 = arith.trunc v254 : felt; + v12 = arith.constant 0 : i64; + v18 = arith.trunc v12 : felt; v1 = arith.constant 0 : i32; - v200, v201, v202, v203, v204, v205, v206, v207 = scf.while v1, v7, v129, v129, v129 : i32, i32, felt, felt, felt, i32, felt, felt { - ^block35(v208: i32, v209: i32, v210: felt, v211: felt, v212: felt): - v231 = arith.constant 0 : i32; - v18 = arith.constant 16 : i32; - v19 = arith.eq v208, v18 : i1; - v20 = arith.zext v19 : u32; - v21 = hir.bitcast v20 : i32; - v23 = arith.neq v21, v231 : i1; - v193 = scf.if v23 : i32 { - ^block34: - v140 = ub.poison i32 : i32; - scf.yield v140; + v224, v225, v226, v227, v228, v229, v230, v231 = scf.while v1, v9, v18, v13, v15 : i32, i32, felt, felt, felt, i32, felt, felt { + ^block41(v232: i32, v233: i32, v234: felt, v235: felt, v236: felt): + v252 = arith.constant 0 : i32; + v37 = arith.constant 16 : i32; + v21 = arith.eq v232, v37 : i1; + v22 = arith.zext v21 : u32; + v23 = hir.bitcast v22 : i32; + v25 = arith.neq v23, v252 : i1; + v217 = scf.if v25 : i32 { + ^block40: + v164 = ub.poison i32 : i32; + scf.yield v164; } else { ^block14: - v230 = arith.constant 16 : i32; - v26 = arith.add v209, v230 : i32 #[overflow = wrapping]; - v27 = arith.add v26, v208 : i32 #[overflow = wrapping]; - v29 = hir.bitcast v27 : u32; - v38 = arith.constant 4 : u32; - v31 = arith.mod v29, v38 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v210; - v33 = arith.constant 4 : i32; - v34 = arith.add v208, v33 : i32 #[overflow = wrapping]; - scf.yield v34; + v251 = arith.constant 16 : i32; + v28 = arith.add v233, v251 : i32 #[overflow = wrapping]; + v29 = arith.add v28, v232 : i32 #[overflow = wrapping]; + v31 = hir.bitcast v29 : u32; + v32 = arith.constant 4 : u32; + v33 = arith.mod v31, v32 : u32; + hir.assertz v33 #[code = 250]; + v34 = hir.int_to_ptr v31 : ptr; + hir.store v34, v234; + v35 = arith.constant 4 : i32; + v36 = arith.add v232, v35 : i32 #[overflow = wrapping]; + scf.yield v36; }; - v227 = ub.poison felt : felt; - v197 = cf.select v23, v227, v212 : felt; - v228 = ub.poison felt : felt; - v196 = cf.select v23, v228, v211 : felt; - v141 = ub.poison felt : felt; - v195 = cf.select v23, v141, v210 : felt; - v229 = ub.poison i32 : i32; - v194 = cf.select v23, v229, v209 : i32; - v139 = arith.constant 1 : u32; - v131 = arith.constant 0 : u32; - v199 = cf.select v23, v131, v139 : u32; - v185 = arith.trunc v199 : i1; - scf.condition v185, v193, v194, v195, v196, v197, v209, v211, v212; + v248 = ub.poison felt : felt; + v221 = cf.select v25, v248, v236 : felt; + v249 = ub.poison felt : felt; + v220 = cf.select v25, v249, v235 : felt; + v165 = ub.poison felt : felt; + v219 = cf.select v25, v165, v234 : felt; + v250 = ub.poison i32 : i32; + v218 = cf.select v25, v250, v233 : i32; + v163 = arith.constant 1 : u32; + v155 = arith.constant 0 : u32; + v223 = cf.select v25, v155, v163 : u32; + v209 = arith.trunc v223 : i1; + scf.condition v209, v217, v218, v219, v220, v221, v233, v235, v236; } do { - ^block36(v213: i32, v214: i32, v215: felt, v216: felt, v217: felt, v218: i32, v219: felt, v220: felt): - scf.yield v213, v214, v215, v216, v217; + ^block42(v237: i32, v238: i32, v239: felt, v240: felt, v241: felt, v242: i32, v243: felt, v244: felt): + scf.yield v237, v238, v239, v240, v241; }; - v36 = arith.constant 24 : u32; - v35 = hir.bitcast v205 : u32; - v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v226 = arith.constant 4 : u32; - v39 = arith.mod v37, v226 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - v41 = hir.load v40 : i64; - v43 = arith.constant 8 : u32; - v42 = hir.bitcast v205 : u32; - v44 = arith.add v42, v43 : u32 #[overflow = checked]; - v225 = arith.constant 8 : u32; - v46 = arith.mod v44, v225 : u32; - hir.assertz v46 #[code = 250]; - v47 = hir.int_to_ptr v44 : ptr; - hir.store v47, v41; - v49 = arith.constant 16 : u32; - v48 = hir.bitcast v205 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v224 = arith.constant 4 : u32; - v52 = arith.mod v50, v224 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i64; - v55 = hir.bitcast v205 : u32; - v223 = arith.constant 8 : u32; - v57 = arith.mod v55, v223 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - hir.store v58, v54; - hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden_base_sys::bindings::output_note::set_word_attachment(v206, v207, v205) - v222 = arith.constant 32 : i32; - v64 = arith.add v205, v222 : i32 #[overflow = wrapping]; - v65 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr - v66 = hir.bitcast v65 : ptr; - hir.store v66, v64; - v221 = arith.constant 0 : felt; - builtin.ret v221; + v247 = arith.constant 16 : i32; + v38 = arith.add v229, v247 : i32 #[overflow = wrapping]; + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/>::from(v229, v38) + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden_base_sys::bindings::output_note::set_word_attachment(v230, v231, v229) + v246 = arith.constant 32 : i32; + v44 = arith.add v229, v246 : i32 #[overflow = wrapping]; + v45 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__stack_pointer : ptr + v46 = hir.bitcast v45 : ptr; + hir.store v46, v44; + v245 = arith.constant 0 : i64; + v42 = arith.trunc v245 : felt; + builtin.ret v42; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { ^block15: - v68 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr - v69 = hir.bitcast v68 : ptr; - v70 = hir.load v69 : i32; - v71 = arith.constant 1048584 : i32; - v72 = arith.add v70, v71 : i32 #[overflow = wrapping]; - v73 = hir.bitcast v72 : u32; - v74 = hir.int_to_ptr v73 : ptr; - v75 = hir.load v74 : u8; - v67 = arith.constant 0 : i32; - v76 = arith.zext v75 : u32; - v77 = hir.bitcast v76 : i32; - v79 = arith.neq v77, v67 : i1; - scf.if v79{ + v48 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 1048612 : i32; + v52 = arith.add v50, v51 : i32 #[overflow = wrapping]; + v53 = hir.bitcast v52 : u32; + v54 = hir.int_to_ptr v53 : ptr; + v55 = hir.load v54 : u8; + v47 = arith.constant 0 : i32; + v56 = arith.zext v55 : u32; + v57 = hir.bitcast v56 : i32; + v59 = arith.neq v57, v47 : i1; + scf.if v59{ ^block17: scf.yield ; } else { ^block18: - v80 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr - v81 = hir.bitcast v80 : ptr; - v82 = hir.load v81 : i32; + v60 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr + v61 = hir.bitcast v60 : ptr; + v62 = hir.load v61 : i32; hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/__wasm_call_ctors() - v233 = arith.constant 1 : u8; - v235 = arith.constant 1048584 : i32; - v84 = arith.add v82, v235 : i32 #[overflow = wrapping]; - v88 = hir.bitcast v84 : u32; - v89 = hir.int_to_ptr v88 : ptr; - hir.store v89, v233; + v256 = arith.constant 1 : u8; + v258 = arith.constant 1048612 : i32; + v64 = arith.add v62, v258 : i32 #[overflow = wrapping]; + v68 = hir.bitcast v64 : u32; + v69 = hir.int_to_ptr v68 : ptr; + hir.store v69, v256; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::output_note::set_word_attachment(v90: felt, v91: felt, v92: i32) { - ^block19(v90: felt, v91: felt, v92: i32): - v94 = arith.constant 12 : u32; - v93 = hir.bitcast v92 : u32; - v95 = arith.add v93, v94 : u32 #[overflow = checked]; - v96 = arith.constant 4 : u32; - v97 = arith.mod v95, v96 : u32; + private builtin.function @miden_base_sys::bindings::output_note::set_word_attachment(v70: felt, v71: felt, v72: i32) { + ^block19(v70: felt, v71: felt, v72: i32): + v75 = builtin.global_symbol @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/GOT.data.internal.__memory_base : ptr + v76 = hir.bitcast v75 : ptr; + v77 = hir.load v76 : i32; + v78 = arith.constant 1048596 : i32; + v79 = arith.add v77, v78 : i32 #[overflow = wrapping]; + v74 = arith.constant 3 : i32; + v80 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/>::index(v72, v74, v79) : i32 + v81 = hir.bitcast v80 : u32; + v82 = arith.constant 4 : u32; + v83 = arith.mod v81, v82 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + v85 = hir.load v84 : felt; + v86 = arith.constant 2 : i32; + v87 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/>::index(v72, v86, v79) : i32 + v88 = hir.bitcast v87 : u32; + v261 = arith.constant 4 : u32; + v90 = arith.mod v88, v261 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + v92 = hir.load v91 : felt; + v93 = arith.constant 1 : i32; + v94 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/>::index(v72, v93, v79) : i32 + v95 = hir.bitcast v94 : u32; + v260 = arith.constant 4 : u32; + v97 = arith.mod v95, v260 : u32; hir.assertz v97 #[code = 250]; v98 = hir.int_to_ptr v95 : ptr; v99 = hir.load v98 : felt; - v101 = arith.constant 8 : u32; - v100 = hir.bitcast v92 : u32; - v102 = arith.add v100, v101 : u32 #[overflow = checked]; - v239 = arith.constant 4 : u32; - v104 = arith.mod v102, v239 : u32; + v73 = arith.constant 0 : i32; + v101 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/>::index(v72, v73, v79) : i32 + v102 = hir.bitcast v101 : u32; + v259 = arith.constant 4 : u32; + v104 = arith.mod v102, v259 : u32; hir.assertz v104 #[code = 250]; v105 = hir.int_to_ptr v102 : ptr; v106 = hir.load v105 : felt; - v238 = arith.constant 4 : u32; - v107 = hir.bitcast v92 : u32; - v109 = arith.add v107, v238 : u32 #[overflow = checked]; - v237 = arith.constant 4 : u32; - v111 = arith.mod v109, v237 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - v113 = hir.load v112 : felt; - v114 = hir.bitcast v92 : u32; - v236 = arith.constant 4 : u32; - v116 = arith.mod v114, v236 : u32; - hir.assertz v116 #[code = 250]; - v117 = hir.int_to_ptr v114 : ptr; - v118 = hir.load v117 : felt; - hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden::protocol::output_note::set_word_attachment(v90, v91, v99, v106, v113, v118) + hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden::protocol::output_note::set_word_attachment(v70, v71, v85, v92, v99, v106) builtin.ret ; }; - private builtin.function @miden::protocol::output_note::set_word_attachment(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt) { - ^block21(v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt): - hir.exec @miden/protocol/output_note/set_word_attachment(v119, v120, v121, v122, v123, v124) + private builtin.function @>::index(v107: i32, v108: i32, v109: i32) -> i32 { + ^block21(v107: i32, v108: i32, v109: i32): + v117 = arith.constant 0 : i32; + v263 = arith.constant 3 : u32; + v112 = hir.bitcast v108 : u32; + v114 = arith.gt v112, v263 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v117 : i1; + cf.cond_br v118 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v262 = arith.constant 2 : u32; + v121 = arith.shl v108, v262 : i32; + v122 = arith.add v107, v121 : i32 #[overflow = wrapping]; + builtin.ret v122; + }; + + private builtin.function @>::from(v123: i32, v124: i32) { + ^block25(v123: i32, v124: i32): + v126 = arith.constant 8 : u32; + v125 = hir.bitcast v124 : u32; + v127 = arith.add v125, v126 : u32 #[overflow = checked]; + v128 = arith.constant 4 : u32; + v129 = arith.mod v127, v128 : u32; + hir.assertz v129 #[code = 250]; + v130 = hir.int_to_ptr v127 : ptr; + v131 = hir.load v130 : i64; + v269 = arith.constant 8 : u32; + v132 = hir.bitcast v123 : u32; + v134 = arith.add v132, v269 : u32 #[overflow = checked]; + v268 = arith.constant 8 : u32; + v136 = arith.mod v134, v268 : u32; + hir.assertz v136 #[code = 250]; + v137 = hir.int_to_ptr v134 : ptr; + hir.store v137, v131; + v138 = hir.bitcast v124 : u32; + v267 = arith.constant 4 : u32; + v140 = arith.mod v138, v267 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + v142 = hir.load v141 : i64; + v143 = hir.bitcast v123 : u32; + v266 = arith.constant 8 : u32; + v145 = arith.mod v143, v266 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v142; + builtin.ret ; + }; + + private builtin.function @miden::protocol::output_note::set_word_attachment(v147: felt, v148: felt, v149: felt, v150: felt, v151: felt, v152: felt) { + ^block27(v147: felt, v148: felt, v149: felt, v150: felt, v151: felt, v152: felt): + hir.exec @miden/protocol/output_note/set_word_attachment(v147, v148, v149, v150, v151, v152) builtin.ret ; }; @@ -191,12 +229,14 @@ builtin.component miden:rust-sdk-output-note-set-word-attachment-binding/rust-sd builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001; + builtin.segment readonly @1048576 = 0x003e64657463616465723c; + + builtin.segment @1048588 = 0x00000000000000000000000a001000000000000100000001; }; public builtin.function @binding() -> felt { - ^block26: - v125 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding() : felt - builtin.ret v125; + ^block32: + v153 = hir.exec @miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1/rust_sdk_output_note_set_word_attachment_binding/miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding() : felt + builtin.ret v153; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm index e01dd82d6..f43acb913 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.masm @@ -18,20 +18,20 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.[7028007876379170725,18060021366771303825,13412364500725888848,14178532912296021363] + push.[11433644200372730325,11349691924608542755,2482790568805339584,12018669310975905431] adv.push_mapval push.262144 - push.1 + push.3 trace.240 exec.::miden::core::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278536 + mem_store.278544 push.0 u32assert - mem_store.278537 + mem_store.278545 end # mod ::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding @@ -54,7 +54,7 @@ end proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding( ) -> felt - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -64,7 +64,7 @@ proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note nop push.32 u32wrapping_sub - push.1114144 + push.1114176 dup.1 swap.1 u32divmod.4 @@ -81,12 +81,19 @@ proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note nop push.0 push.0 - dup.1 - dup.2 - swap.4 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + push.0 + mul.4294967296 + add + push.0 + movup.4 swap.1 - swap.3 - swap.2 push.1 while.true push.0 @@ -178,75 +185,13 @@ proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note drop drop drop - push.24 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - push.8 - dup.3 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop push.16 dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - swap.1 - dup.2 - push.8 + u32wrapping_add dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - movup.2 - movdn.3 trace.240 nop - exec.::intrinsics::mem::store_dw + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::>::from trace.252 nop dup.0 @@ -261,7 +206,7 @@ proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note nop push.32 u32wrapping_add - push.1114144 + push.1114176 u32divmod.4 swap.1 trace.240 @@ -270,13 +215,16 @@ proc miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note trace.252 nop push.0 + push.0 + mul.4294967296 + add end @callconv("C") proc wit_bindgen::rt::run_ctors_once( ) - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -284,7 +232,7 @@ proc wit_bindgen::rt::run_ctors_once( exec.::intrinsics::mem::load_sw trace.252 nop - push.1048584 + push.1048612 u32wrapping_add u32divmod.4 swap.1 @@ -305,7 +253,7 @@ proc wit_bindgen::rt::run_ctors_once( if.true nop else - push.1114148 + push.1114180 u32divmod.4 swap.1 trace.240 @@ -319,7 +267,7 @@ proc wit_bindgen::rt::run_ctors_once( trace.252 nop push.1 - push.1048584 + push.1048612 movup.2 u32wrapping_add u32divmod.4 @@ -352,10 +300,49 @@ proc miden_base_sys::bindings::output_note::set_word_attachment( felt, i32 ) - push.12 - dup.3 - add + push.1114180 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048596 + u32wrapping_add + push.3 + dup.4 + dup.2 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.2 + dup.5 + dup.3 + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -369,10 +356,16 @@ proc miden_base_sys::bindings::output_note::set_word_attachment( exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.1 + dup.6 dup.4 - add - u32assert + swap.2 + swap.1 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::>::index + trace.252 + nop push.4 dup.1 swap.1 @@ -386,8 +379,77 @@ proc miden_base_sys::bindings::output_note::set_word_attachment( exec.::intrinsics::mem::load_felt trace.252 nop + push.0 + movup.2 + swap.4 + movdn.2 + swap.1 + swap.7 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::>::index + trace.252 + nop push.4 - dup.5 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.5 + swap.4 + swap.1 + swap.2 + swap.3 + trace.240 + nop + exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::"miden::protocol::output_note::set_word_attachment" + trace.252 + nop +end + +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + +@callconv("C") +proc >::from( + i32, + i32 +) + push.8 + dup.2 add u32assert push.4 @@ -400,10 +462,30 @@ proc miden_base_sys::bindings::output_note::set_word_attachment( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.8 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw trace.252 nop - movup.5 + swap.1 push.4 dup.1 swap.1 @@ -414,18 +496,24 @@ proc miden_base_sys::bindings::output_note::set_word_attachment( swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt + exec.::intrinsics::mem::load_dw trace.252 nop + swap.1 movup.2 - swap.3 - movdn.2 - swap.5 + push.8 + dup.1 swap.1 - swap.4 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 trace.240 nop - exec.::"miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1"::rust_sdk_output_note_set_word_attachment_binding::"miden::protocol::output_note::set_word_attachment" + exec.::intrinsics::mem::store_dw trace.252 nop end diff --git a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat index 74b93f880..b9ca09f06 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_output_note_set_word_attachment_binding.wat @@ -10,8 +10,10 @@ (type (;0;) (func)) (type (;1;) (func (result f32))) (type (;2;) (func (param f32 f32 i32))) - (type (;3;) (func (param i32) (result f32))) - (type (;4;) (func (param f32 f32 f32 f32 f32 f32))) + (type (;3;) (func (param i64) (result f32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (param i32 i32))) + (type (;6;) (func (param f32 f32 f32 f32 f32 f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -22,58 +24,55 @@ (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_output_note_set_word_attachment_binding::bindings::__link_custom_section_describing_imports (;1;) (type 0)) (func $miden:rust-sdk-output-note-set-word-attachment-binding/rust-sdk-output-note-set-word-attachment-binding@0.0.1#binding (;2;) (type 1) (result f32) - (local i32 i32 f32 f32 f32) + (local i32 f32 f32 i32 f32) global.get $__stack_pointer i32.const 32 i32.sub local.tee 0 global.set $__stack_pointer call $wit_bindgen::rt::run_ctors_once - i32.const 0 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 1 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 2 i32.const 0 - call $intrinsics::felt::from_u32 local.set 3 - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 4 block ;; label = @1 loop ;; label = @2 - local.get 1 + local.get 3 i32.const 16 i32.eq br_if 1 (;@1;) local.get 0 i32.const 16 i32.add - local.get 1 + local.get 3 i32.add local.get 4 f32.store - local.get 1 + local.get 3 i32.const 4 i32.add - local.set 1 + local.set 3 br 0 (;@2;) end end local.get 0 local.get 0 - i64.load offset=24 align=4 - i64.store offset=8 - local.get 0 - local.get 0 - i64.load offset=16 align=4 - i64.store + i32.const 16 + i32.add + call $>::from + local.get 1 local.get 2 - local.get 3 local.get 0 call $miden_base_sys::bindings::output_note::set_word_attachment - i32.const 0 - call $intrinsics::felt::from_u32 + i64.const 0 + call $intrinsics::felt::from_u64_unchecked local.set 4 local.get 0 i32.const 32 @@ -85,7 +84,7 @@ (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048584 + i32.const 1048612 i32.add i32.load8_u br_if 0 (;@1;) @@ -93,32 +92,74 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048584 + i32.const 1048612 i32.add i32.const 1 i32.store8 end ) (func $miden_base_sys::bindings::output_note::set_word_attachment (;4;) (type 2) (param f32 f32 i32) + (local i32) local.get 0 local.get 1 local.get 2 - f32.load offset=12 + i32.const 3 + global.get $GOT.data.internal.__memory_base + i32.const 1048596 + i32.add + local.tee 3 + call $>::index + f32.load local.get 2 - f32.load offset=8 + i32.const 2 + local.get 3 + call $>::index + f32.load local.get 2 - f32.load offset=4 + i32.const 1 + local.get 3 + call $>::index + f32.load local.get 2 + i32.const 0 + local.get 3 + call $>::index f32.load call $miden::protocol::output_note::set_word_attachment ) - (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;5;) (type 3) (param i64) (result f32) unreachable ) - (func $miden::protocol::output_note::set_word_attachment (;6;) (type 4) (param f32 f32 f32 f32 f32 f32) + (func $>::index (;6;) (type 4) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (func $>::from (;7;) (type 5) (param i32 i32) + local.get 0 + local.get 1 + i64.load offset=8 align=4 + i64.store offset=8 + local.get 0 + local.get 1 + i64.load align=4 + i64.store + ) + (func $miden::protocol::output_note::set_word_attachment (;8;) (type 6) (param f32 f32 f32 f32 f32 f32) unreachable ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "\00") + (data $.data (;1;) (i32.const 1048588) "\01\00\00\00\01\00\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") (@custom "rodata,miden_account" (after data) "arust_sdk_output_note_set_word_attachment_binding\01\0b0.0.1\03\01\00\00\00\00\00\00") ) (alias export $miden:base/core-types@1.0.0 "felt" (type $felt (;1;))) diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir index 05e67ec1b..f1153305b 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.hir @@ -10,7 +10,7 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @::eq(v0: i32, v1: i32) -> i32 { + private builtin.function @::eq(v0: i32, v1: i32) -> i32 { ^block9(v0: i32, v1: i32): v5 = hir.bitcast v0 : u32; v6 = arith.constant 4 : u32; @@ -198,7 +198,7 @@ builtin.component miden:base/note-script@1.0.0 { v141 = arith.add v98, v409 : i32 #[overflow = wrapping]; v410 = arith.constant 16 : i32; v139 = arith.add v98, v410 : i32 #[overflow = wrapping]; - v142 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v139, v141) : i32 + v142 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v139, v141) : i32 v407 = arith.constant 0 : i32; v408 = arith.constant 0 : i32; v144 = arith.eq v142, v408 : i1; @@ -215,7 +215,7 @@ builtin.component miden:base/note-script@1.0.0 { v152 = arith.add v98, v404 : i32 #[overflow = wrapping]; v405 = arith.constant 32 : i32; v150 = arith.add v98, v405 : i32 #[overflow = wrapping]; - v153 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v150, v152) : i32 + v153 = hir.exec @miden:base/note-script@1.0.0/rust_sdk_swapp_note_bindings/::eq(v150, v152) : i32 v402 = arith.constant 0 : i32; v403 = arith.constant 0 : i32; v155 = arith.eq v153, v403 : i1; diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm index 563fd39ec..e93b931a3 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.masm @@ -49,7 +49,7 @@ proc rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_im end @callconv("C") -proc ::eq( +proc ::eq( i32, i32 ) -> i32 @@ -357,7 +357,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::::eq + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::::eq trace.252 nop push.0 @@ -378,7 +378,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::::eq + exec.::"miden:base/note-script@1.0.0"::rust_sdk_swapp_note_bindings::::eq trace.252 nop push.0 diff --git a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat index 73413fad6..179e2569e 100644 --- a/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat +++ b/tests/integration/expected/rust_sdk/rust_sdk_swapp_note_bindings.wat @@ -3,9 +3,8 @@ (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (export (;4;) "word" (type (eq 3))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (export (;3;) "word" (type (eq 2))) ) ) (import "miden:base/core-types@1.0.0" (instance $miden:base/core-types@1.0.0 (;0;) (type $ty-miden:base/core-types@1.0.0))) @@ -25,7 +24,7 @@ (elem (;0;) (i32.const 1) func $rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports) (func $__wasm_call_ctors (;0;) (type 0)) (func $rust_sdk_swapp_note_bindings::bindings::__link_custom_section_describing_imports (;1;) (type 0)) - (func $::eq (;2;) (type 1) (param i32 i32) (result i32) + (func $::eq (;2;) (type 1) (param i32 i32) (result i32) (local i32) i32.const 0 local.set 2 @@ -114,7 +113,7 @@ local.get 4 i32.const 16 i32.add - call $::eq + call $::eq i32.eqz br_if 0 (;@1;) local.get 4 @@ -123,7 +122,7 @@ local.get 4 i32.const 32 i32.add - call $::eq + call $::eq i32.eqz br_if 0 (;@1;) local.get 7 @@ -263,15 +262,14 @@ (component $miden:base/note-script@1.0.0-shim-component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) - (type (;2;) (tuple 1 1 1 1)) - (type (;3;) (record (field "inner" 2))) - (import "import-type-word" (type (;4;) (eq 3))) - (import "import-type-word0" (type (;5;) (eq 4))) - (type (;6;) (func (param "arg" 5))) - (import "import-func-run" (func (;0;) (type 6))) - (export (;7;) "word" (type 4)) - (type (;8;) (func (param "arg" 7))) - (export (;1;) "run" (func 0) (func (type 8))) + (type (;2;) (record (field "a" 1) (field "b" 1) (field "c" 1) (field "d" 1))) + (import "import-type-word" (type (;3;) (eq 2))) + (import "import-type-word0" (type (;4;) (eq 3))) + (type (;5;) (func (param "arg" 4))) + (import "import-func-run" (func (;0;) (type 5))) + (export (;6;) "word" (type 3)) + (type (;7;) (func (param "arg" 6))) + (export (;1;) "run" (func 0) (func (type 7))) ) (instance $miden:base/note-script@1.0.0-shim-instance (;1;) (instantiate $miden:base/note-script@1.0.0-shim-component (with "import-func-run" (func $run)) diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.hir b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir index bf4864101..523ab4f0b 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.hir +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.hir @@ -1,6 +1,6 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @rust_sdk_stdlib_smt_get { - private builtin.function @::eq(v0: i32, v1: i32) -> i32 { + private builtin.function @::eq(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): v5 = hir.bitcast v0 : u32; v6 = arith.constant 4 : u32; @@ -9,8 +9,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; v10 = hir.bitcast v1 : u32; - v318 = arith.constant 4 : u32; - v12 = arith.mod v10, v318 : u32; + v454 = arith.constant 4 : u32; + v12 = arith.mod v10, v454 : u32; hir.assertz v12 #[code = 250]; v13 = hir.int_to_ptr v10 : ptr; v14 = hir.load v13 : felt; @@ -22,101 +22,101 @@ builtin.component root_ns:root@1.0.0 { v19 = arith.zext v18 : u32; v20 = hir.bitcast v19 : i32; v22 = arith.neq v20, v3 : i1; - v296 = scf.if v22 : i32 { + v432 = scf.if v22 : i32 { ^block6: - v317 = arith.constant 0 : i32; - scf.yield v317; + v453 = arith.constant 0 : i32; + scf.yield v453; } else { ^block7: - v316 = arith.constant 4 : u32; + v452 = arith.constant 4 : u32; v23 = hir.bitcast v0 : u32; - v25 = arith.add v23, v316 : u32 #[overflow = checked]; - v315 = arith.constant 4 : u32; - v27 = arith.mod v25, v315 : u32; + v25 = arith.add v23, v452 : u32 #[overflow = checked]; + v451 = arith.constant 4 : u32; + v27 = arith.mod v25, v451 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; v29 = hir.load v28 : felt; - v314 = arith.constant 4 : u32; + v450 = arith.constant 4 : u32; v30 = hir.bitcast v1 : u32; - v32 = arith.add v30, v314 : u32 #[overflow = checked]; - v313 = arith.constant 4 : u32; - v34 = arith.mod v32, v313 : u32; + v32 = arith.add v30, v450 : u32 #[overflow = checked]; + v449 = arith.constant 4 : u32; + v34 = arith.mod v32, v449 : u32; hir.assertz v34 #[code = 250]; v35 = hir.int_to_ptr v32 : ptr; v36 = hir.load v35 : felt; - v311 = arith.constant 0 : i32; - v312 = arith.constant 1 : i32; + v447 = arith.constant 0 : i32; + v448 = arith.constant 1 : i32; v37 = arith.eq v29, v36 : i1; v38 = hir.cast v37 : i32; - v40 = arith.neq v38, v312 : i1; + v40 = arith.neq v38, v448 : i1; v41 = arith.zext v40 : u32; v42 = hir.bitcast v41 : i32; - v44 = arith.neq v42, v311 : i1; - v298 = scf.if v44 : i32 { - ^block22: - v310 = arith.constant 0 : i32; - scf.yield v310; + v44 = arith.neq v42, v447 : i1; + v434 = scf.if v44 : i32 { + ^block26: + v446 = arith.constant 0 : i32; + scf.yield v446; } else { ^block8: v46 = arith.constant 8 : u32; v45 = hir.bitcast v0 : u32; v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v309 = arith.constant 4 : u32; - v49 = arith.mod v47, v309 : u32; + v445 = arith.constant 4 : u32; + v49 = arith.mod v47, v445 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; v51 = hir.load v50 : felt; - v308 = arith.constant 8 : u32; + v444 = arith.constant 8 : u32; v52 = hir.bitcast v1 : u32; - v54 = arith.add v52, v308 : u32 #[overflow = checked]; - v307 = arith.constant 4 : u32; - v56 = arith.mod v54, v307 : u32; + v54 = arith.add v52, v444 : u32 #[overflow = checked]; + v443 = arith.constant 4 : u32; + v56 = arith.mod v54, v443 : u32; hir.assertz v56 #[code = 250]; v57 = hir.int_to_ptr v54 : ptr; v58 = hir.load v57 : felt; - v305 = arith.constant 0 : i32; - v306 = arith.constant 1 : i32; + v441 = arith.constant 0 : i32; + v442 = arith.constant 1 : i32; v59 = arith.eq v51, v58 : i1; v60 = hir.cast v59 : i32; - v62 = arith.neq v60, v306 : i1; + v62 = arith.neq v60, v442 : i1; v63 = arith.zext v62 : u32; v64 = hir.bitcast v63 : i32; - v66 = arith.neq v64, v305 : i1; - v299 = scf.if v66 : i32 { - ^block21: - v304 = arith.constant 0 : i32; - scf.yield v304; + v66 = arith.neq v64, v441 : i1; + v435 = scf.if v66 : i32 { + ^block25: + v440 = arith.constant 0 : i32; + scf.yield v440; } else { ^block9: v68 = arith.constant 12 : u32; v67 = hir.bitcast v0 : u32; v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v303 = arith.constant 4 : u32; - v71 = arith.mod v69, v303 : u32; + v439 = arith.constant 4 : u32; + v71 = arith.mod v69, v439 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : felt; - v302 = arith.constant 12 : u32; + v438 = arith.constant 12 : u32; v74 = hir.bitcast v1 : u32; - v76 = arith.add v74, v302 : u32 #[overflow = checked]; - v301 = arith.constant 4 : u32; - v78 = arith.mod v76, v301 : u32; + v76 = arith.add v74, v438 : u32 #[overflow = checked]; + v437 = arith.constant 4 : u32; + v78 = arith.mod v76, v437 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; v80 = hir.load v79 : felt; - v300 = arith.constant 1 : i32; + v436 = arith.constant 1 : i32; v81 = arith.eq v73, v80 : i1; v82 = hir.cast v81 : i32; - v84 = arith.eq v82, v300 : i1; + v84 = arith.eq v82, v436 : i1; v85 = arith.zext v84 : u32; v86 = hir.bitcast v85 : i32; scf.yield v86; }; - scf.yield v299; + scf.yield v435; }; - scf.yield v298; + scf.yield v434; }; - builtin.ret v296; + builtin.ret v432; }; public builtin.function @entrypoint(v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt) { @@ -131,244 +131,407 @@ builtin.component root_ns:root@1.0.0 { v105 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr v106 = hir.bitcast v105 : ptr; hir.store v106, v104; - v108 = arith.constant 28 : u32; + v108 = arith.constant 12 : u32; v107 = hir.bitcast v104 : u32; v109 = arith.add v107, v108 : u32 #[overflow = checked]; v110 = arith.constant 4 : u32; v111 = arith.mod v109, v110 : u32; hir.assertz v111 #[code = 250]; v112 = hir.int_to_ptr v109 : ptr; - hir.store v112, v95; - v114 = arith.constant 24 : u32; + hir.store v112, v91; + v114 = arith.constant 8 : u32; v113 = hir.bitcast v104 : u32; v115 = arith.add v113, v114 : u32 #[overflow = checked]; - v361 = arith.constant 4 : u32; - v117 = arith.mod v115, v361 : u32; + v535 = arith.constant 4 : u32; + v117 = arith.mod v115, v535 : u32; hir.assertz v117 #[code = 250]; v118 = hir.int_to_ptr v115 : ptr; - hir.store v118, v94; - v120 = arith.constant 20 : u32; + hir.store v118, v90; + v534 = arith.constant 4 : u32; v119 = hir.bitcast v104 : u32; - v121 = arith.add v119, v120 : u32 #[overflow = checked]; - v360 = arith.constant 4 : u32; - v123 = arith.mod v121, v360 : u32; + v121 = arith.add v119, v534 : u32 #[overflow = checked]; + v533 = arith.constant 4 : u32; + v123 = arith.mod v121, v533 : u32; hir.assertz v123 #[code = 250]; v124 = hir.int_to_ptr v121 : ptr; - hir.store v124, v93; - v126 = arith.constant 16 : u32; + hir.store v124, v89; v125 = hir.bitcast v104 : u32; - v127 = arith.add v125, v126 : u32 #[overflow = checked]; - v359 = arith.constant 4 : u32; - v129 = arith.mod v127, v359 : u32; - hir.assertz v129 #[code = 250]; - v130 = hir.int_to_ptr v127 : ptr; - hir.store v130, v92; - v131 = arith.constant 64 : i32; - v132 = arith.add v104, v131 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/miden::core::collections::smt::get(v91, v90, v89, v88, v95, v94, v93, v92, v132) - v134 = arith.constant 88 : u32; - v133 = hir.bitcast v104 : u32; - v135 = arith.add v133, v134 : u32 #[overflow = checked]; - v136 = arith.constant 8 : u32; - v137 = arith.mod v135, v136 : u32; - hir.assertz v137 #[code = 250]; - v138 = hir.int_to_ptr v135 : ptr; - v139 = hir.load v138 : i64; - v141 = arith.constant 80 : u32; - v140 = hir.bitcast v104 : u32; - v142 = arith.add v140, v141 : u32 #[overflow = checked]; - v358 = arith.constant 8 : u32; - v144 = arith.mod v142, v358 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i64; - v148 = arith.constant 72 : u32; + v532 = arith.constant 4 : u32; + v127 = arith.mod v125, v532 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + hir.store v128, v88; + v130 = arith.constant 20 : u32; + v129 = hir.bitcast v104 : u32; + v131 = arith.add v129, v130 : u32 #[overflow = checked]; + v531 = arith.constant 4 : u32; + v133 = arith.mod v131, v531 : u32; + hir.assertz v133 #[code = 250]; + v134 = hir.int_to_ptr v131 : ptr; + hir.store v134, v93; + v136 = arith.constant 16 : u32; + v135 = hir.bitcast v104 : u32; + v137 = arith.add v135, v136 : u32 #[overflow = checked]; + v530 = arith.constant 4 : u32; + v139 = arith.mod v137, v530 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v92; + v142 = arith.constant 28 : u32; + v141 = hir.bitcast v104 : u32; + v143 = arith.add v141, v142 : u32 #[overflow = checked]; + v529 = arith.constant 4 : u32; + v145 = arith.mod v143, v529 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + hir.store v146, v95; + v148 = arith.constant 24 : u32; v147 = hir.bitcast v104 : u32; v149 = arith.add v147, v148 : u32 #[overflow = checked]; - v357 = arith.constant 8 : u32; - v151 = arith.mod v149, v357 : u32; + v528 = arith.constant 4 : u32; + v151 = arith.mod v149, v528 : u32; hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : i64; - v155 = arith.constant 64 : u32; - v154 = hir.bitcast v104 : u32; - v156 = arith.add v154, v155 : u32 #[overflow = checked]; - v356 = arith.constant 8 : u32; - v158 = arith.mod v156, v356 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - v160 = hir.load v159 : i64; - v328, v329 = arith.split v160 : felt, felt; - v165 = arith.constant 40 : u32; - v164 = hir.bitcast v104 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v355 = arith.constant 8 : u32; - v168 = arith.mod v166, v355 : u32; - hir.assertz v168 #[code = 250]; - v330 = arith.join v329, v328 : i64; - v169 = hir.int_to_ptr v166 : ptr; - hir.store v169, v330; - v325, v326 = arith.split v153 : felt, felt; - v174 = arith.constant 32 : u32; + v152 = hir.int_to_ptr v149 : ptr; + hir.store v152, v94; + v527 = arith.constant 24 : u32; + v153 = hir.bitcast v104 : u32; + v155 = arith.add v153, v527 : u32 #[overflow = checked]; + v526 = arith.constant 8 : u32; + v157 = arith.mod v155, v526 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + v159 = hir.load v158 : i64; + v161 = arith.constant 56 : u32; + v160 = hir.bitcast v104 : u32; + v162 = arith.add v160, v161 : u32 #[overflow = checked]; + v525 = arith.constant 8 : u32; + v164 = arith.mod v162, v525 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + hir.store v165, v159; + v524 = arith.constant 16 : u32; + v166 = hir.bitcast v104 : u32; + v168 = arith.add v166, v524 : u32 #[overflow = checked]; + v523 = arith.constant 8 : u32; + v170 = arith.mod v168, v523 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + v172 = hir.load v171 : i64; + v174 = arith.constant 48 : u32; v173 = hir.bitcast v104 : u32; v175 = arith.add v173, v174 : u32 #[overflow = checked]; - v354 = arith.constant 8 : u32; - v177 = arith.mod v175, v354 : u32; + v522 = arith.constant 8 : u32; + v177 = arith.mod v175, v522 : u32; hir.assertz v177 #[code = 250]; - v327 = arith.join v326, v325 : i64; v178 = hir.int_to_ptr v175 : ptr; - hir.store v178, v327; - v322, v323 = arith.split v146 : felt, felt; - v183 = arith.constant 56 : u32; - v182 = hir.bitcast v104 : u32; - v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v353 = arith.constant 8 : u32; - v186 = arith.mod v184, v353 : u32; - hir.assertz v186 #[code = 250]; - v324 = arith.join v323, v322 : i64; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v324; - v319, v320 = arith.split v139 : felt, felt; - v192 = arith.constant 48 : u32; - v191 = hir.bitcast v104 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; - v352 = arith.constant 8 : u32; - v195 = arith.mod v193, v352 : u32; - hir.assertz v195 #[code = 250]; - v321 = arith.join v320, v319 : i64; - v196 = hir.int_to_ptr v193 : ptr; - hir.store v196, v321; - v206 = arith.constant 76 : u32; - v205 = hir.bitcast v104 : u32; - v207 = arith.add v205, v206 : u32 #[overflow = checked]; - v351 = arith.constant 4 : u32; - v209 = arith.mod v207, v351 : u32; - hir.assertz v209 #[code = 250]; - v203 = arith.constant 13 : i64; - v204 = arith.trunc v203 : felt; - v210 = hir.int_to_ptr v207 : ptr; - hir.store v210, v204; - v350 = arith.constant 72 : u32; - v211 = hir.bitcast v104 : u32; - v213 = arith.add v211, v350 : u32 #[overflow = checked]; - v349 = arith.constant 4 : u32; - v215 = arith.mod v213, v349 : u32; - hir.assertz v215 #[code = 250]; - v201 = arith.constant 12 : i64; - v202 = arith.trunc v201 : felt; - v216 = hir.int_to_ptr v213 : ptr; - hir.store v216, v202; - v218 = arith.constant 68 : u32; - v217 = hir.bitcast v104 : u32; - v219 = arith.add v217, v218 : u32 #[overflow = checked]; - v348 = arith.constant 4 : u32; - v221 = arith.mod v219, v348 : u32; - hir.assertz v221 #[code = 250]; - v199 = arith.constant 11 : i64; - v200 = arith.trunc v199 : felt; - v222 = hir.int_to_ptr v219 : ptr; - hir.store v222, v200; - v347 = arith.constant 64 : u32; - v223 = hir.bitcast v104 : u32; - v225 = arith.add v223, v347 : u32 #[overflow = checked]; - v346 = arith.constant 4 : u32; - v227 = arith.mod v225, v346 : u32; - hir.assertz v227 #[code = 250]; - v197 = arith.constant 10 : i64; - v198 = arith.trunc v197 : felt; - v228 = hir.int_to_ptr v225 : ptr; - hir.store v228, v198; - v345 = arith.constant 64 : i32; - v232 = arith.add v104, v345 : i32 #[overflow = wrapping]; - v229 = arith.constant 32 : i32; - v230 = arith.add v104, v229 : i32 #[overflow = wrapping]; - v233 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v230, v232) : i32 - v344 = arith.constant 0 : i32; + hir.store v178, v172; + v180 = arith.constant 1048588 : i32; + v179 = arith.constant 3 : i32; + v181 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v104, v179, v180) : i32 + v182 = hir.bitcast v181 : u32; + v521 = arith.constant 4 : u32; + v184 = arith.mod v182, v521 : u32; + hir.assertz v184 #[code = 250]; + v185 = hir.int_to_ptr v182 : ptr; + v186 = hir.load v185 : felt; + v520 = arith.constant 1048588 : i32; + v187 = arith.constant 2 : i32; + v189 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v104, v187, v520) : i32 + v190 = hir.bitcast v189 : u32; + v519 = arith.constant 4 : u32; + v192 = arith.mod v190, v519 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : felt; + v518 = arith.constant 1048588 : i32; + v195 = arith.constant 1 : i32; + v197 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v104, v195, v518) : i32 + v198 = hir.bitcast v197 : u32; + v517 = arith.constant 4 : u32; + v200 = arith.mod v198, v517 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + v202 = hir.load v201 : felt; + v516 = arith.constant 1048588 : i32; v96 = arith.constant 0 : i32; - v235 = arith.eq v233, v96 : i1; - v236 = arith.zext v235 : u32; - v237 = hir.bitcast v236 : i32; - v239 = arith.neq v237, v344 : i1; - v335 = scf.if v239 : u32 { - ^block27: - v331 = arith.constant 0 : u32; - scf.yield v331; + v205 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v104, v96, v516) : i32 + v206 = hir.bitcast v205 : u32; + v515 = arith.constant 4 : u32; + v208 = arith.mod v206, v515 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + v210 = hir.load v209 : felt; + v513 = arith.constant 1048588 : i32; + v514 = arith.constant 3 : i32; + v211 = arith.constant 48 : i32; + v212 = arith.add v104, v211 : i32 #[overflow = wrapping]; + v215 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v212, v514, v513) : i32 + v216 = hir.bitcast v215 : u32; + v512 = arith.constant 4 : u32; + v218 = arith.mod v216, v512 : u32; + hir.assertz v218 #[code = 250]; + v219 = hir.int_to_ptr v216 : ptr; + v220 = hir.load v219 : felt; + v509 = arith.constant 1048588 : i32; + v510 = arith.constant 2 : i32; + v511 = arith.constant 48 : i32; + v222 = arith.add v104, v511 : i32 #[overflow = wrapping]; + v225 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v222, v510, v509) : i32 + v226 = hir.bitcast v225 : u32; + v508 = arith.constant 4 : u32; + v228 = arith.mod v226, v508 : u32; + hir.assertz v228 #[code = 250]; + v229 = hir.int_to_ptr v226 : ptr; + v230 = hir.load v229 : felt; + v505 = arith.constant 1048588 : i32; + v506 = arith.constant 1 : i32; + v507 = arith.constant 48 : i32; + v232 = arith.add v104, v507 : i32 #[overflow = wrapping]; + v235 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v232, v506, v505) : i32 + v236 = hir.bitcast v235 : u32; + v504 = arith.constant 4 : u32; + v238 = arith.mod v236, v504 : u32; + hir.assertz v238 #[code = 250]; + v239 = hir.int_to_ptr v236 : ptr; + v240 = hir.load v239 : felt; + v501 = arith.constant 1048588 : i32; + v502 = arith.constant 0 : i32; + v503 = arith.constant 48 : i32; + v242 = arith.add v104, v503 : i32 #[overflow = wrapping]; + v245 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/>::index(v242, v502, v501) : i32 + v246 = hir.bitcast v245 : u32; + v500 = arith.constant 4 : u32; + v248 = arith.mod v246, v500 : u32; + hir.assertz v248 #[code = 250]; + v249 = hir.int_to_ptr v246 : ptr; + v250 = hir.load v249 : felt; + v251 = arith.constant 64 : i32; + v252 = arith.add v104, v251 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/miden::core::collections::smt::get(v186, v194, v202, v210, v220, v230, v240, v250, v252) + v254 = arith.constant 88 : u32; + v253 = hir.bitcast v104 : u32; + v255 = arith.add v253, v254 : u32 #[overflow = checked]; + v499 = arith.constant 8 : u32; + v257 = arith.mod v255, v499 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + v259 = hir.load v258 : i64; + v261 = arith.constant 80 : u32; + v260 = hir.bitcast v104 : u32; + v262 = arith.add v260, v261 : u32 #[overflow = checked]; + v498 = arith.constant 8 : u32; + v264 = arith.mod v262, v498 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + v266 = hir.load v265 : i64; + v268 = arith.constant 72 : u32; + v267 = hir.bitcast v104 : u32; + v269 = arith.add v267, v268 : u32 #[overflow = checked]; + v497 = arith.constant 8 : u32; + v271 = arith.mod v269, v497 : u32; + hir.assertz v271 #[code = 250]; + v272 = hir.int_to_ptr v269 : ptr; + v273 = hir.load v272 : i64; + v275 = arith.constant 64 : u32; + v274 = hir.bitcast v104 : u32; + v276 = arith.add v274, v275 : u32 #[overflow = checked]; + v496 = arith.constant 8 : u32; + v278 = arith.mod v276, v496 : u32; + hir.assertz v278 #[code = 250]; + v279 = hir.int_to_ptr v276 : ptr; + v280 = hir.load v279 : i64; + v464, v465 = arith.split v280 : felt, felt; + v285 = arith.constant 40 : u32; + v284 = hir.bitcast v104 : u32; + v286 = arith.add v284, v285 : u32 #[overflow = checked]; + v495 = arith.constant 8 : u32; + v288 = arith.mod v286, v495 : u32; + hir.assertz v288 #[code = 250]; + v466 = arith.join v465, v464 : i64; + v289 = hir.int_to_ptr v286 : ptr; + hir.store v289, v466; + v461, v462 = arith.split v273 : felt, felt; + v294 = arith.constant 32 : u32; + v293 = hir.bitcast v104 : u32; + v295 = arith.add v293, v294 : u32 #[overflow = checked]; + v494 = arith.constant 8 : u32; + v297 = arith.mod v295, v494 : u32; + hir.assertz v297 #[code = 250]; + v463 = arith.join v462, v461 : i64; + v298 = hir.int_to_ptr v295 : ptr; + hir.store v298, v463; + v458, v459 = arith.split v266 : felt, felt; + v493 = arith.constant 56 : u32; + v302 = hir.bitcast v104 : u32; + v304 = arith.add v302, v493 : u32 #[overflow = checked]; + v492 = arith.constant 8 : u32; + v306 = arith.mod v304, v492 : u32; + hir.assertz v306 #[code = 250]; + v460 = arith.join v459, v458 : i64; + v307 = hir.int_to_ptr v304 : ptr; + hir.store v307, v460; + v455, v456 = arith.split v259 : felt, felt; + v491 = arith.constant 48 : u32; + v311 = hir.bitcast v104 : u32; + v313 = arith.add v311, v491 : u32 #[overflow = checked]; + v490 = arith.constant 8 : u32; + v315 = arith.mod v313, v490 : u32; + hir.assertz v315 #[code = 250]; + v457 = arith.join v456, v455 : i64; + v316 = hir.int_to_ptr v313 : ptr; + hir.store v316, v457; + v326 = arith.constant 76 : u32; + v325 = hir.bitcast v104 : u32; + v327 = arith.add v325, v326 : u32 #[overflow = checked]; + v489 = arith.constant 4 : u32; + v329 = arith.mod v327, v489 : u32; + hir.assertz v329 #[code = 250]; + v323 = arith.constant 13 : i64; + v324 = arith.trunc v323 : felt; + v330 = hir.int_to_ptr v327 : ptr; + hir.store v330, v324; + v488 = arith.constant 72 : u32; + v331 = hir.bitcast v104 : u32; + v333 = arith.add v331, v488 : u32 #[overflow = checked]; + v487 = arith.constant 4 : u32; + v335 = arith.mod v333, v487 : u32; + hir.assertz v335 #[code = 250]; + v321 = arith.constant 12 : i64; + v322 = arith.trunc v321 : felt; + v336 = hir.int_to_ptr v333 : ptr; + hir.store v336, v322; + v338 = arith.constant 68 : u32; + v337 = hir.bitcast v104 : u32; + v339 = arith.add v337, v338 : u32 #[overflow = checked]; + v486 = arith.constant 4 : u32; + v341 = arith.mod v339, v486 : u32; + hir.assertz v341 #[code = 250]; + v319 = arith.constant 11 : i64; + v320 = arith.trunc v319 : felt; + v342 = hir.int_to_ptr v339 : ptr; + hir.store v342, v320; + v485 = arith.constant 64 : u32; + v343 = hir.bitcast v104 : u32; + v345 = arith.add v343, v485 : u32 #[overflow = checked]; + v484 = arith.constant 4 : u32; + v347 = arith.mod v345, v484 : u32; + hir.assertz v347 #[code = 250]; + v317 = arith.constant 10 : i64; + v318 = arith.trunc v317 : felt; + v348 = hir.int_to_ptr v345 : ptr; + hir.store v348, v318; + v483 = arith.constant 64 : i32; + v352 = arith.add v104, v483 : i32 #[overflow = wrapping]; + v349 = arith.constant 32 : i32; + v350 = arith.add v104, v349 : i32 #[overflow = wrapping]; + v353 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v350, v352) : i32 + v481 = arith.constant 0 : i32; + v482 = arith.constant 0 : i32; + v355 = arith.eq v353, v482 : i1; + v356 = arith.zext v355 : u32; + v357 = hir.bitcast v356 : i32; + v359 = arith.neq v357, v481 : i1; + v471 = scf.if v359 : u32 { + ^block31: + v467 = arith.constant 0 : u32; + scf.yield v467; } else { ^block13: - v242 = arith.constant 16 : i32; - v243 = arith.add v104, v242 : i32 #[overflow = wrapping]; - v240 = arith.constant 48 : i32; - v241 = arith.add v104, v240 : i32 #[overflow = wrapping]; - v244 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v241, v243) : i32 - v342 = arith.constant 0 : i32; - v343 = arith.constant 0 : i32; - v246 = arith.eq v244, v343 : i1; - v247 = arith.zext v246 : u32; - v248 = hir.bitcast v247 : i32; - v250 = arith.neq v248, v342 : i1; - scf.if v250{ - ^block26: + v362 = arith.constant 16 : i32; + v363 = arith.add v104, v362 : i32 #[overflow = wrapping]; + v480 = arith.constant 48 : i32; + v361 = arith.add v104, v480 : i32 #[overflow = wrapping]; + v364 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/::eq(v361, v363) : i32 + v478 = arith.constant 0 : i32; + v479 = arith.constant 0 : i32; + v366 = arith.eq v364, v479 : i1; + v367 = arith.zext v366 : u32; + v368 = hir.bitcast v367 : i32; + v370 = arith.neq v368, v478 : i1; + scf.if v370{ + ^block30: scf.yield ; } else { ^block14: - v251 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr - v252 = hir.bitcast v251 : ptr; - hir.store v252, v100; + v371 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_get/__stack_pointer : ptr + v372 = hir.bitcast v371 : ptr; + hir.store v372, v100; scf.yield ; }; - v333 = arith.constant 1 : u32; - v341 = arith.constant 0 : u32; - v339 = cf.select v250, v341, v333 : u32; - scf.yield v339; + v469 = arith.constant 1 : u32; + v477 = arith.constant 0 : u32; + v475 = cf.select v370, v477, v469 : u32; + scf.yield v475; }; - v340 = arith.constant 0 : u32; - v338 = arith.eq v335, v340 : i1; - cf.cond_br v338 ^block12, ^block29; + v476 = arith.constant 0 : u32; + v474 = arith.eq v471, v476 : i1; + cf.cond_br v474 ^block12, ^block33; ^block12: ub.unreachable ; - ^block29: + ^block33: builtin.ret ; }; - private builtin.function @miden::core::collections::smt::get(v253: felt, v254: felt, v255: felt, v256: felt, v257: felt, v258: felt, v259: felt, v260: felt, v261: i32) { - ^block15(v253: felt, v254: felt, v255: felt, v256: felt, v257: felt, v258: felt, v259: felt, v260: felt, v261: i32): - v262, v263, v264, v265, v266, v267, v268, v269 = hir.exec @miden/core/collections/smt/get(v253, v254, v255, v256, v257, v258, v259, v260) : felt, felt, felt, felt, felt, felt, felt, felt - v270 = hir.bitcast v261 : u32; - v271 = hir.int_to_ptr v270 : ptr; - hir.store v271, v262; - v272 = arith.constant 4 : u32; - v273 = arith.add v270, v272 : u32 #[overflow = checked]; - v274 = hir.int_to_ptr v273 : ptr; - hir.store v274, v263; - v275 = arith.constant 8 : u32; - v276 = arith.add v270, v275 : u32 #[overflow = checked]; - v277 = hir.int_to_ptr v276 : ptr; - hir.store v277, v264; - v278 = arith.constant 12 : u32; - v279 = arith.add v270, v278 : u32 #[overflow = checked]; - v280 = hir.int_to_ptr v279 : ptr; - hir.store v280, v265; - v281 = arith.constant 16 : u32; - v282 = arith.add v270, v281 : u32 #[overflow = checked]; - v283 = hir.int_to_ptr v282 : ptr; - hir.store v283, v266; - v284 = arith.constant 20 : u32; - v285 = arith.add v270, v284 : u32 #[overflow = checked]; - v286 = hir.int_to_ptr v285 : ptr; - hir.store v286, v267; - v287 = arith.constant 24 : u32; - v288 = arith.add v270, v287 : u32 #[overflow = checked]; - v289 = hir.int_to_ptr v288 : ptr; - hir.store v289, v268; - v290 = arith.constant 28 : u32; - v291 = arith.add v270, v290 : u32 #[overflow = checked]; - v292 = hir.int_to_ptr v291 : ptr; - hir.store v292, v269; + private builtin.function @miden::core::collections::smt::get(v373: felt, v374: felt, v375: felt, v376: felt, v377: felt, v378: felt, v379: felt, v380: felt, v381: i32) { + ^block15(v373: felt, v374: felt, v375: felt, v376: felt, v377: felt, v378: felt, v379: felt, v380: felt, v381: i32): + v382, v383, v384, v385, v386, v387, v388, v389 = hir.exec @miden/core/collections/smt/get(v373, v374, v375, v376, v377, v378, v379, v380) : felt, felt, felt, felt, felt, felt, felt, felt + v390 = hir.bitcast v381 : u32; + v391 = hir.int_to_ptr v390 : ptr; + hir.store v391, v382; + v392 = arith.constant 4 : u32; + v393 = arith.add v390, v392 : u32 #[overflow = checked]; + v394 = hir.int_to_ptr v393 : ptr; + hir.store v394, v383; + v395 = arith.constant 8 : u32; + v396 = arith.add v390, v395 : u32 #[overflow = checked]; + v397 = hir.int_to_ptr v396 : ptr; + hir.store v397, v384; + v398 = arith.constant 12 : u32; + v399 = arith.add v390, v398 : u32 #[overflow = checked]; + v400 = hir.int_to_ptr v399 : ptr; + hir.store v400, v385; + v401 = arith.constant 16 : u32; + v402 = arith.add v390, v401 : u32 #[overflow = checked]; + v403 = hir.int_to_ptr v402 : ptr; + hir.store v403, v386; + v404 = arith.constant 20 : u32; + v405 = arith.add v390, v404 : u32 #[overflow = checked]; + v406 = hir.int_to_ptr v405 : ptr; + hir.store v406, v387; + v407 = arith.constant 24 : u32; + v408 = arith.add v390, v407 : u32 #[overflow = checked]; + v409 = hir.int_to_ptr v408 : ptr; + hir.store v409, v388; + v410 = arith.constant 28 : u32; + v411 = arith.add v390, v410 : u32 #[overflow = checked]; + v412 = hir.int_to_ptr v411 : ptr; + hir.store v412, v389; builtin.ret ; }; + private builtin.function @>::index(v413: i32, v414: i32, v415: i32) -> i32 { + ^block21(v413: i32, v414: i32, v415: i32): + v423 = arith.constant 0 : i32; + v537 = arith.constant 3 : u32; + v418 = hir.bitcast v414 : u32; + v420 = arith.gt v418, v537 : i1; + v421 = arith.zext v420 : u32; + v422 = hir.bitcast v421 : i32; + v424 = arith.neq v422, v423 : i1; + cf.cond_br v424 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v536 = arith.constant 2 : u32; + v427 = arith.shl v414, v536 : i32; + v428 = arith.add v413, v427 : i32 #[overflow = wrapping]; + builtin.ret v428; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm index e6dba2758..c02ff1843 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.masm @@ -5,15 +5,23 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop push.1048576 u32assert - mem_store.278528 + mem_store.278536 end # mod ::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get @callconv("C") -proc ::eq( +proc ::eq( i32, i32 ) -> i32 @@ -194,7 +202,7 @@ end @callconv("C") pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -208,7 +216,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) swap.1 u32wrapping_sub u32and - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -218,7 +226,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_sw trace.252 nop - push.28 + push.12 dup.1 add u32assert @@ -228,7 +236,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.10 + movup.6 swap.1 u32divmod.4 swap.1 @@ -237,7 +245,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop - push.24 + push.8 dup.1 add u32assert @@ -247,7 +255,42 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.9 + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 swap.1 u32divmod.4 swap.1 @@ -266,7 +309,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.8 + movup.4 swap.1 u32divmod.4 swap.1 @@ -285,7 +328,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32mod u32assert assertz - dup.7 + movup.3 swap.1 u32divmod.4 swap.1 @@ -294,19 +337,307 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) exec.::intrinsics::mem::store_felt trace.252 nop - push.64 + push.28 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.56 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + swap.1 + push.48 + dup.3 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + movup.2 + movdn.3 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.1048588 + push.3 + dup.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.2 + dup.3 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + dup.4 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + dup.5 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.3 + push.48 + dup.7 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.2 + push.48 + dup.8 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + push.48 + dup.9 u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + push.48 + dup.10 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.64 + dup.9 + u32wrapping_add + movup.3 + swap.5 + movdn.3 movup.2 - swap.10 - swap.4 + swap.6 movdn.2 swap.1 - swap.9 - swap.5 + swap.7 swap.1 swap.8 - swap.6 trace.240 nop exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::"miden::core::collections::smt::get" @@ -564,7 +895,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::::eq + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::::eq trace.252 nop push.0 @@ -585,7 +916,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) u32wrapping_add trace.240 nop - exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::::eq + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_get::::eq trace.252 nop push.0 @@ -598,7 +929,7 @@ pub proc entrypoint(felt, felt, felt, felt, felt, felt, felt, felt) swap.1 drop else - push.1114112 + push.1114144 movup.2 swap.1 u32divmod.4 @@ -742,3 +1073,31 @@ proc miden::core::collections::smt::get( nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat index 197b04989..0ebd22845 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_get.wat +++ b/tests/integration/expected/rust_sdk_stdlib_smt_get.wat @@ -4,12 +4,13 @@ (type (;2;) (func (param f32 f32) (result i32))) (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) (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 "entrypoint" (func $entrypoint)) - (func $::eq (;0;) (type 0) (param i32 i32) (result i32) + (func $::eq (;0;) (type 0) (param i32 i32) (result i32) (local i32) i32.const 0 local.set 2 @@ -62,25 +63,85 @@ local.tee 8 global.set $__stack_pointer local.get 8 - local.get 7 - f32.store offset=28 + local.get 3 + f32.store offset=12 local.get 8 - local.get 6 - f32.store offset=24 + local.get 2 + f32.store offset=8 + local.get 8 + local.get 1 + f32.store offset=4 + local.get 8 + local.get 0 + f32.store local.get 8 local.get 5 f32.store offset=20 local.get 8 local.get 4 f32.store offset=16 - local.get 3 - local.get 2 - local.get 1 - local.get 0 + local.get 8 local.get 7 + f32.store offset=28 + local.get 8 local.get 6 - local.get 5 - local.get 4 + f32.store offset=24 + local.get 8 + local.get 8 + i64.load offset=24 + i64.store offset=56 + local.get 8 + local.get 8 + i64.load offset=16 + i64.store offset=48 + local.get 8 + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 1 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 0 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 48 + i32.add + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 48 + i32.add + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 48 + i32.add + i32.const 1 + i32.const 1048588 + call $>::index + f32.load + local.get 8 + i32.const 48 + i32.add + i32.const 0 + i32.const 1048588 + call $>::index + f32.load local.get 8 i32.const 64 i32.add @@ -117,25 +178,25 @@ i64.store offset=48 i64.const 10 call $intrinsics::felt::from_u64_unchecked - local.set 7 + local.set 3 i64.const 11 call $intrinsics::felt::from_u64_unchecked - local.set 6 + local.set 2 i64.const 12 call $intrinsics::felt::from_u64_unchecked - local.set 5 + local.set 1 local.get 8 i64.const 13 call $intrinsics::felt::from_u64_unchecked f32.store offset=76 local.get 8 - local.get 5 + local.get 1 f32.store offset=72 local.get 8 - local.get 6 + local.get 2 f32.store offset=68 local.get 8 - local.get 7 + local.get 3 f32.store offset=64 block ;; label = @1 local.get 8 @@ -144,7 +205,7 @@ local.get 8 i32.const 64 i32.add - call $::eq + call $::eq i32.eqz br_if 0 (;@1;) local.get 8 @@ -153,7 +214,7 @@ local.get 8 i32.const 16 i32.add - call $::eq + call $::eq i32.eqz br_if 0 (;@1;) local.get 9 @@ -171,4 +232,20 @@ (func $miden::core::collections::smt::get (;4;) (type 4) (param f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) + (func $>::index (;5;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir index 681f0a84f..a738915a1 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.hir +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.hir @@ -1,6 +1,6 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @rust_sdk_stdlib_smt_set { - private builtin.function @::eq(v0: i32, v1: i32) -> i32 { + private builtin.function @::eq(v0: i32, v1: i32) -> i32 { ^block4(v0: i32, v1: i32): v5 = hir.bitcast v0 : u32; v6 = arith.constant 4 : u32; @@ -9,8 +9,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : felt; v10 = hir.bitcast v1 : u32; - v334 = arith.constant 4 : u32; - v12 = arith.mod v10, v334 : u32; + v532 = arith.constant 4 : u32; + v12 = arith.mod v10, v532 : u32; hir.assertz v12 #[code = 250]; v13 = hir.int_to_ptr v10 : ptr; v14 = hir.load v13 : felt; @@ -22,101 +22,101 @@ builtin.component root_ns:root@1.0.0 { v19 = arith.zext v18 : u32; v20 = hir.bitcast v19 : i32; v22 = arith.neq v20, v3 : i1; - v312 = scf.if v22 : i32 { + v510 = scf.if v22 : i32 { ^block6: - v333 = arith.constant 0 : i32; - scf.yield v333; + v531 = arith.constant 0 : i32; + scf.yield v531; } else { ^block7: - v332 = arith.constant 4 : u32; + v530 = arith.constant 4 : u32; v23 = hir.bitcast v0 : u32; - v25 = arith.add v23, v332 : u32 #[overflow = checked]; - v331 = arith.constant 4 : u32; - v27 = arith.mod v25, v331 : u32; + v25 = arith.add v23, v530 : u32 #[overflow = checked]; + v529 = arith.constant 4 : u32; + v27 = arith.mod v25, v529 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; v29 = hir.load v28 : felt; - v330 = arith.constant 4 : u32; + v528 = arith.constant 4 : u32; v30 = hir.bitcast v1 : u32; - v32 = arith.add v30, v330 : u32 #[overflow = checked]; - v329 = arith.constant 4 : u32; - v34 = arith.mod v32, v329 : u32; + v32 = arith.add v30, v528 : u32 #[overflow = checked]; + v527 = arith.constant 4 : u32; + v34 = arith.mod v32, v527 : u32; hir.assertz v34 #[code = 250]; v35 = hir.int_to_ptr v32 : ptr; v36 = hir.load v35 : felt; - v327 = arith.constant 0 : i32; - v328 = arith.constant 1 : i32; + v525 = arith.constant 0 : i32; + v526 = arith.constant 1 : i32; v37 = arith.eq v29, v36 : i1; v38 = hir.cast v37 : i32; - v40 = arith.neq v38, v328 : i1; + v40 = arith.neq v38, v526 : i1; v41 = arith.zext v40 : u32; v42 = hir.bitcast v41 : i32; - v44 = arith.neq v42, v327 : i1; - v314 = scf.if v44 : i32 { - ^block22: - v326 = arith.constant 0 : i32; - scf.yield v326; + v44 = arith.neq v42, v525 : i1; + v512 = scf.if v44 : i32 { + ^block26: + v524 = arith.constant 0 : i32; + scf.yield v524; } else { ^block8: v46 = arith.constant 8 : u32; v45 = hir.bitcast v0 : u32; v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v325 = arith.constant 4 : u32; - v49 = arith.mod v47, v325 : u32; + v523 = arith.constant 4 : u32; + v49 = arith.mod v47, v523 : u32; hir.assertz v49 #[code = 250]; v50 = hir.int_to_ptr v47 : ptr; v51 = hir.load v50 : felt; - v324 = arith.constant 8 : u32; + v522 = arith.constant 8 : u32; v52 = hir.bitcast v1 : u32; - v54 = arith.add v52, v324 : u32 #[overflow = checked]; - v323 = arith.constant 4 : u32; - v56 = arith.mod v54, v323 : u32; + v54 = arith.add v52, v522 : u32 #[overflow = checked]; + v521 = arith.constant 4 : u32; + v56 = arith.mod v54, v521 : u32; hir.assertz v56 #[code = 250]; v57 = hir.int_to_ptr v54 : ptr; v58 = hir.load v57 : felt; - v321 = arith.constant 0 : i32; - v322 = arith.constant 1 : i32; + v519 = arith.constant 0 : i32; + v520 = arith.constant 1 : i32; v59 = arith.eq v51, v58 : i1; v60 = hir.cast v59 : i32; - v62 = arith.neq v60, v322 : i1; + v62 = arith.neq v60, v520 : i1; v63 = arith.zext v62 : u32; v64 = hir.bitcast v63 : i32; - v66 = arith.neq v64, v321 : i1; - v315 = scf.if v66 : i32 { - ^block21: - v320 = arith.constant 0 : i32; - scf.yield v320; + v66 = arith.neq v64, v519 : i1; + v513 = scf.if v66 : i32 { + ^block25: + v518 = arith.constant 0 : i32; + scf.yield v518; } else { ^block9: v68 = arith.constant 12 : u32; v67 = hir.bitcast v0 : u32; v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v319 = arith.constant 4 : u32; - v71 = arith.mod v69, v319 : u32; + v517 = arith.constant 4 : u32; + v71 = arith.mod v69, v517 : u32; hir.assertz v71 #[code = 250]; v72 = hir.int_to_ptr v69 : ptr; v73 = hir.load v72 : felt; - v318 = arith.constant 12 : u32; + v516 = arith.constant 12 : u32; v74 = hir.bitcast v1 : u32; - v76 = arith.add v74, v318 : u32 #[overflow = checked]; - v317 = arith.constant 4 : u32; - v78 = arith.mod v76, v317 : u32; + v76 = arith.add v74, v516 : u32 #[overflow = checked]; + v515 = arith.constant 4 : u32; + v78 = arith.mod v76, v515 : u32; hir.assertz v78 #[code = 250]; v79 = hir.int_to_ptr v76 : ptr; v80 = hir.load v79 : felt; - v316 = arith.constant 1 : i32; + v514 = arith.constant 1 : i32; v81 = arith.eq v73, v80 : i1; v82 = hir.cast v81 : i32; - v84 = arith.eq v82, v316 : i1; + v84 = arith.eq v82, v514 : i1; v85 = arith.zext v84 : u32; v86 = hir.bitcast v85 : i32; scf.yield v86; }; - scf.yield v315; + scf.yield v513; }; - scf.yield v314; + scf.yield v512; }; - builtin.ret v312; + builtin.ret v510; }; public builtin.function @entrypoint(v88: felt, v89: felt, v90: felt, v91: felt, v92: felt, v93: felt, v94: felt, v95: felt, v96: felt, v97: felt, v98: felt, v99: felt) { @@ -125,258 +125,497 @@ builtin.component root_ns:root@1.0.0 { v103 = hir.bitcast v102 : ptr; v104 = hir.load v103 : i32; v107 = arith.constant -32 : i32; - v105 = arith.constant 96 : i32; + v105 = arith.constant 128 : i32; v106 = arith.sub v104, v105 : i32 #[overflow = wrapping]; v108 = arith.band v106, v107 : i32; v109 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr v110 = hir.bitcast v109 : ptr; hir.store v110, v108; - v111 = arith.constant 64 : i32; - v112 = arith.add v108, v111 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/miden::core::collections::smt::set(v91, v90, v89, v88, v95, v94, v93, v92, v99, v98, v97, v96, v112) - v114 = arith.constant 88 : u32; - v113 = hir.bitcast v108 : u32; - v115 = arith.add v113, v114 : u32 #[overflow = checked]; - v116 = arith.constant 8 : u32; - v117 = arith.mod v115, v116 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - v119 = hir.load v118 : i64; - v121 = arith.constant 80 : u32; - v120 = hir.bitcast v108 : u32; - v122 = arith.add v120, v121 : u32 #[overflow = checked]; - v380 = arith.constant 8 : u32; - v124 = arith.mod v122, v380 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : i64; - v128 = arith.constant 72 : u32; - v127 = hir.bitcast v108 : u32; - v129 = arith.add v127, v128 : u32 #[overflow = checked]; - v379 = arith.constant 8 : u32; - v131 = arith.mod v129, v379 : u32; + v112 = arith.constant 12 : u32; + v111 = hir.bitcast v108 : u32; + v113 = arith.add v111, v112 : u32 #[overflow = checked]; + v114 = arith.constant 4 : u32; + v115 = arith.mod v113, v114 : u32; + hir.assertz v115 #[code = 250]; + v116 = hir.int_to_ptr v113 : ptr; + hir.store v116, v91; + v118 = arith.constant 8 : u32; + v117 = hir.bitcast v108 : u32; + v119 = arith.add v117, v118 : u32 #[overflow = checked]; + v630 = arith.constant 4 : u32; + v121 = arith.mod v119, v630 : u32; + hir.assertz v121 #[code = 250]; + v122 = hir.int_to_ptr v119 : ptr; + hir.store v122, v90; + v629 = arith.constant 4 : u32; + v123 = hir.bitcast v108 : u32; + v125 = arith.add v123, v629 : u32 #[overflow = checked]; + v628 = arith.constant 4 : u32; + v127 = arith.mod v125, v628 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + hir.store v128, v89; + v129 = hir.bitcast v108 : u32; + v627 = arith.constant 4 : u32; + v131 = arith.mod v129, v627 : u32; hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i64; - v135 = arith.constant 64 : u32; - v134 = hir.bitcast v108 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v378 = arith.constant 8 : u32; - v138 = arith.mod v136, v378 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : i64; - v344, v345 = arith.split v140 : felt, felt; - v145 = arith.constant 24 : u32; - v144 = hir.bitcast v108 : u32; - v146 = arith.add v144, v145 : u32 #[overflow = checked]; - v377 = arith.constant 8 : u32; - v148 = arith.mod v146, v377 : u32; - hir.assertz v148 #[code = 250]; - v346 = arith.join v345, v344 : i64; - v149 = hir.int_to_ptr v146 : ptr; - hir.store v149, v346; - v341, v342 = arith.split v133 : felt, felt; - v154 = arith.constant 16 : u32; - v153 = hir.bitcast v108 : u32; - v155 = arith.add v153, v154 : u32 #[overflow = checked]; - v376 = arith.constant 8 : u32; - v157 = arith.mod v155, v376 : u32; - hir.assertz v157 #[code = 250]; - v343 = arith.join v342, v341 : i64; - v158 = hir.int_to_ptr v155 : ptr; - hir.store v158, v343; - v338, v339 = arith.split v126 : felt, felt; - v163 = arith.constant 40 : u32; - v162 = hir.bitcast v108 : u32; - v164 = arith.add v162, v163 : u32 #[overflow = checked]; - v375 = arith.constant 8 : u32; - v166 = arith.mod v164, v375 : u32; - hir.assertz v166 #[code = 250]; - v340 = arith.join v339, v338 : i64; - v167 = hir.int_to_ptr v164 : ptr; - hir.store v167, v340; - v335, v336 = arith.split v119 : felt, felt; - v172 = arith.constant 32 : u32; - v171 = hir.bitcast v108 : u32; - v173 = arith.add v171, v172 : u32 #[overflow = checked]; - v374 = arith.constant 8 : u32; - v175 = arith.mod v173, v374 : u32; - hir.assertz v175 #[code = 250]; - v337 = arith.join v336, v335 : i64; - v176 = hir.int_to_ptr v173 : ptr; - hir.store v176, v337; - v186 = arith.constant 60 : u32; - v185 = hir.bitcast v108 : u32; - v187 = arith.add v185, v186 : u32 #[overflow = checked]; - v188 = arith.constant 4 : u32; - v189 = arith.mod v187, v188 : u32; - hir.assertz v189 #[code = 250]; - v101 = arith.constant 0 : i64; - v184 = arith.trunc v101 : felt; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v184; - v192 = arith.constant 56 : u32; - v191 = hir.bitcast v108 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; - v373 = arith.constant 4 : u32; - v195 = arith.mod v193, v373 : u32; - hir.assertz v195 #[code = 250]; - v372 = arith.constant 0 : i64; - v182 = arith.trunc v372 : felt; - v196 = hir.int_to_ptr v193 : ptr; - hir.store v196, v182; - v198 = arith.constant 52 : u32; - v197 = hir.bitcast v108 : u32; - v199 = arith.add v197, v198 : u32 #[overflow = checked]; - v371 = arith.constant 4 : u32; - v201 = arith.mod v199, v371 : u32; - hir.assertz v201 #[code = 250]; - v370 = arith.constant 0 : i64; - v180 = arith.trunc v370 : felt; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v180; - v204 = arith.constant 48 : u32; - v203 = hir.bitcast v108 : u32; - v205 = arith.add v203, v204 : u32 #[overflow = checked]; - v369 = arith.constant 4 : u32; - v207 = arith.mod v205, v369 : u32; - hir.assertz v207 #[code = 250]; - v368 = arith.constant 0 : i64; - v178 = arith.trunc v368 : felt; - v208 = hir.int_to_ptr v205 : ptr; - hir.store v208, v178; - v218 = arith.constant 76 : u32; - v217 = hir.bitcast v108 : u32; - v219 = arith.add v217, v218 : u32 #[overflow = checked]; - v367 = arith.constant 4 : u32; - v221 = arith.mod v219, v367 : u32; - hir.assertz v221 #[code = 250]; - v215 = arith.constant 900237903234600995 : i64; - v216 = arith.trunc v215 : felt; - v222 = hir.int_to_ptr v219 : ptr; - hir.store v222, v216; - v366 = arith.constant 72 : u32; - v223 = hir.bitcast v108 : u32; - v225 = arith.add v223, v366 : u32 #[overflow = checked]; - v365 = arith.constant 4 : u32; - v227 = arith.mod v225, v365 : u32; - hir.assertz v227 #[code = 250]; - v213 = arith.constant 4556576161526575002 : i64; - v214 = arith.trunc v213 : felt; - v228 = hir.int_to_ptr v225 : ptr; - hir.store v228, v214; - v230 = arith.constant 68 : u32; - v229 = hir.bitcast v108 : u32; - v231 = arith.add v229, v230 : u32 #[overflow = checked]; - v364 = arith.constant 4 : u32; - v233 = arith.mod v231, v364 : u32; - hir.assertz v233 #[code = 250]; - v211 = arith.constant 2968936853898945160 : i64; - v212 = arith.trunc v211 : felt; - v234 = hir.int_to_ptr v231 : ptr; - hir.store v234, v212; - v363 = arith.constant 64 : u32; - v235 = hir.bitcast v108 : u32; - v237 = arith.add v235, v363 : u32 #[overflow = checked]; - v362 = arith.constant 4 : u32; - v239 = arith.mod v237, v362 : u32; - hir.assertz v239 #[code = 250]; - v209 = arith.constant -8162549007765693629 : i64; - v210 = arith.trunc v209 : felt; - v240 = hir.int_to_ptr v237 : ptr; - hir.store v240, v210; - v243 = arith.constant 48 : i32; - v244 = arith.add v108, v243 : i32 #[overflow = wrapping]; - v241 = arith.constant 16 : i32; - v242 = arith.add v108, v241 : i32 #[overflow = wrapping]; - v245 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v242, v244) : i32 - v361 = arith.constant 0 : i32; + v132 = hir.int_to_ptr v129 : ptr; + hir.store v132, v88; + v134 = arith.constant 28 : u32; + v133 = hir.bitcast v108 : u32; + v135 = arith.add v133, v134 : u32 #[overflow = checked]; + v626 = arith.constant 4 : u32; + v137 = arith.mod v135, v626 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + hir.store v138, v95; + v140 = arith.constant 24 : u32; + v139 = hir.bitcast v108 : u32; + v141 = arith.add v139, v140 : u32 #[overflow = checked]; + v625 = arith.constant 4 : u32; + v143 = arith.mod v141, v625 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + hir.store v144, v94; + v146 = arith.constant 20 : u32; + v145 = hir.bitcast v108 : u32; + v147 = arith.add v145, v146 : u32 #[overflow = checked]; + v624 = arith.constant 4 : u32; + v149 = arith.mod v147, v624 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v93; + v152 = arith.constant 16 : u32; + v151 = hir.bitcast v108 : u32; + v153 = arith.add v151, v152 : u32 #[overflow = checked]; + v623 = arith.constant 4 : u32; + v155 = arith.mod v153, v623 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v92; + v158 = arith.constant 44 : u32; + v157 = hir.bitcast v108 : u32; + v159 = arith.add v157, v158 : u32 #[overflow = checked]; + v622 = arith.constant 4 : u32; + v161 = arith.mod v159, v622 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + hir.store v162, v99; + v164 = arith.constant 40 : u32; + v163 = hir.bitcast v108 : u32; + v165 = arith.add v163, v164 : u32 #[overflow = checked]; + v621 = arith.constant 4 : u32; + v167 = arith.mod v165, v621 : u32; + hir.assertz v167 #[code = 250]; + v168 = hir.int_to_ptr v165 : ptr; + hir.store v168, v98; + v170 = arith.constant 36 : u32; + v169 = hir.bitcast v108 : u32; + v171 = arith.add v169, v170 : u32 #[overflow = checked]; + v620 = arith.constant 4 : u32; + v173 = arith.mod v171, v620 : u32; + hir.assertz v173 #[code = 250]; + v174 = hir.int_to_ptr v171 : ptr; + hir.store v174, v97; + v176 = arith.constant 32 : u32; + v175 = hir.bitcast v108 : u32; + v177 = arith.add v175, v176 : u32 #[overflow = checked]; + v619 = arith.constant 4 : u32; + v179 = arith.mod v177, v619 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v96; + v182 = arith.constant 1048588 : i32; + v181 = arith.constant 3 : i32; + v183 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v108, v181, v182) : i32 + v184 = hir.bitcast v183 : u32; + v618 = arith.constant 4 : u32; + v186 = arith.mod v184, v618 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + v188 = hir.load v187 : felt; + v617 = arith.constant 1048588 : i32; + v189 = arith.constant 2 : i32; + v191 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v108, v189, v617) : i32 + v192 = hir.bitcast v191 : u32; + v616 = arith.constant 4 : u32; + v194 = arith.mod v192, v616 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + v196 = hir.load v195 : felt; + v615 = arith.constant 1048588 : i32; + v197 = arith.constant 1 : i32; + v199 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v108, v197, v615) : i32 + v200 = hir.bitcast v199 : u32; + v614 = arith.constant 4 : u32; + v202 = arith.mod v200, v614 : u32; + hir.assertz v202 #[code = 250]; + v203 = hir.int_to_ptr v200 : ptr; + v204 = hir.load v203 : felt; + v613 = arith.constant 1048588 : i32; v100 = arith.constant 0 : i32; - v247 = arith.eq v245, v100 : i1; - v248 = arith.zext v247 : u32; - v249 = hir.bitcast v248 : i32; - v251 = arith.neq v249, v361 : i1; - v351 = scf.if v251 : u32 { - ^block27: - v347 = arith.constant 0 : u32; - scf.yield v347; + v207 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v108, v100, v613) : i32 + v208 = hir.bitcast v207 : u32; + v612 = arith.constant 4 : u32; + v210 = arith.mod v208, v612 : u32; + hir.assertz v210 #[code = 250]; + v211 = hir.int_to_ptr v208 : ptr; + v212 = hir.load v211 : felt; + v610 = arith.constant 1048588 : i32; + v611 = arith.constant 3 : i32; + v213 = arith.constant 16 : i32; + v214 = arith.add v108, v213 : i32 #[overflow = wrapping]; + v217 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v214, v611, v610) : i32 + v218 = hir.bitcast v217 : u32; + v609 = arith.constant 4 : u32; + v220 = arith.mod v218, v609 : u32; + hir.assertz v220 #[code = 250]; + v221 = hir.int_to_ptr v218 : ptr; + v222 = hir.load v221 : felt; + v606 = arith.constant 1048588 : i32; + v607 = arith.constant 2 : i32; + v608 = arith.constant 16 : i32; + v224 = arith.add v108, v608 : i32 #[overflow = wrapping]; + v227 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v224, v607, v606) : i32 + v228 = hir.bitcast v227 : u32; + v605 = arith.constant 4 : u32; + v230 = arith.mod v228, v605 : u32; + hir.assertz v230 #[code = 250]; + v231 = hir.int_to_ptr v228 : ptr; + v232 = hir.load v231 : felt; + v602 = arith.constant 1048588 : i32; + v603 = arith.constant 1 : i32; + v604 = arith.constant 16 : i32; + v234 = arith.add v108, v604 : i32 #[overflow = wrapping]; + v237 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v234, v603, v602) : i32 + v238 = hir.bitcast v237 : u32; + v601 = arith.constant 4 : u32; + v240 = arith.mod v238, v601 : u32; + hir.assertz v240 #[code = 250]; + v241 = hir.int_to_ptr v238 : ptr; + v242 = hir.load v241 : felt; + v598 = arith.constant 1048588 : i32; + v599 = arith.constant 0 : i32; + v600 = arith.constant 16 : i32; + v244 = arith.add v108, v600 : i32 #[overflow = wrapping]; + v247 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v244, v599, v598) : i32 + v248 = hir.bitcast v247 : u32; + v597 = arith.constant 4 : u32; + v250 = arith.mod v248, v597 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + v252 = hir.load v251 : felt; + v595 = arith.constant 1048588 : i32; + v596 = arith.constant 3 : i32; + v253 = arith.constant 32 : i32; + v254 = arith.add v108, v253 : i32 #[overflow = wrapping]; + v257 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v254, v596, v595) : i32 + v258 = hir.bitcast v257 : u32; + v594 = arith.constant 4 : u32; + v260 = arith.mod v258, v594 : u32; + hir.assertz v260 #[code = 250]; + v261 = hir.int_to_ptr v258 : ptr; + v262 = hir.load v261 : felt; + v591 = arith.constant 1048588 : i32; + v592 = arith.constant 2 : i32; + v593 = arith.constant 32 : i32; + v264 = arith.add v108, v593 : i32 #[overflow = wrapping]; + v267 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v264, v592, v591) : i32 + v268 = hir.bitcast v267 : u32; + v590 = arith.constant 4 : u32; + v270 = arith.mod v268, v590 : u32; + hir.assertz v270 #[code = 250]; + v271 = hir.int_to_ptr v268 : ptr; + v272 = hir.load v271 : felt; + v587 = arith.constant 1048588 : i32; + v588 = arith.constant 1 : i32; + v589 = arith.constant 32 : i32; + v274 = arith.add v108, v589 : i32 #[overflow = wrapping]; + v277 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v274, v588, v587) : i32 + v278 = hir.bitcast v277 : u32; + v586 = arith.constant 4 : u32; + v280 = arith.mod v278, v586 : u32; + hir.assertz v280 #[code = 250]; + v281 = hir.int_to_ptr v278 : ptr; + v282 = hir.load v281 : felt; + v583 = arith.constant 1048588 : i32; + v584 = arith.constant 0 : i32; + v585 = arith.constant 32 : i32; + v284 = arith.add v108, v585 : i32 #[overflow = wrapping]; + v287 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/>::index(v284, v584, v583) : i32 + v288 = hir.bitcast v287 : u32; + v582 = arith.constant 4 : u32; + v290 = arith.mod v288, v582 : u32; + hir.assertz v290 #[code = 250]; + v291 = hir.int_to_ptr v288 : ptr; + v292 = hir.load v291 : felt; + v293 = arith.constant 96 : i32; + v294 = arith.add v108, v293 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/miden::core::collections::smt::set(v188, v196, v204, v212, v222, v232, v242, v252, v262, v272, v282, v292, v294) + v296 = arith.constant 120 : u32; + v295 = hir.bitcast v108 : u32; + v297 = arith.add v295, v296 : u32 #[overflow = checked]; + v581 = arith.constant 8 : u32; + v299 = arith.mod v297, v581 : u32; + hir.assertz v299 #[code = 250]; + v300 = hir.int_to_ptr v297 : ptr; + v301 = hir.load v300 : i64; + v303 = arith.constant 112 : u32; + v302 = hir.bitcast v108 : u32; + v304 = arith.add v302, v303 : u32 #[overflow = checked]; + v580 = arith.constant 8 : u32; + v306 = arith.mod v304, v580 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : i64; + v310 = arith.constant 104 : u32; + v309 = hir.bitcast v108 : u32; + v311 = arith.add v309, v310 : u32 #[overflow = checked]; + v579 = arith.constant 8 : u32; + v313 = arith.mod v311, v579 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + v315 = hir.load v314 : i64; + v317 = arith.constant 96 : u32; + v316 = hir.bitcast v108 : u32; + v318 = arith.add v316, v317 : u32 #[overflow = checked]; + v578 = arith.constant 8 : u32; + v320 = arith.mod v318, v578 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + v322 = hir.load v321 : i64; + v542, v543 = arith.split v322 : felt, felt; + v327 = arith.constant 56 : u32; + v326 = hir.bitcast v108 : u32; + v328 = arith.add v326, v327 : u32 #[overflow = checked]; + v577 = arith.constant 8 : u32; + v330 = arith.mod v328, v577 : u32; + hir.assertz v330 #[code = 250]; + v544 = arith.join v543, v542 : i64; + v331 = hir.int_to_ptr v328 : ptr; + hir.store v331, v544; + v539, v540 = arith.split v315 : felt, felt; + v336 = arith.constant 48 : u32; + v335 = hir.bitcast v108 : u32; + v337 = arith.add v335, v336 : u32 #[overflow = checked]; + v576 = arith.constant 8 : u32; + v339 = arith.mod v337, v576 : u32; + hir.assertz v339 #[code = 250]; + v541 = arith.join v540, v539 : i64; + v340 = hir.int_to_ptr v337 : ptr; + hir.store v340, v541; + v536, v537 = arith.split v308 : felt, felt; + v345 = arith.constant 72 : u32; + v344 = hir.bitcast v108 : u32; + v346 = arith.add v344, v345 : u32 #[overflow = checked]; + v575 = arith.constant 8 : u32; + v348 = arith.mod v346, v575 : u32; + hir.assertz v348 #[code = 250]; + v538 = arith.join v537, v536 : i64; + v349 = hir.int_to_ptr v346 : ptr; + hir.store v349, v538; + v533, v534 = arith.split v301 : felt, felt; + v354 = arith.constant 64 : u32; + v353 = hir.bitcast v108 : u32; + v355 = arith.add v353, v354 : u32 #[overflow = checked]; + v574 = arith.constant 8 : u32; + v357 = arith.mod v355, v574 : u32; + hir.assertz v357 #[code = 250]; + v535 = arith.join v534, v533 : i64; + v358 = hir.int_to_ptr v355 : ptr; + hir.store v358, v535; + v368 = arith.constant 92 : u32; + v367 = hir.bitcast v108 : u32; + v369 = arith.add v367, v368 : u32 #[overflow = checked]; + v573 = arith.constant 4 : u32; + v371 = arith.mod v369, v573 : u32; + hir.assertz v371 #[code = 250]; + v101 = arith.constant 0 : i64; + v366 = arith.trunc v101 : felt; + v372 = hir.int_to_ptr v369 : ptr; + hir.store v372, v366; + v374 = arith.constant 88 : u32; + v373 = hir.bitcast v108 : u32; + v375 = arith.add v373, v374 : u32 #[overflow = checked]; + v572 = arith.constant 4 : u32; + v377 = arith.mod v375, v572 : u32; + hir.assertz v377 #[code = 250]; + v571 = arith.constant 0 : i64; + v364 = arith.trunc v571 : felt; + v378 = hir.int_to_ptr v375 : ptr; + hir.store v378, v364; + v380 = arith.constant 84 : u32; + v379 = hir.bitcast v108 : u32; + v381 = arith.add v379, v380 : u32 #[overflow = checked]; + v570 = arith.constant 4 : u32; + v383 = arith.mod v381, v570 : u32; + hir.assertz v383 #[code = 250]; + v569 = arith.constant 0 : i64; + v362 = arith.trunc v569 : felt; + v384 = hir.int_to_ptr v381 : ptr; + hir.store v384, v362; + v386 = arith.constant 80 : u32; + v385 = hir.bitcast v108 : u32; + v387 = arith.add v385, v386 : u32 #[overflow = checked]; + v568 = arith.constant 4 : u32; + v389 = arith.mod v387, v568 : u32; + hir.assertz v389 #[code = 250]; + v567 = arith.constant 0 : i64; + v360 = arith.trunc v567 : felt; + v390 = hir.int_to_ptr v387 : ptr; + hir.store v390, v360; + v400 = arith.constant 108 : u32; + v399 = hir.bitcast v108 : u32; + v401 = arith.add v399, v400 : u32 #[overflow = checked]; + v566 = arith.constant 4 : u32; + v403 = arith.mod v401, v566 : u32; + hir.assertz v403 #[code = 250]; + v397 = arith.constant 900237903234600995 : i64; + v398 = arith.trunc v397 : felt; + v404 = hir.int_to_ptr v401 : ptr; + hir.store v404, v398; + v565 = arith.constant 104 : u32; + v405 = hir.bitcast v108 : u32; + v407 = arith.add v405, v565 : u32 #[overflow = checked]; + v564 = arith.constant 4 : u32; + v409 = arith.mod v407, v564 : u32; + hir.assertz v409 #[code = 250]; + v395 = arith.constant 4556576161526575002 : i64; + v396 = arith.trunc v395 : felt; + v410 = hir.int_to_ptr v407 : ptr; + hir.store v410, v396; + v412 = arith.constant 100 : u32; + v411 = hir.bitcast v108 : u32; + v413 = arith.add v411, v412 : u32 #[overflow = checked]; + v563 = arith.constant 4 : u32; + v415 = arith.mod v413, v563 : u32; + hir.assertz v415 #[code = 250]; + v393 = arith.constant 2968936853898945160 : i64; + v394 = arith.trunc v393 : felt; + v416 = hir.int_to_ptr v413 : ptr; + hir.store v416, v394; + v562 = arith.constant 96 : u32; + v417 = hir.bitcast v108 : u32; + v419 = arith.add v417, v562 : u32 #[overflow = checked]; + v561 = arith.constant 4 : u32; + v421 = arith.mod v419, v561 : u32; + hir.assertz v421 #[code = 250]; + v391 = arith.constant -8162549007765693629 : i64; + v392 = arith.trunc v391 : felt; + v422 = hir.int_to_ptr v419 : ptr; + hir.store v422, v392; + v425 = arith.constant 80 : i32; + v426 = arith.add v108, v425 : i32 #[overflow = wrapping]; + v423 = arith.constant 48 : i32; + v424 = arith.add v108, v423 : i32 #[overflow = wrapping]; + v427 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v424, v426) : i32 + v559 = arith.constant 0 : i32; + v560 = arith.constant 0 : i32; + v429 = arith.eq v427, v560 : i1; + v430 = arith.zext v429 : u32; + v431 = hir.bitcast v430 : i32; + v433 = arith.neq v431, v559 : i1; + v549 = scf.if v433 : u32 { + ^block31: + v545 = arith.constant 0 : u32; + scf.yield v545; } else { ^block13: - v360 = arith.constant 64 : i32; - v255 = arith.add v108, v360 : i32 #[overflow = wrapping]; - v252 = arith.constant 32 : i32; - v253 = arith.add v108, v252 : i32 #[overflow = wrapping]; - v256 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v253, v255) : i32 - v358 = arith.constant 0 : i32; - v359 = arith.constant 0 : i32; - v258 = arith.eq v256, v359 : i1; - v259 = arith.zext v258 : u32; - v260 = hir.bitcast v259 : i32; - v262 = arith.neq v260, v358 : i1; - scf.if v262{ - ^block26: + v558 = arith.constant 96 : i32; + v437 = arith.add v108, v558 : i32 #[overflow = wrapping]; + v434 = arith.constant 64 : i32; + v435 = arith.add v108, v434 : i32 #[overflow = wrapping]; + v438 = hir.exec @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/::eq(v435, v437) : i32 + v556 = arith.constant 0 : i32; + v557 = arith.constant 0 : i32; + v440 = arith.eq v438, v557 : i1; + v441 = arith.zext v440 : u32; + v442 = hir.bitcast v441 : i32; + v444 = arith.neq v442, v556 : i1; + scf.if v444{ + ^block30: scf.yield ; } else { ^block14: - v263 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr - v264 = hir.bitcast v263 : ptr; - hir.store v264, v104; + v445 = builtin.global_symbol @root_ns:root@1.0.0/rust_sdk_stdlib_smt_set/__stack_pointer : ptr + v446 = hir.bitcast v445 : ptr; + hir.store v446, v104; scf.yield ; }; - v349 = arith.constant 1 : u32; - v357 = arith.constant 0 : u32; - v355 = cf.select v262, v357, v349 : u32; - scf.yield v355; + v547 = arith.constant 1 : u32; + v555 = arith.constant 0 : u32; + v553 = cf.select v444, v555, v547 : u32; + scf.yield v553; }; - v356 = arith.constant 0 : u32; - v354 = arith.eq v351, v356 : i1; - cf.cond_br v354 ^block12, ^block29; + v554 = arith.constant 0 : u32; + v552 = arith.eq v549, v554 : i1; + cf.cond_br v552 ^block12, ^block33; ^block12: ub.unreachable ; - ^block29: + ^block33: builtin.ret ; }; - private builtin.function @miden::core::collections::smt::set(v265: felt, v266: felt, v267: felt, v268: felt, v269: felt, v270: felt, v271: felt, v272: felt, v273: felt, v274: felt, v275: felt, v276: felt, v277: i32) { - ^block15(v265: felt, v266: felt, v267: felt, v268: felt, v269: felt, v270: felt, v271: felt, v272: felt, v273: felt, v274: felt, v275: felt, v276: felt, v277: i32): - v278, v279, v280, v281, v282, v283, v284, v285 = hir.exec @miden/core/collections/smt/set(v265, v266, v267, v268, v269, v270, v271, v272, v273, v274, v275, v276) : felt, felt, felt, felt, felt, felt, felt, felt - v286 = hir.bitcast v277 : u32; - v287 = hir.int_to_ptr v286 : ptr; - hir.store v287, v278; - v288 = arith.constant 4 : u32; - v289 = arith.add v286, v288 : u32 #[overflow = checked]; - v290 = hir.int_to_ptr v289 : ptr; - hir.store v290, v279; - v291 = arith.constant 8 : u32; - v292 = arith.add v286, v291 : u32 #[overflow = checked]; - v293 = hir.int_to_ptr v292 : ptr; - hir.store v293, v280; - v294 = arith.constant 12 : u32; - v295 = arith.add v286, v294 : u32 #[overflow = checked]; - v296 = hir.int_to_ptr v295 : ptr; - hir.store v296, v281; - v297 = arith.constant 16 : u32; - v298 = arith.add v286, v297 : u32 #[overflow = checked]; - v299 = hir.int_to_ptr v298 : ptr; - hir.store v299, v282; - v300 = arith.constant 20 : u32; - v301 = arith.add v286, v300 : u32 #[overflow = checked]; - v302 = hir.int_to_ptr v301 : ptr; - hir.store v302, v283; - v303 = arith.constant 24 : u32; - v304 = arith.add v286, v303 : u32 #[overflow = checked]; - v305 = hir.int_to_ptr v304 : ptr; - hir.store v305, v284; - v306 = arith.constant 28 : u32; - v307 = arith.add v286, v306 : u32 #[overflow = checked]; - v308 = hir.int_to_ptr v307 : ptr; - hir.store v308, v285; + private builtin.function @miden::core::collections::smt::set(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: i32) { + ^block15(v447: felt, v448: felt, v449: felt, v450: felt, v451: felt, v452: felt, v453: felt, v454: felt, v455: felt, v456: felt, v457: felt, v458: felt, v459: i32): + v460, v461, v462, v463, v464, v465, v466, v467 = hir.exec @miden/core/collections/smt/set(v447, v448, v449, v450, v451, v452, v453, v454, v455, v456, v457, v458) : felt, felt, felt, felt, felt, felt, felt, felt + v468 = hir.bitcast v459 : u32; + v469 = hir.int_to_ptr v468 : ptr; + hir.store v469, v460; + v470 = arith.constant 4 : u32; + v471 = arith.add v468, v470 : u32 #[overflow = checked]; + v472 = hir.int_to_ptr v471 : ptr; + hir.store v472, v461; + v473 = arith.constant 8 : u32; + v474 = arith.add v468, v473 : u32 #[overflow = checked]; + v475 = hir.int_to_ptr v474 : ptr; + hir.store v475, v462; + v476 = arith.constant 12 : u32; + v477 = arith.add v468, v476 : u32 #[overflow = checked]; + v478 = hir.int_to_ptr v477 : ptr; + hir.store v478, v463; + v479 = arith.constant 16 : u32; + v480 = arith.add v468, v479 : u32 #[overflow = checked]; + v481 = hir.int_to_ptr v480 : ptr; + hir.store v481, v464; + v482 = arith.constant 20 : u32; + v483 = arith.add v468, v482 : u32 #[overflow = checked]; + v484 = hir.int_to_ptr v483 : ptr; + hir.store v484, v465; + v485 = arith.constant 24 : u32; + v486 = arith.add v468, v485 : u32 #[overflow = checked]; + v487 = hir.int_to_ptr v486 : ptr; + hir.store v487, v466; + v488 = arith.constant 28 : u32; + v489 = arith.add v468, v488 : u32 #[overflow = checked]; + v490 = hir.int_to_ptr v489 : ptr; + hir.store v490, v467; builtin.ret ; }; + private builtin.function @>::index(v491: i32, v492: i32, v493: i32) -> i32 { + ^block21(v491: i32, v492: i32, v493: i32): + v501 = arith.constant 0 : i32; + v632 = arith.constant 3 : u32; + v496 = hir.bitcast v492 : u32; + v498 = arith.gt v496, v632 : i1; + v499 = arith.zext v498 : u32; + v500 = hir.bitcast v499 : i32; + v502 = arith.neq v500, v501 : i1; + cf.cond_br v502 ^block23, ^block24; + ^block23: + ub.unreachable ; + ^block24: + v631 = arith.constant 2 : u32; + v505 = arith.shl v492, v631 : i32; + v506 = arith.add v491, v505 : i32 #[overflow = wrapping]; + builtin.ret v506; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; }; }; \ No newline at end of file diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm index ea26886eb..9c0c117b6 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.masm +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.masm @@ -5,15 +5,23 @@ proc init trace.240 exec.::intrinsics::mem::heap_init trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::miden::core::mem::pipe_preimage_to_memory + trace.252 + drop push.1048576 u32assert - mem_store.278528 + mem_store.278536 end # mod ::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set @callconv("C") -proc ::eq( +proc ::eq( i32, i32 ) -> i32 @@ -207,7 +215,7 @@ pub proc entrypoint( felt, felt ) - push.1114112 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -216,12 +224,12 @@ pub proc entrypoint( trace.252 nop push.4294967264 - push.96 + push.128 dup.2 swap.1 u32wrapping_sub u32and - push.1114112 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -231,27 +239,524 @@ pub proc entrypoint( exec.::intrinsics::mem::store_sw trace.252 nop - push.64 + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.6 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + dup.0 + push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.6 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.44 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.6 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.40 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.36 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.32 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.1048588 + push.3 + dup.2 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.2 + dup.3 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + dup.4 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + dup.5 + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.3 + push.16 + dup.7 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.2 + push.16 + dup.8 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + push.16 + dup.9 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + push.16 + dup.10 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.3 + push.32 + dup.11 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.2 + push.32 + dup.12 u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 swap.1 - swap.13 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.1 + push.32 + dup.13 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.1048588 + push.0 + push.32 + dup.14 + u32wrapping_add + trace.240 + nop + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::>::index + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.96 + dup.13 + u32wrapping_add + movup.5 + swap.7 + movdn.5 + movup.4 + swap.8 + movdn.4 + movup.3 swap.9 - swap.5 + movdn.3 + movup.2 + swap.10 + movdn.2 + swap.1 + swap.11 swap.1 swap.12 - swap.10 - swap.4 - swap.2 - swap.14 - swap.8 - swap.6 trace.240 nop exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::"miden::core::collections::smt::set" trace.252 nop - push.88 + push.120 dup.1 add u32assert @@ -269,7 +774,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.80 + push.112 dup.3 add u32assert @@ -287,7 +792,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.72 + push.104 dup.5 add u32assert @@ -305,7 +810,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.64 + push.96 dup.7 add u32assert @@ -323,7 +828,7 @@ pub proc entrypoint( trace.252 nop swap.1 - push.24 + push.56 dup.9 add u32assert @@ -344,7 +849,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.16 + push.48 dup.7 add u32assert @@ -365,7 +870,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.40 + push.72 dup.5 add u32assert @@ -386,7 +891,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.32 + push.64 dup.3 add u32assert @@ -407,7 +912,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_dw trace.252 nop - push.60 + push.92 dup.1 add u32assert @@ -429,7 +934,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.56 + push.88 dup.1 add u32assert @@ -451,7 +956,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.52 + push.84 dup.1 add u32assert @@ -473,7 +978,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.48 + push.80 dup.1 add u32assert @@ -495,7 +1000,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.76 + push.108 dup.1 add u32assert @@ -517,7 +1022,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.72 + push.104 dup.1 add u32assert @@ -539,7 +1044,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.68 + push.100 dup.1 add u32assert @@ -561,7 +1066,7 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.64 + push.96 dup.1 add u32assert @@ -583,15 +1088,15 @@ pub proc entrypoint( exec.::intrinsics::mem::store_felt trace.252 nop - push.48 + push.80 dup.1 u32wrapping_add - push.16 + push.48 dup.2 u32wrapping_add trace.240 nop - exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::::eq + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::::eq trace.252 nop push.0 @@ -604,15 +1109,15 @@ pub proc entrypoint( drop push.0 else - push.64 + push.96 dup.1 u32wrapping_add - push.32 + push.64 movup.2 u32wrapping_add trace.240 nop - exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::::eq + exec.::"root_ns:root@1.0.0"::rust_sdk_stdlib_smt_set::::eq trace.252 nop push.0 @@ -625,7 +1130,7 @@ pub proc entrypoint( swap.1 drop else - push.1114112 + push.1114144 movup.2 swap.1 u32divmod.4 @@ -773,3 +1278,31 @@ proc miden::core::collections::smt::set( nop end +@callconv("C") +proc >::index( + i32, + i32, + i32 +) -> i32 + movup.2 + drop + push.0 + push.3 + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + push.0 + assert + else + push.2 + movup.2 + swap.1 + u32shl + u32wrapping_add + end +end + diff --git a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat index 9322933a8..2d7d2c5f2 100644 --- a/tests/integration/expected/rust_sdk_stdlib_smt_set.wat +++ b/tests/integration/expected/rust_sdk_stdlib_smt_set.wat @@ -4,12 +4,13 @@ (type (;2;) (func (param f32 f32) (result i32))) (type (;3;) (func (param i64) (result f32))) (type (;4;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32))) + (type (;5;) (func (param i32 i32 i32) (result i32))) (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 "entrypoint" (func $entrypoint)) - (func $::eq (;0;) (type 0) (param i32 i32) (result i32) + (func $::eq (;0;) (type 0) (param i32 i32) (result i32) (local i32) i32.const 0 local.set 2 @@ -55,119 +56,219 @@ local.tee 12 local.set 13 local.get 12 - i32.const 96 + i32.const 128 i32.sub i32.const -32 i32.and local.tee 12 global.set $__stack_pointer + local.get 12 local.get 3 + f32.store offset=12 + local.get 12 local.get 2 + f32.store offset=8 + local.get 12 local.get 1 + f32.store offset=4 + local.get 12 local.get 0 + f32.store + local.get 12 local.get 7 + f32.store offset=28 + local.get 12 local.get 6 + f32.store offset=24 + local.get 12 local.get 5 + f32.store offset=20 + local.get 12 local.get 4 + f32.store offset=16 + local.get 12 local.get 11 + f32.store offset=44 + local.get 12 local.get 10 + f32.store offset=40 + local.get 12 local.get 9 + f32.store offset=36 + local.get 12 local.get 8 + f32.store offset=32 + local.get 12 + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 1 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 0 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 16 + i32.add + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 16 + i32.add + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 16 + i32.add + i32.const 1 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 16 + i32.add + i32.const 0 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 32 + i32.add + i32.const 3 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 32 + i32.add + i32.const 2 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 32 + i32.add + i32.const 1 + i32.const 1048588 + call $>::index + f32.load local.get 12 - i32.const 64 + i32.const 32 + i32.add + i32.const 0 + i32.const 1048588 + call $>::index + f32.load + local.get 12 + i32.const 96 i32.add call $miden::core::collections::smt::set local.get 12 - i64.load offset=88 + i64.load offset=120 local.set 14 local.get 12 - i64.load offset=80 + i64.load offset=112 local.set 15 local.get 12 - i64.load offset=72 + i64.load offset=104 local.set 16 local.get 12 local.get 12 - i64.load offset=64 + i64.load offset=96 i64.const 32 i64.rotl - i64.store offset=24 + i64.store offset=56 local.get 12 local.get 16 i64.const 32 i64.rotl - i64.store offset=16 + i64.store offset=48 local.get 12 local.get 15 i64.const 32 i64.rotl - i64.store offset=40 + i64.store offset=72 local.get 12 local.get 14 i64.const 32 i64.rotl - i64.store offset=32 + i64.store offset=64 i64.const 0 call $intrinsics::felt::from_u64_unchecked - local.set 8 + local.set 3 i64.const 0 call $intrinsics::felt::from_u64_unchecked - local.set 9 + local.set 2 i64.const 0 call $intrinsics::felt::from_u64_unchecked - local.set 10 + local.set 1 local.get 12 i64.const 0 call $intrinsics::felt::from_u64_unchecked - f32.store offset=60 + f32.store offset=92 local.get 12 - local.get 10 - f32.store offset=56 + local.get 1 + f32.store offset=88 local.get 12 - local.get 9 - f32.store offset=52 + local.get 2 + f32.store offset=84 local.get 12 - local.get 8 - f32.store offset=48 + local.get 3 + f32.store offset=80 i64.const -8162549007765693629 call $intrinsics::felt::from_u64_unchecked - local.set 8 + local.set 3 i64.const 2968936853898945160 call $intrinsics::felt::from_u64_unchecked - local.set 9 + local.set 2 i64.const 4556576161526575002 call $intrinsics::felt::from_u64_unchecked - local.set 10 + local.set 1 local.get 12 i64.const 900237903234600995 call $intrinsics::felt::from_u64_unchecked - f32.store offset=76 + f32.store offset=108 local.get 12 - local.get 10 - f32.store offset=72 + local.get 1 + f32.store offset=104 local.get 12 - local.get 9 - f32.store offset=68 + local.get 2 + f32.store offset=100 local.get 12 - local.get 8 - f32.store offset=64 + local.get 3 + f32.store offset=96 block ;; label = @1 local.get 12 - i32.const 16 + i32.const 48 i32.add local.get 12 - i32.const 48 + i32.const 80 i32.add - call $::eq + call $::eq i32.eqz br_if 0 (;@1;) local.get 12 - i32.const 32 + i32.const 64 i32.add local.get 12 - i32.const 64 + i32.const 96 i32.add - call $::eq + call $::eq i32.eqz br_if 0 (;@1;) local.get 13 @@ -185,4 +286,20 @@ (func $miden::core::collections::smt::set (;4;) (type 4) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) unreachable ) + (func $>::index (;5;) (type 5) (param i32 i32 i32) (result i32) + block ;; label = @1 + local.get 1 + i32.const 3 + i32.gt_u + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.const 2 + i32.shl + i32.add + return + end + unreachable + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") ) diff --git a/tests/integration/expected/vec_alloc_vec.hir b/tests/integration/expected/vec_alloc_vec.hir index c806cbc6c..66cc7766a 100644 --- a/tests/integration/expected/vec_alloc_vec.hir +++ b/tests/integration/expected/vec_alloc_vec.hir @@ -26,20 +26,20 @@ builtin.component root_ns:root@1.0.0 { v20 = arith.constant 4 : i32; v19 = arith.constant 12 : i32; v21 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_alloc(v19, v20) : i32 - v337 = arith.constant 0 : i32; + v334 = arith.constant 0 : i32; v10 = arith.constant 0 : i32; v23 = arith.eq v21, v10 : i1; v24 = arith.zext v23 : u32; v25 = hir.bitcast v24 : i32; - v27 = arith.neq v25, v337 : i1; - v310, v311 = scf.if v27 : felt, u32 { + v27 = arith.neq v25, v334 : i1; + v307, v308 = scf.if v27 : felt, u32 { ^block11: - v335 = arith.constant 12 : i32; - v336 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::alloc::handle_alloc_error(v336, v335) - v302 = arith.constant 0 : u32; - v306 = ub.poison felt : felt; - scf.yield v306, v302; + v332 = arith.constant 12 : i32; + v333 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::alloc::handle_alloc_error(v333, v332) + v299 = arith.constant 0 : u32; + v303 = ub.poison felt : felt; + scf.yield v303, v299; } else { ^block12: v35 = arith.constant 8 : u32; @@ -48,96 +48,99 @@ builtin.component root_ns:root@1.0.0 { v37 = arith.constant 4 : u32; v38 = arith.mod v36, v37 : u32; hir.assertz v38 #[code = 250]; - v299 = arith.constant 3 : felt; + v32 = arith.constant 3 : i64; + v33 = arith.trunc v32 : felt; v39 = hir.int_to_ptr v36 : ptr; - hir.store v39, v299; - v334 = arith.constant 4 : u32; + hir.store v39, v33; + v331 = arith.constant 4 : u32; v40 = hir.bitcast v21 : u32; - v42 = arith.add v40, v334 : u32 #[overflow = checked]; - v333 = arith.constant 4 : u32; - v44 = arith.mod v42, v333 : u32; + v42 = arith.add v40, v331 : u32 #[overflow = checked]; + v330 = arith.constant 4 : u32; + v44 = arith.mod v42, v330 : u32; hir.assertz v44 #[code = 250]; - v300 = arith.constant 2 : felt; + v30 = arith.constant 2 : i64; + v31 = arith.trunc v30 : felt; v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v300; + hir.store v45, v31; v46 = hir.bitcast v21 : u32; - v332 = arith.constant 4 : u32; - v48 = arith.mod v46, v332 : u32; + v329 = arith.constant 4 : u32; + v48 = arith.mod v46, v329 : u32; hir.assertz v48 #[code = 250]; - v301 = arith.constant 1 : felt; + v28 = arith.constant 1 : i64; + v29 = arith.trunc v28 : felt; v49 = hir.int_to_ptr v46 : ptr; - hir.store v49, v301; + hir.store v49, v29; v52 = arith.constant 12 : u32; v51 = hir.bitcast v16 : u32; v53 = arith.add v51, v52 : u32 #[overflow = checked]; - v331 = arith.constant 4 : u32; - v55 = arith.mod v53, v331 : u32; + v328 = arith.constant 4 : u32; + v55 = arith.mod v53, v328 : u32; hir.assertz v55 #[code = 250]; - v32 = arith.constant 3 : i32; + v50 = arith.constant 3 : i32; v56 = hir.int_to_ptr v53 : ptr; - hir.store v56, v32; - v330 = arith.constant 8 : u32; + hir.store v56, v50; + v327 = arith.constant 8 : u32; v57 = hir.bitcast v16 : u32; - v59 = arith.add v57, v330 : u32 #[overflow = checked]; - v329 = arith.constant 4 : u32; - v61 = arith.mod v59, v329 : u32; + v59 = arith.add v57, v327 : u32 #[overflow = checked]; + v326 = arith.constant 4 : u32; + v61 = arith.mod v59, v326 : u32; hir.assertz v61 #[code = 250]; v62 = hir.int_to_ptr v59 : ptr; hir.store v62, v21; - v328 = arith.constant 4 : u32; + v325 = arith.constant 4 : u32; v64 = hir.bitcast v16 : u32; - v66 = arith.add v64, v328 : u32 #[overflow = checked]; - v327 = arith.constant 4 : u32; - v68 = arith.mod v66, v327 : u32; + v66 = arith.add v64, v325 : u32 #[overflow = checked]; + v324 = arith.constant 4 : u32; + v68 = arith.mod v66, v324 : u32; hir.assertz v68 #[code = 250]; - v326 = arith.constant 3 : i32; + v323 = arith.constant 3 : i32; v69 = hir.int_to_ptr v66 : ptr; - hir.store v69, v326; - v325 = arith.constant 0 : i32; + hir.store v69, v323; + v322 = arith.constant 0 : i32; v298 = arith.constant 3 : u32; v71 = hir.bitcast v8 : u32; v73 = arith.gte v71, v298 : i1; v74 = arith.zext v73 : u32; v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v325 : i1; - v316 = scf.if v77 : felt { + v77 = arith.neq v75, v322 : i1; + v313 = scf.if v77 : felt { ^block46: - v324 = ub.poison felt : felt; - scf.yield v324; + v321 = ub.poison felt : felt; + scf.yield v321; } else { ^block13: v297 = arith.constant 2 : u32; v80 = arith.shl v8, v297 : i32; v81 = arith.add v21, v80 : i32 #[overflow = wrapping]; v82 = hir.bitcast v81 : u32; - v323 = arith.constant 4 : u32; - v84 = arith.mod v82, v323 : u32; + v320 = arith.constant 4 : u32; + v84 = arith.mod v82, v320 : u32; hir.assertz v84 #[code = 250]; v85 = hir.int_to_ptr v82 : ptr; v86 = hir.load v85 : felt; - v321 = arith.constant 4 : i32; - v322 = arith.constant 4 : i32; - v88 = arith.add v16, v322 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v88, v321, v321) - v320 = arith.constant 16 : i32; - v92 = arith.add v16, v320 : i32 #[overflow = wrapping]; + v318 = arith.constant 4 : i32; + v319 = arith.constant 4 : i32; + v88 = arith.add v16, v319 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v88, v318, v318) + v317 = arith.constant 16 : i32; + v92 = arith.add v16, v317 : i32 #[overflow = wrapping]; v93 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v94 = hir.bitcast v93 : ptr; hir.store v94, v92; scf.yield v86; }; - v307 = arith.constant 1 : u32; - v319 = arith.constant 0 : u32; - v317 = cf.select v77, v319, v307 : u32; - scf.yield v316, v317; + v304 = arith.constant 1 : u32; + v316 = arith.constant 0 : u32; + v314 = cf.select v77, v316, v304 : u32; + scf.yield v313, v314; }; - v318 = arith.constant 0 : u32; - v315 = arith.eq v311, v318 : i1; - cf.cond_br v315 ^block10, ^block48(v310); + v315 = arith.constant 0 : u32; + v312 = arith.eq v308, v315 : i1; + cf.cond_br v312 ^block10, ^block48(v307); ^block10: ub.unreachable ; - ^block48(v303: felt): - builtin.ret v303; + ^block48(v300: felt): + builtin.ret v300; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -149,27 +152,27 @@ builtin.component root_ns:root@1.0.0 { ^block16(v97: i32, v98: i32, v99: i32): v102 = arith.constant 16 : i32; v101 = arith.constant 0 : i32; - v339 = arith.constant 16 : u32; + v336 = arith.constant 16 : u32; v104 = hir.bitcast v98 : u32; - v106 = arith.gt v104, v339 : i1; + v106 = arith.gt v104, v336 : i1; v107 = arith.zext v106 : u32; v108 = hir.bitcast v107 : i32; v110 = arith.neq v108, v101 : i1; v111 = cf.select v110, v98, v102 : i32; - v379 = arith.constant 0 : i32; + v376 = arith.constant 0 : i32; v112 = arith.constant -1 : i32; v113 = arith.add v111, v112 : i32 #[overflow = wrapping]; v114 = arith.band v111, v113 : i32; - v116 = arith.neq v114, v379 : i1; - v348, v349 = scf.if v116 : i32, u32 { + v116 = arith.neq v114, v376 : i1; + v345, v346 = scf.if v116 : i32, u32 { ^block53: - v340 = arith.constant 0 : u32; - v344 = ub.poison i32 : i32; - scf.yield v344, v340; + v337 = arith.constant 0 : u32; + v341 = ub.poison i32 : i32; + scf.yield v341, v337; } else { ^block19: v118 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::max(v98, v111) : i32 - v378 = arith.constant 0 : i32; + v375 = arith.constant 0 : i32; v117 = arith.constant -2147483648 : i32; v119 = arith.sub v117, v118 : i32 #[overflow = wrapping]; v121 = hir.bitcast v119 : u32; @@ -177,18 +180,18 @@ builtin.component root_ns:root@1.0.0 { v122 = arith.gt v120, v121 : i1; v123 = arith.zext v122 : u32; v124 = hir.bitcast v123 : i32; - v126 = arith.neq v124, v378 : i1; - v363 = scf.if v126 : i32 { + v126 = arith.neq v124, v375 : i1; + v360 = scf.if v126 : i32 { ^block52: - v377 = ub.poison i32 : i32; - scf.yield v377; + v374 = ub.poison i32 : i32; + scf.yield v374; } else { ^block20: - v375 = arith.constant 0 : i32; - v132 = arith.sub v375, v118 : i32 #[overflow = wrapping]; - v376 = arith.constant -1 : i32; + v372 = arith.constant 0 : i32; + v132 = arith.sub v372, v118 : i32 #[overflow = wrapping]; + v373 = arith.constant -1 : i32; v128 = arith.add v99, v118 : i32 #[overflow = wrapping]; - v130 = arith.add v128, v376 : i32 #[overflow = wrapping]; + v130 = arith.add v128, v373 : i32 #[overflow = wrapping]; v133 = arith.band v130, v132 : i32; v134 = hir.bitcast v97 : u32; v135 = arith.constant 4 : u32; @@ -196,8 +199,8 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v136 #[code = 250]; v137 = hir.int_to_ptr v134 : ptr; v138 = hir.load v137 : i32; - v374 = arith.constant 0 : i32; - v140 = arith.neq v138, v374 : i1; + v371 = arith.constant 0 : i32; + v140 = arith.neq v138, v371 : i1; scf.if v140{ ^block51: scf.yield ; @@ -206,41 +209,41 @@ builtin.component root_ns:root@1.0.0 { v141 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::mem::heap_base() : i32 v142 = hir.mem_size : u32; v148 = hir.bitcast v97 : u32; - v373 = arith.constant 4 : u32; - v150 = arith.mod v148, v373 : u32; + v370 = arith.constant 4 : u32; + v150 = arith.mod v148, v370 : u32; hir.assertz v150 #[code = 250]; - v372 = arith.constant 16 : u32; + v369 = arith.constant 16 : u32; v143 = hir.bitcast v142 : i32; - v146 = arith.shl v143, v372 : i32; + v146 = arith.shl v143, v369 : i32; v147 = arith.add v141, v146 : i32 #[overflow = wrapping]; v151 = hir.int_to_ptr v148 : ptr; hir.store v151, v147; scf.yield ; }; v154 = hir.bitcast v97 : u32; - v371 = arith.constant 4 : u32; - v156 = arith.mod v154, v371 : u32; + v368 = arith.constant 4 : u32; + v156 = arith.mod v154, v368 : u32; hir.assertz v156 #[code = 250]; v157 = hir.int_to_ptr v154 : ptr; v158 = hir.load v157 : i32; - v369 = arith.constant 0 : i32; - v370 = arith.constant -1 : i32; - v160 = arith.bxor v158, v370 : i32; + v366 = arith.constant 0 : i32; + v367 = arith.constant -1 : i32; + v160 = arith.bxor v158, v367 : i32; v162 = hir.bitcast v160 : u32; v161 = hir.bitcast v133 : u32; v163 = arith.gt v161, v162 : i1; v164 = arith.zext v163 : u32; v165 = hir.bitcast v164 : i32; - v167 = arith.neq v165, v369 : i1; - v362 = scf.if v167 : i32 { + v167 = arith.neq v165, v366 : i1; + v359 = scf.if v167 : i32 { ^block23: - v368 = arith.constant 0 : i32; - scf.yield v368; + v365 = arith.constant 0 : i32; + scf.yield v365; } else { ^block24: v169 = hir.bitcast v97 : u32; - v367 = arith.constant 4 : u32; - v171 = arith.mod v169, v367 : u32; + v364 = arith.constant 4 : u32; + v171 = arith.mod v169, v364 : u32; hir.assertz v171 #[code = 250]; v168 = arith.add v158, v133 : i32 #[overflow = wrapping]; v172 = hir.int_to_ptr v169 : ptr; @@ -248,20 +251,20 @@ builtin.component root_ns:root@1.0.0 { v174 = arith.add v158, v118 : i32 #[overflow = wrapping]; scf.yield v174; }; - scf.yield v362; + scf.yield v359; }; - v345 = arith.constant 1 : u32; - v366 = arith.constant 0 : u32; - v364 = cf.select v126, v366, v345 : u32; - scf.yield v363, v364; + v342 = arith.constant 1 : u32; + v363 = arith.constant 0 : u32; + v361 = cf.select v126, v363, v342 : u32; + scf.yield v360, v361; }; - v365 = arith.constant 0 : u32; - v361 = arith.eq v349, v365 : i1; - cf.cond_br v361 ^block18, ^block55(v348); + v362 = arith.constant 0 : u32; + v358 = arith.eq v346, v362 : i1; + cf.cond_br v358 ^block18, ^block55(v345); ^block18: ub.unreachable ; - ^block55(v341: i32): - builtin.ret v341; + ^block55(v338: i32): + builtin.ret v338; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -296,38 +299,38 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v198 #[code = 250]; v199 = hir.int_to_ptr v196 : ptr; v200 = hir.load v199 : i32; - v386 = arith.constant 0 : i32; + v383 = arith.constant 0 : i32; v184 = arith.constant 0 : i32; v202 = arith.eq v200, v184 : i1; v203 = arith.zext v202 : u32; v204 = hir.bitcast v203 : i32; - v206 = arith.neq v204, v386 : i1; + v206 = arith.neq v204, v383 : i1; scf.if v206{ ^block59: scf.yield ; } else { ^block34: - v385 = arith.constant 4 : u32; + v382 = arith.constant 4 : u32; v207 = hir.bitcast v189 : u32; - v209 = arith.add v207, v385 : u32 #[overflow = checked]; - v384 = arith.constant 4 : u32; - v211 = arith.mod v209, v384 : u32; + v209 = arith.add v207, v382 : u32 #[overflow = checked]; + v381 = arith.constant 4 : u32; + v211 = arith.mod v209, v381 : u32; hir.assertz v211 #[code = 250]; v212 = hir.int_to_ptr v209 : ptr; v213 = hir.load v212 : i32; v215 = arith.constant 12 : u32; v214 = hir.bitcast v189 : u32; v216 = arith.add v214, v215 : u32 #[overflow = checked]; - v383 = arith.constant 4 : u32; - v218 = arith.mod v216, v383 : u32; + v380 = arith.constant 4 : u32; + v218 = arith.mod v216, v380 : u32; hir.assertz v218 #[code = 250]; v219 = hir.int_to_ptr v216 : ptr; v220 = hir.load v219 : i32; hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v213, v200, v220) scf.yield ; }; - v382 = arith.constant 16 : i32; - v223 = arith.add v189, v382 : i32 #[overflow = wrapping]; + v379 = arith.constant 16 : i32; + v223 = arith.add v189, v379 : i32 #[overflow = wrapping]; v224 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v225 = hir.bitcast v224 : ptr; hir.store v225, v223; @@ -336,17 +339,17 @@ builtin.component root_ns:root@1.0.0 { private builtin.function @::current_memory(v226: i32, v227: i32, v228: i32, v229: i32) { ^block35(v226: i32, v227: i32, v228: i32, v229: i32): - v412 = arith.constant 0 : i32; + v409 = arith.constant 0 : i32; v230 = arith.constant 0 : i32; v234 = arith.eq v229, v230 : i1; v235 = arith.zext v234 : u32; v236 = hir.bitcast v235 : i32; - v238 = arith.neq v236, v412 : i1; - v399, v400 = scf.if v238 : i32, i32 { + v238 = arith.neq v236, v409 : i1; + v396, v397 = scf.if v238 : i32, i32 { ^block62: - v411 = arith.constant 0 : i32; + v408 = arith.constant 0 : i32; v232 = arith.constant 4 : i32; - scf.yield v232, v411; + scf.yield v232, v408; } else { ^block38: v239 = hir.bitcast v227 : u32; @@ -355,37 +358,37 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v241 #[code = 250]; v242 = hir.int_to_ptr v239 : ptr; v243 = hir.load v242 : i32; - v409 = arith.constant 0 : i32; - v410 = arith.constant 0 : i32; - v245 = arith.eq v243, v410 : i1; + v406 = arith.constant 0 : i32; + v407 = arith.constant 0 : i32; + v245 = arith.eq v243, v407 : i1; v246 = arith.zext v245 : u32; v247 = hir.bitcast v246 : i32; - v249 = arith.neq v247, v409 : i1; - v397 = scf.if v249 : i32 { + v249 = arith.neq v247, v406 : i1; + v394 = scf.if v249 : i32 { ^block61: - v408 = arith.constant 0 : i32; - scf.yield v408; + v405 = arith.constant 0 : i32; + scf.yield v405; } else { ^block39: - v407 = arith.constant 4 : u32; + v404 = arith.constant 4 : u32; v250 = hir.bitcast v226 : u32; - v252 = arith.add v250, v407 : u32 #[overflow = checked]; - v406 = arith.constant 4 : u32; - v254 = arith.mod v252, v406 : u32; + v252 = arith.add v250, v404 : u32 #[overflow = checked]; + v403 = arith.constant 4 : u32; + v254 = arith.mod v252, v403 : u32; hir.assertz v254 #[code = 250]; v255 = hir.int_to_ptr v252 : ptr; hir.store v255, v228; - v405 = arith.constant 4 : u32; + v402 = arith.constant 4 : u32; v256 = hir.bitcast v227 : u32; - v258 = arith.add v256, v405 : u32 #[overflow = checked]; - v404 = arith.constant 4 : u32; - v260 = arith.mod v258, v404 : u32; + v258 = arith.add v256, v402 : u32 #[overflow = checked]; + v401 = arith.constant 4 : u32; + v260 = arith.mod v258, v401 : u32; hir.assertz v260 #[code = 250]; v261 = hir.int_to_ptr v258 : ptr; v262 = hir.load v261 : i32; v263 = hir.bitcast v226 : u32; - v403 = arith.constant 4 : u32; - v265 = arith.mod v263, v403 : u32; + v400 = arith.constant 4 : u32; + v265 = arith.mod v263, v400 : u32; hir.assertz v265 #[code = 250]; v266 = hir.int_to_ptr v263 : ptr; hir.store v266, v262; @@ -393,28 +396,28 @@ builtin.component root_ns:root@1.0.0 { scf.yield v267; }; v268 = arith.constant 8 : i32; - v402 = arith.constant 4 : i32; - v398 = cf.select v249, v402, v268 : i32; - scf.yield v398, v397; + v399 = arith.constant 4 : i32; + v395 = cf.select v249, v399, v268 : i32; + scf.yield v395, v394; }; - v271 = arith.add v226, v399 : i32 #[overflow = wrapping]; + v271 = arith.add v226, v396 : i32 #[overflow = wrapping]; v273 = hir.bitcast v271 : u32; - v401 = arith.constant 4 : u32; - v275 = arith.mod v273, v401 : u32; + v398 = arith.constant 4 : u32; + v275 = arith.mod v273, v398 : u32; hir.assertz v275 #[code = 250]; v276 = hir.int_to_ptr v273 : ptr; - hir.store v276, v400; + hir.store v276, v397; builtin.ret ; }; private builtin.function @::deallocate(v277: i32, v278: i32, v279: i32) { ^block40(v277: i32, v278: i32, v279: i32): - v414 = arith.constant 0 : i32; + v411 = arith.constant 0 : i32; v280 = arith.constant 0 : i32; v281 = arith.eq v279, v280 : i1; v282 = arith.zext v281 : u32; v283 = hir.bitcast v282 : i32; - v285 = arith.neq v283, v414 : i1; + v285 = arith.neq v283, v411 : i1; scf.if v285{ ^block42: scf.yield ; diff --git a/tests/integration/expected/vec_alloc_vec.masm b/tests/integration/expected/vec_alloc_vec.masm index 80b0cde9a..4a3fd1aae 100644 --- a/tests/integration/expected/vec_alloc_vec.masm +++ b/tests/integration/expected/vec_alloc_vec.masm @@ -95,6 +95,9 @@ pub proc entrypoint(i32) -> felt u32assert assertz push.3 + push.0 + mul.4294967296 + add swap.1 u32divmod.4 swap.1 @@ -114,6 +117,9 @@ pub proc entrypoint(i32) -> felt u32assert assertz push.2 + push.0 + mul.4294967296 + add swap.1 u32divmod.4 swap.1 @@ -130,6 +136,9 @@ pub proc entrypoint(i32) -> felt u32assert assertz push.1 + push.0 + mul.4294967296 + add swap.1 u32divmod.4 swap.1 diff --git a/tests/integration/expected/vec_alloc_vec.wat b/tests/integration/expected/vec_alloc_vec.wat index 0eacb456c..6752fe49f 100644 --- a/tests/integration/expected/vec_alloc_vec.wat +++ b/tests/integration/expected/vec_alloc_vec.wat @@ -5,8 +5,9 @@ (type (;3;) (func)) (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) - (type (;6;) (func (param i32 i32))) - (type (;7;) (func (param i32 i32 i32 i32))) + (type (;6;) (func (param i64) (result f32))) + (type (;7;) (func (param i32 i32))) + (type (;8;) (func (param i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -35,15 +36,15 @@ local.tee 2 i32.eqz br_if 0 (;@2;) - i32.const 1 - call $intrinsics::felt::from_u32 + i64.const 1 + call $intrinsics::felt::from_u64_unchecked local.set 3 - i32.const 2 - call $intrinsics::felt::from_u32 + i64.const 2 + call $intrinsics::felt::from_u64_unchecked local.set 4 local.get 2 - i32.const 3 - call $intrinsics::felt::from_u32 + i64.const 3 + call $intrinsics::felt::from_u64_unchecked f32.store offset=8 local.get 2 local.get 4 @@ -168,10 +169,10 @@ (func $intrinsics::mem::heap_base (;5;) (type 5) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;6;) (type 2) (param i32) (result f32) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 6) (param i64) (result f32) unreachable ) - (func $alloc::alloc::handle_alloc_error (;7;) (type 6) (param i32 i32) + (func $alloc::alloc::handle_alloc_error (;7;) (type 7) (param i32 i32) unreachable ) (func $::deallocate (;8;) (type 1) (param i32 i32 i32) @@ -206,7 +207,7 @@ i32.add global.set $__stack_pointer ) - (func $::current_memory (;9;) (type 7) (param i32 i32 i32 i32) + (func $::current_memory (;9;) (type 8) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 diff --git a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs index 000f39dfe..e93c39513 100644 --- a/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs +++ b/tests/integration/src/rust_masm_tests/abi_transform/advice_map.rs @@ -30,9 +30,9 @@ fn test_adv_load_preimage() { let num_felts = intrinsics::advice::adv_push_mapvaln(key.clone()); - let num_felts_u64 = num_felts.as_u64(); - assert_eq(Felt::from_u32((num_felts_u64 % 4) as u32), felt!(0)); - let num_words = Felt::from_u64_unchecked(num_felts_u64 / 4); + let num_felts_u64 = num_felts.as_canonical_u64(); + assert_eq(Felt::new((num_felts_u64 % 4) as u64), felt!(0)); + let num_words = Felt::new(num_felts_u64 / 4); let commitment = key; let input = adv_load_preimage(num_words, commitment); diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs index 12575344b..b47d30718 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/account.rs @@ -132,7 +132,7 @@ fn rust_sdk_account_get_initial_balance_binding() { run_account_binding_test( "rust_sdk_account_get_initial_balance_binding", "pub fn binding(&self) -> Felt { - let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; + let faucet = AccountId { prefix: Felt::new(1), suffix: Felt::new(0) }; self.get_initial_balance(faucet) }", ); @@ -143,11 +143,11 @@ fn rust_sdk_account_has_non_fungible_asset_binding() { run_account_binding_test( "rust_sdk_account_has_non_fungible_asset_binding", "pub fn binding(&self) -> Felt { - let asset = Asset::from([Felt::from_u32(0); 4]); + let asset = Asset::from([Felt::new(0); 4]); if self.has_non_fungible_asset(asset) { - Felt::from_u32(1) + Felt::new(1) } else { - Felt::from_u32(0) + Felt::new(0) } }", ); @@ -198,11 +198,11 @@ fn rust_sdk_account_has_procedure_binding() { run_account_binding_test( "rust_sdk_account_has_procedure_binding", "pub fn binding(&self) -> Felt { - let proc_root = Word::from([Felt::from_u32(0); 4]); + let proc_root = Word::from([Felt::new(0); 4]); if self.has_procedure(proc_root) { - Felt::from_u32(1) + Felt::new(1) } else { - Felt::from_u32(0) + Felt::new(0) } }", ); @@ -213,11 +213,11 @@ fn rust_sdk_account_was_procedure_called_binding() { run_account_binding_test( "rust_sdk_account_was_procedure_called_binding", "pub fn binding(&self) -> Felt { - let proc_root = Word::from([Felt::from_u32(0); 4]); + let proc_root = Word::from([Felt::new(0); 4]); if self.was_procedure_called(proc_root) { - Felt::from_u32(1) + Felt::new(1) } else { - Felt::from_u32(0) + Felt::new(0) } }", ); @@ -246,7 +246,7 @@ fn rust_sdk_account_storage_get_initial_map_item_binding() { map: StorageMap, }"#, "pub fn binding(&self) -> Word { - let key = Word::from([Felt::from_u32(0); 4]); + let key = Word::from([Felt::new(0); 4]); storage::get_initial_map_item(Self::default().map.slot, &key) }", ); diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs index ae862303c..e5809441a 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/asset.rs @@ -76,8 +76,8 @@ fn rust_sdk_account_asset_build_fungible_asset_binding() { run_asset_binding_test( "rust_sdk_account_asset_build_fungible_asset_binding", "pub fn binding(&self) -> Asset { - let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; - asset::build_fungible_asset(faucet, Felt::from_u32(10)) + let faucet = AccountId { prefix: Felt::new(1), suffix: Felt::new(0) }; + asset::build_fungible_asset(faucet, Felt::new(10)) }", ); } @@ -87,8 +87,8 @@ fn rust_sdk_account_asset_build_non_fungible_asset_binding() { run_asset_binding_test( "rust_sdk_account_asset_build_non_fungible_asset_binding", "pub fn binding(&self) -> Asset { - let faucet = AccountId { prefix: Felt::from_u32(1), suffix: Felt::from_u32(0) }; - let hash = Word::from([Felt::from_u32(0); 4]); + let faucet = AccountId { prefix: Felt::new(1), suffix: Felt::new(0) }; + let hash = Word::from([Felt::new(0); 4]); asset::build_non_fungible_asset(faucet, hash) }", ); diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs index 50c87fcee..b5ff67acf 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/faucet.rs @@ -76,7 +76,7 @@ fn rust_sdk_account_faucet_create_fungible_asset_binding() { run_faucet_binding_test( "rust_sdk_account_faucet_create_fungible_asset_binding", "pub fn binding(&self) -> Asset { - faucet::create_fungible_asset(Felt::from_u32(10)) + faucet::create_fungible_asset(Felt::new(10)) }", ); } @@ -86,7 +86,7 @@ fn rust_sdk_account_faucet_create_non_fungible_asset_binding() { run_faucet_binding_test( "rust_sdk_account_faucet_create_non_fungible_asset_binding", "pub fn binding(&self) -> Asset { - let hash = Word::from([Felt::from_u32(0); 4]); + let hash = Word::from([Felt::new(0); 4]); faucet::create_non_fungible_asset(hash) }", ); @@ -97,7 +97,7 @@ fn rust_sdk_account_faucet_mint_binding() { run_faucet_binding_test( "rust_sdk_account_faucet_mint_binding", "pub fn binding(&self) -> Asset { - let asset = Asset::from([Felt::from_u32(0); 4]); + let asset = Asset::from([Felt::new(0); 4]); faucet::mint(asset) }", ); @@ -108,7 +108,7 @@ fn rust_sdk_account_faucet_burn_binding() { run_faucet_binding_test( "rust_sdk_account_faucet_burn_binding", "pub fn binding(&self) -> Asset { - let asset = Asset::from([Felt::from_u32(0); 4]); + let asset = Asset::from([Felt::new(0); 4]); faucet::burn(asset) }", ); @@ -129,11 +129,11 @@ fn rust_sdk_account_faucet_is_non_fungible_asset_issued_binding() { run_faucet_binding_test( "rust_sdk_account_faucet_is_non_fungible_asset_issued_binding", "pub fn binding(&self) -> Felt { - let asset = Asset::from([Felt::from_u32(0); 4]); + let asset = Asset::from([Felt::new(0); 4]); if faucet::is_non_fungible_asset_issued(asset) { - Felt::from_u32(1) + Felt::new(1) } else { - Felt::from_u32(0) + Felt::new(0) } }", ); diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs index 54f2aa17f..38d10ab49 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/input_note.rs @@ -79,7 +79,7 @@ fn rust_sdk_input_note_get_assets_info_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_assets_info_binding", "pub fn binding(&self) -> Felt { - let info = input_note::get_assets_info(NoteIdx { inner: Felt::from_u32(0) }); + let info = input_note::get_assets_info(NoteIdx { inner: Felt::new(0) }); info.num_assets }", ); @@ -90,8 +90,8 @@ fn rust_sdk_input_note_get_assets_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_assets_binding", "pub fn binding(&self) -> Felt { - let assets = input_note::get_assets(NoteIdx { inner: Felt::from_u32(0) }); - Felt::from_u32(assets.len() as u32) + let assets = input_note::get_assets(NoteIdx { inner: Felt::new(0) }); + Felt::new(assets.len() as u64) }", ); } @@ -101,7 +101,7 @@ fn rust_sdk_input_note_get_recipient_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_recipient_binding", "pub fn binding(&self) -> Recipient { - input_note::get_recipient(NoteIdx { inner: Felt::from_u32(0) }) + input_note::get_recipient(NoteIdx { inner: Felt::new(0) }) }", ); } @@ -111,7 +111,7 @@ fn rust_sdk_input_note_get_metadata_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_metadata_binding", "pub fn binding(&self) -> Word { - input_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }) + input_note::get_metadata(NoteIdx { inner: Felt::new(0) }) }", ); } @@ -121,7 +121,7 @@ fn rust_sdk_input_note_get_sender_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_sender_binding", "pub fn binding(&self) -> AccountId { - input_note::get_sender(NoteIdx { inner: Felt::from_u32(0) }) + input_note::get_sender(NoteIdx { inner: Felt::new(0) }) }", ); } @@ -131,7 +131,7 @@ fn rust_sdk_input_note_get_inputs_info_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_inputs_info_binding", "pub fn binding(&self) -> Felt { - let info = input_note::get_inputs_info(NoteIdx { inner: Felt::from_u32(0) }); + let info = input_note::get_inputs_info(NoteIdx { inner: Felt::new(0) }); info.num_inputs }", ); @@ -142,7 +142,7 @@ fn rust_sdk_input_note_get_script_root_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_script_root_binding", "pub fn binding(&self) -> Word { - input_note::get_script_root(NoteIdx { inner: Felt::from_u32(0) }) + input_note::get_script_root(NoteIdx { inner: Felt::new(0) }) }", ); } @@ -152,7 +152,7 @@ fn rust_sdk_input_note_get_serial_number_binding() { run_input_note_binding_test( "rust_sdk_input_note_get_serial_number_binding", "pub fn binding(&self) -> Word { - input_note::get_serial_number(NoteIdx { inner: Felt::from_u32(0) }) + input_note::get_serial_number(NoteIdx { inner: Felt::new(0) }) }", ); } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs index c83a1e4c8..6438e44e9 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/output_note.rs @@ -81,7 +81,7 @@ fn rust_sdk_output_note_get_assets_info_binding() { run_output_note_binding_test( "rust_sdk_output_note_get_assets_info_binding", "pub fn binding(&self) -> Felt { - let info = output_note::get_assets_info(NoteIdx { inner: Felt::from_u32(0) }); + let info = output_note::get_assets_info(NoteIdx { inner: Felt::new(0) }); info.num_assets }", ); @@ -92,8 +92,8 @@ fn rust_sdk_output_note_get_assets_binding() { run_output_note_binding_test( "rust_sdk_output_note_get_assets_binding", "pub fn binding(&self) -> Felt { - let assets = output_note::get_assets(NoteIdx { inner: Felt::from_u32(0) }); - Felt::from_u32(assets.len() as u32) + let assets = output_note::get_assets(NoteIdx { inner: Felt::new(0) }); + Felt::new(assets.len() as u64) }", ); } @@ -103,7 +103,7 @@ fn rust_sdk_output_note_get_recipient_binding() { run_output_note_binding_test( "rust_sdk_output_note_get_recipient_binding", "pub fn binding(&self) -> Recipient { - output_note::get_recipient(NoteIdx { inner: Felt::from_u32(0) }) + output_note::get_recipient(NoteIdx { inner: Felt::new(0) }) }", ); } @@ -113,7 +113,7 @@ fn rust_sdk_output_note_get_metadata_binding() { run_output_note_binding_test( "rust_sdk_output_note_get_metadata_binding", "pub fn binding(&self) -> Word { - output_note::get_metadata(NoteIdx { inner: Felt::from_u32(0) }) + output_note::get_metadata(NoteIdx { inner: Felt::new(0) }) }", ); } @@ -123,9 +123,9 @@ fn rust_sdk_output_note_create_binding() { run_output_note_binding_test( "rust_sdk_output_note_create_binding", "pub fn binding(&self) -> NoteIdx { - let recipient = Recipient::from([Felt::from_u32(0); 4]); - let tag = Tag { inner: Felt::from_u32(0) }; - let note_type = NoteType { inner: Felt::from_u32(1) }; + let recipient = Recipient::from([Felt::new(0); 4]); + let tag = Tag { inner: Felt::new(0) }; + let note_type = NoteType { inner: Felt::new(1) }; output_note::create(tag, note_type, recipient) }", ); @@ -136,10 +136,10 @@ fn rust_sdk_output_note_add_asset_binding() { run_output_note_binding_test( "rust_sdk_output_note_add_asset_binding", "pub fn binding(&self) -> Felt { - let asset = Asset::from([Felt::from_u32(0); 4]); - let idx = NoteIdx { inner: Felt::from_u32(0) }; + let asset = Asset::from([Felt::new(0); 4]); + let idx = NoteIdx { inner: Felt::new(0) }; output_note::add_asset(asset, idx); - Felt::from_u32(0) + Felt::new(0) }", ); } @@ -149,12 +149,12 @@ fn rust_sdk_output_note_set_attachment_binding() { run_output_note_binding_test( "rust_sdk_output_note_set_attachment_binding", "pub fn binding(&self) -> Felt { - let idx = NoteIdx { inner: Felt::from_u32(0) }; - let attachment_scheme = Felt::from_u32(0); - let attachment_kind = Felt::from_u32(0); - let attachment = Word::from([Felt::from_u32(0); 4]); + let idx = NoteIdx { inner: Felt::new(0) }; + let attachment_scheme = Felt::new(0); + let attachment_kind = Felt::new(0); + let attachment = Word::from([Felt::new(0); 4]); output_note::set_attachment(idx, attachment_scheme, attachment_kind, attachment); - Felt::from_u32(0) + Felt::new(0) }", ); } @@ -164,11 +164,11 @@ fn rust_sdk_output_note_set_word_attachment_binding() { run_output_note_binding_test( "rust_sdk_output_note_set_word_attachment_binding", "pub fn binding(&self) -> Felt { - let idx = NoteIdx { inner: Felt::from_u32(0) }; - let attachment_scheme = Felt::from_u32(0); - let attachment = Word::from([Felt::from_u32(0); 4]); + let idx = NoteIdx { inner: Felt::new(0) }; + let attachment_scheme = Felt::new(0); + let attachment = Word::from([Felt::new(0); 4]); output_note::set_word_attachment(idx, attachment_scheme, attachment); - Felt::from_u32(0) + Felt::new(0) }", ); } @@ -178,11 +178,11 @@ fn rust_sdk_output_note_set_array_attachment_binding() { run_output_note_binding_test( "rust_sdk_output_note_set_array_attachment_binding", "pub fn binding(&self) -> Felt { - let idx = NoteIdx { inner: Felt::from_u32(0) }; - let attachment_scheme = Felt::from_u32(0); - let attachment = Word::from([Felt::from_u32(0); 4]); + let idx = NoteIdx { inner: Felt::new(0) }; + let attachment_scheme = Felt::new(0); + let attachment = Word::from([Felt::new(0); 4]); output_note::set_array_attachment(idx, attachment_scheme, attachment); - Felt::from_u32(0) + Felt::new(0) }", ); } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs index d81b4db0e..c9e9d243e 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/base/tx.rs @@ -122,7 +122,7 @@ fn rust_sdk_account_tx_get_expiration_block_delta_binding() { fn rust_sdk_account_tx_update_expiration_block_delta_binding() { run_tx_binding_test( "rust_sdk_account_tx_update_expiration_block_delta_binding", - "tx::update_expiration_block_delta(Felt::from_u32(42));", + "tx::update_expiration_block_delta(Felt::new(42));", ); } diff --git a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs index f00efdd4b..7ef7079b4 100644 --- a/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs +++ b/tests/integration/src/rust_masm_tests/rust_sdk/stdlib/collections.rs @@ -97,15 +97,15 @@ fn test_smt_get_binding() { let value = result.value; let returned_root = result.root; - let expected = Word::new([ - Felt::from_u64_unchecked({ev0}), - Felt::from_u64_unchecked({ev1}), - Felt::from_u64_unchecked({ev2}), - Felt::from_u64_unchecked({ev3}), - ]); - assert_eq!(value, expected, "smt_get returned unexpected value"); - assert_eq!(returned_root, root, "smt_get should not mutate the root"); - }}"#, + let expected = Word::new([ + Felt::new({ev0}), + Felt::new({ev1}), + Felt::new({ev2}), + Felt::new({ev3}), + ]); + assert_eq!(value, expected, "smt_get returned unexpected value"); + assert_eq!(returned_root, root, "smt_get should not mutate the root"); + }}"#, ev0 = expected_value_u64[0], ev1 = expected_value_u64[1], ev2 = expected_value_u64[2], @@ -178,21 +178,21 @@ fn test_smt_set_binding() { let old_value = result.old_value; let new_root = result.new_root; - let expected_old = Word::new([ - Felt::from_u64_unchecked({eo0}), - Felt::from_u64_unchecked({eo1}), - Felt::from_u64_unchecked({eo2}), - Felt::from_u64_unchecked({eo3}), - ]); - let expected_new = Word::new([ - Felt::from_u64_unchecked({en0}), - Felt::from_u64_unchecked({en1}), - Felt::from_u64_unchecked({en2}), - Felt::from_u64_unchecked({en3}), - ]); - assert_eq!(old_value, expected_old, "smt_set returned unexpected old value"); - assert_eq!(new_root, expected_new, "smt_set returned unexpected new root"); - }}"#, + let expected_old = Word::new([ + Felt::new({eo0}), + Felt::new({eo1}), + Felt::new({eo2}), + Felt::new({eo3}), + ]); + let expected_new = Word::new([ + Felt::new({en0}), + Felt::new({en1}), + Felt::new({en2}), + Felt::new({en3}), + ]); + assert_eq!(old_value, expected_old, "smt_set returned unexpected old value"); + assert_eq!(new_root, expected_new, "smt_set returned unexpected new root"); + }}"#, eo0 = expected_old_u64[0], eo1 = expected_old_u64[1], eo2 = expected_old_u64[2], diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock index 0068eb7c2..44ba46c65 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -989,7 +989,7 @@ checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "miden" -version = "0.8.0" +version = "0.9.0" dependencies = [ "miden-base", "miden-base-macros", @@ -1052,7 +1052,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.8.0" +version = "0.9.0" dependencies = [ "miden-base-sys", "miden-stdlib-sys", @@ -1060,7 +1060,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.8.0" +version = "0.9.0" dependencies = [ "heck", "miden-protocol", @@ -1075,7 +1075,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.8.1" +version = "0.9.0" dependencies = [ "miden-field-repr", "miden-stdlib-sys", @@ -1180,23 +1180,32 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.8.0" +version = "0.22.2" +source = "git+https://github.com/0xMiden/crypto?rev=ba5aa2b78923b40b50d8170fd287b36808b11ec5#ba5aa2b78923b40b50d8170fd287b36808b11ec5" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", ] [[package]] name = "miden-field-repr" -version = "0.7.1" +version = "0.9.0" dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] name = "miden-field-repr-derive" -version = "0.7.1" +version = "0.9.0" dependencies = [ "proc-macro2", "quote", @@ -1242,7 +1251,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1332,11 +1341,20 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.8.0" +version = "0.9.0" + +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +source = "git+https://github.com/0xMiden/crypto?rev=ba5aa2b78923b40b50d8170fd287b36808b11ec5#ba5aa2b78923b40b50d8170fd287b36808b11ec5" +dependencies = [ + "p3-field", + "p3-goldilocks", +] [[package]] name = "miden-stdlib-sys" -version = "0.8.0" +version = "0.9.0" dependencies = [ "miden-field", ] @@ -1560,6 +1578,162 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -2081,6 +2255,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2091,6 +2274,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2386,6 +2575,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.114" 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 f5f686b85..a0876f028 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 @@ -27,18 +27,18 @@ impl Account { #[unsafe(no_mangle)] pub fn test_felt_ops_smoke(a: Felt, b: Felt) -> Felt { - let d = a.as_u64(); + let d = a.as_canonical_u64(); if a > b { a.inv() + b } else if a < b { a.exp(b) - b } else if a <= b { - a.pow2() * b + a.square() * b } else if a >= b { b / a } else if a == b { miden::assert_eq(a, b); - a + Felt::from_u64_unchecked(d) + a + Felt::new(d) } else if a != b { -a } else if b.is_odd() { @@ -56,7 +56,7 @@ pub struct Note; impl Note { #[unsafe(no_mangle)] pub fn note_script() -> Felt { - let mut sum = Felt::new(0).unwrap(); + let mut sum = Felt::new(0); for input in miden::active_note::get_inputs() { sum = sum + input; } diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index 01f979288..b0cc5caab 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -521,7 +521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -555,7 +555,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1165,9 +1165,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1177,6 +1185,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1227,7 +1236,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1312,6 +1321,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1545,6 +1562,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock index fdf3c2a31..bf195374e 100644 --- a/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/assert-debug-test/Cargo.lock @@ -570,7 +570,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1186,9 +1186,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1198,6 +1206,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1248,7 +1257,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1333,6 +1342,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1559,6 +1576,162 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -2086,6 +2259,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2096,6 +2278,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2391,6 +2579,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.114" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock index aa3f5c934..dd944a9dc 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock @@ -569,7 +569,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1185,9 +1185,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1197,6 +1205,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1247,7 +1256,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1332,6 +1341,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1558,6 +1575,162 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -2085,6 +2258,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2095,6 +2277,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2390,6 +2578,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.112" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs index 353e82912..bb4a8290b 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/src/lib.rs @@ -54,8 +54,7 @@ struct MyAccount; impl MyAccount { /// Exercises exported user-defined type and SDK type in signatures and return value. pub fn test_custom_types(&self, a: StructA, asset: Asset) -> StructB { - let foo_val = - Word::from([a.foo.inner.0, asset.inner.inner.0, a.foo.inner.1, a.foo.inner.2]); + let foo_val = Word::from([a.foo.a, asset.a, a.foo.b, a.foo.c]); let val_a = StructA { foo: foo_val, @@ -84,8 +83,8 @@ impl MyAccount { fn test_custom_types_private(&self, a: StructA, _asset: Asset) -> StructD { StructD { - bar: a.foo.inner.0, - baz: a.foo.inner.1, + bar: a.foo.a, + baz: a.foo.b, } } } diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock index 39fad704f..43e38d020 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock @@ -569,7 +569,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1185,9 +1185,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1197,6 +1205,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1247,7 +1256,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1332,6 +1341,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1558,6 +1575,162 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -2085,6 +2258,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2095,6 +2277,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2390,6 +2578,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.112" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs index 55a808465..628df1676 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/src/lib.rs @@ -14,7 +14,7 @@ struct MyNote; impl MyNote { #[note_script] pub fn execute(self, _arg: Word) { - let foo_val = Word::from_u64_unchecked(11, 22, 33, 44); + let foo_val = Word::new([felt!(11), felt!(22), felt!(33), felt!(44)]); let asset = Asset::new([felt!(99), felt!(88), felt!(77), felt!(66)]); let value = StructA { foo: foo_val, @@ -22,8 +22,8 @@ impl MyNote { }; let result = test_custom_types(value, asset); let expected = StructB { - bar: foo_val.inner.0, - baz: asset.inner.inner.0, + bar: foo_val.a, + baz: asset.inner.a, }; assert_eq!(result.bar, expected.bar); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock index 76363bf78..e6bcf6a47 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs index 028dec1b2..29d7abbc6 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/src/lib.rs @@ -47,20 +47,18 @@ impl foo::Guest for MyFoo { ) -> Felt { // Use weighted sum to encode the order of elements. Different weights ensure different // results if elements are reordered during the flattening - let sum1 = input1.inner.0 * felt!(1) - + input1.inner.1 * felt!(2) - + input1.inner.2 * felt!(4) - + input1.inner.3 * felt!(8); + let sum1 = + input1.a * felt!(1) + input1.b * felt!(2) + input1.c * felt!(4) + input1.d * felt!(8); - let sum2 = input2.inner.0 * felt!(16) - + input2.inner.1 * felt!(32) - + input2.inner.2 * felt!(64) - + input2.inner.3 * felt!(128); + let sum2 = input2.a * felt!(16) + + input2.b * felt!(32) + + input2.c * felt!(64) + + input2.d * felt!(128); - let sum3 = input3.inner.0 * felt!(256) - + input3.inner.1 * felt!(512) - + input3.inner.2 * felt!(1024) - + input3.inner.3 * felt!(2048); + let sum3 = input3.a * felt!(256) + + input3.b * felt!(512) + + input3.c * felt!(1024) + + input3.d * felt!(2048); let felt_sum = felt1 * felt!(4096) + felt2 * felt!(8192) + felt3 * felt!(16384); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock index b44cfafec..2fc537e7d 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs index 643aa2f90..15698722a 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/src/lib.rs @@ -39,10 +39,10 @@ struct MyFoo; impl foo::Guest for MyFoo { fn process_word(input: Word) -> Word { let result = Word::new([ - input.inner.0 + felt!(1), - input.inner.1 + felt!(2), - input.inner.2 + felt!(3), - input.inner.3 + felt!(4), + input.a + felt!(1), + input.b + felt!(2), + input.c + felt!(3), + input.d + felt!(4), ]); result @@ -52,10 +52,10 @@ impl foo::Guest for MyFoo { // The same signature, different name and body fn process_another_word(input: Word) -> Word { let result = Word::new([ - input.inner.0 + felt!(2), - input.inner.1 + felt!(3), - input.inner.2 + felt!(4), - input.inner.3 + felt!(5), + input.a + felt!(2), + input.b + felt!(3), + input.c + felt!(4), + input.d + felt!(5), ]); result diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock index 40edfa5ee..b959baa0c 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs index b5a07e001..2298ae70f 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/src/lib.rs @@ -40,8 +40,8 @@ struct MyFoo; impl foo::Guest for MyFoo { fn process_felt(input: Felt) -> Felt { - let res = input + Felt::from_u32(unsafe { FOO }); - unsafe { FOO = res.as_u64() as u32 }; + let res = input + Felt::new(unsafe { FOO } as u64); + unsafe { FOO = res.as_canonical_u64() as u32 }; res } } diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock index 82bdbdd93..b8fac0c01 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs index 7f3eed4d8..73b436189 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/src/lib.rs @@ -39,13 +39,22 @@ struct MyNote; impl Guest for MyNote { fn run(_arg: Word) { let input1 = Word { - inner: (felt!(1), felt!(2), felt!(3), felt!(4)), + a: felt!(1), + b: felt!(2), + c: felt!(3), + d: felt!(4), }; let input2 = Word { - inner: (felt!(5), felt!(6), felt!(7), felt!(8)), + a: felt!(5), + b: felt!(6), + c: felt!(7), + d: felt!(8), }; let input3 = Word { - inner: (felt!(9), felt!(10), felt!(11), felt!(12)), + a: felt!(9), + b: felt!(10), + c: felt!(11), + d: felt!(12), }; let felt1 = felt!(13); let felt2 = felt!(14); diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock index 6710edf5b..298293fe0 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs index 3439fc992..42c00c4fb 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/src/lib.rs @@ -37,22 +37,25 @@ struct MyNote; impl Guest for MyNote { fn run(_arg: Word) { let input = Word { - inner: (felt!(2), felt!(3), felt!(4), felt!(5)), + a: felt!(2), + b: felt!(3), + c: felt!(4), + d: felt!(5), }; let output = process_word(input.clone()); - assert_eq(output.inner.0, felt!(3)); - assert_eq(output.inner.1, felt!(5)); - assert_eq(output.inner.2, felt!(7)); - assert_eq(output.inner.3, felt!(9)); + assert_eq(output.a, felt!(3)); + assert_eq(output.b, felt!(5)); + assert_eq(output.c, felt!(7)); + assert_eq(output.d, felt!(9)); let output = process_another_word(input); - assert_eq(output.inner.0, felt!(4)); - assert_eq(output.inner.1, felt!(6)); - assert_eq(output.inner.2, felt!(8)); - assert_eq(output.inner.3, felt!(10)); + assert_eq(output.a, felt!(4)); + assert_eq(output.b, felt!(6)); + assert_eq(output.c, felt!(8)); + assert_eq(output.d, felt!(10)); let felt_input = felt!(9); let felt_output = process_felt(felt_input); @@ -78,7 +81,7 @@ impl Guest for MyNote { let mixed_input = MixedStruct { f: u64::MAX - 1000, - a: Felt::new(Felt::M - 1 - 6).unwrap(), + a: Felt::new(Felt::ORDER_U64 - 1 - 6), b: u32::MAX - 10, c: felt!(50), d: 111, @@ -90,12 +93,12 @@ impl Guest for MyNote { // fail assert_eq!(0, 1); } - assert_eq(mixed_output.a, Felt::new(Felt::M - 1).unwrap()); // M - 1 - 6 + 6 - assert_eq(mixed_output.b.into(), Felt::from_u32(u32::MAX)); // u32::MAX - 10 + 10 + assert_eq(mixed_output.a, Felt::new(Felt::ORDER_U64 - 1)); // M - 1 - 6 + 6 + assert_eq(mixed_output.b.into(), Felt::new(u32::MAX as u64)); // u32::MAX - 10 + 10 assert_eq(mixed_output.c, felt!(57)); // 50 + 7 - assert_eq(mixed_output.d.into(), Felt::from_u32(122)); - assert_eq(Felt::from_u32(mixed_output.e as u32), felt!(1)); - assert_eq(mixed_output.g.into(), Felt::from_u32(12)); + assert_eq(mixed_output.d.into(), Felt::new(122)); + assert_eq(Felt::new(mixed_output.e as u64), felt!(1)); + assert_eq(mixed_output.g.into(), Felt::new(12)); let nested_input = NestedStruct { inner: Pair { diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock index c6bc10cd5..886095cec 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.lock @@ -528,7 +528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -562,7 +562,7 @@ dependencies = [ "futures-core", "futures-sink", "nanorand", - "spin", + "spin 0.9.8", ] [[package]] @@ -1172,9 +1172,17 @@ dependencies = [ [[package]] name = "miden-field" -version = "0.9.0" +version = "0.22.2" dependencies = [ - "miden-core", + "miden-serde-utils", + "num-bigint", + "p3-challenger", + "p3-field", + "p3-goldilocks", + "paste", + "rand", + "serde", + "thiserror", ] [[package]] @@ -1184,6 +1192,7 @@ dependencies = [ "miden-core", "miden-field", "miden-field-repr-derive", + "p3-field", ] [[package]] @@ -1234,7 +1243,7 @@ dependencies = [ "rustc_version 0.2.3", "rustversion", "serde_json", - "spin", + "spin 0.9.8", "strip-ansi-escapes", "supports-color", "supports-hyperlinks", @@ -1319,6 +1328,14 @@ dependencies = [ name = "miden-sdk-alloc" version = "0.9.0" +[[package]] +name = "miden-serde-utils" +version = "0.22.2" +dependencies = [ + "p3-field", + "p3-goldilocks", +] + [[package]] name = "miden-stdlib-sys" version = "0.9.0" @@ -1552,6 +1569,162 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "p3-challenger" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20e42ba74a49c08c6e99f74cd9b343bfa31aa5721fea55079b18e3fd65f1dcbc" +dependencies = [ + "p3-field", + "p3-maybe-rayon", + "p3-monty-31", + "p3-symmetric", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-dft" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e63fa5eb1bd12a240089e72ae3fe10350944d9c166d00a3bfd2a1794db65cf5c" +dependencies = [ + "itertools", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "spin 0.10.0", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ebfdb6ef992ae64e9e8f449ac46516ffa584f11afbdf9ee244288c2a633cdf4" +dependencies = [ + "itertools", + "num-bigint", + "p3-maybe-rayon", + "p3-util", + "paste", + "rand", + "serde", + "tracing", +] + +[[package]] +name = "p3-goldilocks" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64716244b5612622d4e78a4f48b74f6d3bb7b4085b7b6b25364b1dfca7198c66" +dependencies = [ + "num-bigint", + "p3-challenger", + "p3-dft", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5542f96504dae8100c91398fb1e3f5ec669eb9c73d9e0b018a93b5fe32bad230" +dependencies = [ + "itertools", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand", + "serde", + "tracing", + "transpose", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e5669ca75645f99cd001e9d0289a4eeff2bc2cd9dc3c6c3aaf22643966e83df" + +[[package]] +name = "p3-mds" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038763af23df9da653065867fd85b38626079031576c86fd537097e5be6a0da0" +dependencies = [ + "p3-dft", + "p3-field", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-monty-31" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a981d60da3d8cbf8561014e2c186068578405fd69098fa75b43d4afb364a47" +dependencies = [ + "itertools", + "num-bigint", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "p3-util", + "paste", + "rand", + "serde", + "spin 0.10.0", + "tracing", + "transpose", +] + +[[package]] +name = "p3-poseidon2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "903b73e4f9a7781a18561c74dc169cf03333497b57a8dd02aaeb130c0f386599" +dependencies = [ + "p3-field", + "p3-mds", + "p3-symmetric", + "p3-util", + "rand", +] + +[[package]] +name = "p3-symmetric" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd788f04e86dd5c35dd87cad29eefdb6371d2fd5f7664451382eeacae3c3ed0" +dependencies = [ + "itertools", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "663b16021930bc600ecada915c6c3965730a3b9d6a6c23434ccf70bfc29d6881" +dependencies = [ + "serde", +] + [[package]] name = "parking_lot" version = "0.12.4" @@ -2092,6 +2265,15 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spin" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +dependencies = [ + "lock_api", +] + [[package]] name = "spki" version = "0.7.3" @@ -2102,6 +2284,12 @@ dependencies = [ "der", ] +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + [[package]] name = "string_cache" version = "0.8.9" @@ -2184,7 +2372,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2397,6 +2585,16 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "transpose" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad61aed86bc3faea4300c7aee358b4c6d0c8d6ccc36524c96e4c92ccf26e77e" +dependencies = [ + "num-integer", + "strength_reduce", +] + [[package]] name = "trybuild" version = "1.0.106" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs index 0c5339152..bb0216671 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/src/lib.rs @@ -42,10 +42,10 @@ struct MyNote; impl Guest for MyNote { fn run(_arg: Word) { - let input = Felt::from_u32(unsafe { BAR }); + let input = Felt::new(unsafe { BAR } as u64); assert_eq(input, felt!(11)); let output = process_felt(input); assert_eq(output, felt!(53)); - unsafe { BAR = output.as_u64() as u32 }; + unsafe { BAR = output.as_canonical_u64() as u32 }; } } diff --git a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs index d038ab129..dc0703a5a 100644 --- a/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs +++ b/tests/rust-apps-wasm/rust-sdk/issue-invalid-stack-offset-movup/src/lib.rs @@ -9,7 +9,7 @@ #[macro_use] extern crate alloc; -use miden::*; +use miden::{miden_field::word, *}; #[note] struct InvalidStackOffsetMovupNote; @@ -46,7 +46,7 @@ impl InvalidStackOffsetMovupNote { let note_assets = active_note::get_assets(); let num_assets = note_assets.len(); - assert_eq(Felt::from_u32(num_assets as u32), felt!(1)); + assert_eq(Felt::new(num_assets as u64), felt!(1)); let note_asset = note_assets[0]; let assets_match = if offered_asset_word == note_asset { @@ -74,7 +74,10 @@ impl InvalidStackOffsetMovupNote { active_note::add_assets_to_account(); - let routing_serial = add_word(current_note_serial, Word::from_u64_unchecked(0, 0, 0, 1)); + let routing_serial = add_word( + current_note_serial, + Word::new([Felt::ZERO, Felt::ZERO, Felt::ZERO, felt!(1)]), + ); let aux_value = offered_out; let input_asset = Asset::new(Word::from([inputs[0], inputs[1], inputs[2], input_amount])); @@ -102,7 +105,7 @@ impl InvalidStackOffsetMovupNote { /// Calculates the output amount for the given swap parameters. fn calculate_output_amount(offered_total: Felt, requested_total: Felt, input_amount: Felt) -> Felt { - let precision_factor = Felt::from_u32(100000); + let precision_factor = Felt::new(100000); if offered_total > requested_total { let ratio = (offered_total * precision_factor) / requested_total; @@ -124,10 +127,10 @@ fn create_p2id_note(serial_num: Word, input_asset: Asset, recipient_id: AccountI let note_type = get_note_type(); let _p2id_note_root_digest = Digest::from_word(Word::new([ - Felt::from_u64_unchecked(6412241294473976817), - Felt::from_u64_unchecked(10671567784403105513), - Felt::from_u64_unchecked(4275774806771663409), - Felt::from_u64_unchecked(17933276983439992403), + Felt::new(6412241294473976817), + Felt::new(10671567784403105513), + Felt::new(4275774806771663409), + Felt::new(17933276983439992403), ])); let recipient = Recipient::compute( @@ -190,8 +193,9 @@ fn create_swapp_note( /// Extracts the note tag from the active note metadata. fn get_note_tag() -> Tag { let metadata = active_note::get_metadata(); - let left_shifted_32 = metadata[2] * Felt::from_u32(2u32.pow(32)); - let tag_felt = left_shifted_32 / (Felt::from_u32(2u32.pow(32))); + let pow_32 = Felt::new(2u64.pow(32)); + let left_shifted_32 = metadata[2] * pow_32; + let tag_felt = left_shifted_32 / pow_32; Tag::from(tag_felt) } @@ -199,7 +203,9 @@ fn get_note_tag() -> Tag { fn get_note_type() -> NoteType { let metadata = active_note::get_metadata(); let second_felt = metadata[1]; - let left_shifted_56 = second_felt * Felt::from_u32(2u32.pow(56)); - let note_type_felt = left_shifted_56 / Felt::from_u32(2u32.pow(62)); + let pow_56 = Felt::new(2u64.pow(56)); + let pow_62 = Felt::new(2u64.pow(62)); + let left_shifted_56 = second_felt * pow_56; + let note_type_felt = left_shifted_56 / pow_62; NoteType::from(note_type_felt) }