diff --git a/Cargo.lock b/Cargo.lock index 716341d6f..9a36510c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -682,9 +682,7 @@ dependencies = [ "libc", "log", "miden-base", - "miden-base-sys", "miden-mast-package", - "miden-stdlib-sys", "midenc-compile", "midenc-session", "owo-colors", @@ -3478,7 +3476,7 @@ dependencies = [ [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -3518,7 +3516,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -3527,7 +3525,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -3539,7 +3537,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -3833,7 +3831,7 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib" @@ -3847,7 +3845,7 @@ dependencies = [ [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-thiserror" diff --git a/Makefile.toml b/Makefile.toml index d1e625593..387541fb5 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -32,6 +32,9 @@ MIDENC_BUILD_PROFILE = "release" [tasks.init] run_task = "print-env" +# Install proxies to the `llvm-tools` component, i.e. `rust-ar` proxy to the +# LLVM `ar` needed to build stub libraries (see `build.rs` in `*-sys` crates) +install_crate = { crate_name = "cargo-binutils" } [tasks.default] category = "Build" diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index 3195e1841..8e9cee121 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/examples/basic-wallet-tx-script/Cargo.toml b/examples/basic-wallet-tx-script/Cargo.toml index 96ef88794..410351be9 100644 --- a/examples/basic-wallet-tx-script/Cargo.toml +++ b/examples/basic-wallet-tx-script/Cargo.toml @@ -29,9 +29,6 @@ project-kind = "transaction-script" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../sdk/base-sys/wit/miden-core-base.wit" } "miden:basic-wallet" = { path = "../basic-wallet/wit/basic-wallet.wit" } [profile.release] diff --git a/examples/basic-wallet-tx-script/wit/interface.wit b/examples/basic-wallet-tx-script/wit/interface.wit index fd0fc9246..5462e9cfe 100644 --- a/examples/basic-wallet-tx-script/wit/interface.wit +++ b/examples/basic-wallet-tx-script/wit/interface.wit @@ -1,10 +1,6 @@ package miden:basic-wallet-tx-script@1.0.0; world basic-wallet-tx-script-world { - include miden:core-intrinsics/intrinsics@1.0.0; - include miden:core-stdlib/stdlib@1.0.0; - include miden:core-base/base@1.0.0; - import miden:basic-wallet/basic-wallet@1.0.0; export miden:base/transaction-script@1.0.0; } diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index 29f6cc2c3..36637ca7c 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/examples/basic-wallet/Cargo.toml b/examples/basic-wallet/Cargo.toml index b75b23944..4ebf92f9e 100644 --- a/examples/basic-wallet/Cargo.toml +++ b/examples/basic-wallet/Cargo.toml @@ -25,9 +25,6 @@ supported-types = ["RegularAccountUpdatableCode"] [package.metadata.component.target.dependencies] "miden:base" = { path = "../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../sdk/base-sys/wit/miden-core-base.wit" } [profile.release] trim-paths = ["diagnostics", "object"] diff --git a/examples/basic-wallet/wit/basic-wallet.wit b/examples/basic-wallet/wit/basic-wallet.wit index 4ede5d7a3..2fa642f01 100644 --- a/examples/basic-wallet/wit/basic-wallet.wit +++ b/examples/basic-wallet/wit/basic-wallet.wit @@ -10,9 +10,5 @@ interface basic-wallet { } world basic-wallet-world { - include miden:core-intrinsics/intrinsics@1.0.0; - include miden:core-stdlib/stdlib@1.0.0; - include miden:core-base/base@1.0.0; - export basic-wallet; } diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index d9bbd2bb5..662c18b43 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/examples/counter-contract/Cargo.toml b/examples/counter-contract/Cargo.toml index 2f617b540..39fef1950 100644 --- a/examples/counter-contract/Cargo.toml +++ b/examples/counter-contract/Cargo.toml @@ -22,7 +22,4 @@ supported-types = ["RegularAccountUpdatableCode"] [package.metadata.component.target.dependencies] "miden:base" = { path = "../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../sdk/base-sys/wit/miden-core-base.wit" } diff --git a/examples/counter-contract/wit/counter.wit b/examples/counter-contract/wit/counter.wit index e8ae4350c..214ba623d 100644 --- a/examples/counter-contract/wit/counter.wit +++ b/examples/counter-contract/wit/counter.wit @@ -13,9 +13,5 @@ interface counter { } world counter-world { - include miden:core-intrinsics/intrinsics@1.0.0; - include miden:core-stdlib/stdlib@1.0.0; - include miden:core-base/base@1.0.0; - export counter; } diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index 8fa07e9c6..58608d739 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/examples/counter-note/Cargo.toml b/examples/counter-note/Cargo.toml index 9f5af2f91..1375de4f5 100644 --- a/examples/counter-note/Cargo.toml +++ b/examples/counter-note/Cargo.toml @@ -32,9 +32,6 @@ package = "miden:counter-note" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../sdk/base-sys/wit/miden-core-base.wit" } "miden:counter-contract" = { path = "../counter-contract/wit/counter.wit" } [profile.release] diff --git a/examples/counter-note/wit/counter-note.wit b/examples/counter-note/wit/counter-note.wit index a28a05ebc..1824680b1 100644 --- a/examples/counter-note/wit/counter-note.wit +++ b/examples/counter-note/wit/counter-note.wit @@ -1,10 +1,6 @@ package miden:counter-note@1.0.0; world counter-note-world { - include miden:core-intrinsics/intrinsics@1.0.0; - include miden:core-stdlib/stdlib@1.0.0; - include miden:core-base/base@1.0.0; - import miden:counter-contract/counter@0.1.0; export miden:base/note-script@1.0.0; } diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index 26da22fc9..ec0bf4ac1 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -476,7 +476,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -516,7 +516,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -525,7 +525,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -537,7 +537,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -658,11 +658,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/examples/p2id-note/Cargo.toml b/examples/p2id-note/Cargo.toml index ac8d59ca4..5d4017eb3 100644 --- a/examples/p2id-note/Cargo.toml +++ b/examples/p2id-note/Cargo.toml @@ -29,9 +29,6 @@ project-kind = "note-script" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../sdk/base-sys/wit/miden-core-base.wit" } "miden:basic-wallet" = { path = "../basic-wallet/wit/basic-wallet.wit" } [profile.release] diff --git a/examples/p2id-note/wit/p2id.wit b/examples/p2id-note/wit/p2id.wit index 59e60f6f7..f33954929 100644 --- a/examples/p2id-note/wit/p2id.wit +++ b/examples/p2id-note/wit/p2id.wit @@ -1,10 +1,6 @@ package miden:p2id@1.0.0; world p2id-world { - include miden:core-intrinsics/intrinsics@1.0.0; - include miden:core-stdlib/stdlib@1.0.0; - include miden:core-base/base@1.0.0; - import miden:basic-wallet/basic-wallet@1.0.0; export miden:base/note-script@1.0.0; } diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index c4c42ac8d..adcd6faa9 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -476,7 +476,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -516,7 +516,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -525,7 +525,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -537,7 +537,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -658,11 +658,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/examples/storage-example/Cargo.toml b/examples/storage-example/Cargo.toml index 2b155859f..159877b35 100644 --- a/examples/storage-example/Cargo.toml +++ b/examples/storage-example/Cargo.toml @@ -22,7 +22,3 @@ supported-types = ["RegularAccountUpdatableCode"] [package.metadata.component.target.dependencies] "miden:base" = { path = "../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../sdk/base-sys/wit/miden-core-base.wit" } - diff --git a/examples/storage-example/wit/storage-example.wit b/examples/storage-example/wit/storage-example.wit index 43cb24a19..e6abc48db 100644 --- a/examples/storage-example/wit/storage-example.wit +++ b/examples/storage-example/wit/storage-example.wit @@ -10,9 +10,5 @@ interface foo { } world foo-world { - include miden:core-intrinsics/intrinsics@1.0.0; - include miden:core-stdlib/stdlib@1.0.0; - include miden:core-base/base@1.0.0; - export foo; } diff --git a/frontend/wasm/src/component/translator.rs b/frontend/wasm/src/component/translator.rs index 707828dbf..140e05d85 100644 --- a/frontend/wasm/src/component/translator.rs +++ b/frontend/wasm/src/component/translator.rs @@ -26,7 +26,6 @@ use crate::{ StaticComponentIndex, }, error::WasmResult, - miden_abi::recover_imported_masm_module, module::{ build_ir::build_ir_module, instance::ModuleArgument, @@ -568,12 +567,6 @@ impl<'a> ComponentTranslator<'a> { let parsed_module = self.nested_modules.get_mut(*static_module_idx).unwrap(); for module_arg in args { let arg_module_name = module_arg.0; - if recover_imported_masm_module(arg_module_name).is_ok() { - // Skip processing module import if its an intrinsics, stdlib, tx-kernel, etc. - // They are processed in the core Wasm module translation - continue; - } - let module_path = SymbolPath { path: smallvec![ SymbolNameComponent::Root, diff --git a/frontend/wasm/src/intrinsics/mod.rs b/frontend/wasm/src/intrinsics/mod.rs index ffa2813de..ce8e6bf10 100644 --- a/frontend/wasm/src/intrinsics/mod.rs +++ b/frontend/wasm/src/intrinsics/mod.rs @@ -8,29 +8,9 @@ pub mod debug; pub mod felt; pub mod mem; -use midenc_hir::{ - diagnostics::WrapErr, - dialects::builtin::{FunctionRef, ModuleBuilder, WorldBuilder}, - Builder, FxHashSet, Signature, SmallVec, SourceSpan, SymbolPath, ValueRef, -}; -use midenc_hir_symbol::sync::LazyLock; +use midenc_hir::{dialects::builtin::FunctionRef, Builder, SmallVec, SourceSpan, ValueRef}; -use crate::{ - callable::CallableFunction, error::WasmResult, module::function_builder_ext::FunctionBuilderExt, -}; - -fn modules() -> &'static FxHashSet { - static MODULES: LazyLock> = LazyLock::new(|| { - let mut s = FxHashSet::default(); - s.insert(SymbolPath::from_iter(mem::MODULE_PREFIX.iter().copied())); - s.insert(SymbolPath::from_iter(felt::MODULE_PREFIX.iter().copied())); - s.insert(SymbolPath::from_iter(debug::MODULE_PREFIX.iter().copied())); - s.insert(SymbolPath::from_iter(crypto::MODULE_PREFIX.iter().copied())); - s.insert(SymbolPath::from_iter(advice::MODULE_PREFIX.iter().copied())); - s - }); - &MODULES -} +use crate::{error::WasmResult, module::function_builder_ext::FunctionBuilderExt}; /// Convert a call to a Miden intrinsic function into instruction(s) pub fn convert_intrinsics_call( @@ -58,39 +38,3 @@ pub fn convert_intrinsics_call( } } } - -/// Returns [`CallableFunction`] for a given intrinsics in core Wasm module imports -pub fn process_intrinsics_import( - world_builder: &mut WorldBuilder, - intrinsic: Intrinsic, - signature: Signature, -) -> CallableFunction { - let conversion_result = intrinsic.conversion_result().expect("unknown intrinsic"); - if conversion_result.is_operation() { - return CallableFunction::Instruction { - intrinsic, - signature, - }; - } - - // This intrinsic function will be defined further down the pipeline. - // - // We are declaring it now, creating the module hierarchy as needed. - let path = intrinsic.into_symbol_path(); - let module_path = path.without_leaf(); - let intrinsic_module = world_builder - .declare_module_tree(&module_path) - .unwrap_or_else(|err| panic!("{err}")); - - let mut intrinsic_module_builder = ModuleBuilder::new(intrinsic_module); - let function_ref = intrinsic_module_builder - .define_function(intrinsic.function_name().into(), signature.clone()) - .wrap_err("failed to declare function") - .unwrap_or_else(|err| panic!("{err}")); - - CallableFunction::Intrinsic { - intrinsic, - function_ref, - signature, - } -} diff --git a/frontend/wasm/src/miden_abi/mod.rs b/frontend/wasm/src/miden_abi/mod.rs index 85f84e7d4..d99329c86 100644 --- a/frontend/wasm/src/miden_abi/mod.rs +++ b/frontend/wasm/src/miden_abi/mod.rs @@ -2,27 +2,8 @@ pub(crate) mod stdlib; pub(crate) mod transform; pub(crate) mod tx_kernel; -use alloc::rc::Rc; -use core::cell::RefCell; - -use midenc_dialect_cf::ControlFlowOpBuilder; -use midenc_hir::{ - diagnostics::WrapErr, - dialects::builtin::{BuiltinOpBuilder, ModuleBuilder, WorldBuilder}, - interner::Symbol, - AbiParam, FunctionType, FxHashMap, Op, Signature, SmallVec, SymbolNameComponent, SymbolPath, - ValueRef, -}; +use midenc_hir::{interner::Symbol, FunctionType, FxHashMap, SymbolNameComponent, SymbolPath}; use midenc_hir_symbol::symbols; -use transform::transform_miden_abi_call; - -use crate::{ - callable::CallableFunction, - intrinsics, - module::function_builder_ext::{ - FunctionBuilderContext, FunctionBuilderExt, SSABuilderListener, - }, -}; pub(crate) type FunctionTypeMap = FxHashMap; pub(crate) type ModuleFunctionTypeMap = FxHashMap; @@ -74,135 +55,3 @@ fn miden_stdlib_function_type(path: &SymbolPath) -> FunctionType { .cloned() .unwrap_or_else(|| panic!("No Miden ABI function type found for function {path}")) } - -/// Restore module and function names of the intrinsics and Miden SDK functions -/// that were renamed to satisfy the Wasm Component Model requirements. -/// -/// Returns the pre-renamed (expected at the linking stage) module and function -/// names or given `wasm_module_id` and `wasm_function_id` ids if the function -/// is not an intrinsic or Miden SDK function -pub fn recover_imported_masm_function_id( - wasm_module_id: &str, - wasm_function_id: &str, -) -> Option { - match recover_imported_masm_module(wasm_module_id) { - Ok(mut path) => { - // Since `hash-1to1` is an invalid name in Wasm CM (dashed part cannot start with a digit), - // we need to translate the CM name to the one that is expected at the linking stage - let function_id = if wasm_function_id == "hash-one-to-one" { - Symbol::from("hash_1to1") - } else if wasm_function_id == "hash-two-to-one" { - Symbol::from("hash_2to1") - } else { - Symbol::intern(wasm_function_id.replace("-", "_")) - }; - - path.set_name(function_id); - - Some(path) - } - Err(_unknown_module_id) => None, - } -} - -/// Restore module names of the intrinsics and Miden SDK -/// that were renamed to satisfy the Wasm Component Model requirements. -/// -/// Returns the pre-renamed (expected at the linking stage) module name -/// or given `wasm_module_id` if the module is not an intrinsic or Miden SDK module -pub fn recover_imported_masm_module(wasm_module_id: &str) -> Result { - if wasm_module_id.starts_with("miden:core-intrinsics/intrinsics-mem") { - Ok(SymbolPath::from_masm_module_id(intrinsics::mem::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-intrinsics/intrinsics-felt") { - Ok(SymbolPath::from_masm_module_id(intrinsics::felt::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-intrinsics/intrinsics-debug") { - Ok(SymbolPath::from_masm_module_id(intrinsics::debug::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-intrinsics/intrinsics-crypto") { - Ok(SymbolPath::from_masm_module_id(intrinsics::crypto::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-intrinsics/intrinsics-advice") { - Ok(SymbolPath::from_masm_module_id(intrinsics::advice::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-base/account") { - Ok(SymbolPath::from_masm_module_id(tx_kernel::account::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-base/note") { - Ok(SymbolPath::from_masm_module_id(tx_kernel::note::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-base/tx") { - Ok(SymbolPath::from_masm_module_id(tx_kernel::tx::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-stdlib/stdlib-mem") { - Ok(SymbolPath::from_masm_module_id(stdlib::mem::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-stdlib/stdlib-crypto-dsa-rpo-falcon") { - Ok(SymbolPath::from_masm_module_id(stdlib::crypto::dsa::rpo_falcon::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-stdlib/stdlib-crypto-hashes-blake3") { - Ok(SymbolPath::from_masm_module_id(stdlib::crypto::hashes::blake3::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-stdlib/stdlib-crypto-hashes-rpo") { - Ok(SymbolPath::from_masm_module_id(stdlib::crypto::hashes::rpo::MODULE_ID)) - } else if wasm_module_id.starts_with("miden:core-import") { - panic!("unrecovered intrinsics or Miden SDK import module ID: {wasm_module_id}") - } else { - // Unrecognized module ID, return as a `Symbol` - Err(Symbol::intern(wasm_module_id)) - } -} - -/// Define a synthetic wrapper functon transforming parameters, calling the Miden ABI function -/// (think written in MASM) and transforming result -pub fn define_func_for_miden_abi_transformation( - world_builder: &mut WorldBuilder, - module_builder: &mut ModuleBuilder, - synth_func_id: SymbolPath, - synth_func_sig: Signature, - import_path: SymbolPath, -) -> CallableFunction { - let import_ft = miden_abi_function_type(&import_path); - let import_sig = Signature::new( - import_ft.params.into_iter().map(AbiParam::new), - import_ft.results.into_iter().map(AbiParam::new), - ); - let function_ref = module_builder - .define_function(synth_func_id.name().into(), synth_func_sig.clone()) - .expect("failed to create an import function"); - let func = function_ref.borrow(); - let span = func.name().span; - let context = func.as_operation().context_rc(); - let func_ctx = Rc::new(RefCell::new(FunctionBuilderContext::new(context.clone()))); - let mut op_builder = - midenc_hir::OpBuilder::new(context).with_listener(SSABuilderListener::new(func_ctx)); - drop(func); - let mut func_builder = FunctionBuilderExt::new(function_ref, &mut op_builder); - let entry_block = func_builder.current_block(); - func_builder.seal_block(entry_block); // Declare all predecessors known. - let args: Vec = entry_block - .borrow() - .arguments() - .iter() - .copied() - .map(|ba| ba as ValueRef) - .collect(); - - let import_module_ref = world_builder - .declare_module_tree(&import_path) - .wrap_err("failed to create module for imports") - .unwrap_or_else(|err| panic!("{err}")); - let mut import_module_builder = ModuleBuilder::new(import_module_ref); - let import_func_ref = import_module_builder - .define_function(import_path.name().into(), import_sig.clone()) - .expect("failed to create an import function"); - let results = - transform_miden_abi_call(import_func_ref, &import_path, args.as_slice(), &mut func_builder); - - let exit_block = func_builder.create_block(); - func_builder.append_block_params_for_function_returns(exit_block); - func_builder.br(exit_block, results, span).expect("failed br"); - func_builder.seal_block(exit_block); - func_builder.switch_to_block(exit_block); - let arg_vals: SmallVec<[ValueRef; 1]> = { - let borrow = exit_block.borrow(); - borrow.argument_values().collect() - }; - func_builder.ret(arg_vals, span).expect("failed ret"); - - CallableFunction::Function { - wasm_id: synth_func_id, - function_ref, - signature: synth_func_sig, - } -} diff --git a/frontend/wasm/src/module/build_ir.rs b/frontend/wasm/src/module/build_ir.rs index 1c1546267..c1d523660 100644 --- a/frontend/wasm/src/module/build_ir.rs +++ b/frontend/wasm/src/module/build_ir.rs @@ -23,6 +23,7 @@ use crate::{ error::WasmResult, module::{ func_translator::FuncTranslator, + linker_stubs::maybe_lower_linker_stub, module_env::{FunctionBodyData, ModuleEnvironment, ParsedModule}, types::ir_type, }, @@ -96,9 +97,6 @@ pub fn build_ir_module( .memories .get(MemoryIndex::from_u32(0)) .map(|mem| mem.minimum as u32); - // if let Some(memory_size) = memory_size { - // module_builder.with_reserved_memory_pages(memory_size); - // } build_globals(&parsed_module.module, module_state.module_builder, context.diagnostics())?; build_data_segments(parsed_module, module_state.module_builder, context.diagnostics())?; @@ -132,7 +130,13 @@ pub fn build_ir_module( module_state.module_builder.get_function(func_name).unwrap_or_else(|| { panic!("cannot build {func_name} function, since it is not defined in the module.") }); - // let mut module_func_builder = module_builder.function(func_name.as_str(), sig.clone())?; + // If this is a linker stub, synthesize its body to exec the MASM callee. + // Note: Intrinsics and Miden ABI (SDK/stdlib) calls are expected to be + // surfaced via such linker stubs rather than as core-wasm imports. + if maybe_lower_linker_stub(function_ref, &body_data.body, module_state)? { + continue; + } + let FunctionBodyData { validator, body } = body_data; let mut func_validator = validator.into_validator(Default::default()); func_translator.translate_body( @@ -145,9 +149,7 @@ pub fn build_ir_module( context.session(), &mut func_validator, )?; - // module_func_builder.build(&context.session.diagnostics)?; } - // let module = module_builder.build(); Ok(()) } diff --git a/frontend/wasm/src/module/linker_stubs.rs b/frontend/wasm/src/module/linker_stubs.rs new file mode 100644 index 000000000..b42cda743 --- /dev/null +++ b/frontend/wasm/src/module/linker_stubs.rs @@ -0,0 +1,167 @@ +//! Generic lowering for Rust linker stubs to MASM procedure calls. +//! A linker stub is detected as a function whose body consists solely of a +//! single `unreachable` instruction (plus the implicit `end`). The stub +//! function name is expected to be a fully-qualified MASM function path like +//! `miden::account::add_asset` and is used to locate the MASM callee. + +use core::str::FromStr; +use std::cell::RefCell; + +use midenc_dialect_cf::ControlFlowOpBuilder; +use midenc_hir::{ + diagnostics::WrapErr, + dialects::builtin::{BuiltinOpBuilder, FunctionRef, ModuleBuilder}, + AbiParam, FunctionType, Op, Signature, SmallVec, SymbolPath, ValueRef, +}; +use wasmparser::{FunctionBody, Operator}; + +use crate::{ + error::WasmResult, + intrinsics::{convert_intrinsics_call, Intrinsic}, + miden_abi::{ + is_miden_abi_module, miden_abi_function_type, transform::transform_miden_abi_call, + }, + module::{ + function_builder_ext::{FunctionBuilderContext, FunctionBuilderExt, SSABuilderListener}, + module_translation_state::ModuleTranslationState, + }, +}; + +/// Returns true if the given Wasm function body consists only of an +/// `unreachable` operator (ignoring `end`/`nop`). +pub fn is_unreachable_stub(body: &FunctionBody<'_>) -> bool { + let mut reader = match body.get_operators_reader() { + Ok(r) => r, + Err(_) => return false, + }; + let mut saw_unreachable = false; + while !reader.eof() { + let Ok((op, _)) = reader.read_with_offset() else { + return false; + }; + match op { + Operator::Unreachable => { + saw_unreachable = true; + } + Operator::End | Operator::Nop => { + // ignore + } + _ => return false, + } + } + saw_unreachable +} + +/// If `body` looks like a linker stub, lowers `function_ref` to a call to the +/// MASM callee derived from the function name and applies the appropriate +/// TransformStrategy. Returns `true` if handled, `false` otherwise. +pub fn maybe_lower_linker_stub( + function_ref: FunctionRef, + body: &FunctionBody<'_>, + module_state: &mut ModuleTranslationState, +) -> WasmResult { + if !is_unreachable_stub(body) { + return Ok(false); + } + + // Parse function name as MASM function ident: "ns::...::func" + let name_string = { + let borrowed = function_ref.borrow(); + borrowed.name().as_str().to_string() + }; + // Expect stub export names to be fully-qualified MASM paths already (e.g. "intrinsics::felt::add"). + let func_ident = match midenc_hir::FunctionIdent::from_str(&name_string) { + Ok(id) => id, + Err(_) => return Ok(false), + }; + let import_path: SymbolPath = SymbolPath::from_masm_function_id(func_ident); + // Ensure the stub targets a known Miden ABI module or a recognized intrinsic. + let is_intrinsic = Intrinsic::try_from(&import_path).is_ok(); + if !is_miden_abi_module(&import_path) && !is_intrinsic { + return Ok(false); + } + + // Classify intrinsics and obtain signature when needed + let (import_sig, intrinsic): (Signature, Option) = + match Intrinsic::try_from(&import_path) { + Ok(intr) => (function_ref.borrow().signature().clone(), Some(intr)), + Err(_) => { + let import_ft: FunctionType = miden_abi_function_type(&import_path); + ( + Signature::new( + import_ft.params.into_iter().map(AbiParam::new), + import_ft.results.into_iter().map(AbiParam::new), + ), + None, + ) + } + }; + + // Build the function body for the stub and replace it with an exec to MASM + let span = function_ref.borrow().name().span; + let context = function_ref.borrow().as_operation().context_rc(); + let func_builder_ctx = + std::rc::Rc::new(RefCell::new(FunctionBuilderContext::new(context.clone()))); + let mut op_builder = midenc_hir::OpBuilder::new(context) + .with_listener(SSABuilderListener::new(func_builder_ctx)); + let mut fb = FunctionBuilderExt::new(function_ref, &mut op_builder); + + // Entry/args + let entry_block = fb.current_block(); + fb.seal_block(entry_block); + let args: Vec = entry_block + .borrow() + .arguments() + .iter() + .copied() + .map(|ba| ba as ValueRef) + .collect(); + + // Declare MASM import callee in world and exec via TransformStrategy + let results: Vec = if let Some(intr) = intrinsic { + // Decide whether the intrinsic is implemented as a function or an operation + let Some(conv) = intr.conversion_result() else { + return Ok(false); + }; + if conv.is_function() { + // Declare callee and call via convert_intrinsics_call with function_ref + let import_module_ref = module_state + .world_builder + .declare_module_tree(&import_path.without_leaf()) + .wrap_err("failed to create module for intrinsics imports")?; + let mut import_module_builder = ModuleBuilder::new(import_module_ref); + let intrinsic_func_ref = import_module_builder + .define_function(import_path.name().into(), import_sig.clone()) + .wrap_err("failed to create intrinsic function ref")?; + convert_intrinsics_call(intr, Some(intrinsic_func_ref), &args, &mut fb, span)?.to_vec() + } else { + // Inline conversion of intrinsic operation + convert_intrinsics_call(intr, None, &args, &mut fb, span)?.to_vec() + } + } else { + // Miden ABI path: exec import with TransformStrategy + let import_module_ref = module_state + .world_builder + .declare_module_tree(&import_path.without_leaf()) + .wrap_err("failed to create module for MASM imports")?; + let mut import_module_builder = ModuleBuilder::new(import_module_ref); + let import_func_ref = import_module_builder + .define_function(import_path.name().into(), import_sig) + .wrap_err("failed to create MASM import function ref")?; + transform_miden_abi_call(import_func_ref, &import_path, &args, &mut fb) + }; + + // Return + let exit_block = fb.create_block(); + fb.append_block_params_for_function_returns(exit_block); + fb.br(exit_block, results, span)?; + fb.seal_block(exit_block); + fb.switch_to_block(exit_block); + let ret_vals: SmallVec<[ValueRef; 1]> = { + let borrow = exit_block.borrow(); + borrow.argument_values().collect() + }; + fb.ret(ret_vals, span)?; + + Ok(true) +} diff --git a/frontend/wasm/src/module/mod.rs b/frontend/wasm/src/module/mod.rs index 667670a4e..76d92373b 100644 --- a/frontend/wasm/src/module/mod.rs +++ b/frontend/wasm/src/module/mod.rs @@ -17,6 +17,7 @@ pub mod func_translation_state; pub mod func_translator; pub mod function_builder_ext; pub mod instance; +pub mod linker_stubs; pub mod module_env; pub mod module_translation_state; pub mod types; diff --git a/frontend/wasm/src/module/module_translation_state.rs b/frontend/wasm/src/module/module_translation_state.rs index 6193592a0..473980186 100644 --- a/frontend/wasm/src/module/module_translation_state.rs +++ b/frontend/wasm/src/module/module_translation_state.rs @@ -3,25 +3,19 @@ use midenc_hir::{ interner::Symbol, smallvec, CallConv, FxHashMap, Signature, SymbolNameComponent, SymbolPath, Visibility, }; -use midenc_session::diagnostics::DiagnosticsHandler; +use midenc_session::diagnostics::{DiagnosticsHandler, Severity}; use super::{instance::ModuleArgument, ir_func_type, types::ModuleTypesBuilder, FuncIndex, Module}; use crate::{ - callable::CallableFunction, - component::lower_imports::generate_import_lowering_function, - error::WasmResult, - intrinsics::{process_intrinsics_import, Intrinsic}, - miden_abi::{ - define_func_for_miden_abi_transformation, is_miden_abi_module, - recover_imported_masm_function_id, - }, - translation_utils::sig_from_func_type, + callable::CallableFunction, component::lower_imports::generate_import_lowering_function, + error::WasmResult, translation_utils::sig_from_func_type, }; pub struct ModuleTranslationState<'a> { /// Imported and local functions functions: FxHashMap, pub module_builder: &'a mut ModuleBuilder, + pub world_builder: &'a mut WorldBuilder, } impl<'a> ModuleTranslationState<'a> { @@ -62,13 +56,28 @@ impl<'a> ModuleTranslationState<'a> { if module.is_imported_function(index) { assert!((index.as_u32() as usize) < module.num_imported_funcs); let import = &module.imports[index.as_u32() as usize]; - let func = - process_import(module_builder, world_builder, &module_args, path, sig, import)?; + let func = process_import( + module_builder, + world_builder, + &module_args, + path, + sig, + import, + diagnostics, + )?; functions.insert(index, func); } else { let function_ref = module_builder .define_function(path.name().into(), sig.clone()) - .expect("adding new function failed"); + .map_err(|e| { + diagnostics + .diagnostic(Severity::Error) + .with_message(format!( + "Failed to add new function '{}' to module: {e:?}", + path.name() + )) + .into_report() + })?; let defined_function = CallableFunction::Function { wasm_id: path, function_ref, @@ -80,6 +89,7 @@ impl<'a> ModuleTranslationState<'a> { Ok(Self { functions, module_builder, + world_builder, }) } @@ -98,44 +108,26 @@ fn process_import( core_func_id: SymbolPath, core_func_sig: Signature, import: &super::ModuleImport, -) -> Result { - match recover_imported_masm_function_id(&import.module, &import.field) { - Some(masm_function_path) => { - if let Ok(intrinsic) = Intrinsic::try_from(&masm_function_path) { - Ok(process_intrinsics_import(world_builder, intrinsic, core_func_sig)) - } else if is_miden_abi_module(&masm_function_path) { - Ok(define_func_for_miden_abi_transformation( - world_builder, - module_builder, - core_func_id, - core_func_sig, - masm_function_path, - )) - } else { - unimplemented!("unhandled masm primitive: '{masm_function_path}'") - } - } - None => { - let import_path = SymbolPath { - path: smallvec![ - SymbolNameComponent::Root, - SymbolNameComponent::Component(Symbol::intern(&import.module)), - SymbolNameComponent::Leaf(Symbol::intern(&import.field)) - ], - }; - let module_arg = module_args - .get(&import_path) - .unwrap_or_else(|| panic!("unexpected import '{import_path:?}'")); - process_module_arg( - module_builder, - world_builder, - core_func_id, - core_func_sig, - import_path, - module_arg, - ) - } - } + diagnostics: &DiagnosticsHandler, +) -> WasmResult { + let import_path = SymbolPath { + path: smallvec![ + SymbolNameComponent::Root, + SymbolNameComponent::Component(Symbol::intern(&import.module)), + SymbolNameComponent::Leaf(Symbol::intern(&import.field)) + ], + }; + let Some(module_arg) = module_args.get(&import_path) else { + crate::unsupported_diag!(diagnostics, "unexpected import '{import_path:?}'"); + }; + process_module_arg( + module_builder, + world_builder, + core_func_id, + core_func_sig, + import_path, + module_arg, + ) } fn process_module_arg( @@ -145,7 +137,7 @@ fn process_module_arg( sig: Signature, wasm_import_path: SymbolPath, module_arg: &ModuleArgument, -) -> Result { +) -> WasmResult { Ok(match module_arg { ModuleArgument::Function(_) => { todo!("core Wasm function import is not implemented yet"); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 79c890449..2b86f8fff 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -3,6 +3,6 @@ # - docs/src/usage/cargo-miden.md # - docs/src/usage/midenc.md channel = "nightly-2025-07-20" -components = ["rustfmt", "rust-src", "clippy"] +components = ["rustfmt", "rust-src", "clippy", "llvm-tools"] targets = ["wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip2"] profile = "minimal" diff --git a/sdk/alloc/Cargo.toml b/sdk/alloc/Cargo.toml index 351a8d82e..e45c3df67 100644 --- a/sdk/alloc/Cargo.toml +++ b/sdk/alloc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-sdk-alloc" description = "A simple bump allocator for Miden SDK programs" -version.workspace = true +version = "0.5.0" rust-version.workspace = true authors.workspace = true repository.workspace = true diff --git a/sdk/alloc/build.rs b/sdk/alloc/build.rs new file mode 100644 index 000000000..b915cd29c --- /dev/null +++ b/sdk/alloc/build.rs @@ -0,0 +1,105 @@ +// Build the Miden alloc stubs and link them for dependents. +// +// We produce a native static library (.a) that contains only the stub object +// files (no panic handler) to avoid duplicate panic symbols in downstream +// component builds. We do this by compiling a single object with rustc and +// packaging it into an archive with `ar`. +// +// Why not an rlib? +// - `cargo:rustc-link-lib`/`cargo:rustc-link-search` are for native archives; +// .rlib doesn’t fit that model and attempts to use `rustc-link-arg` don’t +// propagate to dependents. +// Why not a staticlib via rustc directly? +// - A no_std staticlib usually requires a `#[panic_handler]`, which then +// collides at link time with other crates that also define panic symbols. +// - Packaging a single object keeps the archive minimal and free of panic +// symbols. + +use std::{env, path::PathBuf, process::Command}; + +fn ensure_rust_ar() { + // Preflight: ensure `rust-ar` is available. This typically comes from the + // `llvm-tools` rustup component or via `cargo-binutils`. + if Command::new("rust-ar").arg("--version").output().is_ok() { + return; + } + // Attempt to install cargo-binutils to expose proxies + let _ = Command::new("cargo").args(["install", "cargo-binutils"]).status(); + // Re-check after install + if Command::new("rust-ar").arg("--version").output().is_ok() { + return; + } + panic!( + "`rust-ar` was not found. Ensure the `llvm-tools` component is present (listed in \ + rust-toolchain.toml) and try installing proxies via `cargo install cargo-binutils`." + ); +} + +fn main() { + let target = env::var("TARGET").unwrap_or_else(|_| "wasm32-wasip1".to_string()); + + // Only build the wasm stub when targeting wasm32 + if !target.starts_with("wasm32") { + println!("cargo:rerun-if-changed=stubs/heap_base.rs"); + return; + } + + let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + + println!("cargo:rerun-if-env-changed=TARGET"); + println!("cargo:rerun-if-env-changed=RUSTUP_TOOLCHAIN"); + println!("cargo:rerun-if-env-changed=RUSTFLAGS"); + println!("cargo:rerun-if-changed={}", manifest_dir.join("stubs/heap_base.rs").display()); + + let out_obj = out_dir.join("miden_alloc_heap_base.o"); + let out_a = out_dir.join("libmiden_alloc_intrinsics.a"); + + // Ensure tools are present before invoking them. + ensure_rust_ar(); + + // Compile a single object with the stub + let status = Command::new("rustc") + .arg("--crate-name") + .arg("miden_alloc_heap_base_stub") + .arg("--edition=2021") + .arg("--crate-type=rlib") + .arg("--target") + .arg(&target) + .arg("-C") + .arg("opt-level=1") + .arg("-C") + .arg("panic=abort") + .arg("-C") + .arg("codegen-units=1") + .arg("-C") + .arg("debuginfo=0") + .arg("-Z") + .arg("merge-functions=disabled") + .arg("-C") + .arg("target-feature=+bulk-memory,+wide-arithmetic") + .arg("--emit=obj") + .arg("-o") + .arg(&out_obj) + .arg(manifest_dir.join("stubs/heap_base.rs")) + .status() + .expect("failed to spawn rustc for heap_base stub object"); + if !status.success() { + panic!("failed to compile heap_base stub object: {status}"); + } + + // Archive + let status = Command::new("rust-ar") + .arg("crs") + .arg(&out_a) + .arg(&out_obj) + .status() + .expect("failed to spawn ar for alloc stubs"); + if !status.success() { + panic!("failed to archive alloc stubs: {status}"); + } + + // Link for dependents of this crate + println!("cargo:rustc-link-search=native={}", out_dir.display()); + println!("cargo:rustc-link-lib=static=miden_alloc_intrinsics"); +} diff --git a/sdk/alloc/src/lib.rs b/sdk/alloc/src/lib.rs index f8a7286b2..37d789f01 100644 --- a/sdk/alloc/src/lib.rs +++ b/sdk/alloc/src/lib.rs @@ -125,8 +125,7 @@ unsafe impl GlobalAlloc for BumpAlloc { } #[cfg(target_family = "wasm")] -#[link(wasm_import_module = "miden:core-intrinsics/intrinsics-mem@1.0.0")] extern "C" { - #[link_name = "heap-base"] + #[link_name = "intrinsics::mem::heap_base"] fn heap_base() -> *mut u8; } diff --git a/sdk/alloc/stubs/heap_base.rs b/sdk/alloc/stubs/heap_base.rs new file mode 100644 index 000000000..54789a1da --- /dev/null +++ b/sdk/alloc/stubs/heap_base.rs @@ -0,0 +1,10 @@ +#![no_std] + +// Provide a local definition for the allocator to link against, and export it +// under the MASM intrinsic path so the frontend recognizes and lowers it. + +#[export_name = "intrinsics::mem::heap_base"] +pub extern "C" fn __intrinsics_mem_heap_base_stub() -> *mut u8 { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/base-macros/Cargo.toml b/sdk/base-macros/Cargo.toml index 9b8589b81..bc58cb513 100644 --- a/sdk/base-macros/Cargo.toml +++ b/sdk/base-macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-base-macros" description = "Provides proc macro support for Miden rollup SDK" -version.workspace = true +version = "0.5.0" rust-version.workspace = true authors.workspace = true repository.workspace = true diff --git a/sdk/base-sys/Cargo.toml b/sdk/base-sys/Cargo.toml index a77e67b7d..d2ee78ef1 100644 --- a/sdk/base-sys/Cargo.toml +++ b/sdk/base-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-base-sys" description = "Miden rollup Rust bingings and MASM library" -version.workspace = true +version = "0.5.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -12,11 +12,11 @@ keywords.workspace = true license.workspace = true readme.workspace = true edition.workspace = true +build = "build.rs" +links = "miden_base_sys_stubs" [dependencies] -miden-stdlib-sys = { version = "0.4.1", path = "../stdlib-sys" } +miden-stdlib-sys = { version = "0.5.0", path = "../stdlib-sys" } [features] default = [] -# WIT files for Wasm Component Model -"wit" = [] diff --git a/sdk/base-sys/build.rs b/sdk/base-sys/build.rs new file mode 100644 index 000000000..3589991bf --- /dev/null +++ b/sdk/base-sys/build.rs @@ -0,0 +1,141 @@ +// Build the Miden base stubs and link them for dependents. +// +// We produce a native static library (.a) that contains only the stub object +// files (no panic handler) to avoid duplicate panic symbols in downstream +// component builds. We do this by compiling a single object with rustc and +// packaging it into an archive with `ar`. +// +// Why not an rlib? +// - `cargo:rustc-link-lib`/`cargo:rustc-link-search` are for native archives; +// .rlib doesn’t fit that model and attempts to use `rustc-link-arg` don’t +// propagate to dependents. +// Why not a staticlib via rustc directly? +// - A no_std staticlib usually requires a `#[panic_handler]`, which then +// collides at link time with other crates that also define panic symbols. +// - Packaging a single object keeps the archive minimal and free of panic +// symbols. + +use std::{env, path::PathBuf, process::Command}; + +fn ensure_rust_ar() { + // Preflight: ensure `rust-ar` is available. This typically comes from the + // `llvm-tools` rustup component or via `cargo-binutils`. + if Command::new("rust-ar").arg("--version").output().is_ok() { + return; + } + + let _ = Command::new("cargo").args(["install", "cargo-binutils"]).status(); + if Command::new("rust-ar").arg("--version").output().is_ok() { + return; + } + panic!( + "`rust-ar` was not found. Ensure the `llvm-tools` component is present (listed in \ + rust-toolchain.toml) and try installing proxies via `cargo install cargo-binutils`." + ); +} + +fn main() { + let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + let target = env::var("TARGET").unwrap_or_else(|_| "wasm32-wasip1".to_string()); + + if !target.starts_with("wasm32") { + // Still track files for re-run if changed in case of cross compilation. + let stubs_root = manifest_dir.join("stubs"); + let src_root = stubs_root.join("lib.rs"); + if src_root.exists() { + println!("cargo:rerun-if-changed={}", src_root.display()); + } + return; + } + + println!("cargo:rerun-if-env-changed=TARGET"); + println!("cargo:rerun-if-env-changed=RUSTUP_TOOLCHAIN"); + println!("cargo:rerun-if-env-changed=RUSTFLAGS"); + + let stubs_root = manifest_dir.join("stubs"); + let src_root = stubs_root.join("lib.rs"); + // Ensure build script reruns when any stub file changes + println!("cargo:rerun-if-changed={}", src_root.display()); + if let Ok(read_dir) = std::fs::read_dir(&stubs_root) { + for entry in read_dir.flatten() { + let p = entry.path(); + if p.is_dir() { + if let Ok(inner) = std::fs::read_dir(&p) { + for e in inner.flatten() { + let pp = e.path(); + if pp.extension().and_then(|s| s.to_str()) == Some("rs") { + println!("cargo:rerun-if-changed={}", pp.display()); + } + } + } + } else if p.extension().and_then(|s| s.to_str()) == Some("rs") { + println!("cargo:rerun-if-changed={}", p.display()); + } + } + } + + // Build a single object, then package into a static archive to avoid + // bringing in panic symbols. + let out_static = out_dir.join("libmiden_base_sys_stubs.a"); + let out_obj = out_dir.join("miden_base_sys_stubs.o"); + + // Ensure tools are present before invoking them. + ensure_rust_ar(); + + // 1) Compile object + // These stubs intentionally compile to `unreachable` so the frontend recognizes + // and lowers their exported symbol names to MASM calls. + // LLVM MergeFunctions pass https://llvm.org/docs/MergeFunctions.html considers some + // functions in the stub library identical (e.g. `intrinsics::felt::add` and + // `intrinsics::felt::mul`) because besides the same sig they have the same body + // (`unreachable`). The pass merges them which manifests in the compiled Wasm as if both + // `add` and `mul` are linked to the same (`add` in this case) function. + // Setting `opt-level=1` seems to be skipping this pass and is enough on its own, but I + // also put `-Z merge-functions=disabled` in case `opt-level=1` behaviour changes + // in the future and runs the MergeFunctions pass. + // `opt-level=0` - introduces import for panic infra leading to WIT encoder error (unsatisfied import). + let status = Command::new("rustc") + .arg("--crate-name") + .arg("miden_base_sys_stubs") + .arg("--edition=2021") + .arg("--crate-type=rlib") + .arg("--target") + .arg(&target) + .arg("-C") + .arg("opt-level=1") + .arg("-C") + .arg("panic=abort") + .arg("-C") + .arg("codegen-units=1") + .arg("-C") + .arg("debuginfo=0") + .arg("-Z") + .arg("merge-functions=disabled") + .arg("-C") + .arg("target-feature=+bulk-memory,+wide-arithmetic") + .arg("--emit=obj") + .arg("-o") + .arg(&out_obj) + .arg(&src_root) + .status() + .expect("failed to spawn rustc for base stubs object"); + if !status.success() { + panic!("failed to compile miden-base-sys stubs object: {status}"); + } + + // 2) Archive + let status = Command::new("rust-ar") + .arg("crs") + .arg(&out_static) + .arg(&out_obj) + .status() + .expect("failed to spawn ar for base stubs"); + if !status.success() { + panic!("failed to archive miden-base-sys stubs: {status}"); + } + + // Emit link directives for dependents + println!("cargo:rustc-link-search=native={}", out_dir.display()); + println!("cargo:rustc-link-lib=static=miden_base_sys_stubs"); +} diff --git a/sdk/base-sys/src/base_sys_wit.rs b/sdk/base-sys/src/base_sys_wit.rs deleted file mode 100644 index e2b4d1ddf..000000000 --- a/sdk/base-sys/src/base_sys_wit.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[cfg(feature = "wit")] -pub const BASE_WIT: &str = include_str!("../wit/miden-core-base.wit"); diff --git a/sdk/base-sys/src/bindings/account.rs b/sdk/base-sys/src/bindings/account.rs index d91d50dea..a31dd37c0 100644 --- a/sdk/base-sys/src/bindings/account.rs +++ b/sdk/base-sys/src/bindings/account.rs @@ -3,16 +3,16 @@ use miden_stdlib_sys::Felt; use super::types::{AccountId, Asset}; #[allow(improper_ctypes)] -#[link(wasm_import_module = "miden:core-base/account@1.0.0")] extern "C" { - #[link_name = "get-id"] + #[link_name = "miden::account::get_id"] pub fn extern_account_get_id(ptr: *mut AccountId); - #[link_name = "add-asset"] - pub fn extern_account_add_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); - #[link_name = "remove-asset"] + #[link_name = "miden::account::remove_asset"] pub fn extern_account_remove_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); - #[link_name = "incr-nonce"] + #[link_name = "miden::account::incr_nonce"] pub fn extern_account_incr_nonce(value: i32); + // Resolved via stub rlib at core Wasm link time + #[link_name = "miden::account::add_asset"] + pub fn extern_account_add_asset(_: Felt, _: Felt, _: Felt, _: Felt, ptr: *mut Asset); } /// Get the account ID of the currently executing note account. diff --git a/sdk/base-sys/src/bindings/note.rs b/sdk/base-sys/src/bindings/note.rs index 68a90eff3..0f2402b06 100644 --- a/sdk/base-sys/src/bindings/note.rs +++ b/sdk/base-sys/src/bindings/note.rs @@ -5,11 +5,10 @@ use miden_stdlib_sys::Felt; use super::Asset; -#[link(wasm_import_module = "miden:core-base/note@1.0.0")] extern "C" { - #[link_name = "get-inputs"] + #[link_name = "miden::note::get_inputs"] pub fn extern_note_get_inputs(ptr: *mut Felt) -> usize; - #[link_name = "get-assets"] + #[link_name = "miden::note::get_assets"] pub fn extern_note_get_assets(ptr: *mut Felt) -> usize; } diff --git a/sdk/base-sys/src/bindings/storage.rs b/sdk/base-sys/src/bindings/storage.rs index f69b98d49..ea8ed370f 100644 --- a/sdk/base-sys/src/bindings/storage.rs +++ b/sdk/base-sys/src/bindings/storage.rs @@ -3,12 +3,11 @@ use miden_stdlib_sys::{Felt, Word}; use super::StorageCommitmentRoot; #[allow(improper_ctypes)] -#[link(wasm_import_module = "miden:core-base/account@1.0.0")] extern "C" { - #[link_name = "get-item"] + #[link_name = "miden::account::get_item"] pub fn extern_get_storage_item(index: Felt, ptr: *mut Word); - #[link_name = "set-item"] + #[link_name = "miden::account::set_item"] pub fn extern_set_storage_item( index: Felt, v0: Felt, @@ -18,7 +17,7 @@ extern "C" { ptr: *mut (StorageCommitmentRoot, Word), ); - #[link_name = "get-map-item"] + #[link_name = "miden::account::get_map_item"] pub fn extern_get_storage_map_item( index: Felt, k0: Felt, @@ -28,7 +27,7 @@ extern "C" { ptr: *mut Word, ); - #[link_name = "set-map-item"] + #[link_name = "miden::account::set_map_item"] pub fn extern_set_storage_map_item( index: Felt, k0: Felt, diff --git a/sdk/base-sys/src/bindings/tx.rs b/sdk/base-sys/src/bindings/tx.rs index cbe78e6b5..4b7309399 100644 --- a/sdk/base-sys/src/bindings/tx.rs +++ b/sdk/base-sys/src/bindings/tx.rs @@ -3,9 +3,8 @@ use miden_stdlib_sys::Felt; use super::types::{Asset, NoteIdx, NoteType, Recipient, Tag}; #[allow(improper_ctypes)] -#[link(wasm_import_module = "miden:core-base/tx@1.0.0")] extern "C" { - #[link_name = "create-note"] + #[link_name = "miden::tx::create_note"] pub fn extern_tx_create_note( tag: Tag, aux: Felt, @@ -17,7 +16,7 @@ extern "C" { recipient_f3: Felt, ) -> NoteIdx; - #[link_name = "add-asset-to-note"] + #[link_name = "miden::tx::add_asset_to_note"] pub fn extern_tx_add_asset_to_note( asset_f0: Felt, asset_f1: Felt, diff --git a/sdk/base-sys/src/lib.rs b/sdk/base-sys/src/lib.rs index 66f404982..3adbebc89 100644 --- a/sdk/base-sys/src/lib.rs +++ b/sdk/base-sys/src/lib.rs @@ -3,6 +3,3 @@ #![deny(warnings)] pub mod bindings; - -#[cfg(feature = "wit")] -pub mod base_sys_wit; diff --git a/sdk/base-sys/stubs/account.rs b/sdk/base-sys/stubs/account.rs new file mode 100644 index 000000000..30f42ec5d --- /dev/null +++ b/sdk/base-sys/stubs/account.rs @@ -0,0 +1,77 @@ +use core::ffi::c_void; + +/// Account interface stubs +/// +/// Unreachable stub for `add-asset` import (extern_account_add_asset). +/// Signature matches the Wasm lowering used by the SDK: (f32, f32, f32, f32, i32) +#[export_name = "miden::account::add_asset"] +pub extern "C" fn add_asset_plain(_a0: f32, _a1: f32, _a2: f32, _a3: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::remove_asset"] +pub extern "C" fn remove_asset_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::get_id"] +pub extern "C" fn account_get_id_plain(_out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::get_item"] +pub extern "C" fn account_get_item_plain(_index: f32, _out: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::set_item"] +pub extern "C" fn account_set_item_plain( + _index: f32, + _v0: f32, + _v1: f32, + _v2: f32, + _v3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::get_map_item"] +pub extern "C" fn account_get_map_item_plain( + _index: f32, + _k0: f32, + _k1: f32, + _k2: f32, + _k3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::set_map_item"] +pub extern "C" fn account_set_map_item_plain( + _index: f32, + _k0: f32, + _k1: f32, + _k2: f32, + _k3: f32, + _v0: f32, + _v1: f32, + _v2: f32, + _v3: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::account::incr_nonce"] +pub extern "C" fn account_incr_nonce_plain(_value: i32) { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/base-sys/stubs/lib.rs b/sdk/base-sys/stubs/lib.rs new file mode 100644 index 000000000..8badd074e --- /dev/null +++ b/sdk/base-sys/stubs/lib.rs @@ -0,0 +1,14 @@ +#![no_std] + +//! Unreachable stubs for Miden base SDK functions. +//! +//! These stubs are compiled by build.rs into a separate rlib and +//! linked to `miden-base-sys` so that the Wasm translator can lower +//! the calls appropriately. They are not part of the crate sources. + +mod account; +mod note; +mod tx; + +// No panic handler here; the stubs are packaged as a single object into a +// static archive by build.rs to avoid introducing panic symbols. diff --git a/sdk/base-sys/stubs/note.rs b/sdk/base-sys/stubs/note.rs new file mode 100644 index 000000000..8c06eca6b --- /dev/null +++ b/sdk/base-sys/stubs/note.rs @@ -0,0 +1,13 @@ +use core::ffi::c_void; + +/// Note interface stubs +#[export_name = "miden::note::get_inputs"] +pub extern "C" fn note_get_inputs_plain(_ptr: *mut c_void) -> usize { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::note::get_assets"] +pub extern "C" fn note_get_assets_plain(_ptr: *mut c_void) -> usize { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/base-sys/stubs/tx.rs b/sdk/base-sys/stubs/tx.rs new file mode 100644 index 000000000..cf7516c6c --- /dev/null +++ b/sdk/base-sys/stubs/tx.rs @@ -0,0 +1,29 @@ +use core::ffi::c_void; + +/// Tx interface stubs +#[export_name = "miden::tx::create_note"] +pub extern "C" fn tx_create_note_plain( + _tag: f32, + _aux: f32, + _note_type: f32, + _execution_hint: f32, + _r0: f32, + _r1: f32, + _r2: f32, + _r3: f32, +) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "miden::tx::add_asset_to_note"] +pub extern "C" fn tx_add_asset_to_note_plain( + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _note_idx: f32, + _out: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/base-sys/wit/miden-core-base.wit b/sdk/base-sys/wit/miden-core-base.wit deleted file mode 100644 index 0bce97060..000000000 --- a/sdk/base-sys/wit/miden-core-base.wit +++ /dev/null @@ -1,83 +0,0 @@ -package miden:core-base@1.0.0; - -// The function signatures should be kept in sync with the signatures in the -// Rust SDK `extern` functions (see `/sdk`); - -interface account { - - /// Add the specified asset to the vault. Panics under various conditions. - /// Returns the final asset in the account vault defined as follows: If asset is - /// a non-fungible asset, then returns the same as asset. If asset is a - /// fungible asset, then returns the total fungible asset in the account - /// vault after asset was added to it. - add-asset: func(asset0: f32, asset1: f32, asset2: f32, asset3: f32, result-ptr: s32); - /// Remove the specified asset from the vault - remove-asset: func(asset0: f32, asset1: f32, asset2: f32, asset3: f32, result-ptr: s32); - /// Get the id of the currently executing account - get-id: func(result-ptr: s32); - - /// Gets an item from the account storage - get-item: func(index: f32, result-ptr: s32); - /// Sets an item in the account storage - set-item: func(index: f32, value0: f32, value1: f32, value2: f32, value3: f32, result-ptr: s32); - /// Gets a map item from the account storage - get-map-item: func(index: f32, key0: f32, key1: f32, key2: f32, key3: f32, result-ptr: s32); - /// Sets a map item in the account storage - set-map-item: func(index: f32, key0: f32, key1: f32, key2: f32, key3: f32, value0: f32, value1: f32, value2: f32, value3: f32, result-ptr: s32); - - /// Increments the account nonce by the provided value. - incr-nonce: func(value: u32); -} - - -interface note { - - /// Get the inputs of the currently executed note - get-inputs: func(ptr: s32) -> s32; - /// Get the assets of the currently executing note - get-assets: func(ptr: s32) -> s32; -} - -interface tx { - - /// Creates a new note. - /// asset is the asset to be included in the note. - /// tag is the tag to be included in the note. - /// recipient is the recipient of the note. - /// Returns the id of the created note. - create-note: func( - tag: f32, - aux: f32, - note-type: f32, - execution-hint: f32, - recipient0: f32, - recipient1: f32, - recipient2: f32, - recipient3: f32, - ) -> f32; - - - /// Adds the ASSET to the note specified by the index. - /// - /// Inputs: [ASSET, note_idx] - /// Outputs: [ASSET, note_idx] - /// - /// Where: - /// - note_idx is the index of the note to which the asset is added. - /// - ASSET can be a fungible or non-fungible asset. - add-asset-to-note: func( - asset0: f32, - asset1: f32, - asset2: f32, - asset3: f32, - note-idx: f32, - result-ptr: s32, - ); - -} - -world base { - import account; - import note; - import tx; -} diff --git a/sdk/base/Cargo.toml b/sdk/base/Cargo.toml index d07d8a72e..a144ceb88 100644 --- a/sdk/base/Cargo.toml +++ b/sdk/base/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-base" description = "Miden rollup Rust SDK" -version.workspace = true +version = "0.5.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -12,10 +12,10 @@ readme.workspace = true edition.workspace = true [dependencies] -miden-base-sys = { version = "0.4.1", path = "../base-sys" } -miden-stdlib-sys = { version = "0.4.1", path = "../stdlib-sys" } -miden-base-macros = { version = "0.4.1", path = "../base-macros" } +miden-base-sys = { version = "0.5.0", path = "../base-sys" } +miden-stdlib-sys = { version = "0.5.0", path = "../stdlib-sys" } +miden-base-macros = { version = "0.5.0", path = "../base-macros" } [features] default = [] -wit = ["miden-base-sys/wit", "miden-stdlib-sys/wit"] +wit = [] diff --git a/sdk/sdk/CHANGELOG.md b/sdk/sdk/CHANGELOG.md index 8958baa37..54763f69f 100644 --- a/sdk/sdk/CHANGELOG.md +++ b/sdk/sdk/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.5.0] + +### BREAKING +- Remove low-level WIT interfaces for Miden standard library and transaction protocol library and link directly using stub library and transforming the stub functions into calls to MASM procedures. + ## [0.0.8](https://github.com/0xMiden/compiler/compare/miden-v0.0.7...miden-v0.0.8) - 2025-04-24 ### Added diff --git a/sdk/sdk/Cargo.toml b/sdk/sdk/Cargo.toml index 7fd302c27..762b9af92 100644 --- a/sdk/sdk/Cargo.toml +++ b/sdk/sdk/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden" description = "Miden SDK" -version.workspace = true +version = "0.5.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -15,11 +15,10 @@ edition.workspace = true crate-type = ["rlib"] [dependencies] -miden-sdk-alloc = { version = "0.4.1", path = "../alloc" } -miden-stdlib-sys = { version = "0.4.1", path = "../stdlib-sys" } -miden-base = { version = "0.4.1", path = "../base" } -miden-base-sys = { version = "0.4.1", path = "../base-sys" } +miden-sdk-alloc = { version = "0.5.0", path = "../alloc" } +miden-stdlib-sys = { version = "0.5.0", path = "../stdlib-sys" } +miden-base = { version = "0.5.0", path = "../base" } +miden-base-sys = { version = "0.5.0", path = "../base-sys" } [features] default = [] -wit = ["miden-base/wit", "miden-base-sys/wit", "miden-stdlib-sys/wit"] diff --git a/sdk/stdlib-sys/Cargo.toml b/sdk/stdlib-sys/Cargo.toml index 24384441d..67613d6ec 100644 --- a/sdk/stdlib-sys/Cargo.toml +++ b/sdk/stdlib-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "miden-stdlib-sys" description = "Low-level Rust bindings for the Miden standard library" -version.workspace = true +version = "0.5.0" rust-version.workspace = true authors.workspace = true repository.workspace = true @@ -10,6 +10,8 @@ keywords.workspace = true license.workspace = true readme.workspace = true edition.workspace = true +build = "build.rs" +links = "miden_stdlib_sys_stubs" [lib] crate-type = ["rlib"] @@ -18,4 +20,3 @@ crate-type = ["rlib"] [features] default = [] -wit = [] diff --git a/sdk/stdlib-sys/build.rs b/sdk/stdlib-sys/build.rs new file mode 100644 index 000000000..81bd0ee7d --- /dev/null +++ b/sdk/stdlib-sys/build.rs @@ -0,0 +1,177 @@ +// Build the Miden stdlib stubs and link them for dependents. +// +// We produce a native static library (.a) that contains only the stub object +// files (no panic handler) to avoid duplicate panic symbols in downstream +// component builds. We do this by compiling a single object with rustc and +// packaging it into an archive with `ar`. +// +// Why not an rlib? +// - `cargo:rustc-link-lib`/`cargo:rustc-link-search` are for native archives; +// .rlib doesn’t fit that model and attempts to use `rustc-link-arg` don’t +// propagate to dependents. +// Why not a staticlib via rustc directly? +// - A no_std staticlib usually requires a `#[panic_handler]`, which then +// collides at link time with other crates that also define panic symbols. +// - Packaging a single object keeps the archive minimal and free of panic +// symbols. + +use std::{env, path::PathBuf, process::Command}; + +fn ensure_rust_ar() { + // Preflight: ensure `rust-ar` is available. This typically comes from the + // `llvm-tools` rustup component or via `cargo-binutils`. + if Command::new("rust-ar").arg("--version").output().is_ok() { + return; + } + let _ = Command::new("cargo").args(["install", "cargo-binutils"]).status(); + if Command::new("rust-ar").arg("--version").output().is_ok() { + return; + } + panic!( + "`rust-ar` was not found. Ensure the `llvm-tools` component is present (listed in \ + rust-toolchain.toml) and try installing proxies via `cargo install cargo-binutils`." + ); +} + +fn main() { + let manifest_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); + let target = env::var("TARGET").unwrap_or_else(|_| "wasm32-wasip1".to_string()); + + if !target.starts_with("wasm32") { + // track changes, but don’t build + let stubs_root = manifest_dir.join("stubs"); + let src_root = stubs_root.join("lib.rs"); + if src_root.exists() { + println!("cargo:rerun-if-changed={}", src_root.display()); + } + return; + } + + println!("cargo:rerun-if-env-changed=TARGET"); + println!("cargo:rerun-if-env-changed=RUSTUP_TOOLCHAIN"); + println!("cargo:rerun-if-env-changed=RUSTFLAGS"); + + let stubs_root = manifest_dir.join("stubs"); + let src_root = stubs_root.join("lib.rs"); + println!("cargo:rerun-if-changed={}", src_root.display()); + // Ensure build script reruns when any stub file changes + if let Ok(read_dir) = std::fs::read_dir(&stubs_root) { + for entry in read_dir.flatten() { + let p = entry.path(); + if p.is_dir() { + if let Ok(inner) = std::fs::read_dir(&p) { + for e in inner.flatten() { + let pp = e.path(); + if pp.extension().and_then(|s| s.to_str()) == Some("rs") { + println!("cargo:rerun-if-changed={}", pp.display()); + } + } + } + } else if p.extension().and_then(|s| s.to_str()) == Some("rs") { + println!("cargo:rerun-if-changed={}", p.display()); + } + } + } + + // Build separate objects for intrinsics and stdlib stubs, then package into + // a single static archive to avoid large sections in a single object. + let out_intrinsics_obj = out_dir.join("miden_stdlib_sys_intrinsics_stubs.o"); + let out_stdlib_obj = out_dir.join("miden_stdlib_sys_stdlib_stubs.o"); + let out_a = out_dir.join("libmiden_stdlib_sys_stubs.a"); + + // Ensure tools are present before invoking them. + ensure_rust_ar(); + + // LLVM MergeFunctions pass https://llvm.org/docs/MergeFunctions.html considers some + // functions in the stub library identical (e.g. `intrinsics::felt::add` and + // `intrinsics::felt::mul`) because besides the same sig they have the same body + // (`unreachable`). The pass merges them which manifests in the compiled Wasm as if both + // `add` and `mul` are linked to the same (`add` in this case) function. + // Setting `opt-level=1` seems to be skipping this pass and is enough on its own, but I + // also put `-Z merge-functions=disabled` in case `opt-level=1` behaviour changes + // in the future and runs the MergeFunctions pass. + // `opt-level=0` - introduces import for panic infra leading to WIT encoder error (unsatisfied import). + + // Although the stdlib vs intrinsics split seems redundant in the future we will have to move + // the intrinsics to the separate crate with its own build.rs script. The reason for the + // separation is the automatic bindings generation. For the Miden stdlib the bindings will be + // generated from the Miden package, but for intrinsics they will be maintained manually since + // the intrinsics are part of the compiler. + + // 1a) Compile intrinsics object + let status = Command::new("rustc") + .arg("--crate-name") + .arg("miden_stdlib_sys_intrinsics_stubs") + .arg("--edition=2021") + .arg("--crate-type=rlib") + .arg("--target") + .arg(&target) + .arg("-C") + .arg("opt-level=1") + .arg("-C") + .arg("panic=abort") + .arg("-C") + .arg("codegen-units=1") + .arg("-C") + .arg("debuginfo=0") + .arg("-Z") + .arg("merge-functions=disabled") + .arg("-C") + .arg("target-feature=+bulk-memory,+wide-arithmetic") + .arg("--emit=obj") + .arg("-o") + .arg(&out_intrinsics_obj) + .arg(stubs_root.join("intrinsics_root.rs")) + .status() + .expect("failed to spawn rustc for stdlib intrinsics stub object"); + if !status.success() { + panic!("failed to compile stdlib intrinsics stub object: {status}"); + } + + // 1b) Compile stdlib (mem/crypto) object + let status = Command::new("rustc") + .arg("--crate-name") + .arg("miden_stdlib_sys_stdlib_stubs") + .arg("--edition=2021") + .arg("--crate-type=rlib") + .arg("--target") + .arg(&target) + .arg("-C") + .arg("opt-level=1") + .arg("-C") + .arg("panic=abort") + .arg("-C") + .arg("codegen-units=1") + .arg("-C") + .arg("debuginfo=0") + .arg("-Z") + .arg("merge-functions=disabled") + .arg("-C") + .arg("target-feature=+bulk-memory,+wide-arithmetic") + .arg("--emit=obj") + .arg("-o") + .arg(&out_stdlib_obj) + .arg(stubs_root.join("stdlib_root.rs")) + .status() + .expect("failed to spawn rustc for stdlib (mem/crypto) stub object"); + if !status.success() { + panic!("failed to compile stdlib (mem/crypto) stub object: {status}"); + } + + // 2) Archive both objects + let status = Command::new("rust-ar") + .arg("crs") + .arg(&out_a) + .arg(&out_intrinsics_obj) + .arg(&out_stdlib_obj) + .status() + .expect("failed to spawn ar for stdlib stubs"); + if !status.success() { + panic!("failed to archive stdlib stubs: {status}"); + } + + // Emit link directives for dependents + println!("cargo:rustc-link-search=native={}", out_dir.display()); + println!("cargo:rustc-link-lib=static=miden_stdlib_sys_stubs"); +} diff --git a/sdk/stdlib-sys/src/intrinsics/advice.rs b/sdk/stdlib-sys/src/intrinsics/advice.rs index 6af048abc..8ef488e75 100644 --- a/sdk/stdlib-sys/src/intrinsics/advice.rs +++ b/sdk/stdlib-sys/src/intrinsics/advice.rs @@ -2,12 +2,11 @@ use crate::{Felt, Word}; -#[link(wasm_import_module = "miden:core-intrinsics/intrinsics-advice@1.0.0")] extern "C" { /// Pushes a list of field elements onto the advice stack. /// The list is looked up in the advice map using `key` as the key. /// Returns the number of elements pushed on the advice stack. - #[link_name = "adv-push-mapvaln"] + #[link_name = "intrinsics::advice::adv_push_mapvaln"] fn extern_adv_push_mapvaln(key0: Felt, key1: Felt, key2: Felt, key3: Felt) -> Felt; } diff --git a/sdk/stdlib-sys/src/intrinsics/crypto.rs b/sdk/stdlib-sys/src/intrinsics/crypto.rs index 333c07ea8..f56b30eb6 100644 --- a/sdk/stdlib-sys/src/intrinsics/crypto.rs +++ b/sdk/stdlib-sys/src/intrinsics/crypto.rs @@ -58,7 +58,9 @@ impl From for [Felt; 4] { } } -#[link(wasm_import_module = "miden:core-intrinsics/intrinsics-crypto@1.0.0")] +// Remove WIT import module and resolve via a linker stub instead. The stub will export +// the MASM symbol `intrinsics::crypto::hmerge`, and the frontend will lower its +// unreachable body to a MASM exec. extern "C" { /// Computes the hash of two digests using the Rescue Prime Optimized (RPO) /// permutation in 2-to-1 mode. @@ -67,7 +69,7 @@ extern "C" { /// /// Input: Pointer to an array of two digests (8 field elements total) /// Output: One digest (4 field elements) written to the result pointer - #[link_name = "hmerge"] + #[link_name = "intrinsics::crypto::hmerge"] fn extern_hmerge( // Pointer to array of two digests digests_ptr: *const Felt, diff --git a/sdk/stdlib-sys/src/intrinsics/debug.rs b/sdk/stdlib-sys/src/intrinsics/debug.rs index d27a4356c..f96c2d590 100644 --- a/sdk/stdlib-sys/src/intrinsics/debug.rs +++ b/sdk/stdlib-sys/src/intrinsics/debug.rs @@ -1,6 +1,5 @@ -#[link(wasm_import_module = "miden:core-import/intrinsics-debug@1.0.0")] extern "C" { - #[link_name = "break"] + #[link_name = "intrinsics::debug::break"] fn extern_break(); } diff --git a/sdk/stdlib-sys/src/intrinsics/felt.rs b/sdk/stdlib-sys/src/intrinsics/felt.rs index 48e9f97af..c1c2477b4 100644 --- a/sdk/stdlib-sys/src/intrinsics/felt.rs +++ b/sdk/stdlib-sys/src/intrinsics/felt.rs @@ -1,66 +1,65 @@ use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign}; -#[link(wasm_import_module = "miden:core-intrinsics/intrinsics-felt@1.0.0")] extern "C" { - #[link_name = "from-u64-unchecked"] + #[link_name = "intrinsics::felt::from_u64_unchecked"] fn extern_from_u64_unchecked(value: u64) -> Felt; - #[link_name = "from-u32"] + #[link_name = "intrinsics::felt::from_u32"] fn extern_from_u32(value: u32) -> Felt; - #[link_name = "as-u64"] + #[link_name = "intrinsics::felt::as_u64"] fn extern_as_u64(felt: Felt) -> u64; - #[link_name = "add"] - fn extern_add(a: Felt, b: Felt) -> Felt; - - #[link_name = "sub"] + #[link_name = "intrinsics::felt::sub"] fn extern_sub(a: Felt, b: Felt) -> Felt; - #[link_name = "mul"] + #[link_name = "intrinsics::felt::mul"] fn extern_mul(a: Felt, b: Felt) -> Felt; - #[link_name = "div"] + #[link_name = "intrinsics::felt::div"] fn extern_div(a: Felt, b: Felt) -> Felt; - #[link_name = "neg"] + #[link_name = "intrinsics::felt::neg"] fn extern_neg(a: Felt) -> Felt; - #[link_name = "inv"] + #[link_name = "intrinsics::felt::inv"] fn extern_inv(a: Felt) -> Felt; - #[link_name = "pow2"] + #[link_name = "intrinsics::felt::pow2"] fn extern_pow2(a: Felt) -> Felt; - #[link_name = "exp"] + #[link_name = "intrinsics::felt::exp"] fn extern_exp(a: Felt, b: Felt) -> Felt; - #[link_name = "eq"] + #[link_name = "intrinsics::felt::eq"] fn extern_eq(a: Felt, b: Felt) -> i32; - #[link_name = "gt"] + #[link_name = "intrinsics::felt::gt"] fn extern_gt(a: Felt, b: Felt) -> i32; - #[link_name = "lt"] + #[link_name = "intrinsics::felt::lt"] fn extern_lt(a: Felt, b: Felt) -> i32; - #[link_name = "ge"] + #[link_name = "intrinsics::felt::ge"] fn extern_ge(a: Felt, b: Felt) -> i32; - #[link_name = "le"] + #[link_name = "intrinsics::felt::le"] fn extern_le(a: Felt, b: Felt) -> i32; - #[link_name = "is-odd"] + #[link_name = "intrinsics::felt::is_odd"] fn extern_is_odd(a: Felt) -> i32; - #[link_name = "assert"] + #[link_name = "intrinsics::felt::assert"] fn extern_assert(a: Felt); - #[link_name = "assertz"] + #[link_name = "intrinsics::felt::assertz"] fn extern_assertz(a: Felt); - #[link_name = "assert-eq"] + #[link_name = "intrinsics::felt::assert_eq"] fn extern_assert_eq(a: Felt, b: Felt); + + #[link_name = "intrinsics::felt::add"] + fn extern_add(a: Felt, b: Felt) -> Felt; } /// Creates a `Felt` from an integer constant checking that it is within the diff --git a/sdk/stdlib-sys/src/lib.rs b/sdk/stdlib-sys/src/lib.rs index c141092f8..e55175fb2 100644 --- a/sdk/stdlib-sys/src/lib.rs +++ b/sdk/stdlib-sys/src/lib.rs @@ -5,8 +5,6 @@ extern crate alloc; pub mod intrinsics; mod stdlib; -#[cfg(feature = "wit")] -pub mod stdlib_wit; pub use intrinsics::{assert_eq, Digest, Felt, Word, WordAligned}; pub use stdlib::*; diff --git a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs index 0a41133f3..c058838fd 100644 --- a/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs +++ b/sdk/stdlib-sys/src/stdlib/crypto/hashes.rs @@ -9,14 +9,13 @@ use crate::{ intrinsics::{assert_eq, Digest, Felt, Word}, }; -#[link(wasm_import_module = "miden:core-stdlib/stdlib-crypto-hashes-blake3@1.0.0")] extern "C" { /// Computes BLAKE3 1-to-1 hash. /// /// Input: 32-bytes stored in the first 8 elements of the stack (32 bits per element). /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). /// The output is passed back to the caller via a pointer. - #[link_name = "hash-one-to-one"] + #[link_name = "std::crypto::hashes::blake3::hash_1to1"] fn extern_blake3_hash_1to1( e1: u32, e2: u32, @@ -34,7 +33,7 @@ extern "C" { /// Input: 64-bytes stored in the first 16 elements of the stack (32 bits per element). /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element) /// The output is passed back to the caller via a pointer. - #[link_name = "hash-two-to-one"] + #[link_name = "std::crypto::hashes::blake3::hash_2to1"] fn extern_blake3_hash_2to1( e1: u32, e2: u32, @@ -56,14 +55,13 @@ extern "C" { ); } -#[link(wasm_import_module = "miden:core-stdlib/stdlib-crypto-hashes-sha256@1.0.0")] extern "C" { /// Computes SHA256 1-to-1 hash. /// /// Input: 32-bytes stored in the first 8 elements of the stack (32 bits per element). /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). /// The output is passed back to the caller via a pointer. - #[link_name = "sha256-hash-one-to-one"] + #[link_name = "std::crypto::hashes::sha256::hash_1to1"] fn extern_sha256_hash_1to1( e1: u32, e2: u32, @@ -81,7 +79,7 @@ extern "C" { /// Input: 64-bytes stored in the first 16 elements of the stack (32 bits per element). /// Output: A 32-byte digest stored in the first 8 elements of stack (32 bits per element). /// The output is passed back to the caller via a pointer. - #[link_name = "sha256-hash-two-to-one"] + #[link_name = "std::crypto::hashes::sha256::hash_2to1"] fn extern_sha256_hash_2to1( e1: u32, e2: u32, @@ -103,7 +101,6 @@ extern "C" { ); } -#[link(wasm_import_module = "miden:core-stdlib/stdlib-crypto-hashes-rpo@1.0.0")] extern "C" { /// Computes the hash of a sequence of field elements using the Rescue Prime Optimized (RPO) /// hash function. @@ -113,7 +110,7 @@ extern "C" { /// Input: A pointer to the memory location and the number of elements to hash /// Output: One digest (4 field elements) /// The output is passed back to the caller via a pointer. - #[link_name = "hash-memory"] + #[link_name = "std::crypto::hashes::rpo::hash_memory"] pub fn extern_hash_memory(ptr: u32, num_elements: u32, result_ptr: *mut Felt); } diff --git a/sdk/stdlib-sys/src/stdlib/mem.rs b/sdk/stdlib-sys/src/stdlib/mem.rs index 61621c850..73062026a 100644 --- a/sdk/stdlib-sys/src/stdlib/mem.rs +++ b/sdk/stdlib-sys/src/stdlib/mem.rs @@ -8,7 +8,6 @@ use crate::{ intrinsics::{Felt, Word}, }; -#[link(wasm_import_module = "miden:core-stdlib/stdlib-mem@1.0.0")] extern "C" { /// Moves an arbitrary number of words from the advice stack to memory. @@ -21,7 +20,7 @@ extern "C" { /// Cycles: /// - Even num_words: 48 + 9 * num_words / 2 /// - Odd num_words: 65 + 9 * round_down(num_words / 2) - #[link_name = "pipe-words-to-memory"] + #[link_name = "std::mem::pipe_words_to_memory"] fn extern_pipe_words_to_memory(num_words: Felt, ptr: *mut Felt, out_ptr: *mut Felt); /// Moves an even number of words from the advice stack to memory. @@ -36,7 +35,7 @@ extern "C" { /// - The value num_words = end_ptr - write_ptr must be positive and even /// /// Cycles: 10 + 9 * num_words / 2 - #[link_name = "pipe-double-words-to-memory"] + #[link_name = "std::mem::pipe_double_words_to_memory"] fn extern_pipe_double_words_to_memory( c0: Felt, c1: Felt, @@ -63,7 +62,7 @@ extern "C" { /// Cycles: /// - Even num_words: 58 + 9 * (num_words / 2) /// - Odd num_words: 75 + 9 * round_down(num_words / 2) - #[link_name = "pipe-preimage-to-memory"] + #[link_name = "std::mem::pipe_preimage_to_memory"] pub(crate) fn extern_pipe_preimage_to_memory( num_words: Felt, write_ptr: *mut Felt, diff --git a/sdk/stdlib-sys/src/stdlib_wit.rs b/sdk/stdlib-sys/src/stdlib_wit.rs deleted file mode 100644 index 50116ab4f..000000000 --- a/sdk/stdlib-sys/src/stdlib_wit.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(feature = "wit")] -pub const STDLIB_WIT: &str = include_str!("../wit/miden-core-stdlib.wit"); - -#[cfg(feature = "wit")] -pub const INTRINSICS_WIT: &str = include_str!("../wit/miden-core-intrinsics.wit"); diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs b/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs new file mode 100644 index 000000000..09114c23a --- /dev/null +++ b/sdk/stdlib-sys/stubs/crypto/hashes_blake3.rs @@ -0,0 +1,46 @@ +use core::ffi::c_void; + +/// Unreachable stubs for std::crypto::hashes::blake3 + +#[export_name = "std::crypto::hashes::blake3::hash_1to1"] +pub extern "C" fn blake3_hash_1to1_stub( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + result_ptr: *mut c_void, +) { + let _ = (e1, e2, e3, e4, e5, e6, e7, e8, result_ptr); + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "std::crypto::hashes::blake3::hash_2to1"] +pub extern "C" fn blake3_hash_2to1_stub( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + e9: u32, + e10: u32, + e11: u32, + e12: u32, + e13: u32, + e14: u32, + e15: u32, + e16: u32, + result_ptr: *mut c_void, +) { + let _ = ( + e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, result_ptr, + ); + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs b/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs new file mode 100644 index 000000000..2049ad39a --- /dev/null +++ b/sdk/stdlib-sys/stubs/crypto/hashes_rpo.rs @@ -0,0 +1,10 @@ +use core::ffi::c_void; + +/// Unreachable stub for std::crypto::hashes::rpo::hash_memory + +#[export_name = "std::crypto::hashes::rpo::hash_memory"] +pub extern "C" fn rpo_hash_memory_stub(ptr: u32, num_elements: u32, result_ptr: *mut c_void) { + let _ = (ptr, num_elements, result_ptr); + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs b/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs new file mode 100644 index 000000000..ede9ab358 --- /dev/null +++ b/sdk/stdlib-sys/stubs/crypto/hashes_sha256.rs @@ -0,0 +1,46 @@ +use core::ffi::c_void; + +/// Unreachable stubs for std::crypto::hashes::sha256 + +#[export_name = "std::crypto::hashes::sha256::hash_1to1"] +pub extern "C" fn sha256_hash_1to1_stub( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + result_ptr: *mut c_void, +) { + let _ = (e1, e2, e3, e4, e5, e6, e7, e8, result_ptr); + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "std::crypto::hashes::sha256::hash_2to1"] +pub extern "C" fn sha256_hash_2to1_stub( + e1: u32, + e2: u32, + e3: u32, + e4: u32, + e5: u32, + e6: u32, + e7: u32, + e8: u32, + e9: u32, + e10: u32, + e11: u32, + e12: u32, + e13: u32, + e14: u32, + e15: u32, + e16: u32, + result_ptr: *mut c_void, +) { + let _ = ( + e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, result_ptr, + ); + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/crypto/mod.rs b/sdk/stdlib-sys/stubs/crypto/mod.rs new file mode 100644 index 000000000..56ffa80af --- /dev/null +++ b/sdk/stdlib-sys/stubs/crypto/mod.rs @@ -0,0 +1,4 @@ +mod hashes_blake3; +mod hashes_sha256; +mod hashes_rpo; + diff --git a/sdk/stdlib-sys/stubs/intrinsics/advice.rs b/sdk/stdlib-sys/stubs/intrinsics/advice.rs new file mode 100644 index 000000000..7d8706083 --- /dev/null +++ b/sdk/stdlib-sys/stubs/intrinsics/advice.rs @@ -0,0 +1,7 @@ +/// Unreachable stubs for intrinsics::advice interface + +#[export_name = "intrinsics::advice::adv_push_mapvaln"] +pub extern "C" fn advice_adv_push_mapvaln_stub(_key0: f32, _key1: f32, _key2: f32, _key3: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/intrinsics/crypto.rs b/sdk/stdlib-sys/stubs/intrinsics/crypto.rs new file mode 100644 index 000000000..6e2d2e7b7 --- /dev/null +++ b/sdk/stdlib-sys/stubs/intrinsics/crypto.rs @@ -0,0 +1,9 @@ +use core::ffi::c_void; + +/// Unreachable stub for intrinsics::crypto::hmerge. +/// Signature in Wasm is (i32 digests_ptr, i32 result_ptr) +#[export_name = "intrinsics::crypto::hmerge"] +pub extern "C" fn hmerge_stub(_digests_ptr: *const c_void, _result_ptr: *mut c_void) { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/intrinsics/debug.rs b/sdk/stdlib-sys/stubs/intrinsics/debug.rs new file mode 100644 index 000000000..9767cb15e --- /dev/null +++ b/sdk/stdlib-sys/stubs/intrinsics/debug.rs @@ -0,0 +1,7 @@ +/// Unreachable stubs for intrinsics::debug interface + +#[export_name = "intrinsics::debug::break"] +pub extern "C" fn debug_break_stub() { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/intrinsics/felt.rs b/sdk/stdlib-sys/stubs/intrinsics/felt.rs new file mode 100644 index 000000000..b6c18c060 --- /dev/null +++ b/sdk/stdlib-sys/stubs/intrinsics/felt.rs @@ -0,0 +1,104 @@ +/// Unreachable stubs for intrinsics::felt::* functions. +/// These are linked by name, and the frontend lowers calls +/// to MASM operations or functions accordingly. + +#[export_name = "intrinsics::felt::add"] +pub extern "C" fn felt_add_stub(_a: f32, _b: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::from_u64_unchecked"] +pub extern "C" fn felt_from_u64_unchecked_stub(_v: u64) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::from_u32"] +pub extern "C" fn felt_from_u32_stub(_v: u32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::as_u64"] +pub extern "C" fn felt_as_u64_stub(_a: f32) -> u64 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::sub"] +pub extern "C" fn felt_sub_stub(_a: f32, _b: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::mul"] +pub fn felt_mul_stub(_a: f32, _b: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::div"] +pub extern "C" fn felt_div_stub(_a: f32, _b: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::neg"] +pub extern "C" fn felt_neg_stub(_a: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::inv"] +pub extern "C" fn felt_inv_stub(_a: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::pow2"] +pub extern "C" fn felt_pow2_stub(_a: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::exp"] +pub extern "C" fn felt_exp_stub(_a: f32, _b: f32) -> f32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::eq"] +pub extern "C" fn felt_eq_stub(_a: f32, _b: f32) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::gt"] +pub extern "C" fn felt_gt_stub(_a: f32, _b: f32) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::lt"] +pub extern "C" fn felt_lt_stub(_a: f32, _b: f32) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::ge"] +pub extern "C" fn felt_ge_stub(_a: f32, _b: f32) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::le"] +pub extern "C" fn felt_le_stub(_a: f32, _b: f32) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::is_odd"] +pub extern "C" fn felt_is_odd_stub(_a: f32) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::assert"] +pub extern "C" fn felt_assert_stub(_a: f32) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::assertz"] +pub extern "C" fn felt_assertz_stub(_a: f32) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "intrinsics::felt::assert_eq"] +pub extern "C" fn felt_assert_eq_stub(_a: f32, _b: f32) { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/intrinsics/mod.rs b/sdk/stdlib-sys/stubs/intrinsics/mod.rs new file mode 100644 index 000000000..d5cb69d23 --- /dev/null +++ b/sdk/stdlib-sys/stubs/intrinsics/mod.rs @@ -0,0 +1,4 @@ +mod felt; +mod crypto; +mod debug; +mod advice; diff --git a/sdk/stdlib-sys/stubs/intrinsics_root.rs b/sdk/stdlib-sys/stubs/intrinsics_root.rs new file mode 100644 index 000000000..b3b6de171 --- /dev/null +++ b/sdk/stdlib-sys/stubs/intrinsics_root.rs @@ -0,0 +1,4 @@ +#![no_std] + +mod intrinsics; + diff --git a/sdk/stdlib-sys/stubs/mem.rs b/sdk/stdlib-sys/stubs/mem.rs new file mode 100644 index 000000000..aec9fc0c1 --- /dev/null +++ b/sdk/stdlib-sys/stubs/mem.rs @@ -0,0 +1,46 @@ +use core::ffi::c_void; + +/// Unreachable stubs for std::mem procedures used via SDK + +#[export_name = "std::mem::pipe_words_to_memory"] +pub extern "C" fn std_mem_pipe_words_to_memory_stub( + _num_words: f32, + _write_ptr: *mut c_void, + _out_ptr: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "std::mem::pipe_double_words_to_memory"] +pub extern "C" fn std_mem_pipe_double_words_to_memory_stub( + _c0: f32, + _c1: f32, + _c2: f32, + _c3: f32, + _b0: f32, + _b1: f32, + _b2: f32, + _b3: f32, + _a0: f32, + _a1: f32, + _a2: f32, + _a3: f32, + _write_ptr: *mut c_void, + _end_ptr: *mut c_void, + _out_ptr: *mut c_void, +) { + unsafe { core::hint::unreachable_unchecked() } +} + +#[export_name = "std::mem::pipe_preimage_to_memory"] +pub extern "C" fn std_mem_pipe_preimage_to_memory_stub( + _num_words: f32, + _write_ptr: *mut c_void, + _c0: f32, + _c1: f32, + _c2: f32, + _c3: f32, +) -> i32 { + unsafe { core::hint::unreachable_unchecked() } +} + diff --git a/sdk/stdlib-sys/stubs/stdlib_root.rs b/sdk/stdlib-sys/stubs/stdlib_root.rs new file mode 100644 index 000000000..8e3b7ee97 --- /dev/null +++ b/sdk/stdlib-sys/stubs/stdlib_root.rs @@ -0,0 +1,5 @@ +#![no_std] + +mod mem; +mod crypto; + diff --git a/sdk/stdlib-sys/wit/miden-core-intrinsics.wit b/sdk/stdlib-sys/wit/miden-core-intrinsics.wit deleted file mode 100644 index d64cb82cf..000000000 --- a/sdk/stdlib-sys/wit/miden-core-intrinsics.wit +++ /dev/null @@ -1,72 +0,0 @@ -package miden:core-intrinsics@1.0.0; - -// The function signatures should be kept in sync with the signatures in the -// Rust SDK `extern` functions (see `/sdk`) using `f32` instead of `Felt` type; - -interface intrinsics-mem { - - heap-base: func() -> s32; -} - -interface intrinsics-felt { - - // See sdk/stdlib-sys/src/intrinsics/felt.rs for `extern` function signatures - - // Conversion operations - from-u64-unchecked: func(a: u64) -> f32; - from-u32: func(a: u32) -> f32; - as-u64: func(a: f32) -> u64; - - // Arithmetic operations - add: func(a: f32, b: f32) -> f32; - sub: func(a: f32, b: f32) -> f32; - mul: func(a: f32, b: f32) -> f32; - div: func(a: f32, b: f32) -> f32; - neg: func(a: f32) -> f32; - inv: func(a: f32) -> f32; - pow2: func(a: f32) -> f32; - exp: func(a: f32, b: f32) -> f32; - - // Comparison operations - eq: func(a: f32, b: f32) -> s32; - gt: func(a: f32, b: f32) -> s32; - lt: func(a: f32, b: f32) -> s32; - ge: func(a: f32, b: f32) -> s32; - le: func(a: f32, b: f32) -> s32; - is-odd: func(a: f32) -> s32; - - // Assertion operations - assert: func(a: f32); - assertz: func(a: f32); - assert-eq: func(a: f32, b: f32); -} - -interface intrinsics-debug { - - break: func(); - -} - -interface intrinsics-crypto { - - // See sdk/stdlib-sys/src/intrinsics/crypto.rs for `extern` function signatures - - // Hash merge operation - takes pointer to array of two digests and writes result to output pointer - hmerge: func(digests-ptr: s32, result-ptr: s32); -} - -interface intrinsics-advice { - - // Pushes a list of field elements onto the advice stack. The list is looked up in the advice map using `key` as the key. - // Returns the number of elements pushed on the advice stack. - // key: Word (4 f32 values representing the key) - adv-push-mapvaln: func(key0: f32, key1: f32, key2: f32, key3: f32) -> f32; -} - -world intrinsics { - import intrinsics-mem; - import intrinsics-felt; - import intrinsics-debug; - import intrinsics-crypto; - import intrinsics-advice; -} diff --git a/sdk/stdlib-sys/wit/miden-core-stdlib.wit b/sdk/stdlib-sys/wit/miden-core-stdlib.wit deleted file mode 100644 index 1b4c213e4..000000000 --- a/sdk/stdlib-sys/wit/miden-core-stdlib.wit +++ /dev/null @@ -1,19 +0,0 @@ -package miden:core-stdlib@1.0.0; - -// The function signatures should be kept in sync with the signatures in the -// Rust SDK `extern` functions (see `/sdk`); - -interface stdlib-crypto-hashes-blake3 { - - hash-one-to-one: func(a0: s32, a1: s32, a2: s32, a3: s32, a4: s32, a5: s32, a6: s32, a7: s32, result-ptr: s32); -} - -interface stdlib-mem { - - pipe-preimage-to-memory: func(num-words: f32, result-ptr: s32, c0: f32, c1: f32, c2: f32, c3: f32) -> s32; -} - -world stdlib { - import stdlib-crypto-hashes-blake3; - import stdlib-mem; -} diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir b/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir index 504c2d8ff..1ee9fae7c 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.hir @@ -1,144 +1,144 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_stdlib_blake3_hash { - private builtin.function @miden_stdlib_sys::stdlib::crypto::hashes::extern_blake3_hash_1to1(v0: i32, v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32, v7: i32, v8: i32) { - ^block3(v0: i32, v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32, v7: i32, v8: i32): - v9, v10, v11, v12, v13, v14, v15, v16 = hir.exec @std/crypto/hashes/blake3/hash_1to1(v0, v1, v2, v3, v4, v5, v6, v7) : i32, i32, i32, i32, i32, i32, i32, i32 - v17 = hir.bitcast v8 : u32; + public builtin.function @entrypoint(v0: i32, v1: i32) { + ^block4(v0: i32, v1: i32): + v3 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr + v4 = hir.bitcast v3 : ptr; + v5 = hir.load v4 : i32; + v8 = arith.constant -32 : i32; + v6 = arith.constant 32 : i32; + v7 = arith.sub v5, v6 : i32 #[overflow = wrapping]; + v9 = arith.band v7, v8 : i32; + v10 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; + v12 = hir.bitcast v1 : u32; + v13 = hir.int_to_ptr v12 : ptr; + v14 = hir.load v13 : i32; + v16 = arith.constant 4 : u32; + v15 = hir.bitcast v1 : u32; + v17 = arith.add v15, v16 : u32 #[overflow = checked]; v18 = hir.int_to_ptr v17 : ptr; - hir.store v18, v9; - v19 = arith.constant 4 : u32; - v20 = arith.add v17, v19 : u32 #[overflow = checked]; - v21 = hir.int_to_ptr v20 : ptr; - hir.store v21, v10; - v22 = arith.constant 8 : u32; - v23 = arith.add v17, v22 : u32 #[overflow = checked]; - v24 = hir.int_to_ptr v23 : ptr; - hir.store v24, v11; - v25 = arith.constant 12 : u32; - v26 = arith.add v17, v25 : u32 #[overflow = checked]; - v27 = hir.int_to_ptr v26 : ptr; - hir.store v27, v12; - v28 = arith.constant 16 : u32; - v29 = arith.add v17, v28 : u32 #[overflow = checked]; - v30 = hir.int_to_ptr v29 : ptr; - hir.store v30, v13; - v31 = arith.constant 20 : u32; - v32 = arith.add v17, v31 : u32 #[overflow = checked]; + v19 = hir.load v18 : i32; + v21 = arith.constant 8 : u32; + v20 = hir.bitcast v1 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v23 = hir.int_to_ptr v22 : ptr; + v24 = hir.load v23 : i32; + v26 = arith.constant 12 : u32; + v25 = hir.bitcast v1 : u32; + v27 = arith.add v25, v26 : u32 #[overflow = checked]; + v28 = hir.int_to_ptr v27 : ptr; + v29 = hir.load v28 : i32; + v31 = arith.constant 16 : u32; + v30 = hir.bitcast v1 : u32; + v32 = arith.add v30, v31 : u32 #[overflow = checked]; v33 = hir.int_to_ptr v32 : ptr; - hir.store v33, v14; - v34 = arith.constant 24 : u32; - v35 = arith.add v17, v34 : u32 #[overflow = checked]; - v36 = hir.int_to_ptr v35 : ptr; - hir.store v36, v15; - v37 = arith.constant 28 : u32; - v38 = arith.add v17, v37 : u32 #[overflow = checked]; - v39 = hir.int_to_ptr v38 : ptr; - hir.store v39, v16; - builtin.ret ; - }; - - public builtin.function @entrypoint(v40: i32, v41: i32) { - ^block10(v40: i32, v41: i32): - v43 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr - v44 = hir.bitcast v43 : ptr; - v45 = hir.load v44 : i32; - v48 = arith.constant -32 : i32; - v46 = arith.constant 32 : i32; - v47 = arith.sub v45, v46 : i32 #[overflow = wrapping]; - v49 = arith.band v47, v48 : i32; - v50 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr - v51 = hir.bitcast v50 : ptr; - hir.store v51, v49; - v52 = hir.bitcast v41 : u32; - v53 = hir.int_to_ptr v52 : ptr; - v54 = hir.load v53 : i32; - v56 = arith.constant 4 : u32; - v55 = hir.bitcast v41 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v58 = hir.int_to_ptr v57 : ptr; - v59 = hir.load v58 : i32; - v61 = arith.constant 8 : u32; - v60 = hir.bitcast v41 : u32; - v62 = arith.add v60, v61 : u32 #[overflow = checked]; - v63 = hir.int_to_ptr v62 : ptr; - v64 = hir.load v63 : i32; - v66 = arith.constant 12 : u32; - v65 = hir.bitcast v41 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v68 = hir.int_to_ptr v67 : ptr; - v69 = hir.load v68 : i32; - v71 = arith.constant 16 : u32; - v70 = hir.bitcast v41 : u32; - v72 = arith.add v70, v71 : u32 #[overflow = checked]; - v73 = hir.int_to_ptr v72 : ptr; - v74 = hir.load v73 : i32; - v76 = arith.constant 20 : u32; - v75 = hir.bitcast v41 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v78 = hir.int_to_ptr v77 : ptr; - v79 = hir.load v78 : i32; - v81 = arith.constant 24 : u32; - v80 = hir.bitcast v41 : u32; - v82 = arith.add v80, v81 : u32 #[overflow = checked]; - v83 = hir.int_to_ptr v82 : ptr; - v84 = hir.load v83 : i32; - v86 = arith.constant 28 : u32; - v85 = hir.bitcast v41 : u32; - v87 = arith.add v85, v86 : u32 #[overflow = checked]; - v88 = hir.int_to_ptr v87 : ptr; - v89 = hir.load v88 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/miden_stdlib_sys::stdlib::crypto::hashes::extern_blake3_hash_1to1(v54, v59, v64, v69, v74, v79, v84, v89, v49) + v34 = hir.load v33 : i32; + v36 = arith.constant 20 : u32; + v35 = hir.bitcast v1 : u32; + v37 = arith.add v35, v36 : u32 #[overflow = checked]; + v38 = hir.int_to_ptr v37 : ptr; + v39 = hir.load v38 : i32; + v41 = arith.constant 24 : u32; + v40 = hir.bitcast v1 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v43 = hir.int_to_ptr v42 : ptr; + v44 = hir.load v43 : i32; + v46 = arith.constant 28 : u32; + v45 = hir.bitcast v1 : u32; + v47 = arith.add v45, v46 : u32 #[overflow = checked]; + v48 = hir.int_to_ptr v47 : ptr; + v49 = hir.load v48 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/std::crypto::hashes::blake3::hash_1to1(v14, v19, v24, v29, v34, v39, v44, v49, v9) v138 = arith.constant 24 : u32; - v92 = hir.bitcast v49 : u32; - v94 = arith.add v92, v138 : u32 #[overflow = checked]; + v52 = hir.bitcast v9 : u32; + v54 = arith.add v52, v138 : u32 #[overflow = checked]; v137 = arith.constant 8 : u32; - v96 = arith.mod v94, v137 : u32; - hir.assertz v96 #[code = 250]; - v97 = hir.int_to_ptr v94 : ptr; - v98 = hir.load v97 : i64; - v90 = arith.constant 24 : i32; - v91 = arith.add v40, v90 : i32 #[overflow = wrapping]; - v99 = hir.bitcast v91 : u32; - v100 = hir.int_to_ptr v99 : ptr; - hir.store v100, v98; + v56 = arith.mod v54, v137 : u32; + hir.assertz v56 #[code = 250]; + v57 = hir.int_to_ptr v54 : ptr; + v58 = hir.load v57 : i64; + v50 = arith.constant 24 : i32; + v51 = arith.add v0, v50 : i32 #[overflow = wrapping]; + v59 = hir.bitcast v51 : u32; + v60 = hir.int_to_ptr v59 : ptr; + hir.store v60, v58; v136 = arith.constant 16 : u32; - v103 = hir.bitcast v49 : u32; - v105 = arith.add v103, v136 : u32 #[overflow = checked]; + v63 = hir.bitcast v9 : u32; + v65 = arith.add v63, v136 : u32 #[overflow = checked]; v135 = arith.constant 8 : u32; - v107 = arith.mod v105, v135 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - v109 = hir.load v108 : i64; - v101 = arith.constant 16 : i32; - v102 = arith.add v40, v101 : i32 #[overflow = wrapping]; - v110 = hir.bitcast v102 : u32; - v111 = hir.int_to_ptr v110 : ptr; - hir.store v111, v109; + v67 = arith.mod v65, v135 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + v69 = hir.load v68 : i64; + v61 = arith.constant 16 : i32; + v62 = arith.add v0, v61 : i32 #[overflow = wrapping]; + v70 = hir.bitcast v62 : u32; + v71 = hir.int_to_ptr v70 : ptr; + hir.store v71, v69; v134 = arith.constant 8 : u32; - v114 = hir.bitcast v49 : u32; - v116 = arith.add v114, v134 : u32 #[overflow = checked]; + v74 = hir.bitcast v9 : u32; + v76 = arith.add v74, v134 : u32 #[overflow = checked]; v133 = arith.constant 8 : u32; - v118 = arith.mod v116, v133 : u32; - hir.assertz v118 #[code = 250]; - v119 = hir.int_to_ptr v116 : ptr; - v120 = hir.load v119 : i64; - v112 = arith.constant 8 : i32; - v113 = arith.add v40, v112 : i32 #[overflow = wrapping]; - v121 = hir.bitcast v113 : u32; - v122 = hir.int_to_ptr v121 : ptr; - hir.store v122, v120; - v123 = hir.bitcast v49 : u32; + v78 = arith.mod v76, v133 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : i64; + v72 = arith.constant 8 : i32; + v73 = arith.add v0, v72 : i32 #[overflow = wrapping]; + v81 = hir.bitcast v73 : u32; + v82 = hir.int_to_ptr v81 : ptr; + hir.store v82, v80; + v83 = hir.bitcast v9 : u32; v132 = arith.constant 8 : u32; - v125 = arith.mod v123, v132 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : i64; - v128 = hir.bitcast v40 : u32; - v129 = hir.int_to_ptr v128 : ptr; - hir.store v129, v127; - v130 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr - v131 = hir.bitcast v130 : ptr; - hir.store v131, v45; + v85 = arith.mod v83, v132 : u32; + hir.assertz v85 #[code = 250]; + v86 = hir.int_to_ptr v83 : ptr; + v87 = hir.load v86 : i64; + v88 = hir.bitcast v0 : u32; + v89 = hir.int_to_ptr v88 : ptr; + hir.store v89, v87; + v90 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_stdlib_blake3_hash/__stack_pointer : ptr + v91 = hir.bitcast v90 : ptr; + hir.store v91, v5; + builtin.ret ; + }; + + private builtin.function @std::crypto::hashes::blake3::hash_1to1(v92: i32, v93: i32, v94: i32, v95: i32, v96: i32, v97: i32, v98: i32, v99: i32, v100: i32) { + ^block6(v92: i32, v93: i32, v94: i32, v95: i32, v96: i32, v97: i32, v98: i32, v99: i32, v100: i32): + v101, v102, v103, v104, v105, v106, v107, v108 = hir.exec @std/crypto/hashes/blake3/hash_1to1(v92, v93, v94, v95, v96, v97, v98, v99) : i32, i32, i32, i32, i32, i32, i32, i32 + v109 = hir.bitcast v100 : u32; + v110 = hir.int_to_ptr v109 : ptr; + hir.store v110, v101; + v111 = arith.constant 4 : u32; + v112 = arith.add v109, v111 : u32 #[overflow = checked]; + v113 = hir.int_to_ptr v112 : ptr; + hir.store v113, v102; + v114 = arith.constant 8 : u32; + v115 = arith.add v109, v114 : u32 #[overflow = checked]; + v116 = hir.int_to_ptr v115 : ptr; + hir.store v116, v103; + v117 = arith.constant 12 : u32; + v118 = arith.add v109, v117 : u32 #[overflow = checked]; + v119 = hir.int_to_ptr v118 : ptr; + hir.store v119, v104; + v120 = arith.constant 16 : u32; + v121 = arith.add v109, v120 : u32 #[overflow = checked]; + v122 = hir.int_to_ptr v121 : ptr; + hir.store v122, v105; + v123 = arith.constant 20 : u32; + v124 = arith.add v109, v123 : u32 #[overflow = checked]; + v125 = hir.int_to_ptr v124 : ptr; + hir.store v125, v106; + v126 = arith.constant 24 : u32; + v127 = arith.add v109, v126 : u32 #[overflow = checked]; + v128 = hir.int_to_ptr v127 : ptr; + hir.store v128, v107; + v129 = arith.constant 28 : u32; + v130 = arith.add v109, v129 : u32 #[overflow = checked]; + v131 = hir.int_to_ptr v130 : ptr; + hir.store v131, v108; builtin.ret ; }; diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm index f84504c82..ef3dd6f25 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.masm @@ -12,119 +12,6 @@ end # mod root_ns:root@1.0.0::abi_transform_stdlib_blake3_hash -proc.miden_stdlib_sys::stdlib::crypto::hashes::extern_blake3_hash_1to1 - trace.240 - nop - exec.::std::crypto::hashes::blake3::hash_1to1 - trace.252 - nop - movup.8 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.12 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.20 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.28 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - export.entrypoint push.1114112 u32divmod.4 @@ -248,7 +135,7 @@ export.entrypoint swap.8 trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_stdlib_blake3_hash::miden_stdlib_sys::stdlib::crypto::hashes::extern_blake3_hash_1to1 + exec.::root_ns:root@1.0.0::abi_transform_stdlib_blake3_hash::std::crypto::hashes::blake3::hash_1to1 trace.252 nop push.24 @@ -366,3 +253,116 @@ export.entrypoint nop end +proc.std::crypto::hashes::blake3::hash_1to1 + trace.240 + nop + exec.::std::crypto::hashes::blake3::hash_1to1 + trace.252 + nop + movup.8 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.20 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + diff --git a/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat b/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat index 4dd407ca6..3f2d358f3 100644 --- a/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat +++ b/tests/integration/expected/abi_transform_stdlib_blake3_hash.wat @@ -1,13 +1,12 @@ (module $abi_transform_stdlib_blake3_hash.wasm - (type (;0;) (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32))) - (type (;1;) (func (param i32 i32))) - (import "miden:core-stdlib/stdlib-crypto-hashes-blake3@1.0.0" "hash-one-to-one" (func $miden_stdlib_sys::stdlib::crypto::hashes::extern_blake3_hash_1to1 (;0;) (type 0))) + (type (;0;) (func (param i32 i32))) + (type (;1;) (func (param i32 i32 i32 i32 i32 i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 1) (param i32 i32) + (func $entrypoint (;0;) (type 0) (param i32 i32) (local i32 i32) global.get $__stack_pointer local.tee 2 @@ -34,7 +33,7 @@ local.get 1 i32.load offset=28 align=1 local.get 3 - call $miden_stdlib_sys::stdlib::crypto::hashes::extern_blake3_hash_1to1 + call $std::crypto::hashes::blake3::hash_1to1 local.get 0 i32.const 24 i32.add @@ -60,4 +59,7 @@ local.get 2 global.set $__stack_pointer ) + (func $std::crypto::hashes::blake3::hash_1to1 (;1;) (type 1) (param i32 i32 i32 i32 i32 i32 i32 i32 i32) + unreachable + ) ) diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir index f22ce30d7..abdf62847 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.hir @@ -1,85 +1,85 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_tx_kernel_get_id { - private builtin.function @miden_base_sys::bindings::account::extern_account_get_id(v0: i32) { - ^block3(v0: i32): - v1, v2 = hir.exec @miden/account/get_id() : felt, felt - v3 = hir.bitcast v0 : u32; - v4 = hir.int_to_ptr v3 : ptr; - hir.store v4, v1; - v5 = arith.constant 4 : u32; - v6 = arith.add v3, v5 : u32 #[overflow = checked]; - v7 = hir.int_to_ptr v6 : ptr; - hir.store v7, v2; - builtin.ret ; - }; - - public builtin.function @entrypoint(v8: i32) { - ^block8(v8: i32): - v10 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - v12 = hir.load v11 : i32; - v13 = arith.constant 16 : i32; - v14 = arith.sub v12, v13 : i32 #[overflow = wrapping]; - v15 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v16 = hir.bitcast v15 : ptr; - hir.store v16, v14; - v17 = arith.constant 8 : i32; - v18 = arith.add v14, v17 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::account::get_id(v18) - v20 = arith.constant 8 : u32; - v19 = hir.bitcast v14 : u32; - v21 = arith.add v19, v20 : u32 #[overflow = checked]; + public builtin.function @entrypoint(v0: i32) { + ^block4(v0: i32): + v2 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v3 = hir.bitcast v2 : ptr; + v4 = hir.load v3 : i32; + v5 = arith.constant 16 : i32; + v6 = arith.sub v4, v5 : i32 #[overflow = wrapping]; + v7 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + v9 = arith.constant 8 : i32; + v10 = arith.add v6, v9 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::account::get_id(v10) + v12 = arith.constant 8 : u32; + v11 = hir.bitcast v6 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; v61 = arith.constant 8 : u32; - v23 = arith.mod v21, v61 : u32; - hir.assertz v23 #[code = 250]; - v24 = hir.int_to_ptr v21 : ptr; - v25 = hir.load v24 : i64; - v26 = hir.bitcast v8 : u32; - v27 = arith.constant 4 : u32; - v28 = arith.mod v26, v27 : u32; - hir.assertz v28 #[code = 250]; - v29 = hir.int_to_ptr v26 : ptr; - hir.store v29, v25; + v15 = arith.mod v13, v61 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i64; + v18 = hir.bitcast v0 : u32; + v19 = arith.constant 4 : u32; + v20 = arith.mod v18, v19 : u32; + hir.assertz v20 #[code = 250]; + v21 = hir.int_to_ptr v18 : ptr; + hir.store v21, v17; v60 = arith.constant 16 : i32; - v31 = arith.add v14, v60 : i32 #[overflow = wrapping]; - v32 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v33 = hir.bitcast v32 : ptr; - hir.store v33, v31; + v23 = arith.add v6, v60 : i32 #[overflow = wrapping]; + v24 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v25 = hir.bitcast v24 : ptr; + hir.store v25, v23; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::get_id(v34: i32) { - ^block10(v34: i32): - v36 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v37 = hir.bitcast v36 : ptr; - v38 = hir.load v37 : i32; - v39 = arith.constant 16 : i32; - v40 = arith.sub v38, v39 : i32 #[overflow = wrapping]; - v41 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v42 = hir.bitcast v41 : ptr; - hir.store v42, v40; - v43 = arith.constant 8 : i32; - v44 = arith.add v40, v43 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden_base_sys::bindings::account::extern_account_get_id(v44) - v46 = arith.constant 8 : u32; - v45 = hir.bitcast v40 : u32; - v47 = arith.add v45, v46 : u32 #[overflow = checked]; - v48 = arith.constant 4 : u32; - v49 = arith.mod v47, v48 : u32; - hir.assertz v49 #[code = 250]; - v50 = hir.int_to_ptr v47 : ptr; - v51 = hir.load v50 : i64; - v52 = hir.bitcast v34 : u32; + private builtin.function @miden_base_sys::bindings::account::get_id(v26: i32) { + ^block6(v26: i32): + v28 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v29 = hir.bitcast v28 : ptr; + v30 = hir.load v29 : i32; + v31 = arith.constant 16 : i32; + v32 = arith.sub v30, v31 : i32 #[overflow = wrapping]; + v33 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v34 = hir.bitcast v33 : ptr; + hir.store v34, v32; + v35 = arith.constant 8 : i32; + v36 = arith.add v32, v35 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/miden::account::get_id(v36) + v38 = arith.constant 8 : u32; + v37 = hir.bitcast v32 : u32; + v39 = arith.add v37, v38 : u32 #[overflow = checked]; + v40 = arith.constant 4 : u32; + v41 = arith.mod v39, v40 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + v43 = hir.load v42 : i64; + v44 = hir.bitcast v26 : u32; v63 = arith.constant 8 : u32; - v54 = arith.mod v52, v63 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - hir.store v55, v51; + v46 = arith.mod v44, v63 : u32; + hir.assertz v46 #[code = 250]; + v47 = hir.int_to_ptr v44 : ptr; + hir.store v47, v43; v62 = arith.constant 16 : i32; - v57 = arith.add v40, v62 : i32 #[overflow = wrapping]; - v58 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr - v59 = hir.bitcast v58 : ptr; - hir.store v59, v57; + v49 = arith.add v32, v62 : i32 #[overflow = wrapping]; + v50 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_id/__stack_pointer : ptr + v51 = hir.bitcast v50 : ptr; + hir.store v51, v49; + builtin.ret ; + }; + + private builtin.function @miden::account::get_id(v52: i32) { + ^block8(v52: i32): + v53, v54 = hir.exec @miden/account/get_id() : felt, felt + v55 = hir.bitcast v52 : u32; + v56 = hir.int_to_ptr v55 : ptr; + hir.store v56, v53; + v57 = arith.constant 4 : u32; + v58 = arith.add v55, v57 : u32 #[overflow = checked]; + v59 = hir.int_to_ptr v58 : ptr; + hir.store v59, v54; builtin.ret ; }; diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat index 1eec80086..830d823b3 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_id.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_id.wat @@ -1,12 +1,11 @@ (module $abi_transform_tx_kernel_get_id.wasm (type (;0;) (func (param i32))) - (import "miden:core-base/account@1.0.0" "get-id" (func $miden_base_sys::bindings::account::extern_account_get_id (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param i32) + (func $entrypoint (;0;) (type 0) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -26,7 +25,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::account::get_id (;2;) (type 0) (param i32) + (func $miden_base_sys::bindings::account::get_id (;1;) (type 0) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -36,7 +35,7 @@ local.get 1 i32.const 8 i32.add - call $miden_base_sys::bindings::account::extern_account_get_id + call $miden::account::get_id local.get 0 local.get 1 i64.load offset=8 align=4 @@ -46,4 +45,7 @@ i32.add global.set $__stack_pointer ) + (func $miden::account::get_id (;2;) (type 0) (param i32) + unreachable + ) ) diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir index 9834c03c3..6a78a34a0 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.hir @@ -1,959 +1,981 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @abi_transform_tx_kernel_get_inputs_4 { - private builtin.function @miden_base_sys::bindings::note::extern_note_get_inputs(v0: i32) -> i32 { - ^block5(v0: i32): - v1, v2 = hir.exec @miden/note/get_inputs(v0) : i32, i32 - builtin.ret v1; - }; - public builtin.function @entrypoint() { - ^block10: - v5 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v6 = hir.bitcast v5 : ptr; - v7 = hir.load v6 : i32; - v8 = arith.constant 16 : i32; - v9 = arith.sub v7, v8 : i32 #[overflow = wrapping]; - v10 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v11 = hir.bitcast v10 : ptr; - hir.store v11, v9; - v12 = arith.constant 4 : i32; - v13 = arith.add v9, v12 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden_base_sys::bindings::note::get_inputs(v13) - v15 = arith.constant 12 : u32; - v14 = hir.bitcast v9 : u32; - v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v17 = arith.constant 4 : u32; - v18 = arith.mod v16, v17 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - v20 = hir.load v19 : i32; - v21 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/>::from(v20) : felt - v660 = arith.constant 4 : felt; - hir.assert_eq v21, v660; - v692 = arith.constant 0 : i32; - v4 = arith.constant 0 : i32; - v25 = arith.eq v20, v4 : i1; - v26 = arith.zext v25 : u32; - v27 = hir.bitcast v26 : i32; - v29 = arith.neq v27, v692 : i1; - v665 = scf.if v29 : u32 { - ^block87: - v661 = arith.constant 0 : u32; - scf.yield v661; + ^block4: + v1 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v2 = hir.bitcast v1 : ptr; + v3 = hir.load v2 : i32; + v4 = arith.constant 16 : i32; + v5 = arith.sub v3, v4 : i32 #[overflow = wrapping]; + v6 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v7 = hir.bitcast v6 : ptr; + hir.store v7, v5; + v8 = arith.constant 4 : i32; + v9 = arith.add v5, v8 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden_base_sys::bindings::note::get_inputs(v9) + v11 = arith.constant 12 : u32; + v10 = hir.bitcast v5 : u32; + v12 = arith.add v10, v11 : u32 #[overflow = checked]; + v13 = arith.constant 4 : u32; + v14 = arith.mod v12, v13 : u32; + hir.assertz v14 #[code = 250]; + v15 = hir.int_to_ptr v12 : ptr; + v16 = hir.load v15 : i32; + v17 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/>::from(v16) : felt + v698 = arith.constant 4 : i32; + v19 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v698) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v17, v19) + v697 = arith.constant 0 : i32; + v0 = arith.constant 0 : i32; + v21 = arith.eq v16, v0 : i1; + v22 = arith.zext v21 : u32; + v23 = hir.bitcast v22 : i32; + v25 = arith.neq v23, v697 : i1; + v668 = scf.if v25 : u32 { + ^block93: + v664 = arith.constant 0 : u32; + scf.yield v664; } else { - ^block13: - v31 = arith.constant 8 : u32; - v30 = hir.bitcast v9 : u32; - v32 = arith.add v30, v31 : u32 #[overflow = checked]; - v691 = arith.constant 4 : u32; - v34 = arith.mod v32, v691 : u32; - hir.assertz v34 #[code = 250]; - v35 = hir.int_to_ptr v32 : ptr; - v36 = hir.load v35 : i32; - v37 = hir.bitcast v36 : u32; - v690 = arith.constant 4 : u32; - v39 = arith.mod v37, v690 : u32; - hir.assertz v39 #[code = 250]; - v40 = hir.int_to_ptr v37 : ptr; - v41 = hir.load v40 : felt; - v42 = arith.constant -1 : i32; - v43 = hir.bitcast v42 : felt; - hir.assert_eq v41, v43; - v689 = arith.constant 0 : i32; - v44 = arith.constant 1 : i32; - v45 = arith.eq v20, v44 : i1; - v46 = arith.zext v45 : u32; - v47 = hir.bitcast v46 : i32; - v49 = arith.neq v47, v689 : i1; - v667 = scf.if v49 : u32 { - ^block86: - v688 = arith.constant 0 : u32; - scf.yield v688; + ^block7: + v27 = arith.constant 8 : u32; + v26 = hir.bitcast v5 : u32; + v28 = arith.add v26, v27 : u32 #[overflow = checked]; + v696 = arith.constant 4 : u32; + v30 = arith.mod v28, v696 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + v32 = hir.load v31 : i32; + v33 = hir.bitcast v32 : u32; + v695 = arith.constant 4 : u32; + v35 = arith.mod v33, v695 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : felt; + v38 = arith.constant -1 : i32; + v39 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v38) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v37, v39) + v694 = arith.constant 0 : i32; + v40 = arith.constant 1 : i32; + v41 = arith.eq v16, v40 : i1; + v42 = arith.zext v41 : u32; + v43 = hir.bitcast v42 : i32; + v45 = arith.neq v43, v694 : i1; + v670 = scf.if v45 : u32 { + ^block92: + v693 = arith.constant 0 : u32; + scf.yield v693; } else { - ^block14: - v687 = arith.constant 4 : u32; - v50 = hir.bitcast v36 : u32; - v52 = arith.add v50, v687 : u32 #[overflow = checked]; - v686 = arith.constant 4 : u32; - v54 = arith.mod v52, v686 : u32; - hir.assertz v54 #[code = 250]; - v55 = hir.int_to_ptr v52 : ptr; - v56 = hir.load v55 : felt; - v659 = arith.constant 1 : felt; - hir.assert_eq v56, v659; - v685 = arith.constant 0 : i32; - v658 = arith.constant 2 : u32; - v60 = hir.bitcast v20 : u32; - v62 = arith.lte v60, v658 : i1; - v63 = arith.zext v62 : u32; - v64 = hir.bitcast v63 : i32; - v66 = arith.neq v64, v685 : i1; - v669 = scf.if v66 : u32 { - ^block85: - v684 = arith.constant 0 : u32; - scf.yield v684; + ^block8: + v692 = arith.constant 4 : u32; + v46 = hir.bitcast v32 : u32; + v48 = arith.add v46, v692 : u32 #[overflow = checked]; + v691 = arith.constant 4 : u32; + v50 = arith.mod v48, v691 : u32; + hir.assertz v50 #[code = 250]; + v51 = hir.int_to_ptr v48 : ptr; + v52 = hir.load v51 : felt; + v690 = arith.constant 1 : i32; + v54 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v690) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v52, v54) + v689 = arith.constant 0 : i32; + v663 = arith.constant 2 : u32; + v56 = hir.bitcast v16 : u32; + v58 = arith.lte v56, v663 : i1; + v59 = arith.zext v58 : u32; + v60 = hir.bitcast v59 : i32; + v62 = arith.neq v60, v689 : i1; + v672 = scf.if v62 : u32 { + ^block91: + v688 = arith.constant 0 : u32; + scf.yield v688; } else { - ^block15: - v683 = arith.constant 8 : u32; - v67 = hir.bitcast v36 : u32; - v69 = arith.add v67, v683 : u32 #[overflow = checked]; - v682 = arith.constant 4 : u32; - v71 = arith.mod v69, v682 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - v73 = hir.load v72 : felt; - v657 = arith.constant 2 : felt; - hir.assert_eq v73, v657; - v681 = arith.constant 0 : i32; - v76 = arith.constant 3 : i32; - v77 = arith.eq v20, v76 : i1; - v78 = arith.zext v77 : u32; - v79 = hir.bitcast v78 : i32; - v81 = arith.neq v79, v681 : i1; - scf.if v81{ - ^block84: + ^block9: + v687 = arith.constant 8 : u32; + v63 = hir.bitcast v32 : u32; + v65 = arith.add v63, v687 : u32 #[overflow = checked]; + v686 = arith.constant 4 : u32; + v67 = arith.mod v65, v686 : u32; + hir.assertz v67 #[code = 250]; + v68 = hir.int_to_ptr v65 : ptr; + v69 = hir.load v68 : felt; + v55 = arith.constant 2 : i32; + v71 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v55) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v69, v71) + v685 = arith.constant 0 : i32; + v72 = arith.constant 3 : i32; + v73 = arith.eq v16, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v685 : i1; + scf.if v77{ + ^block90: scf.yield ; } else { - ^block16: - v680 = arith.constant 12 : u32; - v82 = hir.bitcast v36 : u32; - v84 = arith.add v82, v680 : u32 #[overflow = checked]; - v679 = arith.constant 4 : u32; - v86 = arith.mod v84, v679 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - v88 = hir.load v87 : felt; - v656 = arith.constant 3 : felt; - hir.assert_eq v88, v656; - v677 = arith.constant 4 : i32; - v678 = arith.constant 4 : i32; - v92 = arith.add v9, v678 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::deallocate(v92, v677, v677) - v676 = arith.constant 16 : i32; - v96 = arith.add v9, v676 : i32 #[overflow = wrapping]; - v97 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v98 = hir.bitcast v97 : ptr; - hir.store v98, v96; + ^block10: + v684 = arith.constant 12 : u32; + v78 = hir.bitcast v32 : u32; + v80 = arith.add v78, v684 : u32 #[overflow = checked]; + v683 = arith.constant 4 : u32; + v82 = arith.mod v80, v683 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : felt; + v682 = arith.constant 3 : i32; + v86 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::from_u32(v682) : felt + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::felt::assert_eq(v84, v86) + v680 = arith.constant 4 : i32; + v681 = arith.constant 4 : i32; + v88 = arith.add v5, v681 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::deallocate(v88, v680, v680) + v679 = arith.constant 16 : i32; + v92 = arith.add v5, v679 : i32 #[overflow = wrapping]; + v93 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v94 = hir.bitcast v93 : ptr; + hir.store v94, v92; scf.yield ; }; - v663 = arith.constant 1 : u32; - v675 = arith.constant 0 : u32; - v673 = cf.select v81, v675, v663 : u32; - scf.yield v673; + v666 = arith.constant 1 : u32; + v678 = arith.constant 0 : u32; + v676 = cf.select v77, v678, v666 : u32; + scf.yield v676; }; - scf.yield v669; + scf.yield v672; }; - scf.yield v667; + scf.yield v670; }; - v674 = arith.constant 0 : u32; - v672 = arith.eq v665, v674 : i1; - cf.cond_br v672 ^block12, ^block89; - ^block12: + v677 = arith.constant 0 : u32; + v675 = arith.eq v668, v677 : i1; + cf.cond_br v675 ^block6, ^block95; + ^block6: ub.unreachable ; - ^block89: + ^block95: builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc(v99: i32, v100: i32) -> i32 { - ^block17(v99: i32, v100: i32): - v102 = arith.constant 1048636 : i32; - v103 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v102, v100, v99) : i32 - builtin.ret v103; + private builtin.function @__rustc::__rust_alloc(v95: i32, v96: i32) -> i32 { + ^block11(v95: i32, v96: i32): + v98 = arith.constant 1048636 : i32; + v99 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v98, v96, v95) : i32 + builtin.ret v99; }; - private builtin.function @__rustc::__rust_dealloc(v104: i32, v105: i32, v106: i32) { - ^block19(v104: i32, v105: i32, v106: i32): + private builtin.function @__rustc::__rust_dealloc(v100: i32, v101: i32, v102: i32) { + ^block13(v100: i32, v101: i32, v102: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v107: i32, v108: i32) -> i32 { - ^block21(v107: i32, v108: i32): - v110 = arith.constant 1048636 : i32; - v111 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v110, v108, v107) : i32 - v701 = arith.constant 0 : i32; - v112 = arith.constant 0 : i32; - v113 = arith.eq v111, v112 : i1; - v114 = arith.zext v113 : u32; - v115 = hir.bitcast v114 : i32; - v117 = arith.neq v115, v701 : i1; - scf.if v117{ - ^block23: + private builtin.function @__rustc::__rust_alloc_zeroed(v103: i32, v104: i32) -> i32 { + ^block15(v103: i32, v104: i32): + v106 = arith.constant 1048636 : i32; + v107 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::alloc(v106, v104, v103) : i32 + v707 = arith.constant 0 : i32; + v108 = arith.constant 0 : i32; + v109 = arith.eq v107, v108 : i1; + v110 = arith.zext v109 : u32; + v111 = hir.bitcast v110 : i32; + v113 = arith.neq v111, v707 : i1; + scf.if v113{ + ^block17: scf.yield ; } else { - ^block24: - v699 = arith.constant 0 : i32; - v700 = arith.constant 0 : i32; - v119 = arith.eq v107, v700 : i1; - v120 = arith.zext v119 : u32; - v121 = hir.bitcast v120 : i32; - v123 = arith.neq v121, v699 : i1; - scf.if v123{ - ^block94: + ^block18: + v705 = arith.constant 0 : i32; + v706 = arith.constant 0 : i32; + v115 = arith.eq v103, v706 : i1; + v116 = arith.zext v115 : u32; + v117 = hir.bitcast v116 : i32; + v119 = arith.neq v117, v705 : i1; + scf.if v119{ + ^block100: scf.yield ; } else { - ^block25: - v693 = arith.constant 0 : u8; - v126 = hir.bitcast v107 : u32; - v127 = hir.bitcast v111 : u32; - v128 = hir.int_to_ptr v127 : ptr; - hir.mem_set v128, v126, v693; + ^block19: + v699 = arith.constant 0 : u8; + v122 = hir.bitcast v103 : u32; + v123 = hir.bitcast v107 : u32; + v124 = hir.int_to_ptr v123 : ptr; + hir.mem_set v124, v122, v699; scf.yield ; }; scf.yield ; }; - builtin.ret v111; + builtin.ret v107; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block26: + ^block20: builtin.ret ; }; - private builtin.function @::alloc(v130: i32, v131: i32, v132: i32) -> i32 { - ^block28(v130: i32, v131: i32, v132: i32): - v135 = arith.constant 16 : i32; - v134 = arith.constant 0 : i32; - v703 = arith.constant 16 : u32; - v137 = hir.bitcast v131 : u32; - v139 = arith.gt v137, v703 : i1; - v140 = arith.zext v139 : u32; - v141 = hir.bitcast v140 : i32; - v143 = arith.neq v141, v134 : i1; - v144 = cf.select v143, v131, v135 : i32; - v743 = arith.constant 0 : i32; - v145 = arith.constant -1 : i32; - v146 = arith.add v144, v145 : i32 #[overflow = wrapping]; - v147 = arith.band v144, v146 : i32; - v149 = arith.neq v147, v743 : i1; - v712, v713 = scf.if v149 : i32, u32 { - ^block99: - v704 = arith.constant 0 : u32; - v708 = ub.poison i32 : i32; - scf.yield v708, v704; + private builtin.function @::alloc(v126: i32, v127: i32, v128: i32) -> i32 { + ^block22(v126: i32, v127: i32, v128: i32): + v131 = arith.constant 16 : i32; + v130 = arith.constant 0 : i32; + v709 = arith.constant 16 : u32; + v133 = hir.bitcast v127 : u32; + v135 = arith.gt v133, v709 : i1; + v136 = arith.zext v135 : u32; + v137 = hir.bitcast v136 : i32; + v139 = arith.neq v137, v130 : i1; + v140 = cf.select v139, v127, v131 : i32; + v749 = arith.constant 0 : i32; + v141 = arith.constant -1 : i32; + v142 = arith.add v140, v141 : i32 #[overflow = wrapping]; + v143 = arith.band v140, v142 : i32; + v145 = arith.neq v143, v749 : i1; + v718, v719 = scf.if v145 : i32, u32 { + ^block105: + v710 = arith.constant 0 : u32; + v714 = ub.poison i32 : i32; + scf.yield v714, v710; } else { - ^block31: - v151 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/core::ptr::alignment::Alignment::max(v131, v144) : i32 - v742 = arith.constant 0 : i32; - v150 = arith.constant -2147483648 : i32; - v152 = arith.sub v150, v151 : i32 #[overflow = wrapping]; - v154 = hir.bitcast v152 : u32; - v153 = hir.bitcast v132 : u32; - v155 = arith.gt v153, v154 : i1; - v156 = arith.zext v155 : u32; - v157 = hir.bitcast v156 : i32; - v159 = arith.neq v157, v742 : i1; - v727 = scf.if v159 : i32 { - ^block98: - v741 = ub.poison i32 : i32; - scf.yield v741; + ^block25: + v147 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/core::ptr::alignment::Alignment::max(v127, v140) : i32 + v748 = arith.constant 0 : i32; + v146 = arith.constant -2147483648 : i32; + v148 = arith.sub v146, v147 : i32 #[overflow = wrapping]; + v150 = hir.bitcast v148 : u32; + v149 = hir.bitcast v128 : u32; + v151 = arith.gt v149, v150 : i1; + v152 = arith.zext v151 : u32; + v153 = hir.bitcast v152 : i32; + v155 = arith.neq v153, v748 : i1; + v733 = scf.if v155 : i32 { + ^block104: + v747 = ub.poison i32 : i32; + scf.yield v747; } else { - ^block32: - v739 = arith.constant 0 : i32; - v165 = arith.sub v739, v151 : i32 #[overflow = wrapping]; - v740 = arith.constant -1 : i32; - v161 = arith.add v132, v151 : i32 #[overflow = wrapping]; - v163 = arith.add v161, v740 : i32 #[overflow = wrapping]; - v166 = arith.band v163, v165 : i32; - v167 = hir.bitcast v130 : u32; - 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; - v738 = arith.constant 0 : i32; - v173 = arith.neq v171, v738 : i1; - scf.if v173{ - ^block97: + ^block26: + v745 = arith.constant 0 : i32; + v161 = arith.sub v745, v147 : i32 #[overflow = wrapping]; + v746 = arith.constant -1 : i32; + v157 = arith.add v128, v147 : i32 #[overflow = wrapping]; + v159 = arith.add v157, v746 : i32 #[overflow = wrapping]; + v162 = arith.band v159, v161 : i32; + v163 = hir.bitcast v126 : u32; + 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 : i32; + v744 = arith.constant 0 : i32; + v169 = arith.neq v167, v744 : i1; + scf.if v169{ + ^block103: scf.yield ; } else { - ^block34: - v174 = hir.exec @intrinsics/mem/heap_base() : i32 - v175 = hir.mem_size : u32; - v181 = hir.bitcast v130 : u32; - v737 = arith.constant 4 : u32; - v183 = arith.mod v181, v737 : u32; - hir.assertz v183 #[code = 250]; - v736 = arith.constant 16 : u32; - v176 = hir.bitcast v175 : i32; - v179 = arith.shl v176, v736 : i32; - v180 = arith.add v174, v179 : i32 #[overflow = wrapping]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v180; + ^block28: + v170 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/intrinsics::mem::heap_base() : i32 + v171 = hir.mem_size : u32; + v177 = hir.bitcast v126 : u32; + v743 = arith.constant 4 : u32; + v179 = arith.mod v177, v743 : u32; + hir.assertz v179 #[code = 250]; + v742 = arith.constant 16 : u32; + v172 = hir.bitcast v171 : i32; + v175 = arith.shl v172, v742 : i32; + v176 = arith.add v170, v175 : i32 #[overflow = wrapping]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v176; scf.yield ; }; - v187 = hir.bitcast v130 : u32; - v735 = arith.constant 4 : u32; - v189 = arith.mod v187, v735 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - v191 = hir.load v190 : i32; - v733 = arith.constant 0 : i32; - v734 = arith.constant -1 : i32; - v193 = arith.bxor v191, v734 : i32; - v195 = hir.bitcast v193 : u32; - v194 = hir.bitcast v166 : u32; - v196 = arith.gt v194, v195 : i1; - v197 = arith.zext v196 : u32; - v198 = hir.bitcast v197 : i32; - v200 = arith.neq v198, v733 : i1; - v726 = scf.if v200 : i32 { - ^block35: - v732 = arith.constant 0 : i32; - scf.yield v732; + v183 = hir.bitcast v126 : u32; + v741 = arith.constant 4 : u32; + v185 = arith.mod v183, v741 : u32; + hir.assertz v185 #[code = 250]; + v186 = hir.int_to_ptr v183 : ptr; + v187 = hir.load v186 : i32; + v739 = arith.constant 0 : i32; + v740 = arith.constant -1 : i32; + v189 = arith.bxor v187, v740 : i32; + v191 = hir.bitcast v189 : u32; + v190 = hir.bitcast v162 : u32; + v192 = arith.gt v190, v191 : i1; + v193 = arith.zext v192 : u32; + v194 = hir.bitcast v193 : i32; + v196 = arith.neq v194, v739 : i1; + v732 = scf.if v196 : i32 { + ^block29: + v738 = arith.constant 0 : i32; + scf.yield v738; } else { - ^block36: - v202 = hir.bitcast v130 : u32; - v731 = arith.constant 4 : u32; - v204 = arith.mod v202, v731 : u32; - hir.assertz v204 #[code = 250]; - v201 = arith.add v191, v166 : i32 #[overflow = wrapping]; - v205 = hir.int_to_ptr v202 : ptr; - hir.store v205, v201; - v207 = arith.add v191, v151 : i32 #[overflow = wrapping]; - scf.yield v207; + ^block30: + v198 = hir.bitcast v126 : u32; + v737 = arith.constant 4 : u32; + v200 = arith.mod v198, v737 : u32; + hir.assertz v200 #[code = 250]; + v197 = arith.add v187, v162 : i32 #[overflow = wrapping]; + v201 = hir.int_to_ptr v198 : ptr; + hir.store v201, v197; + v203 = arith.add v187, v147 : i32 #[overflow = wrapping]; + scf.yield v203; }; - scf.yield v726; + scf.yield v732; }; - v709 = arith.constant 1 : u32; - v730 = arith.constant 0 : u32; - v728 = cf.select v159, v730, v709 : u32; - scf.yield v727, v728; + v715 = arith.constant 1 : u32; + v736 = arith.constant 0 : u32; + v734 = cf.select v155, v736, v715 : u32; + scf.yield v733, v734; }; - v729 = arith.constant 0 : u32; - v725 = arith.eq v713, v729 : i1; - cf.cond_br v725 ^block30, ^block101(v712); - ^block30: + v735 = arith.constant 0 : u32; + v731 = arith.eq v719, v735 : i1; + cf.cond_br v731 ^block24, ^block107(v718); + ^block24: ub.unreachable ; - ^block101(v705: i32): - builtin.ret v705; + ^block107(v711: i32): + builtin.ret v711; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v210: i32, v211: i32, v212: i32, v213: i32) { - ^block37(v210: i32, v211: i32, v212: i32, v213: i32): - v215 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v216 = hir.bitcast v215 : ptr; - v217 = hir.load v216 : i32; - v218 = arith.constant 16 : i32; - v219 = arith.sub v217, v218 : i32 #[overflow = wrapping]; - v220 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v221 = hir.bitcast v220 : ptr; - hir.store v221, v219; - v214 = arith.constant 0 : i32; - v224 = arith.constant 256 : i32; - v222 = arith.constant 4 : i32; - v223 = arith.add v219, v222 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::try_allocate_in(v223, v224, v214, v211, v212) - v227 = arith.constant 8 : u32; - v226 = hir.bitcast v219 : 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; - v754 = arith.constant 4 : u32; - v233 = hir.bitcast v219 : u32; - v235 = arith.add v233, v754 : u32 #[overflow = checked]; - v753 = arith.constant 4 : u32; - v237 = arith.mod v235, v753 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i32; - v752 = 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, v752 : i1; - cf.cond_br v245 ^block39, ^block40; - ^block39: - v254 = arith.constant 12 : u32; - v253 = hir.bitcast v219 : u32; - v255 = arith.add v253, v254 : u32 #[overflow = checked]; - v751 = arith.constant 4 : u32; - v257 = arith.mod v255, v751 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - v259 = hir.load v258 : i32; - v750 = arith.constant 4 : u32; - v260 = hir.bitcast v210 : u32; - v262 = arith.add v260, v750 : u32 #[overflow = checked]; - v749 = arith.constant 4 : u32; - v264 = arith.mod v262, v749 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - hir.store v265, v259; - v266 = hir.bitcast v210 : u32; - v748 = arith.constant 4 : u32; - v268 = arith.mod v266, v748 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - hir.store v269, v232; - v747 = arith.constant 16 : i32; - v271 = arith.add v219, v747 : i32 #[overflow = wrapping]; - v272 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v273 = hir.bitcast v272 : ptr; - hir.store v273, v271; - builtin.ret ; - ^block40: - v746 = arith.constant 12 : u32; - v246 = hir.bitcast v219 : u32; - v248 = arith.add v246, v746 : u32 #[overflow = checked]; - v745 = arith.constant 4 : u32; - v250 = arith.mod v248, v745 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::handle_error(v232, v252, v213) - ub.unreachable ; + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block31: + v206 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v206; }; - private builtin.function @miden_base_sys::bindings::note::get_inputs(v274: i32) { - ^block41(v274: i32): - v276 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v277 = hir.bitcast v276 : ptr; - v278 = hir.load v277 : i32; - v279 = arith.constant 16 : i32; - v280 = arith.sub v278, v279 : i32 #[overflow = wrapping]; - v281 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v282 = hir.bitcast v281 : ptr; - hir.store v282, v280; - v287 = arith.constant 1048620 : i32; - v285 = arith.constant 4 : i32; - v283 = arith.constant 8 : i32; - v284 = arith.add v280, v283 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::with_capacity_in(v284, v285, v285, v287) - v289 = arith.constant 8 : u32; - v288 = hir.bitcast v280 : 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; - v296 = arith.constant 12 : u32; - v295 = hir.bitcast v280 : u32; - v297 = arith.add v295, v296 : u32 #[overflow = checked]; - v762 = arith.constant 4 : u32; - v299 = arith.mod v297, v762 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - v301 = hir.load v300 : i32; - v755 = arith.constant 2 : u32; - v303 = hir.bitcast v301 : u32; - v305 = arith.shr v303, v755 : u32; - v306 = hir.bitcast v305 : i32; - v307 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden_base_sys::bindings::note::extern_note_get_inputs(v306) : i32 - v761 = arith.constant 8 : u32; - v308 = hir.bitcast v274 : u32; - v310 = arith.add v308, v761 : u32 #[overflow = checked]; + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v208: i32, v209: i32, v210: i32, v211: i32) { + ^block35(v208: i32, v209: i32, v210: i32, v211: i32): + v213 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v214 = hir.bitcast v213 : ptr; + v215 = hir.load v214 : i32; + v216 = arith.constant 16 : i32; + v217 = arith.sub v215, v216 : i32 #[overflow = wrapping]; + v218 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v219 = hir.bitcast v218 : ptr; + hir.store v219, v217; + v212 = arith.constant 0 : i32; + v222 = arith.constant 256 : i32; + v220 = arith.constant 4 : i32; + v221 = arith.add v217, v220 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::try_allocate_in(v221, v222, v212, v209, v210) + v225 = arith.constant 8 : u32; + v224 = hir.bitcast v217 : 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; v760 = arith.constant 4 : u32; - v312 = arith.mod v310, v760 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - hir.store v313, v307; + v231 = hir.bitcast v217 : u32; + v233 = arith.add v231, v760 : u32 #[overflow = checked]; v759 = arith.constant 4 : u32; - v314 = hir.bitcast v274 : u32; - v316 = arith.add v314, v759 : u32 #[overflow = checked]; - v758 = arith.constant 4 : u32; - v318 = arith.mod v316, v758 : u32; - hir.assertz v318 #[code = 250]; - v319 = hir.int_to_ptr v316 : ptr; - hir.store v319, v301; - v320 = hir.bitcast v274 : u32; + v235 = arith.mod v233, v759 : u32; + hir.assertz v235 #[code = 250]; + v236 = hir.int_to_ptr v233 : ptr; + v237 = hir.load v236 : i32; + v758 = 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, v758 : i1; + cf.cond_br v243 ^block37, ^block38; + ^block37: + v252 = arith.constant 12 : u32; + v251 = hir.bitcast v217 : u32; + v253 = arith.add v251, v252 : u32 #[overflow = checked]; v757 = arith.constant 4 : u32; - v322 = arith.mod v320, v757 : u32; - hir.assertz v322 #[code = 250]; - v323 = hir.int_to_ptr v320 : ptr; - hir.store v323, v294; - v756 = arith.constant 16 : i32; - v325 = arith.add v280, v756 : i32 #[overflow = wrapping]; - v326 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v327 = hir.bitcast v326 : ptr; - hir.store v327, v325; + v255 = arith.mod v253, v757 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + v257 = hir.load v256 : i32; + v756 = arith.constant 4 : u32; + v258 = hir.bitcast v208 : u32; + v260 = arith.add v258, v756 : u32 #[overflow = checked]; + v755 = arith.constant 4 : u32; + v262 = arith.mod v260, v755 : u32; + hir.assertz v262 #[code = 250]; + v263 = hir.int_to_ptr v260 : ptr; + hir.store v263, v257; + v264 = hir.bitcast v208 : u32; + v754 = arith.constant 4 : u32; + v266 = arith.mod v264, v754 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + hir.store v267, v230; + v753 = arith.constant 16 : i32; + v269 = arith.add v217, v753 : i32 #[overflow = wrapping]; + v270 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v271 = hir.bitcast v270 : ptr; + hir.store v271, v269; + builtin.ret ; + ^block38: + v752 = arith.constant 12 : u32; + v244 = hir.bitcast v217 : u32; + v246 = arith.add v244, v752 : u32 #[overflow = checked]; + v751 = arith.constant 4 : u32; + v248 = arith.mod v246, v751 : u32; + hir.assertz v248 #[code = 250]; + v249 = hir.int_to_ptr v246 : ptr; + v250 = hir.load v249 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::handle_error(v230, v250, v211) + ub.unreachable ; + }; + + private builtin.function @miden_base_sys::bindings::note::get_inputs(v272: i32) { + ^block39(v272: i32): + v274 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v275 = hir.bitcast v274 : ptr; + v276 = hir.load v275 : i32; + v277 = arith.constant 16 : i32; + v278 = arith.sub v276, v277 : i32 #[overflow = wrapping]; + v279 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v280 = hir.bitcast v279 : ptr; + hir.store v280, v278; + v285 = arith.constant 1048620 : i32; + v283 = arith.constant 4 : i32; + v281 = arith.constant 8 : i32; + v282 = arith.add v278, v281 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::with_capacity_in(v282, v283, v283, v285) + v287 = arith.constant 8 : u32; + v286 = hir.bitcast v278 : 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; + v294 = arith.constant 12 : u32; + v293 = hir.bitcast v278 : u32; + v295 = arith.add v293, v294 : u32 #[overflow = checked]; + v768 = arith.constant 4 : u32; + v297 = arith.mod v295, v768 : u32; + hir.assertz v297 #[code = 250]; + v298 = hir.int_to_ptr v295 : ptr; + v299 = hir.load v298 : i32; + v761 = arith.constant 2 : u32; + v301 = hir.bitcast v299 : u32; + v303 = arith.shr v301, v761 : u32; + v304 = hir.bitcast v303 : i32; + v305 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/miden::note::get_inputs(v304) : i32 + v767 = arith.constant 8 : u32; + v306 = hir.bitcast v272 : u32; + v308 = arith.add v306, v767 : u32 #[overflow = checked]; + v766 = arith.constant 4 : u32; + v310 = arith.mod v308, v766 : u32; + hir.assertz v310 #[code = 250]; + v311 = hir.int_to_ptr v308 : ptr; + hir.store v311, v305; + v765 = arith.constant 4 : u32; + v312 = hir.bitcast v272 : u32; + v314 = arith.add v312, v765 : u32 #[overflow = checked]; + v764 = arith.constant 4 : u32; + v316 = arith.mod v314, v764 : u32; + hir.assertz v316 #[code = 250]; + v317 = hir.int_to_ptr v314 : ptr; + hir.store v317, v299; + v318 = hir.bitcast v272 : u32; + v763 = arith.constant 4 : u32; + v320 = arith.mod v318, v763 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + hir.store v321, v292; + v762 = arith.constant 16 : i32; + v323 = arith.add v278, v762 : i32 #[overflow = wrapping]; + v324 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v325 = hir.bitcast v324 : ptr; + hir.store v325, v323; builtin.ret ; }; - private builtin.function @>::from(v328: i32) -> felt { - ^block43(v328: i32): - v330 = hir.bitcast v328 : felt; - builtin.ret v330; + private builtin.function @miden::note::get_inputs(v326: i32) -> i32 { + ^block41(v326: i32): + v327, v328 = hir.exec @miden/note/get_inputs(v326) : i32, i32 + builtin.ret v327; + }; + + private builtin.function @>::from(v330: i32) -> felt { + ^block45(v330: i32): + v332 = hir.bitcast v330 : felt; + builtin.ret v332; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v331: i32, v332: i32, v333: i32) { - ^block45(v331: i32, v332: i32, v333: i32): - v335 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v336 = hir.bitcast v335 : ptr; - v337 = hir.load v336 : i32; - v338 = arith.constant 16 : i32; - v339 = arith.sub v337, v338 : i32 #[overflow = wrapping]; - v340 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v341 = hir.bitcast v340 : ptr; - hir.store v341, v339; - v342 = arith.constant 4 : i32; - v343 = arith.add v339, v342 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::current_memory(v343, v331, v332, v333) - v345 = arith.constant 8 : u32; - v344 = hir.bitcast v339 : u32; - v346 = arith.add v344, v345 : u32 #[overflow = checked]; - v347 = arith.constant 4 : u32; - v348 = arith.mod v346, v347 : u32; - hir.assertz v348 #[code = 250]; - v349 = hir.int_to_ptr v346 : ptr; - v350 = hir.load v349 : i32; - v769 = arith.constant 0 : i32; - v334 = arith.constant 0 : i32; - v352 = arith.eq v350, v334 : i1; - v353 = arith.zext v352 : u32; - v354 = hir.bitcast v353 : i32; - v356 = arith.neq v354, v769 : i1; - scf.if v356{ - ^block107: + private builtin.function @intrinsics::felt::from_u32(v333: i32) -> felt { + ^block47(v333: i32): + v334 = hir.bitcast v333 : felt; + builtin.ret v334; + }; + + private builtin.function @intrinsics::felt::assert_eq(v336: felt, v337: felt) { + ^block49(v336: felt, v337: felt): + hir.assert_eq v336, v337; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v338: i32, v339: i32, v340: i32) { + ^block51(v338: i32, v339: i32, v340: i32): + v342 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v343 = hir.bitcast v342 : ptr; + v344 = hir.load v343 : i32; + v345 = arith.constant 16 : i32; + v346 = arith.sub v344, v345 : i32 #[overflow = wrapping]; + v347 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v348 = hir.bitcast v347 : ptr; + hir.store v348, v346; + v349 = arith.constant 4 : i32; + v350 = arith.add v346, v349 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::raw_vec::RawVecInner::current_memory(v350, v338, v339, v340) + v352 = arith.constant 8 : u32; + v351 = hir.bitcast v346 : u32; + v353 = arith.add v351, v352 : u32 #[overflow = checked]; + v354 = arith.constant 4 : u32; + v355 = arith.mod v353, v354 : u32; + hir.assertz v355 #[code = 250]; + v356 = hir.int_to_ptr v353 : ptr; + v357 = hir.load v356 : i32; + v775 = arith.constant 0 : i32; + v341 = arith.constant 0 : i32; + v359 = arith.eq v357, v341 : i1; + v360 = arith.zext v359 : u32; + v361 = hir.bitcast v360 : i32; + v363 = arith.neq v361, v775 : i1; + scf.if v363{ + ^block113: scf.yield ; } else { - ^block48: - v768 = arith.constant 4 : u32; - v357 = hir.bitcast v339 : u32; - v359 = arith.add v357, v768 : u32 #[overflow = checked]; - v767 = arith.constant 4 : u32; - v361 = arith.mod v359, v767 : u32; - hir.assertz v361 #[code = 250]; - v362 = hir.int_to_ptr v359 : ptr; - v363 = hir.load v362 : i32; - v365 = arith.constant 12 : u32; - v364 = hir.bitcast v339 : u32; - v366 = arith.add v364, v365 : u32 #[overflow = checked]; - v766 = arith.constant 4 : u32; - v368 = arith.mod v366, v766 : u32; + ^block54: + v774 = arith.constant 4 : u32; + v364 = hir.bitcast v346 : u32; + v366 = arith.add v364, v774 : u32 #[overflow = checked]; + v773 = arith.constant 4 : u32; + v368 = arith.mod v366, v773 : u32; hir.assertz v368 #[code = 250]; v369 = hir.int_to_ptr v366 : ptr; v370 = hir.load v369 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v363, v350, v370) + v372 = arith.constant 12 : u32; + v371 = hir.bitcast v346 : u32; + v373 = arith.add v371, v372 : u32 #[overflow = checked]; + v772 = arith.constant 4 : u32; + v375 = arith.mod v373, v772 : u32; + hir.assertz v375 #[code = 250]; + v376 = hir.int_to_ptr v373 : ptr; + v377 = hir.load v376 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::deallocate(v370, v357, v377) scf.yield ; }; - v765 = arith.constant 16 : i32; - v373 = arith.add v339, v765 : i32 #[overflow = wrapping]; - v374 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v375 = hir.bitcast v374 : ptr; - hir.store v375, v373; + v771 = arith.constant 16 : i32; + v380 = arith.add v346, v771 : i32 #[overflow = wrapping]; + v381 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v382 = hir.bitcast v381 : ptr; + hir.store v382, v380; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32) { - ^block49(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32): - v383 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v384 = hir.bitcast v383 : ptr; - v385 = hir.load v384 : i32; - v386 = arith.constant 16 : i32; - v387 = arith.sub v385, v386 : i32 #[overflow = wrapping]; - v388 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v389 = hir.bitcast v388 : ptr; - hir.store v389, v387; - v399 = hir.bitcast v377 : u32; - v400 = arith.zext v399 : u64; - v401 = hir.bitcast v400 : i64; - v381 = arith.constant 0 : i32; - v394 = arith.sub v381, v379 : i32 #[overflow = wrapping]; - v391 = arith.constant -1 : i32; - v390 = arith.add v379, v380 : i32 #[overflow = wrapping]; - v392 = arith.add v390, v391 : i32 #[overflow = wrapping]; - v395 = arith.band v392, v394 : i32; - v396 = hir.bitcast v395 : u32; - v397 = arith.zext v396 : u64; - v398 = hir.bitcast v397 : i64; - v402 = arith.mul v398, v401 : i64 #[overflow = wrapping]; - v873 = arith.constant 0 : i32; - v403 = arith.constant 32 : i64; - v405 = hir.cast v403 : u32; - v404 = hir.bitcast v402 : u64; - v406 = arith.shr v404, v405 : u64; - v407 = hir.bitcast v406 : i64; - v408 = arith.trunc v407 : i32; - v410 = arith.neq v408, v873 : i1; - v785, v786, v787, v788, v789, v790 = scf.if v410 : i32, i32, i32, i32, i32, u32 { - ^block109: - v770 = arith.constant 0 : u32; - v777 = ub.poison i32 : i32; - scf.yield v376, v387, v777, v777, v777, v770; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v383: i32, v384: i32, v385: i32, v386: i32, v387: i32) { + ^block55(v383: i32, v384: i32, v385: i32, v386: i32, v387: i32): + v390 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v391 = hir.bitcast v390 : ptr; + v392 = hir.load v391 : i32; + v393 = arith.constant 16 : i32; + v394 = arith.sub v392, v393 : i32 #[overflow = wrapping]; + v395 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v396 = hir.bitcast v395 : ptr; + hir.store v396, v394; + v406 = hir.bitcast v384 : u32; + v407 = arith.zext v406 : u64; + v408 = hir.bitcast v407 : i64; + v388 = arith.constant 0 : i32; + v401 = arith.sub v388, v386 : i32 #[overflow = wrapping]; + v398 = arith.constant -1 : i32; + v397 = arith.add v386, v387 : i32 #[overflow = wrapping]; + v399 = arith.add v397, v398 : i32 #[overflow = wrapping]; + v402 = arith.band v399, v401 : i32; + v403 = hir.bitcast v402 : u32; + v404 = arith.zext v403 : u64; + v405 = hir.bitcast v404 : i64; + v409 = arith.mul v405, v408 : i64 #[overflow = wrapping]; + v879 = arith.constant 0 : i32; + v410 = arith.constant 32 : i64; + v412 = hir.cast v410 : u32; + v411 = hir.bitcast v409 : u64; + v413 = arith.shr v411, v412 : u64; + v414 = hir.bitcast v413 : i64; + v415 = arith.trunc v414 : i32; + v417 = arith.neq v415, v879 : i1; + v791, v792, v793, v794, v795, v796 = scf.if v417 : i32, i32, i32, i32, i32, u32 { + ^block115: + v776 = arith.constant 0 : u32; + v783 = ub.poison i32 : i32; + scf.yield v383, v394, v783, v783, v783, v776; } else { - ^block54: - v411 = arith.trunc v402 : i32; - v872 = arith.constant 0 : i32; - v412 = arith.constant -2147483648 : i32; - v413 = arith.sub v412, v379 : i32 #[overflow = wrapping]; - v415 = hir.bitcast v413 : u32; - v414 = hir.bitcast v411 : u32; - v416 = arith.lte v414, v415 : i1; - v417 = arith.zext v416 : u32; - v418 = hir.bitcast v417 : i32; - v420 = arith.neq v418, v872 : i1; - v833 = scf.if v420 : i32 { - ^block52: - v871 = arith.constant 0 : i32; - v431 = arith.neq v411, v871 : i1; - v832 = scf.if v431 : i32 { - ^block56: - v870 = arith.constant 0 : i32; - v447 = arith.neq v378, v870 : i1; - v831 = scf.if v447 : i32 { - ^block59: - v429 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v387, v379, v411, v429) - v458 = hir.bitcast v387 : u32; - v503 = arith.constant 4 : u32; - v460 = arith.mod v458, v503 : u32; - hir.assertz v460 #[code = 250]; - v461 = hir.int_to_ptr v458 : ptr; - v462 = hir.load v461 : i32; - scf.yield v462; + ^block60: + v418 = arith.trunc v409 : i32; + v878 = arith.constant 0 : i32; + v419 = arith.constant -2147483648 : i32; + v420 = arith.sub v419, v386 : i32 #[overflow = wrapping]; + v422 = hir.bitcast v420 : u32; + v421 = hir.bitcast v418 : u32; + v423 = arith.lte v421, v422 : i1; + v424 = arith.zext v423 : u32; + v425 = hir.bitcast v424 : i32; + v427 = arith.neq v425, v878 : i1; + v839 = scf.if v427 : i32 { + ^block58: + v877 = arith.constant 0 : i32; + v438 = arith.neq v418, v877 : i1; + v838 = scf.if v438 : i32 { + ^block62: + v876 = arith.constant 0 : i32; + v454 = arith.neq v385, v876 : i1; + v837 = scf.if v454 : i32 { + ^block65: + v436 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v394, v386, v418, v436) + v465 = hir.bitcast v394 : u32; + v510 = arith.constant 4 : u32; + v467 = arith.mod v465, v510 : u32; + hir.assertz v467 #[code = 250]; + v468 = hir.int_to_ptr v465 : ptr; + v469 = hir.load v468 : i32; + scf.yield v469; } else { - ^block60: - v448 = arith.constant 8 : i32; - v449 = arith.add v387, v448 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v449, v379, v411) - v433 = arith.constant 8 : u32; - v450 = hir.bitcast v387 : u32; - v452 = arith.add v450, v433 : u32 #[overflow = checked]; - v869 = arith.constant 4 : u32; - v454 = arith.mod v452, v869 : u32; - hir.assertz v454 #[code = 250]; - v455 = hir.int_to_ptr v452 : ptr; - v456 = hir.load v455 : i32; - scf.yield v456; + ^block66: + v455 = arith.constant 8 : i32; + v456 = arith.add v394, v455 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/::allocate(v456, v386, v418) + v440 = arith.constant 8 : u32; + v457 = hir.bitcast v394 : u32; + v459 = arith.add v457, v440 : u32 #[overflow = checked]; + v875 = arith.constant 4 : u32; + v461 = arith.mod v459, v875 : u32; + hir.assertz v461 #[code = 250]; + v462 = hir.int_to_ptr v459 : ptr; + v463 = hir.load v462 : i32; + scf.yield v463; }; - v867 = arith.constant 0 : i32; - v868 = arith.constant 0 : i32; - v465 = arith.eq v831, v868 : i1; - v466 = arith.zext v465 : u32; - v467 = hir.bitcast v466 : i32; - v469 = arith.neq v467, v867 : i1; - scf.if v469{ - ^block61: - v866 = arith.constant 8 : u32; - v486 = hir.bitcast v376 : u32; - v488 = arith.add v486, v866 : u32 #[overflow = checked]; - v865 = arith.constant 4 : u32; - v490 = arith.mod v488, v865 : u32; - hir.assertz v490 #[code = 250]; - v491 = hir.int_to_ptr v488 : ptr; - hir.store v491, v411; - v864 = arith.constant 4 : u32; - v493 = hir.bitcast v376 : u32; - v495 = arith.add v493, v864 : u32 #[overflow = checked]; - v863 = arith.constant 4 : u32; - v497 = arith.mod v495, v863 : u32; + v873 = arith.constant 0 : i32; + v874 = arith.constant 0 : i32; + v472 = arith.eq v837, v874 : i1; + v473 = arith.zext v472 : u32; + v474 = hir.bitcast v473 : i32; + v476 = arith.neq v474, v873 : i1; + scf.if v476{ + ^block67: + v872 = arith.constant 8 : u32; + v493 = hir.bitcast v383 : u32; + v495 = arith.add v493, v872 : u32 #[overflow = checked]; + v871 = arith.constant 4 : u32; + v497 = arith.mod v495, v871 : u32; hir.assertz v497 #[code = 250]; v498 = hir.int_to_ptr v495 : ptr; - hir.store v498, v379; + hir.store v498, v418; + v870 = arith.constant 4 : u32; + v500 = hir.bitcast v383 : u32; + v502 = arith.add v500, v870 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v504 = arith.mod v502, v869 : u32; + hir.assertz v504 #[code = 250]; + v505 = hir.int_to_ptr v502 : ptr; + hir.store v505, v386; scf.yield ; } else { - ^block62: - v862 = arith.constant 8 : u32; - v471 = hir.bitcast v376 : u32; - v473 = arith.add v471, v862 : u32 #[overflow = checked]; - v861 = arith.constant 4 : u32; - v475 = arith.mod v473, v861 : u32; - hir.assertz v475 #[code = 250]; - v476 = hir.int_to_ptr v473 : ptr; - hir.store v476, v831; - v860 = arith.constant 4 : u32; - v478 = hir.bitcast v376 : u32; - v480 = arith.add v478, v860 : u32 #[overflow = checked]; - v859 = arith.constant 4 : u32; - v482 = arith.mod v480, v859 : u32; + ^block68: + v868 = arith.constant 8 : u32; + v478 = hir.bitcast v383 : u32; + v480 = arith.add v478, v868 : u32 #[overflow = checked]; + v867 = arith.constant 4 : u32; + v482 = arith.mod v480, v867 : u32; hir.assertz v482 #[code = 250]; v483 = hir.int_to_ptr v480 : ptr; - hir.store v483, v377; + hir.store v483, v837; + v866 = arith.constant 4 : u32; + v485 = hir.bitcast v383 : u32; + v487 = arith.add v485, v866 : u32 #[overflow = checked]; + v865 = arith.constant 4 : u32; + v489 = arith.mod v487, v865 : u32; + hir.assertz v489 #[code = 250]; + v490 = hir.int_to_ptr v487 : ptr; + hir.store v490, v384; scf.yield ; }; - v857 = arith.constant 0 : i32; - v858 = arith.constant 1 : i32; - v830 = cf.select v469, v858, v857 : i32; - scf.yield v830; + v863 = arith.constant 0 : i32; + v864 = arith.constant 1 : i32; + v836 = cf.select v476, v864, v863 : i32; + scf.yield v836; } else { - ^block57: - v856 = arith.constant 8 : u32; - v432 = hir.bitcast v376 : u32; - v434 = arith.add v432, v856 : u32 #[overflow = checked]; - v855 = arith.constant 4 : u32; - v436 = arith.mod v434, v855 : u32; - hir.assertz v436 #[code = 250]; - v437 = hir.int_to_ptr v434 : ptr; - hir.store v437, v379; - v854 = arith.constant 4 : u32; - v440 = hir.bitcast v376 : u32; - v442 = arith.add v440, v854 : u32 #[overflow = checked]; - v853 = arith.constant 4 : u32; - v444 = arith.mod v442, v853 : u32; - hir.assertz v444 #[code = 250]; - v852 = arith.constant 0 : i32; - v445 = hir.int_to_ptr v442 : ptr; - hir.store v445, v852; - v851 = arith.constant 0 : i32; - scf.yield v851; + ^block63: + v862 = arith.constant 8 : u32; + v439 = hir.bitcast v383 : u32; + v441 = arith.add v439, v862 : u32 #[overflow = checked]; + v861 = arith.constant 4 : u32; + v443 = arith.mod v441, v861 : u32; + hir.assertz v443 #[code = 250]; + v444 = hir.int_to_ptr v441 : ptr; + hir.store v444, v386; + v860 = arith.constant 4 : u32; + v447 = hir.bitcast v383 : u32; + v449 = arith.add v447, v860 : u32 #[overflow = checked]; + v859 = arith.constant 4 : u32; + v451 = arith.mod v449, v859 : u32; + hir.assertz v451 #[code = 250]; + v858 = arith.constant 0 : i32; + v452 = hir.int_to_ptr v449 : ptr; + hir.store v452, v858; + v857 = arith.constant 0 : i32; + scf.yield v857; }; - scf.yield v832; + scf.yield v838; } else { - ^block55: - v850 = ub.poison i32 : i32; - scf.yield v850; + ^block61: + v856 = ub.poison i32 : i32; + scf.yield v856; }; - v845 = arith.constant 0 : u32; - v778 = arith.constant 1 : u32; - v838 = cf.select v420, v778, v845 : u32; - v846 = ub.poison i32 : i32; - v837 = cf.select v420, v387, v846 : i32; - v847 = ub.poison i32 : i32; - v836 = cf.select v420, v376, v847 : i32; - v848 = ub.poison i32 : i32; - v835 = cf.select v420, v848, v387 : i32; - v849 = ub.poison i32 : i32; - v834 = cf.select v420, v849, v376 : i32; - scf.yield v834, v835, v836, v833, v837, v838; + v851 = arith.constant 0 : u32; + v784 = arith.constant 1 : u32; + v844 = cf.select v427, v784, v851 : u32; + v852 = ub.poison i32 : i32; + v843 = cf.select v427, v394, v852 : i32; + v853 = ub.poison i32 : i32; + v842 = cf.select v427, v383, v853 : i32; + v854 = ub.poison i32 : i32; + v841 = cf.select v427, v854, v394 : i32; + v855 = ub.poison i32 : i32; + v840 = cf.select v427, v855, v383 : i32; + scf.yield v840, v841, v842, v839, v843, v844; }; - v791, v792, v793 = scf.index_switch v790 : i32, i32, i32 + v797, v798, v799 = scf.index_switch v796 : i32, i32, i32 case 0 { - ^block53: - v844 = arith.constant 4 : u32; - v423 = hir.bitcast v785 : u32; - v425 = arith.add v423, v844 : u32 #[overflow = checked]; - v843 = arith.constant 4 : u32; - v427 = arith.mod v425, v843 : u32; - hir.assertz v427 #[code = 250]; - v842 = arith.constant 0 : i32; - v428 = hir.int_to_ptr v425 : ptr; - hir.store v428, v842; - v841 = arith.constant 1 : i32; - scf.yield v785, v841, v786; + ^block59: + v850 = arith.constant 4 : u32; + v430 = hir.bitcast v791 : u32; + v432 = arith.add v430, v850 : u32 #[overflow = checked]; + v849 = arith.constant 4 : u32; + v434 = arith.mod v432, v849 : u32; + hir.assertz v434 #[code = 250]; + v848 = arith.constant 0 : i32; + v435 = hir.int_to_ptr v432 : ptr; + hir.store v435, v848; + v847 = arith.constant 1 : i32; + scf.yield v791, v847, v792; } default { - ^block113: - scf.yield v787, v788, v789; + ^block119: + scf.yield v793, v794, v795; }; - v502 = hir.bitcast v791 : u32; - v840 = arith.constant 4 : u32; - v504 = arith.mod v502, v840 : u32; - hir.assertz v504 #[code = 250]; - v505 = hir.int_to_ptr v502 : ptr; - hir.store v505, v792; - v839 = arith.constant 16 : i32; - v510 = arith.add v793, v839 : i32 #[overflow = wrapping]; - v511 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v512 = hir.bitcast v511 : ptr; - hir.store v512, v510; + v509 = hir.bitcast v797 : u32; + v846 = arith.constant 4 : u32; + v511 = arith.mod v509, v846 : u32; + hir.assertz v511 #[code = 250]; + v512 = hir.int_to_ptr v509 : ptr; + hir.store v512, v798; + v845 = arith.constant 16 : i32; + v517 = arith.add v799, v845 : i32 #[overflow = wrapping]; + v518 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v519 = hir.bitcast v518 : ptr; + hir.store v519, v517; builtin.ret ; }; - private builtin.function @::allocate(v513: i32, v514: i32, v515: i32) { - ^block63(v513: i32, v514: i32, v515: i32): - v517 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v518 = hir.bitcast v517 : ptr; - v519 = hir.load v518 : i32; - v520 = arith.constant 16 : i32; - v521 = arith.sub v519, v520 : i32 #[overflow = wrapping]; - v522 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v523 = hir.bitcast v522 : ptr; - hir.store v523, v521; - v516 = arith.constant 0 : i32; - v524 = arith.constant 8 : i32; - v525 = arith.add v521, v524 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v525, v514, v515, v516) - v528 = arith.constant 12 : u32; - v527 = hir.bitcast v521 : u32; - v529 = arith.add v527, v528 : u32 #[overflow = checked]; - v530 = arith.constant 4 : u32; - v531 = arith.mod v529, v530 : u32; - hir.assertz v531 #[code = 250]; - v532 = hir.int_to_ptr v529 : ptr; - v533 = hir.load v532 : i32; - v535 = arith.constant 8 : u32; - v534 = hir.bitcast v521 : u32; + private builtin.function @::allocate(v520: i32, v521: i32, v522: i32) { + ^block69(v520: i32, v521: i32, v522: i32): + v524 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v525 = hir.bitcast v524 : ptr; + v526 = hir.load v525 : i32; + v527 = arith.constant 16 : i32; + v528 = arith.sub v526, v527 : i32 #[overflow = wrapping]; + v529 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v530 = hir.bitcast v529 : ptr; + hir.store v530, v528; + v523 = arith.constant 0 : i32; + v531 = arith.constant 8 : i32; + v532 = arith.add v528, v531 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/alloc::alloc::Global::alloc_impl(v532, v521, v522, v523) + v535 = arith.constant 12 : u32; + v534 = hir.bitcast v528 : u32; v536 = arith.add v534, v535 : u32 #[overflow = checked]; - v878 = arith.constant 4 : u32; - v538 = arith.mod v536, v878 : u32; + v537 = arith.constant 4 : u32; + v538 = arith.mod v536, v537 : u32; hir.assertz v538 #[code = 250]; v539 = hir.int_to_ptr v536 : ptr; v540 = hir.load v539 : i32; - v541 = hir.bitcast v513 : u32; - v877 = arith.constant 4 : u32; - v543 = arith.mod v541, v877 : u32; - hir.assertz v543 #[code = 250]; - v544 = hir.int_to_ptr v541 : ptr; - hir.store v544, v540; - v876 = arith.constant 4 : u32; - v545 = hir.bitcast v513 : u32; - v547 = arith.add v545, v876 : u32 #[overflow = checked]; - v875 = arith.constant 4 : u32; - v549 = arith.mod v547, v875 : u32; - hir.assertz v549 #[code = 250]; - v550 = hir.int_to_ptr v547 : ptr; - hir.store v550, v533; - v874 = arith.constant 16 : i32; - v552 = arith.add v521, v874 : i32 #[overflow = wrapping]; - v553 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr - v554 = hir.bitcast v553 : ptr; - hir.store v554, v552; + v542 = arith.constant 8 : u32; + v541 = hir.bitcast v528 : u32; + v543 = arith.add v541, v542 : u32 #[overflow = checked]; + v884 = arith.constant 4 : u32; + v545 = arith.mod v543, v884 : u32; + hir.assertz v545 #[code = 250]; + v546 = hir.int_to_ptr v543 : ptr; + v547 = hir.load v546 : i32; + v548 = hir.bitcast v520 : u32; + v883 = arith.constant 4 : u32; + v550 = arith.mod v548, v883 : u32; + hir.assertz v550 #[code = 250]; + v551 = hir.int_to_ptr v548 : ptr; + hir.store v551, v547; + v882 = arith.constant 4 : u32; + v552 = hir.bitcast v520 : u32; + v554 = arith.add v552, v882 : u32 #[overflow = checked]; + v881 = arith.constant 4 : u32; + v556 = arith.mod v554, v881 : u32; + hir.assertz v556 #[code = 250]; + v557 = hir.int_to_ptr v554 : ptr; + hir.store v557, v540; + v880 = arith.constant 16 : i32; + v559 = arith.add v528, v880 : i32 #[overflow = wrapping]; + v560 = builtin.global_symbol @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__stack_pointer : ptr + v561 = hir.bitcast v560 : ptr; + hir.store v561, v559; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v555: i32, v556: i32, v557: i32, v558: i32) { - ^block65(v555: i32, v556: i32, v557: i32, v558: i32): - v894 = arith.constant 0 : i32; - v559 = arith.constant 0 : i32; - v560 = arith.eq v557, v559 : i1; - v561 = arith.zext v560 : u32; - v562 = hir.bitcast v561 : i32; - v564 = arith.neq v562, v894 : i1; - v890 = scf.if v564 : i32 { - ^block116: - scf.yield v556; + private builtin.function @alloc::alloc::Global::alloc_impl(v562: i32, v563: i32, v564: i32, v565: i32) { + ^block71(v562: i32, v563: i32, v564: i32, v565: i32): + v900 = arith.constant 0 : i32; + v566 = arith.constant 0 : i32; + v567 = arith.eq v564, v566 : i1; + v568 = arith.zext v567 : u32; + v569 = hir.bitcast v568 : i32; + v571 = arith.neq v569, v900 : i1; + v896 = scf.if v571 : i32 { + ^block122: + scf.yield v563; } else { - ^block68: + ^block74: hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v893 = arith.constant 0 : i32; - v566 = arith.neq v558, v893 : i1; - v889 = scf.if v566 : i32 { - ^block69: - v568 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v557, v556) : i32 - scf.yield v568; + v899 = arith.constant 0 : i32; + v573 = arith.neq v565, v899 : i1; + v895 = scf.if v573 : i32 { + ^block75: + v575 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc_zeroed(v564, v563) : i32 + scf.yield v575; } else { - ^block70: - v567 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v557, v556) : i32 - scf.yield v567; + ^block76: + v574 = hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_alloc(v564, v563) : i32 + scf.yield v574; }; - scf.yield v889; + scf.yield v895; }; - v572 = arith.constant 4 : u32; - v571 = hir.bitcast v555 : u32; - v573 = arith.add v571, v572 : u32 #[overflow = checked]; - v892 = arith.constant 4 : u32; - v575 = arith.mod v573, v892 : u32; - hir.assertz v575 #[code = 250]; - v576 = hir.int_to_ptr v573 : ptr; - hir.store v576, v557; - v578 = hir.bitcast v555 : u32; - v891 = arith.constant 4 : u32; - v580 = arith.mod v578, v891 : u32; - hir.assertz v580 #[code = 250]; - v581 = hir.int_to_ptr v578 : ptr; - hir.store v581, v890; + v579 = arith.constant 4 : u32; + v578 = hir.bitcast v562 : u32; + v580 = arith.add v578, v579 : u32 #[overflow = checked]; + v898 = arith.constant 4 : u32; + v582 = arith.mod v580, v898 : u32; + hir.assertz v582 #[code = 250]; + v583 = hir.int_to_ptr v580 : ptr; + hir.store v583, v564; + v585 = hir.bitcast v562 : u32; + v897 = arith.constant 4 : u32; + v587 = arith.mod v585, v897 : u32; + hir.assertz v587 #[code = 250]; + v588 = hir.int_to_ptr v585 : ptr; + hir.store v588, v896; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v582: i32, v583: i32, v584: i32, v585: i32) { - ^block71(v582: i32, v583: i32, v584: i32, v585: i32): - v920 = arith.constant 0 : i32; - v586 = arith.constant 0 : i32; - v590 = arith.eq v585, v586 : i1; - v591 = arith.zext v590 : u32; - v592 = hir.bitcast v591 : i32; - v594 = arith.neq v592, v920 : i1; - v907, v908 = scf.if v594 : i32, i32 { - ^block120: - v919 = arith.constant 0 : i32; - v588 = arith.constant 4 : i32; - scf.yield v588, v919; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v589: i32, v590: i32, v591: i32, v592: i32) { + ^block77(v589: i32, v590: i32, v591: i32, v592: i32): + v926 = arith.constant 0 : i32; + v593 = arith.constant 0 : i32; + v597 = arith.eq v592, v593 : i1; + v598 = arith.zext v597 : u32; + v599 = hir.bitcast v598 : i32; + v601 = arith.neq v599, v926 : i1; + v913, v914 = scf.if v601 : i32, i32 { + ^block126: + v925 = arith.constant 0 : i32; + v595 = arith.constant 4 : i32; + scf.yield v595, v925; } else { - ^block74: - v595 = hir.bitcast v583 : u32; - v630 = arith.constant 4 : u32; - v597 = arith.mod v595, v630 : u32; - hir.assertz v597 #[code = 250]; - v598 = hir.int_to_ptr v595 : ptr; - v599 = hir.load v598 : i32; - v917 = arith.constant 0 : i32; - v918 = arith.constant 0 : i32; - v601 = arith.eq v599, v918 : i1; - v602 = arith.zext v601 : u32; - v603 = hir.bitcast v602 : i32; - v605 = arith.neq v603, v917 : i1; - v905 = scf.if v605 : i32 { - ^block119: - v916 = arith.constant 0 : i32; - scf.yield v916; + ^block80: + v602 = hir.bitcast v590 : u32; + v637 = arith.constant 4 : u32; + v604 = arith.mod v602, v637 : u32; + hir.assertz v604 #[code = 250]; + v605 = hir.int_to_ptr v602 : ptr; + v606 = hir.load v605 : i32; + v923 = arith.constant 0 : i32; + v924 = arith.constant 0 : i32; + v608 = arith.eq v606, v924 : i1; + v609 = arith.zext v608 : u32; + v610 = hir.bitcast v609 : i32; + v612 = arith.neq v610, v923 : i1; + v911 = scf.if v612 : i32 { + ^block125: + v922 = arith.constant 0 : i32; + scf.yield v922; } else { - ^block75: - v915 = arith.constant 4 : u32; - v606 = hir.bitcast v582 : u32; - v608 = arith.add v606, v915 : u32 #[overflow = checked]; - v914 = arith.constant 4 : u32; - v610 = arith.mod v608, v914 : u32; - hir.assertz v610 #[code = 250]; - v611 = hir.int_to_ptr v608 : ptr; - hir.store v611, v584; - v913 = arith.constant 4 : u32; - v612 = hir.bitcast v583 : u32; - v614 = arith.add v612, v913 : u32 #[overflow = checked]; - v912 = arith.constant 4 : u32; - v616 = arith.mod v614, v912 : u32; - hir.assertz v616 #[code = 250]; - v617 = hir.int_to_ptr v614 : ptr; - v618 = hir.load v617 : i32; - v619 = hir.bitcast v582 : u32; - v911 = arith.constant 4 : u32; - v621 = arith.mod v619, v911 : u32; - hir.assertz v621 #[code = 250]; - v622 = hir.int_to_ptr v619 : ptr; - hir.store v622, v618; - v623 = arith.mul v599, v585 : i32 #[overflow = wrapping]; - scf.yield v623; + ^block81: + v921 = arith.constant 4 : u32; + v613 = hir.bitcast v589 : u32; + v615 = arith.add v613, v921 : u32 #[overflow = checked]; + v920 = arith.constant 4 : u32; + v617 = arith.mod v615, v920 : u32; + hir.assertz v617 #[code = 250]; + v618 = hir.int_to_ptr v615 : ptr; + hir.store v618, v591; + v919 = arith.constant 4 : u32; + v619 = hir.bitcast v590 : u32; + v621 = arith.add v619, v919 : u32 #[overflow = checked]; + v918 = arith.constant 4 : u32; + v623 = arith.mod v621, v918 : u32; + hir.assertz v623 #[code = 250]; + v624 = hir.int_to_ptr v621 : ptr; + v625 = hir.load v624 : i32; + v626 = hir.bitcast v589 : u32; + v917 = arith.constant 4 : u32; + v628 = arith.mod v626, v917 : u32; + hir.assertz v628 #[code = 250]; + v629 = hir.int_to_ptr v626 : ptr; + hir.store v629, v625; + v630 = arith.mul v606, v592 : i32 #[overflow = wrapping]; + scf.yield v630; }; - v624 = arith.constant 8 : i32; - v910 = arith.constant 4 : i32; - v906 = cf.select v605, v910, v624 : i32; - scf.yield v906, v905; + v631 = arith.constant 8 : i32; + v916 = arith.constant 4 : i32; + v912 = cf.select v612, v916, v631 : i32; + scf.yield v912, v911; }; - v627 = arith.add v582, v907 : i32 #[overflow = wrapping]; - v629 = hir.bitcast v627 : u32; - v909 = arith.constant 4 : u32; - v631 = arith.mod v629, v909 : u32; - hir.assertz v631 #[code = 250]; - v632 = hir.int_to_ptr v629 : ptr; - hir.store v632, v908; + v634 = arith.add v589, v913 : i32 #[overflow = wrapping]; + v636 = hir.bitcast v634 : u32; + v915 = arith.constant 4 : u32; + v638 = arith.mod v636, v915 : u32; + hir.assertz v638 #[code = 250]; + v639 = hir.int_to_ptr v636 : ptr; + hir.store v639, v914; builtin.ret ; }; - private builtin.function @::deallocate(v633: i32, v634: i32, v635: i32) { - ^block76(v633: i32, v634: i32, v635: i32): - v922 = arith.constant 0 : i32; - v636 = arith.constant 0 : i32; - v637 = arith.eq v635, v636 : i1; - v638 = arith.zext v637 : u32; - v639 = hir.bitcast v638 : i32; - v641 = arith.neq v639, v922 : i1; - scf.if v641{ - ^block78: + private builtin.function @::deallocate(v640: i32, v641: i32, v642: i32) { + ^block82(v640: i32, v641: i32, v642: i32): + v928 = arith.constant 0 : i32; + v643 = arith.constant 0 : i32; + v644 = arith.eq v642, v643 : i1; + v645 = arith.zext v644 : u32; + v646 = hir.bitcast v645 : i32; + v648 = arith.neq v646, v928 : i1; + scf.if v648{ + ^block84: scf.yield ; } else { - ^block79: - hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v633, v635, v634) + ^block85: + hir.exec @root_ns:root@1.0.0/abi_transform_tx_kernel_get_inputs_4/__rustc::__rust_dealloc(v640, v642, v641) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v642: i32, v643: i32, v644: i32) { - ^block80(v642: i32, v643: i32, v644: i32): + private builtin.function @alloc::raw_vec::handle_error(v649: i32, v650: i32, v651: i32) { + ^block86(v649: i32, v650: i32, v651: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v645: i32, v646: i32) -> i32 { - ^block82(v645: i32, v646: i32): - v653 = arith.constant 0 : i32; - v649 = hir.bitcast v646 : u32; - v648 = hir.bitcast v645 : u32; - v650 = arith.gt v648, v649 : i1; - v651 = arith.zext v650 : u32; - v652 = hir.bitcast v651 : i32; - v654 = arith.neq v652, v653 : i1; - v655 = cf.select v654, v645, v646 : i32; - builtin.ret v655; + private builtin.function @core::ptr::alignment::Alignment::max(v652: i32, v653: i32) -> i32 { + ^block88(v652: i32, v653: i32): + v660 = arith.constant 0 : i32; + v656 = hir.bitcast v653 : u32; + v655 = hir.bitcast v652 : u32; + v657 = arith.gt v655, v656 : i1; + v658 = arith.zext v657 : u32; + v659 = hir.bitcast v658 : i32; + v661 = arith.neq v659, v660 : i1; + v662 = cf.select v661, v652, v653 : i32; + builtin.ret v662; }; builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x000000000000002100000013000000290010000000000073722e65746f6e2f73676e69646e69622f6372732f312e342e302d7379732d657361622d6e6564696d; + builtin.segment readonly @1048576 = 0x000000000000002100000012000000290010000000000073722e65746f6e2f73676e69646e69622f6372732f302e352e302d7379732d657361622d6e6564696d; }; }; \ No newline at end of file diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm index 468396666..9e5b66d7c 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.masm @@ -5,10 +5,10 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.2094373581628026397 - push.18422714770906872060 - push.5858770915156314281 - push.5001255115237129131 + push.14670314238157692340 + push.550734728644709840 + push.11682311677181816446 + push.13981293513766033527 adv.push_mapval push.262144 push.4 @@ -23,16 +23,6 @@ end # mod root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4 -proc.miden_base_sys::bindings::note::extern_note_get_inputs - trace.240 - nop - exec.::miden::note::get_inputs - trace.252 - nop - swap.1 - drop -end - export.entrypoint push.1114176 u32divmod.4 @@ -87,7 +77,17 @@ export.entrypoint trace.252 nop push.4 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.0 dup.2 @@ -131,7 +131,17 @@ export.entrypoint trace.252 nop push.4294967295 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.1 dup.3 @@ -162,7 +172,17 @@ export.entrypoint trace.252 nop push.1 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.2 dup.3 @@ -193,7 +213,17 @@ export.entrypoint trace.252 nop push.2 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.3 movup.3 @@ -224,7 +254,17 @@ export.entrypoint trace.252 nop push.3 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::felt::assert_eq + trace.252 + nop push.4 push.4 dup.3 @@ -443,7 +483,7 @@ proc.::alloc else trace.240 nop - exec.::intrinsics::mem::heap_base + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::intrinsics::mem::heap_base trace.252 nop trace.240 @@ -546,6 +586,14 @@ proc.::alloc end end +proc.intrinsics::mem::heap_base + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + proc.alloc::raw_vec::RawVecInner::with_capacity_in push.1114176 u32divmod.4 @@ -791,7 +839,7 @@ proc.miden_base_sys::bindings::note::get_inputs u32shr trace.240 nop - exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden_base_sys::bindings::note::extern_note_get_inputs + exec.::root_ns:root@1.0.0::abi_transform_tx_kernel_get_inputs_4::miden::note::get_inputs trace.252 nop push.8 @@ -854,10 +902,28 @@ proc.miden_base_sys::bindings::note::get_inputs nop end +proc.miden::note::get_inputs + trace.240 + nop + exec.::miden::note::get_inputs + trace.252 + nop + swap.1 + drop +end + proc.>::from nop end +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + proc.alloc::raw_vec::RawVecInner::deallocate push.1114176 u32divmod.4 diff --git a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat index 5d7ec8de8..fb7891873 100644 --- a/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat +++ b/tests/integration/expected/abi_transform_tx_kernel_get_inputs_4.wat @@ -1,25 +1,21 @@ (module $abi_transform_tx_kernel_get_inputs_4.wasm - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32))) - (type (;2;) (func (result i32))) - (type (;3;) (func (param i32) (result i32))) - (type (;4;) (func)) - (type (;5;) (func (param i32 i32) (result i32))) - (type (;6;) (func (param i32 i32 i32))) - (type (;7;) (func (param i32 i32 i32) (result i32))) - (type (;8;) (func (param i32 i32 i32 i32))) - (type (;9;) (func (param i32))) + (type (;0;) (func)) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func (param i32 i32 i32) (result i32))) + (type (;4;) (func (result i32))) + (type (;5;) (func (param i32 i32 i32 i32))) + (type (;6;) (func (param i32))) + (type (;7;) (func (param i32) (result i32))) + (type (;8;) (func (param i32) (result f32))) + (type (;9;) (func (param f32 f32))) (type (;10;) (func (param i32 i32 i32 i32 i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" "heap-base" (func $miden_sdk_alloc::heap_base (;2;) (type 2))) - (import "miden:core-base/note@1.0.0" "get-inputs" (func $miden_base_sys::bindings::note::extern_note_get_inputs (;3;) (type 3))) (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 $entrypoint (;4;) (type 4) + (func $entrypoint (;0;) (type 0) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -35,8 +31,8 @@ local.tee 1 call $>::from i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq block ;; label = @1 local.get 1 i32.eqz @@ -46,8 +42,8 @@ local.tee 2 f32.load i32.const -1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 1 i32.const 1 i32.eq @@ -55,8 +51,8 @@ local.get 2 f32.load offset=4 i32.const 1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 1 i32.const 2 i32.le_u @@ -64,8 +60,8 @@ local.get 2 f32.load offset=8 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 1 i32.const 3 i32.eq @@ -73,8 +69,8 @@ local.get 2 f32.load offset=12 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 0 i32.const 4 i32.add @@ -89,14 +85,14 @@ end unreachable ) - (func $__rustc::__rust_alloc (;5;) (type 5) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) i32.const 1048636 local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_dealloc (;6;) (type 6) (param i32 i32 i32)) - (func $__rustc::__rust_alloc_zeroed (;7;) (type 5) (param i32 i32) (result i32) + (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;3;) (type 1) (param i32 i32) (result i32) block ;; label = @1 i32.const 1048636 local.get 1 @@ -115,10 +111,10 @@ end local.get 1 ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;8;) (type 4) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;4;) (type 0) return ) - (func $::alloc (;9;) (type 7) (param i32 i32 i32) (result i32) + (func $::alloc (;5;) (type 3) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -159,7 +155,7 @@ i32.load br_if 0 (;@2;) local.get 0 - call $miden_sdk_alloc::heap_base + call $intrinsics::mem::heap_base memory.size i32.const 16 i32.shl @@ -190,7 +186,10 @@ end unreachable ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;10;) (type 8) (param i32 i32 i32 i32) + (func $intrinsics::mem::heap_base (;6;) (type 4) (result i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;7;) (type 5) (param i32 i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -233,7 +232,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_inputs (;11;) (type 9) (param i32) + (func $miden_base_sys::bindings::note::get_inputs (;8;) (type 6) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -256,7 +255,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden_base_sys::bindings::note::extern_note_get_inputs + call $miden::note::get_inputs i32.store offset=8 local.get 0 local.get 3 @@ -269,11 +268,20 @@ i32.add global.set $__stack_pointer ) - (func $>::from (;12;) (type 0) (param i32) (result f32) + (func $miden::note::get_inputs (;9;) (type 7) (param i32) (result i32) + unreachable + ) + (func $>::from (;10;) (type 8) (param i32) (result f32) local.get 0 f32.reinterpret_i32 ) - (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 6) (param i32 i32 i32) + (func $intrinsics::felt::from_u32 (;11;) (type 8) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;12;) (type 9) (param f32 f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -417,7 +425,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;15;) (type 6) (param i32 i32 i32) + (func $::allocate (;15;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -446,7 +454,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;16;) (type 8) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;16;) (type 5) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -473,7 +481,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;17;) (type 8) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;17;) (type 5) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -508,7 +516,7 @@ local.get 4 i32.store ) - (func $::deallocate (;18;) (type 6) (param i32 i32 i32) + (func $::deallocate (;18;) (type 2) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -519,10 +527,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;19;) (type 6) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;19;) (type 2) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;20;) (type 5) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;20;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -530,5 +538,5 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.4.1/src/bindings/note.rs\00\00\00\00\00\10\00)\00\00\00\13\00\00\00!\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.5.0/src/bindings/note.rs\00\00\00\00\00\10\00)\00\00\00\12\00\00\00!\00\00\00") ) diff --git a/tests/integration/expected/add_felt.hir b/tests/integration/expected/add_felt.hir index 57e9cc903..ffadf0fba 100644 --- a/tests/integration/expected/add_felt.hir +++ b/tests/integration/expected/add_felt.hir @@ -2,10 +2,16 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @add_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = arith.add v0, v1 : felt #[overflow = unchecked]; + v3 = hir.exec @root_ns:root@1.0.0/add_felt/intrinsics::felt::add(v0, v1) : felt builtin.ret v3; }; + private builtin.function @intrinsics::felt::add(v4: felt, v5: felt) -> felt { + ^block6(v4: felt, v5: felt): + v6 = arith.add v4, v5 : felt #[overflow = unchecked]; + builtin.ret v6; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/add_felt.masm b/tests/integration/expected/add_felt.masm index 43354fa8b..0886c55c3 100644 --- a/tests/integration/expected/add_felt.masm +++ b/tests/integration/expected/add_felt.masm @@ -13,6 +13,14 @@ end # mod root_ns:root@1.0.0::add_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::add_felt::intrinsics::felt::add + trace.252 + nop +end + +proc.intrinsics::felt::add add end diff --git a/tests/integration/expected/add_felt.wat b/tests/integration/expected/add_felt.wat index f9afa578e..b3692c867 100644 --- a/tests/integration/expected/add_felt.wat +++ b/tests/integration/expected/add_felt.wat @@ -1,14 +1,16 @@ (module $add_felt.wasm (type (;0;) (func (param f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "add" (func $miden_stdlib_sys::intrinsics::felt::extern_add (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result f32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::add + ) + (func $intrinsics::felt::add (;1;) (type 0) (param f32 f32) (result f32) + unreachable ) ) diff --git a/tests/integration/expected/adv_load_preimage.hir b/tests/integration/expected/adv_load_preimage.hir index 66abfedee..b339789e4 100644 --- a/tests/integration/expected/adv_load_preimage.hir +++ b/tests/integration/expected/adv_load_preimage.hir @@ -1,709 +1,750 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @adv_load_preimage { - private builtin.function @miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory(v0: felt, v1: i32, v2: felt, v3: felt, v4: felt, v5: felt) -> i32 { - ^block5(v0: felt, v1: i32, v2: felt, v3: felt, v4: felt, v5: felt): - v6 = hir.exec @std/mem/pipe_preimage_to_memory(v0, v1, v2, v3, v4, v5) : i32 - builtin.ret v6; - }; - - public builtin.function @entrypoint(v8: i32, v9: felt, v10: felt, v11: felt, v12: felt) { - ^block11(v8: i32, v9: felt, v10: felt, v11: felt, v12: felt): - v17 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v18 = hir.bitcast v17 : ptr; - v19 = hir.load v18 : i32; - v20 = arith.constant 16 : i32; - v21 = arith.sub v19, v20 : i32 #[overflow = wrapping]; - v22 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v23 = hir.bitcast v22 : ptr; - hir.store v23, v21; - v24 = hir.exec @intrinsics/advice/adv_push_mapvaln(v12, v11, v10, v9) : felt - v25 = hir.cast v24 : i64; - v501 = arith.constant 0 : felt; - v27 = arith.constant 3 : i32; - v26 = arith.trunc v25 : i32; - v28 = arith.band v26, v27 : i32; - v29 = hir.bitcast v28 : felt; - hir.assert_eq v29, v501; - v34 = arith.constant 2 : i64; - v36 = hir.cast v34 : u32; - v35 = hir.bitcast v25 : u64; - v37 = arith.shr v35, v36 : u64; - v38 = hir.bitcast v37 : i64; - v39 = hir.cast v38 : felt; - v500 = arith.constant 2 : u32; - v40 = hir.cast v39 : i64; - v41 = arith.trunc v40 : i32; - v44 = arith.shl v41, v500 : i32; - v541 = arith.constant 4 : i32; - v13 = arith.constant 0 : i32; - v32 = arith.constant 4 : i32; - v33 = arith.add v21, v32 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::RawVecInner::try_allocate_in(v33, v44, v13, v541, v541) - v49 = arith.constant 8 : u32; - v48 = hir.bitcast v21 : u32; - v50 = arith.add v48, v49 : u32 #[overflow = checked]; - v51 = arith.constant 4 : u32; - v52 = arith.mod v50, v51 : u32; - hir.assertz v52 #[code = 250]; - v53 = hir.int_to_ptr v50 : ptr; - v54 = hir.load v53 : i32; - v540 = arith.constant 4 : u32; - v55 = hir.bitcast v21 : u32; - v57 = arith.add v55, v540 : u32 #[overflow = checked]; - v539 = arith.constant 4 : u32; - v59 = arith.mod v57, v539 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v538 = arith.constant 0 : i32; - v62 = arith.constant 1 : i32; - v63 = arith.eq v61, v62 : i1; - v64 = arith.zext v63 : u32; - v65 = hir.bitcast v64 : i32; - v67 = arith.neq v65, v538 : i1; - v506 = scf.if v67 : u32 { - ^block14: - v158 = arith.constant 12 : u32; - v157 = hir.bitcast v21 : u32; - v159 = arith.add v157, v158 : u32 #[overflow = checked]; - v537 = arith.constant 4 : u32; - v161 = arith.mod v159, v537 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : i32; - v164 = arith.constant 1048620 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v54, v163, v164) - v502 = arith.constant 0 : u32; - scf.yield v502; + public builtin.function @entrypoint(v0: i32, v1: felt, v2: felt, v3: felt, v4: felt) { + ^block4(v0: i32, v1: felt, v2: felt, v3: felt, v4: felt): + v9 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + v11 = hir.load v10 : i32; + v12 = arith.constant 16 : i32; + v13 = arith.sub v11, v12 : i32 #[overflow = wrapping]; + v14 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v15 = hir.bitcast v14 : ptr; + hir.store v15, v13; + v16 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::advice::adv_push_mapvaln(v4, v3, v2, v1) : felt + v17 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::as_u64(v16) : i64 + v19 = arith.constant 3 : i32; + v18 = arith.trunc v17 : i32; + v20 = arith.band v18, v19 : i32; + v21 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v20) : felt + v5 = arith.constant 0 : i32; + v23 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v5) : felt + hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v21, v23) + v26 = arith.constant 2 : i64; + v28 = hir.cast v26 : u32; + v27 = hir.bitcast v17 : u64; + v29 = arith.shr v27, v28 : u64; + v30 = hir.bitcast v29 : i64; + v31 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u64_unchecked(v30) : felt + v32 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::as_u64(v31) : i64 + v515 = arith.constant 2 : u32; + v33 = arith.trunc v32 : i32; + v36 = arith.shl v33, v515 : i32; + v556 = arith.constant 4 : i32; + v557 = arith.constant 0 : i32; + v24 = arith.constant 4 : i32; + v25 = arith.add v13, v24 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::RawVecInner::try_allocate_in(v25, v36, v557, v556, v556) + v41 = arith.constant 8 : u32; + v40 = hir.bitcast v13 : u32; + v42 = arith.add v40, v41 : u32 #[overflow = checked]; + v43 = arith.constant 4 : u32; + v44 = arith.mod v42, v43 : u32; + hir.assertz v44 #[code = 250]; + v45 = hir.int_to_ptr v42 : ptr; + v46 = hir.load v45 : i32; + v555 = arith.constant 4 : u32; + v47 = hir.bitcast v13 : u32; + v49 = arith.add v47, v555 : u32 #[overflow = checked]; + v554 = arith.constant 4 : u32; + v51 = arith.mod v49, v554 : u32; + hir.assertz v51 #[code = 250]; + v52 = hir.int_to_ptr v49 : ptr; + v53 = hir.load v52 : i32; + v553 = arith.constant 0 : i32; + v54 = arith.constant 1 : i32; + v55 = arith.eq v53, v54 : i1; + v56 = arith.zext v55 : u32; + v57 = hir.bitcast v56 : i32; + v59 = arith.neq v57, v553 : i1; + v520 = scf.if v59 : u32 { + ^block7: + v150 = arith.constant 12 : u32; + v149 = hir.bitcast v13 : u32; + v151 = arith.add v149, v150 : u32 #[overflow = checked]; + v552 = arith.constant 4 : u32; + v153 = arith.mod v151, v552 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + v155 = hir.load v154 : i32; + v156 = arith.constant 1048620 : i32; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::raw_vec::handle_error(v46, v155, v156) + v516 = arith.constant 0 : u32; + scf.yield v516; } else { - ^block15: - v536 = arith.constant 12 : u32; - v68 = hir.bitcast v21 : u32; - v70 = arith.add v68, v536 : u32 #[overflow = checked]; - v535 = arith.constant 4 : u32; - v72 = arith.mod v70, v535 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i32; - v534 = arith.constant 2 : u32; - v76 = hir.bitcast v74 : u32; - v78 = arith.shr v76, v534 : u32; - v79 = hir.bitcast v78 : i32; - v80 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory(v39, v79, v12, v11, v10, v9) : i32 - v533 = arith.constant 8 : u32; - v81 = hir.bitcast v8 : u32; - v83 = arith.add v81, v533 : u32 #[overflow = checked]; - v532 = arith.constant 4 : u32; - v85 = arith.mod v83, v532 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - hir.store v86, v44; - v531 = arith.constant 4 : u32; - v87 = hir.bitcast v8 : u32; - v89 = arith.add v87, v531 : u32 #[overflow = checked]; - v530 = arith.constant 4 : u32; - v91 = arith.mod v89, v530 : u32; - hir.assertz v91 #[code = 250]; - v92 = hir.int_to_ptr v89 : ptr; - hir.store v92, v74; - v93 = hir.bitcast v8 : u32; - v529 = arith.constant 4 : u32; - v95 = arith.mod v93, v529 : u32; - hir.assertz v95 #[code = 250]; - v96 = hir.int_to_ptr v93 : ptr; - hir.store v96, v54; - v527 = arith.constant 0 : i32; - v528 = arith.constant 0 : i32; - v98 = arith.eq v44, v528 : i1; - v99 = arith.zext v98 : u32; - v100 = hir.bitcast v99 : i32; - v102 = arith.neq v100, v527 : i1; - v508 = scf.if v102 : u32 { - ^block65: - v526 = arith.constant 0 : u32; - scf.yield v526; + ^block8: + v551 = arith.constant 12 : u32; + v60 = hir.bitcast v13 : u32; + v62 = arith.add v60, v551 : u32 #[overflow = checked]; + v550 = arith.constant 4 : u32; + v64 = arith.mod v62, v550 : u32; + hir.assertz v64 #[code = 250]; + v65 = hir.int_to_ptr v62 : ptr; + v66 = hir.load v65 : i32; + v549 = arith.constant 2 : u32; + v68 = hir.bitcast v66 : u32; + v70 = arith.shr v68, v549 : u32; + v71 = hir.bitcast v70 : i32; + v72 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/std::mem::pipe_preimage_to_memory(v31, v71, v4, v3, v2, v1) : i32 + v548 = arith.constant 8 : u32; + v73 = hir.bitcast v0 : u32; + v75 = arith.add v73, v548 : u32 #[overflow = checked]; + v547 = arith.constant 4 : u32; + v77 = arith.mod v75, v547 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + hir.store v78, v36; + v546 = arith.constant 4 : u32; + v79 = hir.bitcast v0 : u32; + v81 = arith.add v79, v546 : u32 #[overflow = checked]; + v545 = arith.constant 4 : u32; + v83 = arith.mod v81, v545 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + hir.store v84, v66; + v85 = hir.bitcast v0 : u32; + v544 = arith.constant 4 : u32; + v87 = arith.mod v85, v544 : u32; + hir.assertz v87 #[code = 250]; + v88 = hir.int_to_ptr v85 : ptr; + hir.store v88, v46; + v542 = arith.constant 0 : i32; + v543 = arith.constant 0 : i32; + v90 = arith.eq v36, v543 : i1; + v91 = arith.zext v90 : u32; + v92 = hir.bitcast v91 : i32; + v94 = arith.neq v92, v542 : i1; + v522 = scf.if v94 : u32 { + ^block77: + v541 = arith.constant 0 : u32; + scf.yield v541; } else { - ^block16: - v103 = hir.bitcast v74 : u32; - v525 = arith.constant 4 : u32; - v105 = arith.mod v103, v525 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v498 = arith.constant 1 : felt; - hir.assert_eq v107, v498; - v524 = arith.constant 4 : u32; - v110 = hir.bitcast v74 : u32; - v112 = arith.add v110, v524 : u32 #[overflow = checked]; - v523 = arith.constant 4 : u32; - v114 = arith.mod v112, v523 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : felt; - v497 = arith.constant 2 : felt; - hir.assert_eq v116, v497; - v522 = arith.constant 0 : i32; - v496 = arith.constant 5 : u32; - v120 = hir.bitcast v44 : u32; - v122 = arith.lte v120, v496 : i1; - v123 = arith.zext v122 : u32; - v124 = hir.bitcast v123 : i32; - v126 = arith.neq v124, v522 : i1; - v510 = scf.if v126 : u32 { - ^block64: - v521 = arith.constant 0 : u32; - scf.yield v521; + ^block9: + v95 = hir.bitcast v66 : u32; + v540 = arith.constant 4 : u32; + v97 = arith.mod v95, v540 : u32; + hir.assertz v97 #[code = 250]; + v98 = hir.int_to_ptr v95 : ptr; + v99 = hir.load v98 : felt; + v539 = arith.constant 1 : i32; + v101 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v539) : felt + hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v99, v101) + v538 = arith.constant 4 : u32; + v102 = hir.bitcast v66 : u32; + v104 = arith.add v102, v538 : u32 #[overflow = checked]; + v537 = arith.constant 4 : u32; + v106 = arith.mod v104, v537 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : felt; + v34 = arith.constant 2 : i32; + v110 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v34) : felt + hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v108, v110) + v536 = arith.constant 0 : i32; + v513 = arith.constant 5 : u32; + v112 = hir.bitcast v36 : u32; + v114 = arith.lte v112, v513 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v536 : i1; + v524 = scf.if v118 : u32 { + ^block76: + v535 = arith.constant 0 : u32; + scf.yield v535; } else { - ^block17: - v128 = arith.constant 20 : u32; - v127 = hir.bitcast v74 : u32; - v129 = arith.add v127, v128 : u32 #[overflow = checked]; - v520 = arith.constant 4 : u32; - v131 = arith.mod v129, v520 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : felt; - v495 = arith.constant 6 : felt; - hir.assert_eq v133, v495; - v519 = arith.constant 0 : i32; - v494 = arith.constant 14 : u32; - v137 = hir.bitcast v44 : u32; - v139 = arith.lte v137, v494 : i1; - v140 = arith.zext v139 : u32; - v141 = hir.bitcast v140 : i32; - v143 = arith.neq v141, v519 : i1; - scf.if v143{ - ^block63: + ^block10: + v120 = arith.constant 20 : u32; + v119 = hir.bitcast v66 : u32; + v121 = arith.add v119, v120 : u32 #[overflow = checked]; + v534 = arith.constant 4 : u32; + v123 = arith.mod v121, v534 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : felt; + v126 = arith.constant 6 : i32; + v127 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v126) : felt + hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v125, v127) + v533 = arith.constant 0 : i32; + v512 = arith.constant 14 : u32; + v129 = hir.bitcast v36 : u32; + v131 = arith.lte v129, v512 : i1; + v132 = arith.zext v131 : u32; + v133 = hir.bitcast v132 : i32; + v135 = arith.neq v133, v533 : i1; + scf.if v135{ + ^block75: scf.yield ; } else { - ^block18: - v145 = arith.constant 56 : u32; - v144 = hir.bitcast v74 : u32; - v146 = arith.add v144, v145 : u32 #[overflow = checked]; - v518 = arith.constant 4 : u32; - v148 = arith.mod v146, v518 : u32; - hir.assertz v148 #[code = 250]; - v149 = hir.int_to_ptr v146 : ptr; - v150 = hir.load v149 : felt; - v493 = arith.constant 15 : felt; - hir.assert_eq v150, v493; - v517 = arith.constant 16 : i32; - v154 = arith.add v21, v517 : i32 #[overflow = wrapping]; - v155 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v156 = hir.bitcast v155 : ptr; - hir.store v156, v154; + ^block11: + v137 = arith.constant 56 : u32; + v136 = hir.bitcast v66 : u32; + v138 = arith.add v136, v137 : u32 #[overflow = checked]; + v532 = arith.constant 4 : u32; + v140 = arith.mod v138, v532 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + v142 = hir.load v141 : felt; + v143 = arith.constant 15 : i32; + v144 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::from_u32(v143) : felt + hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::felt::assert_eq(v142, v144) + v531 = arith.constant 16 : i32; + v146 = arith.add v13, v531 : i32 #[overflow = wrapping]; + v147 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v148 = hir.bitcast v147 : ptr; + hir.store v148, v146; scf.yield ; }; - v504 = arith.constant 1 : u32; - v516 = arith.constant 0 : u32; - v514 = cf.select v143, v516, v504 : u32; - scf.yield v514; + v518 = arith.constant 1 : u32; + v530 = arith.constant 0 : u32; + v528 = cf.select v135, v530, v518 : u32; + scf.yield v528; }; - scf.yield v510; + scf.yield v524; }; - scf.yield v508; + scf.yield v522; }; - v515 = arith.constant 0 : u32; - v513 = arith.eq v506, v515 : i1; - cf.cond_br v513 ^block13, ^block67; - ^block13: + v529 = arith.constant 0 : u32; + v527 = arith.eq v520, v529 : i1; + cf.cond_br v527 ^block6, ^block79; + ^block6: ub.unreachable ; - ^block67: + ^block79: builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc(v165: i32, v166: i32) -> i32 { - ^block19(v165: i32, v166: i32): - v168 = arith.constant 1048636 : i32; - v169 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v168, v166, v165) : i32 - builtin.ret v169; + private builtin.function @__rustc::__rust_alloc(v157: i32, v158: i32) -> i32 { + ^block12(v157: i32, v158: i32): + v160 = arith.constant 1048636 : i32; + v161 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v160, v158, v157) : i32 + builtin.ret v161; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v170: i32, v171: i32) -> i32 { - ^block21(v170: i32, v171: i32): - v173 = arith.constant 1048636 : i32; - v174 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v173, v171, v170) : i32 - v550 = arith.constant 0 : i32; - v175 = arith.constant 0 : i32; - v176 = arith.eq v174, v175 : i1; - v177 = arith.zext v176 : u32; - v178 = hir.bitcast v177 : i32; - v180 = arith.neq v178, v550 : i1; - scf.if v180{ - ^block23: + private builtin.function @__rustc::__rust_alloc_zeroed(v162: i32, v163: i32) -> i32 { + ^block14(v162: i32, v163: i32): + v165 = arith.constant 1048636 : i32; + v166 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/::alloc(v165, v163, v162) : i32 + v566 = arith.constant 0 : i32; + v167 = arith.constant 0 : i32; + v168 = arith.eq v166, v167 : i1; + v169 = arith.zext v168 : u32; + v170 = hir.bitcast v169 : i32; + v172 = arith.neq v170, v566 : i1; + scf.if v172{ + ^block16: scf.yield ; } else { - ^block24: - v548 = arith.constant 0 : i32; - v549 = arith.constant 0 : i32; - v182 = arith.eq v170, v549 : i1; - v183 = arith.zext v182 : u32; - v184 = hir.bitcast v183 : i32; - v186 = arith.neq v184, v548 : i1; - scf.if v186{ - ^block72: + ^block17: + v564 = arith.constant 0 : i32; + v565 = arith.constant 0 : i32; + v174 = arith.eq v162, v565 : i1; + v175 = arith.zext v174 : u32; + v176 = hir.bitcast v175 : i32; + v178 = arith.neq v176, v564 : i1; + scf.if v178{ + ^block84: scf.yield ; } else { - ^block25: - v542 = arith.constant 0 : u8; - v189 = hir.bitcast v170 : u32; - v190 = hir.bitcast v174 : u32; - v191 = hir.int_to_ptr v190 : ptr; - hir.mem_set v191, v189, v542; + ^block18: + v558 = arith.constant 0 : u8; + v181 = hir.bitcast v162 : u32; + v182 = hir.bitcast v166 : u32; + v183 = hir.int_to_ptr v182 : ptr; + hir.mem_set v183, v181, v558; scf.yield ; }; scf.yield ; }; - builtin.ret v174; + builtin.ret v166; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block26: + ^block19: builtin.ret ; }; - private builtin.function @::alloc(v193: i32, v194: i32, v195: i32) -> i32 { - ^block28(v193: i32, v194: i32, v195: i32): - v198 = arith.constant 16 : i32; - v197 = arith.constant 0 : i32; - v552 = arith.constant 16 : u32; - v200 = hir.bitcast v194 : u32; - v202 = arith.gt v200, v552 : i1; - v203 = arith.zext v202 : u32; - v204 = hir.bitcast v203 : i32; - v206 = arith.neq v204, v197 : i1; - v207 = cf.select v206, v194, v198 : i32; - v592 = arith.constant 0 : i32; - v208 = arith.constant -1 : i32; - v209 = arith.add v207, v208 : i32 #[overflow = wrapping]; - v210 = arith.band v207, v209 : i32; - v212 = arith.neq v210, v592 : i1; - v561, v562 = scf.if v212 : i32, u32 { - ^block77: - v553 = arith.constant 0 : u32; - v557 = ub.poison i32 : i32; - scf.yield v557, v553; + private builtin.function @::alloc(v185: i32, v186: i32, v187: i32) -> i32 { + ^block21(v185: i32, v186: i32, v187: i32): + v190 = arith.constant 16 : i32; + v189 = arith.constant 0 : i32; + v568 = arith.constant 16 : u32; + v192 = hir.bitcast v186 : u32; + v194 = arith.gt v192, v568 : i1; + v195 = arith.zext v194 : u32; + v196 = hir.bitcast v195 : i32; + v198 = arith.neq v196, v189 : i1; + v199 = cf.select v198, v186, v190 : i32; + v608 = arith.constant 0 : i32; + v200 = arith.constant -1 : i32; + v201 = arith.add v199, v200 : i32 #[overflow = wrapping]; + v202 = arith.band v199, v201 : i32; + v204 = arith.neq v202, v608 : i1; + v577, v578 = scf.if v204 : i32, u32 { + ^block89: + v569 = arith.constant 0 : u32; + v573 = ub.poison i32 : i32; + scf.yield v573, v569; } else { - ^block31: - v214 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/core::ptr::alignment::Alignment::max(v194, v207) : i32 - v591 = arith.constant 0 : i32; - v213 = arith.constant -2147483648 : i32; - v215 = arith.sub v213, v214 : i32 #[overflow = wrapping]; - v217 = hir.bitcast v215 : u32; - v216 = hir.bitcast v195 : u32; - v218 = arith.gt v216, v217 : i1; - v219 = arith.zext v218 : u32; - v220 = hir.bitcast v219 : i32; - v222 = arith.neq v220, v591 : i1; - v576 = scf.if v222 : i32 { - ^block76: - v590 = ub.poison i32 : i32; - scf.yield v590; + ^block24: + v206 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/core::ptr::alignment::Alignment::max(v186, v199) : i32 + v607 = arith.constant 0 : i32; + v205 = arith.constant -2147483648 : i32; + v207 = arith.sub v205, v206 : i32 #[overflow = wrapping]; + v209 = hir.bitcast v207 : u32; + v208 = hir.bitcast v187 : u32; + v210 = arith.gt v208, v209 : i1; + v211 = arith.zext v210 : u32; + v212 = hir.bitcast v211 : i32; + v214 = arith.neq v212, v607 : i1; + v592 = scf.if v214 : i32 { + ^block88: + v606 = ub.poison i32 : i32; + scf.yield v606; } else { - ^block32: - v588 = arith.constant 0 : i32; - v228 = arith.sub v588, v214 : i32 #[overflow = wrapping]; - v589 = arith.constant -1 : i32; - v224 = arith.add v195, v214 : i32 #[overflow = wrapping]; - v226 = arith.add v224, v589 : i32 #[overflow = wrapping]; - v229 = arith.band v226, v228 : i32; - v230 = hir.bitcast v193 : u32; - v231 = arith.constant 4 : u32; - v232 = arith.mod v230, v231 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - v234 = hir.load v233 : i32; - v587 = arith.constant 0 : i32; - v236 = arith.neq v234, v587 : i1; - scf.if v236{ - ^block75: + ^block25: + v604 = arith.constant 0 : i32; + v220 = arith.sub v604, v206 : i32 #[overflow = wrapping]; + v605 = arith.constant -1 : i32; + v216 = arith.add v187, v206 : i32 #[overflow = wrapping]; + v218 = arith.add v216, v605 : i32 #[overflow = wrapping]; + v221 = arith.band v218, v220 : i32; + v222 = hir.bitcast v185 : u32; + v223 = arith.constant 4 : u32; + v224 = arith.mod v222, v223 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : i32; + v603 = arith.constant 0 : i32; + v228 = arith.neq v226, v603 : i1; + scf.if v228{ + ^block87: scf.yield ; } else { - ^block34: - v237 = hir.exec @intrinsics/mem/heap_base() : i32 - v238 = hir.mem_size : u32; - v244 = hir.bitcast v193 : u32; - v586 = arith.constant 4 : u32; - v246 = arith.mod v244, v586 : u32; - hir.assertz v246 #[code = 250]; - v585 = arith.constant 16 : u32; - v239 = hir.bitcast v238 : i32; - v242 = arith.shl v239, v585 : i32; - v243 = arith.add v237, v242 : i32 #[overflow = wrapping]; - v247 = hir.int_to_ptr v244 : ptr; - hir.store v247, v243; + ^block27: + v229 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/intrinsics::mem::heap_base() : i32 + v230 = hir.mem_size : u32; + v236 = hir.bitcast v185 : u32; + v602 = arith.constant 4 : u32; + v238 = arith.mod v236, v602 : u32; + hir.assertz v238 #[code = 250]; + v601 = arith.constant 16 : u32; + v231 = hir.bitcast v230 : i32; + v234 = arith.shl v231, v601 : i32; + v235 = arith.add v229, v234 : i32 #[overflow = wrapping]; + v239 = hir.int_to_ptr v236 : ptr; + hir.store v239, v235; scf.yield ; }; - v250 = hir.bitcast v193 : u32; - v584 = arith.constant 4 : u32; - v252 = arith.mod v250, v584 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i32; - v582 = arith.constant 0 : i32; - v583 = arith.constant -1 : i32; - v256 = arith.bxor v254, v583 : i32; - v258 = hir.bitcast v256 : u32; - v257 = hir.bitcast v229 : u32; - v259 = arith.gt v257, v258 : i1; - v260 = arith.zext v259 : u32; - v261 = hir.bitcast v260 : i32; - v263 = arith.neq v261, v582 : i1; - v575 = scf.if v263 : i32 { - ^block35: - v581 = arith.constant 0 : i32; - scf.yield v581; + v242 = hir.bitcast v185 : u32; + v600 = arith.constant 4 : u32; + v244 = arith.mod v242, v600 : u32; + hir.assertz v244 #[code = 250]; + v245 = hir.int_to_ptr v242 : ptr; + v246 = hir.load v245 : i32; + v598 = arith.constant 0 : i32; + v599 = arith.constant -1 : i32; + v248 = arith.bxor v246, v599 : i32; + v250 = hir.bitcast v248 : u32; + v249 = hir.bitcast v221 : u32; + v251 = arith.gt v249, v250 : i1; + v252 = arith.zext v251 : u32; + v253 = hir.bitcast v252 : i32; + v255 = arith.neq v253, v598 : i1; + v591 = scf.if v255 : i32 { + ^block28: + v597 = arith.constant 0 : i32; + scf.yield v597; } else { - ^block36: - v265 = hir.bitcast v193 : u32; - v580 = arith.constant 4 : u32; - v267 = arith.mod v265, v580 : u32; - hir.assertz v267 #[code = 250]; - v264 = arith.add v254, v229 : i32 #[overflow = wrapping]; - v268 = hir.int_to_ptr v265 : ptr; - hir.store v268, v264; - v270 = arith.add v254, v214 : i32 #[overflow = wrapping]; - scf.yield v270; + ^block29: + v257 = hir.bitcast v185 : u32; + v596 = arith.constant 4 : u32; + v259 = arith.mod v257, v596 : u32; + hir.assertz v259 #[code = 250]; + v256 = arith.add v246, v221 : i32 #[overflow = wrapping]; + v260 = hir.int_to_ptr v257 : ptr; + hir.store v260, v256; + v262 = arith.add v246, v206 : i32 #[overflow = wrapping]; + scf.yield v262; }; - scf.yield v575; + scf.yield v591; }; - v558 = arith.constant 1 : u32; - v579 = arith.constant 0 : u32; - v577 = cf.select v222, v579, v558 : u32; - scf.yield v576, v577; + v574 = arith.constant 1 : u32; + v595 = arith.constant 0 : u32; + v593 = cf.select v214, v595, v574 : u32; + scf.yield v592, v593; }; - v578 = arith.constant 0 : u32; - v574 = arith.eq v562, v578 : i1; - cf.cond_br v574 ^block30, ^block79(v561); - ^block30: + v594 = arith.constant 0 : u32; + v590 = arith.eq v578, v594 : i1; + cf.cond_br v590 ^block23, ^block91(v577); + ^block23: ub.unreachable ; - ^block79(v554: i32): - builtin.ret v554; + ^block91(v570: i32): + builtin.ret v570; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block30: + v265 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v265; + }; + + private builtin.function @intrinsics::felt::from_u64_unchecked(v267: i64) -> felt { + ^block34(v267: i64): + v268 = hir.cast v267 : felt; + builtin.ret v268; + }; + + private builtin.function @intrinsics::felt::from_u32(v270: i32) -> felt { + ^block36(v270: i32): + v271 = hir.bitcast v270 : felt; + builtin.ret v271; + }; + + private builtin.function @intrinsics::felt::as_u64(v273: felt) -> i64 { + ^block38(v273: felt): + v274 = hir.cast v273 : i64; + builtin.ret v274; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v273: i32, v274: i32, v275: i32, v276: i32, v277: i32) { - ^block37(v273: i32, v274: i32, v275: i32, v276: i32, v277: i32): - v280 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v281 = hir.bitcast v280 : ptr; - v282 = hir.load v281 : i32; - v283 = arith.constant 16 : i32; - v284 = arith.sub v282, v283 : i32 #[overflow = wrapping]; - v285 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v286 = hir.bitcast v285 : ptr; - hir.store v286, v284; - v296 = hir.bitcast v274 : u32; - v297 = arith.zext v296 : u64; - v298 = hir.bitcast v297 : i64; - v278 = arith.constant 0 : i32; - v291 = arith.sub v278, v276 : i32 #[overflow = wrapping]; - v288 = arith.constant -1 : i32; - v287 = arith.add v276, v277 : i32 #[overflow = wrapping]; - v289 = arith.add v287, v288 : i32 #[overflow = wrapping]; - v292 = arith.band v289, v291 : i32; - v293 = hir.bitcast v292 : u32; - v294 = arith.zext v293 : u64; - v295 = hir.bitcast v294 : i64; - v299 = arith.mul v295, v298 : i64 #[overflow = wrapping]; - v696 = arith.constant 0 : i32; - v300 = arith.constant 32 : i64; - v302 = hir.cast v300 : u32; - v301 = hir.bitcast v299 : u64; - v303 = arith.shr v301, v302 : u64; - v304 = hir.bitcast v303 : i64; - v305 = arith.trunc v304 : i32; - v307 = arith.neq v305, v696 : i1; - v608, v609, v610, v611, v612, v613 = scf.if v307 : i32, i32, i32, i32, i32, u32 { - ^block83: - v593 = arith.constant 0 : u32; - v600 = ub.poison i32 : i32; - scf.yield v273, v284, v600, v600, v600, v593; + private builtin.function @intrinsics::felt::assert_eq(v276: felt, v277: felt) { + ^block40(v276: felt, v277: felt): + hir.assert_eq v276, v277; + builtin.ret ; + }; + + private builtin.function @intrinsics::advice::adv_push_mapvaln(v278: felt, v279: felt, v280: felt, v281: felt) -> felt { + ^block42(v278: felt, v279: felt, v280: felt, v281: felt): + v282 = hir.exec @intrinsics/advice/adv_push_mapvaln(v278, v279, v280, v281) : felt + builtin.ret v282; + }; + + private builtin.function @std::mem::pipe_preimage_to_memory(v284: felt, v285: i32, v286: felt, v287: felt, v288: felt, v289: felt) -> i32 { + ^block45(v284: felt, v285: i32, v286: felt, v287: felt, v288: felt, v289: felt): + v290 = hir.exec @std/mem/pipe_preimage_to_memory(v284, v285, v286, v287, v288, v289) : i32 + builtin.ret v290; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v292: i32, v293: i32, v294: i32, v295: i32, v296: i32) { + ^block49(v292: i32, v293: i32, v294: i32, v295: i32, v296: i32): + v299 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v300 = hir.bitcast v299 : ptr; + v301 = hir.load v300 : i32; + v302 = arith.constant 16 : i32; + v303 = arith.sub v301, v302 : i32 #[overflow = wrapping]; + v304 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v305 = hir.bitcast v304 : ptr; + hir.store v305, v303; + v315 = hir.bitcast v293 : u32; + v316 = arith.zext v315 : u64; + v317 = hir.bitcast v316 : i64; + v297 = arith.constant 0 : i32; + v310 = arith.sub v297, v295 : i32 #[overflow = wrapping]; + v307 = arith.constant -1 : i32; + v306 = arith.add v295, v296 : i32 #[overflow = wrapping]; + v308 = arith.add v306, v307 : i32 #[overflow = wrapping]; + v311 = arith.band v308, v310 : i32; + v312 = hir.bitcast v311 : u32; + v313 = arith.zext v312 : u64; + v314 = hir.bitcast v313 : i64; + v318 = arith.mul v314, v317 : i64 #[overflow = wrapping]; + v712 = arith.constant 0 : i32; + v319 = arith.constant 32 : i64; + v321 = hir.cast v319 : u32; + v320 = hir.bitcast v318 : u64; + v322 = arith.shr v320, v321 : u64; + v323 = hir.bitcast v322 : i64; + v324 = arith.trunc v323 : i32; + v326 = arith.neq v324, v712 : i1; + v624, v625, v626, v627, v628, v629 = scf.if v326 : i32, i32, i32, i32, i32, u32 { + ^block95: + v609 = arith.constant 0 : u32; + v616 = ub.poison i32 : i32; + scf.yield v292, v303, v616, v616, v616, v609; } else { - ^block42: - v308 = arith.trunc v299 : i32; - v695 = arith.constant 0 : i32; - v309 = arith.constant -2147483648 : i32; - v310 = arith.sub v309, v276 : i32 #[overflow = wrapping]; - v312 = hir.bitcast v310 : u32; - v311 = hir.bitcast v308 : u32; - v313 = arith.lte v311, v312 : i1; - v314 = arith.zext v313 : u32; - v315 = hir.bitcast v314 : i32; - v317 = arith.neq v315, v695 : i1; - v656 = scf.if v317 : i32 { - ^block40: - v694 = arith.constant 0 : i32; - v328 = arith.neq v308, v694 : i1; - v655 = scf.if v328 : i32 { - ^block44: - v693 = arith.constant 0 : i32; - v344 = arith.neq v275, v693 : i1; - v654 = scf.if v344 : i32 { - ^block47: - v326 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::alloc::Global::alloc_impl(v284, v276, v308, v326) - v355 = hir.bitcast v284 : u32; - v400 = arith.constant 4 : u32; - v357 = arith.mod v355, v400 : u32; - hir.assertz v357 #[code = 250]; - v358 = hir.int_to_ptr v355 : ptr; - v359 = hir.load v358 : i32; - scf.yield v359; + ^block54: + v327 = arith.trunc v318 : i32; + v711 = arith.constant 0 : i32; + v328 = arith.constant -2147483648 : i32; + v329 = arith.sub v328, v295 : i32 #[overflow = wrapping]; + v331 = hir.bitcast v329 : u32; + v330 = hir.bitcast v327 : u32; + v332 = arith.lte v330, v331 : i1; + v333 = arith.zext v332 : u32; + v334 = hir.bitcast v333 : i32; + v336 = arith.neq v334, v711 : i1; + v672 = scf.if v336 : i32 { + ^block52: + v710 = arith.constant 0 : i32; + v347 = arith.neq v327, v710 : i1; + v671 = scf.if v347 : i32 { + ^block56: + v709 = arith.constant 0 : i32; + v363 = arith.neq v294, v709 : i1; + v670 = scf.if v363 : i32 { + ^block59: + v345 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::alloc::Global::alloc_impl(v303, v295, v327, v345) + v374 = hir.bitcast v303 : u32; + v419 = arith.constant 4 : u32; + v376 = arith.mod v374, v419 : u32; + hir.assertz v376 #[code = 250]; + v377 = hir.int_to_ptr v374 : ptr; + v378 = hir.load v377 : i32; + scf.yield v378; } else { - ^block48: - v345 = arith.constant 8 : i32; - v346 = arith.add v284, v345 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v346, v276, v308) - v330 = arith.constant 8 : u32; - v347 = hir.bitcast v284 : u32; - v349 = arith.add v347, v330 : u32 #[overflow = checked]; - v692 = arith.constant 4 : u32; - v351 = arith.mod v349, v692 : u32; - hir.assertz v351 #[code = 250]; - v352 = hir.int_to_ptr v349 : ptr; - v353 = hir.load v352 : i32; - scf.yield v353; + ^block60: + v364 = arith.constant 8 : i32; + v365 = arith.add v303, v364 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/::allocate(v365, v295, v327) + v349 = arith.constant 8 : u32; + v366 = hir.bitcast v303 : u32; + v368 = arith.add v366, v349 : u32 #[overflow = checked]; + v708 = arith.constant 4 : u32; + v370 = arith.mod v368, v708 : u32; + hir.assertz v370 #[code = 250]; + v371 = hir.int_to_ptr v368 : ptr; + v372 = hir.load v371 : i32; + scf.yield v372; }; - v690 = arith.constant 0 : i32; - v691 = arith.constant 0 : i32; - v362 = arith.eq v654, v691 : i1; - v363 = arith.zext v362 : u32; - v364 = hir.bitcast v363 : i32; - v366 = arith.neq v364, v690 : i1; - scf.if v366{ - ^block49: - v689 = arith.constant 8 : u32; - v383 = hir.bitcast v273 : u32; - v385 = arith.add v383, v689 : u32 #[overflow = checked]; - v688 = arith.constant 4 : u32; - v387 = arith.mod v385, v688 : u32; - hir.assertz v387 #[code = 250]; - v388 = hir.int_to_ptr v385 : ptr; - hir.store v388, v308; - v687 = arith.constant 4 : u32; - v390 = hir.bitcast v273 : u32; - v392 = arith.add v390, v687 : u32 #[overflow = checked]; - v686 = arith.constant 4 : u32; - v394 = arith.mod v392, v686 : u32; - hir.assertz v394 #[code = 250]; - v395 = hir.int_to_ptr v392 : ptr; - hir.store v395, v276; + v706 = arith.constant 0 : i32; + v707 = arith.constant 0 : i32; + v381 = arith.eq v670, v707 : i1; + v382 = arith.zext v381 : u32; + v383 = hir.bitcast v382 : i32; + v385 = arith.neq v383, v706 : i1; + scf.if v385{ + ^block61: + v705 = arith.constant 8 : u32; + v402 = hir.bitcast v292 : u32; + v404 = arith.add v402, v705 : u32 #[overflow = checked]; + v704 = arith.constant 4 : u32; + v406 = arith.mod v404, v704 : u32; + hir.assertz v406 #[code = 250]; + v407 = hir.int_to_ptr v404 : ptr; + hir.store v407, v327; + v703 = arith.constant 4 : u32; + v409 = hir.bitcast v292 : u32; + v411 = arith.add v409, v703 : u32 #[overflow = checked]; + v702 = arith.constant 4 : u32; + v413 = arith.mod v411, v702 : u32; + hir.assertz v413 #[code = 250]; + v414 = hir.int_to_ptr v411 : ptr; + hir.store v414, v295; scf.yield ; } else { - ^block50: - v685 = arith.constant 8 : u32; - v368 = hir.bitcast v273 : u32; - v370 = arith.add v368, v685 : u32 #[overflow = checked]; - v684 = arith.constant 4 : u32; - v372 = arith.mod v370, v684 : u32; - hir.assertz v372 #[code = 250]; - v373 = hir.int_to_ptr v370 : ptr; - hir.store v373, v654; - v683 = arith.constant 4 : u32; - v375 = hir.bitcast v273 : u32; - v377 = arith.add v375, v683 : u32 #[overflow = checked]; - v682 = arith.constant 4 : u32; - v379 = arith.mod v377, v682 : u32; - hir.assertz v379 #[code = 250]; - v380 = hir.int_to_ptr v377 : ptr; - hir.store v380, v274; + ^block62: + v701 = arith.constant 8 : u32; + v387 = hir.bitcast v292 : u32; + v389 = arith.add v387, v701 : u32 #[overflow = checked]; + v700 = arith.constant 4 : u32; + v391 = arith.mod v389, v700 : u32; + hir.assertz v391 #[code = 250]; + v392 = hir.int_to_ptr v389 : ptr; + hir.store v392, v670; + v699 = arith.constant 4 : u32; + v394 = hir.bitcast v292 : u32; + v396 = arith.add v394, v699 : u32 #[overflow = checked]; + v698 = arith.constant 4 : u32; + v398 = arith.mod v396, v698 : u32; + hir.assertz v398 #[code = 250]; + v399 = hir.int_to_ptr v396 : ptr; + hir.store v399, v293; scf.yield ; }; - v680 = arith.constant 0 : i32; - v681 = arith.constant 1 : i32; - v653 = cf.select v366, v681, v680 : i32; - scf.yield v653; + v696 = arith.constant 0 : i32; + v697 = arith.constant 1 : i32; + v669 = cf.select v385, v697, v696 : i32; + scf.yield v669; } else { - ^block45: - v679 = arith.constant 8 : u32; - v329 = hir.bitcast v273 : u32; - v331 = arith.add v329, v679 : u32 #[overflow = checked]; - v678 = arith.constant 4 : u32; - v333 = arith.mod v331, v678 : u32; - hir.assertz v333 #[code = 250]; - v334 = hir.int_to_ptr v331 : ptr; - hir.store v334, v276; - v677 = arith.constant 4 : u32; - v337 = hir.bitcast v273 : u32; - v339 = arith.add v337, v677 : u32 #[overflow = checked]; - v676 = arith.constant 4 : u32; - v341 = arith.mod v339, v676 : u32; - hir.assertz v341 #[code = 250]; - v675 = arith.constant 0 : i32; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v675; - v674 = arith.constant 0 : i32; - scf.yield v674; + ^block57: + v695 = arith.constant 8 : u32; + v348 = hir.bitcast v292 : u32; + v350 = arith.add v348, v695 : u32 #[overflow = checked]; + v694 = arith.constant 4 : u32; + v352 = arith.mod v350, v694 : u32; + hir.assertz v352 #[code = 250]; + v353 = hir.int_to_ptr v350 : ptr; + hir.store v353, v295; + v693 = arith.constant 4 : u32; + v356 = hir.bitcast v292 : u32; + v358 = arith.add v356, v693 : u32 #[overflow = checked]; + v692 = arith.constant 4 : u32; + v360 = arith.mod v358, v692 : u32; + hir.assertz v360 #[code = 250]; + v691 = arith.constant 0 : i32; + v361 = hir.int_to_ptr v358 : ptr; + hir.store v361, v691; + v690 = arith.constant 0 : i32; + scf.yield v690; }; - scf.yield v655; + scf.yield v671; } else { - ^block43: - v673 = ub.poison i32 : i32; - scf.yield v673; + ^block55: + v689 = ub.poison i32 : i32; + scf.yield v689; }; - v668 = arith.constant 0 : u32; - v601 = arith.constant 1 : u32; - v661 = cf.select v317, v601, v668 : u32; - v669 = ub.poison i32 : i32; - v660 = cf.select v317, v284, v669 : i32; - v670 = ub.poison i32 : i32; - v659 = cf.select v317, v273, v670 : i32; - v671 = ub.poison i32 : i32; - v658 = cf.select v317, v671, v284 : i32; - v672 = ub.poison i32 : i32; - v657 = cf.select v317, v672, v273 : i32; - scf.yield v657, v658, v659, v656, v660, v661; + v684 = arith.constant 0 : u32; + v617 = arith.constant 1 : u32; + v677 = cf.select v336, v617, v684 : u32; + v685 = ub.poison i32 : i32; + v676 = cf.select v336, v303, v685 : i32; + v686 = ub.poison i32 : i32; + v675 = cf.select v336, v292, v686 : i32; + v687 = ub.poison i32 : i32; + v674 = cf.select v336, v687, v303 : i32; + v688 = ub.poison i32 : i32; + v673 = cf.select v336, v688, v292 : i32; + scf.yield v673, v674, v675, v672, v676, v677; }; - v614, v615, v616 = scf.index_switch v613 : i32, i32, i32 + v630, v631, v632 = scf.index_switch v629 : i32, i32, i32 case 0 { - ^block41: - v667 = arith.constant 4 : u32; - v320 = hir.bitcast v608 : u32; - v322 = arith.add v320, v667 : u32 #[overflow = checked]; - v666 = arith.constant 4 : u32; - v324 = arith.mod v322, v666 : u32; - hir.assertz v324 #[code = 250]; - v665 = arith.constant 0 : i32; - v325 = hir.int_to_ptr v322 : ptr; - hir.store v325, v665; - v664 = arith.constant 1 : i32; - scf.yield v608, v664, v609; + ^block53: + v683 = arith.constant 4 : u32; + v339 = hir.bitcast v624 : u32; + v341 = arith.add v339, v683 : u32 #[overflow = checked]; + v682 = arith.constant 4 : u32; + v343 = arith.mod v341, v682 : u32; + hir.assertz v343 #[code = 250]; + v681 = arith.constant 0 : i32; + v344 = hir.int_to_ptr v341 : ptr; + hir.store v344, v681; + v680 = arith.constant 1 : i32; + scf.yield v624, v680, v625; } default { - ^block87: - scf.yield v610, v611, v612; + ^block99: + scf.yield v626, v627, v628; }; - v399 = hir.bitcast v614 : u32; - v663 = arith.constant 4 : u32; - v401 = arith.mod v399, v663 : u32; - hir.assertz v401 #[code = 250]; - v402 = hir.int_to_ptr v399 : ptr; - hir.store v402, v615; - v662 = arith.constant 16 : i32; - v407 = arith.add v616, v662 : i32 #[overflow = wrapping]; - v408 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v409 = hir.bitcast v408 : ptr; - hir.store v409, v407; + v418 = hir.bitcast v630 : u32; + v679 = arith.constant 4 : u32; + v420 = arith.mod v418, v679 : u32; + hir.assertz v420 #[code = 250]; + v421 = hir.int_to_ptr v418 : ptr; + hir.store v421, v631; + v678 = arith.constant 16 : i32; + v426 = arith.add v632, v678 : i32 #[overflow = wrapping]; + v427 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v428 = hir.bitcast v427 : ptr; + hir.store v428, v426; builtin.ret ; }; - private builtin.function @::allocate(v410: i32, v411: i32, v412: i32) { - ^block51(v410: i32, v411: i32, v412: i32): - v414 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v415 = hir.bitcast v414 : ptr; - v416 = hir.load v415 : i32; - v417 = arith.constant 16 : i32; - v418 = arith.sub v416, v417 : i32 #[overflow = wrapping]; - v419 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v420 = hir.bitcast v419 : ptr; - hir.store v420, v418; - v413 = arith.constant 0 : i32; - v421 = arith.constant 8 : i32; - v422 = arith.add v418, v421 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::alloc::Global::alloc_impl(v422, v411, v412, v413) - v425 = arith.constant 12 : u32; - v424 = hir.bitcast v418 : u32; - v426 = arith.add v424, v425 : u32 #[overflow = checked]; - v427 = arith.constant 4 : u32; - v428 = arith.mod v426, v427 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - v430 = hir.load v429 : i32; - v432 = arith.constant 8 : u32; - v431 = hir.bitcast v418 : u32; - v433 = arith.add v431, v432 : u32 #[overflow = checked]; - v701 = arith.constant 4 : u32; - v435 = arith.mod v433, v701 : u32; - hir.assertz v435 #[code = 250]; - v436 = hir.int_to_ptr v433 : ptr; - v437 = hir.load v436 : i32; - v438 = hir.bitcast v410 : u32; - v700 = arith.constant 4 : u32; - v440 = arith.mod v438, v700 : u32; - hir.assertz v440 #[code = 250]; - v441 = hir.int_to_ptr v438 : ptr; - hir.store v441, v437; - v699 = arith.constant 4 : u32; - v442 = hir.bitcast v410 : u32; - v444 = arith.add v442, v699 : u32 #[overflow = checked]; - v698 = arith.constant 4 : u32; - v446 = arith.mod v444, v698 : u32; - hir.assertz v446 #[code = 250]; - v447 = hir.int_to_ptr v444 : ptr; - hir.store v447, v430; - v697 = arith.constant 16 : i32; - v449 = arith.add v418, v697 : i32 #[overflow = wrapping]; - v450 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr - v451 = hir.bitcast v450 : ptr; - hir.store v451, v449; + private builtin.function @::allocate(v429: i32, v430: i32, v431: i32) { + ^block63(v429: i32, v430: i32, v431: i32): + v433 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v434 = hir.bitcast v433 : ptr; + v435 = hir.load v434 : i32; + v436 = arith.constant 16 : i32; + v437 = arith.sub v435, v436 : i32 #[overflow = wrapping]; + v438 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v439 = hir.bitcast v438 : ptr; + hir.store v439, v437; + v432 = arith.constant 0 : i32; + v440 = arith.constant 8 : i32; + v441 = arith.add v437, v440 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/adv_load_preimage/alloc::alloc::Global::alloc_impl(v441, v430, v431, v432) + v444 = arith.constant 12 : u32; + v443 = hir.bitcast v437 : u32; + v445 = arith.add v443, v444 : u32 #[overflow = checked]; + v446 = arith.constant 4 : u32; + v447 = arith.mod v445, v446 : u32; + hir.assertz v447 #[code = 250]; + v448 = hir.int_to_ptr v445 : ptr; + v449 = hir.load v448 : i32; + v451 = arith.constant 8 : u32; + v450 = hir.bitcast v437 : u32; + v452 = arith.add v450, v451 : u32 #[overflow = checked]; + v717 = arith.constant 4 : u32; + v454 = arith.mod v452, v717 : u32; + hir.assertz v454 #[code = 250]; + v455 = hir.int_to_ptr v452 : ptr; + v456 = hir.load v455 : i32; + v457 = hir.bitcast v429 : u32; + v716 = arith.constant 4 : u32; + v459 = arith.mod v457, v716 : u32; + hir.assertz v459 #[code = 250]; + v460 = hir.int_to_ptr v457 : ptr; + hir.store v460, v456; + v715 = arith.constant 4 : u32; + v461 = hir.bitcast v429 : u32; + v463 = arith.add v461, v715 : u32 #[overflow = checked]; + v714 = arith.constant 4 : u32; + v465 = arith.mod v463, v714 : u32; + hir.assertz v465 #[code = 250]; + v466 = hir.int_to_ptr v463 : ptr; + hir.store v466, v449; + v713 = arith.constant 16 : i32; + v468 = arith.add v437, v713 : i32 #[overflow = wrapping]; + v469 = builtin.global_symbol @root_ns:root@1.0.0/adv_load_preimage/__stack_pointer : ptr + v470 = hir.bitcast v469 : ptr; + hir.store v470, v468; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v452: i32, v453: i32, v454: i32, v455: i32) { - ^block53(v452: i32, v453: i32, v454: i32, v455: i32): - v717 = arith.constant 0 : i32; - v456 = arith.constant 0 : i32; - v457 = arith.eq v454, v456 : i1; - v458 = arith.zext v457 : u32; - v459 = hir.bitcast v458 : i32; - v461 = arith.neq v459, v717 : i1; - v713 = scf.if v461 : i32 { - ^block90: - scf.yield v453; + private builtin.function @alloc::alloc::Global::alloc_impl(v471: i32, v472: i32, v473: i32, v474: i32) { + ^block65(v471: i32, v472: i32, v473: i32, v474: i32): + v733 = arith.constant 0 : i32; + v475 = arith.constant 0 : i32; + v476 = arith.eq v473, v475 : i1; + v477 = arith.zext v476 : u32; + v478 = hir.bitcast v477 : i32; + v480 = arith.neq v478, v733 : i1; + v729 = scf.if v480 : i32 { + ^block102: + scf.yield v472; } else { - ^block56: + ^block68: hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v716 = arith.constant 0 : i32; - v463 = arith.neq v455, v716 : i1; - v712 = scf.if v463 : i32 { - ^block57: - v465 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v454, v453) : i32 - scf.yield v465; + v732 = arith.constant 0 : i32; + v482 = arith.neq v474, v732 : i1; + v728 = scf.if v482 : i32 { + ^block69: + v484 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc_zeroed(v473, v472) : i32 + scf.yield v484; } else { - ^block58: - v464 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v454, v453) : i32 - scf.yield v464; + ^block70: + v483 = hir.exec @root_ns:root@1.0.0/adv_load_preimage/__rustc::__rust_alloc(v473, v472) : i32 + scf.yield v483; }; - scf.yield v712; + scf.yield v728; }; - v469 = arith.constant 4 : u32; - v468 = hir.bitcast v452 : u32; - v470 = arith.add v468, v469 : u32 #[overflow = checked]; - v715 = arith.constant 4 : u32; - v472 = arith.mod v470, v715 : u32; - hir.assertz v472 #[code = 250]; - v473 = hir.int_to_ptr v470 : ptr; - hir.store v473, v454; - v475 = hir.bitcast v452 : u32; - v714 = arith.constant 4 : u32; - v477 = arith.mod v475, v714 : u32; - hir.assertz v477 #[code = 250]; - v478 = hir.int_to_ptr v475 : ptr; - hir.store v478, v713; + v488 = arith.constant 4 : u32; + v487 = hir.bitcast v471 : u32; + v489 = arith.add v487, v488 : u32 #[overflow = checked]; + v731 = arith.constant 4 : u32; + v491 = arith.mod v489, v731 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + hir.store v492, v473; + v494 = hir.bitcast v471 : u32; + v730 = arith.constant 4 : u32; + v496 = arith.mod v494, v730 : u32; + hir.assertz v496 #[code = 250]; + v497 = hir.int_to_ptr v494 : ptr; + hir.store v497, v729; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v479: i32, v480: i32, v481: i32) { - ^block59(v479: i32, v480: i32, v481: i32): + private builtin.function @alloc::raw_vec::handle_error(v498: i32, v499: i32, v500: i32) { + ^block71(v498: i32, v499: i32, v500: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v482: i32, v483: i32) -> i32 { - ^block61(v482: i32, v483: i32): - v490 = arith.constant 0 : i32; - v486 = hir.bitcast v483 : u32; - v485 = hir.bitcast v482 : u32; - v487 = arith.gt v485, v486 : i1; - v488 = arith.zext v487 : u32; - v489 = hir.bitcast v488 : i32; - v491 = arith.neq v489, v490 : i1; - v492 = cf.select v491, v482, v483 : i32; - builtin.ret v492; + private builtin.function @core::ptr::alignment::Alignment::max(v501: i32, v502: i32) -> i32 { + ^block73(v501: i32, v502: i32): + v509 = arith.constant 0 : i32; + v505 = hir.bitcast v502 : u32; + v504 = hir.bitcast v501 : u32; + v506 = arith.gt v504, v505 : i1; + v507 = arith.zext v506 : u32; + v508 = hir.bitcast v507 : i32; + v510 = arith.neq v508, v509 : i1; + v511 = cf.select v510, v501, v502 : i32; + builtin.ret v511; }; builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; - builtin.segment readonly @1048576 = 0x00000000000000210000009800000028001000000000000073722e6d656d2f62696c6474732f6372732f312e342e302d7379732d62696c6474732d6e6564696d; + builtin.segment readonly @1048576 = 0x00000000000000210000009700000028001000000000000073722e6d656d2f62696c6474732f6372732f302e352e302d7379732d62696c6474732d6e6564696d; }; }; \ 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 4523aaeb4..e370314cd 100644 --- a/tests/integration/expected/adv_load_preimage.masm +++ b/tests/integration/expected/adv_load_preimage.masm @@ -5,10 +5,10 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.6511108792895883553 - push.16222885695204016799 - push.9743660194275725311 - push.6517813025021579317 + push.16791429592475771515 + push.1532788014365311554 + push.16355128202447696923 + push.13058114983777808360 adv.push_mapval push.262144 push.4 @@ -23,14 +23,6 @@ end # mod root_ns:root@1.0.0::adv_load_preimage -proc.miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory - trace.240 - nop - exec.::std::mem::pipe_preimage_to_memory - trace.252 - nop -end - export.entrypoint push.1114176 u32divmod.4 @@ -58,17 +50,36 @@ export.entrypoint dup.8 trace.240 nop - exec.::intrinsics::advice::adv_push_mapvaln + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::advice::adv_push_mapvaln + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::as_u64 trace.252 nop - u32split - push.0 push.3 - dup.3 - dup.3 + dup.2 + dup.2 drop u32and - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + trace.252 + nop push.2 push.0 dup.0 @@ -88,21 +99,19 @@ export.entrypoint exec.::std::math::u64::shr trace.252 nop - dup.1 - dup.1 - push.1 - push.4294967295 trace.240 nop - exec.::std::math::u64::lt + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u64_unchecked + trace.252 + nop + dup.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::as_u64 trace.252 nop - assert - mul.4294967296 - add push.2 - dup.1 - u32split + movdn.2 drop swap.1 u32shl @@ -237,7 +246,7 @@ export.entrypoint swap.4 trace.240 nop - exec.::root_ns:root@1.0.0::adv_load_preimage::miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory + exec.::root_ns:root@1.0.0::adv_load_preimage::std::mem::pipe_preimage_to_memory trace.252 nop drop @@ -321,7 +330,17 @@ export.entrypoint trace.252 nop push.1 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + trace.252 + nop push.4 dup.2 add @@ -340,7 +359,17 @@ export.entrypoint trace.252 nop push.2 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.5 dup.4 @@ -371,7 +400,17 @@ export.entrypoint trace.252 nop push.6 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.14 movup.4 @@ -402,7 +441,17 @@ export.entrypoint trace.252 nop push.15 - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::felt::assert_eq + trace.252 + nop push.16 movup.2 swap.1 @@ -602,7 +651,7 @@ proc.::alloc else trace.240 nop - exec.::intrinsics::mem::heap_base + exec.::root_ns:root@1.0.0::adv_load_preimage::intrinsics::mem::heap_base trace.252 nop trace.240 @@ -705,6 +754,57 @@ proc.::alloc end end +proc.intrinsics::mem::heap_base + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +proc.intrinsics::felt::from_u64_unchecked + dup.1 + dup.1 + push.1 + push.4294967295 + trace.240 + nop + exec.::std::math::u64::lt + trace.252 + nop + assert + mul.4294967296 + add +end + +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::as_u64 + u32split +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + +proc.intrinsics::advice::adv_push_mapvaln + trace.240 + nop + exec.::intrinsics::advice::adv_push_mapvaln + trace.252 + nop +end + +proc.std::mem::pipe_preimage_to_memory + trace.240 + nop + exec.::std::mem::pipe_preimage_to_memory + trace.252 + nop +end + proc.alloc::raw_vec::RawVecInner::try_allocate_in push.1114176 u32divmod.4 diff --git a/tests/integration/expected/adv_load_preimage.wat b/tests/integration/expected/adv_load_preimage.wat index 0d9e5ba36..eda37646e 100644 --- a/tests/integration/expected/adv_load_preimage.wat +++ b/tests/integration/expected/adv_load_preimage.wat @@ -1,31 +1,24 @@ (module $adv_load_preimage.wasm - (type (;0;) (func (param f32 f32 f32 f32) (result f32))) - (type (;1;) (func (param f32) (result i64))) - (type (;2;) (func (param i32) (result f32))) - (type (;3;) (func (param f32 f32))) - (type (;4;) (func (param i64) (result f32))) - (type (;5;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) - (type (;6;) (func (result i32))) - (type (;7;) (func (param i32 f32 f32 f32 f32))) - (type (;8;) (func (param i32 i32) (result i32))) - (type (;9;) (func)) - (type (;10;) (func (param i32 i32 i32) (result i32))) + (type (;0;) (func (param i32 f32 f32 f32 f32))) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func)) + (type (;3;) (func (param i32 i32 i32) (result i32))) + (type (;4;) (func (result i32))) + (type (;5;) (func (param i64) (result f32))) + (type (;6;) (func (param i32) (result f32))) + (type (;7;) (func (param f32) (result i64))) + (type (;8;) (func (param f32 f32))) + (type (;9;) (func (param f32 f32 f32 f32) (result f32))) + (type (;10;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) (type (;11;) (func (param i32 i32 i32 i32 i32))) (type (;12;) (func (param i32 i32 i32))) (type (;13;) (func (param i32 i32 i32 i32))) - (import "miden:core-intrinsics/intrinsics-advice@1.0.0" "adv-push-mapvaln" (func $miden_stdlib_sys::intrinsics::advice::extern_adv_push_mapvaln (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "as-u64" (func $miden_stdlib_sys::intrinsics::felt::extern_as_u64 (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;2;) (type 2))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;3;) (type 3))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u64-unchecked" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked (;4;) (type 4))) - (import "miden:core-stdlib/stdlib-mem@1.0.0" "pipe-preimage-to-memory" (func $miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory (;5;) (type 5))) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" "heap-base" (func $miden_sdk_alloc::heap_base (;6;) (type 6))) (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 $entrypoint (;7;) (type 7) (param i32 f32 f32 f32 f32) + (func $entrypoint (;0;) (type 0) (param i32 f32 f32 f32 f32) (local i32 i64 f32 i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -36,25 +29,25 @@ local.get 3 local.get 2 local.get 1 - call $miden_stdlib_sys::intrinsics::advice::extern_adv_push_mapvaln - call $miden_stdlib_sys::intrinsics::felt::extern_as_u64 + call $intrinsics::advice::adv_push_mapvaln + call $intrinsics::felt::as_u64 local.tee 6 i32.wrap_i64 i32.const 3 i32.and - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 4 i32.add local.get 6 i64.const 2 i64.shr_u - call $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked + call $intrinsics::felt::from_u64_unchecked local.tee 7 - call $miden_stdlib_sys::intrinsics::felt::extern_as_u64 + call $intrinsics::felt::as_u64 i32.wrap_i64 i32.const 2 i32.shl @@ -83,7 +76,7 @@ local.get 3 local.get 2 local.get 1 - call $miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory + call $std::mem::pipe_preimage_to_memory drop local.get 0 local.get 8 @@ -100,13 +93,13 @@ local.get 10 f32.load i32.const 1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 10 f32.load offset=4 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 8 i32.const 5 i32.le_u @@ -114,8 +107,8 @@ local.get 10 f32.load offset=20 i32.const 6 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 8 i32.const 14 i32.le_u @@ -123,8 +116,8 @@ local.get 10 f32.load offset=56 i32.const 15 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 16 i32.add @@ -139,13 +132,13 @@ end unreachable ) - (func $__rustc::__rust_alloc (;8;) (type 8) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) i32.const 1048636 local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_alloc_zeroed (;9;) (type 8) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc_zeroed (;2;) (type 1) (param i32 i32) (result i32) block ;; label = @1 i32.const 1048636 local.get 1 @@ -164,10 +157,10 @@ end local.get 1 ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;10;) (type 9) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 2) return ) - (func $::alloc (;11;) (type 10) (param i32 i32 i32) (result i32) + (func $::alloc (;4;) (type 3) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -208,7 +201,7 @@ i32.load br_if 0 (;@2;) local.get 0 - call $miden_sdk_alloc::heap_base + call $intrinsics::mem::heap_base memory.size i32.const 16 i32.shl @@ -239,6 +232,27 @@ end unreachable ) + (func $intrinsics::mem::heap_base (;5;) (type 4) (result i32) + unreachable + ) + (func $intrinsics::felt::from_u64_unchecked (;6;) (type 5) (param i64) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;7;) (type 6) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::as_u64 (;8;) (type 7) (param f32) (result i64) + unreachable + ) + (func $intrinsics::felt::assert_eq (;9;) (type 8) (param f32 f32) + unreachable + ) + (func $intrinsics::advice::adv_push_mapvaln (;10;) (type 9) (param f32 f32 f32 f32) (result f32) + unreachable + ) + (func $std::mem::pipe_preimage_to_memory (;11;) (type 10) (param f32 i32 f32 f32 f32 f32) (result i32) + unreachable + ) (func $alloc::raw_vec::RawVecInner::try_allocate_in (;12;) (type 11) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer @@ -410,7 +424,7 @@ (func $alloc::raw_vec::handle_error (;15;) (type 12) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;16;) (type 8) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;16;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -418,5 +432,5 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.4.1/src/stdlib/mem.rs\00\00\00\00\00\00\10\00(\00\00\00\98\00\00\00!\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.5.0/src/stdlib/mem.rs\00\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00") ) diff --git a/tests/integration/expected/div_felt.hir b/tests/integration/expected/div_felt.hir index b8f7493ab..6f5ed64d0 100644 --- a/tests/integration/expected/div_felt.hir +++ b/tests/integration/expected/div_felt.hir @@ -2,10 +2,16 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @div_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = arith.div v0, v1 : felt; + v3 = hir.exec @root_ns:root@1.0.0/div_felt/intrinsics::felt::div(v0, v1) : felt builtin.ret v3; }; + private builtin.function @intrinsics::felt::div(v4: felt, v5: felt) -> felt { + ^block6(v4: felt, v5: felt): + v6 = arith.div v4, v5 : felt; + builtin.ret v6; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/div_felt.masm b/tests/integration/expected/div_felt.masm index a8d79b10e..bfcdf8837 100644 --- a/tests/integration/expected/div_felt.masm +++ b/tests/integration/expected/div_felt.masm @@ -13,6 +13,14 @@ end # mod root_ns:root@1.0.0::div_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::div_felt::intrinsics::felt::div + trace.252 + nop +end + +proc.intrinsics::felt::div swap.1 div end diff --git a/tests/integration/expected/div_felt.wat b/tests/integration/expected/div_felt.wat index fff4b8c07..c2029075e 100644 --- a/tests/integration/expected/div_felt.wat +++ b/tests/integration/expected/div_felt.wat @@ -1,14 +1,16 @@ (module $div_felt.wasm (type (;0;) (func (param f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "div" (func $miden_stdlib_sys::intrinsics::felt::extern_div (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result f32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_div + call $intrinsics::felt::div + ) + (func $intrinsics::felt::div (;1;) (type 0) (param f32 f32) (result f32) + unreachable ) ) diff --git a/tests/integration/expected/eq_felt.hir b/tests/integration/expected/eq_felt.hir index 96a24ac28..614267455 100644 --- a/tests/integration/expected/eq_felt.hir +++ b/tests/integration/expected/eq_felt.hir @@ -2,13 +2,19 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @eq_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v5 = arith.constant 1 : i32; - v3 = arith.eq v0, v1 : i1; - v4 = hir.cast v3 : i32; - v6 = arith.eq v4, v5 : i1; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v3 = hir.exec @root_ns:root@1.0.0/eq_felt/intrinsics::felt::eq(v0, v1) : i32 + v4 = arith.constant 1 : i32; + v5 = arith.eq v3, v4 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; + }; + + private builtin.function @intrinsics::felt::eq(v8: felt, v9: felt) -> i32 { + ^block6(v8: felt, v9: felt): + v10 = arith.eq v8, v9 : i1; + v11 = hir.cast v10 : i32; + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/eq_felt.masm b/tests/integration/expected/eq_felt.masm index 0a1a8dae9..16f9f7401 100644 --- a/tests/integration/expected/eq_felt.masm +++ b/tests/integration/expected/eq_felt.masm @@ -13,10 +13,16 @@ end # mod root_ns:root@1.0.0::eq_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::eq_felt::intrinsics::felt::eq + trace.252 + nop push.1 - swap.1 - movup.2 eq +end + +proc.intrinsics::felt::eq eq end diff --git a/tests/integration/expected/eq_felt.wat b/tests/integration/expected/eq_felt.wat index 916305025..40c2f6062 100644 --- a/tests/integration/expected/eq_felt.wat +++ b/tests/integration/expected/eq_felt.wat @@ -1,16 +1,18 @@ (module $eq_felt.wasm (type (;0;) (func (param f32 f32) (result i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "eq" (func $miden_stdlib_sys::intrinsics::felt::extern_eq (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result i32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_eq + call $intrinsics::felt::eq i32.const 1 i32.eq ) + (func $intrinsics::felt::eq (;1;) (type 0) (param f32 f32) (result i32) + unreachable + ) ) diff --git a/tests/integration/expected/examples/basic_wallet.hir b/tests/integration/expected/examples/basic_wallet.hir index 08355e486..b99be9cbb 100644 --- a/tests/integration/expected/examples/basic_wallet.hir +++ b/tests/integration/expected/examples/basic_wallet.hir @@ -1,438 +1,438 @@ builtin.component miden:basic-wallet/basic-wallet@1.0.0 { builtin.module public @basic_wallet { - private builtin.function @miden_base_sys::bindings::account::extern_account_add_asset(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.exec @miden/account/add_asset(v0, v1, v2, v3) : felt, felt, felt, felt - v9 = hir.bitcast v4 : u32; - v10 = hir.int_to_ptr v9 : ptr; - hir.store v10, v5; - v11 = arith.constant 4 : u32; - v12 = arith.add v9, v11 : u32 #[overflow = checked]; - v13 = hir.int_to_ptr v12 : ptr; - hir.store v13, v6; - v14 = arith.constant 8 : u32; - v15 = arith.add v9, v14 : u32 #[overflow = checked]; - v16 = hir.int_to_ptr v15 : ptr; - hir.store v16, v7; - v17 = arith.constant 12 : u32; - v18 = arith.add v9, v17 : u32 #[overflow = checked]; - v19 = hir.int_to_ptr v18 : ptr; - hir.store v19, v8; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::account::extern_account_remove_asset(v20: felt, v21: felt, v22: felt, v23: felt, v24: i32) { - ^block7(v20: felt, v21: felt, v22: felt, v23: felt, v24: i32): - v25, v26, v27, v28 = hir.exec @miden/account/remove_asset(v20, v21, v22, v23) : felt, felt, felt, felt - v29 = hir.bitcast v24 : u32; - v30 = hir.int_to_ptr v29 : ptr; - hir.store v30, v25; - v31 = arith.constant 4 : u32; - v32 = arith.add v29, v31 : u32 #[overflow = checked]; - v33 = hir.int_to_ptr v32 : ptr; - hir.store v33, v26; - v34 = arith.constant 8 : u32; - v35 = arith.add v29, v34 : u32 #[overflow = checked]; - v36 = hir.int_to_ptr v35 : ptr; - hir.store v36, v27; - v37 = arith.constant 12 : u32; - v38 = arith.add v29, v37 : u32 #[overflow = checked]; - v39 = hir.int_to_ptr v38 : ptr; - hir.store v39, v28; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::tx::extern_tx_add_asset_to_note(v40: felt, v41: felt, v42: felt, v43: felt, v44: felt, v45: i32) { - ^block9(v40: felt, v41: felt, v42: felt, v43: felt, v44: felt, v45: i32): - v46, v47, v48, v49, v50 = hir.exec @miden/tx/add_asset_to_note(v40, v41, v42, v43, v44) : felt, felt, felt, felt, felt - v51 = hir.bitcast v45 : u32; - v52 = hir.int_to_ptr v51 : ptr; - hir.store v52, v46; - v53 = arith.constant 4 : u32; - v54 = arith.add v51, v53 : u32 #[overflow = checked]; - v55 = hir.int_to_ptr v54 : ptr; - hir.store v55, v47; - v56 = arith.constant 8 : u32; - v57 = arith.add v51, v56 : u32 #[overflow = checked]; - v58 = hir.int_to_ptr v57 : ptr; - hir.store v58, v48; - v59 = arith.constant 12 : u32; - v60 = arith.add v51, v59 : u32 #[overflow = checked]; - v61 = hir.int_to_ptr v60 : ptr; - hir.store v61, v49; - v62 = arith.constant 16 : u32; - v63 = arith.add v51, v62 : u32 #[overflow = checked]; - v64 = hir.int_to_ptr v63 : ptr; - hir.store v64, v50; - builtin.ret ; - }; - private builtin.function @__wasm_call_ctors() { - ^block14: + ^block5: builtin.ret ; }; private builtin.function @basic_wallet::bindings::__link_custom_section_describing_imports() { - ^block16: + ^block7: builtin.ret ; }; - public builtin.function @miden:basic-wallet/basic-wallet@1.0.0#receive-asset(v65: felt, v66: felt, v67: felt, v68: felt) { - ^block18(v65: felt, v66: felt, v67: felt, v68: felt): - v70 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - v72 = hir.load v71 : i32; - v73 = arith.constant 32 : i32; - v74 = arith.sub v72, v73 : i32 #[overflow = wrapping]; - v75 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v76 = hir.bitcast v75 : ptr; - hir.store v76, v74; + public builtin.function @miden:basic-wallet/basic-wallet@1.0.0#receive-asset(v0: felt, v1: felt, v2: felt, v3: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt): + v5 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__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:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v11 = hir.bitcast v10 : ptr; + hir.store v11, v9; hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/wit_bindgen_rt::run_ctors_once() - v78 = arith.constant 12 : u32; - v77 = hir.bitcast v74 : u32; - v79 = arith.add v77, v78 : u32 #[overflow = checked]; - v80 = arith.constant 4 : u32; - v81 = arith.mod v79, v80 : u32; - hir.assertz v81 #[code = 250]; - v82 = hir.int_to_ptr v79 : ptr; - hir.store v82, v68; - v84 = arith.constant 8 : u32; - v83 = hir.bitcast v74 : u32; - v85 = arith.add v83, v84 : u32 #[overflow = checked]; + v13 = arith.constant 12 : u32; + v12 = hir.bitcast v9 : 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; + hir.store v17, v3; + v19 = arith.constant 8 : u32; + v18 = hir.bitcast v9 : u32; + v20 = arith.add v18, v19 : u32 #[overflow = checked]; v449 = arith.constant 4 : u32; - v87 = arith.mod v85, v449 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - hir.store v88, v67; + v22 = arith.mod v20, v449 : u32; + hir.assertz v22 #[code = 250]; + v23 = hir.int_to_ptr v20 : ptr; + hir.store v23, v2; v448 = arith.constant 4 : u32; - v89 = hir.bitcast v74 : u32; - v91 = arith.add v89, v448 : u32 #[overflow = checked]; + v24 = hir.bitcast v9 : u32; + v26 = arith.add v24, v448 : u32 #[overflow = checked]; v447 = arith.constant 4 : u32; - v93 = arith.mod v91, v447 : u32; - hir.assertz v93 #[code = 250]; - v94 = hir.int_to_ptr v91 : ptr; - hir.store v94, v66; - v95 = hir.bitcast v74 : u32; + v28 = arith.mod v26, v447 : u32; + hir.assertz v28 #[code = 250]; + v29 = hir.int_to_ptr v26 : ptr; + hir.store v29, v1; + v30 = hir.bitcast v9 : u32; v446 = arith.constant 4 : u32; - v97 = arith.mod v95, v446 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - hir.store v98, v65; - v99 = arith.constant 16 : i32; - v100 = arith.add v74, v99 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::account::add_asset(v100, v74) + v32 = arith.mod v30, v446 : u32; + hir.assertz v32 #[code = 250]; + v33 = hir.int_to_ptr v30 : ptr; + hir.store v33, v0; + v34 = arith.constant 16 : i32; + v35 = arith.add v9, v34 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::account::add_asset(v35, v9) v445 = arith.constant 32 : i32; - v102 = arith.add v74, v445 : i32 #[overflow = wrapping]; - v103 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v104 = hir.bitcast v103 : ptr; - hir.store v104, v102; + v37 = arith.add v9, v445 : i32 #[overflow = wrapping]; + v38 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v39 = hir.bitcast v38 : ptr; + hir.store v39, v37; builtin.ret ; }; - public builtin.function @miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note(v105: felt, v106: felt, v107: felt, v108: felt, v109: felt) { - ^block20(v105: felt, v106: felt, v107: felt, v108: felt, v109: felt): - v111 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v112 = hir.bitcast v111 : ptr; - v113 = hir.load v112 : i32; - v114 = arith.constant 64 : i32; - v115 = arith.sub v113, v114 : i32 #[overflow = wrapping]; - v116 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v117 = hir.bitcast v116 : ptr; - hir.store v117, v115; + public builtin.function @miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note(v40: felt, v41: felt, v42: felt, v43: felt, v44: felt) { + ^block11(v40: felt, v41: felt, v42: felt, v43: felt, v44: felt): + v46 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v47 = hir.bitcast v46 : ptr; + v48 = hir.load v47 : i32; + v49 = arith.constant 64 : i32; + v50 = arith.sub v48, v49 : i32 #[overflow = wrapping]; + v51 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v52 = hir.bitcast v51 : ptr; + hir.store v52, v50; hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/wit_bindgen_rt::run_ctors_once() - v119 = arith.constant 12 : u32; - v118 = hir.bitcast v115 : u32; - v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v121 = arith.constant 4 : u32; - v122 = arith.mod v120, v121 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v108; - v125 = arith.constant 8 : u32; - v124 = hir.bitcast v115 : u32; - v126 = arith.add v124, v125 : u32 #[overflow = checked]; + v54 = arith.constant 12 : u32; + v53 = hir.bitcast v50 : 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; + hir.store v58, v43; + v60 = arith.constant 8 : u32; + v59 = hir.bitcast v50 : u32; + v61 = arith.add v59, v60 : u32 #[overflow = checked]; v455 = arith.constant 4 : u32; - v128 = arith.mod v126, v455 : u32; - hir.assertz v128 #[code = 250]; - v129 = hir.int_to_ptr v126 : ptr; - hir.store v129, v107; + v63 = arith.mod v61, v455 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + hir.store v64, v42; v454 = arith.constant 4 : u32; - v130 = hir.bitcast v115 : u32; - v132 = arith.add v130, v454 : u32 #[overflow = checked]; + v65 = hir.bitcast v50 : u32; + v67 = arith.add v65, v454 : u32 #[overflow = checked]; v453 = arith.constant 4 : u32; - v134 = arith.mod v132, v453 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v106; - v136 = hir.bitcast v115 : u32; + v69 = arith.mod v67, v453 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + hir.store v70, v41; + v71 = hir.bitcast v50 : u32; v452 = arith.constant 4 : u32; - v138 = arith.mod v136, v452 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - hir.store v139, v105; - v140 = arith.constant 16 : i32; - v141 = arith.add v115, v140 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::account::remove_asset(v141, v115) + v73 = arith.mod v71, v452 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + hir.store v74, v40; + v75 = arith.constant 16 : i32; + v76 = arith.add v50, v75 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::account::remove_asset(v76, v50) v451 = arith.constant 16 : i32; - v145 = arith.add v115, v451 : i32 #[overflow = wrapping]; - v142 = arith.constant 32 : i32; - v143 = arith.add v115, v142 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::tx::add_asset_to_note(v143, v145, v109) + v80 = arith.add v50, v451 : i32 #[overflow = wrapping]; + v77 = arith.constant 32 : i32; + v78 = arith.add v50, v77 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::tx::add_asset_to_note(v78, v80, v44) v450 = arith.constant 64 : i32; - v147 = arith.add v115, v450 : i32 #[overflow = wrapping]; - v148 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v149 = hir.bitcast v148 : ptr; - hir.store v149, v147; + v82 = arith.add v50, v450 : i32 #[overflow = wrapping]; + v83 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v84 = hir.bitcast v83 : ptr; + hir.store v84, v82; builtin.ret ; }; private builtin.function @wit_bindgen_rt::run_ctors_once() { - ^block22: - v151 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/GOT.data.internal.__memory_base : ptr - v152 = hir.bitcast v151 : ptr; - v153 = hir.load v152 : i32; - v154 = arith.constant 1048624 : 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{ - ^block24: + ^block13: + v86 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v87 = hir.bitcast v86 : ptr; + v88 = hir.load v87 : i32; + v89 = arith.constant 1048584 : i32; + v90 = arith.add v88, v89 : i32 #[overflow = wrapping]; + v91 = hir.bitcast v90 : u32; + v92 = hir.int_to_ptr v91 : ptr; + v93 = hir.load v92 : u8; + v85 = arith.constant 0 : i32; + v94 = arith.zext v93 : u32; + v95 = hir.bitcast v94 : i32; + v97 = arith.neq v95, v85 : i1; + scf.if v97{ + ^block15: scf.yield ; } else { - ^block25: - v163 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/GOT.data.internal.__memory_base : ptr - v164 = hir.bitcast v163 : ptr; - v165 = hir.load v164 : i32; + ^block16: + v98 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/GOT.data.internal.__memory_base : ptr + v99 = hir.bitcast v98 : ptr; + v100 = hir.load v99 : i32; hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__wasm_call_ctors() v457 = arith.constant 1 : u8; - v459 = arith.constant 1048624 : i32; - v167 = arith.add v165, v459 : i32 #[overflow = wrapping]; - v171 = hir.bitcast v167 : u32; - v172 = hir.int_to_ptr v171 : ptr; - hir.store v172, v457; + v459 = arith.constant 1048584 : i32; + v102 = arith.add v100, v459 : i32 #[overflow = wrapping]; + v106 = hir.bitcast v102 : u32; + v107 = hir.int_to_ptr v106 : ptr; + hir.store v107, v457; scf.yield ; }; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::add_asset(v173: i32, v174: i32) { - ^block26(v173: i32, v174: i32): - v176 = arith.constant 12 : u32; - v175 = hir.bitcast v174 : u32; - v177 = arith.add v175, v176 : u32 #[overflow = checked]; - v178 = arith.constant 4 : u32; - v179 = arith.mod v177, v178 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - v181 = hir.load v180 : felt; - v183 = arith.constant 8 : u32; - v182 = hir.bitcast v174 : u32; - v184 = arith.add v182, v183 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::account::add_asset(v108: i32, v109: i32) { + ^block17(v108: i32, v109: i32): + v111 = arith.constant 12 : u32; + v110 = hir.bitcast v109 : u32; + v112 = arith.add v110, v111 : u32 #[overflow = checked]; + v113 = arith.constant 4 : u32; + v114 = arith.mod v112, v113 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + v116 = hir.load v115 : felt; + v118 = arith.constant 8 : u32; + v117 = hir.bitcast v109 : u32; + v119 = arith.add v117, v118 : u32 #[overflow = checked]; v463 = arith.constant 4 : u32; - v186 = arith.mod v184, v463 : u32; - hir.assertz v186 #[code = 250]; - v187 = hir.int_to_ptr v184 : ptr; - v188 = hir.load v187 : felt; + v121 = arith.mod v119, v463 : u32; + hir.assertz v121 #[code = 250]; + v122 = hir.int_to_ptr v119 : ptr; + v123 = hir.load v122 : felt; v462 = arith.constant 4 : u32; - v189 = hir.bitcast v174 : u32; - v191 = arith.add v189, v462 : u32 #[overflow = checked]; + v124 = hir.bitcast v109 : u32; + v126 = arith.add v124, v462 : u32 #[overflow = checked]; v461 = arith.constant 4 : u32; - v193 = arith.mod v191, v461 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - v195 = hir.load v194 : felt; - v196 = hir.bitcast v174 : u32; + v128 = arith.mod v126, v461 : u32; + hir.assertz v128 #[code = 250]; + v129 = hir.int_to_ptr v126 : ptr; + v130 = hir.load v129 : felt; + v131 = hir.bitcast v109 : u32; v460 = arith.constant 4 : u32; - v198 = arith.mod v196, v460 : u32; - hir.assertz v198 #[code = 250]; - v199 = hir.int_to_ptr v196 : ptr; - v200 = hir.load v199 : felt; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::account::extern_account_add_asset(v181, v188, v195, v200, v173) + v133 = arith.mod v131, v460 : u32; + hir.assertz v133 #[code = 250]; + v134 = hir.int_to_ptr v131 : ptr; + v135 = hir.load v134 : felt; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden::account::add_asset(v116, v123, v130, v135, v108) builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::remove_asset(v201: i32, v202: i32) { - ^block28(v201: i32, v202: i32): - v204 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v205 = hir.bitcast v204 : ptr; - v206 = hir.load v205 : i32; - v207 = arith.constant 32 : i32; - v208 = arith.sub v206, v207 : i32 #[overflow = wrapping]; - v209 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v210 = hir.bitcast v209 : ptr; - hir.store v210, v208; - v212 = arith.constant 12 : u32; - v211 = hir.bitcast v202 : u32; - v213 = arith.add v211, v212 : u32 #[overflow = checked]; - v214 = arith.constant 4 : u32; - v215 = arith.mod v213, v214 : u32; - hir.assertz v215 #[code = 250]; - v216 = hir.int_to_ptr v213 : ptr; - v217 = hir.load v216 : felt; - v219 = arith.constant 8 : u32; - v218 = hir.bitcast v202 : u32; - v220 = arith.add v218, v219 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::account::remove_asset(v136: i32, v137: i32) { + ^block19(v136: i32, v137: i32): + v139 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v140 = hir.bitcast v139 : ptr; + v141 = hir.load v140 : i32; + v142 = arith.constant 32 : i32; + v143 = arith.sub v141, v142 : i32 #[overflow = wrapping]; + v144 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v145 = hir.bitcast v144 : ptr; + hir.store v145, v143; + v147 = arith.constant 12 : u32; + v146 = hir.bitcast v137 : u32; + v148 = arith.add v146, v147 : u32 #[overflow = checked]; + v149 = arith.constant 4 : u32; + v150 = arith.mod v148, v149 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : felt; + v154 = arith.constant 8 : u32; + v153 = hir.bitcast v137 : u32; + v155 = arith.add v153, v154 : u32 #[overflow = checked]; v473 = arith.constant 4 : u32; - v222 = arith.mod v220, v473 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - v224 = hir.load v223 : felt; + v157 = arith.mod v155, v473 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + v159 = hir.load v158 : felt; v472 = arith.constant 4 : u32; - v225 = hir.bitcast v202 : u32; - v227 = arith.add v225, v472 : u32 #[overflow = checked]; + v160 = hir.bitcast v137 : u32; + v162 = arith.add v160, v472 : u32 #[overflow = checked]; v471 = arith.constant 4 : u32; - v229 = arith.mod v227, v471 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - v231 = hir.load v230 : felt; - v232 = hir.bitcast v202 : u32; + v164 = arith.mod v162, v471 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : felt; + v167 = hir.bitcast v137 : u32; v470 = arith.constant 4 : u32; - v234 = arith.mod v232, v470 : u32; - hir.assertz v234 #[code = 250]; - v235 = hir.int_to_ptr v232 : ptr; - v236 = hir.load v235 : felt; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::account::extern_account_remove_asset(v217, v224, v231, v236, v208) + v169 = arith.mod v167, v470 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + v171 = hir.load v170 : felt; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden::account::remove_asset(v152, v159, v166, v171, v143) v469 = arith.constant 8 : u32; - v237 = hir.bitcast v208 : u32; - v239 = arith.add v237, v469 : u32 #[overflow = checked]; + v172 = hir.bitcast v143 : u32; + v174 = arith.add v172, v469 : u32 #[overflow = checked]; v468 = arith.constant 8 : u32; - v241 = arith.mod v239, v468 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - v243 = hir.load v242 : i64; - v245 = arith.constant 24 : u32; - v244 = hir.bitcast v208 : u32; - v246 = arith.add v244, v245 : u32 #[overflow = checked]; + v176 = arith.mod v174, v468 : u32; + hir.assertz v176 #[code = 250]; + v177 = hir.int_to_ptr v174 : ptr; + v178 = hir.load v177 : i64; + v180 = arith.constant 24 : u32; + v179 = hir.bitcast v143 : u32; + v181 = arith.add v179, v180 : u32 #[overflow = checked]; v467 = arith.constant 8 : u32; - v248 = arith.mod v246, v467 : u32; - hir.assertz v248 #[code = 250]; - v249 = hir.int_to_ptr v246 : ptr; - hir.store v249, v243; - v250 = hir.bitcast v208 : u32; + v183 = arith.mod v181, v467 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + hir.store v184, v178; + v185 = hir.bitcast v143 : u32; v466 = arith.constant 8 : u32; - v252 = arith.mod v250, v466 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - v254 = hir.load v253 : i64; - v256 = arith.constant 16 : u32; - v255 = hir.bitcast v208 : u32; - v257 = arith.add v255, v256 : u32 #[overflow = checked]; + v187 = arith.mod v185, v466 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + v189 = hir.load v188 : i64; + v191 = arith.constant 16 : u32; + v190 = hir.bitcast v143 : u32; + v192 = arith.add v190, v191 : u32 #[overflow = checked]; v465 = arith.constant 8 : u32; - v259 = arith.mod v257, v465 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - hir.store v260, v254; - v261 = arith.constant 16 : i32; - v262 = arith.add v208, v261 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v201, v262) + v194 = arith.mod v192, v465 : u32; + hir.assertz v194 #[code = 250]; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v189; + v196 = arith.constant 16 : i32; + v197 = arith.add v143, v196 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v136, v197) v464 = arith.constant 32 : i32; - v264 = arith.add v208, v464 : i32 #[overflow = wrapping]; - v265 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v266 = hir.bitcast v265 : ptr; - hir.store v266, v264; + v199 = arith.add v143, v464 : i32 #[overflow = wrapping]; + v200 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v201 = hir.bitcast v200 : ptr; + hir.store v201, v199; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::add_asset_to_note(v267: i32, v268: i32, v269: felt) { - ^block30(v267: i32, v268: i32, v269: felt): - v271 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v272 = hir.bitcast v271 : ptr; - v273 = hir.load v272 : i32; - v274 = arith.constant 48 : i32; - v275 = arith.sub v273, v274 : i32 #[overflow = wrapping]; - v276 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v277 = hir.bitcast v276 : ptr; - hir.store v277, v275; - v279 = arith.constant 12 : u32; - v278 = hir.bitcast v268 : u32; - v280 = arith.add v278, v279 : u32 #[overflow = checked]; - v281 = arith.constant 4 : u32; - v282 = arith.mod v280, v281 : u32; - hir.assertz v282 #[code = 250]; - v283 = hir.int_to_ptr v280 : ptr; - v284 = hir.load v283 : felt; - v286 = arith.constant 8 : u32; - v285 = hir.bitcast v268 : u32; - v287 = arith.add v285, v286 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::tx::add_asset_to_note(v202: i32, v203: i32, v204: felt) { + ^block21(v202: i32, v203: i32, v204: felt): + v206 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v207 = hir.bitcast v206 : ptr; + v208 = hir.load v207 : i32; + v209 = arith.constant 48 : i32; + v210 = arith.sub v208, v209 : i32 #[overflow = wrapping]; + v211 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v212 = hir.bitcast v211 : ptr; + hir.store v212, v210; + v214 = arith.constant 12 : u32; + v213 = hir.bitcast v203 : u32; + v215 = arith.add v213, v214 : u32 #[overflow = checked]; + v216 = arith.constant 4 : u32; + v217 = arith.mod v215, v216 : u32; + hir.assertz v217 #[code = 250]; + v218 = hir.int_to_ptr v215 : ptr; + v219 = hir.load v218 : felt; + v221 = arith.constant 8 : u32; + v220 = hir.bitcast v203 : u32; + v222 = arith.add v220, v221 : u32 #[overflow = checked]; v486 = arith.constant 4 : u32; - v289 = arith.mod v287, v486 : u32; - hir.assertz v289 #[code = 250]; - v290 = hir.int_to_ptr v287 : ptr; - v291 = hir.load v290 : felt; + v224 = arith.mod v222, v486 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : felt; v485 = arith.constant 4 : u32; - v292 = hir.bitcast v268 : u32; - v294 = arith.add v292, v485 : u32 #[overflow = checked]; + v227 = hir.bitcast v203 : u32; + v229 = arith.add v227, v485 : u32 #[overflow = checked]; v484 = arith.constant 4 : u32; - v296 = arith.mod v294, v484 : u32; - hir.assertz v296 #[code = 250]; - v297 = hir.int_to_ptr v294 : ptr; - v298 = hir.load v297 : felt; - v299 = hir.bitcast v268 : u32; + v231 = arith.mod v229, v484 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + v233 = hir.load v232 : felt; + v234 = hir.bitcast v203 : u32; v483 = arith.constant 4 : u32; - v301 = arith.mod v299, v483 : u32; - hir.assertz v301 #[code = 250]; - v302 = hir.int_to_ptr v299 : ptr; - v303 = hir.load v302 : felt; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_base_sys::bindings::tx::extern_tx_add_asset_to_note(v284, v291, v298, v303, v269, v275) + v236 = arith.mod v234, v483 : u32; + hir.assertz v236 #[code = 250]; + v237 = hir.int_to_ptr v234 : ptr; + v238 = hir.load v237 : felt; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden::tx::add_asset_to_note(v219, v226, v233, v238, v204, v210) v482 = arith.constant 8 : u32; - v304 = hir.bitcast v275 : u32; - v306 = arith.add v304, v482 : u32 #[overflow = checked]; + v239 = hir.bitcast v210 : u32; + v241 = arith.add v239, v482 : u32 #[overflow = checked]; v481 = arith.constant 8 : u32; - v308 = arith.mod v306, v481 : u32; - hir.assertz v308 #[code = 250]; - v309 = hir.int_to_ptr v306 : ptr; - v310 = hir.load v309 : i64; - v312 = arith.constant 40 : u32; - v311 = hir.bitcast v275 : u32; - v313 = arith.add v311, v312 : u32 #[overflow = checked]; + v243 = arith.mod v241, v481 : u32; + hir.assertz v243 #[code = 250]; + v244 = hir.int_to_ptr v241 : ptr; + v245 = hir.load v244 : i64; + v247 = arith.constant 40 : u32; + v246 = hir.bitcast v210 : u32; + v248 = arith.add v246, v247 : u32 #[overflow = checked]; v480 = arith.constant 8 : u32; - v315 = arith.mod v313, v480 : u32; - hir.assertz v315 #[code = 250]; - v316 = hir.int_to_ptr v313 : ptr; - hir.store v316, v310; - v317 = hir.bitcast v275 : u32; + v250 = arith.mod v248, v480 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + hir.store v251, v245; + v252 = hir.bitcast v210 : u32; v479 = arith.constant 8 : u32; - v319 = arith.mod v317, v479 : u32; - hir.assertz v319 #[code = 250]; - v320 = hir.int_to_ptr v317 : ptr; - v321 = hir.load v320 : i64; - v323 = arith.constant 32 : u32; - v322 = hir.bitcast v275 : u32; - v324 = arith.add v322, v323 : u32 #[overflow = checked]; + v254 = arith.mod v252, v479 : u32; + hir.assertz v254 #[code = 250]; + v255 = hir.int_to_ptr v252 : ptr; + v256 = hir.load v255 : i64; + v258 = arith.constant 32 : u32; + v257 = hir.bitcast v210 : u32; + v259 = arith.add v257, v258 : u32 #[overflow = checked]; v478 = arith.constant 8 : u32; - v326 = arith.mod v324, v478 : u32; - hir.assertz v326 #[code = 250]; - v327 = hir.int_to_ptr v324 : ptr; - hir.store v327, v321; - v329 = arith.constant 16 : u32; - v328 = hir.bitcast v275 : u32; - v330 = arith.add v328, v329 : u32 #[overflow = checked]; + v261 = arith.mod v259, v478 : u32; + hir.assertz v261 #[code = 250]; + v262 = hir.int_to_ptr v259 : ptr; + hir.store v262, v256; + v264 = arith.constant 16 : u32; + v263 = hir.bitcast v210 : u32; + v265 = arith.add v263, v264 : u32 #[overflow = checked]; v477 = arith.constant 4 : u32; - v332 = arith.mod v330, v477 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - v334 = hir.load v333 : felt; - v335 = arith.constant 32 : i32; - v336 = arith.add v275, v335 : i32 #[overflow = wrapping]; - hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v267, v336) + v267 = arith.mod v265, v477 : u32; + hir.assertz v267 #[code = 250]; + v268 = hir.int_to_ptr v265 : ptr; + v269 = hir.load v268 : felt; + v270 = arith.constant 32 : i32; + v271 = arith.add v210, v270 : i32 #[overflow = wrapping]; + hir.exec @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/miden_stdlib_sys::intrinsics::word::Word::reverse(v202, v271) v476 = arith.constant 16 : u32; - v337 = hir.bitcast v267 : u32; - v339 = arith.add v337, v476 : u32 #[overflow = checked]; + v272 = hir.bitcast v202 : u32; + v274 = arith.add v272, v476 : u32 #[overflow = checked]; v475 = arith.constant 4 : u32; - v341 = arith.mod v339, v475 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v334; + v276 = arith.mod v274, v475 : u32; + hir.assertz v276 #[code = 250]; + v277 = hir.int_to_ptr v274 : ptr; + hir.store v277, v269; v474 = arith.constant 48 : i32; - v344 = arith.add v275, v474 : i32 #[overflow = wrapping]; - v345 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr - v346 = hir.bitcast v345 : ptr; - hir.store v346, v344; + v279 = arith.add v210, v474 : i32 #[overflow = wrapping]; + v280 = builtin.global_symbol @miden:basic-wallet/basic-wallet@1.0.0/basic_wallet/__stack_pointer : ptr + v281 = hir.bitcast v280 : ptr; + hir.store v281, v279; + builtin.ret ; + }; + + private builtin.function @miden::account::add_asset(v282: felt, v283: felt, v284: felt, v285: felt, v286: i32) { + ^block23(v282: felt, v283: felt, v284: felt, v285: felt, v286: i32): + v287, v288, v289, v290 = hir.exec @miden/account/add_asset(v282, v283, v284, v285) : felt, felt, felt, felt + v291 = hir.bitcast v286 : u32; + v292 = hir.int_to_ptr v291 : ptr; + hir.store v292, v287; + v293 = arith.constant 4 : u32; + v294 = arith.add v291, v293 : u32 #[overflow = checked]; + v295 = hir.int_to_ptr v294 : ptr; + hir.store v295, v288; + v296 = arith.constant 8 : u32; + v297 = arith.add v291, v296 : u32 #[overflow = checked]; + v298 = hir.int_to_ptr v297 : ptr; + hir.store v298, v289; + v299 = arith.constant 12 : u32; + v300 = arith.add v291, v299 : u32 #[overflow = checked]; + v301 = hir.int_to_ptr v300 : ptr; + hir.store v301, v290; + builtin.ret ; + }; + + private builtin.function @miden::account::remove_asset(v302: felt, v303: felt, v304: felt, v305: felt, v306: i32) { + ^block27(v302: felt, v303: felt, v304: felt, v305: felt, v306: i32): + v307, v308, v309, v310 = hir.exec @miden/account/remove_asset(v302, v303, v304, v305) : felt, felt, felt, felt + v311 = hir.bitcast v306 : u32; + v312 = hir.int_to_ptr v311 : ptr; + hir.store v312, v307; + v313 = arith.constant 4 : u32; + v314 = arith.add v311, v313 : u32 #[overflow = checked]; + v315 = hir.int_to_ptr v314 : ptr; + hir.store v315, v308; + v316 = arith.constant 8 : u32; + v317 = arith.add v311, v316 : u32 #[overflow = checked]; + v318 = hir.int_to_ptr v317 : ptr; + hir.store v318, v309; + v319 = arith.constant 12 : u32; + v320 = arith.add v311, v319 : u32 #[overflow = checked]; + v321 = hir.int_to_ptr v320 : ptr; + hir.store v321, v310; + builtin.ret ; + }; + + private builtin.function @miden::tx::add_asset_to_note(v322: felt, v323: felt, v324: felt, v325: felt, v326: felt, v327: i32) { + ^block29(v322: felt, v323: felt, v324: felt, v325: felt, v326: felt, v327: i32): + v328, v329, v330, v331, v332 = hir.exec @miden/tx/add_asset_to_note(v322, v323, v324, v325, v326) : felt, felt, felt, felt, felt + v333 = hir.bitcast v327 : u32; + v334 = hir.int_to_ptr v333 : ptr; + hir.store v334, v328; + v335 = arith.constant 4 : u32; + v336 = arith.add v333, v335 : u32 #[overflow = checked]; + v337 = hir.int_to_ptr v336 : ptr; + hir.store v337, v329; + v338 = arith.constant 8 : u32; + v339 = arith.add v333, v338 : u32 #[overflow = checked]; + v340 = hir.int_to_ptr v339 : ptr; + hir.store v340, v330; + v341 = arith.constant 12 : u32; + v342 = arith.add v333, v341 : u32 #[overflow = checked]; + v343 = hir.int_to_ptr v342 : ptr; + hir.store v343, v331; + v344 = arith.constant 16 : u32; + v345 = arith.add v333, v344 : u32 #[overflow = checked]; + v346 = hir.int_to_ptr v345 : ptr; + hir.store v346, v332; builtin.ret ; }; @@ -571,7 +571,7 @@ builtin.component miden:basic-wallet/basic-wallet@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000000000000100000001; }; public builtin.function @receive-asset(v436: felt, v437: felt, v438: felt, v439: felt) { diff --git a/tests/integration/expected/examples/basic_wallet.masm b/tests/integration/expected/examples/basic_wallet.masm index 9d2c8ab74..3d8c3d321 100644 --- a/tests/integration/expected/examples/basic_wallet.masm +++ b/tests/integration/expected/examples/basic_wallet.masm @@ -25,212 +25,27 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.17709194624399802691 - push.16317546024271837059 - push.2378870773206530087 - push.4951894414315594265 + push.7028007876379170725 + push.18060021366771303825 + push.13412364500725888848 + push.14178532912296021363 adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + mem_store.278537 end # mod miden:basic-wallet/basic-wallet@1.0.0::basic_wallet -proc.miden_base_sys::bindings::account::extern_account_add_asset - trace.240 - nop - exec.::miden::account::add_asset - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - -proc.miden_base_sys::bindings::account::extern_account_remove_asset - trace.240 - nop - exec.::miden::account::remove_asset - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - -proc.miden_base_sys::bindings::tx::extern_tx_add_asset_to_note - trace.240 - nop - exec.::miden::tx::add_asset_to_note - trace.252 - nop - movup.5 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.16 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - proc.__wasm_call_ctors nop end @@ -240,7 +55,7 @@ proc.basic_wallet::bindings::__link_custom_section_describing_imports end export.miden:basic-wallet/basic-wallet@1.0.0#receive-asset - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -250,7 +65,7 @@ export.miden:basic-wallet/basic-wallet@1.0.0#receive-asset nop push.32 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -351,7 +166,7 @@ export.miden:basic-wallet/basic-wallet@1.0.0#receive-asset nop push.32 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -362,7 +177,7 @@ export.miden:basic-wallet/basic-wallet@1.0.0#receive-asset end export.miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -372,7 +187,7 @@ export.miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note nop push.64 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -489,7 +304,7 @@ export.miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note nop push.64 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -500,7 +315,7 @@ export.miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note end proc.wit_bindgen_rt::run_ctors_once - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -508,7 +323,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048624 + push.1048584 u32wrapping_add u32divmod.4 swap.1 @@ -529,7 +344,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -543,7 +358,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048624 + push.1048584 movup.2 swap.1 u32wrapping_add @@ -641,13 +456,13 @@ proc.miden_base_sys::bindings::account::add_asset swap.2 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@1.0.0::basic_wallet::miden_base_sys::bindings::account::extern_account_add_asset + exec.::miden:basic-wallet/basic-wallet@1.0.0::basic_wallet::miden::account::add_asset trace.252 nop end proc.miden_base_sys::bindings::account::remove_asset - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -657,7 +472,7 @@ proc.miden_base_sys::bindings::account::remove_asset nop push.32 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -739,7 +554,7 @@ proc.miden_base_sys::bindings::account::remove_asset swap.4 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@1.0.0::basic_wallet::miden_base_sys::bindings::account::extern_account_remove_asset + exec.::miden:basic-wallet/basic-wallet@1.0.0::basic_wallet::miden::account::remove_asset trace.252 nop push.8 @@ -819,7 +634,7 @@ proc.miden_base_sys::bindings::account::remove_asset nop push.32 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -830,7 +645,7 @@ proc.miden_base_sys::bindings::account::remove_asset end proc.miden_base_sys::bindings::tx::add_asset_to_note - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -840,7 +655,7 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note nop push.48 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -924,7 +739,7 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note swap.4 trace.240 nop - exec.::miden:basic-wallet/basic-wallet@1.0.0::basic_wallet::miden_base_sys::bindings::tx::extern_tx_add_asset_to_note + exec.::miden:basic-wallet/basic-wallet@1.0.0::basic_wallet::miden::tx::add_asset_to_note trace.252 nop push.8 @@ -1038,7 +853,7 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note nop push.48 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1048,8 +863,193 @@ proc.miden_base_sys::bindings::tx::add_asset_to_note nop end +proc.miden::account::add_asset + trace.240 + nop + exec.::miden::account::add_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +proc.miden::account::remove_asset + trace.240 + nop + exec.::miden::account::remove_asset + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +proc.miden::tx::add_asset_to_note + trace.240 + nop + exec.::miden::tx::add_asset_to_note + trace.252 + nop + movup.5 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + proc.miden_stdlib_sys::intrinsics::word::Word::reverse - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/examples/basic_wallet.wat b/tests/integration/expected/examples/basic_wallet.wat index b49dac930..690ec4d2d 100644 --- a/tests/integration/expected/examples/basic_wallet.wat +++ b/tests/integration/expected/examples/basic_wallet.wat @@ -1,20 +1,5 @@ (component (type (;0;) - (instance - (type (;0;) (func (param "asset0" f32) (param "asset1" f32) (param "asset2" f32) (param "asset3" f32) (param "result-ptr" s32))) - (export (;0;) "add-asset" (func (type 0))) - (export (;1;) "remove-asset" (func (type 0))) - ) - ) - (import "miden:core-base/account@1.0.0" (instance (;0;) (type 0))) - (type (;1;) - (instance - (type (;0;) (func (param "asset0" f32) (param "asset1" f32) (param "asset2" f32) (param "asset3" f32) (param "note-idx" f32) (param "result-ptr" s32))) - (export (;0;) "add-asset-to-note" (func (type 0))) - ) - ) - (import "miden:core-base/tx@1.0.0" (instance (;1;) (type 1))) - (type (;2;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -35,18 +20,15 @@ (export (;16;) "note-execution-hint" (type (eq 15))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;2;) (type 2))) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) (core module (;0;) - (type (;0;) (func (param f32 f32 f32 f32 i32))) - (type (;1;) (func (param f32 f32 f32 f32 f32 i32))) - (type (;2;) (func)) - (type (;3;) (func (param f32 f32 f32 f32))) - (type (;4;) (func (param f32 f32 f32 f32 f32))) - (type (;5;) (func (param i32 i32))) - (type (;6;) (func (param i32 i32 f32))) - (import "miden:core-base/account@1.0.0" "add-asset" (func $miden_base_sys::bindings::account::extern_account_add_asset (;0;) (type 0))) - (import "miden:core-base/account@1.0.0" "remove-asset" (func $miden_base_sys::bindings::account::extern_account_remove_asset (;1;) (type 0))) - (import "miden:core-base/tx@1.0.0" "add-asset-to-note" (func $miden_base_sys::bindings::tx::extern_tx_add_asset_to_note (;2;) (type 1))) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32))) + (type (;2;) (func (param f32 f32 f32 f32 f32))) + (type (;3;) (func (param i32 i32))) + (type (;4;) (func (param i32 i32 f32))) + (type (;5;) (func (param f32 f32 f32 f32 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) @@ -55,9 +37,9 @@ (export "miden:basic-wallet/basic-wallet@1.0.0#receive-asset" (func $miden:basic-wallet/basic-wallet@1.0.0#receive-asset)) (export "miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note" (func $miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note)) (elem (;0;) (i32.const 1) func $basic_wallet::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;3;) (type 2)) - (func $basic_wallet::bindings::__link_custom_section_describing_imports (;4;) (type 2)) - (func $miden:basic-wallet/basic-wallet@1.0.0#receive-asset (;5;) (type 3) (param f32 f32 f32 f32) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $basic_wallet::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:basic-wallet/basic-wallet@1.0.0#receive-asset (;2;) (type 1) (param f32 f32 f32 f32) (local i32) global.get $__stack_pointer i32.const 32 @@ -87,7 +69,7 @@ i32.add global.set $__stack_pointer ) - (func $miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note (;6;) (type 4) (param f32 f32 f32 f32 f32) + (func $miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note (;3;) (type 2) (param f32 f32 f32 f32 f32) (local i32) global.get $__stack_pointer i32.const 64 @@ -125,11 +107,11 @@ i32.add global.set $__stack_pointer ) - (func $wit_bindgen_rt::run_ctors_once (;7;) (type 2) + (func $wit_bindgen_rt::run_ctors_once (;4;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048624 + i32.const 1048584 i32.add i32.load8_u br_if 0 (;@1;) @@ -137,13 +119,13 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048624 + i32.const 1048584 i32.add i32.const 1 i32.store8 end ) - (func $miden_base_sys::bindings::account::add_asset (;8;) (type 5) (param i32 i32) + (func $miden_base_sys::bindings::account::add_asset (;5;) (type 3) (param i32 i32) local.get 1 f32.load offset=12 local.get 1 @@ -153,9 +135,9 @@ local.get 1 f32.load local.get 0 - call $miden_base_sys::bindings::account::extern_account_add_asset + call $miden::account::add_asset ) - (func $miden_base_sys::bindings::account::remove_asset (;9;) (type 5) (param i32 i32) + (func $miden_base_sys::bindings::account::remove_asset (;6;) (type 3) (param i32 i32) (local i32) global.get $__stack_pointer i32.const 32 @@ -171,7 +153,7 @@ local.get 1 f32.load local.get 2 - call $miden_base_sys::bindings::account::extern_account_remove_asset + call $miden::account::remove_asset local.get 2 local.get 2 i64.load offset=8 @@ -190,7 +172,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::tx::add_asset_to_note (;10;) (type 6) (param i32 i32 f32) + (func $miden_base_sys::bindings::tx::add_asset_to_note (;7;) (type 4) (param i32 i32 f32) (local i32) global.get $__stack_pointer i32.const 48 @@ -207,7 +189,7 @@ f32.load local.get 2 local.get 3 - call $miden_base_sys::bindings::tx::extern_tx_add_asset_to_note + call $miden::tx::add_asset_to_note local.get 3 local.get 3 i64.load offset=8 @@ -232,7 +214,16 @@ i32.add global.set $__stack_pointer ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;11;) (type 5) (param i32 i32) + (func $miden::account::add_asset (;8;) (type 5) (param f32 f32 f32 f32 i32) + unreachable + ) + (func $miden::account::remove_asset (;9;) (type 5) (param f32 f32 f32 f32 i32) + unreachable + ) + (func $miden::tx::add_asset_to_note (;10;) (type 6) (param f32 f32 f32 f32 f32 i32) + unreachable + ) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;11;) (type 3) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -290,49 +281,32 @@ i64.load align=4 i64.store ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00") + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") (@custom "rodata,miden_account" (after data) "\19basic_wallet\01\0b0.1.0\03\01\01") ) - (alias export 2 "asset" (type (;3;))) - (alias export 2 "tag" (type (;4;))) - (alias export 2 "recipient" (type (;5;))) - (alias export 2 "note-type" (type (;6;))) - (alias export 2 "note-idx" (type (;7;))) - (alias export 2 "felt" (type (;8;))) - (alias export 2 "note-execution-hint" (type (;9;))) - (alias export 0 "add-asset" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 0 "remove-asset" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (core instance (;0;) - (export "add-asset" (func 0)) - (export "remove-asset" (func 1)) - ) - (alias export 1 "add-asset-to-note" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (core instance (;1;) - (export "add-asset-to-note" (func 2)) - ) - (core instance (;2;) (instantiate 0 - (with "miden:core-base/account@1.0.0" (instance 0)) - (with "miden:core-base/tx@1.0.0" (instance 1)) - ) - ) - (alias core export 2 "memory" (core memory (;0;))) - (type (;10;) (func (param "asset" 3))) - (alias core export 2 "miden:basic-wallet/basic-wallet@1.0.0#receive-asset" (core func (;3;))) - (func (;3;) (type 10) (canon lift (core func 3))) - (type (;11;) (func (param "asset" 3) (param "note-idx" 7))) - (alias core export 2 "miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note" (core func (;4;))) - (func (;4;) (type 11) (canon lift (core func 4))) - (alias export 2 "felt" (type (;12;))) - (alias export 2 "word" (type (;13;))) - (alias export 2 "asset" (type (;14;))) - (alias export 2 "tag" (type (;15;))) - (alias export 2 "recipient" (type (;16;))) - (alias export 2 "note-type" (type (;17;))) - (alias export 2 "note-idx" (type (;18;))) - (alias export 2 "note-execution-hint" (type (;19;))) + (alias export 0 "asset" (type (;1;))) + (alias export 0 "tag" (type (;2;))) + (alias export 0 "recipient" (type (;3;))) + (alias export 0 "note-type" (type (;4;))) + (alias export 0 "note-idx" (type (;5;))) + (alias export 0 "felt" (type (;6;))) + (alias export 0 "note-execution-hint" (type (;7;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;8;) (func (param "asset" 1))) + (alias core export 0 "miden:basic-wallet/basic-wallet@1.0.0#receive-asset" (core func (;0;))) + (func (;0;) (type 8) (canon lift (core func 0))) + (type (;9;) (func (param "asset" 1) (param "note-idx" 5))) + (alias core export 0 "miden:basic-wallet/basic-wallet@1.0.0#move-asset-to-note" (core func (;1;))) + (func (;1;) (type 9) (canon lift (core func 1))) + (alias export 0 "felt" (type (;10;))) + (alias export 0 "word" (type (;11;))) + (alias export 0 "asset" (type (;12;))) + (alias export 0 "tag" (type (;13;))) + (alias export 0 "recipient" (type (;14;))) + (alias export 0 "note-type" (type (;15;))) + (alias export 0 "note-idx" (type (;16;))) + (alias export 0 "note-execution-hint" (type (;17;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -369,20 +343,20 @@ (type (;29;) (func (param "asset" 21) (param "note-idx" 25))) (export (;3;) "move-asset-to-note" (func 1) (func (type 29))) ) - (instance (;3;) (instantiate 0 - (with "import-func-receive-asset" (func 3)) - (with "import-func-move-asset-to-note" (func 4)) - (with "import-type-felt" (type 12)) - (with "import-type-word" (type 13)) - (with "import-type-asset" (type 14)) - (with "import-type-tag" (type 15)) - (with "import-type-recipient" (type 16)) - (with "import-type-note-type" (type 17)) - (with "import-type-note-idx" (type 18)) - (with "import-type-note-execution-hint" (type 19)) - (with "import-type-asset0" (type 3)) - (with "import-type-note-idx0" (type 7)) + (instance (;1;) (instantiate 0 + (with "import-func-receive-asset" (func 0)) + (with "import-func-move-asset-to-note" (func 1)) + (with "import-type-felt" (type 10)) + (with "import-type-word" (type 11)) + (with "import-type-asset" (type 12)) + (with "import-type-tag" (type 13)) + (with "import-type-recipient" (type 14)) + (with "import-type-note-type" (type 15)) + (with "import-type-note-idx" (type 16)) + (with "import-type-note-execution-hint" (type 17)) + (with "import-type-asset0" (type 1)) + (with "import-type-note-idx0" (type 5)) ) ) - (export (;4;) "miden:basic-wallet/basic-wallet@1.0.0" (instance 3)) + (export (;2;) "miden:basic-wallet/basic-wallet@1.0.0" (instance 1)) ) diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.hir b/tests/integration/expected/examples/basic_wallet_tx_script.hir index faa1162f6..df5e86ce7 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.hir +++ b/tests/integration/expected/examples/basic_wallet_tx_script.hir @@ -1,1217 +1,1254 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.module public @basic_wallet_tx_script { - private builtin.function @miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory(v0: felt, v1: i32, v2: felt, v3: felt, v4: felt, v5: felt) -> i32 { - ^block5(v0: felt, v1: i32, v2: felt, v3: felt, v4: felt, v5: felt): - v6 = hir.exec @std/mem/pipe_preimage_to_memory(v0, v1, v2, v3, v4, v5) : i32 - builtin.ret v6; - }; - - private builtin.function @basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9(v8: felt, v9: felt, v10: felt, v11: felt, v12: felt) { - ^block9(v8: felt, v9: felt, v10: felt, v11: felt, v12: felt): - hir.call v8, v9, v10, v11, v12 #[callee = miden:basic-wallet/basic-wallet@1.0.0/move-asset-to-note] #[signature = (param felt) (param felt) (param felt) (param felt) (param felt)]; + 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) { + ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt): + hir.call v0, v1, v2, v3, v4 #[callee = miden:basic-wallet/basic-wallet@1.0.0/move-asset-to-note] #[signature = (param felt) (param felt) (param felt) (param felt) (param felt)]; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::tx::extern_tx_create_note(v13: felt, v14: felt, v15: felt, v16: felt, v17: felt, v18: felt, v19: felt, v20: felt) -> felt { - ^block13(v13: felt, v14: felt, v15: felt, v16: felt, v17: felt, v18: felt, v19: felt, v20: felt): - v21 = hir.exec @miden/tx/create_note(v13, v14, v15, v16, v17, v18, v19, v20) : felt - builtin.ret v21; - }; - private builtin.function @__wasm_call_ctors() { - ^block19: + ^block8: builtin.ret ; }; - private builtin.function @core::slice::index::slice_end_index_len_fail(v23: i32, v24: i32, v25: i32) { - ^block21(v23: i32, v24: i32, v25: i32): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v23, v24, v25) + private builtin.function @core::slice::index::slice_end_index_len_fail(v5: i32, v6: i32, v7: i32) { + ^block10(v5: i32, v6: i32, v7: i32): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v5, v6, v7) ub.unreachable ; }; - private builtin.function @ as core::ops::index::Index>::index(v26: i32, v27: i32, v28: i32, v29: i32, v30: i32) { - ^block23(v26: i32, v27: i32, v28: i32, v29: i32, v30: i32): - v33 = arith.constant 8 : u32; - v32 = hir.bitcast v27 : u32; - v34 = arith.add v32, v33 : u32 #[overflow = checked]; - v35 = arith.constant 4 : u32; - v36 = arith.mod v34, v35 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - v38 = hir.load v37 : i32; - v31 = arith.constant 0 : i32; - v40 = hir.bitcast v38 : u32; - v39 = hir.bitcast v29 : u32; - v41 = arith.lte v39, v40 : i1; - v42 = arith.zext v41 : u32; - v43 = hir.bitcast v42 : i32; - v45 = arith.neq v43, v31 : i1; - cf.cond_br v45 ^block25, ^block26; - ^block25: - v896 = arith.constant 4 : u32; - v47 = hir.bitcast v26 : u32; - v49 = arith.add v47, v896 : u32 #[overflow = checked]; - v895 = arith.constant 4 : u32; - v51 = arith.mod v49, v895 : u32; - hir.assertz v51 #[code = 250]; - v46 = arith.sub v29, v28 : i32 #[overflow = wrapping]; - v52 = hir.int_to_ptr v49 : ptr; - hir.store v52, v46; - v894 = arith.constant 4 : u32; - v53 = hir.bitcast v27 : u32; - v55 = arith.add v53, v894 : u32 #[overflow = checked]; - v893 = arith.constant 4 : u32; - v57 = arith.mod v55, v893 : u32; - hir.assertz v57 #[code = 250]; - v58 = hir.int_to_ptr v55 : ptr; - v59 = hir.load v58 : i32; - v64 = hir.bitcast v26 : u32; - v892 = arith.constant 4 : u32; - v66 = arith.mod v64, v892 : u32; - hir.assertz v66 #[code = 250]; - v890 = arith.constant 2 : u32; - v62 = arith.shl v28, v890 : i32; - v63 = arith.add v59, v62 : i32 #[overflow = wrapping]; - v67 = hir.int_to_ptr v64 : ptr; - hir.store v67, v63; + private builtin.function @ as core::ops::index::Index>::index(v8: i32, v9: i32, v10: i32, v11: i32, v12: i32) { + ^block12(v8: i32, v9: i32, v10: i32, v11: i32, v12: i32): + v15 = arith.constant 8 : u32; + v14 = hir.bitcast v9 : u32; + v16 = arith.add v14, v15 : u32 #[overflow = checked]; + v17 = arith.constant 4 : u32; + v18 = arith.mod v16, v17 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + v20 = hir.load v19 : i32; + v13 = arith.constant 0 : i32; + v22 = hir.bitcast v20 : u32; + v21 = hir.bitcast v11 : u32; + v23 = arith.lte v21, v22 : i1; + v24 = arith.zext v23 : u32; + v25 = hir.bitcast v24 : i32; + v27 = arith.neq v25, v13 : i1; + cf.cond_br v27 ^block14, ^block15; + ^block14: + v915 = arith.constant 4 : u32; + v29 = hir.bitcast v8 : u32; + v31 = arith.add v29, v915 : u32 #[overflow = checked]; + v914 = arith.constant 4 : u32; + v33 = arith.mod v31, v914 : u32; + hir.assertz v33 #[code = 250]; + v28 = arith.sub v11, v10 : i32 #[overflow = wrapping]; + v34 = hir.int_to_ptr v31 : ptr; + hir.store v34, v28; + v913 = arith.constant 4 : u32; + v35 = hir.bitcast v9 : u32; + v37 = arith.add v35, v913 : u32 #[overflow = checked]; + v912 = arith.constant 4 : u32; + v39 = arith.mod v37, v912 : u32; + hir.assertz v39 #[code = 250]; + v40 = hir.int_to_ptr v37 : ptr; + v41 = hir.load v40 : i32; + v46 = hir.bitcast v8 : u32; + v911 = arith.constant 4 : u32; + v48 = arith.mod v46, v911 : u32; + hir.assertz v48 #[code = 250]; + v909 = arith.constant 2 : u32; + v44 = arith.shl v10, v909 : i32; + v45 = arith.add v41, v44 : i32 #[overflow = wrapping]; + v49 = hir.int_to_ptr v46 : ptr; + hir.store v49, v45; builtin.ret ; - ^block26: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_end_index_len_fail(v29, v38, v30) + ^block15: + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::slice::index::slice_end_index_len_fail(v11, v20, v12) ub.unreachable ; }; private builtin.function @basic_wallet_tx_script::bindings::__link_custom_section_describing_imports() { - ^block27: + ^block16: builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc(v68: i32, v69: i32) -> i32 { - ^block29(v68: i32, v69: i32): - 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; - v74 = arith.constant 1048728 : i32; - v75 = arith.add v73, v74 : i32 #[overflow = wrapping]; - v76 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v75, v69, v68) : i32 - builtin.ret v76; + private builtin.function @__rustc::__rust_alloc(v50: i32, v51: i32) -> i32 { + ^block18(v50: i32, v51: i32): + v53 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v54 = hir.bitcast v53 : ptr; + v55 = hir.load v54 : i32; + v56 = arith.constant 1048688 : i32; + v57 = arith.add v55, v56 : i32 #[overflow = wrapping]; + v58 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v57, v51, v50) : i32 + builtin.ret v58; }; - private builtin.function @__rustc::__rust_dealloc(v77: i32, v78: i32, v79: i32) { - ^block31(v77: i32, v78: i32, v79: i32): + private builtin.function @__rustc::__rust_dealloc(v59: i32, v60: i32, v61: i32) { + ^block20(v59: i32, v60: i32, v61: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v80: i32, v81: i32) -> i32 { - ^block33(v80: i32, v81: i32): - v83 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v84 = hir.bitcast v83 : ptr; - v85 = hir.load v84 : i32; - v86 = arith.constant 1048728 : i32; - v87 = arith.add v85, v86 : i32 #[overflow = wrapping]; - v88 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v87, v81, v80) : i32 - v905 = arith.constant 0 : i32; - v89 = arith.constant 0 : i32; - v90 = arith.eq v88, v89 : i1; - v91 = arith.zext v90 : u32; - v92 = hir.bitcast v91 : i32; - v94 = arith.neq v92, v905 : i1; - scf.if v94{ - ^block35: + private builtin.function @__rustc::__rust_alloc_zeroed(v62: i32, v63: i32) -> i32 { + ^block22(v62: i32, v63: i32): + v65 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v66 = hir.bitcast v65 : ptr; + v67 = hir.load v66 : i32; + v68 = arith.constant 1048688 : i32; + v69 = arith.add v67, v68 : i32 #[overflow = wrapping]; + v70 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::alloc(v69, v63, v62) : i32 + v924 = arith.constant 0 : i32; + v71 = arith.constant 0 : i32; + v72 = arith.eq v70, v71 : i1; + v73 = arith.zext v72 : u32; + v74 = hir.bitcast v73 : i32; + v76 = arith.neq v74, v924 : i1; + scf.if v76{ + ^block24: scf.yield ; } else { - ^block36: - v903 = arith.constant 0 : i32; - v904 = arith.constant 0 : i32; - v96 = arith.eq v80, v904 : i1; - v97 = arith.zext v96 : u32; - v98 = hir.bitcast v97 : i32; - v100 = arith.neq v98, v903 : i1; - scf.if v100{ - ^block110: + ^block25: + v922 = arith.constant 0 : i32; + v923 = arith.constant 0 : i32; + v78 = arith.eq v62, v923 : i1; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v922 : i1; + scf.if v82{ + ^block122: scf.yield ; } else { - ^block37: - v897 = arith.constant 0 : u8; - v103 = hir.bitcast v80 : u32; - v104 = hir.bitcast v88 : u32; - v105 = hir.int_to_ptr v104 : ptr; - hir.mem_set v105, v103, v897; + ^block26: + v916 = arith.constant 0 : u8; + v85 = hir.bitcast v62 : u32; + v86 = hir.bitcast v70 : u32; + v87 = hir.int_to_ptr v86 : ptr; + hir.mem_set v87, v85, v916; scf.yield ; }; scf.yield ; }; - builtin.ret v88; + builtin.ret v70; }; - public builtin.function @miden:base/transaction-script@1.0.0#run(v107: felt, v108: felt, v109: felt, v110: felt) { - ^block38(v107: felt, v108: felt, v109: felt, v110: felt): - v115 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v116 = hir.bitcast v115 : ptr; - v117 = hir.load v116 : i32; - v118 = arith.constant 80 : i32; - v119 = arith.sub v117, v118 : i32 #[overflow = wrapping]; - v120 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v121 = hir.bitcast v120 : ptr; - hir.store v121, v119; + public builtin.function @miden:base/transaction-script@1.0.0#run(v89: felt, v90: felt, v91: felt, v92: felt) { + ^block27(v89: felt, v90: felt, v91: felt, v92: felt): + v97 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v98 = hir.bitcast v97 : ptr; + v99 = hir.load v98 : i32; + v100 = arith.constant 80 : i32; + v101 = arith.sub v99, v100 : i32 #[overflow = wrapping]; + v102 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v103 = hir.bitcast v102 : ptr; + hir.store v103, v101; hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/wit_bindgen_rt::run_ctors_once() - v122 = hir.exec @intrinsics/advice/adv_push_mapvaln(v110, v109, v108, v107) : felt - v123 = hir.cast v122 : i64; - v908 = arith.constant 0 : felt; - v125 = arith.constant 3 : i32; - v124 = arith.trunc v123 : i32; - v126 = arith.band v124, v125 : i32; - v127 = hir.bitcast v126 : felt; - hir.assert_eq v127, v908; - v132 = arith.constant 2 : i64; - v134 = hir.cast v132 : u32; - v133 = hir.bitcast v123 : u64; - v135 = arith.shr v133, v134 : u64; - v136 = hir.bitcast v135 : i64; - v137 = hir.cast v136 : felt; - v907 = arith.constant 2 : u32; - v138 = hir.cast v137 : i64; - v139 = arith.trunc v138 : i32; - v142 = arith.shl v139, v907 : i32; - v144 = arith.constant 4 : i32; - v111 = arith.constant 0 : i32; - v130 = arith.constant 64 : i32; - v131 = arith.add v119, v130 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::try_allocate_in(v131, v142, v111, v144, v144) - v147 = arith.constant 68 : u32; - v146 = hir.bitcast v119 : u32; - v148 = arith.add v146, v147 : u32 #[overflow = checked]; - v149 = arith.constant 4 : u32; - v150 = arith.mod v148, v149 : u32; - hir.assertz v150 #[code = 250]; - v151 = hir.int_to_ptr v148 : ptr; - v152 = hir.load v151 : i32; - v154 = arith.constant 64 : u32; - v153 = hir.bitcast v119 : u32; - v155 = arith.add v153, v154 : u32 #[overflow = checked]; - v983 = arith.constant 4 : u32; - v157 = arith.mod v155, v983 : u32; - hir.assertz v157 #[code = 250]; - v158 = hir.int_to_ptr v155 : ptr; - v159 = hir.load v158 : i32; - v982 = arith.constant 0 : i32; - v160 = arith.constant 1 : i32; - v161 = arith.eq v159, v160 : i1; - v162 = arith.zext v161 : u32; - v163 = hir.bitcast v162 : i32; - v165 = arith.neq v163, v982 : i1; - v913 = scf.if v165 : u32 { - ^block41: - v386 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v387 = hir.bitcast v386 : ptr; - v388 = hir.load v387 : i32; - v390 = arith.constant 72 : u32; - v389 = hir.bitcast v119 : u32; - v391 = arith.add v389, v390 : u32 #[overflow = checked]; - v981 = arith.constant 4 : u32; - v393 = arith.mod v391, v981 : u32; - hir.assertz v393 #[code = 250]; - v394 = hir.int_to_ptr v391 : ptr; - v395 = hir.load v394 : i32; - v396 = arith.constant 1048680 : i32; - v397 = arith.add v388, v396 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v152, v395, v397) - v909 = arith.constant 0 : u32; - scf.yield v909; + v104 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::advice::adv_push_mapvaln(v92, v91, v90, v89) : felt + v105 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v104) : i64 + v107 = arith.constant 3 : i32; + v106 = arith.trunc v105 : i32; + v108 = arith.band v106, v107 : i32; + v109 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v108) : felt + v93 = arith.constant 0 : i32; + v111 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u32(v93) : felt + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::assert_eq(v109, v111) + v114 = arith.constant 2 : i64; + v116 = hir.cast v114 : u32; + v115 = hir.bitcast v105 : u64; + v117 = arith.shr v115, v116 : u64; + v118 = hir.bitcast v117 : i64; + v119 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::from_u64_unchecked(v118) : felt + v120 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::felt::as_u64(v119) : i64 + v926 = arith.constant 2 : u32; + v121 = arith.trunc v120 : i32; + v124 = arith.shl v121, v926 : i32; + v126 = arith.constant 4 : i32; + v1002 = arith.constant 0 : i32; + v112 = arith.constant 64 : i32; + v113 = arith.add v101, v112 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::try_allocate_in(v113, v124, v1002, v126, v126) + v129 = arith.constant 68 : u32; + v128 = hir.bitcast v101 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v131 = arith.constant 4 : u32; + v132 = arith.mod v130, v131 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : i32; + v136 = arith.constant 64 : u32; + v135 = hir.bitcast v101 : u32; + v137 = arith.add v135, v136 : u32 #[overflow = checked]; + v1001 = arith.constant 4 : u32; + v139 = arith.mod v137, v1001 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : i32; + v1000 = arith.constant 0 : i32; + v142 = arith.constant 1 : i32; + v143 = arith.eq v141, v142 : i1; + v144 = arith.zext v143 : u32; + v145 = hir.bitcast v144 : i32; + v147 = arith.neq v145, v1000 : i1; + v931 = scf.if v147 : u32 { + ^block30: + v368 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v369 = hir.bitcast v368 : ptr; + v370 = hir.load v369 : i32; + v372 = arith.constant 72 : u32; + v371 = hir.bitcast v101 : u32; + v373 = arith.add v371, v372 : u32 #[overflow = checked]; + v999 = arith.constant 4 : u32; + v375 = arith.mod v373, v999 : u32; + hir.assertz v375 #[code = 250]; + v376 = hir.int_to_ptr v373 : ptr; + v377 = hir.load v376 : i32; + v378 = arith.constant 1048640 : i32; + v379 = arith.add v370, v378 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::handle_error(v134, v377, v379) + v927 = arith.constant 0 : u32; + scf.yield v927; } else { - ^block42: - v980 = arith.constant 72 : u32; - v166 = hir.bitcast v119 : u32; - v168 = arith.add v166, v980 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v170 = arith.mod v168, v979 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - v172 = hir.load v171 : i32; - v978 = arith.constant 2 : u32; - v174 = hir.bitcast v172 : u32; - v176 = arith.shr v174, v978 : u32; - v177 = hir.bitcast v176 : i32; - v178 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory(v137, v177, v110, v109, v108, v107) : i32 - v180 = arith.constant 28 : u32; - v179 = hir.bitcast v119 : u32; - v181 = arith.add v179, v180 : u32 #[overflow = checked]; - v977 = arith.constant 4 : u32; - v183 = arith.mod v181, v977 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - hir.store v184, v142; - v186 = arith.constant 24 : u32; - v185 = hir.bitcast v119 : u32; - v187 = arith.add v185, v186 : u32 #[overflow = checked]; - v976 = arith.constant 4 : u32; - v189 = arith.mod v187, v976 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v172; - v192 = arith.constant 20 : u32; - v191 = hir.bitcast v119 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; - v975 = arith.constant 4 : u32; - v195 = arith.mod v193, v975 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - hir.store v196, v152; - v973 = arith.constant 0 : i32; - v974 = arith.constant 0 : i32; - v198 = arith.eq v142, v974 : i1; - v199 = arith.zext v198 : u32; - v200 = hir.bitcast v199 : i32; - v202 = arith.neq v200, v973 : i1; - v915 = scf.if v202 : u32 { - ^block115: - v972 = arith.constant 0 : u32; - scf.yield v972; + ^block31: + v998 = arith.constant 72 : u32; + v148 = hir.bitcast v101 : u32; + v150 = arith.add v148, v998 : u32 #[overflow = checked]; + v997 = arith.constant 4 : u32; + v152 = arith.mod v150, v997 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : i32; + v996 = arith.constant 2 : u32; + v156 = hir.bitcast v154 : u32; + v158 = arith.shr v156, v996 : u32; + v159 = hir.bitcast v158 : i32; + v160 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/std::mem::pipe_preimage_to_memory(v119, v159, v92, v91, v90, v89) : i32 + v162 = arith.constant 28 : u32; + v161 = hir.bitcast v101 : u32; + v163 = arith.add v161, v162 : u32 #[overflow = checked]; + v995 = arith.constant 4 : u32; + v165 = arith.mod v163, v995 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + hir.store v166, v124; + v168 = arith.constant 24 : u32; + v167 = hir.bitcast v101 : u32; + v169 = arith.add v167, v168 : u32 #[overflow = checked]; + v994 = arith.constant 4 : u32; + v171 = arith.mod v169, v994 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v154; + v174 = arith.constant 20 : u32; + v173 = hir.bitcast v101 : u32; + v175 = arith.add v173, v174 : u32 #[overflow = checked]; + v993 = arith.constant 4 : u32; + v177 = arith.mod v175, v993 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + hir.store v178, v134; + v991 = arith.constant 0 : i32; + v992 = arith.constant 0 : i32; + v180 = arith.eq v124, v992 : i1; + v181 = arith.zext v180 : u32; + v182 = hir.bitcast v181 : i32; + v184 = arith.neq v182, v991 : i1; + v933 = scf.if v184 : u32 { + ^block127: + v990 = arith.constant 0 : u32; + scf.yield v990; } else { - ^block43: - v203 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v204 = hir.bitcast v203 : ptr; - v205 = hir.load v204 : i32; - v207 = arith.constant 12 : u32; - v206 = hir.bitcast v172 : u32; - v208 = arith.add v206, v207 : u32 #[overflow = checked]; - v971 = arith.constant 4 : u32; - v210 = arith.mod v208, v971 : u32; - hir.assertz v210 #[code = 250]; - v211 = hir.int_to_ptr v208 : ptr; - v212 = hir.load v211 : felt; - v214 = arith.constant 8 : u32; - v213 = hir.bitcast v172 : u32; - v215 = arith.add v213, v214 : 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; - v969 = arith.constant 4 : u32; - v220 = hir.bitcast v172 : u32; - v222 = arith.add v220, v969 : u32 #[overflow = checked]; - v968 = arith.constant 4 : u32; - v224 = arith.mod v222, v968 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : felt; - v227 = hir.bitcast v172 : u32; - v967 = arith.constant 4 : u32; - v229 = arith.mod v227, v967 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - v231 = hir.load v230 : felt; - v238 = arith.constant 1048696 : i32; - v239 = arith.add v205, v238 : i32 #[overflow = wrapping]; - v965 = arith.constant 8 : i32; - v966 = arith.constant 4 : i32; - v234 = arith.constant 20 : i32; - v235 = arith.add v119, v234 : i32 #[overflow = wrapping]; - v232 = arith.constant 8 : i32; - v233 = arith.add v119, v232 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v233, v235, v966, v965, v239) - v964 = arith.constant 12 : u32; - v240 = hir.bitcast v119 : u32; - v242 = arith.add v240, v964 : u32 #[overflow = checked]; - v963 = arith.constant 4 : u32; - v244 = arith.mod v242, v963 : u32; - hir.assertz v244 #[code = 250]; - v245 = hir.int_to_ptr v242 : ptr; - v246 = hir.load v245 : i32; - v961 = arith.constant 0 : i32; - v962 = arith.constant 4 : i32; - v248 = arith.neq v246, v962 : i1; - v249 = arith.zext v248 : u32; - v250 = hir.bitcast v249 : i32; - v252 = arith.neq v250, v961 : i1; - v917 = scf.if v252 : u32 { - ^block114: - v960 = arith.constant 0 : u32; - scf.yield v960; + ^block32: + v185 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v186 = hir.bitcast v185 : ptr; + v187 = hir.load v186 : i32; + v189 = arith.constant 12 : u32; + v188 = hir.bitcast v154 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v989 = arith.constant 4 : u32; + v192 = arith.mod v190, v989 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : felt; + v196 = arith.constant 8 : u32; + v195 = hir.bitcast v154 : u32; + v197 = arith.add v195, v196 : u32 #[overflow = checked]; + v988 = arith.constant 4 : u32; + v199 = arith.mod v197, v988 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + v201 = hir.load v200 : felt; + v987 = arith.constant 4 : u32; + v202 = hir.bitcast v154 : u32; + v204 = arith.add v202, v987 : u32 #[overflow = checked]; + v986 = arith.constant 4 : u32; + v206 = arith.mod v204, v986 : u32; + hir.assertz v206 #[code = 250]; + v207 = hir.int_to_ptr v204 : ptr; + v208 = hir.load v207 : felt; + v209 = hir.bitcast v154 : u32; + v985 = arith.constant 4 : u32; + v211 = arith.mod v209, v985 : u32; + hir.assertz v211 #[code = 250]; + v212 = hir.int_to_ptr v209 : ptr; + v213 = hir.load v212 : felt; + v220 = arith.constant 1048656 : i32; + v221 = arith.add v187, v220 : i32 #[overflow = wrapping]; + v983 = arith.constant 8 : i32; + v984 = arith.constant 4 : i32; + v216 = arith.constant 20 : i32; + v217 = arith.add v101, v216 : i32 #[overflow = wrapping]; + v214 = arith.constant 8 : i32; + v215 = arith.add v101, v214 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v215, v217, v984, v983, v221) + v982 = arith.constant 12 : u32; + v222 = hir.bitcast v101 : u32; + v224 = arith.add v222, v982 : u32 #[overflow = checked]; + v981 = arith.constant 4 : u32; + v226 = arith.mod v224, v981 : u32; + hir.assertz v226 #[code = 250]; + v227 = hir.int_to_ptr v224 : ptr; + v228 = hir.load v227 : i32; + v979 = arith.constant 0 : i32; + v980 = arith.constant 4 : i32; + v230 = arith.neq v228, v980 : i1; + v231 = arith.zext v230 : u32; + v232 = hir.bitcast v231 : i32; + v234 = arith.neq v232, v979 : i1; + v935 = scf.if v234 : u32 { + ^block126: + v978 = arith.constant 0 : u32; + scf.yield v978; } else { - ^block44: - v959 = arith.constant 8 : u32; - v253 = hir.bitcast v119 : u32; - v255 = arith.add v253, v959 : u32 #[overflow = checked]; - v958 = arith.constant 4 : u32; - v257 = arith.mod v255, v958 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - v259 = hir.load v258 : i32; - v260 = hir.bitcast v259 : u32; - v957 = arith.constant 4 : u32; - v262 = arith.mod v260, v957 : u32; - hir.assertz v262 #[code = 250]; - v263 = hir.int_to_ptr v260 : ptr; - v264 = hir.load v263 : i64; - v956 = arith.constant 8 : i32; - v270 = arith.add v259, v956 : i32 #[overflow = wrapping]; - v271 = hir.bitcast v270 : u32; - v955 = arith.constant 4 : u32; - v273 = arith.mod v271, v955 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - v275 = hir.load v274 : i64; - v954 = arith.constant 8 : i32; - v265 = arith.constant 32 : i32; - v266 = arith.add v119, v265 : i32 #[overflow = wrapping]; - v268 = arith.add v266, v954 : i32 #[overflow = wrapping]; - v276 = hir.bitcast v268 : u32; - v953 = arith.constant 8 : u32; - v278 = arith.mod v276, v953 : u32; - hir.assertz v278 #[code = 250]; - v279 = hir.int_to_ptr v276 : ptr; - hir.store v279, v275; - v281 = arith.constant 32 : u32; - v280 = hir.bitcast v119 : u32; - v282 = arith.add v280, v281 : u32 #[overflow = checked]; - v952 = arith.constant 8 : u32; - v284 = arith.mod v282, v952 : u32; - hir.assertz v284 #[code = 250]; - v285 = hir.int_to_ptr v282 : ptr; - hir.store v285, v264; - v286 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v287 = hir.bitcast v286 : ptr; - v288 = hir.load v287 : i32; - v950 = arith.constant 32 : i32; - v292 = arith.add v119, v950 : i32 #[overflow = wrapping]; - v951 = arith.constant 64 : i32; - v290 = arith.add v119, v951 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v290, v292) - v949 = arith.constant 64 : i32; - v294 = arith.add v119, v949 : i32 #[overflow = wrapping]; - v295 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::tx::create_note(v231, v226, v219, v212, v294) : felt - v300 = arith.constant 1048712 : i32; - v301 = arith.add v288, v300 : i32 #[overflow = wrapping]; - v299 = arith.constant 12 : i32; - v947 = arith.constant 8 : i32; - v948 = arith.constant 20 : i32; - v297 = arith.add v119, v948 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v119, v297, v947, v299, v301) - v946 = arith.constant 4 : u32; - v302 = hir.bitcast v119 : u32; - v304 = arith.add v302, v946 : u32 #[overflow = checked]; - v945 = arith.constant 4 : u32; - v306 = arith.mod v304, v945 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - v308 = hir.load v307 : i32; - v943 = arith.constant 0 : i32; - v944 = arith.constant 4 : i32; - v310 = arith.neq v308, v944 : i1; - v311 = arith.zext v310 : u32; - v312 = hir.bitcast v311 : i32; - v314 = arith.neq v312, v943 : i1; - scf.if v314{ - ^block113: + ^block33: + v977 = arith.constant 8 : u32; + v235 = hir.bitcast v101 : u32; + v237 = arith.add v235, v977 : u32 #[overflow = checked]; + v976 = arith.constant 4 : u32; + v239 = arith.mod v237, v976 : u32; + hir.assertz v239 #[code = 250]; + v240 = hir.int_to_ptr v237 : ptr; + v241 = hir.load v240 : i32; + v242 = hir.bitcast v241 : u32; + v975 = arith.constant 4 : u32; + v244 = arith.mod v242, v975 : u32; + hir.assertz v244 #[code = 250]; + v245 = hir.int_to_ptr v242 : ptr; + v246 = hir.load v245 : i64; + v974 = arith.constant 8 : i32; + v252 = arith.add v241, v974 : i32 #[overflow = wrapping]; + v253 = hir.bitcast v252 : u32; + v973 = arith.constant 4 : u32; + v255 = arith.mod v253, v973 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + v257 = hir.load v256 : i64; + v972 = arith.constant 8 : i32; + v247 = arith.constant 32 : i32; + v248 = arith.add v101, v247 : i32 #[overflow = wrapping]; + v250 = arith.add v248, v972 : i32 #[overflow = wrapping]; + v258 = hir.bitcast v250 : u32; + v971 = arith.constant 8 : u32; + v260 = arith.mod v258, v971 : u32; + hir.assertz v260 #[code = 250]; + v261 = hir.int_to_ptr v258 : ptr; + hir.store v261, v257; + v263 = arith.constant 32 : u32; + v262 = hir.bitcast v101 : u32; + v264 = arith.add v262, v263 : u32 #[overflow = checked]; + v970 = arith.constant 8 : u32; + v266 = arith.mod v264, v970 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + hir.store v267, v246; + v268 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v269 = hir.bitcast v268 : ptr; + v270 = hir.load v269 : i32; + v968 = arith.constant 32 : i32; + v274 = arith.add v101, v968 : i32 #[overflow = wrapping]; + v969 = arith.constant 64 : i32; + v272 = arith.add v101, v969 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v272, v274) + v967 = arith.constant 64 : i32; + v276 = arith.add v101, v967 : i32 #[overflow = wrapping]; + v277 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::tx::create_note(v213, v208, v201, v194, v276) : felt + v282 = arith.constant 1048672 : i32; + v283 = arith.add v270, v282 : i32 #[overflow = wrapping]; + v281 = arith.constant 12 : i32; + v965 = arith.constant 8 : i32; + v966 = arith.constant 20 : i32; + v279 = arith.add v101, v966 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/ as core::ops::index::Index>::index(v101, v279, v965, v281, v283) + v964 = arith.constant 4 : u32; + v284 = hir.bitcast v101 : u32; + v286 = arith.add v284, v964 : u32 #[overflow = checked]; + v963 = arith.constant 4 : u32; + v288 = arith.mod v286, v963 : u32; + hir.assertz v288 #[code = 250]; + v289 = hir.int_to_ptr v286 : ptr; + v290 = hir.load v289 : i32; + v961 = arith.constant 0 : i32; + v962 = arith.constant 4 : i32; + v292 = arith.neq v290, v962 : i1; + v293 = arith.zext v292 : u32; + v294 = hir.bitcast v293 : i32; + v296 = arith.neq v294, v961 : i1; + scf.if v296{ + ^block125: scf.yield ; } else { - ^block45: - v315 = hir.bitcast v119 : u32; - v942 = arith.constant 4 : u32; - v317 = arith.mod v315, v942 : u32; - hir.assertz v317 #[code = 250]; - v318 = hir.int_to_ptr v315 : ptr; - v319 = hir.load v318 : i32; - v320 = hir.bitcast v319 : u32; - v941 = arith.constant 4 : u32; - v322 = arith.mod v320, v941 : u32; - hir.assertz v322 #[code = 250]; - v323 = hir.int_to_ptr v320 : ptr; - v324 = hir.load v323 : i64; - v940 = arith.constant 8 : i32; - v330 = arith.add v319, v940 : i32 #[overflow = wrapping]; - v331 = hir.bitcast v330 : u32; - v939 = arith.constant 4 : u32; - v333 = arith.mod v331, v939 : u32; - hir.assertz v333 #[code = 250]; - v334 = hir.int_to_ptr v331 : ptr; - v335 = hir.load v334 : i64; - v938 = arith.constant 8 : i32; - v325 = arith.constant 48 : i32; - v326 = arith.add v119, v325 : i32 #[overflow = wrapping]; - v328 = arith.add v326, v938 : i32 #[overflow = wrapping]; - v336 = hir.bitcast v328 : u32; - v937 = arith.constant 8 : u32; - v338 = arith.mod v336, v937 : u32; - hir.assertz v338 #[code = 250]; - v339 = hir.int_to_ptr v336 : ptr; - hir.store v339, v335; - v341 = arith.constant 48 : u32; - v340 = hir.bitcast v119 : u32; - v342 = arith.add v340, v341 : u32 #[overflow = checked]; - v936 = arith.constant 8 : u32; - v344 = arith.mod v342, v936 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - hir.store v345, v324; - v934 = arith.constant 48 : i32; - v349 = arith.add v119, v934 : i32 #[overflow = wrapping]; - v935 = arith.constant 64 : i32; - v347 = arith.add v119, v935 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v347, v349) - v933 = arith.constant 64 : u32; - v350 = hir.bitcast v119 : u32; - v352 = arith.add v350, v933 : u32 #[overflow = checked]; - v932 = arith.constant 4 : u32; - v354 = arith.mod v352, v932 : u32; - hir.assertz v354 #[code = 250]; - v355 = hir.int_to_ptr v352 : ptr; - v356 = hir.load v355 : felt; - v931 = arith.constant 68 : u32; - v357 = hir.bitcast v119 : u32; - v359 = arith.add v357, v931 : u32 #[overflow = checked]; - v930 = arith.constant 4 : u32; - v361 = arith.mod v359, v930 : u32; - hir.assertz v361 #[code = 250]; - v362 = hir.int_to_ptr v359 : ptr; - v363 = hir.load v362 : felt; - v929 = arith.constant 72 : u32; - v364 = hir.bitcast v119 : u32; - v366 = arith.add v364, v929 : u32 #[overflow = checked]; - v928 = arith.constant 4 : u32; - v368 = arith.mod v366, v928 : u32; - hir.assertz v368 #[code = 250]; - v369 = hir.int_to_ptr v366 : ptr; - v370 = hir.load v369 : felt; - v372 = arith.constant 76 : u32; - v371 = hir.bitcast v119 : u32; - v373 = arith.add v371, v372 : u32 #[overflow = checked]; - v927 = arith.constant 4 : u32; - v375 = arith.mod v373, v927 : u32; - hir.assertz v375 #[code = 250]; - v376 = hir.int_to_ptr v373 : ptr; - v377 = hir.load v376 : 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(v356, v363, v370, v377, v295) - v925 = arith.constant 4 : i32; - v926 = arith.constant 20 : i32; - v379 = arith.add v119, v926 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::deallocate(v379, v925, v925) - v924 = arith.constant 80 : i32; - v383 = arith.add v119, v924 : i32 #[overflow = wrapping]; - v384 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v385 = hir.bitcast v384 : ptr; - hir.store v385, v383; + ^block34: + v297 = hir.bitcast v101 : u32; + v960 = arith.constant 4 : u32; + v299 = arith.mod v297, v960 : u32; + hir.assertz v299 #[code = 250]; + v300 = hir.int_to_ptr v297 : ptr; + v301 = hir.load v300 : i32; + v302 = hir.bitcast v301 : u32; + v959 = arith.constant 4 : u32; + v304 = arith.mod v302, v959 : u32; + hir.assertz v304 #[code = 250]; + v305 = hir.int_to_ptr v302 : ptr; + v306 = hir.load v305 : i64; + v958 = arith.constant 8 : i32; + v312 = arith.add v301, v958 : i32 #[overflow = wrapping]; + v313 = hir.bitcast v312 : u32; + v957 = arith.constant 4 : u32; + v315 = arith.mod v313, v957 : u32; + hir.assertz v315 #[code = 250]; + v316 = hir.int_to_ptr v313 : ptr; + v317 = hir.load v316 : i64; + v956 = arith.constant 8 : i32; + v307 = arith.constant 48 : i32; + v308 = arith.add v101, v307 : i32 #[overflow = wrapping]; + v310 = arith.add v308, v956 : i32 #[overflow = wrapping]; + v318 = hir.bitcast v310 : u32; + v955 = arith.constant 8 : u32; + v320 = arith.mod v318, v955 : u32; + hir.assertz v320 #[code = 250]; + v321 = hir.int_to_ptr v318 : ptr; + hir.store v321, v317; + v323 = arith.constant 48 : u32; + v322 = hir.bitcast v101 : u32; + v324 = arith.add v322, v323 : u32 #[overflow = checked]; + v954 = arith.constant 8 : u32; + v326 = arith.mod v324, v954 : u32; + hir.assertz v326 #[code = 250]; + v327 = hir.int_to_ptr v324 : ptr; + hir.store v327, v306; + v952 = arith.constant 48 : i32; + v331 = arith.add v101, v952 : i32 #[overflow = wrapping]; + v953 = arith.constant 64 : i32; + v329 = arith.add v101, v953 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/>::from(v329, v331) + v951 = arith.constant 64 : u32; + v332 = hir.bitcast v101 : u32; + v334 = arith.add v332, v951 : u32 #[overflow = checked]; + v950 = arith.constant 4 : u32; + v336 = arith.mod v334, v950 : u32; + hir.assertz v336 #[code = 250]; + v337 = hir.int_to_ptr v334 : ptr; + v338 = hir.load v337 : felt; + v949 = arith.constant 68 : u32; + v339 = hir.bitcast v101 : u32; + v341 = arith.add v339, v949 : u32 #[overflow = checked]; + v948 = arith.constant 4 : u32; + v343 = arith.mod v341, v948 : u32; + hir.assertz v343 #[code = 250]; + v344 = hir.int_to_ptr v341 : ptr; + v345 = hir.load v344 : felt; + v947 = arith.constant 72 : u32; + v346 = hir.bitcast v101 : u32; + v348 = arith.add v346, v947 : u32 #[overflow = checked]; + v946 = arith.constant 4 : u32; + v350 = arith.mod v348, v946 : u32; + hir.assertz v350 #[code = 250]; + v351 = hir.int_to_ptr v348 : ptr; + v352 = hir.load v351 : felt; + v354 = arith.constant 76 : u32; + v353 = hir.bitcast v101 : u32; + v355 = arith.add v353, v354 : u32 #[overflow = checked]; + v945 = arith.constant 4 : u32; + v357 = arith.mod v355, v945 : u32; + hir.assertz v357 #[code = 250]; + v358 = hir.int_to_ptr v355 : ptr; + v359 = hir.load v358 : 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(v338, v345, v352, v359, v277) + v943 = arith.constant 4 : i32; + v944 = arith.constant 20 : i32; + v361 = arith.add v101, v944 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::deallocate(v361, v943, v943) + v942 = arith.constant 80 : i32; + v365 = arith.add v101, v942 : i32 #[overflow = wrapping]; + v366 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v367 = hir.bitcast v366 : ptr; + hir.store v367, v365; scf.yield ; }; - v911 = arith.constant 1 : u32; - v923 = arith.constant 0 : u32; - v921 = cf.select v314, v923, v911 : u32; - scf.yield v921; + v929 = arith.constant 1 : u32; + v941 = arith.constant 0 : u32; + v939 = cf.select v296, v941, v929 : u32; + scf.yield v939; }; - scf.yield v917; + scf.yield v935; }; - scf.yield v915; + scf.yield v933; }; - v922 = arith.constant 0 : u32; - v920 = arith.eq v913, v922 : i1; - cf.cond_br v920 ^block40, ^block117; - ^block40: + v940 = arith.constant 0 : u32; + v938 = arith.eq v931, v940 : i1; + cf.cond_br v938 ^block29, ^block129; + ^block29: ub.unreachable ; - ^block117: + ^block129: builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block46: + ^block35: builtin.ret ; }; private builtin.function @wit_bindgen_rt::run_ctors_once() { - ^block48: - v399 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v400 = hir.bitcast v399 : ptr; - v401 = hir.load v400 : i32; - v402 = arith.constant 1048732 : 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{ - ^block50: + ^block37: + v381 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v382 = hir.bitcast v381 : ptr; + v383 = hir.load v382 : i32; + v384 = arith.constant 1048692 : i32; + v385 = arith.add v383, v384 : i32 #[overflow = wrapping]; + v386 = hir.bitcast v385 : u32; + v387 = hir.int_to_ptr v386 : ptr; + v388 = hir.load v387 : u8; + v380 = arith.constant 0 : i32; + v389 = arith.zext v388 : u32; + v390 = hir.bitcast v389 : i32; + v392 = arith.neq v390, v380 : i1; + scf.if v392{ + ^block39: scf.yield ; } else { - ^block51: - v411 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr - v412 = hir.bitcast v411 : ptr; - v413 = hir.load v412 : i32; + ^block40: + v393 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/GOT.data.internal.__memory_base : ptr + v394 = hir.bitcast v393 : ptr; + v395 = hir.load v394 : 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 1048732 : i32; - v415 = arith.add v413, v987 : i32 #[overflow = wrapping]; - v419 = hir.bitcast v415 : u32; - v420 = hir.int_to_ptr v419 : ptr; - hir.store v420, v985; + v1004 = arith.constant 1 : u8; + v1006 = arith.constant 1048692 : i32; + v397 = arith.add v395, v1006 : i32 #[overflow = wrapping]; + v401 = hir.bitcast v397 : u32; + v402 = hir.int_to_ptr v401 : ptr; + hir.store v402, v1004; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v421: i32, v422: i32, v423: i32) -> i32 { - ^block52(v421: i32, v422: i32, v423: i32): - v426 = arith.constant 16 : i32; - v425 = arith.constant 0 : i32; - v989 = arith.constant 16 : u32; - v428 = hir.bitcast v422 : u32; - v430 = arith.gt v428, v989 : i1; - v431 = arith.zext v430 : u32; - v432 = hir.bitcast v431 : i32; - v434 = arith.neq v432, v425 : i1; - v435 = cf.select v434, v422, v426 : i32; - v1029 = arith.constant 0 : i32; - v436 = arith.constant -1 : i32; - v437 = arith.add v435, v436 : i32 #[overflow = wrapping]; - v438 = arith.band v435, v437 : i32; - v440 = arith.neq v438, v1029 : i1; - v998, v999 = scf.if v440 : i32, u32 { - ^block125: - v990 = arith.constant 0 : u32; - v994 = ub.poison i32 : i32; - scf.yield v994, v990; + private builtin.function @::alloc(v403: i32, v404: i32, v405: i32) -> i32 { + ^block41(v403: i32, v404: i32, v405: i32): + v408 = arith.constant 16 : i32; + v407 = arith.constant 0 : i32; + v1008 = arith.constant 16 : u32; + v410 = hir.bitcast v404 : u32; + v412 = arith.gt v410, v1008 : i1; + v413 = arith.zext v412 : u32; + v414 = hir.bitcast v413 : i32; + v416 = arith.neq v414, v407 : i1; + v417 = cf.select v416, v404, v408 : i32; + v1048 = arith.constant 0 : i32; + v418 = arith.constant -1 : i32; + v419 = arith.add v417, v418 : i32 #[overflow = wrapping]; + v420 = arith.band v417, v419 : i32; + v422 = arith.neq v420, v1048 : i1; + v1017, v1018 = scf.if v422 : i32, u32 { + ^block137: + v1009 = arith.constant 0 : u32; + v1013 = ub.poison i32 : i32; + scf.yield v1013, v1009; } else { - ^block55: - v442 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::ptr::alignment::Alignment::max(v422, v435) : i32 - v1028 = arith.constant 0 : i32; - v441 = arith.constant -2147483648 : i32; - v443 = arith.sub v441, v442 : i32 #[overflow = wrapping]; - v445 = hir.bitcast v443 : u32; - v444 = hir.bitcast v423 : u32; - v446 = arith.gt v444, v445 : i1; - v447 = arith.zext v446 : u32; - v448 = hir.bitcast v447 : i32; - v450 = arith.neq v448, v1028 : i1; - v1013 = scf.if v450 : i32 { - ^block124: - v1027 = ub.poison i32 : i32; - scf.yield v1027; + ^block44: + v424 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/core::ptr::alignment::Alignment::max(v404, v417) : i32 + v1047 = arith.constant 0 : i32; + v423 = arith.constant -2147483648 : i32; + v425 = arith.sub v423, v424 : i32 #[overflow = wrapping]; + v427 = hir.bitcast v425 : u32; + v426 = hir.bitcast v405 : u32; + v428 = arith.gt v426, v427 : i1; + v429 = arith.zext v428 : u32; + v430 = hir.bitcast v429 : i32; + v432 = arith.neq v430, v1047 : i1; + v1032 = scf.if v432 : i32 { + ^block136: + v1046 = ub.poison i32 : i32; + scf.yield v1046; } else { - ^block56: - v1025 = arith.constant 0 : i32; - v456 = arith.sub v1025, v442 : i32 #[overflow = wrapping]; - v1026 = arith.constant -1 : i32; - v452 = arith.add v423, v442 : i32 #[overflow = wrapping]; - v454 = arith.add v452, v1026 : i32 #[overflow = wrapping]; - v457 = arith.band v454, v456 : i32; - v458 = hir.bitcast v421 : u32; - v459 = arith.constant 4 : u32; - v460 = arith.mod v458, v459 : u32; - hir.assertz v460 #[code = 250]; - v461 = hir.int_to_ptr v458 : ptr; - v462 = hir.load v461 : i32; - v1024 = arith.constant 0 : i32; - v464 = arith.neq v462, v1024 : i1; - scf.if v464{ - ^block123: + ^block45: + v1044 = arith.constant 0 : i32; + v438 = arith.sub v1044, v424 : i32 #[overflow = wrapping]; + v1045 = arith.constant -1 : i32; + v434 = arith.add v405, v424 : i32 #[overflow = wrapping]; + v436 = arith.add v434, v1045 : i32 #[overflow = wrapping]; + v439 = arith.band v436, v438 : i32; + v440 = hir.bitcast v403 : u32; + v441 = arith.constant 4 : u32; + v442 = arith.mod v440, v441 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + v444 = hir.load v443 : i32; + v1043 = arith.constant 0 : i32; + v446 = arith.neq v444, v1043 : i1; + scf.if v446{ + ^block135: scf.yield ; } else { - ^block58: - v465 = hir.exec @intrinsics/mem/heap_base() : i32 - v466 = hir.mem_size : u32; - v472 = hir.bitcast v421 : u32; - v1023 = arith.constant 4 : u32; - v474 = arith.mod v472, v1023 : u32; - hir.assertz v474 #[code = 250]; - v1022 = arith.constant 16 : u32; - v467 = hir.bitcast v466 : i32; - v470 = arith.shl v467, v1022 : i32; - v471 = arith.add v465, v470 : i32 #[overflow = wrapping]; - v475 = hir.int_to_ptr v472 : ptr; - hir.store v475, v471; + ^block47: + v447 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/intrinsics::mem::heap_base() : i32 + v448 = hir.mem_size : u32; + v454 = hir.bitcast v403 : u32; + v1042 = arith.constant 4 : u32; + v456 = arith.mod v454, v1042 : u32; + hir.assertz v456 #[code = 250]; + v1041 = arith.constant 16 : u32; + v449 = hir.bitcast v448 : i32; + v452 = arith.shl v449, v1041 : i32; + v453 = arith.add v447, v452 : i32 #[overflow = wrapping]; + v457 = hir.int_to_ptr v454 : ptr; + hir.store v457, v453; scf.yield ; }; - v478 = hir.bitcast v421 : u32; - v1021 = arith.constant 4 : u32; - v480 = arith.mod v478, v1021 : u32; - hir.assertz v480 #[code = 250]; - v481 = hir.int_to_ptr v478 : ptr; - v482 = hir.load v481 : i32; - v1019 = arith.constant 0 : i32; - v1020 = arith.constant -1 : i32; - v484 = arith.bxor v482, v1020 : i32; - v486 = hir.bitcast v484 : u32; - v485 = hir.bitcast v457 : u32; - v487 = arith.gt v485, v486 : i1; - v488 = arith.zext v487 : u32; - v489 = hir.bitcast v488 : i32; - v491 = arith.neq v489, v1019 : i1; - v1012 = scf.if v491 : i32 { - ^block59: - v1018 = arith.constant 0 : i32; - scf.yield v1018; + v460 = hir.bitcast v403 : u32; + v1040 = arith.constant 4 : u32; + v462 = arith.mod v460, v1040 : u32; + hir.assertz v462 #[code = 250]; + v463 = hir.int_to_ptr v460 : ptr; + v464 = hir.load v463 : i32; + v1038 = arith.constant 0 : i32; + v1039 = arith.constant -1 : i32; + v466 = arith.bxor v464, v1039 : i32; + v468 = hir.bitcast v466 : u32; + v467 = hir.bitcast v439 : u32; + v469 = arith.gt v467, v468 : i1; + v470 = arith.zext v469 : u32; + v471 = hir.bitcast v470 : i32; + v473 = arith.neq v471, v1038 : i1; + v1031 = scf.if v473 : i32 { + ^block48: + v1037 = arith.constant 0 : i32; + scf.yield v1037; } else { - ^block60: - v493 = hir.bitcast v421 : u32; - v1017 = arith.constant 4 : u32; - v495 = arith.mod v493, v1017 : u32; - hir.assertz v495 #[code = 250]; - v492 = arith.add v482, v457 : i32 #[overflow = wrapping]; - v496 = hir.int_to_ptr v493 : ptr; - hir.store v496, v492; - v498 = arith.add v482, v442 : i32 #[overflow = wrapping]; - scf.yield v498; + ^block49: + v475 = hir.bitcast v403 : u32; + v1036 = arith.constant 4 : u32; + v477 = arith.mod v475, v1036 : u32; + hir.assertz v477 #[code = 250]; + v474 = arith.add v464, v439 : i32 #[overflow = wrapping]; + v478 = hir.int_to_ptr v475 : ptr; + hir.store v478, v474; + v480 = arith.add v464, v424 : i32 #[overflow = wrapping]; + scf.yield v480; }; - scf.yield v1012; + scf.yield v1031; }; - v995 = arith.constant 1 : u32; - v1016 = arith.constant 0 : u32; - v1014 = cf.select v450, v1016, v995 : u32; - scf.yield v1013, v1014; + v1014 = arith.constant 1 : u32; + v1035 = arith.constant 0 : u32; + v1033 = cf.select v432, v1035, v1014 : u32; + scf.yield v1032, v1033; }; - v1015 = arith.constant 0 : u32; - v1011 = arith.eq v999, v1015 : i1; - cf.cond_br v1011 ^block54, ^block127(v998); - ^block54: + v1034 = arith.constant 0 : u32; + v1030 = arith.eq v1018, v1034 : i1; + cf.cond_br v1030 ^block43, ^block139(v1017); + ^block43: ub.unreachable ; - ^block127(v991: i32): - builtin.ret v991; + ^block139(v1010: i32): + builtin.ret v1010; }; - private builtin.function @miden_base_sys::bindings::tx::create_note(v501: felt, v502: felt, v503: felt, v504: felt, v505: i32) -> felt { - ^block61(v501: felt, v502: felt, v503: felt, v504: felt, v505: i32): - v508 = arith.constant 12 : u32; - v507 = hir.bitcast v505 : u32; - v509 = arith.add v507, v508 : u32 #[overflow = checked]; - v510 = arith.constant 4 : u32; - v511 = arith.mod v509, v510 : u32; - hir.assertz v511 #[code = 250]; - v512 = hir.int_to_ptr v509 : ptr; - v513 = hir.load v512 : felt; - v515 = arith.constant 8 : u32; - v514 = hir.bitcast v505 : u32; - v516 = arith.add v514, v515 : u32 #[overflow = checked]; - v1033 = arith.constant 4 : u32; - v518 = arith.mod v516, v1033 : u32; - hir.assertz v518 #[code = 250]; - v519 = hir.int_to_ptr v516 : ptr; - v520 = hir.load v519 : felt; - v1032 = arith.constant 4 : u32; - v521 = hir.bitcast v505 : u32; - v523 = arith.add v521, v1032 : u32 #[overflow = checked]; - v1031 = arith.constant 4 : u32; - v525 = arith.mod v523, v1031 : u32; - hir.assertz v525 #[code = 250]; - v526 = hir.int_to_ptr v523 : ptr; - v527 = hir.load v526 : felt; - v528 = hir.bitcast v505 : u32; - v1030 = arith.constant 4 : u32; - v530 = arith.mod v528, v1030 : u32; - hir.assertz v530 #[code = 250]; - v531 = hir.int_to_ptr v528 : ptr; - v532 = hir.load v531 : felt; - v533 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden_base_sys::bindings::tx::extern_tx_create_note(v501, v502, v503, v504, v513, v520, v527, v532) : felt - builtin.ret v533; + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block50: + v483 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v483; }; - private builtin.function @>::from(v534: i32, v535: i32) { - ^block63(v534: i32, v535: i32): - v537 = arith.constant 8 : u32; - v536 = hir.bitcast v535 : u32; - v538 = arith.add v536, v537 : u32 #[overflow = checked]; - v539 = arith.constant 4 : u32; - v540 = arith.mod v538, v539 : u32; + private builtin.function @miden_base_sys::bindings::tx::create_note(v485: felt, v486: felt, v487: felt, v488: felt, v489: i32) -> felt { + ^block54(v485: felt, v486: felt, 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]; + v1052 = arith.constant 4 : u32; + v502 = arith.mod v500, v1052 : u32; + hir.assertz v502 #[code = 250]; + v503 = hir.int_to_ptr v500 : ptr; + v504 = hir.load v503 : felt; + v1051 = arith.constant 4 : u32; + v505 = hir.bitcast v489 : u32; + v507 = arith.add v505, v1051 : u32 #[overflow = checked]; + v1050 = arith.constant 4 : u32; + v509 = arith.mod v507, v1050 : u32; + hir.assertz v509 #[code = 250]; + v510 = hir.int_to_ptr v507 : ptr; + v511 = hir.load v510 : felt; + v512 = hir.bitcast v489 : u32; + v1049 = arith.constant 4 : u32; + v514 = arith.mod v512, v1049 : 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::tx::create_note(v485, v486, v487, v488, v497, v504, v511, v516) : felt + builtin.ret v517; + }; + + private builtin.function @>::from(v518: i32, v519: i32) { + ^block56(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; + v1056 = arith.constant 8 : u32; + v527 = hir.bitcast v518 : u32; + v529 = arith.add v527, v1056 : u32 #[overflow = checked]; + v1055 = arith.constant 8 : u32; + v531 = arith.mod v529, v1055 : u32; + hir.assertz v531 #[code = 250]; + v532 = hir.int_to_ptr v529 : ptr; + hir.store v532, v526; + v533 = hir.bitcast v519 : u32; + v1054 = arith.constant 4 : u32; + v535 = arith.mod v533, v1054 : u32; + hir.assertz v535 #[code = 250]; + v536 = hir.int_to_ptr v533 : ptr; + v537 = hir.load v536 : i64; + v538 = hir.bitcast v518 : u32; + v1053 = arith.constant 8 : u32; + v540 = arith.mod v538, v1053 : u32; hir.assertz v540 #[code = 250]; v541 = hir.int_to_ptr v538 : ptr; - v542 = hir.load v541 : i64; - v1037 = arith.constant 8 : u32; - v543 = hir.bitcast v534 : u32; - v545 = arith.add v543, v1037 : u32 #[overflow = checked]; - v1036 = arith.constant 8 : u32; - v547 = arith.mod v545, v1036 : u32; - hir.assertz v547 #[code = 250]; - v548 = hir.int_to_ptr v545 : ptr; - hir.store v548, v542; - v549 = hir.bitcast v535 : u32; - v1035 = arith.constant 4 : u32; - v551 = arith.mod v549, v1035 : u32; - hir.assertz v551 #[code = 250]; - v552 = hir.int_to_ptr v549 : ptr; - v553 = hir.load v552 : i64; - v554 = hir.bitcast v534 : u32; - v1034 = arith.constant 8 : u32; - v556 = arith.mod v554, v1034 : u32; - hir.assertz v556 #[code = 250]; - v557 = hir.int_to_ptr v554 : ptr; - hir.store v557, v553; + hir.store v541, v537; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v558: i32, v559: i32, v560: i32) { - ^block65(v558: i32, v559: i32, v560: i32): - v562 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v563 = hir.bitcast v562 : ptr; - v564 = hir.load v563 : i32; - v565 = arith.constant 16 : i32; - v566 = arith.sub v564, v565 : i32 #[overflow = wrapping]; - v567 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v568 = hir.bitcast v567 : ptr; - hir.store v568, v566; - v569 = arith.constant 4 : i32; - v570 = arith.add v566, v569 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::current_memory(v570, v558, v559, v560) - v572 = arith.constant 8 : u32; - v571 = hir.bitcast v566 : u32; - v573 = arith.add v571, v572 : u32 #[overflow = checked]; - v574 = arith.constant 4 : u32; - v575 = arith.mod v573, v574 : u32; - hir.assertz v575 #[code = 250]; - v576 = hir.int_to_ptr v573 : ptr; - v577 = hir.load v576 : i32; - v1044 = arith.constant 0 : i32; - v561 = arith.constant 0 : i32; - v579 = arith.eq v577, v561 : i1; - v580 = arith.zext v579 : u32; - v581 = hir.bitcast v580 : i32; - v583 = arith.neq v581, v1044 : i1; - scf.if v583{ - ^block131: + private builtin.function @miden::tx::create_note(v542: felt, v543: felt, v544: felt, v545: felt, v546: felt, v547: felt, v548: felt, v549: felt) -> felt { + ^block58(v542: felt, v543: felt, v544: felt, v545: felt, v546: felt, v547: felt, v548: felt, v549: felt): + v550 = hir.exec @miden/tx/create_note(v542, v543, v544, v545, v546, v547, v548, v549) : felt + builtin.ret v550; + }; + + private builtin.function @intrinsics::felt::from_u64_unchecked(v552: i64) -> felt { + ^block62(v552: i64): + v553 = hir.cast v552 : felt; + builtin.ret v553; + }; + + private builtin.function @intrinsics::felt::from_u32(v555: i32) -> felt { + ^block64(v555: i32): + v556 = hir.bitcast v555 : felt; + builtin.ret v556; + }; + + private builtin.function @intrinsics::felt::as_u64(v558: felt) -> i64 { + ^block66(v558: felt): + v559 = hir.cast v558 : i64; + builtin.ret v559; + }; + + private builtin.function @intrinsics::felt::assert_eq(v561: felt, v562: felt) { + ^block68(v561: felt, v562: felt): + hir.assert_eq v561, v562; + builtin.ret ; + }; + + private builtin.function @intrinsics::advice::adv_push_mapvaln(v563: felt, v564: felt, v565: felt, v566: felt) -> felt { + ^block70(v563: felt, v564: felt, v565: felt, v566: felt): + v567 = hir.exec @intrinsics/advice/adv_push_mapvaln(v563, v564, v565, v566) : felt + builtin.ret v567; + }; + + private builtin.function @std::mem::pipe_preimage_to_memory(v569: felt, v570: i32, v571: felt, v572: felt, v573: felt, v574: felt) -> i32 { + ^block73(v569: felt, v570: i32, v571: felt, v572: felt, v573: felt, v574: felt): + v575 = hir.exec @std/mem/pipe_preimage_to_memory(v569, v570, v571, v572, v573, v574) : i32 + builtin.ret v575; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v577: i32, v578: i32, v579: i32) { + ^block77(v577: i32, v578: i32, v579: i32): + v581 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v582 = hir.bitcast v581 : ptr; + v583 = hir.load v582 : i32; + v584 = arith.constant 16 : i32; + v585 = arith.sub v583, v584 : i32 #[overflow = wrapping]; + v586 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v587 = hir.bitcast v586 : ptr; + hir.store v587, v585; + v588 = arith.constant 4 : i32; + v589 = arith.add v585, v588 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::raw_vec::RawVecInner::current_memory(v589, v577, v578, v579) + v591 = arith.constant 8 : u32; + v590 = hir.bitcast v585 : u32; + v592 = arith.add v590, v591 : u32 #[overflow = checked]; + v593 = arith.constant 4 : u32; + v594 = arith.mod v592, v593 : u32; + hir.assertz v594 #[code = 250]; + v595 = hir.int_to_ptr v592 : ptr; + v596 = hir.load v595 : i32; + v1063 = arith.constant 0 : i32; + v580 = arith.constant 0 : i32; + v598 = arith.eq v596, v580 : i1; + v599 = arith.zext v598 : u32; + v600 = hir.bitcast v599 : i32; + v602 = arith.neq v600, v1063 : i1; + scf.if v602{ + ^block143: scf.yield ; } else { - ^block68: - v1043 = arith.constant 4 : u32; - v584 = hir.bitcast v566 : u32; - v586 = arith.add v584, v1043 : u32 #[overflow = checked]; - v1042 = arith.constant 4 : u32; - v588 = arith.mod v586, v1042 : u32; - hir.assertz v588 #[code = 250]; - v589 = hir.int_to_ptr v586 : ptr; - v590 = hir.load v589 : i32; - v592 = arith.constant 12 : u32; - v591 = hir.bitcast v566 : u32; - v593 = arith.add v591, v592 : u32 #[overflow = checked]; - v1041 = arith.constant 4 : u32; - v595 = arith.mod v593, v1041 : u32; - hir.assertz v595 #[code = 250]; - v596 = hir.int_to_ptr v593 : ptr; - v597 = hir.load v596 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v590, v577, v597) + ^block80: + v1062 = arith.constant 4 : u32; + v603 = hir.bitcast v585 : u32; + v605 = arith.add v603, v1062 : u32 #[overflow = checked]; + v1061 = arith.constant 4 : u32; + v607 = arith.mod v605, v1061 : u32; + hir.assertz v607 #[code = 250]; + v608 = hir.int_to_ptr v605 : ptr; + v609 = hir.load v608 : i32; + v611 = arith.constant 12 : u32; + v610 = hir.bitcast v585 : u32; + v612 = arith.add v610, v611 : u32 #[overflow = checked]; + v1060 = arith.constant 4 : u32; + v614 = arith.mod v612, v1060 : u32; + hir.assertz v614 #[code = 250]; + v615 = hir.int_to_ptr v612 : ptr; + v616 = hir.load v615 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::deallocate(v609, v596, v616) scf.yield ; }; - v1040 = arith.constant 16 : i32; - v600 = arith.add v566, v1040 : i32 #[overflow = wrapping]; - v601 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v602 = hir.bitcast v601 : ptr; - hir.store v602, v600; + v1059 = arith.constant 16 : i32; + v619 = arith.add v585, v1059 : i32 #[overflow = wrapping]; + v620 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v621 = hir.bitcast v620 : ptr; + hir.store v621, v619; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v603: i32, v604: i32, v605: i32, v606: i32, v607: i32) { - ^block69(v603: i32, v604: i32, v605: i32, v606: i32, v607: i32): - v610 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v611 = hir.bitcast v610 : ptr; - v612 = hir.load v611 : i32; - v613 = arith.constant 16 : i32; - v614 = arith.sub v612, v613 : i32 #[overflow = wrapping]; - v615 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v616 = hir.bitcast v615 : ptr; - hir.store v616, v614; - v626 = hir.bitcast v604 : u32; - v627 = arith.zext v626 : u64; - v628 = hir.bitcast v627 : i64; - v608 = arith.constant 0 : i32; - v621 = arith.sub v608, v606 : i32 #[overflow = wrapping]; - v618 = arith.constant -1 : i32; - v617 = arith.add v606, v607 : i32 #[overflow = wrapping]; - v619 = arith.add v617, v618 : i32 #[overflow = wrapping]; - v622 = arith.band v619, v621 : i32; - v623 = hir.bitcast v622 : u32; - v624 = arith.zext v623 : u64; - v625 = hir.bitcast v624 : i64; - v629 = arith.mul v625, v628 : i64 #[overflow = wrapping]; - v1148 = arith.constant 0 : i32; - v630 = arith.constant 32 : i64; - v632 = hir.cast v630 : u32; - v631 = hir.bitcast v629 : u64; - v633 = arith.shr v631, v632 : u64; - v634 = hir.bitcast v633 : i64; - v635 = arith.trunc v634 : i32; - v637 = arith.neq v635, v1148 : i1; - v1060, v1061, v1062, v1063, v1064, v1065 = scf.if v637 : i32, i32, i32, i32, i32, u32 { - ^block133: - v1045 = arith.constant 0 : u32; - v1052 = ub.poison i32 : i32; - scf.yield v603, v614, v1052, v1052, v1052, v1045; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v622: i32, v623: i32, v624: i32, v625: i32, v626: i32) { + ^block81(v622: i32, v623: i32, v624: i32, v625: i32, v626: i32): + v629 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v630 = hir.bitcast v629 : ptr; + v631 = hir.load v630 : i32; + v632 = arith.constant 16 : i32; + v633 = arith.sub v631, v632 : i32 #[overflow = wrapping]; + v634 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v635 = hir.bitcast v634 : ptr; + hir.store v635, v633; + v645 = hir.bitcast v623 : u32; + v646 = arith.zext v645 : u64; + v647 = hir.bitcast v646 : i64; + v627 = arith.constant 0 : i32; + v640 = arith.sub v627, v625 : i32 #[overflow = wrapping]; + v637 = arith.constant -1 : i32; + v636 = arith.add v625, v626 : i32 #[overflow = wrapping]; + v638 = arith.add v636, v637 : i32 #[overflow = wrapping]; + v641 = arith.band v638, v640 : i32; + v642 = hir.bitcast v641 : u32; + v643 = arith.zext v642 : u64; + v644 = hir.bitcast v643 : i64; + v648 = arith.mul v644, v647 : i64 #[overflow = wrapping]; + v1167 = arith.constant 0 : i32; + v649 = arith.constant 32 : i64; + v651 = hir.cast v649 : u32; + v650 = hir.bitcast v648 : u64; + v652 = arith.shr v650, v651 : u64; + v653 = hir.bitcast v652 : i64; + v654 = arith.trunc v653 : i32; + v656 = arith.neq v654, v1167 : i1; + v1079, v1080, v1081, v1082, v1083, v1084 = scf.if v656 : i32, i32, i32, i32, i32, u32 { + ^block145: + v1064 = arith.constant 0 : u32; + v1071 = ub.poison i32 : i32; + scf.yield v622, v633, v1071, v1071, v1071, v1064; } else { - ^block74: - v638 = arith.trunc v629 : i32; - v1147 = arith.constant 0 : i32; - v639 = arith.constant -2147483648 : i32; - v640 = arith.sub v639, v606 : i32 #[overflow = wrapping]; - v642 = hir.bitcast v640 : u32; - v641 = hir.bitcast v638 : u32; - v643 = arith.lte v641, v642 : i1; - v644 = arith.zext v643 : u32; - v645 = hir.bitcast v644 : i32; - v647 = arith.neq v645, v1147 : i1; - v1108 = scf.if v647 : i32 { - ^block72: - v1146 = arith.constant 0 : i32; - v658 = arith.neq v638, v1146 : i1; - v1107 = scf.if v658 : i32 { - ^block76: - v1145 = arith.constant 0 : i32; - v674 = arith.neq v605, v1145 : i1; - v1106 = scf.if v674 : i32 { - ^block79: - v656 = arith.constant 1 : i32; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v614, v606, v638, v656) - v685 = hir.bitcast v614 : u32; - v730 = arith.constant 4 : u32; - v687 = arith.mod v685, v730 : u32; - hir.assertz v687 #[code = 250]; - v688 = hir.int_to_ptr v685 : ptr; - v689 = hir.load v688 : i32; - scf.yield v689; + ^block86: + v657 = arith.trunc v648 : i32; + v1166 = arith.constant 0 : i32; + v658 = arith.constant -2147483648 : i32; + v659 = arith.sub v658, v625 : i32 #[overflow = wrapping]; + v661 = hir.bitcast v659 : u32; + v660 = hir.bitcast v657 : u32; + v662 = arith.lte v660, v661 : i1; + v663 = arith.zext v662 : u32; + v664 = hir.bitcast v663 : i32; + v666 = arith.neq v664, v1166 : i1; + v1127 = scf.if v666 : i32 { + ^block84: + v1165 = arith.constant 0 : i32; + v677 = arith.neq v657, v1165 : i1; + v1126 = scf.if v677 : i32 { + ^block88: + v1164 = arith.constant 0 : i32; + v693 = arith.neq v624, v1164 : i1; + v1125 = scf.if v693 : i32 { + ^block91: + v675 = arith.constant 1 : i32; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v633, v625, v657, v675) + v704 = hir.bitcast v633 : u32; + v749 = arith.constant 4 : u32; + v706 = arith.mod v704, v749 : u32; + hir.assertz v706 #[code = 250]; + v707 = hir.int_to_ptr v704 : ptr; + v708 = hir.load v707 : i32; + scf.yield v708; } else { - ^block80: - v675 = arith.constant 8 : i32; - v676 = arith.add v614, v675 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v676, v606, v638) - v660 = arith.constant 8 : u32; - v677 = hir.bitcast v614 : u32; - v679 = arith.add v677, v660 : u32 #[overflow = checked]; - v1144 = arith.constant 4 : u32; - v681 = arith.mod v679, v1144 : u32; - hir.assertz v681 #[code = 250]; - v682 = hir.int_to_ptr v679 : ptr; - v683 = hir.load v682 : i32; - scf.yield v683; + ^block92: + v694 = arith.constant 8 : i32; + v695 = arith.add v633, v694 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/::allocate(v695, v625, v657) + v679 = arith.constant 8 : u32; + v696 = hir.bitcast v633 : u32; + v698 = arith.add v696, v679 : u32 #[overflow = checked]; + v1163 = arith.constant 4 : u32; + v700 = arith.mod v698, v1163 : u32; + hir.assertz v700 #[code = 250]; + v701 = hir.int_to_ptr v698 : ptr; + v702 = hir.load v701 : i32; + scf.yield v702; }; - v1142 = arith.constant 0 : i32; - v1143 = arith.constant 0 : i32; - v692 = arith.eq v1106, v1143 : i1; - v693 = arith.zext v692 : u32; - v694 = hir.bitcast v693 : i32; - v696 = arith.neq v694, v1142 : i1; - scf.if v696{ - ^block81: - v1141 = arith.constant 8 : u32; - v713 = hir.bitcast v603 : u32; - v715 = arith.add v713, v1141 : u32 #[overflow = checked]; - v1140 = arith.constant 4 : u32; - v717 = arith.mod v715, v1140 : u32; - hir.assertz v717 #[code = 250]; - v718 = hir.int_to_ptr v715 : ptr; - hir.store v718, v638; - v1139 = arith.constant 4 : u32; - v720 = hir.bitcast v603 : u32; - v722 = arith.add v720, v1139 : u32 #[overflow = checked]; - v1138 = arith.constant 4 : u32; - v724 = arith.mod v722, v1138 : u32; - hir.assertz v724 #[code = 250]; - v725 = hir.int_to_ptr v722 : ptr; - hir.store v725, v606; + v1161 = arith.constant 0 : i32; + v1162 = arith.constant 0 : i32; + v711 = arith.eq v1125, v1162 : i1; + v712 = arith.zext v711 : u32; + v713 = hir.bitcast v712 : i32; + v715 = arith.neq v713, v1161 : i1; + scf.if v715{ + ^block93: + v1160 = arith.constant 8 : u32; + v732 = hir.bitcast v622 : u32; + v734 = arith.add v732, v1160 : u32 #[overflow = checked]; + v1159 = arith.constant 4 : u32; + v736 = arith.mod v734, v1159 : u32; + hir.assertz v736 #[code = 250]; + v737 = hir.int_to_ptr v734 : ptr; + hir.store v737, v657; + v1158 = arith.constant 4 : u32; + v739 = hir.bitcast v622 : u32; + v741 = arith.add v739, v1158 : u32 #[overflow = checked]; + v1157 = arith.constant 4 : u32; + v743 = arith.mod v741, v1157 : u32; + hir.assertz v743 #[code = 250]; + v744 = hir.int_to_ptr v741 : ptr; + hir.store v744, v625; scf.yield ; } else { - ^block82: - v1137 = arith.constant 8 : u32; - v698 = hir.bitcast v603 : u32; - v700 = arith.add v698, v1137 : u32 #[overflow = checked]; - v1136 = arith.constant 4 : u32; - v702 = arith.mod v700, v1136 : u32; - hir.assertz v702 #[code = 250]; - v703 = hir.int_to_ptr v700 : ptr; - hir.store v703, v1106; - v1135 = arith.constant 4 : u32; - v705 = hir.bitcast v603 : u32; - v707 = arith.add v705, v1135 : u32 #[overflow = checked]; - v1134 = arith.constant 4 : u32; - v709 = arith.mod v707, v1134 : u32; - hir.assertz v709 #[code = 250]; - v710 = hir.int_to_ptr v707 : ptr; - hir.store v710, v604; + ^block94: + v1156 = arith.constant 8 : u32; + v717 = hir.bitcast v622 : u32; + v719 = arith.add v717, v1156 : u32 #[overflow = checked]; + v1155 = arith.constant 4 : u32; + v721 = arith.mod v719, v1155 : u32; + hir.assertz v721 #[code = 250]; + v722 = hir.int_to_ptr v719 : ptr; + hir.store v722, v1125; + v1154 = arith.constant 4 : u32; + v724 = hir.bitcast v622 : u32; + v726 = arith.add v724, v1154 : u32 #[overflow = checked]; + v1153 = arith.constant 4 : u32; + v728 = arith.mod v726, v1153 : u32; + hir.assertz v728 #[code = 250]; + v729 = hir.int_to_ptr v726 : ptr; + hir.store v729, v623; scf.yield ; }; - v1132 = arith.constant 0 : i32; - v1133 = arith.constant 1 : i32; - v1105 = cf.select v696, v1133, v1132 : i32; - scf.yield v1105; + v1151 = arith.constant 0 : i32; + v1152 = arith.constant 1 : i32; + v1124 = cf.select v715, v1152, v1151 : i32; + scf.yield v1124; } else { - ^block77: - v1131 = arith.constant 8 : u32; - v659 = hir.bitcast v603 : u32; - v661 = arith.add v659, v1131 : u32 #[overflow = checked]; - v1130 = arith.constant 4 : u32; - v663 = arith.mod v661, v1130 : u32; - hir.assertz v663 #[code = 250]; - v664 = hir.int_to_ptr v661 : ptr; - hir.store v664, v606; - v1129 = arith.constant 4 : u32; - v667 = hir.bitcast v603 : u32; - v669 = arith.add v667, v1129 : u32 #[overflow = checked]; - v1128 = arith.constant 4 : u32; - v671 = arith.mod v669, v1128 : u32; - hir.assertz v671 #[code = 250]; - v1127 = arith.constant 0 : i32; - v672 = hir.int_to_ptr v669 : ptr; - hir.store v672, v1127; - v1126 = arith.constant 0 : i32; - scf.yield v1126; + ^block89: + v1150 = arith.constant 8 : u32; + v678 = hir.bitcast v622 : u32; + v680 = arith.add v678, v1150 : u32 #[overflow = checked]; + v1149 = arith.constant 4 : u32; + v682 = arith.mod v680, v1149 : u32; + hir.assertz v682 #[code = 250]; + v683 = hir.int_to_ptr v680 : ptr; + hir.store v683, v625; + v1148 = arith.constant 4 : u32; + v686 = hir.bitcast v622 : u32; + v688 = arith.add v686, v1148 : u32 #[overflow = checked]; + v1147 = arith.constant 4 : u32; + v690 = arith.mod v688, v1147 : u32; + hir.assertz v690 #[code = 250]; + v1146 = arith.constant 0 : i32; + v691 = hir.int_to_ptr v688 : ptr; + hir.store v691, v1146; + v1145 = arith.constant 0 : i32; + scf.yield v1145; }; - scf.yield v1107; + scf.yield v1126; } else { - ^block75: - v1125 = ub.poison i32 : i32; - scf.yield v1125; + ^block87: + v1144 = ub.poison i32 : i32; + scf.yield v1144; }; - v1120 = arith.constant 0 : u32; - v1053 = arith.constant 1 : u32; - v1113 = cf.select v647, v1053, v1120 : u32; - v1121 = ub.poison i32 : i32; - v1112 = cf.select v647, v614, v1121 : i32; - v1122 = ub.poison i32 : i32; - v1111 = cf.select v647, v603, v1122 : i32; - v1123 = ub.poison i32 : i32; - v1110 = cf.select v647, v1123, v614 : i32; - v1124 = ub.poison i32 : i32; - v1109 = cf.select v647, v1124, v603 : i32; - scf.yield v1109, v1110, v1111, v1108, v1112, v1113; + v1139 = arith.constant 0 : u32; + v1072 = arith.constant 1 : u32; + v1132 = cf.select v666, v1072, v1139 : u32; + v1140 = ub.poison i32 : i32; + v1131 = cf.select v666, v633, v1140 : i32; + v1141 = ub.poison i32 : i32; + v1130 = cf.select v666, v622, v1141 : i32; + v1142 = ub.poison i32 : i32; + v1129 = cf.select v666, v1142, v633 : i32; + v1143 = ub.poison i32 : i32; + v1128 = cf.select v666, v1143, v622 : i32; + scf.yield v1128, v1129, v1130, v1127, v1131, v1132; }; - v1066, v1067, v1068 = scf.index_switch v1065 : i32, i32, i32 + v1085, v1086, v1087 = scf.index_switch v1084 : i32, i32, i32 case 0 { - ^block73: - v1119 = arith.constant 4 : u32; - v650 = hir.bitcast v1060 : u32; - v652 = arith.add v650, v1119 : u32 #[overflow = checked]; - v1118 = arith.constant 4 : u32; - v654 = arith.mod v652, v1118 : u32; - hir.assertz v654 #[code = 250]; - v1117 = arith.constant 0 : i32; - v655 = hir.int_to_ptr v652 : ptr; - hir.store v655, v1117; - v1116 = arith.constant 1 : i32; - scf.yield v1060, v1116, v1061; + ^block85: + v1138 = arith.constant 4 : u32; + v669 = hir.bitcast v1079 : u32; + v671 = arith.add v669, v1138 : u32 #[overflow = checked]; + v1137 = arith.constant 4 : u32; + v673 = arith.mod v671, v1137 : u32; + hir.assertz v673 #[code = 250]; + v1136 = arith.constant 0 : i32; + v674 = hir.int_to_ptr v671 : ptr; + hir.store v674, v1136; + v1135 = arith.constant 1 : i32; + scf.yield v1079, v1135, v1080; } default { - ^block137: - scf.yield v1062, v1063, v1064; + ^block149: + scf.yield v1081, v1082, v1083; }; - v729 = hir.bitcast v1066 : u32; - v1115 = arith.constant 4 : u32; - v731 = arith.mod v729, v1115 : u32; - hir.assertz v731 #[code = 250]; - v732 = hir.int_to_ptr v729 : ptr; - hir.store v732, v1067; - v1114 = arith.constant 16 : i32; - v737 = arith.add v1068, v1114 : i32 #[overflow = wrapping]; - v738 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v739 = hir.bitcast v738 : ptr; - hir.store v739, v737; + v748 = hir.bitcast v1085 : u32; + v1134 = arith.constant 4 : u32; + v750 = arith.mod v748, v1134 : u32; + hir.assertz v750 #[code = 250]; + v751 = hir.int_to_ptr v748 : ptr; + hir.store v751, v1086; + v1133 = arith.constant 16 : i32; + v756 = arith.add v1087, v1133 : i32 #[overflow = wrapping]; + v757 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v758 = hir.bitcast v757 : ptr; + hir.store v758, v756; builtin.ret ; }; - private builtin.function @::allocate(v740: i32, v741: i32, v742: i32) { - ^block83(v740: i32, v741: i32, v742: i32): - v744 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v745 = hir.bitcast v744 : ptr; - v746 = hir.load v745 : i32; - v747 = arith.constant 16 : i32; - v748 = arith.sub v746, v747 : i32 #[overflow = wrapping]; - v749 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v750 = hir.bitcast v749 : ptr; - hir.store v750, v748; - v743 = arith.constant 0 : i32; - v751 = arith.constant 8 : i32; - v752 = arith.add v748, v751 : i32 #[overflow = wrapping]; - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v752, v741, v742, v743) - v755 = arith.constant 12 : u32; - v754 = hir.bitcast v748 : u32; - v756 = arith.add v754, v755 : u32 #[overflow = checked]; - v757 = arith.constant 4 : u32; - v758 = arith.mod v756, v757 : u32; - hir.assertz v758 #[code = 250]; - v759 = hir.int_to_ptr v756 : ptr; - v760 = hir.load v759 : i32; - v762 = arith.constant 8 : u32; - v761 = hir.bitcast v748 : u32; - v763 = arith.add v761, v762 : u32 #[overflow = checked]; - v1153 = arith.constant 4 : u32; - v765 = arith.mod v763, v1153 : u32; - hir.assertz v765 #[code = 250]; - v766 = hir.int_to_ptr v763 : ptr; - v767 = hir.load v766 : i32; - v768 = hir.bitcast v740 : u32; - v1152 = arith.constant 4 : u32; - v770 = arith.mod v768, v1152 : u32; - hir.assertz v770 #[code = 250]; - v771 = hir.int_to_ptr v768 : ptr; - hir.store v771, v767; - v1151 = arith.constant 4 : u32; - v772 = hir.bitcast v740 : u32; - v774 = arith.add v772, v1151 : u32 #[overflow = checked]; - v1150 = arith.constant 4 : u32; - v776 = arith.mod v774, v1150 : u32; - hir.assertz v776 #[code = 250]; - v777 = hir.int_to_ptr v774 : ptr; - hir.store v777, v760; - v1149 = arith.constant 16 : i32; - v779 = arith.add v748, v1149 : i32 #[overflow = wrapping]; - v780 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr - v781 = hir.bitcast v780 : ptr; - hir.store v781, v779; + private builtin.function @::allocate(v759: i32, v760: i32, v761: i32) { + ^block95(v759: i32, v760: i32, v761: i32): + v763 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v764 = hir.bitcast v763 : ptr; + v765 = hir.load v764 : i32; + v766 = arith.constant 16 : i32; + v767 = arith.sub v765, v766 : i32 #[overflow = wrapping]; + v768 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v769 = hir.bitcast v768 : ptr; + hir.store v769, v767; + v762 = arith.constant 0 : i32; + v770 = arith.constant 8 : i32; + v771 = arith.add v767, v770 : i32 #[overflow = wrapping]; + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/alloc::alloc::Global::alloc_impl(v771, v760, v761, v762) + v774 = arith.constant 12 : u32; + v773 = hir.bitcast v767 : u32; + v775 = arith.add v773, v774 : u32 #[overflow = checked]; + v776 = arith.constant 4 : u32; + v777 = arith.mod v775, v776 : u32; + hir.assertz v777 #[code = 250]; + v778 = hir.int_to_ptr v775 : ptr; + v779 = hir.load v778 : i32; + v781 = arith.constant 8 : u32; + v780 = hir.bitcast v767 : u32; + v782 = arith.add v780, v781 : u32 #[overflow = checked]; + v1172 = arith.constant 4 : u32; + v784 = arith.mod v782, v1172 : u32; + hir.assertz v784 #[code = 250]; + v785 = hir.int_to_ptr v782 : ptr; + v786 = hir.load v785 : i32; + v787 = hir.bitcast v759 : u32; + v1171 = arith.constant 4 : u32; + v789 = arith.mod v787, v1171 : u32; + hir.assertz v789 #[code = 250]; + v790 = hir.int_to_ptr v787 : ptr; + hir.store v790, v786; + v1170 = arith.constant 4 : u32; + v791 = hir.bitcast v759 : u32; + v793 = arith.add v791, v1170 : u32 #[overflow = checked]; + v1169 = arith.constant 4 : u32; + v795 = arith.mod v793, v1169 : u32; + hir.assertz v795 #[code = 250]; + v796 = hir.int_to_ptr v793 : ptr; + hir.store v796, v779; + v1168 = arith.constant 16 : i32; + v798 = arith.add v767, v1168 : i32 #[overflow = wrapping]; + v799 = builtin.global_symbol @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__stack_pointer : ptr + v800 = hir.bitcast v799 : ptr; + hir.store v800, v798; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v782: i32, v783: i32, v784: i32, v785: i32) { - ^block85(v782: i32, v783: i32, v784: i32, v785: i32): - v1169 = arith.constant 0 : i32; - v786 = arith.constant 0 : i32; - v787 = arith.eq v784, v786 : i1; - v788 = arith.zext v787 : u32; - v789 = hir.bitcast v788 : i32; - v791 = arith.neq v789, v1169 : i1; - v1165 = scf.if v791 : i32 { - ^block140: - scf.yield v783; + private builtin.function @alloc::alloc::Global::alloc_impl(v801: i32, v802: i32, v803: i32, v804: i32) { + ^block97(v801: i32, v802: i32, v803: i32, v804: i32): + v1188 = arith.constant 0 : i32; + v805 = arith.constant 0 : i32; + v806 = arith.eq v803, v805 : i1; + v807 = arith.zext v806 : u32; + v808 = hir.bitcast v807 : i32; + v810 = arith.neq v808, v1188 : i1; + v1184 = scf.if v810 : i32 { + ^block152: + scf.yield v802; } else { - ^block88: + ^block100: hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1168 = arith.constant 0 : i32; - v793 = arith.neq v785, v1168 : i1; - v1164 = scf.if v793 : i32 { - ^block89: - v795 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v784, v783) : i32 - scf.yield v795; + v1187 = arith.constant 0 : i32; + v812 = arith.neq v804, v1187 : i1; + v1183 = scf.if v812 : i32 { + ^block101: + v814 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc_zeroed(v803, v802) : i32 + scf.yield v814; } else { - ^block90: - v794 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v784, v783) : i32 - scf.yield v794; + ^block102: + v813 = hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_alloc(v803, v802) : i32 + scf.yield v813; }; - scf.yield v1164; + scf.yield v1183; }; - v799 = arith.constant 4 : u32; - v798 = hir.bitcast v782 : u32; - v800 = arith.add v798, v799 : u32 #[overflow = checked]; - v1167 = arith.constant 4 : u32; - v802 = arith.mod v800, v1167 : u32; - hir.assertz v802 #[code = 250]; - v803 = hir.int_to_ptr v800 : ptr; - hir.store v803, v784; - v805 = hir.bitcast v782 : u32; - v1166 = arith.constant 4 : u32; - v807 = arith.mod v805, v1166 : u32; - hir.assertz v807 #[code = 250]; - v808 = hir.int_to_ptr v805 : ptr; - hir.store v808, v1165; + v818 = arith.constant 4 : u32; + v817 = hir.bitcast v801 : u32; + v819 = arith.add v817, v818 : u32 #[overflow = checked]; + v1186 = arith.constant 4 : u32; + v821 = arith.mod v819, v1186 : u32; + hir.assertz v821 #[code = 250]; + v822 = hir.int_to_ptr v819 : ptr; + hir.store v822, v803; + v824 = hir.bitcast v801 : u32; + v1185 = arith.constant 4 : u32; + v826 = arith.mod v824, v1185 : u32; + hir.assertz v826 #[code = 250]; + v827 = hir.int_to_ptr v824 : ptr; + hir.store v827, v1184; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v809: i32, v810: i32, v811: i32, v812: i32) { - ^block91(v809: i32, v810: i32, v811: i32, v812: i32): - v1195 = arith.constant 0 : i32; - v813 = arith.constant 0 : i32; - v817 = arith.eq v812, v813 : i1; - v818 = arith.zext v817 : u32; - v819 = hir.bitcast v818 : i32; - v821 = arith.neq v819, v1195 : i1; - v1182, v1183 = scf.if v821 : i32, i32 { - ^block144: - v1194 = arith.constant 0 : i32; - v815 = arith.constant 4 : i32; - scf.yield v815, v1194; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v828: i32, v829: i32, v830: i32, v831: i32) { + ^block103(v828: i32, v829: i32, v830: i32, v831: i32): + v1214 = arith.constant 0 : i32; + v832 = arith.constant 0 : i32; + v836 = arith.eq v831, v832 : i1; + v837 = arith.zext v836 : u32; + v838 = hir.bitcast v837 : i32; + v840 = arith.neq v838, v1214 : i1; + v1201, v1202 = scf.if v840 : i32, i32 { + ^block156: + v1213 = arith.constant 0 : i32; + v834 = arith.constant 4 : i32; + scf.yield v834, v1213; } else { - ^block94: - v822 = hir.bitcast v810 : u32; - v857 = arith.constant 4 : u32; - v824 = arith.mod v822, v857 : u32; - hir.assertz v824 #[code = 250]; - v825 = hir.int_to_ptr v822 : ptr; - v826 = hir.load v825 : i32; - v1192 = arith.constant 0 : i32; - v1193 = arith.constant 0 : i32; - v828 = arith.eq v826, v1193 : i1; - v829 = arith.zext v828 : u32; - v830 = hir.bitcast v829 : i32; - v832 = arith.neq v830, v1192 : i1; - v1180 = scf.if v832 : i32 { - ^block143: - v1191 = arith.constant 0 : i32; - scf.yield v1191; + ^block106: + v841 = hir.bitcast v829 : u32; + v876 = arith.constant 4 : u32; + v843 = arith.mod v841, v876 : u32; + hir.assertz v843 #[code = 250]; + v844 = hir.int_to_ptr v841 : ptr; + v845 = hir.load v844 : i32; + v1211 = arith.constant 0 : i32; + v1212 = arith.constant 0 : i32; + v847 = arith.eq v845, v1212 : i1; + v848 = arith.zext v847 : u32; + v849 = hir.bitcast v848 : i32; + v851 = arith.neq v849, v1211 : i1; + v1199 = scf.if v851 : i32 { + ^block155: + v1210 = arith.constant 0 : i32; + scf.yield v1210; } else { - ^block95: - v1190 = arith.constant 4 : u32; - v833 = hir.bitcast v809 : u32; - v835 = arith.add v833, v1190 : u32 #[overflow = checked]; - v1189 = arith.constant 4 : u32; - v837 = arith.mod v835, v1189 : u32; - hir.assertz v837 #[code = 250]; - v838 = hir.int_to_ptr v835 : ptr; - hir.store v838, v811; - v1188 = arith.constant 4 : u32; - v839 = hir.bitcast v810 : u32; - v841 = arith.add v839, v1188 : u32 #[overflow = checked]; - v1187 = arith.constant 4 : u32; - v843 = arith.mod v841, v1187 : u32; - hir.assertz v843 #[code = 250]; - v844 = hir.int_to_ptr v841 : ptr; - v845 = hir.load v844 : i32; - v846 = hir.bitcast v809 : u32; - v1186 = arith.constant 4 : u32; - v848 = arith.mod v846, v1186 : u32; - hir.assertz v848 #[code = 250]; - v849 = hir.int_to_ptr v846 : ptr; - hir.store v849, v845; - v850 = arith.mul v826, v812 : i32 #[overflow = wrapping]; - scf.yield v850; + ^block107: + v1209 = arith.constant 4 : u32; + v852 = hir.bitcast v828 : u32; + v854 = arith.add v852, v1209 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v856 = arith.mod v854, v1208 : u32; + hir.assertz v856 #[code = 250]; + v857 = hir.int_to_ptr v854 : ptr; + hir.store v857, v830; + v1207 = arith.constant 4 : u32; + v858 = hir.bitcast v829 : u32; + v860 = arith.add v858, v1207 : u32 #[overflow = checked]; + v1206 = arith.constant 4 : u32; + v862 = arith.mod v860, v1206 : u32; + hir.assertz v862 #[code = 250]; + v863 = hir.int_to_ptr v860 : ptr; + v864 = hir.load v863 : i32; + v865 = hir.bitcast v828 : u32; + v1205 = arith.constant 4 : u32; + v867 = arith.mod v865, v1205 : u32; + hir.assertz v867 #[code = 250]; + v868 = hir.int_to_ptr v865 : ptr; + hir.store v868, v864; + v869 = arith.mul v845, v831 : i32 #[overflow = wrapping]; + scf.yield v869; }; - v851 = arith.constant 8 : i32; - v1185 = arith.constant 4 : i32; - v1181 = cf.select v832, v1185, v851 : i32; - scf.yield v1181, v1180; + v870 = arith.constant 8 : i32; + v1204 = arith.constant 4 : i32; + v1200 = cf.select v851, v1204, v870 : i32; + scf.yield v1200, v1199; }; - v854 = arith.add v809, v1182 : i32 #[overflow = wrapping]; - v856 = hir.bitcast v854 : u32; - v1184 = arith.constant 4 : u32; - v858 = arith.mod v856, v1184 : u32; - hir.assertz v858 #[code = 250]; - v859 = hir.int_to_ptr v856 : ptr; - hir.store v859, v1183; + v873 = arith.add v828, v1201 : i32 #[overflow = wrapping]; + v875 = hir.bitcast v873 : u32; + v1203 = arith.constant 4 : u32; + v877 = arith.mod v875, v1203 : u32; + hir.assertz v877 #[code = 250]; + v878 = hir.int_to_ptr v875 : ptr; + hir.store v878, v1202; builtin.ret ; }; - private builtin.function @::deallocate(v860: i32, v861: i32, v862: i32) { - ^block96(v860: i32, v861: i32, v862: i32): - v1197 = arith.constant 0 : i32; - v863 = arith.constant 0 : i32; - v864 = arith.eq v862, v863 : i1; - v865 = arith.zext v864 : u32; - v866 = hir.bitcast v865 : i32; - v868 = arith.neq v866, v1197 : i1; - scf.if v868{ - ^block98: + private builtin.function @::deallocate(v879: i32, v880: i32, v881: i32) { + ^block108(v879: i32, v880: i32, v881: i32): + v1216 = arith.constant 0 : i32; + v882 = arith.constant 0 : i32; + v883 = arith.eq v881, v882 : i1; + v884 = arith.zext v883 : u32; + v885 = hir.bitcast v884 : i32; + v887 = arith.neq v885, v1216 : i1; + scf.if v887{ + ^block110: scf.yield ; } else { - ^block99: - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v860, v862, v861) + ^block111: + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/__rustc::__rust_dealloc(v879, v881, v880) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v869: i32, v870: i32, v871: i32) { - ^block100(v869: i32, v870: i32, v871: i32): + private builtin.function @alloc::raw_vec::handle_error(v888: i32, v889: i32, v890: i32) { + ^block112(v888: i32, v889: i32, v890: i32): ub.unreachable ; }; - private builtin.function @core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v872: i32, v873: i32, v874: i32) { - ^block102(v872: i32, v873: i32, v874: i32): + private builtin.function @core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime(v891: i32, v892: i32, v893: i32) { + ^block114(v891: i32, v892: i32, v893: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v875: i32, v876: i32) -> i32 { - ^block104(v875: i32, v876: i32): - v883 = arith.constant 0 : i32; - v879 = hir.bitcast v876 : u32; - v878 = hir.bitcast v875 : u32; - v880 = arith.gt v878, v879 : i1; - v881 = arith.zext v880 : u32; - v882 = hir.bitcast v881 : i32; - v884 = arith.neq v882, v883 : i1; - v885 = cf.select v884, v875, v876 : i32; - builtin.ret v885; + private builtin.function @core::ptr::alignment::Alignment::max(v894: i32, v895: i32) -> i32 { + ^block116(v894: i32, v895: i32): + v902 = arith.constant 0 : i32; + v898 = hir.bitcast v895 : u32; + v897 = hir.bitcast v894 : u32; + v899 = arith.gt v897, v898 : i1; + v900 = arith.zext v899 : u32; + v901 = hir.bitcast v900 : i32; + v903 = arith.neq v901, v902 : i1; + v904 = cf.select v903, v894, v895 : i32; + builtin.ret v904; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1222,12 +1259,12 @@ builtin.component miden:base/transaction-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000000000000000000250000003d0000000a0010002900000029000000350000000a0010002900000021000000980000002800100000000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010073722e62696c2f6372730073722e6d656d2f62696c6474732f6372732f312e342e302d7379732d62696c6474732d6e6564696d; + builtin.segment @1048576 = 0x000000250000003d0000000a0010002900000029000000350000000a00100029000000210000009700000028001000000000000100000001000000010073722e62696c2f6372730073722e6d656d2f62696c6474732f6372732f302e352e302d7379732d62696c6474732d6e6564696d; }; - public builtin.function @run(v886: felt, v887: felt, v888: felt, v889: felt) { - ^block106(v886: felt, v887: felt, v888: felt, v889: felt): - hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v886, v887, v888, v889) + public builtin.function @run(v905: felt, v906: felt, v907: felt, v908: felt) { + ^block118(v905: felt, v906: felt, v907: felt, v908: felt): + hir.exec @miden:base/transaction-script@1.0.0/basic_wallet_tx_script/miden:base/transaction-script@1.0.0#run(v905, v906, v907, v908) 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 8130da54a..be7a77e72 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.masm +++ b/tests/integration/expected/examples/basic_wallet_tx_script.masm @@ -15,35 +15,27 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.16353247543818146285 - push.6029968293504981527 - push.13612682669040488201 - push.6770632034261679822 + push.12854956927142009897 + push.11856979172059048066 + push.13357988120828940708 + push.10468901649221237290 adv.push_mapval push.262144 - push.10 + push.7 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278568 + mem_store.278560 push.0 u32assert - mem_store.278569 + mem_store.278561 end # mod miden:base/transaction-script@1.0.0::basic_wallet_tx_script -proc.miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory - trace.240 - nop - exec.::std::mem::pipe_preimage_to_memory - trace.252 - nop -end - proc.basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 trace.240 nop @@ -52,14 +44,6 @@ proc.basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_a nop end -proc.miden_base_sys::bindings::tx::extern_tx_create_note - trace.240 - nop - exec.::miden::tx::create_note - trace.252 - nop -end - proc.__wasm_call_ctors nop end @@ -184,7 +168,7 @@ proc.basic_wallet_tx_script::bindings::__link_custom_section_describing_imports end proc.__rustc::__rust_alloc - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -192,7 +176,7 @@ proc.__rustc::__rust_alloc exec.::intrinsics::mem::load_sw trace.252 nop - push.1048728 + push.1048688 u32wrapping_add movup.2 swap.1 @@ -210,7 +194,7 @@ proc.__rustc::__rust_dealloc end proc.__rustc::__rust_alloc_zeroed - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -218,7 +202,7 @@ proc.__rustc::__rust_alloc_zeroed exec.::intrinsics::mem::load_sw trace.252 nop - push.1048728 + push.1048688 u32wrapping_add dup.1 swap.2 @@ -296,7 +280,7 @@ proc.__rustc::__rust_alloc_zeroed end export.miden:base/transaction-script@1.0.0#run - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -306,7 +290,7 @@ export.miden:base/transaction-script@1.0.0#run nop push.80 u32wrapping_sub - push.1114272 + push.1114240 dup.1 swap.1 u32divmod.4 @@ -327,17 +311,36 @@ export.miden:base/transaction-script@1.0.0#run dup.7 trace.240 nop - exec.::intrinsics::advice::adv_push_mapvaln + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::advice::adv_push_mapvaln + trace.252 + nop + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::as_u64 trace.252 nop - u32split - push.0 push.3 - dup.3 - dup.3 + dup.2 + dup.2 drop u32and - assert_eq + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::assert_eq + trace.252 + nop push.2 push.0 dup.0 @@ -357,21 +360,19 @@ export.miden:base/transaction-script@1.0.0#run exec.::std::math::u64::shr trace.252 nop - dup.1 - dup.1 - push.1 - push.4294967295 trace.240 nop - exec.::std::math::u64::lt + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::from_u64_unchecked + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::felt::as_u64 trace.252 nop - assert - mul.4294967296 - add push.2 - dup.1 - u32split + movdn.2 drop swap.1 u32shl @@ -443,7 +444,7 @@ export.miden:base/transaction-script@1.0.0#run drop movup.2 drop - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -468,7 +469,7 @@ export.miden:base/transaction-script@1.0.0#run exec.::intrinsics::mem::load_sw trace.252 nop - push.1048680 + push.1048640 movup.2 swap.1 u32wrapping_add @@ -515,7 +516,7 @@ export.miden:base/transaction-script@1.0.0#run swap.4 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::std::mem::pipe_preimage_to_memory trace.252 nop drop @@ -587,7 +588,7 @@ export.miden:base/transaction-script@1.0.0#run drop push.0 else - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -660,7 +661,7 @@ export.miden:base/transaction-script@1.0.0#run exec.::intrinsics::mem::load_felt trace.252 nop - push.1048696 + push.1048656 movup.5 swap.1 u32wrapping_add @@ -791,7 +792,7 @@ export.miden:base/transaction-script@1.0.0#run exec.::intrinsics::mem::store_dw trace.252 nop - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -823,7 +824,7 @@ export.miden:base/transaction-script@1.0.0#run exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_base_sys::bindings::tx::create_note trace.252 nop - push.1048712 + push.1048672 movup.2 swap.1 u32wrapping_add @@ -1059,7 +1060,7 @@ export.miden:base/transaction-script@1.0.0#run movup.2 swap.1 u32wrapping_add - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -1090,7 +1091,7 @@ proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 end proc.wit_bindgen_rt::run_ctors_once - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -1098,7 +1099,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048732 + push.1048692 u32wrapping_add u32divmod.4 swap.1 @@ -1119,7 +1120,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114276 + push.1114244 u32divmod.4 swap.1 trace.240 @@ -1133,7 +1134,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048732 + push.1048692 movup.2 swap.1 u32wrapping_add @@ -1238,7 +1239,7 @@ proc.::alloc else trace.240 nop - exec.::intrinsics::mem::heap_base + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::intrinsics::mem::heap_base trace.252 nop trace.240 @@ -1341,6 +1342,14 @@ proc.::alloc end end +proc.intrinsics::mem::heap_base + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + proc.miden_base_sys::bindings::tx::create_note push.12 dup.5 @@ -1417,7 +1426,7 @@ proc.miden_base_sys::bindings::tx::create_note swap.4 trace.240 nop - exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden_base_sys::bindings::tx::extern_tx_create_note + exec.::miden:base/transaction-script@1.0.0::basic_wallet_tx_script::miden::tx::create_note trace.252 nop end @@ -1487,8 +1496,59 @@ proc.::deallocate - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -1498,7 +1558,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop push.16 u32wrapping_sub - push.1114272 + push.1114240 dup.1 swap.1 u32divmod.4 @@ -1591,7 +1651,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate end push.16 u32wrapping_add - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -1602,7 +1662,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate end proc.alloc::raw_vec::RawVecInner::try_allocate_in - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -1612,7 +1672,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop push.16 u32wrapping_sub - push.1114272 + push.1114240 dup.1 swap.1 u32divmod.4 @@ -1999,7 +2059,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop push.16 u32wrapping_add - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -2010,7 +2070,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in end proc.::allocate - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 @@ -2020,7 +2080,7 @@ proc.::allocate nop push.16 u32wrapping_sub - push.1114272 + push.1114240 dup.1 swap.1 u32divmod.4 @@ -2114,7 +2174,7 @@ proc.::allocate nop push.16 u32wrapping_add - push.1114272 + push.1114240 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/examples/basic_wallet_tx_script.wat b/tests/integration/expected/examples/basic_wallet_tx_script.wat index e7adabb50..4528fe803 100644 --- a/tests/integration/expected/examples/basic_wallet_tx_script.wat +++ b/tests/integration/expected/examples/basic_wallet_tx_script.wat @@ -26,75 +26,26 @@ ) ) (import "miden:basic-wallet/basic-wallet@1.0.0" (instance (;1;) (type 3))) - (type (;4;) - (instance - (type (;0;) (func (result s32))) - (export (;0;) "heap-base" (func (type 0))) - ) - ) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" (instance (;2;) (type 4))) - (type (;5;) - (instance - (type (;0;) (func (param "a" u64) (result f32))) - (export (;0;) "from-u64-unchecked" (func (type 0))) - (type (;1;) (func (param "a" u32) (result f32))) - (export (;1;) "from-u32" (func (type 1))) - (type (;2;) (func (param "a" f32) (result u64))) - (export (;2;) "as-u64" (func (type 2))) - (type (;3;) (func (param "a" f32) (param "b" f32))) - (export (;3;) "assert-eq" (func (type 3))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;3;) (type 5))) - (type (;6;) - (instance - (type (;0;) (func (param "key0" f32) (param "key1" f32) (param "key2" f32) (param "key3" f32) (result f32))) - (export (;0;) "adv-push-mapvaln" (func (type 0))) - ) - ) - (import "miden:core-intrinsics/intrinsics-advice@1.0.0" (instance (;4;) (type 6))) - (type (;7;) - (instance - (type (;0;) (func (param "num-words" f32) (param "result-ptr" s32) (param "c0" f32) (param "c1" f32) (param "c2" f32) (param "c3" f32) (result s32))) - (export (;0;) "pipe-preimage-to-memory" (func (type 0))) - ) - ) - (import "miden:core-stdlib/stdlib-mem@1.0.0" (instance (;5;) (type 7))) - (type (;8;) - (instance - (type (;0;) (func (param "tag" f32) (param "aux" f32) (param "note-type" f32) (param "execution-hint" f32) (param "recipient0" f32) (param "recipient1" f32) (param "recipient2" f32) (param "recipient3" f32) (result f32))) - (export (;0;) "create-note" (func (type 0))) - ) - ) - (import "miden:core-base/tx@1.0.0" (instance (;6;) (type 8))) (core module (;0;) - (type (;0;) (func (param f32 f32 f32 f32) (result f32))) - (type (;1;) (func (param f32) (result i64))) - (type (;2;) (func (param i32) (result f32))) - (type (;3;) (func (param f32 f32))) - (type (;4;) (func (param i64) (result f32))) - (type (;5;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) - (type (;6;) (func (param f32 f32 f32 f32 f32))) + (type (;0;) (func (param f32 f32 f32 f32 f32))) + (type (;1;) (func)) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func (param i32 i32 i32 i32 i32))) + (type (;4;) (func (param i32 i32) (result i32))) + (type (;5;) (func (param f32 f32 f32 f32))) + (type (;6;) (func (param i32 i32 i32) (result i32))) (type (;7;) (func (result i32))) - (type (;8;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) - (type (;9;) (func)) - (type (;10;) (func (param i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32 i32))) - (type (;12;) (func (param i32 i32) (result i32))) - (type (;13;) (func (param f32 f32 f32 f32))) - (type (;14;) (func (param i32 i32 i32) (result i32))) - (type (;15;) (func (param f32 f32 f32 f32 i32) (result f32))) - (type (;16;) (func (param i32 i32))) + (type (;8;) (func (param f32 f32 f32 f32 i32) (result f32))) + (type (;9;) (func (param i32 i32))) + (type (;10;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (type (;11;) (func (param i64) (result f32))) + (type (;12;) (func (param i32) (result f32))) + (type (;13;) (func (param f32) (result i64))) + (type (;14;) (func (param f32 f32))) + (type (;15;) (func (param f32 f32 f32 f32) (result f32))) + (type (;16;) (func (param f32 i32 f32 f32 f32 f32) (result i32))) (type (;17;) (func (param i32 i32 i32 i32))) - (import "miden:core-intrinsics/intrinsics-advice@1.0.0" "adv-push-mapvaln" (func $miden_stdlib_sys::intrinsics::advice::extern_adv_push_mapvaln (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "as-u64" (func $miden_stdlib_sys::intrinsics::felt::extern_as_u64 (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;2;) (type 2))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;3;) (type 3))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u64-unchecked" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked (;4;) (type 4))) - (import "miden:core-stdlib/stdlib-mem@1.0.0" "pipe-preimage-to-memory" (func $miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory (;5;) (type 5))) - (import "miden:basic-wallet/basic-wallet@1.0.0" "move-asset-to-note" (func $basic_wallet_tx_script::bindings::miden::basic_wallet::basic_wallet::move_asset_to_note::wit_import9 (;6;) (type 6))) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" "heap-base" (func $miden_sdk_alloc::heap_base (;7;) (type 7))) - (import "miden:core-base/tx@1.0.0" "create-note" (func $miden_base_sys::bindings::tx::extern_tx_create_note (;8;) (type 8))) + (import "miden:basic-wallet/basic-wallet@1.0.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))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -102,15 +53,15 @@ (export "memory" (memory 0)) (export "miden:base/transaction-script@1.0.0#run" (func $miden:base/transaction-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;9;) (type 9)) - (func $core::slice::index::slice_end_index_len_fail (;10;) (type 10) (param i32 i32 i32) + (func $__wasm_call_ctors (;1;) (type 1)) + (func $core::slice::index::slice_end_index_len_fail (;2;) (type 2) (param i32 i32 i32) local.get 0 local.get 1 local.get 2 call $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime unreachable ) - (func $ as core::ops::index::Index>::index (;11;) (type 11) (param i32 i32 i32 i32 i32) + (func $ as core::ops::index::Index>::index (;3;) (type 3) (param i32 i32 i32 i32 i32) (local i32) block ;; label = @1 local.get 3 @@ -139,20 +90,20 @@ i32.add i32.store ) - (func $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports (;12;) (type 9)) - (func $__rustc::__rust_alloc (;13;) (type 12) (param i32 i32) (result i32) + (func $basic_wallet_tx_script::bindings::__link_custom_section_describing_imports (;4;) (type 1)) + (func $__rustc::__rust_alloc (;5;) (type 4) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048728 + i32.const 1048688 i32.add local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_dealloc (;14;) (type 10) (param i32 i32 i32)) - (func $__rustc::__rust_alloc_zeroed (;15;) (type 12) (param i32 i32) (result i32) + (func $__rustc::__rust_dealloc (;6;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;7;) (type 4) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048728 + i32.const 1048688 i32.add local.get 1 local.get 0 @@ -170,7 +121,7 @@ end local.get 1 ) - (func $miden:base/transaction-script@1.0.0#run (;16;) (type 13) (param f32 f32 f32 f32) + (func $miden:base/transaction-script@1.0.0#run (;8;) (type 5) (param f32 f32 f32 f32) (local i32 i64 f32 i32 i32 i32) global.get $__stack_pointer i32.const 80 @@ -182,25 +133,25 @@ local.get 2 local.get 1 local.get 0 - call $miden_stdlib_sys::intrinsics::advice::extern_adv_push_mapvaln - call $miden_stdlib_sys::intrinsics::felt::extern_as_u64 + call $intrinsics::advice::adv_push_mapvaln + call $intrinsics::felt::as_u64 local.tee 5 i32.wrap_i64 i32.const 3 i32.and - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 4 i32.const 64 i32.add local.get 5 i64.const 2 i64.shr_u - call $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked + call $intrinsics::felt::from_u64_unchecked local.tee 6 - call $miden_stdlib_sys::intrinsics::felt::extern_as_u64 + call $intrinsics::felt::as_u64 i32.wrap_i64 i32.const 2 i32.shl @@ -229,7 +180,7 @@ local.get 2 local.get 1 local.get 0 - call $miden_stdlib_sys::stdlib::mem::extern_pipe_preimage_to_memory + call $std::mem::pipe_preimage_to_memory drop local.get 4 local.get 7 @@ -266,7 +217,7 @@ i32.const 4 i32.const 8 local.get 7 - i32.const 1048696 + i32.const 1048656 i32.add call $ as core::ops::index::Index>::index local.get 4 @@ -317,7 +268,7 @@ i32.const 8 i32.const 12 local.get 9 - i32.const 1048712 + i32.const 1048672 i32.add call $ as core::ops::index::Index>::index local.get 4 @@ -378,20 +329,20 @@ local.get 4 i32.load offset=72 local.get 9 - i32.const 1048680 + i32.const 1048640 i32.add call $alloc::raw_vec::handle_error end unreachable ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;17;) (type 9) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;9;) (type 1) return ) - (func $wit_bindgen_rt::run_ctors_once (;18;) (type 9) + (func $wit_bindgen_rt::run_ctors_once (;10;) (type 1) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048732 + i32.const 1048692 i32.add i32.load8_u br_if 0 (;@1;) @@ -399,13 +350,13 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048732 + i32.const 1048692 i32.add i32.const 1 i32.store8 end ) - (func $::alloc (;19;) (type 14) (param i32 i32 i32) (result i32) + (func $::alloc (;11;) (type 6) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -446,7 +397,7 @@ i32.load br_if 0 (;@2;) local.get 0 - call $miden_sdk_alloc::heap_base + call $intrinsics::mem::heap_base memory.size i32.const 16 i32.shl @@ -477,7 +428,10 @@ end unreachable ) - (func $miden_base_sys::bindings::tx::create_note (;20;) (type 15) (param f32 f32 f32 f32 i32) (result f32) + (func $intrinsics::mem::heap_base (;12;) (type 7) (result i32) + unreachable + ) + (func $miden_base_sys::bindings::tx::create_note (;13;) (type 8) (param f32 f32 f32 f32 i32) (result f32) local.get 0 local.get 1 local.get 2 @@ -490,9 +444,9 @@ f32.load offset=4 local.get 4 f32.load - call $miden_base_sys::bindings::tx::extern_tx_create_note + call $miden::tx::create_note ) - (func $>::from (;21;) (type 16) (param i32 i32) + (func $>::from (;14;) (type 9) (param i32 i32) local.get 0 local.get 1 i64.load offset=8 align=4 @@ -502,7 +456,28 @@ i64.load align=4 i64.store ) - (func $alloc::raw_vec::RawVecInner::deallocate (;22;) (type 10) (param i32 i32 i32) + (func $miden::tx::create_note (;15;) (type 10) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u64_unchecked (;16;) (type 11) (param i64) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;17;) (type 12) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::as_u64 (;18;) (type 13) (param f32) (result i64) + unreachable + ) + (func $intrinsics::felt::assert_eq (;19;) (type 14) (param f32 f32) + unreachable + ) + (func $intrinsics::advice::adv_push_mapvaln (;20;) (type 15) (param f32 f32 f32 f32) (result f32) + unreachable + ) + (func $std::mem::pipe_preimage_to_memory (;21;) (type 16) (param f32 i32 f32 f32 f32 f32) (result i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;22;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -534,7 +509,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;23;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;23;) (type 3) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -646,7 +621,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;24;) (type 10) (param i32 i32 i32) + (func $::allocate (;24;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -737,7 +712,7 @@ local.get 4 i32.store ) - (func $::deallocate (;27;) (type 10) (param i32 i32 i32) + (func $::deallocate (;27;) (type 2) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -748,13 +723,13 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;28;) (type 10) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;28;) (type 2) (param i32 i32 i32) unreachable ) - (func $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime (;29;) (type 10) (param i32 i32 i32) + (func $core::slice::::copy_from_slice::len_mismatch_fail::do_panic::runtime (;29;) (type 2) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;30;) (type 12) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;30;) (type 4) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -762,64 +737,25 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.4.1/src/stdlib/mem.rs\00src/lib.rs\00") - (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00(\00\00\00\98\00\00\00!\00\00\00)\00\10\00\0a\00\00\005\00\00\00)\00\00\00)\00\10\00\0a\00\00\00=\00\00\00%\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-stdlib-sys-0.5.0/src/stdlib/mem.rs\00src/lib.rs\00") + (data $.data (;1;) (i32.const 1048628) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00(\00\00\00\97\00\00\00!\00\00\00)\00\10\00\0a\00\00\005\00\00\00)\00\00\00)\00\10\00\0a\00\00\00=\00\00\00%\00\00\00") ) - (alias export 0 "word" (type (;9;))) - (alias export 4 "adv-push-mapvaln" (func (;0;))) + (alias export 0 "word" (type (;4;))) + (alias export 1 "move-asset-to-note" (func (;0;))) (core func (;0;) (canon lower (func 0))) (core instance (;0;) - (export "adv-push-mapvaln" (func 0)) - ) - (alias export 3 "as-u64" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (alias export 3 "from-u32" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (alias export 3 "assert-eq" (func (;3;))) - (core func (;3;) (canon lower (func 3))) - (alias export 3 "from-u64-unchecked" (func (;4;))) - (core func (;4;) (canon lower (func 4))) - (core instance (;1;) - (export "as-u64" (func 1)) - (export "from-u32" (func 2)) - (export "assert-eq" (func 3)) - (export "from-u64-unchecked" (func 4)) - ) - (alias export 5 "pipe-preimage-to-memory" (func (;5;))) - (core func (;5;) (canon lower (func 5))) - (core instance (;2;) - (export "pipe-preimage-to-memory" (func 5)) - ) - (alias export 1 "move-asset-to-note" (func (;6;))) - (core func (;6;) (canon lower (func 6))) - (core instance (;3;) - (export "move-asset-to-note" (func 6)) - ) - (alias export 2 "heap-base" (func (;7;))) - (core func (;7;) (canon lower (func 7))) - (core instance (;4;) - (export "heap-base" (func 7)) - ) - (alias export 6 "create-note" (func (;8;))) - (core func (;8;) (canon lower (func 8))) - (core instance (;5;) - (export "create-note" (func 8)) + (export "move-asset-to-note" (func 0)) ) - (core instance (;6;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-advice@1.0.0" (instance 0)) - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 1)) - (with "miden:core-stdlib/stdlib-mem@1.0.0" (instance 2)) - (with "miden:basic-wallet/basic-wallet@1.0.0" (instance 3)) - (with "miden:core-intrinsics/intrinsics-mem@1.0.0" (instance 4)) - (with "miden:core-base/tx@1.0.0" (instance 5)) + (core instance (;1;) (instantiate 0 + (with "miden:basic-wallet/basic-wallet@1.0.0" (instance 0)) ) ) - (alias core export 6 "memory" (core memory (;0;))) - (type (;10;) (func (param "arg" 9))) - (alias core export 6 "miden:base/transaction-script@1.0.0#run" (core func (;9;))) - (func (;9;) (type 10) (canon lift (core func 9))) - (alias export 0 "felt" (type (;11;))) - (alias export 0 "word" (type (;12;))) + (alias core export 1 "memory" (core memory (;0;))) + (type (;5;) (func (param "arg" 4))) + (alias core export 1 "miden:base/transaction-script@1.0.0#run" (core func (;1;))) + (func (;1;) (type 5) (canon lift (core func 1))) + (alias export 0 "felt" (type (;6;))) + (alias export 0 "word" (type (;7;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -833,12 +769,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;7;) (instantiate 0 - (with "import-func-run" (func 9)) - (with "import-type-felt" (type 11)) - (with "import-type-word" (type 12)) - (with "import-type-word0" (type 9)) + (instance (;2;) (instantiate 0 + (with "import-func-run" (func 1)) + (with "import-type-felt" (type 6)) + (with "import-type-word" (type 7)) + (with "import-type-word0" (type 4)) ) ) - (export (;8;) "miden:base/transaction-script@1.0.0" (instance 7)) + (export (;3;) "miden:base/transaction-script@1.0.0" (instance 2)) ) diff --git a/tests/integration/expected/examples/counter.hir b/tests/integration/expected/examples/counter.hir index add895f22..19c8cd194 100644 --- a/tests/integration/expected/examples/counter.hir +++ b/tests/integration/expected/examples/counter.hir @@ -1,437 +1,444 @@ builtin.component miden:counter-contract/counter@0.1.0 { builtin.module public @counter_contract { - private builtin.function @miden_base_sys::bindings::storage::extern_get_storage_map_item(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: i32) { - ^block3(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: i32): - v6, v7, v8, v9 = hir.exec @miden/account/get_map_item(v0, v1, v2, v3, v4) : felt, felt, felt, felt - v10 = hir.bitcast v5 : u32; - v11 = hir.int_to_ptr v10 : ptr; - hir.store v11, v6; - v12 = arith.constant 4 : u32; - v13 = arith.add v10, v12 : u32 #[overflow = checked]; - v14 = hir.int_to_ptr v13 : ptr; - hir.store v14, v7; - v15 = arith.constant 8 : u32; - v16 = arith.add v10, v15 : u32 #[overflow = checked]; - v17 = hir.int_to_ptr v16 : ptr; - hir.store v17, v8; - v18 = arith.constant 12 : u32; - v19 = arith.add v10, v18 : u32 #[overflow = checked]; - v20 = hir.int_to_ptr v19 : ptr; - hir.store v20, v9; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::storage::extern_set_storage_map_item(v21: felt, v22: felt, v23: felt, v24: felt, v25: felt, v26: felt, v27: felt, v28: felt, v29: felt, v30: i32) { - ^block7(v21: felt, v22: felt, v23: felt, v24: felt, v25: felt, v26: felt, v27: felt, v28: felt, v29: felt, v30: i32): - v31, v32, v33, v34, v35, v36, v37, v38 = hir.exec @miden/account/set_map_item(v21, v22, v23, v24, v25, v26, v27, v28, v29) : felt, felt, felt, felt, felt, felt, felt, felt - v39 = hir.bitcast v30 : u32; - v40 = hir.int_to_ptr v39 : ptr; - hir.store v40, v31; - v41 = arith.constant 4 : u32; - v42 = arith.add v39, v41 : u32 #[overflow = checked]; - v43 = hir.int_to_ptr v42 : ptr; - hir.store v43, v32; - v44 = arith.constant 8 : u32; - v45 = arith.add v39, v44 : u32 #[overflow = checked]; - v46 = hir.int_to_ptr v45 : ptr; - hir.store v46, v33; - v47 = arith.constant 12 : u32; - v48 = arith.add v39, v47 : u32 #[overflow = checked]; - v49 = hir.int_to_ptr v48 : ptr; - hir.store v49, v34; - v50 = arith.constant 16 : u32; - v51 = arith.add v39, v50 : u32 #[overflow = checked]; - v52 = hir.int_to_ptr v51 : ptr; - hir.store v52, v35; - v53 = arith.constant 20 : u32; - v54 = arith.add v39, v53 : u32 #[overflow = checked]; - v55 = hir.int_to_ptr v54 : ptr; - hir.store v55, v36; - v56 = arith.constant 24 : u32; - v57 = arith.add v39, v56 : u32 #[overflow = checked]; - v58 = hir.int_to_ptr v57 : ptr; - hir.store v58, v37; - v59 = arith.constant 28 : u32; - v60 = arith.add v39, v59 : u32 #[overflow = checked]; - v61 = hir.int_to_ptr v60 : ptr; - hir.store v61, v38; - builtin.ret ; - }; - private builtin.function @__wasm_call_ctors() { - ^block11: + ^block5: builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::storage::get_map_item(v62: i32, v63: i32) { - ^block13(v62: i32, v63: i32): - v65 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v66 = hir.bitcast v65 : ptr; - v67 = hir.load v66 : i32; - v68 = arith.constant 32 : i32; - v69 = arith.sub v67, v68 : i32 #[overflow = wrapping]; - v70 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v71 = hir.bitcast v70 : ptr; - hir.store v71, v69; - v64 = arith.constant 0 : i32; - v73 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/>::from(v64) : felt - v75 = arith.constant 12 : u32; - v74 = hir.bitcast v63 : u32; - v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v77 = arith.constant 4 : u32; - v78 = arith.mod v76, v77 : u32; - hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - v80 = hir.load v79 : felt; - v82 = arith.constant 8 : u32; - v81 = hir.bitcast v63 : u32; - v83 = arith.add v81, v82 : u32 #[overflow = checked]; - v492 = arith.constant 4 : u32; - v85 = arith.mod v83, v492 : u32; - hir.assertz v85 #[code = 250]; - v86 = hir.int_to_ptr v83 : ptr; - v87 = hir.load v86 : felt; - v491 = arith.constant 4 : u32; - v88 = hir.bitcast v63 : u32; - v90 = arith.add v88, v491 : u32 #[overflow = checked]; - v490 = arith.constant 4 : u32; - v92 = arith.mod v90, v490 : u32; - hir.assertz v92 #[code = 250]; - v93 = hir.int_to_ptr v90 : ptr; - v94 = hir.load v93 : felt; - v95 = hir.bitcast v63 : u32; - v489 = arith.constant 4 : u32; - v97 = arith.mod v95, v489 : u32; - hir.assertz v97 #[code = 250]; - v98 = hir.int_to_ptr v95 : ptr; - v99 = hir.load v98 : felt; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::extern_get_storage_map_item(v73, v80, v87, v94, v99, v69) - v488 = arith.constant 8 : u32; - v100 = hir.bitcast v69 : u32; - v102 = arith.add v100, v488 : u32 #[overflow = checked]; - v487 = arith.constant 8 : u32; - v104 = arith.mod v102, v487 : u32; - hir.assertz v104 #[code = 250]; - v105 = hir.int_to_ptr v102 : ptr; - v106 = hir.load v105 : i64; - v108 = arith.constant 24 : u32; - v107 = hir.bitcast v69 : u32; - v109 = arith.add v107, v108 : u32 #[overflow = checked]; - v486 = arith.constant 8 : u32; - v111 = arith.mod v109, v486 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - hir.store v112, v106; - v113 = hir.bitcast v69 : u32; - v485 = arith.constant 8 : u32; - v115 = arith.mod v113, v485 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - v117 = hir.load v116 : i64; - v119 = arith.constant 16 : u32; - v118 = hir.bitcast v69 : u32; - v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v484 = arith.constant 8 : u32; - v122 = arith.mod v120, v484 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - hir.store v123, v117; - v124 = arith.constant 16 : i32; - v125 = arith.add v69, v124 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v62, v125) - v483 = arith.constant 32 : i32; - v127 = arith.add v69, v483 : i32 #[overflow = wrapping]; - v128 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v129 = hir.bitcast v128 : ptr; - hir.store v129, v127; + private builtin.function @miden_base_sys::bindings::storage::get_map_item(v0: i32, v1: i32) { + ^block7(v0: i32, v1: i32): + v3 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__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:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v9 = hir.bitcast v8 : ptr; + hir.store v9, v7; + v2 = arith.constant 0 : i32; + v11 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/>::from(v2) : felt + v13 = arith.constant 12 : u32; + v12 = hir.bitcast v1 : 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 v1 : u32; + v21 = arith.add v19, v20 : u32 #[overflow = checked]; + v499 = arith.constant 4 : u32; + v23 = arith.mod v21, v499 : u32; + hir.assertz v23 #[code = 250]; + v24 = hir.int_to_ptr v21 : ptr; + v25 = hir.load v24 : felt; + v498 = arith.constant 4 : u32; + v26 = hir.bitcast v1 : u32; + v28 = arith.add v26, v498 : u32 #[overflow = checked]; + v497 = arith.constant 4 : u32; + v30 = arith.mod v28, v497 : u32; + hir.assertz v30 #[code = 250]; + v31 = hir.int_to_ptr v28 : ptr; + v32 = hir.load v31 : felt; + v33 = hir.bitcast v1 : u32; + v496 = arith.constant 4 : u32; + v35 = arith.mod v33, v496 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : felt; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::account::get_map_item(v11, v18, v25, v32, v37, v7) + v495 = arith.constant 8 : u32; + v38 = hir.bitcast v7 : u32; + v40 = arith.add v38, v495 : u32 #[overflow = checked]; + v494 = arith.constant 8 : u32; + v42 = arith.mod v40, v494 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + v44 = hir.load v43 : i64; + v46 = arith.constant 24 : u32; + v45 = hir.bitcast v7 : u32; + v47 = arith.add v45, v46 : u32 #[overflow = checked]; + v493 = arith.constant 8 : u32; + v49 = arith.mod v47, v493 : u32; + hir.assertz v49 #[code = 250]; + v50 = hir.int_to_ptr v47 : ptr; + hir.store v50, v44; + v51 = hir.bitcast v7 : u32; + v492 = arith.constant 8 : u32; + v53 = arith.mod v51, v492 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i64; + v57 = arith.constant 16 : u32; + v56 = hir.bitcast v7 : u32; + v58 = arith.add v56, v57 : u32 #[overflow = checked]; + v491 = arith.constant 8 : u32; + v60 = arith.mod v58, v491 : u32; + hir.assertz v60 #[code = 250]; + v61 = hir.int_to_ptr v58 : ptr; + hir.store v61, v55; + v62 = arith.constant 16 : i32; + v63 = arith.add v7, v62 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v0, v63) + v490 = arith.constant 32 : i32; + v65 = arith.add v7, v490 : i32 #[overflow = wrapping]; + v66 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v67 = hir.bitcast v66 : ptr; + hir.store v67, v65; builtin.ret ; }; private builtin.function @counter_contract::bindings::__link_custom_section_describing_imports() { - ^block15: + ^block9: builtin.ret ; }; public builtin.function @miden:counter-contract/counter@0.1.0#get-count() -> felt { - ^block17: - v133 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v134 = hir.bitcast v133 : ptr; - v135 = hir.load v134 : i32; - v136 = arith.constant 32 : i32; - v137 = arith.sub v135, v136 : i32 #[overflow = wrapping]; - v138 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v139 = hir.bitcast v138 : ptr; - hir.store v139, v137; + ^block11: + v71 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v72 = hir.bitcast v71 : ptr; + v73 = hir.load v72 : i32; + v74 = arith.constant 32 : i32; + v75 = arith.sub v73, v74 : i32 #[overflow = wrapping]; + v76 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v77 = hir.bitcast v76 : ptr; + hir.store v77, v75; hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/wit_bindgen_rt::run_ctors_once() - v149 = arith.constant 12 : u32; - v148 = hir.bitcast v137 : u32; - v150 = arith.add v148, v149 : u32 #[overflow = checked]; - v151 = arith.constant 4 : u32; - v152 = arith.mod v150, v151 : u32; - hir.assertz v152 #[code = 250]; - v493 = arith.constant 1 : felt; - v153 = hir.int_to_ptr v150 : ptr; - hir.store v153, v493; - v155 = arith.constant 8 : u32; - v154 = hir.bitcast v137 : u32; - v156 = arith.add v154, v155 : u32 #[overflow = checked]; + v69 = arith.constant 0 : i32; + v79 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v69) : felt + v507 = arith.constant 0 : i32; + v81 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v507) : felt + v506 = arith.constant 0 : i32; + v83 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v506) : felt + v84 = arith.constant 1 : i32; + v85 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v84) : felt + v87 = arith.constant 12 : u32; + v86 = hir.bitcast v75 : u32; + v88 = arith.add v86, v87 : u32 #[overflow = checked]; + v89 = arith.constant 4 : u32; + v90 = arith.mod v88, v89 : u32; + hir.assertz v90 #[code = 250]; + v91 = hir.int_to_ptr v88 : ptr; + hir.store v91, v85; + v93 = arith.constant 8 : u32; + v92 = hir.bitcast v75 : u32; + v94 = arith.add v92, v93 : u32 #[overflow = checked]; + v505 = arith.constant 4 : u32; + v96 = arith.mod v94, v505 : u32; + hir.assertz v96 #[code = 250]; + v97 = hir.int_to_ptr v94 : ptr; + hir.store v97, v83; v504 = arith.constant 4 : u32; - v158 = arith.mod v156, v504 : u32; - hir.assertz v158 #[code = 250]; - v496 = arith.constant 0 : felt; - v159 = hir.int_to_ptr v156 : ptr; - hir.store v159, v496; + v98 = hir.bitcast v75 : u32; + v100 = arith.add v98, v504 : u32 #[overflow = checked]; v503 = arith.constant 4 : u32; - v160 = hir.bitcast v137 : u32; - v162 = arith.add v160, v503 : u32 #[overflow = checked]; + v102 = arith.mod v100, v503 : u32; + hir.assertz v102 #[code = 250]; + v103 = hir.int_to_ptr v100 : ptr; + hir.store v103, v81; + v104 = hir.bitcast v75 : u32; v502 = arith.constant 4 : u32; - v164 = arith.mod v162, v502 : u32; - hir.assertz v164 #[code = 250]; - v501 = arith.constant 0 : felt; - v165 = hir.int_to_ptr v162 : ptr; - hir.store v165, v501; - v166 = hir.bitcast v137 : u32; - v500 = arith.constant 4 : u32; - v168 = arith.mod v166, v500 : u32; - hir.assertz v168 #[code = 250]; - v499 = arith.constant 0 : felt; - v169 = hir.int_to_ptr v166 : ptr; - hir.store v169, v499; - v170 = arith.constant 16 : i32; - v171 = arith.add v137, v170 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v171, v137) - v173 = arith.constant 28 : u32; - v172 = hir.bitcast v137 : u32; - v174 = arith.add v172, v173 : u32 #[overflow = checked]; - v498 = arith.constant 4 : u32; - v176 = arith.mod v174, v498 : u32; - hir.assertz v176 #[code = 250]; - v177 = hir.int_to_ptr v174 : ptr; - v178 = hir.load v177 : felt; - v497 = arith.constant 32 : i32; - v180 = arith.add v137, v497 : i32 #[overflow = wrapping]; - v181 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v182 = hir.bitcast v181 : ptr; - hir.store v182, v180; - builtin.ret v178; + v106 = arith.mod v104, v502 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + hir.store v107, v79; + v108 = arith.constant 16 : i32; + v109 = arith.add v75, v108 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v109, v75) + v111 = arith.constant 28 : u32; + v110 = hir.bitcast v75 : u32; + v112 = arith.add v110, v111 : u32 #[overflow = checked]; + v501 = arith.constant 4 : u32; + v114 = arith.mod v112, v501 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + v116 = hir.load v115 : felt; + v500 = arith.constant 32 : i32; + v118 = arith.add v75, v500 : i32 #[overflow = wrapping]; + v119 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v120 = hir.bitcast v119 : ptr; + hir.store v120, v118; + builtin.ret v116; }; public builtin.function @miden:counter-contract/counter@0.1.0#increment-count() -> felt { - ^block19: - v186 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v187 = hir.bitcast v186 : ptr; - v188 = hir.load v187 : i32; - v189 = arith.constant 128 : i32; - v190 = arith.sub v188, v189 : i32 #[overflow = wrapping]; - v191 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v192 = hir.bitcast v191 : ptr; - hir.store v192, v190; + ^block13: + v124 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v125 = hir.bitcast v124 : ptr; + v126 = hir.load v125 : i32; + v127 = arith.constant 128 : i32; + v128 = arith.sub v126, v127 : i32 #[overflow = wrapping]; + v129 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v130 = hir.bitcast v129 : ptr; + hir.store v130, v128; hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/wit_bindgen_rt::run_ctors_once() - v202 = arith.constant 12 : u32; - v201 = hir.bitcast v190 : u32; - v203 = arith.add v201, v202 : u32 #[overflow = checked]; - v204 = arith.constant 4 : u32; - v205 = arith.mod v203, v204 : u32; - hir.assertz v205 #[code = 250]; - v506 = arith.constant 1 : felt; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v506; - v208 = arith.constant 8 : u32; - v207 = hir.bitcast v190 : u32; - v209 = arith.add v207, v208 : u32 #[overflow = checked]; - v533 = arith.constant 4 : u32; - v211 = arith.mod v209, v533 : u32; - hir.assertz v211 #[code = 250]; - v509 = arith.constant 0 : felt; - v212 = hir.int_to_ptr v209 : ptr; - hir.store v212, v509; - v532 = arith.constant 4 : u32; - v213 = hir.bitcast v190 : u32; - v215 = arith.add v213, v532 : u32 #[overflow = checked]; - v531 = arith.constant 4 : u32; - v217 = arith.mod v215, v531 : u32; - hir.assertz v217 #[code = 250]; - v530 = arith.constant 0 : felt; - v218 = hir.int_to_ptr v215 : ptr; - hir.store v218, v530; - v219 = hir.bitcast v190 : u32; - v529 = arith.constant 4 : u32; - v221 = arith.mod v219, v529 : u32; - hir.assertz v221 #[code = 250]; - v528 = arith.constant 0 : felt; - v222 = hir.int_to_ptr v219 : ptr; - hir.store v222, v528; - v223 = arith.constant 64 : i32; - v224 = arith.add v190, v223 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v224, v190) - v228 = arith.constant 76 : u32; - v227 = hir.bitcast v190 : u32; - v229 = arith.add v227, v228 : u32 #[overflow = checked]; + v122 = arith.constant 0 : i32; + v132 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v122) : felt + v530 = arith.constant 0 : i32; + v134 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v530) : felt + v529 = arith.constant 0 : i32; + v136 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v529) : felt + v137 = arith.constant 1 : i32; + v138 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v137) : felt + v140 = arith.constant 12 : u32; + v139 = hir.bitcast v128 : u32; + v141 = arith.add v139, v140 : u32 #[overflow = checked]; + v142 = arith.constant 4 : u32; + v143 = arith.mod v141, v142 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + hir.store v144, v138; + v146 = arith.constant 8 : u32; + v145 = hir.bitcast v128 : u32; + v147 = arith.add v145, v146 : u32 #[overflow = checked]; + v528 = arith.constant 4 : u32; + v149 = arith.mod v147, v528 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v136; v527 = arith.constant 4 : u32; - v231 = arith.mod v229, v527 : u32; - hir.assertz v231 #[code = 250]; - v232 = hir.int_to_ptr v229 : ptr; - v233 = hir.load v232 : felt; - v526 = arith.constant 1 : felt; - v236 = arith.add v233, v526 : felt #[overflow = unchecked]; - v225 = arith.constant 48 : i32; - v226 = arith.add v190, v225 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/>::from(v226, v236) - v184 = arith.constant 0 : i32; - v238 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/>::from(v184) : felt - v240 = arith.constant 60 : u32; - v239 = hir.bitcast v190 : u32; - v241 = arith.add v239, v240 : u32 #[overflow = checked]; + v151 = hir.bitcast v128 : u32; + v153 = arith.add v151, v527 : u32 #[overflow = checked]; + v526 = arith.constant 4 : u32; + v155 = arith.mod v153, v526 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v134; + v157 = hir.bitcast v128 : u32; v525 = arith.constant 4 : u32; - v243 = arith.mod v241, v525 : u32; - hir.assertz v243 #[code = 250]; - v244 = hir.int_to_ptr v241 : ptr; - v245 = hir.load v244 : felt; - v247 = arith.constant 56 : u32; - v246 = hir.bitcast v190 : u32; - v248 = arith.add v246, v247 : u32 #[overflow = checked]; + v159 = arith.mod v157, v525 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + hir.store v160, v132; + v161 = arith.constant 64 : i32; + v162 = arith.add v128, v161 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::get_map_item(v162, v128) + v166 = arith.constant 76 : u32; + v165 = hir.bitcast v128 : u32; + v167 = arith.add v165, v166 : u32 #[overflow = checked]; v524 = arith.constant 4 : u32; - v250 = arith.mod v248, v524 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - v252 = hir.load v251 : felt; - v254 = arith.constant 52 : u32; - v253 = hir.bitcast v190 : u32; - v255 = arith.add v253, v254 : u32 #[overflow = checked]; - v523 = arith.constant 4 : u32; - v257 = arith.mod v255, v523 : u32; - hir.assertz v257 #[code = 250]; - v258 = hir.int_to_ptr v255 : ptr; - v259 = hir.load v258 : felt; - v261 = arith.constant 48 : u32; - v260 = hir.bitcast v190 : u32; - v262 = arith.add v260, v261 : u32 #[overflow = checked]; - v522 = arith.constant 4 : u32; - v264 = arith.mod v262, v522 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - v266 = hir.load v265 : felt; - v519 = arith.constant 64 : i32; - v268 = arith.add v190, v519 : i32 #[overflow = wrapping]; - v520 = arith.constant 0 : felt; - v521 = arith.constant 1 : felt; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_base_sys::bindings::storage::extern_set_storage_map_item(v238, v521, v520, v520, v520, v245, v252, v259, v266, v268) - v270 = arith.constant 72 : u32; - v269 = hir.bitcast v190 : u32; - v271 = arith.add v269, v270 : u32 #[overflow = checked]; - v518 = arith.constant 8 : u32; - v273 = arith.mod v271, v518 : u32; - hir.assertz v273 #[code = 250]; - v274 = hir.int_to_ptr v271 : ptr; - v275 = hir.load v274 : i64; - v277 = arith.constant 104 : u32; - v276 = hir.bitcast v190 : u32; - v278 = arith.add v276, v277 : u32 #[overflow = checked]; - v517 = arith.constant 8 : u32; - v280 = arith.mod v278, v517 : u32; - hir.assertz v280 #[code = 250]; - v281 = hir.int_to_ptr v278 : ptr; - hir.store v281, v275; - v283 = arith.constant 64 : u32; - v282 = hir.bitcast v190 : u32; - v284 = arith.add v282, v283 : u32 #[overflow = checked]; + v169 = arith.mod v167, v524 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + v171 = hir.load v170 : felt; + v523 = arith.constant 1 : i32; + v173 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v523) : felt + v174 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::add(v171, v173) : felt + v163 = arith.constant 48 : i32; + v164 = arith.add v128, v163 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/>::from(v164, v174) + v522 = arith.constant 0 : i32; + v176 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/>::from(v522) : felt + v178 = arith.constant 60 : u32; + v177 = hir.bitcast v128 : u32; + v179 = arith.add v177, v178 : u32 #[overflow = checked]; + v521 = arith.constant 4 : u32; + v181 = arith.mod v179, v521 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : felt; + v185 = arith.constant 56 : u32; + v184 = hir.bitcast v128 : u32; + v186 = arith.add v184, v185 : u32 #[overflow = checked]; + v520 = arith.constant 4 : u32; + v188 = arith.mod v186, v520 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + v190 = hir.load v189 : felt; + v192 = arith.constant 52 : u32; + v191 = hir.bitcast v128 : u32; + v193 = arith.add v191, v192 : u32 #[overflow = checked]; + v519 = arith.constant 4 : u32; + v195 = arith.mod v193, v519 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + v197 = hir.load v196 : felt; + v199 = arith.constant 48 : u32; + v198 = hir.bitcast v128 : u32; + v200 = arith.add v198, v199 : u32 #[overflow = checked]; + v518 = arith.constant 4 : u32; + v202 = arith.mod v200, v518 : u32; + hir.assertz v202 #[code = 250]; + v203 = hir.int_to_ptr v200 : ptr; + v204 = hir.load v203 : felt; + v517 = arith.constant 64 : i32; + v206 = arith.add v128, v517 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden::account::set_map_item(v176, v138, v136, v134, v132, v183, v190, v197, v204, v206) + v208 = arith.constant 72 : u32; + v207 = hir.bitcast v128 : u32; + v209 = arith.add v207, v208 : u32 #[overflow = checked]; v516 = arith.constant 8 : u32; - v286 = arith.mod v284, v516 : u32; - hir.assertz v286 #[code = 250]; - v287 = hir.int_to_ptr v284 : ptr; - v288 = hir.load v287 : i64; - v290 = arith.constant 96 : u32; - v289 = hir.bitcast v190 : u32; - v291 = arith.add v289, v290 : u32 #[overflow = checked]; + v211 = arith.mod v209, v516 : u32; + hir.assertz v211 #[code = 250]; + v212 = hir.int_to_ptr v209 : ptr; + v213 = hir.load v212 : i64; + v215 = arith.constant 104 : u32; + v214 = hir.bitcast v128 : u32; + v216 = arith.add v214, v215 : u32 #[overflow = checked]; v515 = arith.constant 8 : u32; - v293 = arith.mod v291, v515 : u32; - hir.assertz v293 #[code = 250]; - v294 = hir.int_to_ptr v291 : ptr; - hir.store v294, v288; - v295 = arith.constant 88 : i32; - v296 = arith.add v190, v295 : i32 #[overflow = wrapping]; - v297 = hir.bitcast v296 : u32; + v218 = arith.mod v216, v515 : u32; + hir.assertz v218 #[code = 250]; + v219 = hir.int_to_ptr v216 : ptr; + hir.store v219, v213; + v221 = arith.constant 64 : u32; + v220 = hir.bitcast v128 : u32; + v222 = arith.add v220, v221 : u32 #[overflow = checked]; v514 = arith.constant 8 : u32; - v299 = arith.mod v297, v514 : u32; - hir.assertz v299 #[code = 250]; - v300 = hir.int_to_ptr v297 : ptr; - v301 = hir.load v300 : i64; - v303 = arith.constant 120 : u32; - v302 = hir.bitcast v190 : u32; - v304 = arith.add v302, v303 : u32 #[overflow = checked]; + v224 = arith.mod v222, v514 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : i64; + v228 = arith.constant 96 : u32; + v227 = hir.bitcast v128 : u32; + v229 = arith.add v227, v228 : u32 #[overflow = checked]; v513 = arith.constant 8 : u32; - v306 = arith.mod v304, v513 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - hir.store v307, v301; - v309 = arith.constant 80 : u32; - v308 = hir.bitcast v190 : u32; - v310 = arith.add v308, v309 : u32 #[overflow = checked]; + v231 = arith.mod v229, v513 : u32; + hir.assertz v231 #[code = 250]; + v232 = hir.int_to_ptr v229 : ptr; + hir.store v232, v226; + v233 = arith.constant 88 : i32; + v234 = arith.add v128, v233 : i32 #[overflow = wrapping]; + v235 = hir.bitcast v234 : u32; v512 = arith.constant 8 : u32; - v312 = arith.mod v310, v512 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - v314 = hir.load v313 : i64; - v316 = arith.constant 112 : u32; - v315 = hir.bitcast v190 : u32; - v317 = arith.add v315, v316 : u32 #[overflow = checked]; + v237 = arith.mod v235, v512 : u32; + hir.assertz v237 #[code = 250]; + v238 = hir.int_to_ptr v235 : ptr; + v239 = hir.load v238 : i64; + v241 = arith.constant 120 : u32; + v240 = hir.bitcast v128 : u32; + v242 = arith.add v240, v241 : u32 #[overflow = checked]; v511 = arith.constant 8 : u32; - v319 = arith.mod v317, v511 : u32; - hir.assertz v319 #[code = 250]; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v314; - v323 = arith.constant 96 : i32; - v324 = arith.add v190, v323 : i32 #[overflow = wrapping]; - v321 = arith.constant 16 : i32; - v322 = arith.add v190, v321 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v322, v324) - v327 = arith.constant 112 : i32; - v328 = arith.add v190, v327 : i32 #[overflow = wrapping]; - v325 = arith.constant 32 : i32; - v326 = arith.add v190, v325 : i32 #[overflow = wrapping]; - hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v326, v328) - v510 = arith.constant 128 : i32; - v330 = arith.add v190, v510 : i32 #[overflow = wrapping]; - v331 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr - v332 = hir.bitcast v331 : ptr; - hir.store v332, v330; - builtin.ret v236; + v244 = arith.mod v242, v511 : u32; + hir.assertz v244 #[code = 250]; + v245 = hir.int_to_ptr v242 : ptr; + hir.store v245, v239; + v247 = arith.constant 80 : u32; + v246 = hir.bitcast v128 : u32; + v248 = arith.add v246, v247 : u32 #[overflow = checked]; + v510 = arith.constant 8 : u32; + v250 = arith.mod v248, v510 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + v252 = hir.load v251 : i64; + v254 = arith.constant 112 : u32; + v253 = hir.bitcast v128 : u32; + v255 = arith.add v253, v254 : u32 #[overflow = checked]; + v509 = arith.constant 8 : u32; + v257 = arith.mod v255, v509 : u32; + hir.assertz v257 #[code = 250]; + v258 = hir.int_to_ptr v255 : ptr; + hir.store v258, v252; + v261 = arith.constant 96 : i32; + v262 = arith.add v128, v261 : i32 #[overflow = wrapping]; + v259 = arith.constant 16 : i32; + v260 = arith.add v128, v259 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v260, v262) + v265 = arith.constant 112 : i32; + v266 = arith.add v128, v265 : i32 #[overflow = wrapping]; + v263 = arith.constant 32 : i32; + v264 = arith.add v128, v263 : i32 #[overflow = wrapping]; + hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden_stdlib_sys::intrinsics::word::Word::reverse(v264, v266) + v508 = arith.constant 128 : i32; + v268 = arith.add v128, v508 : i32 #[overflow = wrapping]; + v269 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/__stack_pointer : ptr + v270 = hir.bitcast v269 : ptr; + hir.store v270, v268; + builtin.ret v174; }; private builtin.function @wit_bindgen_rt::run_ctors_once() { - ^block21: - v334 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr - v335 = hir.bitcast v334 : ptr; - v336 = hir.load v335 : i32; - v337 = arith.constant 1048624 : i32; - v338 = arith.add v336, v337 : i32 #[overflow = wrapping]; - v339 = hir.bitcast v338 : u32; - v340 = hir.int_to_ptr v339 : ptr; - v341 = hir.load v340 : u8; - v333 = arith.constant 0 : i32; - v342 = arith.zext v341 : u32; - v343 = hir.bitcast v342 : i32; - v345 = arith.neq v343, v333 : i1; - scf.if v345{ - ^block23: + ^block15: + v272 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v273 = hir.bitcast v272 : ptr; + v274 = hir.load v273 : i32; + v275 = arith.constant 1048584 : i32; + v276 = arith.add v274, v275 : i32 #[overflow = wrapping]; + v277 = hir.bitcast v276 : u32; + v278 = hir.int_to_ptr v277 : ptr; + v279 = hir.load v278 : u8; + v271 = arith.constant 0 : i32; + v280 = arith.zext v279 : u32; + v281 = hir.bitcast v280 : i32; + v283 = arith.neq v281, v271 : i1; + scf.if v283{ + ^block17: scf.yield ; } else { - ^block24: - v346 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr - v347 = hir.bitcast v346 : ptr; - v348 = hir.load v347 : i32; + ^block18: + v284 = builtin.global_symbol @miden:counter-contract/counter@0.1.0/counter_contract/GOT.data.internal.__memory_base : ptr + v285 = hir.bitcast v284 : ptr; + v286 = hir.load v285 : i32; hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/__wasm_call_ctors() - v535 = arith.constant 1 : u8; - v537 = arith.constant 1048624 : i32; - v350 = arith.add v348, v537 : i32 #[overflow = wrapping]; - v354 = hir.bitcast v350 : u32; - v355 = hir.int_to_ptr v354 : ptr; - hir.store v355, v535; + v532 = arith.constant 1 : u8; + v534 = arith.constant 1048584 : i32; + v288 = arith.add v286, v534 : i32 #[overflow = wrapping]; + v292 = hir.bitcast v288 : u32; + v293 = hir.int_to_ptr v292 : ptr; + hir.store v293, v532; scf.yield ; }; builtin.ret ; }; + private builtin.function @miden::account::get_map_item(v294: felt, v295: felt, v296: felt, v297: felt, v298: felt, v299: i32) { + ^block19(v294: felt, v295: felt, v296: felt, v297: felt, v298: felt, v299: i32): + v300, v301, v302, v303 = hir.exec @miden/account/get_map_item(v294, v295, v296, v297, v298) : felt, felt, felt, felt + v304 = hir.bitcast v299 : u32; + v305 = hir.int_to_ptr v304 : ptr; + hir.store v305, v300; + v306 = arith.constant 4 : u32; + v307 = arith.add v304, v306 : u32 #[overflow = checked]; + v308 = hir.int_to_ptr v307 : ptr; + hir.store v308, v301; + v309 = arith.constant 8 : u32; + v310 = arith.add v304, v309 : u32 #[overflow = checked]; + v311 = hir.int_to_ptr v310 : ptr; + hir.store v311, v302; + v312 = arith.constant 12 : u32; + v313 = arith.add v304, v312 : u32 #[overflow = checked]; + v314 = hir.int_to_ptr v313 : ptr; + hir.store v314, v303; + builtin.ret ; + }; + + private builtin.function @miden::account::set_map_item(v315: felt, v316: felt, v317: felt, v318: felt, v319: felt, v320: felt, v321: felt, v322: felt, v323: felt, v324: i32) { + ^block23(v315: felt, v316: felt, v317: felt, v318: felt, v319: felt, v320: felt, v321: felt, v322: felt, v323: felt, v324: i32): + v325, v326, v327, v328, v329, v330, v331, v332 = hir.exec @miden/account/set_map_item(v315, v316, v317, v318, v319, v320, v321, v322, v323) : felt, felt, felt, felt, felt, felt, felt, felt + v333 = hir.bitcast v324 : u32; + v334 = hir.int_to_ptr v333 : ptr; + hir.store v334, v325; + v335 = arith.constant 4 : u32; + v336 = arith.add v333, v335 : u32 #[overflow = checked]; + v337 = hir.int_to_ptr v336 : ptr; + hir.store v337, v326; + v338 = arith.constant 8 : u32; + v339 = arith.add v333, v338 : u32 #[overflow = checked]; + v340 = hir.int_to_ptr v339 : ptr; + hir.store v340, v327; + v341 = arith.constant 12 : u32; + v342 = arith.add v333, v341 : u32 #[overflow = checked]; + v343 = hir.int_to_ptr v342 : ptr; + hir.store v343, v328; + v344 = arith.constant 16 : u32; + v345 = arith.add v333, v344 : u32 #[overflow = checked]; + v346 = hir.int_to_ptr v345 : ptr; + hir.store v346, v329; + v347 = arith.constant 20 : u32; + v348 = arith.add v333, v347 : u32 #[overflow = checked]; + v349 = hir.int_to_ptr v348 : ptr; + hir.store v349, v330; + v350 = arith.constant 24 : u32; + v351 = arith.add v333, v350 : u32 #[overflow = checked]; + v352 = hir.int_to_ptr v351 : ptr; + hir.store v352, v331; + v353 = arith.constant 28 : u32; + v354 = arith.add v333, v353 : u32 #[overflow = checked]; + v355 = hir.int_to_ptr v354 : ptr; + hir.store v355, v332; + builtin.ret ; + }; + private builtin.function @>::from(v356: i32) -> felt { ^block25(v356: i32): v358 = arith.constant 255 : i32; @@ -450,117 +457,117 @@ builtin.component miden:counter-contract/counter@0.1.0 { v371 = arith.constant 8 : u32; v370 = hir.bitcast v362 : u32; v372 = arith.add v370, v371 : u32 #[overflow = checked]; - v624 = arith.constant 8 : u32; - v374 = arith.mod v372, v624 : u32; + v621 = arith.constant 8 : u32; + v374 = arith.mod v372, v621 : u32; hir.assertz v374 #[code = 250]; v375 = hir.int_to_ptr v372 : ptr; v376 = hir.load v375 : i64; - v623 = arith.constant 8 : u32; + v620 = arith.constant 8 : u32; v377 = hir.bitcast v369 : u32; - v379 = arith.add v377, v623 : u32 #[overflow = checked]; + v379 = arith.add v377, v620 : u32 #[overflow = checked]; v380 = arith.constant 4 : u32; v381 = arith.mod v379, v380 : u32; hir.assertz v381 #[code = 250]; v382 = hir.int_to_ptr v379 : ptr; hir.store v382, v376; v383 = hir.bitcast v362 : u32; - v622 = arith.constant 8 : u32; - v385 = arith.mod v383, v622 : u32; + v619 = arith.constant 8 : u32; + v385 = arith.mod v383, v619 : u32; hir.assertz v385 #[code = 250]; v386 = hir.int_to_ptr v383 : ptr; v387 = hir.load v386 : i64; v388 = hir.bitcast v369 : u32; - v621 = arith.constant 4 : u32; - v390 = arith.mod v388, v621 : u32; + v618 = arith.constant 4 : u32; + v390 = arith.mod v388, v618 : u32; hir.assertz v390 #[code = 250]; v391 = hir.int_to_ptr v388 : ptr; hir.store v391, v387; v392 = arith.constant 12 : i32; v393 = arith.add v369, v392 : i32 #[overflow = wrapping]; v363 = arith.constant 0 : i32; - v592, v593, v594, v595, v596, v597 = scf.while v363, v369, v393, v361 : i32, i32, i32, i32, i32, i32 { - ^block47(v598: i32, v599: i32, v600: i32, v601: i32): - v620 = arith.constant 0 : i32; + v589, v590, v591, v592, v593, v594 = scf.while v363, v369, v393, v361 : i32, i32, i32, i32, i32, i32 { + ^block51(v595: i32, v596: i32, v597: i32, v598: i32): + v617 = arith.constant 0 : i32; v396 = arith.constant 8 : i32; - v397 = arith.eq v598, v396 : i1; + v397 = arith.eq v595, v396 : i1; v398 = arith.zext v397 : u32; v399 = hir.bitcast v398 : i32; - v401 = arith.neq v399, v620 : i1; - v586, v587 = scf.if v401 : i32, i32 { - ^block46: - v546 = ub.poison i32 : i32; - scf.yield v546, v546; + v401 = arith.neq v399, v617 : i1; + v583, v584 = scf.if v401 : i32, i32 { + ^block50: + v543 = ub.poison i32 : i32; + scf.yield v543, v543; } else { ^block32: - v403 = arith.add v599, v598 : i32 #[overflow = wrapping]; + v403 = arith.add v596, v595 : i32 #[overflow = wrapping]; v404 = hir.bitcast v403 : u32; - v619 = arith.constant 4 : u32; - v406 = arith.mod v404, v619 : u32; + v616 = arith.constant 4 : u32; + v406 = arith.mod v404, v616 : u32; hir.assertz v406 #[code = 250]; v407 = hir.int_to_ptr v404 : ptr; v408 = hir.load v407 : felt; - v410 = hir.bitcast v600 : u32; - v618 = arith.constant 4 : u32; - v412 = arith.mod v410, v618 : u32; + v410 = hir.bitcast v597 : u32; + v615 = arith.constant 4 : u32; + v412 = arith.mod v410, v615 : u32; hir.assertz v412 #[code = 250]; v413 = hir.int_to_ptr v410 : ptr; v414 = hir.load v413 : i32; v415 = hir.bitcast v403 : u32; - v617 = arith.constant 4 : u32; - v417 = arith.mod v415, v617 : u32; + v614 = arith.constant 4 : u32; + v417 = arith.mod v415, v614 : u32; hir.assertz v417 #[code = 250]; v418 = hir.int_to_ptr v415 : ptr; hir.store v418, v414; - v419 = hir.bitcast v600 : u32; - v616 = arith.constant 4 : u32; - v421 = arith.mod v419, v616 : u32; + v419 = hir.bitcast v597 : u32; + v613 = arith.constant 4 : u32; + v421 = arith.mod v419, v613 : u32; hir.assertz v421 #[code = 250]; v422 = hir.int_to_ptr v419 : ptr; hir.store v422, v408; v425 = arith.constant -4 : i32; - v426 = arith.add v600, v425 : i32 #[overflow = wrapping]; + v426 = arith.add v597, v425 : i32 #[overflow = wrapping]; v423 = arith.constant 4 : i32; - v424 = arith.add v598, v423 : i32 #[overflow = wrapping]; + v424 = arith.add v595, v423 : i32 #[overflow = wrapping]; scf.yield v424, v426; }; - v614 = ub.poison i32 : i32; - v589 = cf.select v401, v614, v601 : i32; - v615 = ub.poison i32 : i32; - v588 = cf.select v401, v615, v599 : i32; - v545 = arith.constant 1 : u32; - v538 = arith.constant 0 : u32; - v591 = cf.select v401, v538, v545 : u32; - v579 = arith.trunc v591 : i1; - scf.condition v579, v586, v588, v587, v589, v599, v601; + v611 = ub.poison i32 : i32; + v586 = cf.select v401, v611, v598 : i32; + v612 = ub.poison i32 : i32; + v585 = cf.select v401, v612, v596 : i32; + v542 = arith.constant 1 : u32; + v535 = arith.constant 0 : u32; + v588 = cf.select v401, v535, v542 : u32; + v576 = arith.trunc v588 : i1; + scf.condition v576, v583, v585, v584, v586, v596, v598; } do { - ^block48(v602: i32, v603: i32, v604: i32, v605: i32, v606: i32, v607: i32): - scf.yield v602, v603, v604, v605; + ^block52(v599: i32, v600: i32, v601: i32, v602: i32, v603: i32, v604: i32): + scf.yield v599, v600, v601, v602; }; - v613 = arith.constant 8 : u32; - v428 = hir.bitcast v596 : u32; - v430 = arith.add v428, v613 : u32 #[overflow = checked]; - v612 = arith.constant 4 : u32; - v432 = arith.mod v430, v612 : u32; + v610 = arith.constant 8 : u32; + v428 = hir.bitcast v593 : u32; + v430 = arith.add v428, v610 : u32 #[overflow = checked]; + v609 = arith.constant 4 : u32; + v432 = arith.mod v430, v609 : u32; hir.assertz v432 #[code = 250]; v433 = hir.int_to_ptr v430 : ptr; v434 = hir.load v433 : i64; - v611 = arith.constant 8 : u32; - v435 = hir.bitcast v597 : u32; - v437 = arith.add v435, v611 : u32 #[overflow = checked]; - v610 = arith.constant 8 : u32; - v439 = arith.mod v437, v610 : u32; + v608 = arith.constant 8 : u32; + v435 = hir.bitcast v594 : u32; + v437 = arith.add v435, v608 : u32 #[overflow = checked]; + v607 = arith.constant 8 : u32; + v439 = arith.mod v437, v607 : u32; hir.assertz v439 #[code = 250]; v440 = hir.int_to_ptr v437 : ptr; hir.store v440, v434; - v441 = hir.bitcast v596 : u32; - v609 = arith.constant 4 : u32; - v443 = arith.mod v441, v609 : u32; + v441 = hir.bitcast v593 : u32; + v606 = arith.constant 4 : u32; + v443 = arith.mod v441, v606 : u32; hir.assertz v443 #[code = 250]; v444 = hir.int_to_ptr v441 : ptr; v445 = hir.load v444 : i64; - v446 = hir.bitcast v597 : u32; - v608 = arith.constant 8 : u32; - v448 = arith.mod v446, v608 : u32; + v446 = hir.bitcast v594 : u32; + v605 = arith.constant 8 : u32; + v448 = arith.mod v446, v605 : u32; hir.assertz v448 #[code = 250]; v449 = hir.int_to_ptr v446 : ptr; hir.store v449, v445; @@ -569,6 +576,12 @@ builtin.component miden:counter-contract/counter@0.1.0 { private builtin.function @>::from(v450: i32, v451: felt) { ^block33(v450: i32, v451: felt): + v453 = arith.constant 0 : i32; + v454 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v453) : felt + v627 = arith.constant 0 : i32; + v456 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v627) : felt + v626 = arith.constant 0 : i32; + v458 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/intrinsics::felt::from_u32(v626) : felt v460 = arith.constant 12 : u32; v459 = hir.bitcast v450 : u32; v461 = arith.add v459, v460 : u32 #[overflow = checked]; @@ -580,31 +593,40 @@ builtin.component miden:counter-contract/counter@0.1.0 { v466 = arith.constant 8 : u32; v465 = hir.bitcast v450 : u32; v467 = arith.add v465, v466 : u32 #[overflow = checked]; - v633 = arith.constant 4 : u32; - v469 = arith.mod v467, v633 : u32; + v625 = arith.constant 4 : u32; + v469 = arith.mod v467, v625 : u32; hir.assertz v469 #[code = 250]; - v627 = arith.constant 0 : felt; v470 = hir.int_to_ptr v467 : ptr; - hir.store v470, v627; - v632 = arith.constant 4 : u32; + hir.store v470, v458; + v624 = arith.constant 4 : u32; v471 = hir.bitcast v450 : u32; - v473 = arith.add v471, v632 : u32 #[overflow = checked]; - v631 = arith.constant 4 : u32; - v475 = arith.mod v473, v631 : u32; + v473 = arith.add v471, v624 : u32 #[overflow = checked]; + v623 = arith.constant 4 : u32; + v475 = arith.mod v473, v623 : u32; hir.assertz v475 #[code = 250]; - v630 = arith.constant 0 : felt; v476 = hir.int_to_ptr v473 : ptr; - hir.store v476, v630; + hir.store v476, v456; v477 = hir.bitcast v450 : u32; - v629 = arith.constant 4 : u32; - v479 = arith.mod v477, v629 : u32; + v622 = arith.constant 4 : u32; + v479 = arith.mod v477, v622 : u32; hir.assertz v479 #[code = 250]; - v628 = arith.constant 0 : felt; v480 = hir.int_to_ptr v477 : ptr; - hir.store v480, v628; + hir.store v480, v454; builtin.ret ; }; + private builtin.function @intrinsics::felt::add(v481: felt, v482: felt) -> felt { + ^block35(v481: felt, v482: felt): + v483 = arith.add v481, v482 : felt #[overflow = unchecked]; + builtin.ret v483; + }; + + private builtin.function @intrinsics::felt::from_u32(v485: i32) -> felt { + ^block37(v485: i32): + v486 = hir.bitcast v485 : felt; + builtin.ret v486; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -613,18 +635,18 @@ builtin.component miden:counter-contract/counter@0.1.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000000000000100000001; }; public builtin.function @get-count() -> felt { - ^block35: - v481 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#get-count() : felt - builtin.ret v481; + ^block39: + v488 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#get-count() : felt + builtin.ret v488; }; public builtin.function @increment-count() -> felt { - ^block37: - v482 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#increment-count() : felt - builtin.ret v482; + ^block41: + v489 = hir.exec @miden:counter-contract/counter@0.1.0/counter_contract/miden:counter-contract/counter@0.1.0#increment-count() : felt + builtin.ret v489; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/counter.masm b/tests/integration/expected/examples/counter.masm index 97a87643a..403e68bb5 100644 --- a/tests/integration/expected/examples/counter.masm +++ b/tests/integration/expected/examples/counter.masm @@ -25,203 +25,33 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.17709194624399802691 - push.16317546024271837059 - push.2378870773206530087 - push.4951894414315594265 + push.7028007876379170725 + push.18060021366771303825 + push.13412364500725888848 + push.14178532912296021363 adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + mem_store.278537 end # mod miden:counter-contract/counter@0.1.0::counter_contract -proc.miden_base_sys::bindings::storage::extern_get_storage_map_item - trace.240 - nop - exec.::miden::account::get_map_item - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - -proc.miden_base_sys::bindings::storage::extern_set_storage_map_item - trace.240 - nop - exec.::miden::account::set_map_item - trace.252 - nop - movup.8 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.16 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.20 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.24 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - proc.__wasm_call_ctors nop end proc.miden_base_sys::bindings::storage::get_map_item - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -231,7 +61,7 @@ proc.miden_base_sys::bindings::storage::get_map_item nop push.32 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -322,7 +152,7 @@ proc.miden_base_sys::bindings::storage::get_map_item swap.5 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_base_sys::bindings::storage::extern_get_storage_map_item + exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::account::get_map_item trace.252 nop push.8 @@ -402,7 +232,7 @@ proc.miden_base_sys::bindings::storage::get_map_item nop push.32 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -417,7 +247,7 @@ proc.counter_contract::bindings::__link_custom_section_describing_imports end export.miden:counter-contract/counter@0.1.0#get-count - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -427,7 +257,7 @@ export.miden:counter-contract/counter@0.1.0#get-count nop push.32 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -442,8 +272,32 @@ export.miden:counter-contract/counter@0.1.0#get-count exec.::miden:counter-contract/counter@0.1.0::counter_contract::wit_bindgen_rt::run_ctors_once trace.252 nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.1 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop push.12 - dup.1 + dup.5 add u32assert push.4 @@ -452,8 +306,6 @@ export.miden:counter-contract/counter@0.1.0#get-count u32mod u32assert assertz - push.1 - swap.1 u32divmod.4 swap.1 trace.240 @@ -462,7 +314,7 @@ export.miden:counter-contract/counter@0.1.0#get-count trace.252 nop push.8 - dup.1 + dup.4 add u32assert push.4 @@ -471,8 +323,6 @@ export.miden:counter-contract/counter@0.1.0#get-count u32mod u32assert assertz - push.0 - swap.1 u32divmod.4 swap.1 trace.240 @@ -481,7 +331,7 @@ export.miden:counter-contract/counter@0.1.0#get-count trace.252 nop push.4 - dup.1 + dup.3 add u32assert push.4 @@ -490,8 +340,6 @@ export.miden:counter-contract/counter@0.1.0#get-count u32mod u32assert assertz - push.0 - swap.1 u32divmod.4 swap.1 trace.240 @@ -499,15 +347,13 @@ export.miden:counter-contract/counter@0.1.0#get-count exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + dup.1 push.4 dup.1 swap.1 u32mod u32assert assertz - push.0 - swap.1 u32divmod.4 swap.1 trace.240 @@ -547,7 +393,7 @@ export.miden:counter-contract/counter@0.1.0#get-count movup.2 swap.1 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -558,7 +404,7 @@ export.miden:counter-contract/counter@0.1.0#get-count end export.miden:counter-contract/counter@0.1.0#increment-count - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -568,7 +414,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count nop push.128 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -583,8 +429,32 @@ export.miden:counter-contract/counter@0.1.0#increment-count exec.::miden:counter-contract/counter@0.1.0::counter_contract::wit_bindgen_rt::run_ctors_once trace.252 nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.1 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop push.12 - dup.1 + dup.5 add u32assert push.4 @@ -593,7 +463,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count u32mod u32assert assertz - push.1 + dup.1 swap.1 u32divmod.4 swap.1 @@ -603,7 +473,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.8 - dup.1 + dup.5 add u32assert push.4 @@ -612,7 +482,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count u32mod u32assert assertz - push.0 + dup.2 swap.1 u32divmod.4 swap.1 @@ -622,7 +492,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.4 - dup.1 + dup.5 add u32assert push.4 @@ -631,7 +501,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count u32mod u32assert assertz - push.0 + dup.3 swap.1 u32divmod.4 swap.1 @@ -640,14 +510,14 @@ export.miden:counter-contract/counter@0.1.0#increment-count exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + dup.4 push.4 dup.1 swap.1 u32mod u32assert assertz - push.0 + dup.4 swap.1 u32divmod.4 swap.1 @@ -657,10 +527,10 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.64 - dup.1 + dup.5 swap.1 u32wrapping_add - dup.1 + dup.5 swap.1 trace.240 nop @@ -668,7 +538,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.76 - dup.1 + dup.5 add u32assert push.4 @@ -685,9 +555,19 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.1 - add + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::add + trace.252 + nop push.48 - dup.2 + dup.6 swap.1 u32wrapping_add dup.1 @@ -704,7 +584,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.60 - dup.3 + dup.7 add u32assert push.4 @@ -721,7 +601,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.56 - dup.4 + dup.8 add u32assert push.4 @@ -738,7 +618,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.52 - dup.5 + dup.9 add u32assert push.4 @@ -755,7 +635,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.48 - dup.6 + dup.10 add u32assert push.4 @@ -772,28 +652,23 @@ export.miden:counter-contract/counter@0.1.0#increment-count trace.252 nop push.64 - dup.7 + dup.11 swap.1 u32wrapping_add - push.0 - push.1 - dup.1 - dup.2 - movup.6 - swap.7 - movdn.6 - movup.5 - swap.8 - movdn.5 swap.1 - swap.3 + swap.8 swap.2 + swap.7 swap.1 - swap.4 swap.9 + swap.3 + swap.6 + swap.10 + swap.4 + swap.5 trace.240 nop - exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden_base_sys::bindings::storage::extern_set_storage_map_item + exec.::miden:counter-contract/counter@0.1.0::counter_contract::miden::account::set_map_item trace.252 nop push.72 @@ -962,7 +837,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count movup.2 swap.1 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -973,7 +848,7 @@ export.miden:counter-contract/counter@0.1.0#increment-count end proc.wit_bindgen_rt::run_ctors_once - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -981,7 +856,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048624 + push.1048584 u32wrapping_add u32divmod.4 swap.1 @@ -1002,7 +877,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -1016,7 +891,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048624 + push.1048584 movup.2 swap.1 u32wrapping_add @@ -1044,13 +919,183 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.miden::account::get_map_item + trace.240 + nop + exec.::miden::account::get_map_item + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +proc.miden::account::set_map_item + trace.240 + nop + exec.::miden::account::set_map_item + trace.252 + nop + movup.8 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + proc.>::from push.255 u32and end proc.miden_stdlib_sys::intrinsics::word::Word::reverse - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1318,8 +1363,26 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse end proc.>::from + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:counter-contract/counter@0.1.0::counter_contract::intrinsics::felt::from_u32 + trace.252 + nop push.12 - dup.1 + dup.4 add u32assert push.4 @@ -1328,7 +1391,7 @@ proc.>::from i32.const 0 @@ -191,7 +169,7 @@ local.get 0 i32.const 64 i32.add - call $miden_base_sys::bindings::storage::extern_set_storage_map_item + call $miden::account::set_map_item local.get 0 local.get 0 i64.load offset=72 @@ -230,11 +208,11 @@ global.set $__stack_pointer local.get 5 ) - (func $wit_bindgen_rt::run_ctors_once (;9;) (type 4) + (func $wit_bindgen_rt::run_ctors_once (;5;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048624 + i32.const 1048584 i32.add i32.load8_u br_if 0 (;@1;) @@ -242,19 +220,25 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048624 + i32.const 1048584 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;10;) (type 1) (param i32) (result f32) + (func $miden::account::get_map_item (;6;) (type 3) (param f32 f32 f32 f32 f32 i32) + unreachable + ) + (func $miden::account::set_map_item (;7;) (type 4) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + unreachable + ) + (func $>::from (;8;) (type 5) (param i32) (result f32) local.get 0 i32.const 255 i32.and f32.reinterpret_i32 ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;11;) (type 5) (param i32 i32) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;9;) (type 1) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -312,16 +296,16 @@ i64.load align=4 i64.store ) - (func $>::from (;12;) (type 7) (param i32 f32) + (func $>::from (;10;) (type 6) (param i32 f32) (local f32 f32 f32) i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 2 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 3 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 4 local.get 0 local.get 1 @@ -336,38 +320,24 @@ local.get 2 f32.store ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\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\03\01\00\01\13count_map\019counter contract storage map") - ) - (alias export 2 "felt" (type (;3;))) - (alias export 1 "get-map-item" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 1 "set-map-item" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (core instance (;0;) - (export "get-map-item" (func 0)) - (export "set-map-item" (func 1)) - ) - (alias export 0 "from-u32" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (alias export 0 "add" (func (;3;))) - (core func (;3;) (canon lower (func 3))) - (core instance (;1;) - (export "from-u32" (func 2)) - (export "add" (func 3)) - ) - (core instance (;2;) (instantiate 0 - (with "miden:core-base/account@1.0.0" (instance 0)) - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 1)) + (func $intrinsics::felt::add (;11;) (type 7) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;12;) (type 5) (param i32) (result f32) + unreachable ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\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\03\01\00\01\13count_map\019counter contract storage map") ) - (alias core export 2 "memory" (core memory (;0;))) - (type (;4;) (func (result 3))) - (alias core export 2 "miden:counter-contract/counter@0.1.0#get-count" (core func (;4;))) - (func (;4;) (type 4) (canon lift (core func 4))) - (alias core export 2 "miden:counter-contract/counter@0.1.0#increment-count" (core func (;5;))) - (func (;5;) (type 4) (canon lift (core func 5))) - (alias export 2 "felt" (type (;5;))) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (result 1))) + (alias core export 0 "miden:counter-contract/counter@0.1.0#get-count" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias core export 0 "miden:counter-contract/counter@0.1.0#increment-count" (core func (;1;))) + (func (;1;) (type 2) (canon lift (core func 1))) + (alias export 0 "felt" (type (;3;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -380,12 +350,12 @@ (export (;2;) "get-count" (func 0) (func (type 5))) (export (;3;) "increment-count" (func 1) (func (type 5))) ) - (instance (;3;) (instantiate 0 - (with "import-func-get-count" (func 4)) - (with "import-func-increment-count" (func 5)) - (with "import-type-felt" (type 5)) - (with "import-type-felt0" (type 3)) + (instance (;1;) (instantiate 0 + (with "import-func-get-count" (func 0)) + (with "import-func-increment-count" (func 1)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) ) ) - (export (;4;) "miden:counter-contract/counter@0.1.0" (instance 3)) + (export (;2;) "miden:counter-contract/counter@0.1.0" (instance 1)) ) diff --git a/tests/integration/expected/examples/counter_note.hir b/tests/integration/expected/examples/counter_note.hir index 1937d3d35..812a30312 100644 --- a/tests/integration/expected/examples/counter_note.hir +++ b/tests/integration/expected/examples/counter_note.hir @@ -27,10 +27,11 @@ builtin.component miden:base/note-script@1.0.0 { hir.exec @miden:base/note-script@1.0.0/counter_note/wit_bindgen_rt::run_ctors_once() v7 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0() : felt v8 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0() : felt + v9 = arith.constant 1 : i32; + v10 = hir.exec @miden:base/note-script@1.0.0/counter_note/intrinsics::felt::from_u32(v9) : felt + v11 = hir.exec @miden:base/note-script@1.0.0/counter_note/intrinsics::felt::add(v7, v10) : felt v12 = hir.exec @miden:base/note-script@1.0.0/counter_note/counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0() : felt - v40 = arith.constant 1 : felt; - v11 = arith.add v7, v40 : felt #[overflow = unchecked]; - hir.assert_eq v12, v11; + hir.exec @miden:base/note-script@1.0.0/counter_note/intrinsics::felt::assert_eq(v12, v11) builtin.ret ; }; @@ -39,7 +40,7 @@ builtin.component miden:base/note-script@1.0.0 { v14 = builtin.global_symbol @miden:base/note-script@1.0.0/counter_note/GOT.data.internal.__memory_base : ptr v15 = hir.bitcast v14 : ptr; v16 = hir.load v15 : i32; - v17 = arith.constant 1048628 : i32; + v17 = arith.constant 1048588 : i32; v18 = arith.add v16, v17 : i32 #[overflow = wrapping]; v19 = hir.bitcast v18 : u32; v20 = hir.int_to_ptr v19 : ptr; @@ -57,17 +58,35 @@ 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 1048628 : i32; - v30 = arith.add v28, v44 : i32 #[overflow = wrapping]; + v50 = arith.constant 1 : u8; + v52 = arith.constant 1048588 : i32; + v30 = arith.add v28, v52 : i32 #[overflow = wrapping]; v34 = hir.bitcast v30 : u32; v35 = hir.int_to_ptr v34 : ptr; - hir.store v35, v42; + hir.store v35, v50; scf.yield ; }; builtin.ret ; }; + private builtin.function @intrinsics::felt::add(v36: felt, v37: felt) -> felt { + ^block20(v36: felt, v37: felt): + v38 = arith.add v36, v37 : felt #[overflow = unchecked]; + builtin.ret v38; + }; + + private builtin.function @intrinsics::felt::from_u32(v40: i32) -> felt { + ^block22(v40: i32): + v41 = hir.bitcast v40 : felt; + builtin.ret v41; + }; + + private builtin.function @intrinsics::felt::assert_eq(v43: felt, v44: felt) { + ^block24(v43: felt, v44: felt): + hir.assert_eq v43, v44; + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -76,12 +95,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x00000000000000000000000000000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000010000000100000001; }; - public builtin.function @run(v36: felt, v37: felt, v38: felt, v39: felt) { - ^block20(v36: felt, v37: felt, v38: felt, v39: felt): - hir.exec @miden:base/note-script@1.0.0/counter_note/miden:base/note-script@1.0.0#run(v36, v37, v38, v39) + public builtin.function @run(v45: felt, v46: felt, v47: felt, v48: felt) { + ^block26(v45: felt, v46: felt, v47: felt, v48: felt): + hir.exec @miden:base/note-script@1.0.0/counter_note/miden:base/note-script@1.0.0#run(v45, v46, v47, v48) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/counter_note.masm b/tests/integration/expected/examples/counter_note.masm index a9221aa19..9d0563553 100644 --- a/tests/integration/expected/examples/counter_note.masm +++ b/tests/integration/expected/examples/counter_note.masm @@ -15,23 +15,23 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.10372512867789291194 - push.8847140879871234022 - push.6349320981753112911 - push.1226644495927898530 + push.511068398781876708 + push.4034132635148770913 + push.11946245983825022717 + push.413851799653899214 adv.push_mapval push.262144 - push.4 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + mem_store.278537 end # mod miden:base/note-script@1.0.0::counter_note @@ -81,20 +81,32 @@ export.miden:base/note-script@1.0.0#run trace.252 nop drop + push.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::counter_note::counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 + exec.::miden:base/note-script@1.0.0::counter_note::intrinsics::felt::from_u32 trace.252 nop - push.1 - movup.2 swap.1 - add - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::counter_note::intrinsics::felt::add + trace.252 + nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::counter_note::counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 + trace.252 + nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::counter_note::intrinsics::felt::assert_eq + trace.252 + nop end proc.wit_bindgen_rt::run_ctors_once - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -102,7 +114,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048628 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -123,7 +135,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -137,7 +149,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048628 + push.1048588 movup.2 swap.1 u32wrapping_add @@ -165,3 +177,15 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.intrinsics::felt::add + add +end + +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + diff --git a/tests/integration/expected/examples/counter_note.wat b/tests/integration/expected/examples/counter_note.wat index 95cb4ea13..64a827447 100644 --- a/tests/integration/expected/examples/counter_note.wat +++ b/tests/integration/expected/examples/counter_note.wat @@ -20,29 +20,15 @@ ) ) (import "miden:counter-contract/counter@0.1.0" (instance (;1;) (type 2))) - (type (;3;) - (instance - (type (;0;) (func (param "a" u32) (result f32))) - (export (;0;) "from-u32" (func (type 0))) - (type (;1;) (func (param "a" f32) (param "b" f32) (result f32))) - (export (;1;) "add" (func (type 1))) - (type (;2;) (func (param "a" f32) (param "b" f32))) - (export (;2;) "assert-eq" (func (type 2))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;2;) (type 3))) (core module (;0;) (type (;0;) (func (result f32))) - (type (;1;) (func (param i32) (result f32))) - (type (;2;) (func (param f32 f32) (result f32))) - (type (;3;) (func (param f32 f32))) - (type (;4;) (func)) - (type (;5;) (func (param f32 f32 f32 f32))) + (type (;1;) (func)) + (type (;2;) (func (param f32 f32 f32 f32))) + (type (;3;) (func (param f32 f32) (result f32))) + (type (;4;) (func (param i32) (result f32))) + (type (;5;) (func (param f32 f32))) (import "miden:counter-contract/counter@0.1.0" "get-count" (func $counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 (;0;) (type 0))) (import "miden:counter-contract/counter@0.1.0" "increment-count" (func $counter_note::bindings::miden::counter_contract::counter::increment_count::wit_import0 (;1;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;2;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "add" (func $miden_stdlib_sys::intrinsics::felt::extern_add (;3;) (type 2))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;4;) (type 3))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -50,9 +36,9 @@ (export "memory" (memory 0)) (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $counter_note::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;5;) (type 4)) - (func $counter_note::bindings::__link_custom_section_describing_imports (;6;) (type 4)) - (func $miden:base/note-script@1.0.0#run (;7;) (type 5) (param f32 f32 f32 f32) + (func $__wasm_call_ctors (;2;) (type 1)) + (func $counter_note::bindings::__link_custom_section_describing_imports (;3;) (type 1)) + (func $miden:base/note-script@1.0.0#run (;4;) (type 2) (param f32 f32 f32 f32) (local f32) call $wit_bindgen_rt::run_ctors_once call $counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 @@ -61,18 +47,18 @@ drop local.get 4 i32.const 1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 4 call $counter_note::bindings::miden::counter_contract::counter::get_count::wit_import0 local.get 4 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::assert_eq ) - (func $wit_bindgen_rt::run_ctors_once (;8;) (type 4) + (func $wit_bindgen_rt::run_ctors_once (;5;) (type 1) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048628 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -80,15 +66,24 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048628 + i32.const 1048588 i32.add i32.const 1 i32.store8 end ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00") + (func $intrinsics::felt::add (;6;) (type 3) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;7;) (type 4) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;8;) (type 5) (param f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;4;))) + (alias export 0 "word" (type (;3;))) (alias export 1 "get-count" (func (;0;))) (core func (;0;) (canon lower (func 0))) (alias export 1 "increment-count" (func (;1;))) @@ -97,28 +92,16 @@ (export "get-count" (func 0)) (export "increment-count" (func 1)) ) - (alias export 2 "from-u32" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (alias export 2 "add" (func (;3;))) - (core func (;3;) (canon lower (func 3))) - (alias export 2 "assert-eq" (func (;4;))) - (core func (;4;) (canon lower (func 4))) - (core instance (;1;) - (export "from-u32" (func 2)) - (export "add" (func 3)) - (export "assert-eq" (func 4)) - ) - (core instance (;2;) (instantiate 0 + (core instance (;1;) (instantiate 0 (with "miden:counter-contract/counter@0.1.0" (instance 0)) - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 1)) ) ) - (alias core export 2 "memory" (core memory (;0;))) - (type (;5;) (func (param "arg" 4))) - (alias core export 2 "miden:base/note-script@1.0.0#run" (core func (;5;))) - (func (;5;) (type 5) (canon lift (core func 5))) - (alias export 0 "felt" (type (;6;))) - (alias export 0 "word" (type (;7;))) + (alias core export 1 "memory" (core memory (;0;))) + (type (;4;) (func (param "arg" 3))) + (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;2;))) + (func (;2;) (type 4) (canon lift (core func 2))) + (alias export 0 "felt" (type (;5;))) + (alias export 0 "word" (type (;6;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -132,12 +115,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;3;) (instantiate 0 - (with "import-func-run" (func 5)) - (with "import-type-felt" (type 6)) - (with "import-type-word" (type 7)) - (with "import-type-word0" (type 4)) + (instance (;2;) (instantiate 0 + (with "import-func-run" (func 2)) + (with "import-type-felt" (type 5)) + (with "import-type-word" (type 6)) + (with "import-type-word0" (type 3)) ) ) - (export (;4;) "miden:base/note-script@1.0.0" (instance 3)) + (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) ) diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index 2bfcaa31c..9a3f6c6a8 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -6,1195 +6,1207 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::account::extern_account_get_id(v4: i32) { - ^block8(v4: i32): - v5, v6 = hir.exec @miden/account/get_id() : felt, felt - v7 = hir.bitcast v4 : u32; - v8 = hir.int_to_ptr v7 : ptr; - hir.store v8, v5; - v9 = arith.constant 4 : u32; - v10 = arith.add v7, v9 : u32 #[overflow = checked]; - v11 = hir.int_to_ptr v10 : ptr; - hir.store v11, v6; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::note::extern_note_get_inputs(v12: i32) -> i32 { - ^block12(v12: i32): - v13, v14 = hir.exec @miden/note/get_inputs(v12) : i32, i32 - builtin.ret v13; - }; - - private builtin.function @miden_base_sys::bindings::note::extern_note_get_assets(v16: i32) -> i32 { - ^block15(v16: i32): - v17, v18 = hir.exec @miden/note/get_assets(v16) : i32, i32 - builtin.ret v17; - }; - private builtin.function @__wasm_call_ctors() { - ^block19: + ^block8: builtin.ret ; }; private builtin.function @p2id::bindings::__link_custom_section_describing_imports() { - ^block21: + ^block10: builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc(v20: i32, v21: i32) -> i32 { - ^block23(v20: i32, v21: i32): - v23 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v24 = hir.bitcast v23 : ptr; - v25 = hir.load v24 : i32; - v26 = arith.constant 1048704 : i32; - v27 = arith.add v25, v26 : i32 #[overflow = wrapping]; - v28 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v27, v21, v20) : i32 - builtin.ret v28; + private builtin.function @__rustc::__rust_alloc(v4: i32, v5: i32) -> i32 { + ^block12(v4: i32, v5: i32): + v7 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v8 = hir.bitcast v7 : ptr; + v9 = hir.load v8 : i32; + v10 = arith.constant 1048664 : i32; + v11 = arith.add v9, v10 : i32 #[overflow = wrapping]; + v12 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v11, v5, v4) : i32 + builtin.ret v12; }; - private builtin.function @__rustc::__rust_dealloc(v29: i32, v30: i32, v31: i32) { - ^block25(v29: i32, v30: i32, v31: i32): + private builtin.function @__rustc::__rust_dealloc(v13: i32, v14: i32, v15: i32) { + ^block14(v13: i32, v14: i32, v15: i32): builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v32: i32, v33: i32) -> i32 { - ^block27(v32: i32, v33: i32): - v35 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v36 = hir.bitcast v35 : ptr; - v37 = hir.load v36 : i32; - v38 = arith.constant 1048704 : i32; - v39 = arith.add v37, v38 : i32 #[overflow = wrapping]; - v40 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v39, v33, v32) : i32 - v855 = arith.constant 0 : i32; - v41 = arith.constant 0 : i32; - v42 = arith.eq v40, v41 : i1; - v43 = arith.zext v42 : u32; - v44 = hir.bitcast v43 : i32; - v46 = arith.neq v44, v855 : i1; - scf.if v46{ - ^block29: + private builtin.function @__rustc::__rust_alloc_zeroed(v16: i32, v17: i32) -> i32 { + ^block16(v16: i32, v17: i32): + v19 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v20 = hir.bitcast v19 : ptr; + v21 = hir.load v20 : i32; + v22 = arith.constant 1048664 : i32; + v23 = arith.add v21, v22 : i32 #[overflow = wrapping]; + v24 = hir.exec @miden:base/note-script@1.0.0/p2id/::alloc(v23, v17, v16) : i32 + v859 = arith.constant 0 : i32; + v25 = arith.constant 0 : i32; + v26 = arith.eq v24, v25 : i1; + v27 = arith.zext v26 : u32; + v28 = hir.bitcast v27 : i32; + v30 = arith.neq v28, v859 : i1; + scf.if v30{ + ^block18: scf.yield ; } else { - ^block30: - v853 = arith.constant 0 : i32; - v854 = arith.constant 0 : i32; - v48 = arith.eq v32, v854 : i1; - v49 = arith.zext v48 : u32; - v50 = hir.bitcast v49 : i32; - v52 = arith.neq v50, v853 : i1; - scf.if v52{ - ^block106: + ^block19: + v857 = arith.constant 0 : i32; + v858 = arith.constant 0 : i32; + v32 = arith.eq v16, v858 : i1; + v33 = arith.zext v32 : u32; + v34 = hir.bitcast v33 : i32; + v36 = arith.neq v34, v857 : i1; + scf.if v36{ + ^block110: scf.yield ; } else { - ^block31: - v847 = arith.constant 0 : u8; - v55 = hir.bitcast v32 : u32; - v56 = hir.bitcast v40 : u32; - v57 = hir.int_to_ptr v56 : ptr; - hir.mem_set v57, v55, v847; + ^block20: + v851 = arith.constant 0 : u8; + v39 = hir.bitcast v16 : u32; + v40 = hir.bitcast v24 : u32; + v41 = hir.int_to_ptr v40 : ptr; + hir.mem_set v41, v39, v851; scf.yield ; }; scf.yield ; }; - builtin.ret v40; + builtin.ret v24; }; - public builtin.function @miden:base/note-script@1.0.0#run(v59: felt, v60: felt, v61: felt, v62: felt) { - ^block32(v59: felt, v60: felt, v61: felt, v62: felt): - v66 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v67 = hir.bitcast v66 : ptr; - v68 = hir.load v67 : i32; - v69 = arith.constant 48 : i32; - v70 = arith.sub v68, v69 : i32 #[overflow = wrapping]; - v71 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v72 = hir.bitcast v71 : ptr; - hir.store v72, v70; + public builtin.function @miden:base/note-script@1.0.0#run(v43: felt, v44: felt, v45: felt, v46: felt) { + ^block21(v43: felt, v44: felt, v45: felt, v46: felt): + v50 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v51 = hir.bitcast v50 : ptr; + v52 = hir.load v51 : i32; + v53 = arith.constant 48 : i32; + v54 = arith.sub v52, v53 : i32 #[overflow = wrapping]; + v55 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v56 = hir.bitcast v55 : ptr; + hir.store v56, v54; hir.exec @miden:base/note-script@1.0.0/p2id/wit_bindgen_rt::run_ctors_once() - v73 = arith.constant 16 : i32; - v74 = arith.add v70, v73 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::get_inputs(v74) - v76 = arith.constant 24 : u32; - v75 = hir.bitcast v70 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - 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 : i32; - v82 = hir.cast v81 : u32; - v912 = scf.index_switch v82 : u32 + v57 = arith.constant 16 : i32; + v58 = arith.add v54, v57 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::get_inputs(v58) + v60 = arith.constant 24 : u32; + v59 = hir.bitcast v54 : u32; + v61 = arith.add v59, v60 : u32 #[overflow = checked]; + v62 = arith.constant 4 : u32; + v63 = arith.mod v61, v62 : u32; + hir.assertz v63 #[code = 250]; + v64 = hir.int_to_ptr v61 : ptr; + v65 = hir.load v64 : i32; + v66 = hir.cast v65 : u32; + v916 = scf.index_switch v66 : u32 case 0 { - ^block109: - v952 = arith.constant 1 : u32; - scf.yield v952; + ^block113: + v956 = arith.constant 1 : u32; + scf.yield v956; } case 1 { - ^block110: - v951 = arith.constant 1 : u32; - scf.yield v951; + ^block114: + v955 = arith.constant 1 : u32; + scf.yield v955; } default { - ^block34: - v84 = arith.constant 20 : u32; - v83 = hir.bitcast v70 : u32; - v85 = arith.add v83, v84 : u32 #[overflow = checked]; + ^block23: + v68 = arith.constant 20 : u32; + v67 = hir.bitcast v54 : u32; + v69 = arith.add v67, v68 : u32 #[overflow = checked]; + v984 = arith.constant 4 : u32; + v71 = arith.mod v69, v984 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i32; + v983 = arith.constant 4 : u32; + v74 = hir.bitcast v73 : u32; + v76 = arith.add v74, v983 : u32 #[overflow = checked]; + v982 = arith.constant 4 : u32; + v78 = arith.mod v76, v982 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : felt; + v81 = hir.bitcast v73 : u32; + v981 = arith.constant 4 : u32; + v83 = arith.mod v81, v981 : u32; + hir.assertz v83 #[code = 250]; + v84 = hir.int_to_ptr v81 : ptr; + v85 = hir.load v84 : felt; + v86 = arith.constant 8 : i32; + v87 = arith.add v54, v86 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::account::get_id(v87) + v89 = arith.constant 12 : u32; + v88 = hir.bitcast v54 : u32; + v90 = arith.add v88, v89 : u32 #[overflow = checked]; v980 = arith.constant 4 : u32; - v87 = arith.mod v85, v980 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - v89 = hir.load v88 : i32; + v92 = arith.mod v90, v980 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + v94 = hir.load v93 : felt; + v96 = arith.constant 8 : u32; + v95 = hir.bitcast v54 : u32; + v97 = arith.add v95, v96 : u32 #[overflow = checked]; v979 = arith.constant 4 : u32; - v90 = hir.bitcast v89 : u32; - v92 = arith.add v90, v979 : u32 #[overflow = checked]; - v978 = arith.constant 4 : u32; - v94 = arith.mod v92, v978 : u32; - hir.assertz v94 #[code = 250]; - v95 = hir.int_to_ptr v92 : ptr; - v96 = hir.load v95 : felt; - v97 = hir.bitcast v89 : u32; - v977 = arith.constant 4 : u32; - v99 = arith.mod v97, v977 : u32; + v99 = arith.mod v97, v979 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : felt; - v102 = arith.constant 8 : i32; - v103 = arith.add v70, v102 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::account::get_id(v103) - v105 = arith.constant 12 : u32; - v104 = hir.bitcast v70 : u32; + hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::assert_eq(v101, v85) + hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::assert_eq(v94, v80) + v102 = arith.constant 28 : i32; + v103 = arith.add v54, v102 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::get_assets(v103) + v105 = arith.constant 36 : u32; + v104 = hir.bitcast v54 : u32; v106 = arith.add v104, v105 : u32 #[overflow = checked]; - v976 = arith.constant 4 : u32; - v108 = arith.mod v106, v976 : u32; + v978 = arith.constant 4 : u32; + v108 = arith.mod v106, v978 : u32; hir.assertz v108 #[code = 250]; - v109 = hir.int_to_ptr v106 : ptr; - v110 = hir.load v109 : felt; - v112 = arith.constant 8 : u32; - v111 = hir.bitcast v70 : u32; - v113 = arith.add v111, v112 : u32 #[overflow = checked]; + v109 = hir.int_to_ptr v106 : ptr; + v110 = hir.load v109 : i32; + v115 = arith.constant 28 : u32; + v114 = hir.bitcast v54 : u32; + v116 = arith.add v114, v115 : u32 #[overflow = checked]; + v977 = arith.constant 4 : u32; + v118 = arith.mod v116, v977 : u32; + hir.assertz v118 #[code = 250]; + v119 = hir.int_to_ptr v116 : ptr; + v120 = hir.load v119 : i32; + v122 = arith.constant 32 : u32; + v121 = hir.bitcast v54 : u32; + v123 = arith.add v121, v122 : u32 #[overflow = checked]; + v976 = arith.constant 4 : u32; + v125 = arith.mod v123, v976 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + v127 = hir.load v126 : i32; v975 = arith.constant 4 : u32; - v115 = arith.mod v113, v975 : u32; - hir.assertz v115 #[code = 250]; - v116 = hir.int_to_ptr v113 : ptr; - v117 = hir.load v116 : felt; - hir.assert_eq v117, v101; - hir.assert_eq v110, v96; - v118 = arith.constant 28 : i32; - v119 = arith.add v70, v118 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::get_assets(v119) - v121 = arith.constant 36 : u32; - v120 = hir.bitcast v70 : u32; - v122 = arith.add v120, v121 : u32 #[overflow = checked]; - v974 = arith.constant 4 : u32; - v124 = arith.mod v122, v974 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : i32; - v131 = arith.constant 28 : u32; - v130 = hir.bitcast v70 : u32; - v132 = arith.add v130, v131 : u32 #[overflow = checked]; - v973 = arith.constant 4 : u32; - v134 = arith.mod v132, v973 : u32; - hir.assertz v134 #[code = 250]; - v135 = hir.int_to_ptr v132 : ptr; - v136 = hir.load v135 : i32; - v138 = arith.constant 32 : u32; - v137 = hir.bitcast v70 : u32; - v139 = arith.add v137, v138 : u32 #[overflow = checked]; - v972 = arith.constant 4 : u32; - v141 = arith.mod v139, v972 : u32; - hir.assertz v141 #[code = 250]; - v142 = hir.int_to_ptr v139 : ptr; - v143 = hir.load v142 : i32; - v971 = arith.constant 4 : u32; - v129 = arith.shl v126, v971 : i32; - v929, v930, v931, v932, v933, v934, v935, v936 = scf.while v129, v143, v70, v143, v136 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block120(v937: i32, v938: i32, v939: i32, v940: i32, v941: i32): - v970 = arith.constant 0 : i32; - v63 = arith.constant 0 : i32; - v146 = arith.eq v937, v63 : i1; - v147 = arith.zext v146 : u32; - v148 = hir.bitcast v147 : i32; - v150 = arith.neq v148, v970 : i1; - v922, v923 = scf.if v150 : i32, i32 { - ^block119: - v866 = ub.poison i32 : i32; - scf.yield v866, v866; + v113 = arith.shl v110, v975 : i32; + v933, v934, v935, v936, v937, v938, v939, v940 = scf.while v113, v127, v54, v127, v120 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block124(v941: i32, v942: i32, v943: i32, v944: i32, v945: i32): + v974 = arith.constant 0 : i32; + v47 = arith.constant 0 : i32; + v130 = arith.eq v941, v47 : i1; + v131 = arith.zext v130 : u32; + v132 = hir.bitcast v131 : i32; + v134 = arith.neq v132, v974 : i1; + v926, v927 = scf.if v134 : i32, i32 { + ^block123: + v870 = ub.poison i32 : i32; + scf.yield v870, v870; } else { - ^block39: - v152 = hir.bitcast v938 : u32; + ^block28: + v136 = hir.bitcast v942 : u32; + v973 = arith.constant 4 : u32; + v138 = arith.mod v136, v973 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : felt; + v972 = arith.constant 4 : u32; + v141 = hir.bitcast v942 : u32; + v143 = arith.add v141, v972 : u32 #[overflow = checked]; + v971 = arith.constant 4 : u32; + v145 = arith.mod v143, v971 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : felt; + v970 = arith.constant 8 : u32; + v148 = hir.bitcast v942 : u32; + v150 = arith.add v148, v970 : u32 #[overflow = checked]; v969 = arith.constant 4 : u32; - v154 = arith.mod v152, v969 : u32; - hir.assertz v154 #[code = 250]; - v155 = hir.int_to_ptr v152 : ptr; - v156 = hir.load v155 : felt; - v968 = arith.constant 4 : u32; - v157 = hir.bitcast v938 : u32; - v159 = arith.add v157, v968 : u32 #[overflow = checked]; + v152 = arith.mod v150, v969 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : felt; + v968 = arith.constant 12 : u32; + v155 = hir.bitcast v942 : u32; + v157 = arith.add v155, v968 : u32 #[overflow = checked]; v967 = arith.constant 4 : u32; - v161 = arith.mod v159, v967 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : felt; - v966 = arith.constant 8 : u32; - v164 = hir.bitcast v938 : u32; - v166 = arith.add v164, v966 : u32 #[overflow = checked]; - v965 = arith.constant 4 : u32; - v168 = arith.mod v166, v965 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : felt; - v964 = arith.constant 12 : u32; - v171 = hir.bitcast v938 : u32; - v173 = arith.add v171, v964 : u32 #[overflow = checked]; - v963 = arith.constant 4 : u32; - v175 = arith.mod v173, v963 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : felt; - hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v156, v163, v170, v177) - v962 = arith.constant 16 : i32; - v181 = arith.add v938, v962 : i32 #[overflow = wrapping]; - v178 = arith.constant -16 : i32; - v179 = arith.add v937, v178 : i32 #[overflow = wrapping]; - scf.yield v179, v181; + v159 = arith.mod v157, v967 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + v161 = hir.load v160 : felt; + hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v140, v147, v154, v161) + v966 = arith.constant 16 : i32; + v165 = arith.add v942, v966 : i32 #[overflow = wrapping]; + v162 = arith.constant -16 : i32; + v163 = arith.add v941, v162 : i32 #[overflow = wrapping]; + scf.yield v163, v165; }; - v959 = ub.poison i32 : i32; - v926 = cf.select v150, v959, v941 : i32; - v960 = ub.poison i32 : i32; - v925 = cf.select v150, v960, v940 : i32; - v961 = ub.poison i32 : i32; - v924 = cf.select v150, v961, v939 : i32; - v865 = arith.constant 1 : u32; - v857 = arith.constant 0 : u32; - v928 = cf.select v150, v857, v865 : u32; - v910 = arith.trunc v928 : i1; - scf.condition v910, v922, v923, v924, v925, v926, v939, v940, v941; + v963 = ub.poison i32 : i32; + v930 = cf.select v134, v963, v945 : i32; + v964 = ub.poison i32 : i32; + v929 = cf.select v134, v964, v944 : i32; + v965 = ub.poison i32 : i32; + v928 = cf.select v134, v965, v943 : i32; + v869 = arith.constant 1 : u32; + v861 = arith.constant 0 : u32; + v932 = cf.select v134, v861, v869 : u32; + v914 = arith.trunc v932 : i1; + scf.condition v914, v926, v927, v928, v929, v930, v943, v944, v945; } do { - ^block121(v942: i32, v943: i32, v944: i32, v945: i32, v946: i32, v947: i32, v948: i32, v949: i32): - scf.yield v942, v943, v944, v945, v946; + ^block125(v946: i32, v947: i32, v948: i32, v949: i32, v950: i32, v951: i32, v952: i32, v953: i32): + scf.yield v946, v947, v948, v949, v950; }; - v185 = arith.constant 44 : u32; - v184 = hir.bitcast v934 : u32; - v186 = arith.add v184, v185 : u32 #[overflow = checked]; - v958 = arith.constant 4 : u32; - v188 = arith.mod v186, v958 : u32; - hir.assertz v188 #[code = 250]; - v189 = hir.int_to_ptr v186 : ptr; - hir.store v189, v935; - v192 = arith.constant 40 : u32; - v191 = hir.bitcast v934 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; - v957 = arith.constant 4 : u32; - v195 = arith.mod v193, v957 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - hir.store v196, v936; - v956 = arith.constant 16 : i32; - v197 = arith.constant 40 : i32; - v198 = arith.add v934, v197 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v198, v956, v956) - v127 = arith.constant 4 : i32; - v955 = arith.constant 16 : i32; - v202 = arith.add v934, v955 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v202, v127, v127) - v954 = arith.constant 48 : i32; - v206 = arith.add v934, v954 : i32 #[overflow = wrapping]; - v207 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v208 = hir.bitcast v207 : ptr; - hir.store v208, v206; - v953 = arith.constant 0 : u32; - scf.yield v953; + v169 = arith.constant 44 : u32; + v168 = hir.bitcast v938 : u32; + v170 = arith.add v168, v169 : u32 #[overflow = checked]; + v962 = arith.constant 4 : u32; + v172 = arith.mod v170, v962 : u32; + hir.assertz v172 #[code = 250]; + v173 = hir.int_to_ptr v170 : ptr; + hir.store v173, v939; + v176 = arith.constant 40 : u32; + v175 = hir.bitcast v938 : u32; + v177 = arith.add v175, v176 : u32 #[overflow = checked]; + v961 = arith.constant 4 : u32; + v179 = arith.mod v177, v961 : u32; + hir.assertz v179 #[code = 250]; + v180 = hir.int_to_ptr v177 : ptr; + hir.store v180, v940; + v960 = arith.constant 16 : i32; + v181 = arith.constant 40 : i32; + v182 = arith.add v938, v181 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v182, v960, v960) + v111 = arith.constant 4 : i32; + v959 = arith.constant 16 : i32; + v186 = arith.add v938, v959 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v186, v111, v111) + v958 = arith.constant 48 : i32; + v190 = arith.add v938, v958 : i32 #[overflow = wrapping]; + v191 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v192 = hir.bitcast v191 : ptr; + hir.store v192, v190; + v957 = arith.constant 0 : u32; + scf.yield v957; }; - v950 = arith.constant 0 : u32; - v921 = arith.eq v912, v950 : i1; - cf.cond_br v921 ^block112, ^block35; - ^block35: + v954 = arith.constant 0 : u32; + v925 = arith.eq v916, v954 : i1; + cf.cond_br v925 ^block116, ^block24; + ^block24: ub.unreachable ; - ^block112: + ^block116: builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block40: + ^block29: builtin.ret ; }; private builtin.function @wit_bindgen_rt::run_ctors_once() { - ^block42: - v210 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v211 = hir.bitcast v210 : ptr; - v212 = hir.load v211 : i32; - v213 = arith.constant 1048708 : i32; - v214 = arith.add v212, v213 : i32 #[overflow = wrapping]; - v215 = hir.bitcast v214 : u32; - v216 = hir.int_to_ptr v215 : ptr; - v217 = hir.load v216 : u8; - v209 = arith.constant 0 : i32; - v218 = arith.zext v217 : u32; - v219 = hir.bitcast v218 : i32; - v221 = arith.neq v219, v209 : i1; - scf.if v221{ - ^block44: + ^block31: + v194 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v195 = hir.bitcast v194 : ptr; + v196 = hir.load v195 : i32; + v197 = arith.constant 1048668 : i32; + v198 = arith.add v196, v197 : i32 #[overflow = wrapping]; + v199 = hir.bitcast v198 : u32; + v200 = hir.int_to_ptr v199 : ptr; + v201 = hir.load v200 : u8; + v193 = arith.constant 0 : i32; + v202 = arith.zext v201 : u32; + v203 = hir.bitcast v202 : i32; + v205 = arith.neq v203, v193 : i1; + scf.if v205{ + ^block33: scf.yield ; } else { - ^block45: - v222 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v223 = hir.bitcast v222 : ptr; - v224 = hir.load v223 : i32; + ^block34: + v206 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v207 = hir.bitcast v206 : ptr; + v208 = hir.load v207 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v982 = arith.constant 1 : u8; - v984 = arith.constant 1048708 : i32; - v226 = arith.add v224, v984 : i32 #[overflow = wrapping]; - v230 = hir.bitcast v226 : u32; - v231 = hir.int_to_ptr v230 : ptr; - hir.store v231, v982; + v986 = arith.constant 1 : u8; + v988 = arith.constant 1048668 : i32; + v210 = arith.add v208, v988 : i32 #[overflow = wrapping]; + v214 = hir.bitcast v210 : u32; + v215 = hir.int_to_ptr v214 : ptr; + hir.store v215, v986; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v232: i32, v233: i32, v234: i32) -> i32 { - ^block46(v232: i32, v233: i32, v234: i32): - v237 = arith.constant 16 : i32; - v236 = arith.constant 0 : i32; - v986 = arith.constant 16 : u32; - v239 = hir.bitcast v233 : u32; - v241 = arith.gt v239, v986 : i1; - v242 = arith.zext v241 : u32; - v243 = hir.bitcast v242 : i32; - v245 = arith.neq v243, v236 : i1; - v246 = cf.select v245, v233, v237 : i32; - v1026 = arith.constant 0 : i32; - v247 = arith.constant -1 : i32; - v248 = arith.add v246, v247 : i32 #[overflow = wrapping]; - v249 = arith.band v246, v248 : i32; - v251 = arith.neq v249, v1026 : i1; - v995, v996 = scf.if v251 : i32, u32 { - ^block125: - v987 = arith.constant 0 : u32; - v991 = ub.poison i32 : i32; - scf.yield v991, v987; + private builtin.function @::alloc(v216: i32, v217: i32, v218: i32) -> i32 { + ^block35(v216: i32, v217: i32, v218: i32): + v221 = arith.constant 16 : i32; + v220 = arith.constant 0 : i32; + v990 = arith.constant 16 : u32; + v223 = hir.bitcast v217 : u32; + v225 = arith.gt v223, v990 : i1; + v226 = arith.zext v225 : u32; + v227 = hir.bitcast v226 : i32; + v229 = arith.neq v227, v220 : i1; + v230 = cf.select v229, v217, v221 : i32; + v1030 = arith.constant 0 : i32; + v231 = arith.constant -1 : i32; + v232 = arith.add v230, v231 : i32 #[overflow = wrapping]; + v233 = arith.band v230, v232 : i32; + v235 = arith.neq v233, v1030 : i1; + v999, v1000 = scf.if v235 : i32, u32 { + ^block129: + v991 = arith.constant 0 : u32; + v995 = ub.poison i32 : i32; + scf.yield v995, v991; } else { - ^block49: - v253 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v233, v246) : i32 - v1025 = arith.constant 0 : i32; - v252 = arith.constant -2147483648 : i32; - v254 = arith.sub v252, v253 : i32 #[overflow = wrapping]; - v256 = hir.bitcast v254 : u32; - v255 = hir.bitcast v234 : u32; - v257 = arith.gt v255, v256 : i1; - v258 = arith.zext v257 : u32; - v259 = hir.bitcast v258 : i32; - v261 = arith.neq v259, v1025 : i1; - v1010 = scf.if v261 : i32 { - ^block124: - v1024 = ub.poison i32 : i32; - scf.yield v1024; + ^block38: + v237 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v217, v230) : i32 + v1029 = arith.constant 0 : i32; + v236 = arith.constant -2147483648 : i32; + v238 = arith.sub v236, v237 : i32 #[overflow = wrapping]; + v240 = hir.bitcast v238 : u32; + v239 = hir.bitcast v218 : u32; + v241 = arith.gt v239, v240 : i1; + v242 = arith.zext v241 : u32; + v243 = hir.bitcast v242 : i32; + v245 = arith.neq v243, v1029 : i1; + v1014 = scf.if v245 : i32 { + ^block128: + v1028 = ub.poison i32 : i32; + scf.yield v1028; } else { - ^block50: - v1022 = arith.constant 0 : i32; - v267 = arith.sub v1022, v253 : i32 #[overflow = wrapping]; - v1023 = arith.constant -1 : i32; - v263 = arith.add v234, v253 : i32 #[overflow = wrapping]; - v265 = arith.add v263, v1023 : i32 #[overflow = wrapping]; - v268 = arith.band v265, v267 : i32; - v269 = hir.bitcast v232 : u32; - v270 = arith.constant 4 : u32; - v271 = arith.mod v269, v270 : u32; - hir.assertz v271 #[code = 250]; - v272 = hir.int_to_ptr v269 : ptr; - v273 = hir.load v272 : i32; - v1021 = arith.constant 0 : i32; - v275 = arith.neq v273, v1021 : i1; - scf.if v275{ - ^block123: + ^block39: + v1026 = arith.constant 0 : i32; + v251 = arith.sub v1026, v237 : i32 #[overflow = wrapping]; + v1027 = arith.constant -1 : i32; + v247 = arith.add v218, v237 : i32 #[overflow = wrapping]; + v249 = arith.add v247, v1027 : i32 #[overflow = wrapping]; + v252 = arith.band v249, v251 : i32; + v253 = hir.bitcast v216 : u32; + v254 = arith.constant 4 : u32; + v255 = arith.mod v253, v254 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + v257 = hir.load v256 : i32; + v1025 = arith.constant 0 : i32; + v259 = arith.neq v257, v1025 : i1; + scf.if v259{ + ^block127: scf.yield ; } else { - ^block52: - v276 = hir.exec @intrinsics/mem/heap_base() : i32 - v277 = hir.mem_size : u32; - v283 = hir.bitcast v232 : u32; - v1020 = arith.constant 4 : u32; - v285 = arith.mod v283, v1020 : u32; - hir.assertz v285 #[code = 250]; - v1019 = arith.constant 16 : u32; - v278 = hir.bitcast v277 : i32; - v281 = arith.shl v278, v1019 : i32; - v282 = arith.add v276, v281 : i32 #[overflow = wrapping]; - v286 = hir.int_to_ptr v283 : ptr; - hir.store v286, v282; + ^block41: + v260 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 + v261 = hir.mem_size : u32; + v267 = hir.bitcast v216 : u32; + v1024 = arith.constant 4 : u32; + v269 = arith.mod v267, v1024 : u32; + hir.assertz v269 #[code = 250]; + v1023 = arith.constant 16 : u32; + v262 = hir.bitcast v261 : i32; + v265 = arith.shl v262, v1023 : i32; + v266 = arith.add v260, v265 : i32 #[overflow = wrapping]; + v270 = hir.int_to_ptr v267 : ptr; + hir.store v270, v266; scf.yield ; }; - v289 = hir.bitcast v232 : u32; - v1018 = arith.constant 4 : u32; - v291 = arith.mod v289, v1018 : u32; - hir.assertz v291 #[code = 250]; - v292 = hir.int_to_ptr v289 : ptr; - v293 = hir.load v292 : i32; - v1016 = arith.constant 0 : i32; - v1017 = arith.constant -1 : i32; - v295 = arith.bxor v293, v1017 : i32; - v297 = hir.bitcast v295 : u32; - v296 = hir.bitcast v268 : u32; - v298 = arith.gt v296, v297 : i1; - v299 = arith.zext v298 : u32; - v300 = hir.bitcast v299 : i32; - v302 = arith.neq v300, v1016 : i1; - v1009 = scf.if v302 : i32 { - ^block53: - v1015 = arith.constant 0 : i32; - scf.yield v1015; + v273 = hir.bitcast v216 : u32; + v1022 = arith.constant 4 : u32; + v275 = arith.mod v273, v1022 : u32; + hir.assertz v275 #[code = 250]; + v276 = hir.int_to_ptr v273 : ptr; + v277 = hir.load v276 : i32; + v1020 = arith.constant 0 : i32; + v1021 = arith.constant -1 : i32; + v279 = arith.bxor v277, v1021 : i32; + v281 = hir.bitcast v279 : u32; + v280 = hir.bitcast v252 : u32; + v282 = arith.gt v280, v281 : i1; + v283 = arith.zext v282 : u32; + v284 = hir.bitcast v283 : i32; + v286 = arith.neq v284, v1020 : i1; + v1013 = scf.if v286 : i32 { + ^block42: + v1019 = arith.constant 0 : i32; + scf.yield v1019; } else { - ^block54: - v304 = hir.bitcast v232 : u32; - v1014 = arith.constant 4 : u32; - v306 = arith.mod v304, v1014 : u32; - hir.assertz v306 #[code = 250]; - v303 = arith.add v293, v268 : i32 #[overflow = wrapping]; - v307 = hir.int_to_ptr v304 : ptr; - hir.store v307, v303; - v309 = arith.add v293, v253 : i32 #[overflow = wrapping]; - scf.yield v309; + ^block43: + v288 = hir.bitcast v216 : u32; + v1018 = arith.constant 4 : u32; + v290 = arith.mod v288, v1018 : u32; + hir.assertz v290 #[code = 250]; + v287 = arith.add v277, v252 : i32 #[overflow = wrapping]; + v291 = hir.int_to_ptr v288 : ptr; + hir.store v291, v287; + v293 = arith.add v277, v237 : i32 #[overflow = wrapping]; + scf.yield v293; }; - scf.yield v1009; + scf.yield v1013; }; - v992 = arith.constant 1 : u32; - v1013 = arith.constant 0 : u32; - v1011 = cf.select v261, v1013, v992 : u32; - scf.yield v1010, v1011; + v996 = arith.constant 1 : u32; + v1017 = arith.constant 0 : u32; + v1015 = cf.select v245, v1017, v996 : u32; + scf.yield v1014, v1015; }; - v1012 = arith.constant 0 : u32; - v1008 = arith.eq v996, v1012 : i1; - cf.cond_br v1008 ^block48, ^block127(v995); - ^block48: + v1016 = arith.constant 0 : u32; + v1012 = arith.eq v1000, v1016 : i1; + cf.cond_br v1012 ^block37, ^block131(v999); + ^block37: ub.unreachable ; - ^block127(v988: i32): - builtin.ret v988; + ^block131(v992: i32): + builtin.ret v992; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block44: + v296 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v296; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v312: i32, v313: i32, v314: i32, v315: i32) { - ^block55(v312: i32, v313: i32, v314: i32, v315: i32): - v317 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v318 = hir.bitcast v317 : ptr; - v319 = hir.load v318 : i32; - v320 = arith.constant 16 : i32; - v321 = arith.sub v319, v320 : i32 #[overflow = wrapping]; - v322 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v323 = hir.bitcast v322 : ptr; - hir.store v323, v321; - v316 = arith.constant 0 : i32; - v326 = arith.constant 256 : i32; - v324 = arith.constant 4 : i32; - v325 = arith.add v321, v324 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v325, v326, v316, v313, v314) - v329 = arith.constant 8 : u32; - v328 = hir.bitcast v321 : u32; - v330 = arith.add v328, v329 : u32 #[overflow = checked]; - v331 = arith.constant 4 : u32; - v332 = arith.mod v330, v331 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - v334 = hir.load v333 : i32; + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v298: i32, v299: i32, v300: i32, v301: i32) { + ^block48(v298: i32, v299: i32, v300: i32, v301: i32): + v303 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v304 = hir.bitcast v303 : ptr; + v305 = hir.load v304 : i32; + v306 = arith.constant 16 : i32; + v307 = arith.sub v305, v306 : i32 #[overflow = wrapping]; + v308 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v309 = hir.bitcast v308 : ptr; + hir.store v309, v307; + v302 = arith.constant 0 : i32; + v312 = arith.constant 256 : i32; + v310 = arith.constant 4 : i32; + v311 = arith.add v307, v310 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v311, v312, v302, v299, v300) + v315 = arith.constant 8 : u32; + v314 = hir.bitcast v307 : u32; + v316 = arith.add v314, v315 : u32 #[overflow = checked]; + v317 = arith.constant 4 : u32; + v318 = arith.mod v316, v317 : u32; + hir.assertz v318 #[code = 250]; + v319 = hir.int_to_ptr v316 : ptr; + v320 = hir.load v319 : i32; + v1041 = arith.constant 4 : u32; + v321 = hir.bitcast v307 : u32; + v323 = arith.add v321, v1041 : u32 #[overflow = checked]; + v1040 = arith.constant 4 : u32; + v325 = arith.mod v323, v1040 : u32; + hir.assertz v325 #[code = 250]; + v326 = hir.int_to_ptr v323 : ptr; + v327 = hir.load v326 : i32; + v1039 = arith.constant 0 : i32; + v328 = arith.constant 1 : i32; + v329 = arith.neq v327, v328 : i1; + v330 = arith.zext v329 : u32; + v331 = hir.bitcast v330 : i32; + v333 = arith.neq v331, v1039 : i1; + cf.cond_br v333 ^block50, ^block51; + ^block50: + v342 = arith.constant 12 : u32; + v341 = hir.bitcast v307 : u32; + v343 = arith.add v341, v342 : u32 #[overflow = checked]; + v1038 = arith.constant 4 : u32; + v345 = arith.mod v343, v1038 : u32; + hir.assertz v345 #[code = 250]; + v346 = hir.int_to_ptr v343 : ptr; + v347 = hir.load v346 : i32; v1037 = arith.constant 4 : u32; - v335 = hir.bitcast v321 : u32; - v337 = arith.add v335, v1037 : u32 #[overflow = checked]; + v348 = hir.bitcast v298 : u32; + v350 = arith.add v348, v1037 : u32 #[overflow = checked]; v1036 = arith.constant 4 : u32; - v339 = arith.mod v337, v1036 : u32; - hir.assertz v339 #[code = 250]; - v340 = hir.int_to_ptr v337 : ptr; - v341 = hir.load v340 : i32; - v1035 = arith.constant 0 : i32; - v342 = arith.constant 1 : i32; - v343 = arith.neq v341, v342 : i1; - v344 = arith.zext v343 : u32; - v345 = hir.bitcast v344 : i32; - v347 = arith.neq v345, v1035 : i1; - cf.cond_br v347 ^block57, ^block58; - ^block57: - v356 = arith.constant 12 : u32; - v355 = hir.bitcast v321 : u32; - v357 = arith.add v355, v356 : u32 #[overflow = checked]; - v1034 = arith.constant 4 : u32; - v359 = arith.mod v357, v1034 : u32; - hir.assertz v359 #[code = 250]; - v360 = hir.int_to_ptr v357 : ptr; - v361 = hir.load v360 : i32; - v1033 = arith.constant 4 : u32; - v362 = hir.bitcast v312 : u32; - v364 = arith.add v362, v1033 : u32 #[overflow = checked]; - v1032 = arith.constant 4 : u32; - v366 = arith.mod v364, v1032 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - hir.store v367, v361; - v368 = hir.bitcast v312 : u32; - v1031 = arith.constant 4 : u32; - v370 = arith.mod v368, v1031 : u32; - hir.assertz v370 #[code = 250]; - v371 = hir.int_to_ptr v368 : ptr; - hir.store v371, v334; - v1030 = arith.constant 16 : i32; - v373 = arith.add v321, v1030 : i32 #[overflow = wrapping]; - v374 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v375 = hir.bitcast v374 : ptr; - hir.store v375, v373; - builtin.ret ; - ^block58: - v1029 = arith.constant 12 : u32; - v348 = hir.bitcast v321 : u32; - v350 = arith.add v348, v1029 : u32 #[overflow = checked]; - v1028 = arith.constant 4 : u32; - v352 = arith.mod v350, v1028 : u32; + v352 = arith.mod v350, v1036 : u32; hir.assertz v352 #[code = 250]; v353 = hir.int_to_ptr v350 : ptr; - v354 = hir.load v353 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v334, v354, v315) + hir.store v353, v347; + v354 = hir.bitcast v298 : u32; + v1035 = arith.constant 4 : u32; + v356 = arith.mod v354, v1035 : u32; + hir.assertz v356 #[code = 250]; + v357 = hir.int_to_ptr v354 : ptr; + hir.store v357, v320; + v1034 = arith.constant 16 : i32; + v359 = arith.add v307, v1034 : i32 #[overflow = wrapping]; + v360 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v361 = hir.bitcast v360 : ptr; + hir.store v361, v359; + builtin.ret ; + ^block51: + v1033 = arith.constant 12 : u32; + v334 = hir.bitcast v307 : u32; + v336 = arith.add v334, v1033 : u32 #[overflow = checked]; + v1032 = arith.constant 4 : u32; + v338 = arith.mod v336, v1032 : u32; + hir.assertz v338 #[code = 250]; + v339 = hir.int_to_ptr v336 : ptr; + v340 = hir.load v339 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v320, v340, v301) ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::account::get_id(v376: i32) { - ^block59(v376: i32): - v378 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v379 = hir.bitcast v378 : ptr; - v380 = hir.load v379 : i32; - v381 = arith.constant 16 : i32; - v382 = arith.sub v380, v381 : i32 #[overflow = wrapping]; - v383 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v384 = hir.bitcast v383 : ptr; - hir.store v384, v382; - v385 = arith.constant 8 : i32; - v386 = arith.add v382, v385 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::account::extern_account_get_id(v386) - v388 = arith.constant 8 : u32; - v387 = hir.bitcast v382 : u32; - v389 = arith.add v387, v388 : u32 #[overflow = checked]; - v390 = arith.constant 4 : u32; - v391 = arith.mod v389, v390 : u32; - hir.assertz v391 #[code = 250]; - v392 = hir.int_to_ptr v389 : ptr; - v393 = hir.load v392 : i64; - v394 = hir.bitcast v376 : u32; - v1039 = arith.constant 8 : u32; - v396 = arith.mod v394, v1039 : u32; - hir.assertz v396 #[code = 250]; - v397 = hir.int_to_ptr v394 : ptr; - hir.store v397, v393; - v1038 = arith.constant 16 : i32; - v399 = arith.add v382, v1038 : i32 #[overflow = wrapping]; - v400 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v401 = hir.bitcast v400 : ptr; - hir.store v401, v399; + private builtin.function @miden_base_sys::bindings::account::get_id(v362: i32) { + ^block52(v362: i32): + v364 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v365 = hir.bitcast v364 : ptr; + v366 = hir.load v365 : i32; + v367 = arith.constant 16 : i32; + v368 = arith.sub v366, v367 : i32 #[overflow = wrapping]; + v369 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v370 = hir.bitcast v369 : ptr; + hir.store v370, v368; + v371 = arith.constant 8 : i32; + v372 = arith.add v368, v371 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::account::get_id(v372) + v374 = arith.constant 8 : u32; + v373 = hir.bitcast v368 : u32; + v375 = arith.add v373, v374 : u32 #[overflow = checked]; + v376 = arith.constant 4 : u32; + v377 = arith.mod v375, v376 : u32; + hir.assertz v377 #[code = 250]; + v378 = hir.int_to_ptr v375 : ptr; + v379 = hir.load v378 : i64; + v380 = hir.bitcast v362 : u32; + v1043 = arith.constant 8 : u32; + v382 = arith.mod v380, v1043 : u32; + hir.assertz v382 #[code = 250]; + v383 = hir.int_to_ptr v380 : ptr; + hir.store v383, v379; + v1042 = arith.constant 16 : i32; + v385 = arith.add v368, v1042 : i32 #[overflow = wrapping]; + v386 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v387 = hir.bitcast v386 : ptr; + hir.store v387, v385; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::note::get_inputs(v402: i32) { - ^block61(v402: i32): - v404 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v405 = hir.bitcast v404 : ptr; - v406 = hir.load v405 : i32; - v407 = arith.constant 16 : i32; - v408 = arith.sub v406, v407 : i32 #[overflow = wrapping]; - v409 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v410 = hir.bitcast v409 : ptr; - hir.store v410, v408; - v415 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v416 = hir.bitcast v415 : ptr; - v417 = hir.load v416 : i32; - v418 = arith.constant 1048672 : i32; - v419 = arith.add v417, v418 : i32 #[overflow = wrapping]; - v413 = arith.constant 4 : i32; - v411 = arith.constant 8 : i32; - v412 = arith.add v408, v411 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v412, v413, v413, v419) - v421 = arith.constant 8 : u32; - v420 = hir.bitcast v408 : u32; - v422 = arith.add v420, v421 : u32 #[overflow = checked]; - v423 = arith.constant 4 : u32; - v424 = arith.mod v422, v423 : u32; - hir.assertz v424 #[code = 250]; - v425 = hir.int_to_ptr v422 : ptr; - v426 = hir.load v425 : i32; - v428 = arith.constant 12 : u32; - v427 = hir.bitcast v408 : u32; - v429 = arith.add v427, v428 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::note::get_inputs(v388: i32) { + ^block54(v388: i32): + v390 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v391 = hir.bitcast v390 : ptr; + v392 = hir.load v391 : i32; + v393 = arith.constant 16 : i32; + v394 = arith.sub v392, v393 : i32 #[overflow = wrapping]; + v395 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v396 = hir.bitcast v395 : ptr; + hir.store v396, v394; + v401 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v402 = hir.bitcast v401 : ptr; + v403 = hir.load v402 : i32; + v404 = arith.constant 1048632 : i32; + v405 = arith.add v403, v404 : i32 #[overflow = wrapping]; + v399 = arith.constant 4 : i32; + v397 = arith.constant 8 : i32; + v398 = arith.add v394, v397 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v398, v399, v399, v405) + v407 = arith.constant 8 : u32; + v406 = hir.bitcast v394 : u32; + v408 = arith.add v406, v407 : u32 #[overflow = checked]; + v409 = arith.constant 4 : u32; + v410 = arith.mod v408, v409 : u32; + hir.assertz v410 #[code = 250]; + v411 = hir.int_to_ptr v408 : ptr; + v412 = hir.load v411 : i32; + v414 = arith.constant 12 : u32; + v413 = hir.bitcast v394 : u32; + v415 = arith.add v413, v414 : u32 #[overflow = checked]; + v1051 = arith.constant 4 : u32; + v417 = arith.mod v415, v1051 : u32; + hir.assertz v417 #[code = 250]; + v418 = hir.int_to_ptr v415 : ptr; + v419 = hir.load v418 : i32; + v1044 = arith.constant 2 : u32; + v421 = hir.bitcast v419 : u32; + v423 = arith.shr v421, v1044 : u32; + v424 = hir.bitcast v423 : i32; + v425 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::note::get_inputs(v424) : i32 + v1050 = arith.constant 8 : u32; + v426 = hir.bitcast v388 : u32; + v428 = arith.add v426, v1050 : u32 #[overflow = checked]; + v1049 = arith.constant 4 : u32; + v430 = arith.mod v428, v1049 : u32; + hir.assertz v430 #[code = 250]; + v431 = hir.int_to_ptr v428 : ptr; + hir.store v431, v425; + v1048 = arith.constant 4 : u32; + v432 = hir.bitcast v388 : u32; + v434 = arith.add v432, v1048 : u32 #[overflow = checked]; v1047 = arith.constant 4 : u32; - v431 = arith.mod v429, v1047 : u32; - hir.assertz v431 #[code = 250]; - v432 = hir.int_to_ptr v429 : ptr; - v433 = hir.load v432 : i32; - v1040 = arith.constant 2 : u32; - v435 = hir.bitcast v433 : u32; - v437 = arith.shr v435, v1040 : u32; - v438 = hir.bitcast v437 : i32; - v439 = hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::extern_note_get_inputs(v438) : i32 - v1046 = arith.constant 8 : u32; - v440 = hir.bitcast v402 : u32; - v442 = arith.add v440, v1046 : u32 #[overflow = checked]; - v1045 = arith.constant 4 : u32; - v444 = arith.mod v442, v1045 : u32; - hir.assertz v444 #[code = 250]; - v445 = hir.int_to_ptr v442 : ptr; - hir.store v445, v439; - v1044 = arith.constant 4 : u32; - v446 = hir.bitcast v402 : u32; - v448 = arith.add v446, v1044 : u32 #[overflow = checked]; - v1043 = arith.constant 4 : u32; - v450 = arith.mod v448, v1043 : u32; - hir.assertz v450 #[code = 250]; - v451 = hir.int_to_ptr v448 : ptr; - hir.store v451, v433; - v452 = hir.bitcast v402 : u32; - v1042 = arith.constant 4 : u32; - v454 = arith.mod v452, v1042 : u32; - hir.assertz v454 #[code = 250]; - v455 = hir.int_to_ptr v452 : ptr; - hir.store v455, v426; - v1041 = arith.constant 16 : i32; - v457 = arith.add v408, v1041 : i32 #[overflow = wrapping]; - v458 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v459 = hir.bitcast v458 : ptr; - hir.store v459, v457; + v436 = arith.mod v434, v1047 : u32; + hir.assertz v436 #[code = 250]; + v437 = hir.int_to_ptr v434 : ptr; + hir.store v437, v419; + v438 = hir.bitcast v388 : u32; + v1046 = arith.constant 4 : u32; + v440 = arith.mod v438, v1046 : u32; + hir.assertz v440 #[code = 250]; + v441 = hir.int_to_ptr v438 : ptr; + hir.store v441, v412; + v1045 = arith.constant 16 : i32; + v443 = arith.add v394, v1045 : i32 #[overflow = wrapping]; + v444 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v445 = hir.bitcast v444 : ptr; + hir.store v445, v443; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::note::get_assets(v460: i32) { - ^block63(v460: i32): - v462 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v463 = hir.bitcast v462 : ptr; - v464 = hir.load v463 : i32; - v465 = arith.constant 16 : i32; - v466 = arith.sub v464, v465 : i32 #[overflow = wrapping]; - v467 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v468 = hir.bitcast v467 : ptr; - hir.store v468, v466; - v473 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v474 = hir.bitcast v473 : ptr; - v475 = hir.load v474 : i32; - v476 = arith.constant 1048688 : i32; - v477 = arith.add v475, v476 : i32 #[overflow = wrapping]; - v1056 = arith.constant 16 : i32; - v469 = arith.constant 8 : i32; - v470 = arith.add v466, v469 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v470, v1056, v1056, v477) - v479 = arith.constant 8 : u32; - v478 = hir.bitcast v466 : u32; - v480 = arith.add v478, v479 : u32 #[overflow = checked]; - v481 = arith.constant 4 : u32; - v482 = arith.mod v480, v481 : u32; - hir.assertz v482 #[code = 250]; - v483 = hir.int_to_ptr v480 : ptr; - v484 = hir.load v483 : i32; - v486 = arith.constant 12 : u32; - v485 = hir.bitcast v466 : u32; - v487 = arith.add v485, v486 : u32 #[overflow = checked]; + private builtin.function @miden_base_sys::bindings::note::get_assets(v446: i32) { + ^block56(v446: i32): + v448 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v449 = hir.bitcast v448 : ptr; + v450 = hir.load v449 : i32; + v451 = arith.constant 16 : i32; + v452 = arith.sub v450, v451 : i32 #[overflow = wrapping]; + v453 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v454 = hir.bitcast v453 : ptr; + hir.store v454, v452; + v459 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v460 = hir.bitcast v459 : ptr; + v461 = hir.load v460 : i32; + v462 = arith.constant 1048648 : i32; + v463 = arith.add v461, v462 : i32 #[overflow = wrapping]; + v1060 = arith.constant 16 : i32; + v455 = arith.constant 8 : i32; + v456 = arith.add v452, v455 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v456, v1060, v1060, v463) + v465 = arith.constant 8 : u32; + v464 = hir.bitcast v452 : u32; + v466 = arith.add v464, v465 : u32 #[overflow = checked]; + v467 = arith.constant 4 : u32; + v468 = arith.mod v466, v467 : u32; + hir.assertz v468 #[code = 250]; + v469 = hir.int_to_ptr v466 : ptr; + v470 = hir.load v469 : i32; + v472 = arith.constant 12 : u32; + v471 = hir.bitcast v452 : u32; + v473 = arith.add v471, v472 : u32 #[overflow = checked]; + v1059 = arith.constant 4 : u32; + v475 = arith.mod v473, v1059 : u32; + hir.assertz v475 #[code = 250]; + v476 = hir.int_to_ptr v473 : ptr; + v477 = hir.load v476 : i32; + v1052 = arith.constant 2 : u32; + v479 = hir.bitcast v477 : u32; + v481 = arith.shr v479, v1052 : u32; + v482 = hir.bitcast v481 : i32; + v483 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::note::get_assets(v482) : i32 + v1058 = arith.constant 8 : u32; + v484 = hir.bitcast v446 : u32; + v486 = arith.add v484, v1058 : u32 #[overflow = checked]; + v1057 = arith.constant 4 : u32; + v488 = arith.mod v486, v1057 : u32; + hir.assertz v488 #[code = 250]; + v489 = hir.int_to_ptr v486 : ptr; + hir.store v489, v483; + v1056 = arith.constant 4 : u32; + v490 = hir.bitcast v446 : u32; + v492 = arith.add v490, v1056 : u32 #[overflow = checked]; v1055 = arith.constant 4 : u32; - v489 = arith.mod v487, v1055 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - v491 = hir.load v490 : i32; - v1048 = arith.constant 2 : u32; - v493 = hir.bitcast v491 : u32; - v495 = arith.shr v493, v1048 : u32; - v496 = hir.bitcast v495 : i32; - v497 = hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::note::extern_note_get_assets(v496) : i32 - v1054 = arith.constant 8 : u32; - v498 = hir.bitcast v460 : u32; - v500 = arith.add v498, v1054 : u32 #[overflow = checked]; - v1053 = arith.constant 4 : u32; - v502 = arith.mod v500, v1053 : u32; - hir.assertz v502 #[code = 250]; - v503 = hir.int_to_ptr v500 : ptr; - hir.store v503, v497; - v1052 = arith.constant 4 : u32; - v504 = hir.bitcast v460 : u32; - v506 = arith.add v504, v1052 : u32 #[overflow = checked]; - v1051 = arith.constant 4 : u32; - v508 = arith.mod v506, v1051 : u32; - hir.assertz v508 #[code = 250]; - v509 = hir.int_to_ptr v506 : ptr; - hir.store v509, v491; - v510 = hir.bitcast v460 : u32; - v1050 = arith.constant 4 : u32; - v512 = arith.mod v510, v1050 : u32; - hir.assertz v512 #[code = 250]; - v513 = hir.int_to_ptr v510 : ptr; - hir.store v513, v484; - v1049 = arith.constant 16 : i32; - v515 = arith.add v466, v1049 : i32 #[overflow = wrapping]; - v516 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v517 = hir.bitcast v516 : ptr; - hir.store v517, v515; + v494 = arith.mod v492, v1055 : u32; + hir.assertz v494 #[code = 250]; + v495 = hir.int_to_ptr v492 : ptr; + hir.store v495, v477; + v496 = hir.bitcast v446 : u32; + v1054 = arith.constant 4 : u32; + v498 = arith.mod v496, v1054 : u32; + hir.assertz v498 #[code = 250]; + v499 = hir.int_to_ptr v496 : ptr; + hir.store v499, v470; + v1053 = arith.constant 16 : i32; + v501 = arith.add v452, v1053 : i32 #[overflow = wrapping]; + v502 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v503 = hir.bitcast v502 : ptr; + hir.store v503, v501; + builtin.ret ; + }; + + private builtin.function @miden::account::get_id(v504: i32) { + ^block58(v504: i32): + v505, v506 = hir.exec @miden/account/get_id() : felt, felt + v507 = hir.bitcast v504 : u32; + v508 = hir.int_to_ptr v507 : ptr; + hir.store v508, v505; + v509 = arith.constant 4 : u32; + v510 = arith.add v507, v509 : u32 #[overflow = checked]; + v511 = hir.int_to_ptr v510 : ptr; + hir.store v511, v506; + builtin.ret ; + }; + + private builtin.function @miden::note::get_inputs(v512: i32) -> i32 { + ^block62(v512: i32): + v513, v514 = hir.exec @miden/note/get_inputs(v512) : i32, i32 + builtin.ret v513; + }; + + private builtin.function @miden::note::get_assets(v516: i32) -> i32 { + ^block65(v516: i32): + v517, v518 = hir.exec @miden/note/get_assets(v516) : i32, i32 + builtin.ret v517; + }; + + private builtin.function @intrinsics::felt::assert_eq(v520: felt, v521: felt) { + ^block67(v520: felt, v521: felt): + hir.assert_eq v520, v521; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v518: i32, v519: i32, v520: i32) { - ^block65(v518: i32, v519: i32, v520: i32): - v522 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v523 = hir.bitcast v522 : ptr; - v524 = hir.load v523 : i32; - v525 = arith.constant 16 : i32; - v526 = arith.sub v524, v525 : i32 #[overflow = wrapping]; - v527 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v528 = hir.bitcast v527 : ptr; - hir.store v528, v526; - v529 = arith.constant 4 : i32; - v530 = arith.add v526, v529 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v530, v518, v519, v520) - v532 = arith.constant 8 : u32; - v531 = hir.bitcast v526 : u32; - v533 = arith.add v531, v532 : u32 #[overflow = checked]; - v534 = arith.constant 4 : u32; - v535 = arith.mod v533, v534 : u32; - hir.assertz v535 #[code = 250]; - v536 = hir.int_to_ptr v533 : ptr; - v537 = hir.load v536 : i32; - v1063 = arith.constant 0 : i32; - v521 = arith.constant 0 : i32; - v539 = arith.eq v537, v521 : i1; - v540 = arith.zext v539 : u32; - v541 = hir.bitcast v540 : i32; - v543 = arith.neq v541, v1063 : i1; - scf.if v543{ - ^block133: + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v522: i32, v523: i32, v524: i32) { + ^block69(v522: i32, v523: i32, v524: i32): + v526 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v527 = hir.bitcast v526 : ptr; + v528 = hir.load v527 : i32; + v529 = arith.constant 16 : i32; + v530 = arith.sub v528, v529 : i32 #[overflow = wrapping]; + v531 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v532 = hir.bitcast v531 : ptr; + hir.store v532, v530; + v533 = arith.constant 4 : i32; + v534 = arith.add v530, v533 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v534, v522, v523, v524) + v536 = arith.constant 8 : u32; + v535 = hir.bitcast v530 : u32; + v537 = arith.add v535, v536 : u32 #[overflow = checked]; + v538 = arith.constant 4 : u32; + v539 = arith.mod v537, v538 : u32; + hir.assertz v539 #[code = 250]; + v540 = hir.int_to_ptr v537 : ptr; + v541 = hir.load v540 : i32; + v1067 = arith.constant 0 : i32; + v525 = arith.constant 0 : i32; + v543 = arith.eq v541, v525 : i1; + v544 = arith.zext v543 : u32; + v545 = hir.bitcast v544 : i32; + v547 = arith.neq v545, v1067 : i1; + scf.if v547{ + ^block137: scf.yield ; } else { - ^block68: - v1062 = arith.constant 4 : u32; - v544 = hir.bitcast v526 : u32; - v546 = arith.add v544, v1062 : u32 #[overflow = checked]; - v1061 = arith.constant 4 : u32; - v548 = arith.mod v546, v1061 : u32; - hir.assertz v548 #[code = 250]; - v549 = hir.int_to_ptr v546 : ptr; - v550 = hir.load v549 : i32; - v552 = arith.constant 12 : u32; - v551 = hir.bitcast v526 : u32; - v553 = arith.add v551, v552 : u32 #[overflow = checked]; - v1060 = arith.constant 4 : u32; - v555 = arith.mod v553, v1060 : u32; - hir.assertz v555 #[code = 250]; - v556 = hir.int_to_ptr v553 : ptr; - v557 = hir.load v556 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v550, v537, v557) + ^block72: + v1066 = arith.constant 4 : u32; + v548 = hir.bitcast v530 : u32; + v550 = arith.add v548, v1066 : u32 #[overflow = checked]; + v1065 = arith.constant 4 : u32; + v552 = arith.mod v550, v1065 : u32; + hir.assertz v552 #[code = 250]; + v553 = hir.int_to_ptr v550 : ptr; + v554 = hir.load v553 : i32; + v556 = arith.constant 12 : u32; + v555 = hir.bitcast v530 : u32; + v557 = arith.add v555, v556 : u32 #[overflow = checked]; + v1064 = arith.constant 4 : u32; + v559 = arith.mod v557, v1064 : u32; + hir.assertz v559 #[code = 250]; + v560 = hir.int_to_ptr v557 : ptr; + v561 = hir.load v560 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v554, v541, v561) scf.yield ; }; - v1059 = arith.constant 16 : i32; - v560 = arith.add v526, v1059 : i32 #[overflow = wrapping]; - v561 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v562 = hir.bitcast v561 : ptr; - hir.store v562, v560; + v1063 = arith.constant 16 : i32; + v564 = arith.add v530, v1063 : i32 #[overflow = wrapping]; + v565 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v566 = hir.bitcast v565 : ptr; + hir.store v566, v564; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v563: i32, v564: i32, v565: i32, v566: i32, v567: i32) { - ^block69(v563: i32, v564: i32, v565: i32, v566: i32, v567: i32): - v570 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v571 = hir.bitcast v570 : ptr; - v572 = hir.load v571 : i32; - v573 = arith.constant 16 : i32; - v574 = arith.sub v572, v573 : i32 #[overflow = wrapping]; - v575 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v576 = hir.bitcast v575 : ptr; - hir.store v576, v574; - v586 = hir.bitcast v564 : u32; - v587 = arith.zext v586 : u64; - v588 = hir.bitcast v587 : i64; - v568 = arith.constant 0 : i32; - v581 = arith.sub v568, v566 : i32 #[overflow = wrapping]; - v578 = arith.constant -1 : i32; - v577 = arith.add v566, v567 : i32 #[overflow = wrapping]; - v579 = arith.add v577, v578 : i32 #[overflow = wrapping]; - v582 = arith.band v579, v581 : i32; - v583 = hir.bitcast v582 : u32; - v584 = arith.zext v583 : u64; - v585 = hir.bitcast v584 : i64; - v589 = arith.mul v585, v588 : i64 #[overflow = wrapping]; - v1167 = arith.constant 0 : i32; - v590 = arith.constant 32 : i64; - v592 = hir.cast v590 : u32; - v591 = hir.bitcast v589 : u64; - v593 = arith.shr v591, v592 : u64; - v594 = hir.bitcast v593 : i64; - v595 = arith.trunc v594 : i32; - v597 = arith.neq v595, v1167 : i1; - v1079, v1080, v1081, v1082, v1083, v1084 = scf.if v597 : i32, i32, i32, i32, i32, u32 { - ^block135: - v1064 = arith.constant 0 : u32; - v1071 = ub.poison i32 : i32; - scf.yield v563, v574, v1071, v1071, v1071, v1064; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v567: i32, v568: i32, v569: i32, v570: i32, v571: i32) { + ^block73(v567: i32, v568: i32, v569: i32, v570: i32, v571: i32): + v574 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v575 = hir.bitcast v574 : ptr; + v576 = hir.load v575 : i32; + v577 = arith.constant 16 : i32; + v578 = arith.sub v576, v577 : i32 #[overflow = wrapping]; + v579 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v580 = hir.bitcast v579 : ptr; + hir.store v580, v578; + v590 = hir.bitcast v568 : u32; + v591 = arith.zext v590 : u64; + v592 = hir.bitcast v591 : i64; + v572 = arith.constant 0 : i32; + v585 = arith.sub v572, v570 : i32 #[overflow = wrapping]; + v582 = arith.constant -1 : i32; + v581 = arith.add v570, v571 : i32 #[overflow = wrapping]; + v583 = arith.add v581, v582 : i32 #[overflow = wrapping]; + v586 = arith.band v583, v585 : i32; + v587 = hir.bitcast v586 : u32; + v588 = arith.zext v587 : u64; + v589 = hir.bitcast v588 : i64; + v593 = arith.mul v589, v592 : i64 #[overflow = wrapping]; + v1171 = arith.constant 0 : i32; + v594 = arith.constant 32 : i64; + v596 = hir.cast v594 : u32; + v595 = hir.bitcast v593 : u64; + v597 = arith.shr v595, v596 : u64; + v598 = hir.bitcast v597 : i64; + v599 = arith.trunc v598 : i32; + v601 = arith.neq v599, v1171 : i1; + v1083, v1084, v1085, v1086, v1087, v1088 = scf.if v601 : i32, i32, i32, i32, i32, u32 { + ^block139: + v1068 = arith.constant 0 : u32; + v1075 = ub.poison i32 : i32; + scf.yield v567, v578, v1075, v1075, v1075, v1068; } else { - ^block74: - v598 = arith.trunc v589 : i32; - v1166 = arith.constant 0 : i32; - v599 = arith.constant -2147483648 : i32; - v600 = arith.sub v599, v566 : i32 #[overflow = wrapping]; - v602 = hir.bitcast v600 : u32; - v601 = hir.bitcast v598 : u32; - v603 = arith.lte v601, v602 : i1; - v604 = arith.zext v603 : u32; - v605 = hir.bitcast v604 : i32; - v607 = arith.neq v605, v1166 : i1; - v1127 = scf.if v607 : i32 { - ^block72: - v1165 = arith.constant 0 : i32; - v618 = arith.neq v598, v1165 : i1; - v1126 = scf.if v618 : i32 { - ^block76: - v1164 = arith.constant 0 : i32; - v634 = arith.neq v565, v1164 : i1; - v1125 = scf.if v634 : i32 { - ^block79: - v616 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v574, v566, v598, v616) - v645 = hir.bitcast v574 : u32; - v690 = arith.constant 4 : u32; - v647 = arith.mod v645, v690 : u32; - hir.assertz v647 #[code = 250]; - v648 = hir.int_to_ptr v645 : ptr; - v649 = hir.load v648 : i32; - scf.yield v649; + ^block78: + v602 = arith.trunc v593 : i32; + v1170 = arith.constant 0 : i32; + v603 = arith.constant -2147483648 : i32; + v604 = arith.sub v603, v570 : i32 #[overflow = wrapping]; + v606 = hir.bitcast v604 : u32; + v605 = hir.bitcast v602 : u32; + v607 = arith.lte v605, v606 : i1; + v608 = arith.zext v607 : u32; + v609 = hir.bitcast v608 : i32; + v611 = arith.neq v609, v1170 : i1; + v1131 = scf.if v611 : i32 { + ^block76: + v1169 = arith.constant 0 : i32; + v622 = arith.neq v602, v1169 : i1; + v1130 = scf.if v622 : i32 { + ^block80: + v1168 = arith.constant 0 : i32; + v638 = arith.neq v569, v1168 : i1; + v1129 = scf.if v638 : i32 { + ^block83: + v620 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v578, v570, v602, v620) + v649 = hir.bitcast v578 : u32; + v694 = arith.constant 4 : u32; + v651 = arith.mod v649, v694 : u32; + hir.assertz v651 #[code = 250]; + v652 = hir.int_to_ptr v649 : ptr; + v653 = hir.load v652 : i32; + scf.yield v653; } else { - ^block80: - v635 = arith.constant 8 : i32; - v636 = arith.add v574, v635 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v636, v566, v598) - v620 = arith.constant 8 : u32; - v637 = hir.bitcast v574 : u32; - v639 = arith.add v637, v620 : u32 #[overflow = checked]; - v1163 = arith.constant 4 : u32; - v641 = arith.mod v639, v1163 : u32; - hir.assertz v641 #[code = 250]; - v642 = hir.int_to_ptr v639 : ptr; - v643 = hir.load v642 : i32; - scf.yield v643; + ^block84: + v639 = arith.constant 8 : i32; + v640 = arith.add v578, v639 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v640, v570, v602) + v624 = arith.constant 8 : u32; + v641 = hir.bitcast v578 : u32; + v643 = arith.add v641, v624 : u32 #[overflow = checked]; + v1167 = arith.constant 4 : u32; + v645 = arith.mod v643, v1167 : u32; + hir.assertz v645 #[code = 250]; + v646 = hir.int_to_ptr v643 : ptr; + v647 = hir.load v646 : i32; + scf.yield v647; }; - v1161 = arith.constant 0 : i32; - v1162 = arith.constant 0 : i32; - v652 = arith.eq v1125, v1162 : i1; - v653 = arith.zext v652 : u32; - v654 = hir.bitcast v653 : i32; - v656 = arith.neq v654, v1161 : i1; - scf.if v656{ - ^block81: + v1165 = arith.constant 0 : i32; + v1166 = arith.constant 0 : i32; + v656 = arith.eq v1129, v1166 : i1; + v657 = arith.zext v656 : u32; + v658 = hir.bitcast v657 : i32; + v660 = arith.neq v658, v1165 : i1; + scf.if v660{ + ^block85: + v1164 = arith.constant 8 : u32; + v677 = hir.bitcast v567 : u32; + v679 = arith.add v677, v1164 : u32 #[overflow = checked]; + v1163 = arith.constant 4 : u32; + v681 = arith.mod v679, v1163 : u32; + hir.assertz v681 #[code = 250]; + v682 = hir.int_to_ptr v679 : ptr; + hir.store v682, v602; + v1162 = arith.constant 4 : u32; + v684 = hir.bitcast v567 : u32; + v686 = arith.add v684, v1162 : u32 #[overflow = checked]; + v1161 = arith.constant 4 : u32; + v688 = arith.mod v686, v1161 : u32; + hir.assertz v688 #[code = 250]; + v689 = hir.int_to_ptr v686 : ptr; + hir.store v689, v570; + scf.yield ; + } else { + ^block86: v1160 = arith.constant 8 : u32; - v673 = hir.bitcast v563 : u32; - v675 = arith.add v673, v1160 : u32 #[overflow = checked]; + v662 = hir.bitcast v567 : u32; + v664 = arith.add v662, v1160 : u32 #[overflow = checked]; v1159 = arith.constant 4 : u32; - v677 = arith.mod v675, v1159 : u32; - hir.assertz v677 #[code = 250]; - v678 = hir.int_to_ptr v675 : ptr; - hir.store v678, v598; + v666 = arith.mod v664, v1159 : u32; + hir.assertz v666 #[code = 250]; + v667 = hir.int_to_ptr v664 : ptr; + hir.store v667, v1129; v1158 = arith.constant 4 : u32; - v680 = hir.bitcast v563 : u32; - v682 = arith.add v680, v1158 : u32 #[overflow = checked]; + v669 = hir.bitcast v567 : u32; + v671 = arith.add v669, v1158 : u32 #[overflow = checked]; v1157 = arith.constant 4 : u32; - v684 = arith.mod v682, v1157 : u32; - hir.assertz v684 #[code = 250]; - v685 = hir.int_to_ptr v682 : ptr; - hir.store v685, v566; - scf.yield ; - } else { - ^block82: - v1156 = arith.constant 8 : u32; - v658 = hir.bitcast v563 : u32; - v660 = arith.add v658, v1156 : u32 #[overflow = checked]; - v1155 = arith.constant 4 : u32; - v662 = arith.mod v660, v1155 : u32; - hir.assertz v662 #[code = 250]; - v663 = hir.int_to_ptr v660 : ptr; - hir.store v663, v1125; - v1154 = arith.constant 4 : u32; - v665 = hir.bitcast v563 : u32; - v667 = arith.add v665, v1154 : u32 #[overflow = checked]; - v1153 = arith.constant 4 : u32; - v669 = arith.mod v667, v1153 : u32; - hir.assertz v669 #[code = 250]; - v670 = hir.int_to_ptr v667 : ptr; - hir.store v670, v564; + v673 = arith.mod v671, v1157 : u32; + hir.assertz v673 #[code = 250]; + v674 = hir.int_to_ptr v671 : ptr; + hir.store v674, v568; scf.yield ; }; - v1151 = arith.constant 0 : i32; - v1152 = arith.constant 1 : i32; - v1124 = cf.select v656, v1152, v1151 : i32; - scf.yield v1124; + v1155 = arith.constant 0 : i32; + v1156 = arith.constant 1 : i32; + v1128 = cf.select v660, v1156, v1155 : i32; + scf.yield v1128; } else { - ^block77: - v1150 = arith.constant 8 : u32; - v619 = hir.bitcast v563 : u32; - v621 = arith.add v619, v1150 : u32 #[overflow = checked]; - v1149 = arith.constant 4 : u32; - v623 = arith.mod v621, v1149 : u32; - hir.assertz v623 #[code = 250]; - v624 = hir.int_to_ptr v621 : ptr; - hir.store v624, v566; - v1148 = arith.constant 4 : u32; - v627 = hir.bitcast v563 : u32; - v629 = arith.add v627, v1148 : u32 #[overflow = checked]; - v1147 = arith.constant 4 : u32; - v631 = arith.mod v629, v1147 : u32; - hir.assertz v631 #[code = 250]; - v1146 = arith.constant 0 : i32; - v632 = hir.int_to_ptr v629 : ptr; - hir.store v632, v1146; - v1145 = arith.constant 0 : i32; - scf.yield v1145; + ^block81: + v1154 = arith.constant 8 : u32; + v623 = hir.bitcast v567 : u32; + v625 = arith.add v623, v1154 : u32 #[overflow = checked]; + v1153 = arith.constant 4 : u32; + v627 = arith.mod v625, v1153 : u32; + hir.assertz v627 #[code = 250]; + v628 = hir.int_to_ptr v625 : ptr; + hir.store v628, v570; + v1152 = arith.constant 4 : u32; + v631 = hir.bitcast v567 : u32; + v633 = arith.add v631, v1152 : u32 #[overflow = checked]; + v1151 = arith.constant 4 : u32; + v635 = arith.mod v633, v1151 : u32; + hir.assertz v635 #[code = 250]; + v1150 = arith.constant 0 : i32; + v636 = hir.int_to_ptr v633 : ptr; + hir.store v636, v1150; + v1149 = arith.constant 0 : i32; + scf.yield v1149; }; - scf.yield v1126; + scf.yield v1130; } else { - ^block75: - v1144 = ub.poison i32 : i32; - scf.yield v1144; + ^block79: + v1148 = ub.poison i32 : i32; + scf.yield v1148; }; - v1139 = arith.constant 0 : u32; - v1072 = arith.constant 1 : u32; - v1132 = cf.select v607, v1072, v1139 : u32; - v1140 = ub.poison i32 : i32; - v1131 = cf.select v607, v574, v1140 : i32; - v1141 = ub.poison i32 : i32; - v1130 = cf.select v607, v563, v1141 : i32; - v1142 = ub.poison i32 : i32; - v1129 = cf.select v607, v1142, v574 : i32; - v1143 = ub.poison i32 : i32; - v1128 = cf.select v607, v1143, v563 : i32; - scf.yield v1128, v1129, v1130, v1127, v1131, v1132; + v1143 = arith.constant 0 : u32; + v1076 = arith.constant 1 : u32; + v1136 = cf.select v611, v1076, v1143 : u32; + v1144 = ub.poison i32 : i32; + v1135 = cf.select v611, v578, v1144 : i32; + v1145 = ub.poison i32 : i32; + v1134 = cf.select v611, v567, v1145 : i32; + v1146 = ub.poison i32 : i32; + v1133 = cf.select v611, v1146, v578 : i32; + v1147 = ub.poison i32 : i32; + v1132 = cf.select v611, v1147, v567 : i32; + scf.yield v1132, v1133, v1134, v1131, v1135, v1136; }; - v1085, v1086, v1087 = scf.index_switch v1084 : i32, i32, i32 + v1089, v1090, v1091 = scf.index_switch v1088 : i32, i32, i32 case 0 { - ^block73: - v1138 = arith.constant 4 : u32; - v610 = hir.bitcast v1079 : u32; - v612 = arith.add v610, v1138 : u32 #[overflow = checked]; - v1137 = arith.constant 4 : u32; - v614 = arith.mod v612, v1137 : u32; - hir.assertz v614 #[code = 250]; - v1136 = arith.constant 0 : i32; - v615 = hir.int_to_ptr v612 : ptr; - hir.store v615, v1136; - v1135 = arith.constant 1 : i32; - scf.yield v1079, v1135, v1080; + ^block77: + v1142 = arith.constant 4 : u32; + v614 = hir.bitcast v1083 : u32; + v616 = arith.add v614, v1142 : u32 #[overflow = checked]; + v1141 = arith.constant 4 : u32; + v618 = arith.mod v616, v1141 : u32; + hir.assertz v618 #[code = 250]; + v1140 = arith.constant 0 : i32; + v619 = hir.int_to_ptr v616 : ptr; + hir.store v619, v1140; + v1139 = arith.constant 1 : i32; + scf.yield v1083, v1139, v1084; } default { - ^block139: - scf.yield v1081, v1082, v1083; + ^block143: + scf.yield v1085, v1086, v1087; }; - v689 = hir.bitcast v1085 : u32; - v1134 = arith.constant 4 : u32; - v691 = arith.mod v689, v1134 : u32; - hir.assertz v691 #[code = 250]; - v692 = hir.int_to_ptr v689 : ptr; - hir.store v692, v1086; - v1133 = arith.constant 16 : i32; - v697 = arith.add v1087, v1133 : i32 #[overflow = wrapping]; - v698 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v699 = hir.bitcast v698 : ptr; - hir.store v699, v697; + v693 = hir.bitcast v1089 : u32; + v1138 = arith.constant 4 : u32; + v695 = arith.mod v693, v1138 : u32; + hir.assertz v695 #[code = 250]; + v696 = hir.int_to_ptr v693 : ptr; + hir.store v696, v1090; + v1137 = arith.constant 16 : i32; + v701 = arith.add v1091, v1137 : i32 #[overflow = wrapping]; + v702 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v703 = hir.bitcast v702 : ptr; + hir.store v703, v701; builtin.ret ; }; - private builtin.function @::allocate(v700: i32, v701: i32, v702: i32) { - ^block83(v700: i32, v701: i32, v702: i32): - v704 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v705 = hir.bitcast v704 : ptr; - v706 = hir.load v705 : i32; - v707 = arith.constant 16 : i32; - v708 = arith.sub v706, v707 : i32 #[overflow = wrapping]; - v709 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v710 = hir.bitcast v709 : ptr; - hir.store v710, v708; - v703 = arith.constant 0 : i32; - v711 = arith.constant 8 : i32; - v712 = arith.add v708, v711 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v712, v701, v702, v703) - v715 = arith.constant 12 : u32; - v714 = hir.bitcast v708 : u32; - v716 = arith.add v714, v715 : u32 #[overflow = checked]; - v717 = arith.constant 4 : u32; - v718 = arith.mod v716, v717 : u32; - hir.assertz v718 #[code = 250]; - v719 = hir.int_to_ptr v716 : ptr; - v720 = hir.load v719 : i32; - v722 = arith.constant 8 : u32; - v721 = hir.bitcast v708 : u32; - v723 = arith.add v721, v722 : u32 #[overflow = checked]; - v1172 = arith.constant 4 : u32; - v725 = arith.mod v723, v1172 : u32; - hir.assertz v725 #[code = 250]; - v726 = hir.int_to_ptr v723 : ptr; - v727 = hir.load v726 : i32; - v728 = hir.bitcast v700 : u32; - v1171 = arith.constant 4 : u32; - v730 = arith.mod v728, v1171 : u32; - hir.assertz v730 #[code = 250]; - v731 = hir.int_to_ptr v728 : ptr; - hir.store v731, v727; - v1170 = arith.constant 4 : u32; - v732 = hir.bitcast v700 : u32; - v734 = arith.add v732, v1170 : u32 #[overflow = checked]; - v1169 = arith.constant 4 : u32; - v736 = arith.mod v734, v1169 : u32; - hir.assertz v736 #[code = 250]; - v737 = hir.int_to_ptr v734 : ptr; - hir.store v737, v720; - v1168 = arith.constant 16 : i32; - v739 = arith.add v708, v1168 : i32 #[overflow = wrapping]; - v740 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v741 = hir.bitcast v740 : ptr; - hir.store v741, v739; + private builtin.function @::allocate(v704: i32, v705: i32, v706: i32) { + ^block87(v704: i32, v705: i32, v706: i32): + v708 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v709 = hir.bitcast v708 : ptr; + v710 = hir.load v709 : i32; + v711 = arith.constant 16 : i32; + v712 = arith.sub v710, v711 : i32 #[overflow = wrapping]; + v713 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v714 = hir.bitcast v713 : ptr; + hir.store v714, v712; + v707 = arith.constant 0 : i32; + v715 = arith.constant 8 : i32; + v716 = arith.add v712, v715 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v716, v705, v706, v707) + v719 = arith.constant 12 : u32; + v718 = hir.bitcast v712 : u32; + v720 = arith.add v718, v719 : u32 #[overflow = checked]; + v721 = arith.constant 4 : u32; + v722 = arith.mod v720, v721 : u32; + hir.assertz v722 #[code = 250]; + v723 = hir.int_to_ptr v720 : ptr; + v724 = hir.load v723 : i32; + v726 = arith.constant 8 : u32; + v725 = hir.bitcast v712 : u32; + v727 = arith.add v725, v726 : u32 #[overflow = checked]; + v1176 = arith.constant 4 : u32; + v729 = arith.mod v727, v1176 : u32; + hir.assertz v729 #[code = 250]; + v730 = hir.int_to_ptr v727 : ptr; + v731 = hir.load v730 : i32; + v732 = hir.bitcast v704 : u32; + v1175 = arith.constant 4 : u32; + v734 = arith.mod v732, v1175 : u32; + hir.assertz v734 #[code = 250]; + v735 = hir.int_to_ptr v732 : ptr; + hir.store v735, v731; + v1174 = arith.constant 4 : u32; + v736 = hir.bitcast v704 : u32; + v738 = arith.add v736, v1174 : u32 #[overflow = checked]; + v1173 = arith.constant 4 : u32; + v740 = arith.mod v738, v1173 : u32; + hir.assertz v740 #[code = 250]; + v741 = hir.int_to_ptr v738 : ptr; + hir.store v741, v724; + v1172 = arith.constant 16 : i32; + v743 = arith.add v712, v1172 : i32 #[overflow = wrapping]; + v744 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v745 = hir.bitcast v744 : ptr; + hir.store v745, v743; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v742: i32, v743: i32, v744: i32, v745: i32) { - ^block85(v742: i32, v743: i32, v744: i32, v745: i32): - v1188 = arith.constant 0 : i32; - v746 = arith.constant 0 : i32; - v747 = arith.eq v744, v746 : i1; - v748 = arith.zext v747 : u32; - v749 = hir.bitcast v748 : i32; - v751 = arith.neq v749, v1188 : i1; - v1184 = scf.if v751 : i32 { - ^block142: - scf.yield v743; + private builtin.function @alloc::alloc::Global::alloc_impl(v746: i32, v747: i32, v748: i32, v749: i32) { + ^block89(v746: i32, v747: i32, v748: i32, v749: i32): + v1192 = arith.constant 0 : i32; + v750 = arith.constant 0 : i32; + v751 = arith.eq v748, v750 : i1; + v752 = arith.zext v751 : u32; + v753 = hir.bitcast v752 : i32; + v755 = arith.neq v753, v1192 : i1; + v1188 = scf.if v755 : i32 { + ^block146: + scf.yield v747; } else { - ^block88: + ^block92: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1187 = arith.constant 0 : i32; - v753 = arith.neq v745, v1187 : i1; - v1183 = scf.if v753 : i32 { - ^block89: - v755 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v744, v743) : i32 - scf.yield v755; + v1191 = arith.constant 0 : i32; + v757 = arith.neq v749, v1191 : i1; + v1187 = scf.if v757 : i32 { + ^block93: + v759 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v748, v747) : i32 + scf.yield v759; } else { - ^block90: - v754 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v744, v743) : i32 - scf.yield v754; + ^block94: + v758 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v748, v747) : i32 + scf.yield v758; }; - scf.yield v1183; + scf.yield v1187; }; - v759 = arith.constant 4 : u32; - v758 = hir.bitcast v742 : u32; - v760 = arith.add v758, v759 : u32 #[overflow = checked]; - v1186 = arith.constant 4 : u32; - v762 = arith.mod v760, v1186 : u32; - hir.assertz v762 #[code = 250]; - v763 = hir.int_to_ptr v760 : ptr; - hir.store v763, v744; - v765 = hir.bitcast v742 : u32; - v1185 = arith.constant 4 : u32; - v767 = arith.mod v765, v1185 : u32; - hir.assertz v767 #[code = 250]; - v768 = hir.int_to_ptr v765 : ptr; - hir.store v768, v1184; + v763 = arith.constant 4 : u32; + v762 = hir.bitcast v746 : u32; + v764 = arith.add v762, v763 : u32 #[overflow = checked]; + v1190 = arith.constant 4 : u32; + v766 = arith.mod v764, v1190 : u32; + hir.assertz v766 #[code = 250]; + v767 = hir.int_to_ptr v764 : ptr; + hir.store v767, v748; + v769 = hir.bitcast v746 : u32; + v1189 = arith.constant 4 : u32; + v771 = arith.mod v769, v1189 : u32; + hir.assertz v771 #[code = 250]; + v772 = hir.int_to_ptr v769 : ptr; + hir.store v772, v1188; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v769: i32, v770: i32, v771: i32, v772: i32) { - ^block91(v769: i32, v770: i32, v771: i32, v772: i32): - v1214 = arith.constant 0 : i32; - v773 = arith.constant 0 : i32; - v777 = arith.eq v772, v773 : i1; - v778 = arith.zext v777 : u32; - v779 = hir.bitcast v778 : i32; - v781 = arith.neq v779, v1214 : i1; - v1201, v1202 = scf.if v781 : i32, i32 { - ^block146: - v1213 = arith.constant 0 : i32; - v775 = arith.constant 4 : i32; - scf.yield v775, v1213; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v773: i32, v774: i32, v775: i32, v776: i32) { + ^block95(v773: i32, v774: i32, v775: i32, v776: i32): + v1218 = arith.constant 0 : i32; + v777 = arith.constant 0 : i32; + v781 = arith.eq v776, v777 : i1; + v782 = arith.zext v781 : u32; + v783 = hir.bitcast v782 : i32; + v785 = arith.neq v783, v1218 : i1; + v1205, v1206 = scf.if v785 : i32, i32 { + ^block150: + v1217 = arith.constant 0 : i32; + v779 = arith.constant 4 : i32; + scf.yield v779, v1217; } else { - ^block94: - v782 = hir.bitcast v770 : u32; - v817 = arith.constant 4 : u32; - v784 = arith.mod v782, v817 : u32; - hir.assertz v784 #[code = 250]; - v785 = hir.int_to_ptr v782 : ptr; - v786 = hir.load v785 : i32; - v1211 = arith.constant 0 : i32; - v1212 = arith.constant 0 : i32; - v788 = arith.eq v786, v1212 : i1; - v789 = arith.zext v788 : u32; - v790 = hir.bitcast v789 : i32; - v792 = arith.neq v790, v1211 : i1; - v1199 = scf.if v792 : i32 { - ^block145: - v1210 = arith.constant 0 : i32; - scf.yield v1210; + ^block98: + v786 = hir.bitcast v774 : u32; + v821 = arith.constant 4 : u32; + v788 = arith.mod v786, v821 : u32; + hir.assertz v788 #[code = 250]; + v789 = hir.int_to_ptr v786 : ptr; + v790 = hir.load v789 : i32; + v1215 = arith.constant 0 : i32; + v1216 = arith.constant 0 : i32; + v792 = arith.eq v790, v1216 : i1; + v793 = arith.zext v792 : u32; + v794 = hir.bitcast v793 : i32; + v796 = arith.neq v794, v1215 : i1; + v1203 = scf.if v796 : i32 { + ^block149: + v1214 = arith.constant 0 : i32; + scf.yield v1214; } else { - ^block95: + ^block99: + v1213 = arith.constant 4 : u32; + v797 = hir.bitcast v773 : u32; + v799 = arith.add v797, v1213 : u32 #[overflow = checked]; + v1212 = arith.constant 4 : u32; + v801 = arith.mod v799, v1212 : u32; + hir.assertz v801 #[code = 250]; + v802 = hir.int_to_ptr v799 : ptr; + hir.store v802, v775; + v1211 = arith.constant 4 : u32; + v803 = hir.bitcast v774 : u32; + v805 = arith.add v803, v1211 : u32 #[overflow = checked]; + v1210 = arith.constant 4 : u32; + v807 = arith.mod v805, v1210 : u32; + hir.assertz v807 #[code = 250]; + v808 = hir.int_to_ptr v805 : ptr; + v809 = hir.load v808 : i32; + v810 = hir.bitcast v773 : u32; v1209 = arith.constant 4 : u32; - v793 = hir.bitcast v769 : u32; - v795 = arith.add v793, v1209 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v797 = arith.mod v795, v1208 : u32; - hir.assertz v797 #[code = 250]; - v798 = hir.int_to_ptr v795 : ptr; - hir.store v798, v771; - v1207 = arith.constant 4 : u32; - v799 = hir.bitcast v770 : u32; - v801 = arith.add v799, v1207 : u32 #[overflow = checked]; - v1206 = arith.constant 4 : u32; - v803 = arith.mod v801, v1206 : u32; - hir.assertz v803 #[code = 250]; - v804 = hir.int_to_ptr v801 : ptr; - v805 = hir.load v804 : i32; - v806 = hir.bitcast v769 : u32; - v1205 = arith.constant 4 : u32; - v808 = arith.mod v806, v1205 : u32; - hir.assertz v808 #[code = 250]; - v809 = hir.int_to_ptr v806 : ptr; - hir.store v809, v805; - v810 = arith.mul v786, v772 : i32 #[overflow = wrapping]; - scf.yield v810; + v812 = arith.mod v810, v1209 : u32; + hir.assertz v812 #[code = 250]; + v813 = hir.int_to_ptr v810 : ptr; + hir.store v813, v809; + v814 = arith.mul v790, v776 : i32 #[overflow = wrapping]; + scf.yield v814; }; - v811 = arith.constant 8 : i32; - v1204 = arith.constant 4 : i32; - v1200 = cf.select v792, v1204, v811 : i32; - scf.yield v1200, v1199; + v815 = arith.constant 8 : i32; + v1208 = arith.constant 4 : i32; + v1204 = cf.select v796, v1208, v815 : i32; + scf.yield v1204, v1203; }; - v814 = arith.add v769, v1201 : i32 #[overflow = wrapping]; - v816 = hir.bitcast v814 : u32; - v1203 = arith.constant 4 : u32; - v818 = arith.mod v816, v1203 : u32; - hir.assertz v818 #[code = 250]; - v819 = hir.int_to_ptr v816 : ptr; - hir.store v819, v1202; + v818 = arith.add v773, v1205 : i32 #[overflow = wrapping]; + v820 = hir.bitcast v818 : u32; + v1207 = arith.constant 4 : u32; + v822 = arith.mod v820, v1207 : u32; + hir.assertz v822 #[code = 250]; + v823 = hir.int_to_ptr v820 : ptr; + hir.store v823, v1206; builtin.ret ; }; - private builtin.function @::deallocate(v820: i32, v821: i32, v822: i32) { - ^block96(v820: i32, v821: i32, v822: i32): - v1216 = arith.constant 0 : i32; - v823 = arith.constant 0 : i32; - v824 = arith.eq v822, v823 : i1; - v825 = arith.zext v824 : u32; - v826 = hir.bitcast v825 : i32; - v828 = arith.neq v826, v1216 : i1; - scf.if v828{ - ^block98: + private builtin.function @::deallocate(v824: i32, v825: i32, v826: i32) { + ^block100(v824: i32, v825: i32, v826: i32): + v1220 = arith.constant 0 : i32; + v827 = arith.constant 0 : i32; + v828 = arith.eq v826, v827 : i1; + v829 = arith.zext v828 : u32; + v830 = hir.bitcast v829 : i32; + v832 = arith.neq v830, v1220 : i1; + scf.if v832{ + ^block102: scf.yield ; } else { - ^block99: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v820, v822, v821) + ^block103: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v824, v826, v825) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v829: i32, v830: i32, v831: i32) { - ^block100(v829: i32, v830: i32, v831: i32): + private builtin.function @alloc::raw_vec::handle_error(v833: i32, v834: i32, v835: i32) { + ^block104(v833: i32, v834: i32, v835: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v832: i32, v833: i32) -> i32 { - ^block102(v832: i32, v833: i32): - v840 = arith.constant 0 : i32; - v836 = hir.bitcast v833 : u32; - v835 = hir.bitcast v832 : u32; - v837 = arith.gt v835, v836 : i1; - v838 = arith.zext v837 : u32; - v839 = hir.bitcast v838 : i32; - v841 = arith.neq v839, v840 : i1; - v842 = cf.select v841, v832, v833 : i32; - builtin.ret v842; + private builtin.function @core::ptr::alignment::Alignment::max(v836: i32, v837: i32) -> i32 { + ^block106(v836: i32, v837: i32): + v844 = arith.constant 0 : i32; + v840 = hir.bitcast v837 : u32; + v839 = hir.bitcast v836 : u32; + v841 = arith.gt v839, v840 : i1; + v842 = arith.zext v841 : u32; + v843 = hir.bitcast v842 : i32; + v845 = arith.neq v843, v844 : i1; + v846 = cf.select v845, v836, v837 : i32; + builtin.ret v846; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1205,12 +1217,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x00000022000000310000002900100000000000210000001300000029001000000000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000073722e65746f6e2f73676e69646e69622f6372732f312e342e302d7379732d657361622d6e6564696d; + builtin.segment @1048576 = 0x0000000000000000000000220000003000000029001000000000002100000012000000290010000000000001000000010000000100000073722e65746f6e2f73676e69646e69622f6372732f302e352e302d7379732d657361622d6e6564696d; }; - public builtin.function @run(v843: felt, v844: felt, v845: felt, v846: felt) { - ^block104(v843: felt, v844: felt, v845: felt, v846: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v843, v844, v845, v846) + public builtin.function @run(v847: felt, v848: felt, v849: felt, v850: felt) { + ^block108(v847: felt, v848: felt, v849: felt, v850: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v847, v848, v849, v850) builtin.ret ; }; }; \ No newline at end of file diff --git a/tests/integration/expected/examples/p2id.masm b/tests/integration/expected/examples/p2id.masm index 9747c2303..2bf8dbda6 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -15,23 +15,23 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.11037815730036099628 - push.4341605987084626125 - push.6620663486746975562 - push.17833200410402133662 + push.16965793849803828424 + push.9312017580041654938 + push.3552077852088157573 + push.16633028456433838611 adv.push_mapval push.262144 - push.8 + push.6 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278560 + mem_store.278552 push.0 u32assert - mem_store.278561 + mem_store.278553 end # mod miden:base/note-script@1.0.0::p2id @@ -44,55 +44,6 @@ proc.p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_impor nop end -proc.miden_base_sys::bindings::account::extern_account_get_id - trace.240 - nop - exec.::miden::account::get_id - trace.252 - nop - movup.2 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - -proc.miden_base_sys::bindings::note::extern_note_get_inputs - trace.240 - nop - exec.::miden::note::get_inputs - trace.252 - nop - swap.1 - drop -end - -proc.miden_base_sys::bindings::note::extern_note_get_assets - trace.240 - nop - exec.::miden::note::get_assets - trace.252 - nop - swap.1 - drop -end - proc.__wasm_call_ctors nop end @@ -102,7 +53,7 @@ proc.p2id::bindings::__link_custom_section_describing_imports end proc.__rustc::__rust_alloc - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -110,7 +61,7 @@ proc.__rustc::__rust_alloc exec.::intrinsics::mem::load_sw trace.252 nop - push.1048704 + push.1048664 u32wrapping_add movup.2 swap.1 @@ -128,7 +79,7 @@ proc.__rustc::__rust_dealloc end proc.__rustc::__rust_alloc_zeroed - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -136,7 +87,7 @@ proc.__rustc::__rust_alloc_zeroed exec.::intrinsics::mem::load_sw trace.252 nop - push.1048704 + push.1048664 u32wrapping_add dup.1 swap.2 @@ -218,7 +169,7 @@ export.miden:base/note-script@1.0.0#run drop drop drop - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -228,7 +179,7 @@ export.miden:base/note-script@1.0.0#run nop push.48 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -379,8 +330,17 @@ export.miden:base/note-script@1.0.0#run trace.252 nop movup.2 - assert_eq - assert_eq + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::assert_eq + trace.252 + nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::assert_eq + trace.252 + nop push.28 dup.1 swap.1 @@ -660,7 +620,7 @@ export.miden:base/note-script@1.0.0#run nop push.48 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -685,7 +645,7 @@ proc.__rustc::__rust_no_alloc_shim_is_unstable_v2 end proc.wit_bindgen_rt::run_ctors_once - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -693,7 +653,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048708 + push.1048668 u32wrapping_add u32divmod.4 swap.1 @@ -714,7 +674,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -728,7 +688,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048708 + push.1048668 movup.2 swap.1 u32wrapping_add @@ -833,7 +793,7 @@ proc.::alloc else trace.240 nop - exec.::intrinsics::mem::heap_base + exec.::miden:base/note-script@1.0.0::p2id::intrinsics::mem::heap_base trace.252 nop trace.240 @@ -936,8 +896,16 @@ proc.::alloc end end +proc.intrinsics::mem::heap_base + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + proc.alloc::raw_vec::RawVecInner::with_capacity_in - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -947,7 +915,7 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1067,7 +1035,7 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1107,7 +1075,7 @@ proc.alloc::raw_vec::RawVecInner::with_capacity_in end proc.miden_base_sys::bindings::account::get_id - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1117,7 +1085,7 @@ proc.miden_base_sys::bindings::account::get_id nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1133,7 +1101,7 @@ proc.miden_base_sys::bindings::account::get_id u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::account::extern_account_get_id + exec.::miden:base/note-script@1.0.0::p2id::miden::account::get_id trace.252 nop push.8 @@ -1169,7 +1137,7 @@ proc.miden_base_sys::bindings::account::get_id nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1180,7 +1148,7 @@ proc.miden_base_sys::bindings::account::get_id end proc.miden_base_sys::bindings::note::get_inputs - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1190,7 +1158,7 @@ proc.miden_base_sys::bindings::note::get_inputs nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1200,7 +1168,7 @@ proc.miden_base_sys::bindings::note::get_inputs exec.::intrinsics::mem::store_sw trace.252 nop - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -1208,7 +1176,7 @@ proc.miden_base_sys::bindings::note::get_inputs exec.::intrinsics::mem::load_sw trace.252 nop - push.1048672 + push.1048632 u32wrapping_add push.4 push.8 @@ -1263,7 +1231,7 @@ proc.miden_base_sys::bindings::note::get_inputs u32shr trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::note::extern_note_get_inputs + exec.::miden:base/note-script@1.0.0::p2id::miden::note::get_inputs trace.252 nop push.8 @@ -1316,7 +1284,7 @@ proc.miden_base_sys::bindings::note::get_inputs nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1327,7 +1295,7 @@ proc.miden_base_sys::bindings::note::get_inputs end proc.miden_base_sys::bindings::note::get_assets - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1337,7 +1305,7 @@ proc.miden_base_sys::bindings::note::get_assets nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1347,7 +1315,7 @@ proc.miden_base_sys::bindings::note::get_assets exec.::intrinsics::mem::store_sw trace.252 nop - push.1114244 + push.1114212 u32divmod.4 swap.1 trace.240 @@ -1355,7 +1323,7 @@ proc.miden_base_sys::bindings::note::get_assets exec.::intrinsics::mem::load_sw trace.252 nop - push.1048688 + push.1048648 u32wrapping_add push.16 push.8 @@ -1410,7 +1378,7 @@ proc.miden_base_sys::bindings::note::get_assets u32shr trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::note::extern_note_get_assets + exec.::miden:base/note-script@1.0.0::p2id::miden::note::get_assets trace.252 nop push.8 @@ -1463,7 +1431,7 @@ proc.miden_base_sys::bindings::note::get_assets nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1473,8 +1441,61 @@ proc.miden_base_sys::bindings::note::get_assets nop end +proc.miden::account::get_id + trace.240 + nop + exec.::miden::account::get_id + trace.252 + nop + movup.2 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +proc.miden::note::get_inputs + trace.240 + nop + exec.::miden::note::get_inputs + trace.252 + nop + swap.1 + drop +end + +proc.miden::note::get_assets + trace.240 + nop + exec.::miden::note::get_assets + trace.252 + nop + swap.1 + drop +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + proc.alloc::raw_vec::RawVecInner::deallocate - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1484,7 +1505,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1577,7 +1598,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate end push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1588,7 +1609,7 @@ proc.alloc::raw_vec::RawVecInner::deallocate end proc.alloc::raw_vec::RawVecInner::try_allocate_in - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1598,7 +1619,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -1985,7 +2006,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -1996,7 +2017,7 @@ proc.alloc::raw_vec::RawVecInner::try_allocate_in end proc.::allocate - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 @@ -2006,7 +2027,7 @@ proc.::allocate nop push.16 u32wrapping_sub - push.1114240 + push.1114208 dup.1 swap.1 u32divmod.4 @@ -2100,7 +2121,7 @@ proc.::allocate nop push.16 u32wrapping_add - push.1114240 + push.1114208 u32divmod.4 swap.1 trace.240 diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 7722c1591..ff6f9110d 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -21,53 +21,19 @@ ) ) (import "miden:basic-wallet/basic-wallet@1.0.0" (instance (;1;) (type 2))) - (type (;3;) - (instance - (type (;0;) (func (result s32))) - (export (;0;) "heap-base" (func (type 0))) - ) - ) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" (instance (;2;) (type 3))) - (type (;4;) - (instance - (type (;0;) (func (param "a" f32) (param "b" f32))) - (export (;0;) "assert-eq" (func (type 0))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;3;) (type 4))) - (type (;5;) - (instance - (type (;0;) (func (param "result-ptr" s32))) - (export (;0;) "get-id" (func (type 0))) - ) - ) - (import "miden:core-base/account@1.0.0" (instance (;4;) (type 5))) - (type (;6;) - (instance - (type (;0;) (func (param "ptr" s32) (result s32))) - (export (;0;) "get-inputs" (func (type 0))) - (export (;1;) "get-assets" (func (type 0))) - ) - ) - (import "miden:core-base/note@1.0.0" (instance (;5;) (type 6))) (core module (;0;) - (type (;0;) (func (param f32 f32))) - (type (;1;) (func (param f32 f32 f32 f32))) - (type (;2;) (func (result i32))) - (type (;3;) (func (param i32))) - (type (;4;) (func (param i32) (result i32))) - (type (;5;) (func)) - (type (;6;) (func (param i32 i32) (result i32))) - (type (;7;) (func (param i32 i32 i32))) - (type (;8;) (func (param i32 i32 i32) (result i32))) - (type (;9;) (func (param i32 i32 i32 i32))) + (type (;0;) (func (param f32 f32 f32 f32))) + (type (;1;) (func)) + (type (;2;) (func (param i32 i32) (result i32))) + (type (;3;) (func (param i32 i32 i32))) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (result i32))) + (type (;6;) (func (param i32 i32 i32 i32))) + (type (;7;) (func (param i32))) + (type (;8;) (func (param i32) (result i32))) + (type (;9;) (func (param f32 f32))) (type (;10;) (func (param i32 i32 i32 i32 i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;0;) (type 0))) - (import "miden:basic-wallet/basic-wallet@1.0.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" "heap-base" (func $miden_sdk_alloc::heap_base (;2;) (type 2))) - (import "miden:core-base/account@1.0.0" "get-id" (func $miden_base_sys::bindings::account::extern_account_get_id (;3;) (type 3))) - (import "miden:core-base/note@1.0.0" "get-inputs" (func $miden_base_sys::bindings::note::extern_note_get_inputs (;4;) (type 4))) - (import "miden:core-base/note@1.0.0" "get-assets" (func $miden_base_sys::bindings::note::extern_note_get_assets (;5;) (type 4))) + (import "miden:basic-wallet/basic-wallet@1.0.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -75,21 +41,21 @@ (export "memory" (memory 0)) (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $p2id::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;6;) (type 5)) - (func $p2id::bindings::__link_custom_section_describing_imports (;7;) (type 5)) - (func $__rustc::__rust_alloc (;8;) (type 6) (param i32 i32) (result i32) + (func $__wasm_call_ctors (;1;) (type 1)) + (func $p2id::bindings::__link_custom_section_describing_imports (;2;) (type 1)) + (func $__rustc::__rust_alloc (;3;) (type 2) (param i32 i32) (result i32) global.get $GOT.data.internal.__memory_base - i32.const 1048704 + i32.const 1048664 i32.add local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_dealloc (;9;) (type 7) (param i32 i32 i32)) - (func $__rustc::__rust_alloc_zeroed (;10;) (type 6) (param i32 i32) (result i32) + (func $__rustc::__rust_dealloc (;4;) (type 3) (param i32 i32 i32)) + (func $__rustc::__rust_alloc_zeroed (;5;) (type 2) (param i32 i32) (result i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048704 + i32.const 1048664 i32.add local.get 1 local.get 0 @@ -107,7 +73,7 @@ end local.get 1 ) - (func $miden:base/note-script@1.0.0#run (;11;) (type 1) (param f32 f32 f32 f32) + (func $miden:base/note-script@1.0.0#run (;6;) (type 0) (param f32 f32 f32 f32) (local i32 i32 f32 f32 f32 i32 i32 i32) global.get $__stack_pointer i32.const 48 @@ -145,10 +111,10 @@ local.get 4 f32.load offset=8 local.get 7 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::assert_eq local.get 8 local.get 6 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::assert_eq local.get 4 i32.const 28 i32.add @@ -213,14 +179,14 @@ i32.add global.set $__stack_pointer ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;12;) (type 5) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;7;) (type 1) return ) - (func $wit_bindgen_rt::run_ctors_once (;13;) (type 5) + (func $wit_bindgen_rt::run_ctors_once (;8;) (type 1) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048708 + i32.const 1048668 i32.add i32.load8_u br_if 0 (;@1;) @@ -228,13 +194,13 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048708 + i32.const 1048668 i32.add i32.const 1 i32.store8 end ) - (func $::alloc (;14;) (type 8) (param i32 i32 i32) (result i32) + (func $::alloc (;9;) (type 4) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -275,7 +241,7 @@ i32.load br_if 0 (;@2;) local.get 0 - call $miden_sdk_alloc::heap_base + call $intrinsics::mem::heap_base memory.size i32.const 16 i32.shl @@ -306,7 +272,10 @@ end unreachable ) - (func $alloc::raw_vec::RawVecInner::with_capacity_in (;15;) (type 9) (param i32 i32 i32 i32) + (func $intrinsics::mem::heap_base (;10;) (type 5) (result i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::with_capacity_in (;11;) (type 6) (param i32 i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -349,7 +318,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::account::get_id (;16;) (type 3) (param i32) + (func $miden_base_sys::bindings::account::get_id (;12;) (type 7) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -359,7 +328,7 @@ local.get 1 i32.const 8 i32.add - call $miden_base_sys::bindings::account::extern_account_get_id + call $miden::account::get_id local.get 0 local.get 1 i64.load offset=8 align=4 @@ -369,7 +338,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_inputs (;17;) (type 3) (param i32) + (func $miden_base_sys::bindings::note::get_inputs (;13;) (type 7) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -382,7 +351,7 @@ i32.const 4 i32.const 4 global.get $GOT.data.internal.__memory_base - i32.const 1048672 + i32.const 1048632 i32.add call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 @@ -394,7 +363,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden_base_sys::bindings::note::extern_note_get_inputs + call $miden::note::get_inputs i32.store offset=8 local.get 0 local.get 3 @@ -407,7 +376,7 @@ i32.add global.set $__stack_pointer ) - (func $miden_base_sys::bindings::note::get_assets (;18;) (type 3) (param i32) + (func $miden_base_sys::bindings::note::get_assets (;14;) (type 7) (param i32) (local i32 i32 i32) global.get $__stack_pointer i32.const 16 @@ -420,7 +389,7 @@ i32.const 16 i32.const 16 global.get $GOT.data.internal.__memory_base - i32.const 1048688 + i32.const 1048648 i32.add call $alloc::raw_vec::RawVecInner::with_capacity_in local.get 1 @@ -432,7 +401,7 @@ local.tee 3 i32.const 2 i32.shr_u - call $miden_base_sys::bindings::note::extern_note_get_assets + call $miden::note::get_assets i32.store offset=8 local.get 0 local.get 3 @@ -445,7 +414,19 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::deallocate (;19;) (type 7) (param i32 i32 i32) + (func $miden::account::get_id (;15;) (type 7) (param i32) + unreachable + ) + (func $miden::note::get_inputs (;16;) (type 8) (param i32) (result i32) + unreachable + ) + (func $miden::note::get_assets (;17;) (type 8) (param i32) (result i32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;18;) (type 9) (param f32 f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;19;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -589,7 +570,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;21;) (type 7) (param i32 i32 i32) + (func $::allocate (;21;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -618,7 +599,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;22;) (type 9) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;22;) (type 6) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -645,7 +626,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;23;) (type 9) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;23;) (type 6) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -680,7 +661,7 @@ local.get 4 i32.store ) - (func $::deallocate (;24;) (type 7) (param i32 i32 i32) + (func $::deallocate (;24;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -691,10 +672,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;25;) (type 7) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;25;) (type 3) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;26;) (type 6) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;26;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -702,52 +683,25 @@ i32.gt_u select ) - (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.4.1/src/bindings/note.rs\00") - (data $.data (;1;) (i32.const 1048620) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00)\00\00\00\13\00\00\00!\00\00\00\00\00\10\00)\00\00\001\00\00\00\22\00\00\00") + (data $.rodata (;0;) (i32.const 1048576) "miden-base-sys-0.5.0/src/bindings/note.rs\00") + (data $.data (;1;) (i32.const 1048620) "\01\00\00\00\01\00\00\00\01\00\00\00\00\00\10\00)\00\00\00\12\00\00\00!\00\00\00\00\00\10\00)\00\00\000\00\00\00\22\00\00\00") ) - (alias export 0 "word" (type (;7;))) - (alias export 3 "assert-eq" (func (;0;))) + (alias export 0 "word" (type (;3;))) + (alias export 1 "receive-asset" (func (;0;))) (core func (;0;) (canon lower (func 0))) (core instance (;0;) - (export "assert-eq" (func 0)) - ) - (alias export 1 "receive-asset" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (core instance (;1;) - (export "receive-asset" (func 1)) - ) - (alias export 2 "heap-base" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (core instance (;2;) - (export "heap-base" (func 2)) - ) - (alias export 4 "get-id" (func (;3;))) - (core func (;3;) (canon lower (func 3))) - (core instance (;3;) - (export "get-id" (func 3)) - ) - (alias export 5 "get-inputs" (func (;4;))) - (core func (;4;) (canon lower (func 4))) - (alias export 5 "get-assets" (func (;5;))) - (core func (;5;) (canon lower (func 5))) - (core instance (;4;) - (export "get-inputs" (func 4)) - (export "get-assets" (func 5)) + (export "receive-asset" (func 0)) ) - (core instance (;5;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 0)) - (with "miden:basic-wallet/basic-wallet@1.0.0" (instance 1)) - (with "miden:core-intrinsics/intrinsics-mem@1.0.0" (instance 2)) - (with "miden:core-base/account@1.0.0" (instance 3)) - (with "miden:core-base/note@1.0.0" (instance 4)) + (core instance (;1;) (instantiate 0 + (with "miden:basic-wallet/basic-wallet@1.0.0" (instance 0)) ) ) - (alias core export 5 "memory" (core memory (;0;))) - (type (;8;) (func (param "arg" 7))) - (alias core export 5 "miden:base/note-script@1.0.0#run" (core func (;6;))) - (func (;6;) (type 8) (canon lift (core func 6))) - (alias export 0 "felt" (type (;9;))) - (alias export 0 "word" (type (;10;))) + (alias core export 1 "memory" (core memory (;0;))) + (type (;4;) (func (param "arg" 3))) + (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;1;))) + (func (;1;) (type 4) (canon lift (core func 1))) + (alias export 0 "felt" (type (;5;))) + (alias export 0 "word" (type (;6;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -761,12 +715,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;6;) (instantiate 0 - (with "import-func-run" (func 6)) - (with "import-type-felt" (type 9)) - (with "import-type-word" (type 10)) - (with "import-type-word0" (type 7)) + (instance (;2;) (instantiate 0 + (with "import-func-run" (func 1)) + (with "import-type-felt" (type 5)) + (with "import-type-word" (type 6)) + (with "import-type-word0" (type 3)) ) ) - (export (;7;) "miden:base/note-script@1.0.0" (instance 6)) + (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) ) diff --git a/tests/integration/expected/examples/storage_example.hir b/tests/integration/expected/examples/storage_example.hir index 72fe075a6..ac34666c4 100644 --- a/tests/integration/expected/examples/storage_example.hir +++ b/tests/integration/expected/examples/storage_example.hir @@ -1,339 +1,256 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.module public @storage_example { - private builtin.function @miden_base_sys::bindings::storage::extern_get_storage_item(v0: felt, v1: i32) { - ^block3(v0: felt, v1: i32): - v2, v3, v4, v5 = hir.exec @miden/account/get_item(v0) : felt, felt, felt, felt - v6 = hir.bitcast v1 : u32; - v7 = hir.int_to_ptr v6 : ptr; - hir.store v7, v2; - v8 = arith.constant 4 : u32; - v9 = arith.add v6, v8 : u32 #[overflow = checked]; - v10 = hir.int_to_ptr v9 : ptr; - hir.store v10, v3; - v11 = arith.constant 8 : u32; - v12 = arith.add v6, v11 : u32 #[overflow = checked]; - v13 = hir.int_to_ptr v12 : ptr; - hir.store v13, v4; - v14 = arith.constant 12 : u32; - v15 = arith.add v6, v14 : u32 #[overflow = checked]; - v16 = hir.int_to_ptr v15 : ptr; - hir.store v16, v5; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::storage::extern_set_storage_map_item(v17: felt, v18: felt, v19: felt, v20: felt, v21: felt, v22: felt, v23: felt, v24: felt, v25: felt, v26: i32) { - ^block7(v17: felt, v18: felt, v19: felt, v20: felt, v21: felt, v22: felt, v23: felt, v24: felt, v25: felt, v26: i32): - v27, v28, v29, v30, v31, v32, v33, v34 = hir.exec @miden/account/set_map_item(v17, v18, v19, v20, v21, v22, v23, v24, v25) : felt, felt, felt, felt, felt, felt, felt, felt - v35 = hir.bitcast v26 : u32; - v36 = hir.int_to_ptr v35 : ptr; - hir.store v36, v27; - v37 = arith.constant 4 : u32; - v38 = arith.add v35, v37 : u32 #[overflow = checked]; - v39 = hir.int_to_ptr v38 : ptr; - hir.store v39, v28; - v40 = arith.constant 8 : u32; - v41 = arith.add v35, v40 : u32 #[overflow = checked]; - v42 = hir.int_to_ptr v41 : ptr; - hir.store v42, v29; - v43 = arith.constant 12 : u32; - v44 = arith.add v35, v43 : u32 #[overflow = checked]; - v45 = hir.int_to_ptr v44 : ptr; - hir.store v45, v30; - v46 = arith.constant 16 : u32; - v47 = arith.add v35, v46 : u32 #[overflow = checked]; - v48 = hir.int_to_ptr v47 : ptr; - hir.store v48, v31; - v49 = arith.constant 20 : u32; - v50 = arith.add v35, v49 : u32 #[overflow = checked]; - v51 = hir.int_to_ptr v50 : ptr; - hir.store v51, v32; - v52 = arith.constant 24 : u32; - v53 = arith.add v35, v52 : u32 #[overflow = checked]; - v54 = hir.int_to_ptr v53 : ptr; - hir.store v54, v33; - v55 = arith.constant 28 : u32; - v56 = arith.add v35, v55 : u32 #[overflow = checked]; - v57 = hir.int_to_ptr v56 : ptr; - hir.store v57, v34; - builtin.ret ; - }; - - private builtin.function @miden_base_sys::bindings::storage::extern_get_storage_map_item(v58: felt, v59: felt, v60: felt, v61: felt, v62: felt, v63: i32) { - ^block9(v58: felt, v59: felt, v60: felt, v61: felt, v62: felt, v63: i32): - v64, v65, v66, v67 = hir.exec @miden/account/get_map_item(v58, v59, v60, v61, v62) : felt, felt, felt, felt - v68 = hir.bitcast v63 : u32; - v69 = hir.int_to_ptr v68 : ptr; - hir.store v69, v64; - v70 = arith.constant 4 : u32; - v71 = arith.add v68, v70 : u32 #[overflow = checked]; - v72 = hir.int_to_ptr v71 : ptr; - hir.store v72, v65; - v73 = arith.constant 8 : u32; - v74 = arith.add v68, v73 : u32 #[overflow = checked]; - v75 = hir.int_to_ptr v74 : ptr; - hir.store v75, v66; - v76 = arith.constant 12 : u32; - v77 = arith.add v68, v76 : u32 #[overflow = checked]; - v78 = hir.int_to_ptr v77 : ptr; - hir.store v78, v67; - builtin.ret ; - }; - private builtin.function @__wasm_call_ctors() { - ^block13: + ^block5: builtin.ret ; }; private builtin.function @storage_example::bindings::__link_custom_section_describing_imports() { - ^block15: + ^block7: builtin.ret ; }; - public builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v79: felt, v80: felt, v81: felt, v82: felt, v83: felt, v84: felt, v85: felt, v86: felt, v87: felt) { - ^block17(v79: felt, v80: felt, v81: felt, v82: felt, v83: felt, v84: felt, v85: felt, v86: felt, v87: felt): - v90 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v91 = hir.bitcast v90 : ptr; - v92 = hir.load v91 : i32; - v93 = arith.constant 112 : i32; - v94 = arith.sub v92, v93 : i32 #[overflow = wrapping]; - v95 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v96 = hir.bitcast v95 : ptr; - hir.store v96, v94; + public builtin.function @miden:storage-example/foo@1.0.0#set-asset-qty(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt) { + ^block9(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt, v8: felt): + v11 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v12 = hir.bitcast v11 : ptr; + v13 = hir.load v12 : i32; + v14 = arith.constant 112 : i32; + v15 = arith.sub v13, v14 : i32 #[overflow = wrapping]; + v16 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v17 = hir.bitcast v16 : ptr; + hir.store v17, v15; hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen_rt::run_ctors_once() - v88 = arith.constant 0 : i32; - v98 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v88) : felt - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_base_sys::bindings::storage::extern_get_storage_item(v98, v94) - v100 = arith.constant 8 : u32; - v99 = hir.bitcast v94 : u32; - v101 = arith.add v99, v100 : u32 #[overflow = checked]; - v543 = arith.constant 8 : u32; - v103 = arith.mod v101, v543 : u32; - hir.assertz v103 #[code = 250]; - v104 = hir.int_to_ptr v101 : ptr; - v105 = hir.load v104 : i64; - v107 = arith.constant 56 : u32; - v106 = hir.bitcast v94 : u32; - v108 = arith.add v106, v107 : u32 #[overflow = checked]; - v542 = arith.constant 8 : u32; - v110 = arith.mod v108, v542 : u32; - hir.assertz v110 #[code = 250]; - v111 = hir.int_to_ptr v108 : ptr; - hir.store v111, v105; - v112 = hir.bitcast v94 : u32; - v541 = arith.constant 8 : u32; - v114 = arith.mod v112, v541 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : i64; - v118 = arith.constant 48 : u32; - v117 = hir.bitcast v94 : u32; - v119 = arith.add v117, v118 : u32 #[overflow = checked]; - v540 = arith.constant 8 : u32; - v121 = arith.mod v119, v540 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - hir.store v122, v116; - v125 = arith.constant 48 : i32; - v126 = arith.add v94, v125 : i32 #[overflow = wrapping]; - v123 = arith.constant 96 : i32; - v124 = arith.add v94, v123 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v124, v126) - v128 = arith.constant 100 : u32; - v127 = hir.bitcast v94 : u32; - v129 = arith.add v127, v128 : u32 #[overflow = checked]; - 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 : felt; - v135 = arith.constant 104 : u32; - v134 = hir.bitcast v94 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v539 = arith.constant 4 : u32; - v138 = arith.mod v136, v539 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : felt; - v142 = arith.constant 108 : u32; - v141 = hir.bitcast v94 : u32; - v143 = arith.add v141, v142 : u32 #[overflow = checked]; - v538 = arith.constant 4 : u32; - v145 = arith.mod v143, v538 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : felt; - v149 = arith.constant 96 : u32; - v148 = hir.bitcast v94 : u32; - v150 = arith.add v148, v149 : u32 #[overflow = checked]; - v537 = arith.constant 4 : u32; - v152 = arith.mod v150, v537 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - v154 = hir.load v153 : felt; - v536 = arith.constant 0 : i32; - v157 = arith.constant 1 : i32; - v155 = arith.eq v79, v154 : i1; - v156 = hir.cast v155 : i32; - v158 = arith.neq v156, v157 : i1; - v159 = arith.zext v158 : u32; - v160 = hir.bitcast v159 : i32; - v162 = arith.neq v160, v536 : i1; - scf.if v162{ - ^block47: + v9 = arith.constant 0 : i32; + v19 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v9) : felt + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::account::get_item(v19, v15) + v21 = arith.constant 8 : u32; + v20 = hir.bitcast v15 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v547 = arith.constant 8 : u32; + v24 = arith.mod v22, v547 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + v26 = hir.load v25 : i64; + v28 = arith.constant 56 : u32; + v27 = hir.bitcast v15 : u32; + v29 = arith.add v27, v28 : u32 #[overflow = checked]; + v546 = arith.constant 8 : u32; + v31 = arith.mod v29, v546 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v26; + v33 = hir.bitcast v15 : u32; + v545 = arith.constant 8 : u32; + v35 = arith.mod v33, v545 : u32; + hir.assertz v35 #[code = 250]; + v36 = hir.int_to_ptr v33 : ptr; + v37 = hir.load v36 : i64; + v39 = arith.constant 48 : u32; + v38 = hir.bitcast v15 : u32; + v40 = arith.add v38, v39 : u32 #[overflow = checked]; + v544 = arith.constant 8 : u32; + v42 = arith.mod v40, v544 : u32; + hir.assertz v42 #[code = 250]; + v43 = hir.int_to_ptr v40 : ptr; + hir.store v43, v37; + v46 = arith.constant 48 : i32; + v47 = arith.add v15, v46 : i32 #[overflow = wrapping]; + v44 = arith.constant 96 : i32; + v45 = arith.add v15, v44 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v45, v47) + v49 = arith.constant 100 : u32; + v48 = hir.bitcast v15 : u32; + v50 = arith.add v48, v49 : u32 #[overflow = checked]; + v51 = arith.constant 4 : u32; + v52 = arith.mod v50, v51 : u32; + hir.assertz v52 #[code = 250]; + v53 = hir.int_to_ptr v50 : ptr; + v54 = hir.load v53 : felt; + v56 = arith.constant 104 : u32; + v55 = hir.bitcast v15 : u32; + v57 = arith.add v55, v56 : u32 #[overflow = checked]; + v543 = arith.constant 4 : u32; + v59 = arith.mod v57, v543 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : felt; + v63 = arith.constant 108 : u32; + v62 = hir.bitcast v15 : u32; + v64 = arith.add v62, v63 : u32 #[overflow = checked]; + v542 = arith.constant 4 : u32; + v66 = arith.mod v64, v542 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : felt; + v70 = arith.constant 96 : u32; + v69 = hir.bitcast v15 : u32; + v71 = arith.add v69, v70 : u32 #[overflow = checked]; + v541 = arith.constant 4 : u32; + v73 = arith.mod v71, v541 : u32; + hir.assertz v73 #[code = 250]; + v74 = hir.int_to_ptr v71 : ptr; + v75 = hir.load v74 : felt; + v76 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v0, v75) : i32 + v540 = arith.constant 0 : i32; + v77 = arith.constant 1 : i32; + v78 = arith.neq v76, v77 : i1; + v79 = arith.zext v78 : u32; + v80 = hir.bitcast v79 : i32; + v82 = arith.neq v80, v540 : i1; + scf.if v82{ + ^block51: scf.yield ; } else { - ^block20: - v534 = arith.constant 0 : i32; - v535 = arith.constant 1 : i32; - v163 = arith.eq v80, v133 : i1; - v164 = hir.cast v163 : i32; - v166 = arith.neq v164, v535 : i1; - v167 = arith.zext v166 : u32; - v168 = hir.bitcast v167 : i32; - v170 = arith.neq v168, v534 : i1; - scf.if v170{ - ^block46: + ^block12: + v83 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v1, v54) : i32 + v538 = arith.constant 0 : i32; + v539 = arith.constant 1 : i32; + v85 = arith.neq v83, v539 : i1; + v86 = arith.zext v85 : u32; + v87 = hir.bitcast v86 : i32; + v89 = arith.neq v87, v538 : i1; + scf.if v89{ + ^block50: scf.yield ; } else { - ^block21: - v532 = arith.constant 0 : i32; - v533 = arith.constant 1 : i32; - v171 = arith.eq v81, v140 : i1; - v172 = hir.cast v171 : i32; - v174 = arith.neq v172, v533 : i1; - v175 = arith.zext v174 : u32; - v176 = hir.bitcast v175 : i32; - v178 = arith.neq v176, v532 : i1; - scf.if v178{ - ^block45: + ^block13: + v90 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v2, v61) : i32 + v536 = arith.constant 0 : i32; + v537 = arith.constant 1 : i32; + v92 = arith.neq v90, v537 : i1; + v93 = arith.zext v92 : u32; + v94 = hir.bitcast v93 : i32; + v96 = arith.neq v94, v536 : i1; + scf.if v96{ + ^block49: scf.yield ; } else { - ^block22: - v530 = arith.constant 0 : i32; - v531 = arith.constant 1 : i32; - v179 = arith.eq v82, v147 : i1; - v180 = hir.cast v179 : i32; - v182 = arith.neq v180, v531 : i1; - v183 = arith.zext v182 : u32; - v184 = hir.bitcast v183 : i32; - v186 = arith.neq v184, v530 : i1; - scf.if v186{ - ^block44: + ^block14: + v97 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::eq(v3, v68) : i32 + v534 = arith.constant 0 : i32; + v535 = arith.constant 1 : i32; + v99 = arith.neq v97, v535 : i1; + v100 = arith.zext v99 : u32; + v101 = hir.bitcast v100 : i32; + v103 = arith.neq v101, v534 : i1; + scf.if v103{ + ^block48: scf.yield ; } else { - ^block23: - v187 = arith.constant 32 : i32; - v188 = arith.add v94, v187 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v188, v87) - v529 = arith.constant 1 : i32; - v190 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v529) : felt - v192 = arith.constant 44 : u32; - v191 = hir.bitcast v94 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; - v528 = arith.constant 4 : u32; - v195 = arith.mod v193, v528 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - v197 = hir.load v196 : felt; - v199 = arith.constant 40 : u32; - v198 = hir.bitcast v94 : u32; - v200 = arith.add v198, v199 : u32 #[overflow = checked]; - v527 = arith.constant 4 : u32; - v202 = arith.mod v200, v527 : u32; - hir.assertz v202 #[code = 250]; - v203 = hir.int_to_ptr v200 : ptr; - v204 = hir.load v203 : felt; - v206 = arith.constant 36 : u32; - v205 = hir.bitcast v94 : u32; - v207 = arith.add v205, v206 : u32 #[overflow = checked]; - v526 = arith.constant 4 : u32; - v209 = arith.mod v207, v526 : u32; - hir.assertz v209 #[code = 250]; - v210 = hir.int_to_ptr v207 : ptr; - v211 = hir.load v210 : felt; - v213 = arith.constant 32 : u32; - v212 = hir.bitcast v94 : u32; - v214 = arith.add v212, v213 : u32 #[overflow = checked]; - v525 = arith.constant 4 : u32; - v216 = arith.mod v214, v525 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - v218 = hir.load v217 : felt; - v524 = arith.constant 48 : i32; - v220 = arith.add v94, v524 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_base_sys::bindings::storage::extern_set_storage_map_item(v190, v86, v85, v84, v83, v197, v204, v211, v218, v220) - v523 = arith.constant 56 : u32; - v221 = hir.bitcast v94 : u32; - v223 = arith.add v221, v523 : u32 #[overflow = checked]; + ^block15: + v104 = arith.constant 32 : i32; + v105 = arith.add v15, v104 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v105, v8) + v533 = arith.constant 1 : i32; + v107 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v533) : felt + v109 = arith.constant 44 : u32; + v108 = hir.bitcast v15 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v532 = arith.constant 4 : u32; + v112 = arith.mod v110, v532 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v116 = arith.constant 40 : u32; + v115 = hir.bitcast v15 : u32; + v117 = arith.add v115, v116 : u32 #[overflow = checked]; + v531 = arith.constant 4 : u32; + v119 = arith.mod v117, v531 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v123 = arith.constant 36 : u32; + v122 = hir.bitcast v15 : u32; + v124 = arith.add v122, v123 : u32 #[overflow = checked]; + v530 = arith.constant 4 : u32; + v126 = arith.mod v124, v530 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + v128 = hir.load v127 : felt; + v130 = arith.constant 32 : u32; + v129 = hir.bitcast v15 : u32; + v131 = arith.add v129, v130 : u32 #[overflow = checked]; + v529 = arith.constant 4 : u32; + v133 = arith.mod v131, v529 : u32; + hir.assertz v133 #[code = 250]; + v134 = hir.int_to_ptr v131 : ptr; + v135 = hir.load v134 : felt; + v528 = arith.constant 48 : i32; + v137 = arith.add v15, v528 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::account::set_map_item(v107, v7, v6, v5, v4, v114, v121, v128, v135, v137) + v527 = arith.constant 56 : u32; + v138 = hir.bitcast v15 : u32; + v140 = arith.add v138, v527 : u32 #[overflow = checked]; + v526 = arith.constant 8 : u32; + v142 = arith.mod v140, v526 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + v144 = hir.load v143 : i64; + v146 = arith.constant 88 : u32; + v145 = hir.bitcast v15 : u32; + v147 = arith.add v145, v146 : u32 #[overflow = checked]; + v525 = arith.constant 8 : u32; + v149 = arith.mod v147, v525 : u32; + hir.assertz v149 #[code = 250]; + v150 = hir.int_to_ptr v147 : ptr; + hir.store v150, v144; + v524 = arith.constant 48 : u32; + v151 = hir.bitcast v15 : u32; + v153 = arith.add v151, v524 : u32 #[overflow = checked]; + v523 = arith.constant 8 : u32; + v155 = arith.mod v153, v523 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : i64; + v159 = arith.constant 80 : u32; + v158 = hir.bitcast v15 : u32; + v160 = arith.add v158, v159 : u32 #[overflow = checked]; v522 = arith.constant 8 : u32; - v225 = arith.mod v223, v522 : u32; - hir.assertz v225 #[code = 250]; - v226 = hir.int_to_ptr v223 : ptr; - v227 = hir.load v226 : i64; - v229 = arith.constant 88 : u32; - v228 = hir.bitcast v94 : u32; - v230 = arith.add v228, v229 : u32 #[overflow = checked]; + v162 = arith.mod v160, v522 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + hir.store v163, v157; + v164 = arith.constant 72 : i32; + v165 = arith.add v15, v164 : i32 #[overflow = wrapping]; + v166 = hir.bitcast v165 : u32; v521 = arith.constant 8 : u32; - v232 = arith.mod v230, v521 : u32; - hir.assertz v232 #[code = 250]; - v233 = hir.int_to_ptr v230 : ptr; - hir.store v233, v227; - v520 = arith.constant 48 : u32; - v234 = hir.bitcast v94 : u32; - v236 = arith.add v234, v520 : u32 #[overflow = checked]; + v168 = arith.mod v166, v521 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + v170 = hir.load v169 : i64; + v520 = arith.constant 104 : u32; + v171 = hir.bitcast v15 : u32; + v173 = arith.add v171, v520 : u32 #[overflow = checked]; v519 = arith.constant 8 : u32; - v238 = arith.mod v236, v519 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - v240 = hir.load v239 : i64; - v242 = arith.constant 80 : u32; - v241 = hir.bitcast v94 : u32; - v243 = arith.add v241, v242 : u32 #[overflow = checked]; + v175 = arith.mod v173, v519 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + hir.store v176, v170; + v178 = arith.constant 64 : u32; + v177 = hir.bitcast v15 : u32; + v179 = arith.add v177, v178 : u32 #[overflow = checked]; v518 = arith.constant 8 : u32; - v245 = arith.mod v243, v518 : u32; - hir.assertz v245 #[code = 250]; - v246 = hir.int_to_ptr v243 : ptr; - hir.store v246, v240; - v247 = arith.constant 72 : i32; - v248 = arith.add v94, v247 : i32 #[overflow = wrapping]; - v249 = hir.bitcast v248 : u32; - v517 = arith.constant 8 : u32; - v251 = arith.mod v249, v517 : u32; - hir.assertz v251 #[code = 250]; - v252 = hir.int_to_ptr v249 : ptr; - v253 = hir.load v252 : i64; - v516 = arith.constant 104 : u32; - v254 = hir.bitcast v94 : u32; - v256 = arith.add v254, v516 : u32 #[overflow = checked]; - v515 = arith.constant 8 : u32; - v258 = arith.mod v256, v515 : u32; - hir.assertz v258 #[code = 250]; - v259 = hir.int_to_ptr v256 : ptr; - hir.store v259, v253; - v261 = arith.constant 64 : u32; - v260 = hir.bitcast v94 : u32; - v262 = arith.add v260, v261 : u32 #[overflow = checked]; - v514 = arith.constant 8 : u32; - v264 = arith.mod v262, v514 : u32; - hir.assertz v264 #[code = 250]; - v265 = hir.int_to_ptr v262 : ptr; - v266 = hir.load v265 : i64; - v513 = arith.constant 96 : u32; - v267 = hir.bitcast v94 : u32; - v269 = arith.add v267, v513 : u32 #[overflow = checked]; - v512 = arith.constant 8 : u32; - v271 = arith.mod v269, v512 : u32; - hir.assertz v271 #[code = 250]; - v272 = hir.int_to_ptr v269 : ptr; - hir.store v272, v266; - v273 = arith.constant 80 : i32; - v274 = arith.add v94, v273 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v94, v274) - v511 = arith.constant 96 : i32; - v278 = arith.add v94, v511 : i32 #[overflow = wrapping]; - v275 = arith.constant 16 : i32; - v276 = arith.add v94, v275 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v276, v278) + v181 = arith.mod v179, v518 : u32; + hir.assertz v181 #[code = 250]; + v182 = hir.int_to_ptr v179 : ptr; + v183 = hir.load v182 : i64; + v517 = arith.constant 96 : u32; + v184 = hir.bitcast v15 : u32; + v186 = arith.add v184, v517 : u32 #[overflow = checked]; + v516 = arith.constant 8 : u32; + v188 = arith.mod v186, v516 : u32; + hir.assertz v188 #[code = 250]; + v189 = hir.int_to_ptr v186 : ptr; + hir.store v189, v183; + v190 = arith.constant 80 : i32; + v191 = arith.add v15, v190 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v15, v191) + v515 = arith.constant 96 : i32; + v195 = arith.add v15, v515 : i32 #[overflow = wrapping]; + v192 = arith.constant 16 : i32; + v193 = arith.add v15, v192 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v193, v195) scf.yield ; }; scf.yield ; @@ -342,288 +259,383 @@ builtin.component miden:storage-example/foo@1.0.0 { }; scf.yield ; }; - v510 = arith.constant 112 : i32; - v281 = arith.add v94, v510 : i32 #[overflow = wrapping]; - v282 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v283 = hir.bitcast v282 : ptr; - hir.store v283, v281; + v514 = arith.constant 112 : i32; + v198 = arith.add v15, v514 : i32 #[overflow = wrapping]; + v199 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v200 = hir.bitcast v199 : ptr; + hir.store v200, v198; builtin.ret ; }; - public builtin.function @miden:storage-example/foo@1.0.0#get-asset-qty(v284: felt, v285: felt, v286: felt, v287: felt) -> felt { - ^block24(v284: felt, v285: felt, v286: felt, v287: felt): - v290 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v291 = hir.bitcast v290 : ptr; - v292 = hir.load v291 : i32; - v293 = arith.constant 48 : i32; - v294 = arith.sub v292, v293 : i32 #[overflow = wrapping]; - v295 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v296 = hir.bitcast v295 : ptr; - hir.store v296, v294; + public builtin.function @miden:storage-example/foo@1.0.0#get-asset-qty(v201: felt, v202: felt, v203: felt, v204: felt) -> felt { + ^block16(v201: felt, v202: felt, v203: felt, v204: felt): + v207 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v208 = hir.bitcast v207 : ptr; + v209 = hir.load v208 : i32; + v210 = arith.constant 48 : i32; + v211 = arith.sub v209, v210 : i32 #[overflow = wrapping]; + v212 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v213 = hir.bitcast v212 : ptr; + hir.store v213, v211; hir.exec @miden:storage-example/foo@1.0.0/storage_example/wit_bindgen_rt::run_ctors_once() - v297 = arith.constant 1 : i32; - v298 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v297) : felt - v299 = arith.constant 16 : i32; - v300 = arith.add v294, v299 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_base_sys::bindings::storage::extern_get_storage_map_item(v298, v287, v286, v285, v284, v300) - v302 = arith.constant 24 : u32; - v301 = hir.bitcast v294 : u32; - v303 = arith.add v301, v302 : u32 #[overflow = checked]; - v304 = arith.constant 8 : u32; - v305 = arith.mod v303, v304 : u32; - hir.assertz v305 #[code = 250]; - v306 = hir.int_to_ptr v303 : ptr; - v307 = hir.load v306 : i64; - v309 = arith.constant 40 : u32; - v308 = hir.bitcast v294 : u32; - v310 = arith.add v308, v309 : u32 #[overflow = checked]; - v547 = arith.constant 8 : u32; - v312 = arith.mod v310, v547 : u32; - hir.assertz v312 #[code = 250]; - v313 = hir.int_to_ptr v310 : ptr; - hir.store v313, v307; - v315 = arith.constant 16 : u32; - v314 = hir.bitcast v294 : u32; - v316 = arith.add v314, v315 : u32 #[overflow = checked]; - v546 = arith.constant 8 : u32; - v318 = arith.mod v316, v546 : u32; - hir.assertz v318 #[code = 250]; - v319 = hir.int_to_ptr v316 : ptr; - v320 = hir.load v319 : i64; - v322 = arith.constant 32 : u32; - v321 = hir.bitcast v294 : u32; - v323 = arith.add v321, v322 : u32 #[overflow = checked]; - v545 = arith.constant 8 : u32; - v325 = arith.mod v323, v545 : u32; - hir.assertz v325 #[code = 250]; - v326 = hir.int_to_ptr v323 : ptr; - hir.store v326, v320; - v327 = arith.constant 32 : i32; - v328 = arith.add v294, v327 : i32 #[overflow = wrapping]; - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v294, v328) - v330 = arith.constant 12 : u32; - v329 = hir.bitcast v294 : u32; - v331 = arith.add v329, v330 : u32 #[overflow = checked]; - v332 = arith.constant 4 : u32; - v333 = arith.mod v331, v332 : u32; - hir.assertz v333 #[code = 250]; - v334 = hir.int_to_ptr v331 : ptr; - v335 = hir.load v334 : felt; - v544 = arith.constant 48 : i32; - v337 = arith.add v294, v544 : i32 #[overflow = wrapping]; - v338 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v339 = hir.bitcast v338 : ptr; - hir.store v339, v337; - builtin.ret v335; + v214 = arith.constant 1 : i32; + v215 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/>::from(v214) : felt + v216 = arith.constant 16 : i32; + v217 = arith.add v211, v216 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden::account::get_map_item(v215, v204, v203, v202, v201, v217) + v219 = arith.constant 24 : u32; + v218 = hir.bitcast v211 : u32; + v220 = arith.add v218, v219 : u32 #[overflow = checked]; + v221 = arith.constant 8 : u32; + v222 = arith.mod v220, v221 : u32; + hir.assertz v222 #[code = 250]; + v223 = hir.int_to_ptr v220 : ptr; + v224 = hir.load v223 : i64; + v226 = arith.constant 40 : u32; + v225 = hir.bitcast v211 : u32; + v227 = arith.add v225, v226 : u32 #[overflow = checked]; + v551 = arith.constant 8 : u32; + v229 = arith.mod v227, v551 : u32; + hir.assertz v229 #[code = 250]; + v230 = hir.int_to_ptr v227 : ptr; + hir.store v230, v224; + v232 = arith.constant 16 : u32; + v231 = hir.bitcast v211 : u32; + v233 = arith.add v231, v232 : u32 #[overflow = checked]; + v550 = arith.constant 8 : u32; + v235 = arith.mod v233, v550 : u32; + hir.assertz v235 #[code = 250]; + v236 = hir.int_to_ptr v233 : ptr; + v237 = hir.load v236 : i64; + v239 = arith.constant 32 : u32; + v238 = hir.bitcast v211 : u32; + v240 = arith.add v238, v239 : u32 #[overflow = checked]; + v549 = arith.constant 8 : u32; + v242 = arith.mod v240, v549 : u32; + hir.assertz v242 #[code = 250]; + v243 = hir.int_to_ptr v240 : ptr; + hir.store v243, v237; + v244 = arith.constant 32 : i32; + v245 = arith.add v211, v244 : i32 #[overflow = wrapping]; + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden_stdlib_sys::intrinsics::word::Word::reverse(v211, v245) + v247 = arith.constant 12 : u32; + v246 = hir.bitcast v211 : u32; + v248 = arith.add v246, v247 : u32 #[overflow = checked]; + v249 = arith.constant 4 : u32; + v250 = arith.mod v248, v249 : u32; + hir.assertz v250 #[code = 250]; + v251 = hir.int_to_ptr v248 : ptr; + v252 = hir.load v251 : felt; + v548 = arith.constant 48 : i32; + v254 = arith.add v211, v548 : i32 #[overflow = wrapping]; + v255 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v256 = hir.bitcast v255 : ptr; + hir.store v256, v254; + builtin.ret v252; }; private builtin.function @wit_bindgen_rt::run_ctors_once() { - ^block26: - v341 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr - v342 = hir.bitcast v341 : ptr; - v343 = hir.load v342 : i32; - v344 = arith.constant 1048624 : i32; - v345 = arith.add v343, v344 : i32 #[overflow = wrapping]; - v346 = hir.bitcast v345 : u32; - v347 = hir.int_to_ptr v346 : ptr; - v348 = hir.load v347 : u8; - v340 = arith.constant 0 : i32; - v349 = arith.zext v348 : u32; - v350 = hir.bitcast v349 : i32; - v352 = arith.neq v350, v340 : i1; - scf.if v352{ - ^block28: + ^block18: + v258 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v259 = hir.bitcast v258 : ptr; + v260 = hir.load v259 : i32; + v261 = arith.constant 1048584 : i32; + v262 = arith.add v260, v261 : i32 #[overflow = wrapping]; + v263 = hir.bitcast v262 : u32; + v264 = hir.int_to_ptr v263 : ptr; + v265 = hir.load v264 : u8; + v257 = arith.constant 0 : i32; + v266 = arith.zext v265 : u32; + v267 = hir.bitcast v266 : i32; + v269 = arith.neq v267, v257 : i1; + scf.if v269{ + ^block20: scf.yield ; } else { - ^block29: - v353 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr - v354 = hir.bitcast v353 : ptr; - v355 = hir.load v354 : i32; + ^block21: + v270 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/GOT.data.internal.__memory_base : ptr + v271 = hir.bitcast v270 : ptr; + v272 = hir.load v271 : i32; hir.exec @miden:storage-example/foo@1.0.0/storage_example/__wasm_call_ctors() - v549 = arith.constant 1 : u8; - v551 = arith.constant 1048624 : i32; - v357 = arith.add v355, v551 : i32 #[overflow = wrapping]; - v361 = hir.bitcast v357 : u32; - v362 = hir.int_to_ptr v361 : ptr; - hir.store v362, v549; + v553 = arith.constant 1 : u8; + v555 = arith.constant 1048584 : i32; + v274 = arith.add v272, v555 : i32 #[overflow = wrapping]; + v278 = hir.bitcast v274 : u32; + v279 = hir.int_to_ptr v278 : ptr; + hir.store v279, v553; scf.yield ; }; builtin.ret ; }; - private builtin.function @>::from(v363: i32) -> felt { - ^block30(v363: i32): - v365 = arith.constant 255 : i32; - v366 = arith.band v363, v365 : i32; - v367 = hir.bitcast v366 : felt; - builtin.ret v367; + private builtin.function @miden::account::get_item(v280: felt, v281: i32) { + ^block22(v280: felt, v281: i32): + v282, v283, v284, v285 = hir.exec @miden/account/get_item(v280) : felt, felt, felt, felt + v286 = hir.bitcast v281 : u32; + v287 = hir.int_to_ptr v286 : ptr; + hir.store v287, v282; + v288 = arith.constant 4 : u32; + v289 = arith.add v286, v288 : u32 #[overflow = checked]; + v290 = hir.int_to_ptr v289 : ptr; + hir.store v290, v283; + v291 = arith.constant 8 : u32; + v292 = arith.add v286, v291 : u32 #[overflow = checked]; + v293 = hir.int_to_ptr v292 : ptr; + hir.store v293, v284; + v294 = arith.constant 12 : u32; + v295 = arith.add v286, v294 : u32 #[overflow = checked]; + v296 = hir.int_to_ptr v295 : ptr; + hir.store v296, v285; + builtin.ret ; + }; + + private builtin.function @miden::account::get_map_item(v297: felt, v298: felt, v299: felt, v300: felt, v301: felt, v302: i32) { + ^block26(v297: felt, v298: felt, v299: felt, v300: felt, v301: felt, v302: i32): + v303, v304, v305, v306 = hir.exec @miden/account/get_map_item(v297, v298, v299, v300, v301) : felt, felt, felt, felt + v307 = hir.bitcast v302 : u32; + v308 = hir.int_to_ptr v307 : ptr; + hir.store v308, v303; + v309 = arith.constant 4 : u32; + v310 = arith.add v307, v309 : u32 #[overflow = checked]; + v311 = hir.int_to_ptr v310 : ptr; + hir.store v311, v304; + v312 = arith.constant 8 : u32; + v313 = arith.add v307, v312 : u32 #[overflow = checked]; + v314 = hir.int_to_ptr v313 : ptr; + hir.store v314, v305; + v315 = arith.constant 12 : u32; + v316 = arith.add v307, v315 : u32 #[overflow = checked]; + v317 = hir.int_to_ptr v316 : ptr; + hir.store v317, v306; + builtin.ret ; + }; + + private builtin.function @miden::account::set_map_item(v318: felt, v319: felt, v320: felt, v321: felt, v322: felt, v323: felt, v324: felt, v325: felt, v326: felt, v327: i32) { + ^block28(v318: felt, v319: felt, v320: felt, v321: felt, v322: felt, v323: felt, v324: felt, v325: felt, v326: felt, v327: i32): + v328, v329, v330, v331, v332, v333, v334, v335 = hir.exec @miden/account/set_map_item(v318, v319, v320, v321, v322, v323, v324, v325, v326) : felt, felt, felt, felt, felt, felt, felt, felt + v336 = hir.bitcast v327 : u32; + v337 = hir.int_to_ptr v336 : ptr; + hir.store v337, v328; + v338 = arith.constant 4 : u32; + v339 = arith.add v336, v338 : u32 #[overflow = checked]; + v340 = hir.int_to_ptr v339 : ptr; + hir.store v340, v329; + v341 = arith.constant 8 : u32; + v342 = arith.add v336, v341 : u32 #[overflow = checked]; + v343 = hir.int_to_ptr v342 : ptr; + hir.store v343, v330; + v344 = arith.constant 12 : u32; + v345 = arith.add v336, v344 : u32 #[overflow = checked]; + v346 = hir.int_to_ptr v345 : ptr; + hir.store v346, v331; + v347 = arith.constant 16 : u32; + v348 = arith.add v336, v347 : u32 #[overflow = checked]; + v349 = hir.int_to_ptr v348 : ptr; + hir.store v349, v332; + v350 = arith.constant 20 : u32; + v351 = arith.add v336, v350 : u32 #[overflow = checked]; + v352 = hir.int_to_ptr v351 : ptr; + hir.store v352, v333; + v353 = arith.constant 24 : u32; + v354 = arith.add v336, v353 : u32 #[overflow = checked]; + v355 = hir.int_to_ptr v354 : ptr; + hir.store v355, v334; + v356 = arith.constant 28 : u32; + v357 = arith.add v336, v356 : u32 #[overflow = checked]; + v358 = hir.int_to_ptr v357 : ptr; + hir.store v358, v335; + builtin.ret ; + }; + + private builtin.function @>::from(v359: i32) -> felt { + ^block30(v359: i32): + v361 = arith.constant 255 : i32; + v362 = arith.band v359, v361 : i32; + v363 = hir.bitcast v362 : felt; + builtin.ret v363; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v368: i32, v369: i32) { - ^block32(v368: i32, v369: i32): - v372 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr - v373 = hir.bitcast v372 : ptr; - v374 = hir.load v373 : i32; - v375 = arith.constant 16 : i32; - v376 = arith.sub v374, v375 : i32 #[overflow = wrapping]; - v378 = arith.constant 8 : u32; - v377 = hir.bitcast v369 : u32; - v379 = arith.add v377, v378 : u32 #[overflow = checked]; - v638 = arith.constant 8 : u32; - v381 = arith.mod v379, v638 : u32; - hir.assertz v381 #[code = 250]; - v382 = hir.int_to_ptr v379 : ptr; - v383 = hir.load v382 : i64; - v637 = arith.constant 8 : u32; - v384 = hir.bitcast v376 : u32; - v386 = arith.add v384, v637 : u32 #[overflow = checked]; - v387 = arith.constant 4 : u32; - v388 = arith.mod v386, v387 : u32; + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v364: i32, v365: i32) { + ^block32(v364: i32, v365: i32): + v368 = builtin.global_symbol @miden:storage-example/foo@1.0.0/storage_example/__stack_pointer : ptr + v369 = hir.bitcast v368 : ptr; + v370 = hir.load v369 : i32; + v371 = arith.constant 16 : i32; + v372 = arith.sub v370, v371 : i32 #[overflow = wrapping]; + v374 = arith.constant 8 : u32; + v373 = hir.bitcast v365 : u32; + v375 = arith.add v373, v374 : u32 #[overflow = checked]; + v642 = arith.constant 8 : u32; + v377 = arith.mod v375, v642 : u32; + hir.assertz v377 #[code = 250]; + v378 = hir.int_to_ptr v375 : ptr; + v379 = hir.load v378 : i64; + v641 = arith.constant 8 : u32; + v380 = hir.bitcast v372 : u32; + v382 = arith.add v380, v641 : u32 #[overflow = checked]; + v383 = arith.constant 4 : u32; + v384 = arith.mod v382, v383 : u32; + hir.assertz v384 #[code = 250]; + v385 = hir.int_to_ptr v382 : ptr; + hir.store v385, v379; + v386 = hir.bitcast v365 : u32; + v640 = arith.constant 8 : u32; + v388 = arith.mod v386, v640 : u32; hir.assertz v388 #[code = 250]; v389 = hir.int_to_ptr v386 : ptr; - hir.store v389, v383; - v390 = hir.bitcast v369 : u32; - v636 = arith.constant 8 : u32; - v392 = arith.mod v390, v636 : u32; - hir.assertz v392 #[code = 250]; - v393 = hir.int_to_ptr v390 : ptr; - v394 = hir.load v393 : i64; - v395 = hir.bitcast v376 : u32; - v635 = arith.constant 4 : u32; - v397 = arith.mod v395, v635 : u32; - hir.assertz v397 #[code = 250]; - v398 = hir.int_to_ptr v395 : ptr; - hir.store v398, v394; - v399 = arith.constant 12 : i32; - v400 = arith.add v376, v399 : i32 #[overflow = wrapping]; - v370 = arith.constant 0 : i32; - v606, v607, v608, v609, v610, v611 = scf.while v370, v376, v400, v368 : i32, i32, i32, i32, i32, i32 { - ^block60(v612: i32, v613: i32, v614: i32, v615: i32): - v634 = arith.constant 0 : i32; - v403 = arith.constant 8 : i32; - v404 = arith.eq v612, v403 : i1; - v405 = arith.zext v404 : u32; - v406 = hir.bitcast v405 : i32; - v408 = arith.neq v406, v634 : i1; - v600, v601 = scf.if v408 : i32, i32 { - ^block59: - v560 = ub.poison i32 : i32; - scf.yield v560, v560; + v390 = hir.load v389 : i64; + v391 = hir.bitcast v372 : u32; + v639 = arith.constant 4 : u32; + v393 = arith.mod v391, v639 : u32; + hir.assertz v393 #[code = 250]; + v394 = hir.int_to_ptr v391 : ptr; + hir.store v394, v390; + v395 = arith.constant 12 : i32; + v396 = arith.add v372, v395 : i32 #[overflow = wrapping]; + v366 = arith.constant 0 : i32; + v610, v611, v612, v613, v614, v615 = scf.while v366, v372, v396, v364 : i32, i32, i32, i32, i32, i32 { + ^block64(v616: i32, v617: i32, v618: i32, v619: i32): + v638 = arith.constant 0 : i32; + v399 = arith.constant 8 : i32; + v400 = arith.eq v616, v399 : i1; + v401 = arith.zext v400 : u32; + v402 = hir.bitcast v401 : i32; + v404 = arith.neq v402, v638 : i1; + v604, v605 = scf.if v404 : i32, i32 { + ^block63: + v564 = ub.poison i32 : i32; + scf.yield v564, v564; } else { ^block37: - v410 = arith.add v613, v612 : i32 #[overflow = wrapping]; - v411 = hir.bitcast v410 : u32; - v633 = arith.constant 4 : u32; - v413 = arith.mod v411, v633 : u32; - hir.assertz v413 #[code = 250]; - v414 = hir.int_to_ptr v411 : ptr; - v415 = hir.load v414 : felt; - v417 = hir.bitcast v614 : u32; - v632 = arith.constant 4 : u32; - v419 = arith.mod v417, v632 : u32; - hir.assertz v419 #[code = 250]; - v420 = hir.int_to_ptr v417 : ptr; - v421 = hir.load v420 : i32; - v422 = hir.bitcast v410 : u32; - v631 = arith.constant 4 : u32; - v424 = arith.mod v422, v631 : u32; + v406 = arith.add v617, v616 : i32 #[overflow = wrapping]; + v407 = hir.bitcast v406 : u32; + v637 = arith.constant 4 : u32; + v409 = arith.mod v407, v637 : u32; + hir.assertz v409 #[code = 250]; + v410 = hir.int_to_ptr v407 : ptr; + v411 = hir.load v410 : felt; + v413 = hir.bitcast v618 : u32; + v636 = arith.constant 4 : u32; + v415 = arith.mod v413, v636 : u32; + hir.assertz v415 #[code = 250]; + v416 = hir.int_to_ptr v413 : ptr; + v417 = hir.load v416 : i32; + v418 = hir.bitcast v406 : u32; + v635 = arith.constant 4 : u32; + v420 = arith.mod v418, v635 : u32; + hir.assertz v420 #[code = 250]; + v421 = hir.int_to_ptr v418 : ptr; + hir.store v421, v417; + v422 = hir.bitcast v618 : u32; + v634 = arith.constant 4 : u32; + v424 = arith.mod v422, v634 : u32; hir.assertz v424 #[code = 250]; - v425 = hir.int_to_ptr v422 : ptr; - hir.store v425, v421; - v426 = hir.bitcast v614 : u32; - v630 = arith.constant 4 : u32; - v428 = arith.mod v426, v630 : u32; - hir.assertz v428 #[code = 250]; - v429 = hir.int_to_ptr v426 : ptr; - hir.store v429, v415; - v432 = arith.constant -4 : i32; - v433 = arith.add v614, v432 : i32 #[overflow = wrapping]; - v430 = arith.constant 4 : i32; - v431 = arith.add v612, v430 : i32 #[overflow = wrapping]; - scf.yield v431, v433; + v425 = hir.int_to_ptr v422 : ptr; + hir.store v425, v411; + v428 = arith.constant -4 : i32; + v429 = arith.add v618, v428 : i32 #[overflow = wrapping]; + v426 = arith.constant 4 : i32; + v427 = arith.add v616, v426 : i32 #[overflow = wrapping]; + scf.yield v427, v429; }; - v628 = ub.poison i32 : i32; - v603 = cf.select v408, v628, v615 : i32; - v629 = ub.poison i32 : i32; - v602 = cf.select v408, v629, v613 : i32; - v559 = arith.constant 1 : u32; - v552 = arith.constant 0 : u32; - v605 = cf.select v408, v552, v559 : u32; - v593 = arith.trunc v605 : i1; - scf.condition v593, v600, v602, v601, v603, v613, v615; + v632 = ub.poison i32 : i32; + v607 = cf.select v404, v632, v619 : i32; + v633 = ub.poison i32 : i32; + v606 = cf.select v404, v633, v617 : i32; + v563 = arith.constant 1 : u32; + v556 = arith.constant 0 : u32; + v609 = cf.select v404, v556, v563 : u32; + v597 = arith.trunc v609 : i1; + scf.condition v597, v604, v606, v605, v607, v617, v619; } do { - ^block61(v616: i32, v617: i32, v618: i32, v619: i32, v620: i32, v621: i32): - scf.yield v616, v617, v618, v619; + ^block65(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32, v625: i32): + scf.yield v620, v621, v622, v623; }; - v627 = arith.constant 8 : u32; - v435 = hir.bitcast v610 : u32; - v437 = arith.add v435, v627 : u32 #[overflow = checked]; - v626 = arith.constant 4 : u32; - v439 = arith.mod v437, v626 : u32; - hir.assertz v439 #[code = 250]; - v440 = hir.int_to_ptr v437 : ptr; - v441 = hir.load v440 : i64; - v625 = arith.constant 8 : u32; - v442 = hir.bitcast v611 : u32; - v444 = arith.add v442, v625 : u32 #[overflow = checked]; - v624 = arith.constant 8 : u32; - v446 = arith.mod v444, v624 : u32; + v631 = arith.constant 8 : u32; + v431 = hir.bitcast v614 : u32; + v433 = arith.add v431, v631 : u32 #[overflow = checked]; + v630 = arith.constant 4 : u32; + v435 = arith.mod v433, v630 : u32; + hir.assertz v435 #[code = 250]; + v436 = hir.int_to_ptr v433 : ptr; + v437 = hir.load v436 : i64; + v629 = arith.constant 8 : u32; + v438 = hir.bitcast v615 : u32; + v440 = arith.add v438, v629 : u32 #[overflow = checked]; + v628 = arith.constant 8 : u32; + v442 = arith.mod v440, v628 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + hir.store v443, v437; + v444 = hir.bitcast v614 : u32; + v627 = arith.constant 4 : u32; + v446 = arith.mod v444, v627 : u32; hir.assertz v446 #[code = 250]; v447 = hir.int_to_ptr v444 : ptr; - hir.store v447, v441; - v448 = hir.bitcast v610 : u32; - v623 = arith.constant 4 : u32; - v450 = arith.mod v448, v623 : u32; - hir.assertz v450 #[code = 250]; - v451 = hir.int_to_ptr v448 : ptr; - v452 = hir.load v451 : i64; - v453 = hir.bitcast v611 : u32; - v622 = arith.constant 8 : u32; - v455 = arith.mod v453, v622 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - hir.store v456, v452; + v448 = hir.load v447 : i64; + v449 = hir.bitcast v615 : u32; + v626 = arith.constant 8 : u32; + v451 = arith.mod v449, v626 : u32; + hir.assertz v451 #[code = 250]; + v452 = hir.int_to_ptr v449 : ptr; + hir.store v452, v448; builtin.ret ; }; - private builtin.function @>::from(v457: i32, v458: felt) { - ^block38(v457: i32, v458: felt): - v467 = arith.constant 12 : u32; - v466 = hir.bitcast v457 : u32; - v468 = arith.add v466, v467 : u32 #[overflow = checked]; - v469 = arith.constant 4 : u32; - v470 = arith.mod v468, v469 : u32; - hir.assertz v470 #[code = 250]; - v471 = hir.int_to_ptr v468 : ptr; - hir.store v471, v458; - v473 = arith.constant 8 : u32; - v472 = hir.bitcast v457 : u32; - v474 = arith.add v472, v473 : u32 #[overflow = checked]; - v647 = arith.constant 4 : u32; - v476 = arith.mod v474, v647 : u32; - hir.assertz v476 #[code = 250]; - v641 = arith.constant 0 : felt; - v477 = hir.int_to_ptr v474 : ptr; - hir.store v477, v641; + private builtin.function @>::from(v453: i32, v454: felt) { + ^block38(v453: i32, v454: felt): + v456 = arith.constant 0 : i32; + v457 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v456) : felt + v648 = arith.constant 0 : i32; + v459 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v648) : felt + v647 = arith.constant 0 : i32; + v461 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/intrinsics::felt::from_u32(v647) : felt + v463 = arith.constant 12 : u32; + v462 = hir.bitcast v453 : u32; + v464 = arith.add v462, v463 : u32 #[overflow = checked]; + v465 = arith.constant 4 : u32; + v466 = arith.mod v464, v465 : u32; + hir.assertz v466 #[code = 250]; + v467 = hir.int_to_ptr v464 : ptr; + hir.store v467, v454; + v469 = arith.constant 8 : u32; + v468 = hir.bitcast v453 : u32; + v470 = arith.add v468, v469 : u32 #[overflow = checked]; v646 = arith.constant 4 : u32; - v478 = hir.bitcast v457 : u32; - v480 = arith.add v478, v646 : u32 #[overflow = checked]; + v472 = arith.mod v470, v646 : u32; + hir.assertz v472 #[code = 250]; + v473 = hir.int_to_ptr v470 : ptr; + hir.store v473, v461; v645 = arith.constant 4 : u32; - v482 = arith.mod v480, v645 : u32; + v474 = hir.bitcast v453 : u32; + v476 = arith.add v474, v645 : u32 #[overflow = checked]; + v644 = arith.constant 4 : u32; + v478 = arith.mod v476, v644 : u32; + hir.assertz v478 #[code = 250]; + v479 = hir.int_to_ptr v476 : ptr; + hir.store v479, v459; + v480 = hir.bitcast v453 : u32; + v643 = arith.constant 4 : u32; + v482 = arith.mod v480, v643 : u32; hir.assertz v482 #[code = 250]; - v644 = arith.constant 0 : felt; v483 = hir.int_to_ptr v480 : ptr; - hir.store v483, v644; - v484 = hir.bitcast v457 : u32; - v643 = arith.constant 4 : u32; - v486 = arith.mod v484, v643 : u32; - hir.assertz v486 #[code = 250]; - v642 = arith.constant 0 : felt; - v487 = hir.int_to_ptr v484 : ptr; - hir.store v487, v642; + hir.store v483, v457; builtin.ret ; }; + private builtin.function @intrinsics::felt::from_u32(v484: i32) -> felt { + ^block40(v484: i32): + v485 = hir.bitcast v484 : felt; + builtin.ret v485; + }; + + private builtin.function @intrinsics::felt::eq(v487: felt, v488: felt) -> i32 { + ^block42(v487: felt, v488: felt): + v489 = arith.eq v487, v488 : i1; + v490 = hir.cast v489 : i32; + builtin.ret v490; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -632,18 +644,18 @@ builtin.component miden:storage-example/foo@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000000000000100000001; }; - public builtin.function @set-asset-qty(v488: felt, v489: felt, v490: felt, v491: felt, v492: felt, v493: felt, v494: felt, v495: felt, v496: felt) { - ^block40(v488: felt, v489: felt, v490: felt, v491: felt, v492: felt, v493: felt, v494: felt, v495: felt, v496: felt): - hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v488, v489, v490, v491, v492, v493, v494, v495, v496) + public builtin.function @set-asset-qty(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt) { + ^block44(v492: felt, v493: felt, v494: felt, v495: felt, v496: felt, v497: felt, v498: felt, v499: felt, v500: felt): + hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#set-asset-qty(v492, v493, v494, v495, v496, v497, v498, v499, v500) builtin.ret ; }; - public builtin.function @get-asset-qty(v497: felt, v498: felt, v499: felt, v500: felt) -> felt { - ^block42(v497: felt, v498: felt, v499: felt, v500: felt): - v501 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v497, v498, v499, v500) : felt - builtin.ret v501; + public builtin.function @get-asset-qty(v501: felt, v502: felt, v503: felt, v504: felt) -> felt { + ^block46(v501: felt, v502: felt, v503: felt, v504: felt): + v505 = hir.exec @miden:storage-example/foo@1.0.0/storage_example/miden:storage-example/foo@1.0.0#get-asset-qty(v501, v502, v503, v504) : felt + builtin.ret v505; }; }; \ 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 f225e116a..5e59eaf24 100644 --- a/tests/integration/expected/examples/storage_example.masm +++ b/tests/integration/expected/examples/storage_example.masm @@ -25,254 +25,27 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.17709194624399802691 - push.16317546024271837059 - push.2378870773206530087 - push.4951894414315594265 + push.7028007876379170725 + push.18060021366771303825 + push.13412364500725888848 + push.14178532912296021363 adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + mem_store.278537 end # mod miden:storage-example/foo@1.0.0::storage_example -proc.miden_base_sys::bindings::storage::extern_get_storage_item - trace.240 - nop - exec.::miden::account::get_item - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - -proc.miden_base_sys::bindings::storage::extern_set_storage_map_item - trace.240 - nop - exec.::miden::account::set_map_item - trace.252 - nop - movup.8 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.16 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.20 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.24 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - -proc.miden_base_sys::bindings::storage::extern_get_storage_map_item - trace.240 - nop - exec.::miden::account::get_map_item - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - proc.__wasm_call_ctors nop end @@ -282,7 +55,7 @@ proc.storage_example::bindings::__link_custom_section_describing_imports end export.miden:storage-example/foo@1.0.0#set-asset-qty - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -292,7 +65,7 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty nop push.112 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -317,7 +90,7 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden_base_sys::bindings::storage::extern_get_storage_item + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::account::get_item trace.252 nop push.8 @@ -466,11 +239,16 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty exec.::intrinsics::mem::load_felt trace.252 nop + movup.5 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + trace.252 + nop push.0 push.1 - movup.7 - movup.3 - eq + movup.2 + swap.1 neq neq if.true @@ -481,11 +259,17 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty dropw dropw else + movup.2 + movup.4 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + trace.252 + nop push.0 push.1 - movup.6 - movup.5 - eq + movup.2 + swap.1 neq neq if.true @@ -497,11 +281,17 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty drop drop else + swap.1 + movup.3 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + trace.252 + nop push.0 push.1 - movup.5 - movup.4 - eq + movup.2 + swap.1 neq neq if.true @@ -511,11 +301,16 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty drop drop else + movup.2 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::eq + trace.252 + nop push.0 push.1 - movup.4 - movup.3 - eq + movup.2 + swap.1 neq neq if.true @@ -625,7 +420,7 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty swap.5 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden_base_sys::bindings::storage::extern_set_storage_map_item + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::account::set_map_item trace.252 nop push.56 @@ -793,7 +588,7 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty end push.112 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -804,7 +599,7 @@ export.miden:storage-example/foo@1.0.0#set-asset-qty end export.miden:storage-example/foo@1.0.0#get-asset-qty - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -814,7 +609,7 @@ export.miden:storage-example/foo@1.0.0#get-asset-qty nop push.48 u32wrapping_sub - push.1114176 + push.1114144 dup.1 swap.1 u32divmod.4 @@ -848,7 +643,7 @@ export.miden:storage-example/foo@1.0.0#get-asset-qty swap.1 trace.240 nop - exec.::miden:storage-example/foo@1.0.0::storage_example::miden_base_sys::bindings::storage::extern_get_storage_map_item + exec.::miden:storage-example/foo@1.0.0::storage_example::miden::account::get_map_item trace.252 nop push.24 @@ -950,7 +745,7 @@ export.miden:storage-example/foo@1.0.0#get-asset-qty movup.2 swap.1 u32wrapping_add - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -961,7 +756,7 @@ export.miden:storage-example/foo@1.0.0#get-asset-qty end proc.wit_bindgen_rt::run_ctors_once - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -969,7 +764,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048624 + push.1048584 u32wrapping_add u32divmod.4 swap.1 @@ -990,7 +785,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -1004,7 +799,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048624 + push.1048584 movup.2 swap.1 u32wrapping_add @@ -1032,13 +827,240 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.miden::account::get_item + trace.240 + nop + exec.::miden::account::get_item + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +proc.miden::account::get_map_item + trace.240 + nop + exec.::miden::account::get_map_item + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +proc.miden::account::set_map_item + trace.240 + nop + exec.::miden::account::set_map_item + trace.252 + nop + movup.8 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.16 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.20 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.24 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + proc.>::from push.255 u32and end proc.miden_stdlib_sys::intrinsics::word::Word::reverse - push.1114176 + push.1114144 u32divmod.4 swap.1 trace.240 @@ -1306,8 +1328,26 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse end proc.>::from + push.0 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::miden:storage-example/foo@1.0.0::storage_example::intrinsics::felt::from_u32 + trace.252 + nop push.12 - dup.1 + dup.4 add u32assert push.4 @@ -1316,7 +1356,7 @@ proc.>::from local.get 9 - call $miden_base_sys::bindings::storage::extern_get_storage_item + call $miden::account::get_item local.get 9 local.get 9 i64.load offset=8 @@ -97,25 +72,25 @@ local.get 0 local.get 9 f32.load offset=96 - call $miden_stdlib_sys::intrinsics::felt::extern_eq + call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@1;) local.get 1 local.get 10 - call $miden_stdlib_sys::intrinsics::felt::extern_eq + call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@1;) local.get 2 local.get 11 - call $miden_stdlib_sys::intrinsics::felt::extern_eq + call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@1;) local.get 3 local.get 12 - call $miden_stdlib_sys::intrinsics::felt::extern_eq + call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@1;) @@ -141,7 +116,7 @@ local.get 9 i32.const 48 i32.add - call $miden_base_sys::bindings::storage::extern_set_storage_map_item + call $miden::account::set_map_item local.get 9 local.get 9 i64.load offset=56 @@ -178,7 +153,7 @@ i32.add global.set $__stack_pointer ) - (func $miden:storage-example/foo@1.0.0#get-asset-qty (;8;) (type 7) (param f32 f32 f32 f32) (result f32) + (func $miden:storage-example/foo@1.0.0#get-asset-qty (;3;) (type 2) (param f32 f32 f32 f32) (result f32) (local i32) global.get $__stack_pointer i32.const 48 @@ -195,7 +170,7 @@ local.get 4 i32.const 16 i32.add - call $miden_base_sys::bindings::storage::extern_get_storage_map_item + call $miden::account::get_map_item local.get 4 local.get 4 i64.load offset=24 @@ -218,11 +193,11 @@ global.set $__stack_pointer local.get 0 ) - (func $wit_bindgen_rt::run_ctors_once (;9;) (type 5) + (func $wit_bindgen_rt::run_ctors_once (;4;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048624 + i32.const 1048584 i32.add i32.load8_u br_if 0 (;@1;) @@ -230,19 +205,28 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048624 + i32.const 1048584 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;10;) (type 4) (param i32) (result f32) + (func $miden::account::get_item (;5;) (type 3) (param f32 i32) + unreachable + ) + (func $miden::account::get_map_item (;6;) (type 4) (param f32 f32 f32 f32 f32 i32) + unreachable + ) + (func $miden::account::set_map_item (;7;) (type 5) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 i32) + unreachable + ) + (func $>::from (;8;) (type 6) (param i32) (result f32) local.get 0 i32.const 255 i32.and f32.reinterpret_i32 ) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;11;) (type 8) (param i32 i32) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;9;) (type 7) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -300,16 +284,16 @@ i64.load align=4 i64.store ) - (func $>::from (;12;) (type 9) (param i32 f32) + (func $>::from (;10;) (type 8) (param i32 f32) (local f32 f32 f32) i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 2 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 3 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 4 local.get 0 local.get 1 @@ -324,46 +308,29 @@ local.get 2 f32.store ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\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\05\00\00\00!owner_public_key\01\15test value9auth::rpo_falcon512::pub_key\01\01\01\1basset_qty_map\01\11test map") - ) - (alias export 2 "felt" (type (;3;))) - (alias export 2 "word" (type (;4;))) - (alias export 2 "asset" (type (;5;))) - (alias export 1 "get-item" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 1 "set-map-item" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (alias export 1 "get-map-item" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (core instance (;0;) - (export "get-item" (func 0)) - (export "set-map-item" (func 1)) - (export "get-map-item" (func 2)) - ) - (alias export 0 "eq" (func (;3;))) - (core func (;3;) (canon lower (func 3))) - (alias export 0 "from-u32" (func (;4;))) - (core func (;4;) (canon lower (func 4))) - (core instance (;1;) - (export "eq" (func 3)) - (export "from-u32" (func 4)) - ) - (core instance (;2;) (instantiate 0 - (with "miden:core-base/account@1.0.0" (instance 0)) - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 1)) + (func $intrinsics::felt::from_u32 (;11;) (type 6) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::eq (;12;) (type 9) (param f32 f32) (result i32) + unreachable ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\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\05\00\00\00!owner_public_key\01\15test value9auth::rpo_falcon512::pub_key\01\01\01\1basset_qty_map\01\11test map") ) - (alias core export 2 "memory" (core memory (;0;))) - (type (;6;) (func (param "pub-key" 4) (param "asset" 5) (param "qty" 3))) - (alias core export 2 "miden:storage-example/foo@1.0.0#set-asset-qty" (core func (;5;))) - (func (;5;) (type 6) (canon lift (core func 5))) - (type (;7;) (func (param "asset" 5) (result 3))) - (alias core export 2 "miden:storage-example/foo@1.0.0#get-asset-qty" (core func (;6;))) - (func (;6;) (type 7) (canon lift (core func 6))) - (alias export 2 "felt" (type (;8;))) - (alias export 2 "word" (type (;9;))) - (alias export 2 "asset" (type (;10;))) + (alias export 0 "felt" (type (;1;))) + (alias export 0 "word" (type (;2;))) + (alias export 0 "asset" (type (;3;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;4;) (func (param "pub-key" 2) (param "asset" 3) (param "qty" 1))) + (alias core export 0 "miden:storage-example/foo@1.0.0#set-asset-qty" (core func (;0;))) + (func (;0;) (type 4) (canon lift (core func 0))) + (type (;5;) (func (param "asset" 3) (result 1))) + (alias core export 0 "miden:storage-example/foo@1.0.0#get-asset-qty" (core func (;1;))) + (func (;1;) (type 5) (canon lift (core func 1))) + (alias export 0 "felt" (type (;6;))) + (alias export 0 "word" (type (;7;))) + (alias export 0 "asset" (type (;8;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -387,16 +354,16 @@ (type (;16;) (func (param "asset" 14) (result 12))) (export (;3;) "get-asset-qty" (func 1) (func (type 16))) ) - (instance (;3;) (instantiate 0 - (with "import-func-set-asset-qty" (func 5)) - (with "import-func-get-asset-qty" (func 6)) - (with "import-type-felt" (type 8)) - (with "import-type-word" (type 9)) - (with "import-type-asset" (type 10)) - (with "import-type-word0" (type 4)) - (with "import-type-asset0" (type 5)) - (with "import-type-felt0" (type 3)) + (instance (;1;) (instantiate 0 + (with "import-func-set-asset-qty" (func 0)) + (with "import-func-get-asset-qty" (func 1)) + (with "import-type-felt" (type 6)) + (with "import-type-word" (type 7)) + (with "import-type-asset" (type 8)) + (with "import-type-word0" (type 2)) + (with "import-type-asset0" (type 3)) + (with "import-type-felt0" (type 1)) ) ) - (export (;4;) "miden:storage-example/foo@1.0.0" (instance 3)) + (export (;2;) "miden:storage-example/foo@1.0.0" (instance 1)) ) diff --git a/tests/integration/expected/felt_intrinsics.hir b/tests/integration/expected/felt_intrinsics.hir index 604aa16a6..04d67639c 100644 --- a/tests/integration/expected/felt_intrinsics.hir +++ b/tests/integration/expected/felt_intrinsics.hir @@ -2,13 +2,37 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @felt_intrinsics { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = arith.mul v0, v1 : felt #[overflow = unchecked]; - v4 = arith.sub v3, v0 : felt #[overflow = unchecked]; - v5 = arith.add v4, v1 : felt #[overflow = unchecked]; - v6 = arith.div v0, v5 : felt; + v3 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::mul(v0, v1) : felt + v4 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::sub(v3, v0) : felt + v5 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::add(v4, v1) : felt + v6 = hir.exec @root_ns:root@1.0.0/felt_intrinsics/intrinsics::felt::div(v0, v5) : felt builtin.ret v6; }; + private builtin.function @intrinsics::felt::add(v7: felt, v8: felt) -> felt { + ^block6(v7: felt, v8: felt): + v9 = arith.add v7, v8 : felt #[overflow = unchecked]; + builtin.ret v9; + }; + + private builtin.function @intrinsics::felt::sub(v11: felt, v12: felt) -> felt { + ^block8(v11: felt, v12: felt): + v13 = arith.sub v11, v12 : felt #[overflow = unchecked]; + builtin.ret v13; + }; + + private builtin.function @intrinsics::felt::mul(v15: felt, v16: felt) -> felt { + ^block10(v15: felt, v16: felt): + v17 = arith.mul v15, v16 : felt #[overflow = unchecked]; + builtin.ret v17; + }; + + private builtin.function @intrinsics::felt::div(v19: felt, v20: felt) -> felt { + ^block12(v19: felt, v20: felt): + v21 = arith.div v19, v20 : felt; + builtin.ret v21; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/felt_intrinsics.wat b/tests/integration/expected/felt_intrinsics.wat index 3e48d3180..daf51f0b2 100644 --- a/tests/integration/expected/felt_intrinsics.wat +++ b/tests/integration/expected/felt_intrinsics.wat @@ -1,23 +1,31 @@ (module $felt_intrinsics.wasm (type (;0;) (func (param f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "mul" (func $miden_stdlib_sys::intrinsics::felt::extern_mul (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "sub" (func $miden_stdlib_sys::intrinsics::felt::extern_sub (;1;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "add" (func $miden_stdlib_sys::intrinsics::felt::extern_add (;2;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "div" (func $miden_stdlib_sys::intrinsics::felt::extern_div (;3;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;4;) (type 0) (param f32 f32) (result f32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result f32) local.get 0 local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_mul + call $intrinsics::felt::mul local.get 0 - call $miden_stdlib_sys::intrinsics::felt::extern_sub + call $intrinsics::felt::sub local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_add - call $miden_stdlib_sys::intrinsics::felt::extern_div + call $intrinsics::felt::add + call $intrinsics::felt::div + ) + (func $intrinsics::felt::add (;1;) (type 0) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::sub (;2;) (type 0) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::mul (;3;) (type 0) (param f32 f32) (result f32) + unreachable + ) + (func $intrinsics::felt::div (;4;) (type 0) (param f32 f32) (result f32) + unreachable ) ) diff --git a/tests/integration/expected/ge_felt.hir b/tests/integration/expected/ge_felt.hir index 5518a3f2a..25206f0ae 100644 --- a/tests/integration/expected/ge_felt.hir +++ b/tests/integration/expected/ge_felt.hir @@ -2,13 +2,19 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @ge_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v5 = arith.constant 0 : i32; - v3 = arith.gte v0, v1 : i1; - v4 = hir.cast v3 : i32; - v6 = arith.neq v4, v5 : i1; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v3 = hir.exec @root_ns:root@1.0.0/ge_felt/intrinsics::felt::ge(v0, v1) : i32 + v4 = arith.constant 0 : i32; + v5 = arith.neq v3, v4 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; + }; + + private builtin.function @intrinsics::felt::ge(v8: felt, v9: felt) -> i32 { + ^block6(v8: felt, v9: felt): + v10 = arith.gte v8, v9 : i1; + v11 = hir.cast v10 : i32; + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/ge_felt.masm b/tests/integration/expected/ge_felt.masm index 35ba691d0..110d2dfbd 100644 --- a/tests/integration/expected/ge_felt.masm +++ b/tests/integration/expected/ge_felt.masm @@ -13,10 +13,17 @@ end # mod root_ns:root@1.0.0::ge_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::ge_felt::intrinsics::felt::ge + trace.252 + nop push.0 + neq +end + +proc.intrinsics::felt::ge swap.1 - movup.2 gte - neq end diff --git a/tests/integration/expected/ge_felt.wat b/tests/integration/expected/ge_felt.wat index 0c4872285..b5ba15e8d 100644 --- a/tests/integration/expected/ge_felt.wat +++ b/tests/integration/expected/ge_felt.wat @@ -1,16 +1,18 @@ (module $ge_felt.wasm (type (;0;) (func (param f32 f32) (result i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "ge" (func $miden_stdlib_sys::intrinsics::felt::extern_ge (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result i32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_ge + call $intrinsics::felt::ge i32.const 0 i32.ne ) + (func $intrinsics::felt::ge (;1;) (type 0) (param f32 f32) (result i32) + unreachable + ) ) diff --git a/tests/integration/expected/gt_felt.hir b/tests/integration/expected/gt_felt.hir index 421afe81e..481aa55f1 100644 --- a/tests/integration/expected/gt_felt.hir +++ b/tests/integration/expected/gt_felt.hir @@ -2,13 +2,19 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @gt_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v5 = arith.constant 0 : i32; - v3 = arith.gt v0, v1 : i1; - v4 = hir.cast v3 : i32; - v6 = arith.neq v4, v5 : i1; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v3 = hir.exec @root_ns:root@1.0.0/gt_felt/intrinsics::felt::gt(v0, v1) : i32 + v4 = arith.constant 0 : i32; + v5 = arith.neq v3, v4 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; + }; + + private builtin.function @intrinsics::felt::gt(v8: felt, v9: felt) -> i32 { + ^block6(v8: felt, v9: felt): + v10 = arith.gt v8, v9 : i1; + v11 = hir.cast v10 : i32; + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/gt_felt.masm b/tests/integration/expected/gt_felt.masm index 5da3876e5..eec6b0c47 100644 --- a/tests/integration/expected/gt_felt.masm +++ b/tests/integration/expected/gt_felt.masm @@ -13,10 +13,17 @@ end # mod root_ns:root@1.0.0::gt_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::gt_felt::intrinsics::felt::gt + trace.252 + nop push.0 + neq +end + +proc.intrinsics::felt::gt swap.1 - movup.2 gt - neq end diff --git a/tests/integration/expected/gt_felt.wat b/tests/integration/expected/gt_felt.wat index 1c3cd8e09..672192f3c 100644 --- a/tests/integration/expected/gt_felt.wat +++ b/tests/integration/expected/gt_felt.wat @@ -1,16 +1,18 @@ (module $gt_felt.wasm (type (;0;) (func (param f32 f32) (result i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "gt" (func $miden_stdlib_sys::intrinsics::felt::extern_gt (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result i32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_gt + call $intrinsics::felt::gt i32.const 0 i32.ne ) + (func $intrinsics::felt::gt (;1;) (type 0) (param f32 f32) (result i32) + unreachable + ) ) diff --git a/tests/integration/expected/hash_elements.hir b/tests/integration/expected/hash_elements.hir index b78b31839..4f09ca927 100644 --- a/tests/integration/expected/hash_elements.hir +++ b/tests/integration/expected/hash_elements.hir @@ -1,393 +1,406 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @hash_elements { - private builtin.function @miden_stdlib_sys::stdlib::crypto::hashes::extern_hash_memory(v0: i32, v1: i32, v2: i32) { - ^block3(v0: i32, v1: i32, v2: i32): - v3, v4, v5, v6 = hir.exec @std/crypto/hashes/rpo/hash_memory(v0, v1) : felt, felt, felt, felt - v7 = hir.bitcast v2 : u32; - v8 = hir.int_to_ptr v7 : ptr; - hir.store v8, v3; - v9 = arith.constant 4 : u32; - v10 = arith.add v7, v9 : u32 #[overflow = checked]; - v11 = hir.int_to_ptr v10 : ptr; - hir.store v11, v4; - v12 = arith.constant 8 : u32; - v13 = arith.add v7, v12 : u32 #[overflow = checked]; - v14 = hir.int_to_ptr v13 : ptr; - hir.store v14, v5; - v15 = arith.constant 12 : u32; - v16 = arith.add v7, v15 : u32 #[overflow = checked]; - v17 = hir.int_to_ptr v16 : ptr; - hir.store v17, v6; - builtin.ret ; - }; - - public builtin.function @entrypoint(v18: i32) -> felt { - ^block10(v18: i32): - v22 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v23 = hir.bitcast v22 : ptr; - v24 = hir.load v23 : i32; - v25 = arith.constant 48 : i32; - v26 = arith.sub v24, v25 : i32 #[overflow = wrapping]; - v27 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v28 = hir.bitcast v27 : ptr; - hir.store v28, v26; - v30 = arith.constant 4 : u32; - v29 = hir.bitcast v18 : u32; - v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v300 = arith.constant 4 : u32; - v33 = arith.mod v31, v300 : u32; - hir.assertz v33 #[code = 250]; - v34 = hir.int_to_ptr v31 : ptr; - v35 = hir.load v34 : i32; - v292 = arith.constant 2 : u32; - v37 = hir.bitcast v35 : u32; - v39 = arith.shr v37, v292 : u32; - v40 = hir.bitcast v39 : i32; - v291 = arith.constant 0 : felt; - v41 = arith.constant 3 : i32; - v42 = arith.band v40, v41 : i32; - v43 = hir.bitcast v42 : felt; - hir.assert_eq v43, v291; - v47 = arith.constant 8 : u32; - v46 = hir.bitcast v18 : u32; - v48 = arith.add v46, v47 : u32 #[overflow = checked]; - v299 = arith.constant 4 : u32; - v50 = arith.mod v48, v299 : u32; - hir.assertz v50 #[code = 250]; - v51 = hir.int_to_ptr v48 : ptr; - v52 = hir.load v51 : i32; - v53 = arith.constant 16 : i32; - v54 = arith.add v26, v53 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/miden_stdlib_sys::stdlib::crypto::hashes::extern_hash_memory(v40, v52, v54) - v56 = arith.constant 24 : u32; - v55 = hir.bitcast v26 : u32; - v57 = arith.add v55, v56 : u32 #[overflow = checked]; - v298 = arith.constant 8 : u32; - v59 = arith.mod v57, v298 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i64; - v63 = arith.constant 40 : u32; - v62 = hir.bitcast v26 : u32; - v64 = arith.add v62, v63 : u32 #[overflow = checked]; - v297 = arith.constant 8 : u32; - v66 = arith.mod v64, v297 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - hir.store v67, v61; - v69 = arith.constant 16 : u32; - v68 = hir.bitcast v26 : u32; - v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v296 = arith.constant 8 : u32; - v72 = arith.mod v70, v296 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i64; - v76 = arith.constant 32 : u32; - v75 = hir.bitcast v26 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v295 = arith.constant 8 : u32; - v79 = arith.mod v77, v295 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - hir.store v80, v74; - v81 = arith.constant 32 : i32; - v82 = arith.add v26, v81 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/miden_stdlib_sys::intrinsics::word::Word::reverse(v26, v82) - v83 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/alloc::raw_vec::RawVecInner::deallocate(v18, v83, v83) - v85 = hir.bitcast v26 : u32; - v294 = arith.constant 4 : u32; - v87 = arith.mod v85, v294 : u32; - hir.assertz v87 #[code = 250]; - v88 = hir.int_to_ptr v85 : ptr; - v89 = hir.load v88 : felt; - v293 = arith.constant 48 : i32; - v91 = arith.add v26, v293 : i32 #[overflow = wrapping]; - v92 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v93 = hir.bitcast v92 : ptr; - hir.store v93, v91; - builtin.ret v89; + public builtin.function @entrypoint(v0: i32) -> felt { + ^block4(v0: i32): + v4 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v5 = hir.bitcast v4 : ptr; + v6 = hir.load v5 : i32; + v7 = arith.constant 48 : i32; + v8 = arith.sub v6, v7 : i32 #[overflow = wrapping]; + v9 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v10 = hir.bitcast v9 : ptr; + hir.store v10, v8; + v12 = arith.constant 4 : u32; + v11 = hir.bitcast v0 : u32; + v13 = arith.add v11, v12 : u32 #[overflow = checked]; + v304 = arith.constant 4 : u32; + v15 = arith.mod v13, v304 : u32; + hir.assertz v15 #[code = 250]; + v16 = hir.int_to_ptr v13 : ptr; + v17 = hir.load v16 : i32; + v296 = arith.constant 2 : u32; + v19 = hir.bitcast v17 : u32; + v21 = arith.shr v19, v296 : u32; + v22 = hir.bitcast v21 : i32; + v23 = arith.constant 3 : i32; + v24 = arith.band v22, v23 : i32; + v25 = hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::from_u32(v24) : felt + v2 = arith.constant 0 : i32; + v27 = hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::from_u32(v2) : felt + hir.exec @root_ns:root@1.0.0/hash_elements/intrinsics::felt::assert_eq(v25, v27) + v29 = arith.constant 8 : u32; + v28 = hir.bitcast v0 : u32; + v30 = arith.add v28, v29 : u32 #[overflow = checked]; + v303 = arith.constant 4 : u32; + v32 = arith.mod v30, v303 : u32; + hir.assertz v32 #[code = 250]; + v33 = hir.int_to_ptr v30 : ptr; + v34 = hir.load v33 : i32; + v35 = arith.constant 16 : i32; + v36 = arith.add v8, v35 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/std::crypto::hashes::rpo::hash_memory(v22, v34, v36) + v38 = arith.constant 24 : u32; + v37 = hir.bitcast v8 : u32; + v39 = arith.add v37, v38 : u32 #[overflow = checked]; + v302 = arith.constant 8 : u32; + v41 = arith.mod v39, v302 : u32; + hir.assertz v41 #[code = 250]; + v42 = hir.int_to_ptr v39 : ptr; + v43 = hir.load v42 : i64; + v45 = arith.constant 40 : u32; + v44 = hir.bitcast v8 : u32; + v46 = arith.add v44, v45 : u32 #[overflow = checked]; + v301 = arith.constant 8 : u32; + v48 = arith.mod v46, v301 : 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 v8 : u32; + v52 = arith.add v50, v51 : u32 #[overflow = checked]; + v300 = arith.constant 8 : u32; + v54 = arith.mod v52, v300 : u32; + hir.assertz v54 #[code = 250]; + v55 = hir.int_to_ptr v52 : ptr; + v56 = hir.load v55 : i64; + v58 = arith.constant 32 : u32; + v57 = hir.bitcast v8 : u32; + v59 = arith.add v57, v58 : u32 #[overflow = checked]; + v299 = arith.constant 8 : u32; + v61 = arith.mod v59, v299 : u32; + hir.assertz v61 #[code = 250]; + v62 = hir.int_to_ptr v59 : ptr; + hir.store v62, v56; + v63 = arith.constant 32 : i32; + v64 = arith.add v8, v63 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/miden_stdlib_sys::intrinsics::word::Word::reverse(v8, v64) + v65 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/hash_elements/alloc::raw_vec::RawVecInner::deallocate(v0, v65, v65) + v67 = hir.bitcast v8 : u32; + v298 = arith.constant 4 : u32; + v69 = arith.mod v67, v298 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : felt; + v297 = arith.constant 48 : i32; + v73 = arith.add v8, v297 : i32 #[overflow = wrapping]; + v74 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v75 = hir.bitcast v74 : ptr; + hir.store v75, v73; + builtin.ret v71; }; - private builtin.function @__rustc::__rust_dealloc(v94: i32, v95: i32, v96: i32) { - ^block12(v94: i32, v95: i32, v96: i32): + private builtin.function @__rustc::__rust_dealloc(v76: i32, v77: i32, v78: i32) { + ^block6(v76: i32, v77: i32, v78: i32): builtin.ret ; }; - private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v97: i32, v98: i32) { - ^block14(v97: i32, v98: i32): - v101 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v102 = hir.bitcast v101 : ptr; - v103 = hir.load v102 : i32; - v104 = arith.constant 16 : i32; - v105 = arith.sub v103, v104 : i32 #[overflow = wrapping]; - v107 = arith.constant 8 : u32; - v106 = hir.bitcast v98 : u32; - v108 = arith.add v106, v107 : u32 #[overflow = checked]; - v387 = arith.constant 8 : u32; - v110 = arith.mod v108, v387 : u32; - hir.assertz v110 #[code = 250]; - v111 = hir.int_to_ptr v108 : ptr; - v112 = hir.load v111 : i64; - v386 = arith.constant 8 : u32; - v113 = hir.bitcast v105 : u32; - v115 = arith.add v113, v386 : u32 #[overflow = checked]; - v116 = arith.constant 4 : u32; - v117 = arith.mod v115, v116 : u32; - hir.assertz v117 #[code = 250]; - v118 = hir.int_to_ptr v115 : ptr; - hir.store v118, v112; - v119 = hir.bitcast v98 : u32; - v385 = arith.constant 8 : u32; - v121 = arith.mod v119, v385 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - v123 = hir.load v122 : i64; - v124 = hir.bitcast v105 : u32; - v384 = arith.constant 4 : u32; - v126 = arith.mod v124, v384 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - hir.store v127, v123; - v128 = arith.constant 12 : i32; - v129 = arith.add v105, v128 : i32 #[overflow = wrapping]; - v99 = arith.constant 0 : i32; - v355, v356, v357, v358, v359, v360 = scf.while v99, v105, v129, v97 : i32, i32, i32, i32, i32, i32 { - ^block40(v361: i32, v362: i32, v363: i32, v364: i32): - v383 = arith.constant 0 : i32; - v132 = arith.constant 8 : i32; - v133 = arith.eq v361, v132 : i1; - v134 = arith.zext v133 : u32; - v135 = hir.bitcast v134 : i32; - v137 = arith.neq v135, v383 : i1; - v349, v350 = scf.if v137 : i32, i32 { - ^block39: - v309 = ub.poison i32 : i32; - scf.yield v309, v309; + private builtin.function @miden_stdlib_sys::intrinsics::word::Word::reverse(v79: i32, v80: i32) { + ^block8(v79: i32, v80: i32): + v83 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v84 = hir.bitcast v83 : ptr; + v85 = hir.load v84 : i32; + v86 = arith.constant 16 : i32; + v87 = arith.sub v85, v86 : i32 #[overflow = wrapping]; + v89 = arith.constant 8 : u32; + v88 = hir.bitcast v80 : u32; + v90 = arith.add v88, v89 : u32 #[overflow = checked]; + v391 = arith.constant 8 : u32; + v92 = arith.mod v90, v391 : u32; + hir.assertz v92 #[code = 250]; + v93 = hir.int_to_ptr v90 : ptr; + v94 = hir.load v93 : i64; + v390 = arith.constant 8 : u32; + v95 = hir.bitcast v87 : u32; + v97 = arith.add v95, v390 : u32 #[overflow = checked]; + v98 = arith.constant 4 : u32; + v99 = arith.mod v97, v98 : u32; + hir.assertz v99 #[code = 250]; + v100 = hir.int_to_ptr v97 : ptr; + hir.store v100, v94; + v101 = hir.bitcast v80 : u32; + v389 = arith.constant 8 : u32; + v103 = arith.mod v101, v389 : u32; + hir.assertz v103 #[code = 250]; + v104 = hir.int_to_ptr v101 : ptr; + v105 = hir.load v104 : i64; + v106 = hir.bitcast v87 : u32; + v388 = arith.constant 4 : u32; + v108 = arith.mod v106, v388 : u32; + hir.assertz v108 #[code = 250]; + v109 = hir.int_to_ptr v106 : ptr; + hir.store v109, v105; + v110 = arith.constant 12 : i32; + v111 = arith.add v87, v110 : i32 #[overflow = wrapping]; + v81 = arith.constant 0 : i32; + v359, v360, v361, v362, v363, v364 = scf.while v81, v87, v111, v79 : i32, i32, i32, i32, i32, i32 { + ^block44(v365: i32, v366: i32, v367: i32, v368: i32): + v387 = arith.constant 0 : i32; + v114 = arith.constant 8 : i32; + v115 = arith.eq v365, v114 : i1; + v116 = arith.zext v115 : u32; + v117 = hir.bitcast v116 : i32; + v119 = arith.neq v117, v387 : i1; + v353, v354 = scf.if v119 : i32, i32 { + ^block43: + v313 = ub.poison i32 : i32; + scf.yield v313, v313; } else { - ^block19: - v139 = arith.add v362, v361 : i32 #[overflow = wrapping]; - v140 = hir.bitcast v139 : u32; - v382 = arith.constant 4 : u32; - v142 = arith.mod v140, v382 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - v144 = hir.load v143 : felt; - v146 = hir.bitcast v363 : u32; - v381 = arith.constant 4 : u32; - v148 = arith.mod v146, v381 : u32; - hir.assertz v148 #[code = 250]; - v149 = hir.int_to_ptr v146 : ptr; - v150 = hir.load v149 : i32; - v151 = hir.bitcast v139 : u32; - v380 = arith.constant 4 : u32; - v153 = arith.mod v151, v380 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v150; - v155 = hir.bitcast v363 : u32; - v379 = arith.constant 4 : u32; - v157 = arith.mod v155, v379 : u32; - hir.assertz v157 #[code = 250]; - v158 = hir.int_to_ptr v155 : ptr; - hir.store v158, v144; - v161 = arith.constant -4 : i32; - v162 = arith.add v363, v161 : i32 #[overflow = wrapping]; - v159 = arith.constant 4 : i32; - v160 = arith.add v361, v159 : i32 #[overflow = wrapping]; - scf.yield v160, v162; + ^block13: + v121 = arith.add v366, v365 : i32 #[overflow = wrapping]; + v122 = hir.bitcast v121 : u32; + v386 = arith.constant 4 : u32; + v124 = arith.mod v122, v386 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + v128 = hir.bitcast v367 : u32; + v385 = arith.constant 4 : u32; + v130 = arith.mod v128, v385 : u32; + hir.assertz v130 #[code = 250]; + v131 = hir.int_to_ptr v128 : ptr; + v132 = hir.load v131 : i32; + v133 = hir.bitcast v121 : u32; + v384 = arith.constant 4 : u32; + v135 = arith.mod v133, v384 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + hir.store v136, v132; + v137 = hir.bitcast v367 : u32; + v383 = arith.constant 4 : u32; + v139 = arith.mod v137, v383 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + hir.store v140, v126; + v143 = arith.constant -4 : i32; + v144 = arith.add v367, v143 : i32 #[overflow = wrapping]; + v141 = arith.constant 4 : i32; + v142 = arith.add v365, v141 : i32 #[overflow = wrapping]; + scf.yield v142, v144; }; - v377 = ub.poison i32 : i32; - v352 = cf.select v137, v377, v364 : i32; - v378 = ub.poison i32 : i32; - v351 = cf.select v137, v378, v362 : i32; - v308 = arith.constant 1 : u32; - v301 = arith.constant 0 : u32; - v354 = cf.select v137, v301, v308 : u32; - v342 = arith.trunc v354 : i1; - scf.condition v342, v349, v351, v350, v352, v362, v364; + v381 = ub.poison i32 : i32; + v356 = cf.select v119, v381, v368 : i32; + v382 = ub.poison i32 : i32; + v355 = cf.select v119, v382, v366 : i32; + v312 = arith.constant 1 : u32; + v305 = arith.constant 0 : u32; + v358 = cf.select v119, v305, v312 : u32; + v346 = arith.trunc v358 : i1; + scf.condition v346, v353, v355, v354, v356, v366, v368; } do { - ^block41(v365: i32, v366: i32, v367: i32, v368: i32, v369: i32, v370: i32): - scf.yield v365, v366, v367, v368; + ^block45(v369: i32, v370: i32, v371: i32, v372: i32, v373: i32, v374: i32): + scf.yield v369, v370, v371, v372; }; - v376 = arith.constant 8 : u32; - v164 = hir.bitcast v359 : u32; - v166 = arith.add v164, v376 : u32 #[overflow = checked]; - v375 = arith.constant 4 : u32; - v168 = arith.mod v166, v375 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : i64; - v374 = arith.constant 8 : u32; - v171 = hir.bitcast v360 : u32; - v173 = arith.add v171, v374 : u32 #[overflow = checked]; - v373 = arith.constant 8 : u32; - v175 = arith.mod v173, v373 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - hir.store v176, v170; - v177 = hir.bitcast v359 : u32; - v372 = arith.constant 4 : u32; - v179 = arith.mod v177, v372 : u32; - hir.assertz v179 #[code = 250]; - v180 = hir.int_to_ptr v177 : ptr; - v181 = hir.load v180 : i64; - v182 = hir.bitcast v360 : u32; - v371 = arith.constant 8 : u32; - v184 = arith.mod v182, v371 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - hir.store v185, v181; + v380 = arith.constant 8 : u32; + v146 = hir.bitcast v363 : u32; + v148 = arith.add v146, v380 : u32 #[overflow = checked]; + v379 = arith.constant 4 : u32; + v150 = arith.mod v148, v379 : u32; + hir.assertz v150 #[code = 250]; + v151 = hir.int_to_ptr v148 : ptr; + v152 = hir.load v151 : i64; + v378 = arith.constant 8 : u32; + v153 = hir.bitcast v364 : u32; + v155 = arith.add v153, v378 : u32 #[overflow = checked]; + v377 = arith.constant 8 : u32; + v157 = arith.mod v155, v377 : u32; + hir.assertz v157 #[code = 250]; + v158 = hir.int_to_ptr v155 : ptr; + hir.store v158, v152; + v159 = hir.bitcast v363 : u32; + v376 = arith.constant 4 : u32; + v161 = arith.mod v159, v376 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : i64; + v164 = hir.bitcast v364 : u32; + v375 = arith.constant 8 : u32; + v166 = arith.mod v164, v375 : u32; + hir.assertz v166 #[code = 250]; + v167 = hir.int_to_ptr v164 : ptr; + hir.store v167, v163; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v186: i32, v187: i32, v188: i32) { - ^block20(v186: i32, v187: i32, v188: i32): - v190 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v191 = hir.bitcast v190 : ptr; - v192 = hir.load v191 : i32; - v193 = arith.constant 16 : i32; - v194 = arith.sub v192, v193 : i32 #[overflow = wrapping]; + private builtin.function @intrinsics::felt::from_u32(v168: i32) -> felt { + ^block14(v168: i32): + v169 = hir.bitcast v168 : felt; + builtin.ret v169; + }; + + private builtin.function @intrinsics::felt::assert_eq(v171: felt, v172: felt) { + ^block16(v171: felt, v172: felt): + hir.assert_eq v171, v172; + builtin.ret ; + }; + + private builtin.function @std::crypto::hashes::rpo::hash_memory(v173: i32, v174: i32, v175: i32) { + ^block18(v173: i32, v174: i32, v175: i32): + v176, v177, v178, v179 = hir.exec @std/crypto/hashes/rpo/hash_memory(v173, v174) : felt, felt, felt, felt + v180 = hir.bitcast v175 : u32; + v181 = hir.int_to_ptr v180 : ptr; + hir.store v181, v176; + v182 = arith.constant 4 : u32; + v183 = arith.add v180, v182 : u32 #[overflow = checked]; + v184 = hir.int_to_ptr v183 : ptr; + hir.store v184, v177; + v185 = arith.constant 8 : u32; + v186 = arith.add v180, v185 : u32 #[overflow = checked]; + v187 = hir.int_to_ptr v186 : ptr; + hir.store v187, v178; + v188 = arith.constant 12 : u32; + v189 = arith.add v180, v188 : u32 #[overflow = checked]; + v190 = hir.int_to_ptr v189 : ptr; + hir.store v190, v179; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v191: i32, v192: i32, v193: i32) { + ^block24(v191: i32, v192: i32, v193: i32): v195 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr v196 = hir.bitcast v195 : ptr; - hir.store v196, v194; - v197 = arith.constant 4 : i32; - v198 = arith.add v194, v197 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/hash_elements/alloc::raw_vec::RawVecInner::current_memory(v198, v186, v187, v188) - v200 = arith.constant 8 : u32; - v199 = hir.bitcast v194 : u32; - v201 = arith.add v199, v200 : u32 #[overflow = checked]; - v202 = arith.constant 4 : u32; - v203 = arith.mod v201, v202 : u32; - hir.assertz v203 #[code = 250]; - v204 = hir.int_to_ptr v201 : ptr; - v205 = hir.load v204 : i32; - v394 = arith.constant 0 : i32; - v189 = arith.constant 0 : i32; - v207 = arith.eq v205, v189 : i1; - v208 = arith.zext v207 : u32; - v209 = hir.bitcast v208 : i32; - v211 = arith.neq v209, v394 : i1; - scf.if v211{ - ^block42: + v197 = hir.load v196 : i32; + v198 = arith.constant 16 : i32; + v199 = arith.sub v197, v198 : i32 #[overflow = wrapping]; + v200 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v201 = hir.bitcast v200 : ptr; + hir.store v201, v199; + v202 = arith.constant 4 : i32; + v203 = arith.add v199, v202 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/hash_elements/alloc::raw_vec::RawVecInner::current_memory(v203, v191, v192, v193) + v205 = arith.constant 8 : u32; + v204 = hir.bitcast v199 : u32; + v206 = arith.add v204, v205 : u32 #[overflow = checked]; + v207 = arith.constant 4 : u32; + v208 = arith.mod v206, v207 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + v210 = hir.load v209 : i32; + v398 = arith.constant 0 : i32; + v194 = arith.constant 0 : i32; + v212 = arith.eq v210, v194 : i1; + v213 = arith.zext v212 : u32; + v214 = hir.bitcast v213 : i32; + v216 = arith.neq v214, v398 : i1; + scf.if v216{ + ^block46: scf.yield ; } else { - ^block23: - v393 = arith.constant 4 : u32; - v212 = hir.bitcast v194 : u32; - v214 = arith.add v212, v393 : u32 #[overflow = checked]; - v392 = arith.constant 4 : u32; - v216 = arith.mod v214, v392 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - v218 = hir.load v217 : i32; - v220 = arith.constant 12 : u32; - v219 = hir.bitcast v194 : u32; - v221 = arith.add v219, v220 : u32 #[overflow = checked]; - v391 = arith.constant 4 : u32; - v223 = arith.mod v221, v391 : u32; - hir.assertz v223 #[code = 250]; - v224 = hir.int_to_ptr v221 : ptr; - v225 = hir.load v224 : i32; - hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v218, v205, v225) + ^block27: + v397 = arith.constant 4 : u32; + v217 = hir.bitcast v199 : u32; + v219 = arith.add v217, v397 : u32 #[overflow = checked]; + v396 = arith.constant 4 : u32; + v221 = arith.mod v219, v396 : u32; + hir.assertz v221 #[code = 250]; + v222 = hir.int_to_ptr v219 : ptr; + v223 = hir.load v222 : i32; + v225 = arith.constant 12 : u32; + v224 = hir.bitcast v199 : u32; + v226 = arith.add v224, v225 : u32 #[overflow = checked]; + v395 = arith.constant 4 : u32; + v228 = arith.mod v226, v395 : u32; + hir.assertz v228 #[code = 250]; + v229 = hir.int_to_ptr v226 : ptr; + v230 = hir.load v229 : i32; + hir.exec @root_ns:root@1.0.0/hash_elements/::deallocate(v223, v210, v230) scf.yield ; }; - v390 = arith.constant 16 : i32; - v228 = arith.add v194, v390 : i32 #[overflow = wrapping]; - v229 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr - v230 = hir.bitcast v229 : ptr; - hir.store v230, v228; + v394 = arith.constant 16 : i32; + v233 = arith.add v199, v394 : i32 #[overflow = wrapping]; + v234 = builtin.global_symbol @root_ns:root@1.0.0/hash_elements/__stack_pointer : ptr + v235 = hir.bitcast v234 : ptr; + hir.store v235, v233; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v231: i32, v232: i32, v233: i32, v234: i32) { - ^block24(v231: i32, v232: i32, v233: i32, v234: i32): - v420 = arith.constant 0 : i32; - v235 = arith.constant 0 : i32; - v239 = arith.eq v234, v235 : i1; - v240 = arith.zext v239 : u32; - v241 = hir.bitcast v240 : i32; - v243 = arith.neq v241, v420 : i1; - v407, v408 = scf.if v243 : i32, i32 { - ^block45: - v419 = arith.constant 0 : i32; - v237 = arith.constant 4 : i32; - scf.yield v237, v419; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v236: i32, v237: i32, v238: i32, v239: i32) { + ^block28(v236: i32, v237: i32, v238: i32, v239: i32): + v424 = arith.constant 0 : i32; + v240 = arith.constant 0 : i32; + v244 = arith.eq v239, v240 : i1; + v245 = arith.zext v244 : u32; + v246 = hir.bitcast v245 : i32; + v248 = arith.neq v246, v424 : i1; + v411, v412 = scf.if v248 : i32, i32 { + ^block49: + v423 = arith.constant 0 : i32; + v242 = arith.constant 4 : i32; + scf.yield v242, v423; } else { - ^block27: - v244 = hir.bitcast v232 : u32; - v279 = arith.constant 4 : u32; - v246 = arith.mod v244, v279 : u32; - hir.assertz v246 #[code = 250]; - v247 = hir.int_to_ptr v244 : ptr; - v248 = hir.load v247 : i32; - v417 = arith.constant 0 : i32; - v418 = arith.constant 0 : i32; - v250 = arith.eq v248, v418 : i1; - v251 = arith.zext v250 : u32; - v252 = hir.bitcast v251 : i32; - v254 = arith.neq v252, v417 : i1; - v405 = scf.if v254 : i32 { - ^block44: - v416 = arith.constant 0 : i32; - scf.yield v416; + ^block31: + v249 = hir.bitcast v237 : u32; + v284 = arith.constant 4 : u32; + v251 = arith.mod v249, v284 : u32; + hir.assertz v251 #[code = 250]; + v252 = hir.int_to_ptr v249 : ptr; + v253 = hir.load v252 : i32; + v421 = arith.constant 0 : i32; + v422 = arith.constant 0 : i32; + v255 = arith.eq v253, v422 : i1; + v256 = arith.zext v255 : u32; + v257 = hir.bitcast v256 : i32; + v259 = arith.neq v257, v421 : i1; + v409 = scf.if v259 : i32 { + ^block48: + v420 = arith.constant 0 : i32; + scf.yield v420; } else { - ^block28: - v415 = arith.constant 4 : u32; - v255 = hir.bitcast v231 : u32; - v257 = arith.add v255, v415 : u32 #[overflow = checked]; - v414 = arith.constant 4 : u32; - v259 = arith.mod v257, v414 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - hir.store v260, v233; - v413 = arith.constant 4 : u32; - v261 = hir.bitcast v232 : u32; - v263 = arith.add v261, v413 : u32 #[overflow = checked]; - v412 = arith.constant 4 : u32; - v265 = arith.mod v263, v412 : u32; - hir.assertz v265 #[code = 250]; - v266 = hir.int_to_ptr v263 : ptr; - v267 = hir.load v266 : i32; - v268 = hir.bitcast v231 : u32; - v411 = arith.constant 4 : u32; - v270 = arith.mod v268, v411 : u32; + ^block32: + v419 = arith.constant 4 : u32; + v260 = hir.bitcast v236 : u32; + v262 = arith.add v260, v419 : u32 #[overflow = checked]; + v418 = arith.constant 4 : u32; + v264 = arith.mod v262, v418 : u32; + hir.assertz v264 #[code = 250]; + v265 = hir.int_to_ptr v262 : ptr; + hir.store v265, v238; + v417 = arith.constant 4 : u32; + v266 = hir.bitcast v237 : u32; + v268 = arith.add v266, v417 : u32 #[overflow = checked]; + v416 = arith.constant 4 : u32; + v270 = arith.mod v268, v416 : u32; hir.assertz v270 #[code = 250]; v271 = hir.int_to_ptr v268 : ptr; - hir.store v271, v267; - v272 = arith.mul v248, v234 : i32 #[overflow = wrapping]; - scf.yield v272; + v272 = hir.load v271 : i32; + v273 = hir.bitcast v236 : u32; + v415 = arith.constant 4 : u32; + v275 = arith.mod v273, v415 : u32; + hir.assertz v275 #[code = 250]; + v276 = hir.int_to_ptr v273 : ptr; + hir.store v276, v272; + v277 = arith.mul v253, v239 : i32 #[overflow = wrapping]; + scf.yield v277; }; - v273 = arith.constant 8 : i32; - v410 = arith.constant 4 : i32; - v406 = cf.select v254, v410, v273 : i32; - scf.yield v406, v405; + v278 = arith.constant 8 : i32; + v414 = arith.constant 4 : i32; + v410 = cf.select v259, v414, v278 : i32; + scf.yield v410, v409; }; - v276 = arith.add v231, v407 : i32 #[overflow = wrapping]; - v278 = hir.bitcast v276 : u32; - v409 = arith.constant 4 : u32; - v280 = arith.mod v278, v409 : u32; - hir.assertz v280 #[code = 250]; - v281 = hir.int_to_ptr v278 : ptr; - hir.store v281, v408; + v281 = arith.add v236, v411 : i32 #[overflow = wrapping]; + v283 = hir.bitcast v281 : u32; + v413 = arith.constant 4 : u32; + v285 = arith.mod v283, v413 : u32; + hir.assertz v285 #[code = 250]; + v286 = hir.int_to_ptr v283 : ptr; + hir.store v286, v412; builtin.ret ; }; - private builtin.function @::deallocate(v282: i32, v283: i32, v284: i32) { - ^block29(v282: i32, v283: i32, v284: i32): - v422 = arith.constant 0 : i32; - v285 = arith.constant 0 : i32; - v286 = arith.eq v284, v285 : i1; - v287 = arith.zext v286 : u32; - v288 = hir.bitcast v287 : i32; - v290 = arith.neq v288, v422 : i1; - scf.if v290{ - ^block31: + private builtin.function @::deallocate(v287: i32, v288: i32, v289: i32) { + ^block33(v287: i32, v288: i32, v289: i32): + v426 = arith.constant 0 : i32; + v290 = arith.constant 0 : i32; + v291 = arith.eq v289, v290 : i1; + v292 = arith.zext v291 : u32; + v293 = hir.bitcast v292 : i32; + v295 = arith.neq v293, v426 : i1; + scf.if v295{ + ^block35: scf.yield ; } else { - ^block32: - hir.exec @root_ns:root@1.0.0/hash_elements/__rustc::__rust_dealloc(v282, v284, v283) + ^block36: + hir.exec @root_ns:root@1.0.0/hash_elements/__rustc::__rust_dealloc(v287, v289, v288) scf.yield ; }; builtin.ret ; diff --git a/tests/integration/expected/hash_elements.masm b/tests/integration/expected/hash_elements.masm index 241411d05..c56d947c7 100644 --- a/tests/integration/expected/hash_elements.masm +++ b/tests/integration/expected/hash_elements.masm @@ -12,63 +12,6 @@ end # mod root_ns:root@1.0.0::hash_elements -proc.miden_stdlib_sys::stdlib::crypto::hashes::extern_hash_memory - trace.240 - nop - exec.::std::crypto::hashes::rpo::hash_memory - trace.252 - nop - movup.4 - dup.0 - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.4 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - dup.1 - swap.1 - add - u32assert - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.12 - add - u32assert - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop -end - export.entrypoint push.1114112 u32divmod.4 @@ -111,12 +54,27 @@ export.entrypoint swap.1 swap.1 u32shr - push.0 push.3 - dup.2 + dup.1 swap.1 u32and - assert_eq + trace.240 + nop + exec.::root_ns:root@1.0.0::hash_elements::intrinsics::felt::from_u32 + trace.252 + nop + push.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::hash_elements::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::hash_elements::intrinsics::felt::assert_eq + trace.252 + nop push.8 dup.3 add @@ -141,7 +99,7 @@ export.entrypoint swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::hash_elements::miden_stdlib_sys::stdlib::crypto::hashes::extern_hash_memory + exec.::root_ns:root@1.0.0::hash_elements::std::crypto::hashes::rpo::hash_memory trace.252 nop push.24 @@ -533,6 +491,71 @@ proc.miden_stdlib_sys::intrinsics::word::Word::reverse nop end +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + +proc.std::crypto::hashes::rpo::hash_memory + trace.240 + nop + exec.::std::crypto::hashes::rpo::hash_memory + trace.252 + nop + movup.4 + dup.0 + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.4 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + dup.1 + swap.1 + add + u32assert + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.12 + add + u32assert + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + proc.alloc::raw_vec::RawVecInner::deallocate push.1114112 u32divmod.4 diff --git a/tests/integration/expected/hash_elements.wat b/tests/integration/expected/hash_elements.wat index b36fe48e3..55b5dd67e 100644 --- a/tests/integration/expected/hash_elements.wat +++ b/tests/integration/expected/hash_elements.wat @@ -1,18 +1,15 @@ (module $hash_elements.wasm (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32))) - (type (;2;) (func (param i32 i32 i32))) - (type (;3;) (func (param i32 i32))) + (type (;1;) (func (param i32 i32 i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param f32 f32))) (type (;4;) (func (param i32 i32 i32 i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;1;) (type 1))) - (import "miden:core-stdlib/stdlib-crypto-hashes-rpo@1.0.0" "hash-memory" (func $miden_stdlib_sys::stdlib::crypto::hashes::extern_hash_memory (;2;) (type 2))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;3;) (type 0) (param i32) (result f32) + (func $entrypoint (;0;) (type 0) (param i32) (result f32) (local i32 i32 f32) global.get $__stack_pointer i32.const 48 @@ -26,17 +23,17 @@ local.tee 2 i32.const 3 i32.and - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 0 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 2 local.get 0 i32.load offset=8 local.get 1 i32.const 16 i32.add - call $miden_stdlib_sys::stdlib::crypto::hashes::extern_hash_memory + call $std::crypto::hashes::rpo::hash_memory local.get 1 local.get 1 i64.load offset=24 @@ -63,8 +60,8 @@ global.set $__stack_pointer local.get 3 ) - (func $__rustc::__rust_dealloc (;4;) (type 2) (param i32 i32 i32)) - (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;5;) (type 3) (param i32 i32) + (func $__rustc::__rust_dealloc (;1;) (type 1) (param i32 i32 i32)) + (func $miden_stdlib_sys::intrinsics::word::Word::reverse (;2;) (type 2) (param i32 i32) (local i32 i32 i32 f32) global.get $__stack_pointer i32.const 16 @@ -122,7 +119,16 @@ i64.load align=4 i64.store ) - (func $alloc::raw_vec::RawVecInner::deallocate (;6;) (type 2) (param i32 i32 i32) + (func $intrinsics::felt::from_u32 (;3;) (type 0) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;4;) (type 3) (param f32 f32) + unreachable + ) + (func $std::crypto::hashes::rpo::hash_memory (;5;) (type 1) (param i32 i32 i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;6;) (type 1) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -189,7 +195,7 @@ local.get 4 i32.store ) - (func $::deallocate (;8;) (type 2) (param i32 i32 i32) + (func $::deallocate (;8;) (type 1) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz diff --git a/tests/integration/expected/hmerge.hir b/tests/integration/expected/hmerge.hir index 36920d08b..187e6634e 100644 --- a/tests/integration/expected/hmerge.hir +++ b/tests/integration/expected/hmerge.hir @@ -1,7 +1,7 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @hmerge { public builtin.function @entrypoint(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt) -> felt { - ^block6(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt): + ^block4(v0: felt, v1: felt, v2: felt, v3: felt, v4: felt, v5: felt, v6: felt, v7: felt): v10 = builtin.global_symbol @root_ns:root@1.0.0/hmerge/__stack_pointer : ptr v11 = hir.bitcast v10 : ptr; v12 = hir.load v11 : i32; @@ -21,76 +21,82 @@ builtin.component root_ns:root@1.0.0 { v24 = arith.constant 24 : u32; v23 = hir.bitcast v14 : u32; v25 = arith.add v23, v24 : u32 #[overflow = checked]; - v85 = arith.constant 4 : u32; - v27 = arith.mod v25, v85 : u32; + v87 = arith.constant 4 : u32; + v27 = arith.mod v25, v87 : u32; hir.assertz v27 #[code = 250]; v28 = hir.int_to_ptr v25 : ptr; hir.store v28, v6; v30 = arith.constant 20 : u32; v29 = hir.bitcast v14 : u32; v31 = arith.add v29, v30 : u32 #[overflow = checked]; - v84 = arith.constant 4 : u32; - v33 = arith.mod v31, v84 : u32; + v86 = arith.constant 4 : u32; + v33 = arith.mod v31, v86 : u32; hir.assertz v33 #[code = 250]; v34 = hir.int_to_ptr v31 : ptr; hir.store v34, v5; v36 = arith.constant 16 : u32; v35 = hir.bitcast v14 : u32; v37 = arith.add v35, v36 : u32 #[overflow = checked]; - v83 = arith.constant 4 : u32; - v39 = arith.mod v37, v83 : u32; + v85 = arith.constant 4 : u32; + v39 = arith.mod v37, v85 : 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]; - v82 = arith.constant 4 : u32; - v45 = arith.mod v43, v82 : u32; + 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]; - v81 = arith.constant 4 : u32; - v51 = arith.mod v49, v81 : u32; + 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; - v80 = arith.constant 4 : u32; + v82 = arith.constant 4 : u32; v53 = hir.bitcast v14 : u32; - v55 = arith.add v53, v80 : u32 #[overflow = checked]; - v79 = arith.constant 4 : u32; - v57 = arith.mod v55, v79 : 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; - v78 = arith.constant 4 : u32; - v61 = arith.mod v59, v78 : u32; + v80 = arith.constant 4 : u32; + v61 = arith.mod v59, v80 : 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 @intrinsics/crypto/hmerge(v14, v64) + 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]; - v77 = arith.constant 4 : u32; - v69 = arith.mod v67, v77 : u32; + 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; - v76 = arith.constant 48 : i32; - v73 = arith.add v14, v76 : i32 #[overflow = wrapping]; + 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; }; + private builtin.function @intrinsics::crypto::hmerge(v76: i32, v77: i32) { + ^block6(v76: i32, v77: i32): + hir.exec @intrinsics/crypto/hmerge(v76, v77) + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/hmerge.masm b/tests/integration/expected/hmerge.masm index f1d3a2812..9bb34ae95 100644 --- a/tests/integration/expected/hmerge.masm +++ b/tests/integration/expected/hmerge.masm @@ -189,7 +189,7 @@ export.entrypoint dup.1 trace.240 nop - exec.::intrinsics::crypto::hmerge + exec.::root_ns:root@1.0.0::hmerge::intrinsics::crypto::hmerge trace.252 nop push.32 @@ -223,3 +223,11 @@ export.entrypoint nop end +proc.intrinsics::crypto::hmerge + trace.240 + nop + exec.::intrinsics::crypto::hmerge + trace.252 + nop +end + diff --git a/tests/integration/expected/hmerge.wat b/tests/integration/expected/hmerge.wat index a30715f4d..769febe96 100644 --- a/tests/integration/expected/hmerge.wat +++ b/tests/integration/expected/hmerge.wat @@ -1,13 +1,12 @@ (module $hmerge.wasm - (type (;0;) (func (param i32 i32))) - (type (;1;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-crypto@1.0.0" "hmerge" (func $miden_stdlib_sys::intrinsics::crypto::extern_hmerge (;0;) (type 0))) + (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (type (;1;) (func (param i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 1) (param f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + (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 @@ -42,7 +41,7 @@ local.get 8 i32.const 32 i32.add - call $miden_stdlib_sys::intrinsics::crypto::extern_hmerge + call $intrinsics::crypto::hmerge local.get 8 f32.load offset=32 local.set 7 @@ -52,4 +51,7 @@ global.set $__stack_pointer local.get 7 ) + (func $intrinsics::crypto::hmerge (;1;) (type 1) (param i32 i32) + unreachable + ) ) diff --git a/tests/integration/expected/le_felt.hir b/tests/integration/expected/le_felt.hir index 95243015b..24ed8c61c 100644 --- a/tests/integration/expected/le_felt.hir +++ b/tests/integration/expected/le_felt.hir @@ -2,13 +2,19 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @le_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v5 = arith.constant 0 : i32; - v3 = arith.lte v1, v0 : i1; - v4 = hir.cast v3 : i32; - v6 = arith.neq v4, v5 : i1; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v3 = hir.exec @root_ns:root@1.0.0/le_felt/intrinsics::felt::le(v1, v0) : i32 + v4 = arith.constant 0 : i32; + v5 = arith.neq v3, v4 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; + }; + + private builtin.function @intrinsics::felt::le(v8: felt, v9: felt) -> i32 { + ^block6(v8: felt, v9: felt): + v10 = arith.lte v8, v9 : i1; + v11 = hir.cast v10 : i32; + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/le_felt.masm b/tests/integration/expected/le_felt.masm index bdf7beec7..bff3ed60e 100644 --- a/tests/integration/expected/le_felt.masm +++ b/tests/integration/expected/le_felt.masm @@ -13,10 +13,18 @@ end # mod root_ns:root@1.0.0::le_felt export.entrypoint + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::le_felt::intrinsics::felt::le + trace.252 + nop push.0 - movup.2 - movup.2 - lte neq end +proc.intrinsics::felt::le + swap.1 + lte +end + diff --git a/tests/integration/expected/le_felt.wat b/tests/integration/expected/le_felt.wat index 37c603c41..2d1ccc487 100644 --- a/tests/integration/expected/le_felt.wat +++ b/tests/integration/expected/le_felt.wat @@ -1,16 +1,18 @@ (module $le_felt.wasm (type (;0;) (func (param f32 f32) (result i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "le" (func $miden_stdlib_sys::intrinsics::felt::extern_le (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result i32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) local.get 1 local.get 0 - call $miden_stdlib_sys::intrinsics::felt::extern_le + call $intrinsics::felt::le i32.const 0 i32.ne ) + (func $intrinsics::felt::le (;1;) (type 0) (param f32 f32) (result i32) + unreachable + ) ) diff --git a/tests/integration/expected/lt_felt.hir b/tests/integration/expected/lt_felt.hir index ddf944027..f7d15f7ca 100644 --- a/tests/integration/expected/lt_felt.hir +++ b/tests/integration/expected/lt_felt.hir @@ -2,13 +2,19 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @lt_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> i32 { ^block4(v0: felt, v1: felt): - v5 = arith.constant 0 : i32; - v3 = arith.lt v1, v0 : i1; - v4 = hir.cast v3 : i32; - v6 = arith.neq v4, v5 : i1; - v7 = arith.zext v6 : u32; - v8 = hir.bitcast v7 : i32; - builtin.ret v8; + v3 = hir.exec @root_ns:root@1.0.0/lt_felt/intrinsics::felt::lt(v1, v0) : i32 + v4 = arith.constant 0 : i32; + v5 = arith.neq v3, v4 : i1; + v6 = arith.zext v5 : u32; + v7 = hir.bitcast v6 : i32; + builtin.ret v7; + }; + + private builtin.function @intrinsics::felt::lt(v8: felt, v9: felt) -> i32 { + ^block6(v8: felt, v9: felt): + v10 = arith.lt v8, v9 : i1; + v11 = hir.cast v10 : i32; + builtin.ret v11; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/lt_felt.masm b/tests/integration/expected/lt_felt.masm index 5a38e6f9b..37da8a13c 100644 --- a/tests/integration/expected/lt_felt.masm +++ b/tests/integration/expected/lt_felt.masm @@ -13,10 +13,18 @@ end # mod root_ns:root@1.0.0::lt_felt export.entrypoint + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::lt_felt::intrinsics::felt::lt + trace.252 + nop push.0 - movup.2 - movup.2 - lt neq end +proc.intrinsics::felt::lt + swap.1 + lt +end + diff --git a/tests/integration/expected/lt_felt.wat b/tests/integration/expected/lt_felt.wat index 82821910f..0ae010705 100644 --- a/tests/integration/expected/lt_felt.wat +++ b/tests/integration/expected/lt_felt.wat @@ -1,16 +1,18 @@ (module $lt_felt.wasm (type (;0;) (func (param f32 f32) (result i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "lt" (func $miden_stdlib_sys::intrinsics::felt::extern_lt (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result i32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result i32) local.get 1 local.get 0 - call $miden_stdlib_sys::intrinsics::felt::extern_lt + call $intrinsics::felt::lt i32.const 0 i32.ne ) + (func $intrinsics::felt::lt (;1;) (type 0) (param f32 f32) (result i32) + unreachable + ) ) diff --git a/tests/integration/expected/mem_intrinsics_heap_base.hir b/tests/integration/expected/mem_intrinsics_heap_base.hir index 7310f7604..c82e30528 100644 --- a/tests/integration/expected/mem_intrinsics_heap_base.hir +++ b/tests/integration/expected/mem_intrinsics_heap_base.hir @@ -1,14 +1,14 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @mem_intrinsics_heap_base { public builtin.function @entrypoint(v0: i32, v1: i32) { - ^block6(v0: i32, v1: i32): + ^block4(v0: i32, v1: i32): hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_no_alloc_shim_is_unstable_v2() v3 = arith.constant 4 : i32; v5 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/__rustc::__rust_alloc(v3, v3) : i32 v2 = arith.constant 0 : i32; v7 = arith.neq v5, v2 : i1; - cf.cond_br v7 ^block8, ^block9; - ^block8: + cf.cond_br v7 ^block6, ^block7; + ^block6: v12 = arith.constant 8 : u32; v11 = hir.bitcast v0 : u32; v13 = arith.add v11, v12 : u32 #[overflow = checked]; @@ -18,73 +18,73 @@ builtin.component root_ns:root@1.0.0 { v10 = arith.constant 1 : i32; v16 = hir.int_to_ptr v13 : ptr; hir.store v16, v10; - v140 = arith.constant 4 : u32; + v142 = arith.constant 4 : u32; v17 = hir.bitcast v0 : u32; - v19 = arith.add v17, v140 : u32 #[overflow = checked]; - v139 = arith.constant 4 : u32; - v21 = arith.mod v19, v139 : u32; + v19 = arith.add v17, v142 : u32 #[overflow = checked]; + v141 = arith.constant 4 : u32; + v21 = arith.mod v19, v141 : u32; hir.assertz v21 #[code = 250]; v22 = hir.int_to_ptr v19 : ptr; hir.store v22, v5; v24 = hir.bitcast v0 : u32; - v138 = arith.constant 4 : u32; - v26 = arith.mod v24, v138 : u32; + v140 = arith.constant 4 : u32; + v26 = arith.mod v24, v140 : u32; hir.assertz v26 #[code = 250]; - v137 = arith.constant 1 : i32; + v139 = arith.constant 1 : i32; v27 = hir.int_to_ptr v24 : ptr; - hir.store v27, v137; + hir.store v27, v139; v31 = hir.bitcast v5 : u32; - v136 = arith.constant 4 : u32; - v33 = arith.mod v31, v136 : u32; + v138 = arith.constant 4 : u32; + v33 = arith.mod v31, v138 : u32; hir.assertz v33 #[code = 250]; - v133 = arith.constant 1 : u32; - v30 = arith.shl v1, v133 : i32; + v135 = arith.constant 1 : u32; + v30 = arith.shl v1, v135 : i32; v34 = hir.int_to_ptr v31 : ptr; hir.store v34, v30; builtin.ret ; - ^block9: - v135 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/alloc::alloc::handle_alloc_error(v135, v135) + ^block7: + v137 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/alloc::alloc::handle_alloc_error(v137, v137) ub.unreachable ; }; private builtin.function @__rustc::__rust_alloc(v35: i32, v36: i32) -> i32 { - ^block10(v35: i32, v36: i32): + ^block8(v35: i32, v36: i32): v38 = arith.constant 1048576 : i32; v39 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/::alloc(v38, v36, v35) : i32 builtin.ret v39; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block12: + ^block10: builtin.ret ; }; private builtin.function @::alloc(v40: i32, v41: i32, v42: i32) -> i32 { - ^block14(v40: i32, v41: i32, v42: i32): + ^block12(v40: i32, v41: i32, v42: i32): v45 = arith.constant 16 : i32; v44 = arith.constant 0 : i32; - v142 = arith.constant 16 : u32; + v144 = arith.constant 16 : u32; v47 = hir.bitcast v41 : u32; - v49 = arith.gt v47, v142 : i1; + v49 = arith.gt v47, v144 : i1; v50 = arith.zext v49 : u32; v51 = hir.bitcast v50 : i32; v53 = arith.neq v51, v44 : i1; v54 = cf.select v53, v41, v45 : i32; - v182 = arith.constant 0 : i32; + v184 = arith.constant 0 : i32; v55 = arith.constant -1 : i32; v56 = arith.add v54, v55 : i32 #[overflow = wrapping]; v57 = arith.band v54, v56 : i32; - v59 = arith.neq v57, v182 : i1; - v151, v152 = scf.if v59 : i32, u32 { - ^block31: - v143 = arith.constant 0 : u32; - v147 = ub.poison i32 : i32; - scf.yield v147, v143; + v59 = arith.neq v57, v184 : i1; + v153, v154 = scf.if v59 : i32, u32 { + ^block33: + v145 = arith.constant 0 : u32; + v149 = ub.poison i32 : i32; + scf.yield v149, v145; } else { - ^block17: + ^block15: v61 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/core::ptr::alignment::Alignment::max(v41, v54) : i32 - v181 = arith.constant 0 : i32; + v183 = arith.constant 0 : i32; v60 = arith.constant -2147483648 : i32; v62 = arith.sub v60, v61 : i32 #[overflow = wrapping]; v64 = hir.bitcast v62 : u32; @@ -92,18 +92,18 @@ builtin.component root_ns:root@1.0.0 { v65 = arith.gt v63, v64 : i1; v66 = arith.zext v65 : u32; v67 = hir.bitcast v66 : i32; - v69 = arith.neq v67, v181 : i1; - v166 = scf.if v69 : i32 { - ^block30: - v180 = ub.poison i32 : i32; - scf.yield v180; + v69 = arith.neq v67, v183 : i1; + v168 = scf.if v69 : i32 { + ^block32: + v182 = ub.poison i32 : i32; + scf.yield v182; } else { - ^block18: - v178 = arith.constant 0 : i32; - v75 = arith.sub v178, v61 : i32 #[overflow = wrapping]; - v179 = arith.constant -1 : i32; + ^block16: + v180 = arith.constant 0 : i32; + v75 = arith.sub v180, v61 : i32 #[overflow = wrapping]; + v181 = arith.constant -1 : i32; v71 = arith.add v42, v61 : i32 #[overflow = wrapping]; - v73 = arith.add v71, v179 : i32 #[overflow = wrapping]; + v73 = arith.add v71, v181 : i32 #[overflow = wrapping]; v76 = arith.band v73, v75 : i32; v77 = hir.bitcast v40 : u32; v78 = arith.constant 4 : u32; @@ -111,51 +111,51 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v79 #[code = 250]; v80 = hir.int_to_ptr v77 : ptr; v81 = hir.load v80 : i32; - v177 = arith.constant 0 : i32; - v83 = arith.neq v81, v177 : i1; + v179 = arith.constant 0 : i32; + v83 = arith.neq v81, v179 : i1; scf.if v83{ - ^block29: + ^block31: scf.yield ; } else { - ^block20: - v84 = hir.exec @intrinsics/mem/heap_base() : i32 + ^block18: + v84 = hir.exec @root_ns:root@1.0.0/mem_intrinsics_heap_base/intrinsics::mem::heap_base() : i32 v85 = hir.mem_size : u32; v91 = hir.bitcast v40 : u32; - v176 = arith.constant 4 : u32; - v93 = arith.mod v91, v176 : u32; + v178 = arith.constant 4 : u32; + v93 = arith.mod v91, v178 : u32; hir.assertz v93 #[code = 250]; - v175 = arith.constant 16 : u32; + v177 = arith.constant 16 : u32; v86 = hir.bitcast v85 : i32; - v89 = arith.shl v86, v175 : i32; + v89 = arith.shl v86, v177 : i32; v90 = arith.add v84, v89 : i32 #[overflow = wrapping]; v94 = hir.int_to_ptr v91 : ptr; hir.store v94, v90; scf.yield ; }; v97 = hir.bitcast v40 : u32; - v174 = arith.constant 4 : u32; - v99 = arith.mod v97, v174 : u32; + v176 = arith.constant 4 : u32; + v99 = arith.mod v97, v176 : u32; hir.assertz v99 #[code = 250]; v100 = hir.int_to_ptr v97 : ptr; v101 = hir.load v100 : i32; - v172 = arith.constant 0 : i32; - v173 = arith.constant -1 : i32; - v103 = arith.bxor v101, v173 : i32; + v174 = arith.constant 0 : i32; + v175 = arith.constant -1 : i32; + v103 = arith.bxor v101, v175 : i32; v105 = hir.bitcast v103 : u32; v104 = hir.bitcast v76 : u32; v106 = arith.gt v104, v105 : i1; v107 = arith.zext v106 : u32; v108 = hir.bitcast v107 : i32; - v110 = arith.neq v108, v172 : i1; - v165 = scf.if v110 : i32 { - ^block21: - v171 = arith.constant 0 : i32; - scf.yield v171; + v110 = arith.neq v108, v174 : i1; + v167 = scf.if v110 : i32 { + ^block19: + v173 = arith.constant 0 : i32; + scf.yield v173; } else { - ^block22: + ^block20: v112 = hir.bitcast v40 : u32; - v170 = arith.constant 4 : u32; - v114 = arith.mod v112, v170 : u32; + v172 = arith.constant 4 : u32; + v114 = arith.mod v112, v172 : u32; hir.assertz v114 #[code = 250]; v111 = arith.add v101, v76 : i32 #[overflow = wrapping]; v115 = hir.int_to_ptr v112 : ptr; @@ -163,38 +163,44 @@ builtin.component root_ns:root@1.0.0 { v117 = arith.add v101, v61 : i32 #[overflow = wrapping]; scf.yield v117; }; - scf.yield v165; + scf.yield v167; }; - v148 = arith.constant 1 : u32; - v169 = arith.constant 0 : u32; - v167 = cf.select v69, v169, v148 : u32; - scf.yield v166, v167; + v150 = arith.constant 1 : u32; + v171 = arith.constant 0 : u32; + v169 = cf.select v69, v171, v150 : u32; + scf.yield v168, v169; }; - v168 = arith.constant 0 : u32; - v164 = arith.eq v152, v168 : i1; - cf.cond_br v164 ^block16, ^block33(v151); - ^block16: + v170 = arith.constant 0 : u32; + v166 = arith.eq v154, v170 : i1; + cf.cond_br v166 ^block14, ^block35(v153); + ^block14: ub.unreachable ; - ^block33(v144: i32): - builtin.ret v144; + ^block35(v146: i32): + builtin.ret v146; }; - private builtin.function @alloc::alloc::handle_alloc_error(v120: i32, v121: i32) { - ^block23(v120: i32, v121: i32): - ub.unreachable ; + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block21: + v120 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v120; }; - private builtin.function @core::ptr::alignment::Alignment::max(v122: i32, v123: i32) -> i32 { + private builtin.function @alloc::alloc::handle_alloc_error(v122: i32, v123: i32) { ^block25(v122: i32, v123: i32): - v130 = arith.constant 0 : i32; - v126 = hir.bitcast v123 : u32; - v125 = hir.bitcast v122 : u32; - v127 = arith.gt v125, v126 : i1; - v128 = arith.zext v127 : u32; - v129 = hir.bitcast v128 : i32; - v131 = arith.neq v129, v130 : i1; - v132 = cf.select v131, v122, v123 : i32; - builtin.ret v132; + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v124: i32, v125: i32) -> i32 { + ^block27(v124: i32, v125: i32): + v132 = arith.constant 0 : i32; + v128 = hir.bitcast v125 : u32; + v127 = hir.bitcast v124 : u32; + v129 = arith.gt v127, v128 : i1; + v130 = arith.zext v129 : u32; + v131 = hir.bitcast v130 : i32; + v133 = arith.neq v131, v132 : i1; + v134 = cf.select v133, v124, v125 : i32; + builtin.ret v134; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/mem_intrinsics_heap_base.wat b/tests/integration/expected/mem_intrinsics_heap_base.wat index 2eb54b698..42eac0aa2 100644 --- a/tests/integration/expected/mem_intrinsics_heap_base.wat +++ b/tests/integration/expected/mem_intrinsics_heap_base.wat @@ -1,16 +1,15 @@ (module $mem_intrinsics_heap_base.wasm - (type (;0;) (func (result i32))) - (type (;1;) (func (param i32 i32))) - (type (;2;) (func (param i32 i32) (result i32))) - (type (;3;) (func)) - (type (;4;) (func (param i32 i32 i32) (result i32))) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" "heap-base" (func $miden_sdk_alloc::heap_base (;0;) (type 0))) + (type (;0;) (func (param i32 i32))) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func)) + (type (;3;) (func (param i32 i32 i32) (result i32))) + (type (;4;) (func (result 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 $entrypoint (;1;) (type 1) (param i32 i32) + (func $entrypoint (;0;) (type 0) (param i32 i32) (local i32) call $__rustc::__rust_no_alloc_shim_is_unstable_v2 block ;; label = @1 @@ -39,16 +38,16 @@ i32.shl i32.store ) - (func $__rustc::__rust_alloc (;2;) (type 2) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) i32.const 1048576 local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 3) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;2;) (type 2) return ) - (func $::alloc (;4;) (type 4) (param i32 i32 i32) (result i32) + (func $::alloc (;3;) (type 3) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -89,7 +88,7 @@ i32.load br_if 0 (;@2;) local.get 0 - call $miden_sdk_alloc::heap_base + call $intrinsics::mem::heap_base memory.size i32.const 16 i32.shl @@ -120,10 +119,13 @@ end unreachable ) - (func $alloc::alloc::handle_alloc_error (;5;) (type 1) (param i32 i32) + (func $intrinsics::mem::heap_base (;4;) (type 4) (result i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;6;) (type 2) (param i32 i32) (result i32) + (func $alloc::alloc::handle_alloc_error (;5;) (type 0) (param i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;6;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/tests/integration/expected/mul_felt.hir b/tests/integration/expected/mul_felt.hir index 8369a6cbf..49de5efab 100644 --- a/tests/integration/expected/mul_felt.hir +++ b/tests/integration/expected/mul_felt.hir @@ -2,10 +2,16 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @mul_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = arith.mul v0, v1 : felt #[overflow = unchecked]; + v3 = hir.exec @root_ns:root@1.0.0/mul_felt/intrinsics::felt::mul(v0, v1) : felt builtin.ret v3; }; + private builtin.function @intrinsics::felt::mul(v4: felt, v5: felt) -> felt { + ^block6(v4: felt, v5: felt): + v6 = arith.mul v4, v5 : felt #[overflow = unchecked]; + builtin.ret v6; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/mul_felt.masm b/tests/integration/expected/mul_felt.masm index ecd90954a..9b7c1a24e 100644 --- a/tests/integration/expected/mul_felt.masm +++ b/tests/integration/expected/mul_felt.masm @@ -13,6 +13,14 @@ end # mod root_ns:root@1.0.0::mul_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::mul_felt::intrinsics::felt::mul + trace.252 + nop +end + +proc.intrinsics::felt::mul mul end diff --git a/tests/integration/expected/mul_felt.wat b/tests/integration/expected/mul_felt.wat index c0949af73..e2d772f8a 100644 --- a/tests/integration/expected/mul_felt.wat +++ b/tests/integration/expected/mul_felt.wat @@ -1,14 +1,16 @@ (module $mul_felt.wasm (type (;0;) (func (param f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "mul" (func $miden_stdlib_sys::intrinsics::felt::extern_mul (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result f32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_mul + call $intrinsics::felt::mul + ) + (func $intrinsics::felt::mul (;1;) (type 0) (param f32 f32) (result f32) + unreachable ) ) diff --git a/tests/integration/expected/neg_felt.hir b/tests/integration/expected/neg_felt.hir index 4151bd395..f29547876 100644 --- a/tests/integration/expected/neg_felt.hir +++ b/tests/integration/expected/neg_felt.hir @@ -2,10 +2,16 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @neg_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = arith.sub v0, v1 : felt #[overflow = unchecked]; + v3 = hir.exec @root_ns:root@1.0.0/neg_felt/intrinsics::felt::sub(v0, v1) : felt builtin.ret v3; }; + private builtin.function @intrinsics::felt::sub(v4: felt, v5: felt) -> felt { + ^block6(v4: felt, v5: felt): + v6 = arith.sub v4, v5 : felt #[overflow = unchecked]; + builtin.ret v6; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/neg_felt.masm b/tests/integration/expected/neg_felt.masm index ecfdd3a3e..7654ada3f 100644 --- a/tests/integration/expected/neg_felt.masm +++ b/tests/integration/expected/neg_felt.masm @@ -13,6 +13,14 @@ end # mod root_ns:root@1.0.0::neg_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::neg_felt::intrinsics::felt::sub + trace.252 + nop +end + +proc.intrinsics::felt::sub swap.1 sub end diff --git a/tests/integration/expected/neg_felt.wat b/tests/integration/expected/neg_felt.wat index 3cd1bd3b6..0bc5fa4ba 100644 --- a/tests/integration/expected/neg_felt.wat +++ b/tests/integration/expected/neg_felt.wat @@ -1,14 +1,16 @@ (module $neg_felt.wasm (type (;0;) (func (param f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "sub" (func $miden_stdlib_sys::intrinsics::felt::extern_sub (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result f32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_sub + call $intrinsics::felt::sub + ) + (func $intrinsics::felt::sub (;1;) (type 0) (param f32 f32) (result f32) + unreachable ) ) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.hir b/tests/integration/expected/rust_sdk/cross_ctx_account.hir index a8b2aea35..8f8cdf762 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.hir @@ -15,7 +15,7 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { v3 = builtin.global_symbol @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/GOT.data.internal.__memory_base : ptr v4 = hir.bitcast v3 : ptr; v5 = hir.load v4 : i32; - v6 = arith.constant 1048604 : i32; + v6 = arith.constant 1048584 : i32; v7 = arith.add v5, v6 : i32 #[overflow = wrapping]; hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/wit_bindgen_rt::run_ctors_once() v8 = hir.bitcast v7 : u32; @@ -24,13 +24,13 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { 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]; + v13 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/intrinsics::felt::from_u32(v12) : felt + v14 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/intrinsics::felt::add(v0, v13) : felt + v15 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/intrinsics::felt::as_u64(v14) : i64 v18 = hir.bitcast v7 : u32; - v47 = arith.constant 4 : u32; - v20 = arith.mod v18, v47 : u32; + v57 = arith.constant 4 : u32; + v20 = arith.mod v18, v57 : 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; @@ -43,7 +43,7 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { 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 1048608 : 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; @@ -61,17 +61,35 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { v36 = hir.bitcast v35 : ptr; v37 = hir.load v36 : 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 1048608 : i32; - v39 = arith.add v37, v51 : i32 #[overflow = wrapping]; + v59 = arith.constant 1 : u8; + v61 = arith.constant 1048588 : i32; + v39 = arith.add v37, v61 : i32 #[overflow = wrapping]; v43 = hir.bitcast v39 : u32; v44 = hir.int_to_ptr v43 : ptr; - hir.store v44, v49; + hir.store v44, v59; scf.yield ; }; builtin.ret ; }; + private builtin.function @intrinsics::felt::add(v45: felt, v46: felt) -> felt { + ^block15(v45: felt, v46: felt): + v47 = arith.add v45, v46 : felt #[overflow = unchecked]; + builtin.ret v47; + }; + + private builtin.function @intrinsics::felt::from_u32(v49: i32) -> felt { + ^block17(v49: i32): + v50 = hir.bitcast v49 : felt; + builtin.ret v50; + }; + + private builtin.function @intrinsics::felt::as_u64(v52: felt) -> i64 { + ^block19(v52: felt): + v53 = hir.cast v52 : i64; + builtin.ret v53; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -80,12 +98,12 @@ builtin.component miden:cross-ctx-account/foo@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000002a00000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x000000000000002a0000000100000001; }; - 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(v55: felt) -> felt { + ^block21(v55: felt): + v56 = hir.exec @miden:cross-ctx-account/foo@1.0.0/cross_ctx_account/miden:cross-ctx-account/foo@1.0.0#process-felt(v55) : felt + builtin.ret v56; }; }; \ 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 f43a9e2f5..e2754779f 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.masm @@ -15,13 +15,13 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.10525333576698012761 - push.3716738888022955810 - push.14081891270999459647 - push.16527651546987830017 + push.17087610586833254709 + push.13035385099392546601 + push.11872459138297551738 + push.11525982497240551389 adv.push_mapval push.262144 - push.2 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 @@ -53,7 +53,7 @@ export.miden:cross-ctx-account/foo@1.0.0#process-felt exec.::intrinsics::mem::load_sw trace.252 nop - push.1048604 + push.1048584 u32wrapping_add trace.240 nop @@ -74,18 +74,31 @@ export.miden:cross-ctx-account/foo@1.0.0#process-felt exec.::intrinsics::mem::load_sw trace.252 nop + trace.240 + nop + exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::intrinsics::felt::from_u32 + trace.252 + nop movup.2 - swap.1 - add - swap.1 + trace.240 + nop + exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::intrinsics::felt::add + trace.252 + nop + dup.0 + trace.240 + nop + exec.::miden:cross-ctx-account/foo@1.0.0::cross_ctx_account::intrinsics::felt::as_u64 + trace.252 + nop + movup.3 push.4 dup.1 swap.1 u32mod u32assert assertz - dup.1 - u32split + movdn.2 drop swap.1 u32divmod.4 @@ -106,7 +119,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048608 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -141,7 +154,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048608 + push.1048588 movup.2 swap.1 u32wrapping_add @@ -169,3 +182,15 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.intrinsics::felt::add + add +end + +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::as_u64 + u32split +end + diff --git a/tests/integration/expected/rust_sdk/cross_ctx_account.wat b/tests/integration/expected/rust_sdk/cross_ctx_account.wat index 4decef40d..f7c56c5eb 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account.wat @@ -1,31 +1,17 @@ (component (type (;0;) - (instance - (type (;0;) (func (param "a" u32) (result f32))) - (export (;0;) "from-u32" (func (type 0))) - (type (;1;) (func (param "a" f32) (result u64))) - (export (;1;) "as-u64" (func (type 1))) - (type (;2;) (func (param "a" f32) (param "b" f32) (result f32))) - (export (;2;) "add" (func (type 2))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;0;) (type 0))) - (type (;1;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;1;) (type 1))) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) (core module (;0;) - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32) (result f32))) - (type (;2;) (func (param f32) (result i64))) - (type (;3;) (func)) - (type (;4;) (func (param f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "add" (func $miden_stdlib_sys::intrinsics::felt::extern_add (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "as-u64" (func $miden_stdlib_sys::intrinsics::felt::extern_as_u64 (;2;) (type 2))) + (type (;0;) (func)) + (type (;1;) (func (param f32) (result f32))) + (type (;2;) (func (param f32 f32) (result f32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32) (result i64))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -33,12 +19,12 @@ (export "memory" (memory 0)) (export "miden:cross-ctx-account/foo@1.0.0#process-felt" (func $miden:cross-ctx-account/foo@1.0.0#process-felt)) (elem (;0;) (i32.const 1) func $cross_ctx_account::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;3;) (type 3)) - (func $cross_ctx_account::bindings::__link_custom_section_describing_imports (;4;) (type 3)) - (func $miden:cross-ctx-account/foo@1.0.0#process-felt (;5;) (type 4) (param f32) (result f32) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $cross_ctx_account::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:cross-ctx-account/foo@1.0.0#process-felt (;2;) (type 1) (param f32) (result f32) (local i32) global.get $GOT.data.internal.__memory_base - i32.const 1048604 + i32.const 1048584 i32.add local.set 1 call $wit_bindgen_rt::run_ctors_once @@ -46,18 +32,18 @@ local.get 0 local.get 1 i32.load - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.tee 0 - call $miden_stdlib_sys::intrinsics::felt::extern_as_u64 + call $intrinsics::felt::as_u64 i64.store32 local.get 0 ) - (func $wit_bindgen_rt::run_ctors_once (;6;) (type 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 1048608 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -65,35 +51,30 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048608 + i32.const 1048588 i32.add i32.const 1 i32.store8 end ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00*\00\00\00") - ) - (alias export 1 "felt" (type (;2;))) - (alias export 0 "from-u32" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 0 "add" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (alias export 0 "as-u64" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (core instance (;0;) - (export "from-u32" (func 0)) - (export "add" (func 1)) - (export "as-u64" (func 2)) - ) - (core instance (;1;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 0)) + (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) + unreachable + ) + (func $intrinsics::felt::as_u64 (;6;) (type 4) (param f32) (result i64) + unreachable ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00*\00\00\00") ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;3;) (func (param "input" 2) (result 2))) - (alias core export 1 "miden:cross-ctx-account/foo@1.0.0#process-felt" (core func (;3;))) - (func (;3;) (type 3) (canon lift (core func 3))) - (alias export 1 "felt" (type (;4;))) + (alias export 0 "felt" (type (;1;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;2;) (func (param "input" 1) (result 1))) + (alias core export 0 "miden:cross-ctx-account/foo@1.0.0#process-felt" (core func (;0;))) + (func (;0;) (type 2) (canon lift (core func 0))) + (alias export 0 "felt" (type (;3;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -104,11 +85,11 @@ (type (;5;) (func (param "input" 4) (result 4))) (export (;1;) "process-felt" (func 0) (func (type 5))) ) - (instance (;2;) (instantiate 0 - (with "import-func-process-felt" (func 3)) - (with "import-type-felt" (type 4)) - (with "import-type-felt0" (type 2)) + (instance (;1;) (instantiate 0 + (with "import-func-process-felt" (func 0)) + (with "import-type-felt" (type 3)) + (with "import-type-felt0" (type 1)) ) ) - (export (;3;) "miden:cross-ctx-account/foo@1.0.0" (instance 2)) + (export (;2;) "miden:cross-ctx-account/foo@1.0.0" (instance 1)) ) 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 c3e5d369e..a9fdcd947 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.hir @@ -16,44 +16,48 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v7 = hir.bitcast v6 : ptr; v8 = hir.load v7 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v18 = arith.constant 1048608 : i32; + v9 = arith.constant 1 : i32; + v10 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v9) : felt + v11 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v0, v10) : felt + v12 = arith.constant 2 : i32; + v13 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v12) : felt + v14 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v1, v13) : felt + v15 = arith.constant 3 : i32; + v16 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v15) : felt + v17 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v2, v16) : felt + v18 = arith.constant 1048584 : i32; v19 = arith.add v8, v18 : i32 #[overflow = wrapping]; + v20 = arith.constant 4 : i32; + v21 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v20) : felt + v22 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v3, v21) : felt v24 = arith.constant 12 : u32; v23 = hir.bitcast v19 : u32; v25 = arith.add v23, v24 : u32 #[overflow = checked]; v26 = arith.constant 4 : u32; v27 = arith.mod v25, v26 : u32; hir.assertz v27 #[code = 250]; - v477 = arith.constant 4 : felt; - v22 = arith.add v3, v477 : 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; + v487 = arith.constant 4 : u32; + v33 = arith.mod v31, v487 : u32; hir.assertz v33 #[code = 250]; - v478 = arith.constant 3 : felt; - v17 = arith.add v2, v478 : felt #[overflow = unchecked]; v34 = hir.int_to_ptr v31 : ptr; hir.store v34, v17; - v483 = arith.constant 4 : u32; + v486 = 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, v486 : u32 #[overflow = checked]; + v485 = arith.constant 4 : u32; + v39 = arith.mod v37, v485 : u32; hir.assertz v39 #[code = 250]; - v479 = arith.constant 2 : felt; - v14 = arith.add v1, v479 : 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; + v484 = arith.constant 4 : u32; + v43 = arith.mod v41, v484 : u32; hir.assertz v43 #[code = 250]; - v480 = arith.constant 1 : felt; - v11 = arith.add v0, v480 : felt #[overflow = unchecked]; v44 = hir.int_to_ptr v41 : ptr; hir.store v44, v11; builtin.ret v19; @@ -65,44 +69,48 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v52 = hir.bitcast v51 : ptr; v53 = hir.load v52 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v63 = arith.constant 1048608 : i32; + v54 = arith.constant 2 : i32; + v55 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v54) : felt + v56 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v45, v55) : felt + v57 = arith.constant 3 : i32; + v58 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v57) : felt + v59 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v46, v58) : felt + v60 = arith.constant 4 : i32; + v61 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v60) : felt + v62 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v47, v61) : felt + v63 = arith.constant 1048584 : i32; v64 = arith.add v53, v63 : i32 #[overflow = wrapping]; + v65 = arith.constant 5 : i32; + v66 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v65) : felt + v67 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v48, v66) : felt v69 = arith.constant 12 : u32; v68 = hir.bitcast v64 : 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]; - v485 = arith.constant 5 : felt; - v67 = arith.add v48, v485 : felt #[overflow = unchecked]; v73 = hir.int_to_ptr v70 : ptr; hir.store v73, v67; v75 = arith.constant 8 : u32; v74 = hir.bitcast v64 : u32; v76 = arith.add v74, v75 : u32 #[overflow = checked]; - v492 = arith.constant 4 : u32; - v78 = arith.mod v76, v492 : u32; + v491 = arith.constant 4 : u32; + v78 = arith.mod v76, v491 : u32; hir.assertz v78 #[code = 250]; - v486 = arith.constant 4 : felt; - v62 = arith.add v47, v486 : felt #[overflow = unchecked]; v79 = hir.int_to_ptr v76 : ptr; hir.store v79, v62; - v491 = arith.constant 4 : u32; - v80 = hir.bitcast v64 : u32; - v82 = arith.add v80, v491 : u32 #[overflow = checked]; v490 = arith.constant 4 : u32; - v84 = arith.mod v82, v490 : u32; + v80 = hir.bitcast v64 : u32; + v82 = arith.add v80, v490 : u32 #[overflow = checked]; + v489 = arith.constant 4 : u32; + v84 = arith.mod v82, v489 : u32; hir.assertz v84 #[code = 250]; - v487 = arith.constant 3 : felt; - v59 = arith.add v46, v487 : felt #[overflow = unchecked]; v85 = hir.int_to_ptr v82 : ptr; hir.store v85, v59; v86 = hir.bitcast v64 : u32; - v489 = arith.constant 4 : u32; - v88 = arith.mod v86, v489 : u32; + v488 = arith.constant 4 : u32; + v88 = arith.mod v86, v488 : u32; hir.assertz v88 #[code = 250]; - v488 = arith.constant 2 : felt; - v56 = arith.add v45, v488 : felt #[overflow = unchecked]; v89 = hir.int_to_ptr v86 : ptr; hir.store v89, v56; builtin.ret v64; @@ -111,8 +119,9 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { public builtin.function @miden:cross-ctx-account-word/foo@1.0.0#process-felt(v90: felt) -> felt { ^block13(v90: felt): hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v493 = arith.constant 3 : felt; - v94 = arith.add v90, v493 : felt #[overflow = unchecked]; + v92 = arith.constant 3 : i32; + v93 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v92) : felt + v94 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v90, v93) : felt builtin.ret v94; }; @@ -122,24 +131,26 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v100 = hir.bitcast v99 : ptr; v101 = hir.load v100 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v105 = arith.constant 1048608 : i32; + v102 = arith.constant 4 : i32; + v103 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v102) : felt + v104 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v95, v103) : felt + v105 = arith.constant 1048584 : i32; v106 = arith.add v101, v105 : i32 #[overflow = wrapping]; + v494 = arith.constant 4 : i32; + v108 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v494) : felt + v109 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v96, v108) : felt v111 = arith.constant 4 : u32; v110 = hir.bitcast v106 : u32; v112 = arith.add v110, v111 : u32 #[overflow = checked]; - v498 = arith.constant 4 : u32; - v114 = arith.mod v112, v498 : u32; + v493 = arith.constant 4 : u32; + v114 = arith.mod v112, v493 : u32; hir.assertz v114 #[code = 250]; - v495 = arith.constant 4 : felt; - v109 = arith.add v96, v495 : felt #[overflow = unchecked]; v115 = hir.int_to_ptr v112 : ptr; hir.store v115, v109; v116 = hir.bitcast v106 : u32; - v497 = arith.constant 4 : u32; - v118 = arith.mod v116, v497 : u32; + v492 = arith.constant 4 : u32; + v118 = arith.mod v116, v492 : u32; hir.assertz v118 #[code = 250]; - v496 = arith.constant 4 : felt; - v104 = arith.add v95, v496 : felt #[overflow = unchecked]; v119 = hir.int_to_ptr v116 : ptr; hir.store v119, v104; builtin.ret v106; @@ -151,34 +162,37 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v126 = hir.bitcast v125 : ptr; v127 = hir.load v126 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v134 = arith.constant 1048608 : i32; + v128 = arith.constant 5 : i32; + v129 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v128) : felt + v130 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v120, v129) : felt + v499 = arith.constant 5 : i32; + v132 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v499) : felt + v133 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v121, v132) : felt + v134 = arith.constant 1048584 : i32; v135 = arith.add v127, v134 : i32 #[overflow = wrapping]; + v498 = arith.constant 5 : i32; + v137 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v498) : felt + v138 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v122, v137) : felt v140 = arith.constant 8 : u32; v139 = hir.bitcast v135 : u32; v141 = arith.add v139, v140 : u32 #[overflow = checked]; v142 = arith.constant 4 : u32; v143 = arith.mod v141, v142 : u32; hir.assertz v143 #[code = 250]; - v501 = arith.constant 5 : felt; - v138 = arith.add v122, v501 : felt #[overflow = unchecked]; v144 = hir.int_to_ptr v141 : ptr; hir.store v144, v138; - v506 = arith.constant 4 : u32; + v497 = arith.constant 4 : u32; v145 = hir.bitcast v135 : u32; - v147 = arith.add v145, v506 : u32 #[overflow = checked]; - v505 = arith.constant 4 : u32; - v149 = arith.mod v147, v505 : u32; + v147 = arith.add v145, v497 : u32 #[overflow = checked]; + v496 = arith.constant 4 : u32; + v149 = arith.mod v147, v496 : u32; hir.assertz v149 #[code = 250]; - v504 = arith.constant 5 : felt; - v133 = arith.add v121, v504 : felt #[overflow = unchecked]; v150 = hir.int_to_ptr v147 : ptr; hir.store v150, v133; v151 = hir.bitcast v135 : u32; - v503 = arith.constant 4 : u32; - v153 = arith.mod v151, v503 : u32; + v495 = arith.constant 4 : u32; + v153 = arith.mod v151, v495 : u32; hir.assertz v153 #[code = 250]; - v502 = arith.constant 5 : felt; - v130 = arith.add v120, v502 : felt #[overflow = unchecked]; v154 = hir.int_to_ptr v151 : ptr; hir.store v154, v130; builtin.ret v135; @@ -190,7 +204,13 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v165 = hir.bitcast v164 : ptr; v166 = hir.load v165 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v173 = arith.constant 1048608 : i32; + v167 = arith.constant 6 : i32; + v168 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v167) : felt + v169 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v156, v168) : felt + v170 = arith.constant 7 : i32; + v171 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v170) : felt + v172 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v158, v171) : felt + v173 = arith.constant 1048584 : i32; v174 = arith.add v166, v173 : i32 #[overflow = wrapping]; v180 = arith.constant 22 : u32; v179 = hir.bitcast v174 : u32; @@ -232,15 +252,13 @@ 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]; - v507 = arith.constant 7 : felt; - v172 = arith.add v158, v507 : felt #[overflow = unchecked]; v210 = hir.int_to_ptr v207 : ptr; hir.store v210, v172; v214 = arith.constant 12 : u32; v213 = hir.bitcast v174 : u32; v215 = arith.add v213, v214 : u32 #[overflow = checked]; - v511 = arith.constant 4 : u32; - v217 = arith.mod v215, v511 : u32; + v502 = arith.constant 4 : u32; + v217 = arith.mod v215, v502 : u32; hir.assertz v217 #[code = 250]; v211 = arith.constant 10 : i32; v212 = arith.add v157, v211 : i32 #[overflow = wrapping]; @@ -249,16 +267,14 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v220 = arith.constant 8 : u32; v219 = hir.bitcast v174 : u32; v221 = arith.add v219, v220 : u32 #[overflow = checked]; - v510 = arith.constant 4 : u32; - v223 = arith.mod v221, v510 : u32; + v501 = arith.constant 4 : u32; + v223 = arith.mod v221, v501 : u32; hir.assertz v223 #[code = 250]; - v508 = arith.constant 6 : felt; - v169 = arith.add v156, v508 : felt #[overflow = unchecked]; v224 = hir.int_to_ptr v221 : ptr; hir.store v224, v169; v227 = hir.bitcast v174 : u32; - v509 = arith.constant 8 : u32; - v229 = arith.mod v227, v509 : u32; + v500 = arith.constant 8 : u32; + v229 = arith.mod v227, v500 : u32; hir.assertz v229 #[code = 250]; v225 = arith.constant 1000 : i64; v226 = arith.add v155, v225 : i64 #[overflow = wrapping]; @@ -273,34 +289,37 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v237 = hir.bitcast v236 : ptr; v238 = hir.load v237 : i32; hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/wit_bindgen_rt::run_ctors_once() - v245 = arith.constant 1048608 : i32; + v239 = arith.constant 8 : i32; + v240 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v239) : felt + v241 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v231, v240) : felt + v507 = arith.constant 8 : i32; + v243 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v507) : felt + v244 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v232, v243) : felt + v245 = arith.constant 1048584 : i32; v246 = arith.add v238, v245 : i32 #[overflow = wrapping]; + v506 = arith.constant 8 : i32; + v248 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::from_u32(v506) : felt + v249 = hir.exec @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/intrinsics::felt::add(v233, v248) : felt v251 = arith.constant 8 : u32; v250 = hir.bitcast v246 : u32; v252 = arith.add v250, v251 : u32 #[overflow = checked]; v253 = arith.constant 4 : u32; v254 = arith.mod v252, v253 : u32; hir.assertz v254 #[code = 250]; - v514 = arith.constant 8 : felt; - v249 = arith.add v233, v514 : felt #[overflow = unchecked]; v255 = hir.int_to_ptr v252 : ptr; hir.store v255, v249; - v519 = arith.constant 4 : u32; + v505 = arith.constant 4 : u32; v256 = hir.bitcast v246 : u32; - v258 = arith.add v256, v519 : u32 #[overflow = checked]; - v518 = arith.constant 4 : u32; - v260 = arith.mod v258, v518 : u32; + v258 = arith.add v256, v505 : u32 #[overflow = checked]; + v504 = arith.constant 4 : u32; + v260 = arith.mod v258, v504 : u32; hir.assertz v260 #[code = 250]; - v517 = arith.constant 8 : felt; - v244 = arith.add v232, v517 : felt #[overflow = unchecked]; v261 = hir.int_to_ptr v258 : ptr; hir.store v261, v244; v262 = hir.bitcast v246 : u32; - v516 = arith.constant 4 : u32; - v264 = arith.mod v262, v516 : u32; + v503 = arith.constant 4 : u32; + v264 = arith.mod v262, v503 : u32; hir.assertz v264 #[code = 250]; - v515 = arith.constant 8 : felt; - v241 = arith.add v231, v515 : felt #[overflow = unchecked]; v265 = hir.int_to_ptr v262 : ptr; hir.store v265, v241; builtin.ret v246; @@ -311,7 +330,7 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { v267 = builtin.global_symbol @miden:cross-ctx-account-word/foo@1.0.0/cross_ctx_account_word/GOT.data.internal.__memory_base : ptr v268 = hir.bitcast v267 : ptr; v269 = hir.load v268 : i32; - v270 = arith.constant 1048632 : i32; + v270 = arith.constant 1048608 : i32; v271 = arith.add v269, v270 : i32 #[overflow = wrapping]; v272 = hir.bitcast v271 : u32; v273 = hir.int_to_ptr v272 : ptr; @@ -329,17 +348,29 @@ 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 1048632 : i32; - v283 = arith.add v281, v523 : i32 #[overflow = wrapping]; + v509 = arith.constant 1 : u8; + v511 = arith.constant 1048608 : i32; + v283 = arith.add v281, v511 : i32 #[overflow = wrapping]; v287 = hir.bitcast v283 : u32; v288 = hir.int_to_ptr v287 : ptr; - hir.store v288, v521; + hir.store v288, v509; scf.yield ; }; builtin.ret ; }; + private builtin.function @intrinsics::felt::add(v289: felt, v290: felt) -> felt { + ^block27(v289: felt, v290: felt): + v291 = arith.add v289, v290 : felt #[overflow = unchecked]; + builtin.ret v291; + }; + + private builtin.function @intrinsics::felt::from_u32(v293: i32) -> felt { + ^block29(v293: i32): + v294 = hir.bitcast v293 : felt; + builtin.ret v294; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -348,182 +379,182 @@ builtin.component miden:cross-ctx-account-word/foo@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000000000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000000000000100000001; }; - 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 - 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; + public builtin.function @process-word(v296: felt, v297: felt, v298: felt, v299: felt) -> felt, felt, felt, felt { + ^block31(v296: felt, v297: felt, v298: felt, v299: felt): + v300 = 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(v296, v297, v298, v299) : i32 + v301 = arith.constant 0 : i32; + v302 = arith.add v300, v301 : i32 #[overflow = unchecked]; + v515 = arith.constant 0 : i32; + v516 = arith.constant 0 : i32; + v304 = arith.add v302, v516 : i32 #[overflow = unchecked]; + v306 = arith.add v304, v515 : i32 #[overflow = unchecked]; + v307 = hir.int_to_ptr v306 : ptr; + v308 = hir.load v307 : felt; + v514 = arith.constant 0 : i32; + v309 = arith.constant 4 : i32; + v310 = arith.add v302, v309 : i32 #[overflow = unchecked]; + v312 = arith.add v310, v514 : i32 #[overflow = unchecked]; + v313 = hir.int_to_ptr v312 : ptr; + v314 = hir.load v313 : felt; + v513 = arith.constant 0 : i32; + v315 = arith.constant 8 : i32; + v316 = arith.add v302, v315 : i32 #[overflow = unchecked]; + v318 = arith.add v316, v513 : i32 #[overflow = unchecked]; + v319 = hir.int_to_ptr v318 : ptr; + v320 = hir.load v319 : felt; + v512 = arith.constant 0 : i32; + v321 = arith.constant 12 : i32; + v322 = arith.add v302, v321 : i32 #[overflow = unchecked]; + v324 = arith.add v322, v512 : i32 #[overflow = unchecked]; + v325 = hir.int_to_ptr v324 : ptr; + v326 = hir.load v325 : felt; + builtin.ret v308, v314, v320, v326; }; - 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(v331: felt, v332: felt, v333: felt, v334: felt) -> felt, felt, felt, felt { + ^block33(v331: felt, v332: felt, v333: felt, v334: felt): + v335 = 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(v331, v332, v333, v334) : i32 + v336 = arith.constant 0 : i32; + v337 = arith.add v335, v336 : i32 #[overflow = unchecked]; + v520 = arith.constant 0 : i32; + v521 = arith.constant 0 : i32; + v339 = arith.add v337, v521 : i32 #[overflow = unchecked]; + v341 = arith.add v339, v520 : i32 #[overflow = unchecked]; + v342 = hir.int_to_ptr v341 : ptr; + v343 = hir.load v342 : felt; + v519 = arith.constant 0 : i32; + v344 = arith.constant 4 : i32; + v345 = arith.add v337, v344 : i32 #[overflow = unchecked]; + v347 = arith.add v345, v519 : i32 #[overflow = unchecked]; + v348 = hir.int_to_ptr v347 : ptr; + v349 = hir.load v348 : felt; + v518 = arith.constant 0 : i32; + v350 = arith.constant 8 : i32; + v351 = arith.add v337, v350 : i32 #[overflow = unchecked]; + v353 = arith.add v351, v518 : i32 #[overflow = unchecked]; + v354 = hir.int_to_ptr v353 : ptr; + v355 = hir.load v354 : felt; + v517 = arith.constant 0 : i32; + v356 = arith.constant 12 : i32; + v357 = arith.add v337, v356 : i32 #[overflow = unchecked]; + v359 = arith.add v357, v517 : i32 #[overflow = unchecked]; + v360 = hir.int_to_ptr v359 : ptr; + v361 = hir.load v360 : felt; + builtin.ret v343, v349, v355, v361; }; - 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(v366: felt) -> felt { + ^block35(v366: felt): + v367 = 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(v366) : felt + builtin.ret v367; }; - 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(v368: felt, v369: felt) -> felt, felt { + ^block37(v368: felt, v369: felt): + v370 = 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(v368, v369) : i32 + v523 = arith.constant 0 : i32; + v371 = arith.constant 0 : i32; + v372 = arith.add v370, v371 : i32 #[overflow = unchecked]; + v374 = arith.add v372, v523 : i32 #[overflow = unchecked]; + v375 = hir.int_to_ptr v374 : ptr; + v376 = hir.load v375 : felt; + v522 = arith.constant 0 : i32; + v377 = arith.constant 4 : i32; + v378 = arith.add v370, v377 : i32 #[overflow = unchecked]; + v380 = arith.add v378, v522 : i32 #[overflow = unchecked]; + v381 = hir.int_to_ptr v380 : ptr; + v382 = hir.load v381 : felt; + builtin.ret v376, v382; }; - 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(v385: felt, v386: felt, v387: felt) -> felt, felt, felt { + ^block39(v385: felt, v386: felt, v387: felt): + v388 = 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(v385, v386, v387) : i32 + v526 = arith.constant 0 : i32; + v389 = arith.constant 0 : i32; + v390 = arith.add v388, v389 : i32 #[overflow = unchecked]; + v392 = arith.add v390, v526 : i32 #[overflow = unchecked]; + v393 = hir.int_to_ptr v392 : ptr; + v394 = hir.load v393 : felt; + v525 = arith.constant 0 : i32; + v395 = arith.constant 4 : i32; + v396 = arith.add v388, v395 : i32 #[overflow = unchecked]; + v398 = arith.add v396, v525 : i32 #[overflow = unchecked]; + v399 = hir.int_to_ptr v398 : ptr; + v400 = hir.load v399 : felt; + v524 = arith.constant 0 : i32; + v401 = arith.constant 8 : i32; + v402 = arith.add v388, v401 : i32 #[overflow = unchecked]; + v404 = arith.add v402, v524 : i32 #[overflow = unchecked]; + v405 = hir.int_to_ptr v404 : ptr; + v406 = hir.load v405 : felt; + builtin.ret v394, v400, v406; }; - 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(v410: i64, v411: felt, v412: i32, v413: felt, v414: i32, v415: i32, v416: i32) -> i64, felt, i32, felt, i32, i32, i32 { + ^block41(v410: i64, v411: felt, v412: i32, v413: felt, v414: i32, v415: i32, v416: i32): + v417 = 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(v410, v411, v412, v413, v414, v415, v416) : i32 + v418 = arith.constant 0 : i32; + v419 = arith.add v417, v418 : i32 #[overflow = unchecked]; + v420 = hir.int_to_ptr v419 : ptr; + v421 = hir.load v420 : u64; + v528 = arith.constant 0 : i32; + v422 = arith.constant 8 : i32; + v423 = arith.add v417, v422 : i32 #[overflow = unchecked]; + v425 = arith.add v423, v528 : i32 #[overflow = unchecked]; + v426 = hir.int_to_ptr v425 : ptr; + v427 = hir.load v426 : felt; + v428 = arith.constant 12 : i32; + v429 = arith.add v417, v428 : i32 #[overflow = unchecked]; + v430 = hir.int_to_ptr v429 : ptr; + v431 = hir.load v430 : u32; + v527 = arith.constant 0 : i32; + v432 = arith.constant 16 : i32; + v433 = arith.add v417, v432 : i32 #[overflow = unchecked]; + v435 = arith.add v433, v527 : i32 #[overflow = unchecked]; + v436 = hir.int_to_ptr v435 : ptr; + v437 = hir.load v436 : felt; + v438 = arith.constant 20 : i32; + v439 = arith.add v417, v438 : i32 #[overflow = unchecked]; + v440 = hir.int_to_ptr v439 : ptr; + v441 = hir.load v440 : u8; + v442 = arith.constant 21 : i32; + v443 = arith.add v417, v442 : i32 #[overflow = unchecked]; + v444 = hir.int_to_ptr v443 : ptr; + v445 = hir.load v444 : i1; + v446 = arith.constant 22 : i32; + v447 = arith.add v417, v446 : i32 #[overflow = unchecked]; + v448 = hir.int_to_ptr v447 : ptr; + v449 = hir.load v448 : u16; + builtin.ret v421, v427, v431, v437, v441, v445, v449; }; - 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(v457: felt, v458: felt, v459: felt) -> felt, felt, felt { + ^block43(v457: felt, v458: felt, v459: felt): + v460 = 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(v457, v458, v459) : i32 + v461 = arith.constant 0 : i32; + v462 = arith.add v460, v461 : i32 #[overflow = unchecked]; + v531 = arith.constant 0 : i32; + v532 = arith.constant 0 : i32; + v464 = arith.add v462, v532 : i32 #[overflow = unchecked]; + v466 = arith.add v464, v531 : i32 #[overflow = unchecked]; + v467 = hir.int_to_ptr v466 : ptr; + v468 = hir.load v467 : felt; + v530 = arith.constant 0 : i32; + v469 = arith.constant 4 : i32; + v470 = arith.add v462, v469 : i32 #[overflow = unchecked]; + v472 = arith.add v470, v530 : i32 #[overflow = unchecked]; + v473 = hir.int_to_ptr v472 : ptr; + v474 = hir.load v473 : felt; + v529 = arith.constant 0 : i32; + v475 = arith.constant 8 : i32; + v476 = arith.add v460, v475 : i32 #[overflow = unchecked]; + v478 = arith.add v476, v529 : i32 #[overflow = unchecked]; + v479 = hir.int_to_ptr v478 : ptr; + v480 = hir.load v479 : felt; + builtin.ret v468, v474, v480; }; }; \ 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 e42c41f27..f81ef2b53 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.masm @@ -406,13 +406,13 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.12642424670700610466 - push.726580607729070103 - push.14722180543335400972 - push.3395382036106606298 + push.7028007876379170725 + push.18060021366771303825 + push.13412364500725888848 + push.14178532912296021363 adv.push_mapval push.262144 - push.2 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 @@ -449,10 +449,60 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-word exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.1 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.1048584 + movup.4 + swap.1 u32wrapping_add + push.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop push.12 - dup.1 + dup.2 add u32assert push.4 @@ -461,11 +511,6 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-word u32mod u32assert assertz - push.4 - movup.6 - swap.1 - add - swap.1 u32divmod.4 swap.1 trace.240 @@ -483,10 +528,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-word u32mod u32assert assertz - push.3 - movup.5 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -505,10 +547,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-word u32mod u32assert assertz - push.2 - movup.4 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -524,10 +563,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-word u32mod u32assert assertz - push.1 - movup.3 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -552,10 +588,60 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-another-word exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.1048584 + movup.4 + swap.1 u32wrapping_add + push.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop push.12 - dup.1 + dup.2 add u32assert push.4 @@ -564,11 +650,6 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-another-word u32mod u32assert assertz - push.5 - movup.6 - swap.1 - add - swap.1 u32divmod.4 swap.1 trace.240 @@ -586,10 +667,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-another-word u32mod u32assert assertz - push.4 - movup.5 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -608,10 +686,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-another-word u32mod u32assert assertz - push.3 - movup.4 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -627,10 +702,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-another-word u32mod u32assert assertz - push.2 - movup.3 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -648,7 +720,17 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-felt trace.252 nop push.3 - add + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop end export.miden:cross-ctx-account-word/foo@1.0.0#process-pair @@ -665,10 +747,36 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-pair exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.1048584 + movup.2 + swap.1 u32wrapping_add push.4 - dup.1 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.4 + dup.2 add u32assert push.4 @@ -677,11 +785,6 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-pair u32mod u32assert assertz - push.4 - movup.4 - swap.1 - add - swap.1 u32divmod.4 swap.1 trace.240 @@ -696,10 +799,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-pair u32mod u32assert assertz - push.4 - movup.3 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -724,10 +824,48 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-triple exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.1048584 + movup.3 + swap.1 u32wrapping_add + push.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop push.8 - dup.1 + dup.2 add u32assert push.4 @@ -736,11 +874,6 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-triple u32mod u32assert assertz - push.5 - movup.5 - swap.1 - add - swap.1 u32divmod.4 swap.1 trace.240 @@ -758,10 +891,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-triple u32mod u32assert assertz - push.5 - movup.4 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -777,10 +907,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-triple u32mod u32assert assertz - push.5 - movup.3 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -805,7 +932,33 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-mixed exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.6 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.7 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.6 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.1048584 + movup.3 + swap.1 u32wrapping_add push.22 dup.1 @@ -919,10 +1072,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-mixed u32mod u32assert assertz - push.7 - movup.7 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -963,10 +1113,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-mixed u32mod u32assert assertz - push.6 - movup.5 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -1017,10 +1164,48 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-nested exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.8 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.8 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.1048584 + movup.3 + swap.1 u32wrapping_add push.8 - dup.1 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word/foo@1.0.0::cross_ctx_account_word::intrinsics::felt::add + trace.252 + nop + push.8 + dup.2 add u32assert push.4 @@ -1029,11 +1214,6 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-nested u32mod u32assert assertz - push.8 - movup.5 - swap.1 - add - swap.1 u32divmod.4 swap.1 trace.240 @@ -1051,10 +1231,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-nested u32mod u32assert assertz - push.8 - movup.4 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -1070,10 +1247,7 @@ export.miden:cross-ctx-account-word/foo@1.0.0#process-nested u32mod u32assert assertz - push.8 - movup.3 - swap.1 - add + movup.2 swap.1 u32divmod.4 swap.1 @@ -1093,7 +1267,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048632 + push.1048608 u32wrapping_add u32divmod.4 swap.1 @@ -1128,7 +1302,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048632 + push.1048608 movup.2 swap.1 u32wrapping_add @@ -1156,3 +1330,11 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.intrinsics::felt::add + add +end + +proc.intrinsics::felt::from_u32 + nop +end + 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 83a8a1474..db7093ba3 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_account_word.wat @@ -1,14 +1,5 @@ (component (type (;0;) - (instance - (type (;0;) (func (param "a" u32) (result f32))) - (export (;0;) "from-u32" (func (type 0))) - (type (;1;) (func (param "a" f32) (param "b" f32) (result f32))) - (export (;1;) "add" (func (type 1))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;0;) (type 0))) - (type (;1;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -17,18 +8,16 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;1;) (type 1))) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) (core module (;0;) - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32) (result f32))) - (type (;2;) (func)) - (type (;3;) (func (param f32 f32 f32 f32) (result i32))) - (type (;4;) (func (param f32) (result f32))) - (type (;5;) (func (param f32 f32) (result i32))) - (type (;6;) (func (param f32 f32 f32) (result i32))) - (type (;7;) (func (param i64 f32 i32 f32 i32 i32 i32) (result i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "add" (func $miden_stdlib_sys::intrinsics::felt::extern_add (;1;) (type 1))) + (type (;0;) (func)) + (type (;1;) (func (param f32 f32 f32 f32) (result i32))) + (type (;2;) (func (param f32) (result f32))) + (type (;3;) (func (param f32 f32) (result i32))) + (type (;4;) (func (param f32 f32 f32) (result i32))) + (type (;5;) (func (param i64 f32 i32 f32 i32 i32 i32) (result i32))) + (type (;6;) (func (param f32 f32) (result f32))) + (type (;7;) (func (param i32) (result f32))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -42,36 +31,36 @@ (export "miden:cross-ctx-account-word/foo@1.0.0#process-mixed" (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed)) (export "miden:cross-ctx-account-word/foo@1.0.0#process-nested" (func $miden:cross-ctx-account-word/foo@1.0.0#process-nested)) (elem (;0;) (i32.const 1) func $cross_ctx_account_word::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;2;) (type 2)) - (func $cross_ctx_account_word::bindings::__link_custom_section_describing_imports (;3;) (type 2)) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-word (;4;) (type 3) (param f32 f32 f32 f32) (result i32) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $cross_ctx_account_word::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-word (;2;) (type 1) (param f32 f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 4 call $wit_bindgen_rt::run_ctors_once local.get 0 i32.const 1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 0 local.get 1 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 1 local.get 2 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 2 local.get 4 - i32.const 1048608 + i32.const 1048584 i32.add local.tee 4 local.get 3 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add f32.store offset=12 local.get 4 local.get 2 @@ -84,34 +73,34 @@ f32.store local.get 4 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word (;5;) (type 3) (param f32 f32 f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-another-word (;3;) (type 1) (param f32 f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 4 call $wit_bindgen_rt::run_ctors_once local.get 0 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 0 local.get 1 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 1 local.get 2 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 2 local.get 4 - i32.const 1048608 + i32.const 1048584 i32.add local.tee 4 local.get 3 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add f32.store offset=12 local.get 4 local.get 2 @@ -124,60 +113,60 @@ f32.store local.get 4 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-felt (;6;) (type 4) (param f32) (result f32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-felt (;4;) (type 2) (param f32) (result f32) call $wit_bindgen_rt::run_ctors_once local.get 0 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-pair (;7;) (type 5) (param f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-pair (;5;) (type 3) (param f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 2 call $wit_bindgen_rt::run_ctors_once local.get 0 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 0 local.get 2 - i32.const 1048608 + i32.const 1048584 i32.add local.tee 2 local.get 1 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add f32.store offset=4 local.get 2 local.get 0 f32.store local.get 2 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-triple (;8;) (type 6) (param f32 f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-triple (;6;) (type 4) (param f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 3 call $wit_bindgen_rt::run_ctors_once local.get 0 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 0 local.get 1 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 1 local.get 3 - i32.const 1048608 + i32.const 1048584 i32.add local.tee 3 local.get 2 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add f32.store offset=8 local.get 3 local.get 1 @@ -187,23 +176,23 @@ f32.store local.get 3 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed (;9;) (type 7) (param i64 f32 i32 f32 i32 i32 i32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-mixed (;7;) (type 5) (param i64 f32 i32 f32 i32 i32 i32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 7 call $wit_bindgen_rt::run_ctors_once local.get 1 i32.const 6 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 1 local.get 3 i32.const 7 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 3 local.get 7 - i32.const 1048608 + i32.const 1048584 i32.add local.tee 7 local.get 6 @@ -239,29 +228,29 @@ i64.store local.get 7 ) - (func $miden:cross-ctx-account-word/foo@1.0.0#process-nested (;10;) (type 6) (param f32 f32 f32) (result i32) + (func $miden:cross-ctx-account-word/foo@1.0.0#process-nested (;8;) (type 4) (param f32 f32 f32) (result i32) (local i32) global.get $GOT.data.internal.__memory_base local.set 3 call $wit_bindgen_rt::run_ctors_once local.get 0 i32.const 8 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 0 local.get 1 i32.const 8 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add local.set 1 local.get 3 - i32.const 1048608 + i32.const 1048584 i32.add local.tee 3 local.get 2 i32.const 8 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::add f32.store offset=8 local.get 3 local.get 1 @@ -271,11 +260,11 @@ f32.store local.get 3 ) - (func $wit_bindgen_rt::run_ctors_once (;11;) (type 2) + (func $wit_bindgen_rt::run_ctors_once (;9;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048632 + i32.const 1048608 i32.add i32.load8_u br_if 0 (;@1;) @@ -283,55 +272,50 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048632 + i32.const 1048608 i32.add i32.const 1 i32.store8 end ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00") - ) - (alias export 1 "word" (type (;2;))) - (alias export 1 "felt" (type (;3;))) - (type (;4;) (record (field "first" 3) (field "second" 3))) - (type (;5;) (record (field "x" 3) (field "y" 3) (field "z" 3))) - (type (;6;) (record (field "f" u64) (field "a" 3) (field "b" u32) (field "c" 3) (field "d" u8) (field "e" bool) (field "g" u16))) - (type (;7;) (record (field "inner" 4) (field "value" 3))) - (alias export 0 "from-u32" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 0 "add" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (core instance (;0;) - (export "from-u32" (func 0)) - (export "add" (func 1)) - ) - (core instance (;1;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 0)) + (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) + unreachable ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias core export 1 "memory" (core memory (;0;))) + (alias export 0 "word" (type (;1;))) + (alias export 0 "felt" (type (;2;))) + (type (;3;) (record (field "first" 2) (field "second" 2))) + (type (;4;) (record (field "x" 2) (field "y" 2) (field "z" 2))) + (type (;5;) (record (field "f" u64) (field "a" 2) (field "b" u32) (field "c" 2) (field "d" u8) (field "e" bool) (field "g" u16))) + (type (;6;) (record (field "inner" 3) (field "value" 2))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;7;) (func (param "input" 1) (result 1))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-word" (core func (;0;))) + (func (;0;) (type 7) (canon lift (core func 0) (memory 0))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-another-word" (core func (;1;))) + (func (;1;) (type 7) (canon lift (core func 1) (memory 0))) (type (;8;) (func (param "input" 2) (result 2))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-word" (core func (;2;))) - (func (;2;) (type 8) (canon lift (core func 2) (memory 0))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-another-word" (core func (;3;))) - (func (;3;) (type 8) (canon lift (core func 3) (memory 0))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-felt" (core func (;2;))) + (func (;2;) (type 8) (canon lift (core func 2))) (type (;9;) (func (param "input" 3) (result 3))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-felt" (core func (;4;))) - (func (;4;) (type 9) (canon lift (core func 4))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-pair" (core func (;3;))) + (func (;3;) (type 9) (canon lift (core func 3) (memory 0))) (type (;10;) (func (param "input" 4) (result 4))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-pair" (core func (;5;))) - (func (;5;) (type 10) (canon lift (core func 5) (memory 0))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-triple" (core func (;4;))) + (func (;4;) (type 10) (canon lift (core func 4) (memory 0))) (type (;11;) (func (param "input" 5) (result 5))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-triple" (core func (;6;))) - (func (;6;) (type 11) (canon lift (core func 6) (memory 0))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-mixed" (core func (;5;))) + (func (;5;) (type 11) (canon lift (core func 5) (memory 0))) (type (;12;) (func (param "input" 6) (result 6))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-mixed" (core func (;7;))) - (func (;7;) (type 12) (canon lift (core func 7) (memory 0))) - (type (;13;) (func (param "input" 7) (result 7))) - (alias core export 1 "miden:cross-ctx-account-word/foo@1.0.0#process-nested" (core func (;8;))) - (func (;8;) (type 13) (canon lift (core func 8) (memory 0))) - (alias export 1 "felt" (type (;14;))) - (alias export 1 "word" (type (;15;))) + (alias core export 0 "miden:cross-ctx-account-word/foo@1.0.0#process-nested" (core func (;6;))) + (func (;6;) (type 12) (canon lift (core func 6) (memory 0))) + (alias export 0 "felt" (type (;13;))) + (alias export 0 "word" (type (;14;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -385,23 +369,23 @@ (type (;36;) (func (param "input" 30) (result 30))) (export (;13;) "process-nested" (func 6) (func (type 36))) ) - (instance (;2;) (instantiate 0 - (with "import-func-process-word" (func 2)) - (with "import-func-process-another-word" (func 3)) - (with "import-func-process-felt" (func 4)) - (with "import-func-process-pair" (func 5)) - (with "import-func-process-triple" (func 6)) - (with "import-func-process-mixed" (func 7)) - (with "import-func-process-nested" (func 8)) - (with "import-type-felt" (type 14)) - (with "import-type-word" (type 15)) - (with "import-type-word0" (type 2)) - (with "import-type-felt0" (type 3)) - (with "import-type-pair" (type 4)) - (with "import-type-triple" (type 5)) - (with "import-type-mixed-struct" (type 6)) - (with "import-type-nested-struct" (type 7)) + (instance (;1;) (instantiate 0 + (with "import-func-process-word" (func 0)) + (with "import-func-process-another-word" (func 1)) + (with "import-func-process-felt" (func 2)) + (with "import-func-process-pair" (func 3)) + (with "import-func-process-triple" (func 4)) + (with "import-func-process-mixed" (func 5)) + (with "import-func-process-nested" (func 6)) + (with "import-type-felt" (type 13)) + (with "import-type-word" (type 14)) + (with "import-type-word0" (type 1)) + (with "import-type-felt0" (type 2)) + (with "import-type-pair" (type 3)) + (with "import-type-triple" (type 4)) + (with "import-type-mixed-struct" (type 5)) + (with "import-type-nested-struct" (type 6)) ) ) - (export (;3;) "miden:cross-ctx-account-word/foo@1.0.0" (instance 2)) + (export (;2;) "miden:cross-ctx-account-word/foo@1.0.0" (instance 1)) ) 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 298a9236c..a57e0a26d 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,67 @@ 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]; - 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]; - 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]; - 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]; - 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]; + v17 = arith.constant 1 : i32; + v18 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v17) : felt + v19 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v0, v18) : felt + v20 = arith.constant 2 : i32; + v21 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v20) : felt + v22 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v1, v21) : felt + v23 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v19, v22) : felt + v24 = arith.constant 4 : i32; + v25 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v24) : felt + v26 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v2, v25) : felt + v27 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v23, v26) : felt + v28 = arith.constant 8 : i32; + v29 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v28) : felt + v30 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v3, v29) : felt + v31 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v27, v30) : felt + v32 = arith.constant 16 : i32; + v33 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v32) : felt + v34 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v4, v33) : felt + v35 = arith.constant 32 : i32; + v36 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v35) : felt + v37 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v5, v36) : felt + v38 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v34, v37) : felt + v39 = arith.constant 64 : i32; + v40 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v39) : felt + v41 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v6, v40) : felt + v42 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v38, v41) : felt + v43 = arith.constant 128 : i32; + v44 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v43) : felt + v45 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v7, v44) : felt + v46 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v42, v45) : felt + v47 = arith.constant 256 : i32; + v48 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v47) : felt + v49 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v8, v48) : felt + v50 = arith.constant 512 : i32; + v51 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v50) : felt + v52 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v9, v51) : felt + v53 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v49, v52) : felt + v54 = arith.constant 1024 : i32; + v55 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v54) : felt + v56 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v10, v55) : felt + v57 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v53, v56) : felt + v58 = arith.constant 2048 : i32; + v59 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v58) : felt + v60 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v11, v59) : felt + v61 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v57, v60) : felt + v62 = arith.constant 4096 : i32; + v63 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v62) : felt + v64 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v12, v63) : felt + v65 = arith.constant 8192 : i32; + v66 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v65) : felt + v67 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v13, v66) : felt + v68 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v64, v67) : felt + v69 = arith.constant 16384 : i32; + v70 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::from_u32(v69) : felt + v71 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::mul(v14, v70) : felt + v72 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v68, v71) : felt + v73 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v31, v46) : felt + v74 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v73, v61) : felt + v75 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v74, v72) : felt + v129 = hir.load_local : felt #[local = lv0]; + v76 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/intrinsics::felt::add(v75, v129) : felt builtin.ret v76; }; @@ -68,7 +83,7 @@ builtin.component miden:cross-ctx-account-word-arg/foo@1.0.0 { v78 = builtin.global_symbol @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/GOT.data.internal.__memory_base : ptr v79 = hir.bitcast v78 : ptr; v80 = hir.load v79 : i32; - v81 = arith.constant 1048604 : i32; + v81 = arith.constant 1048584 : i32; v82 = arith.add v80, v81 : i32 #[overflow = wrapping]; v83 = hir.bitcast v82 : u32; v84 = hir.int_to_ptr v83 : ptr; @@ -86,17 +101,35 @@ 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 1048604 : i32; - v94 = arith.add v92, v137 : i32 #[overflow = wrapping]; + v131 = arith.constant 1 : u8; + v133 = arith.constant 1048584 : i32; + v94 = arith.add v92, v133 : i32 #[overflow = wrapping]; v98 = hir.bitcast v94 : u32; v99 = hir.int_to_ptr v98 : ptr; - hir.store v99, v135; + hir.store v99, v131; scf.yield ; }; builtin.ret ; }; + private builtin.function @intrinsics::felt::add(v100: felt, v101: felt) -> felt { + ^block15(v100: felt, v101: felt): + v102 = arith.add v100, v101 : felt #[overflow = unchecked]; + builtin.ret v102; + }; + + private builtin.function @intrinsics::felt::from_u32(v104: i32) -> felt { + ^block17(v104: i32): + v105 = hir.bitcast v104 : felt; + builtin.ret v105; + }; + + private builtin.function @intrinsics::felt::mul(v107: felt, v108: felt) -> felt { + ^block19(v107: felt, v108: felt): + v109 = arith.mul v107, v108 : felt #[overflow = unchecked]; + builtin.ret v109; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -105,12 +138,12 @@ builtin.component miden:cross-ctx-account-word-arg/foo@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000000000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000000000000100000001; }; - public builtin.function @process-word(v100: felt, v101: felt, v102: felt, v103: felt, v104: felt, v105: felt, v106: felt, v107: felt, v108: felt, v109: felt, v110: felt, v111: felt, v112: felt, v113: felt, v114: felt, v115: felt) -> felt { - ^block15(v100: felt, v101: felt, v102: felt, v103: felt, v104: felt, v105: felt, v106: felt, v107: felt, v108: felt, v109: felt, v110: felt, v111: felt, v112: felt, v113: felt, v114: felt, v115: felt): - v116 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/miden:cross-ctx-account-word-arg/foo@1.0.0#process-word(v100, v101, v102, v103, v104, v105, v106, v107, v108, v109, v110, v111, v112, v113, v114, v115) : felt - builtin.ret v116; + public builtin.function @process-word(v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt) -> felt { + ^block21(v111: felt, v112: felt, v113: felt, v114: felt, v115: felt, v116: felt, v117: felt, v118: felt, v119: felt, v120: felt, v121: felt, v122: felt, v123: felt, v124: felt, v125: felt, v126: felt): + v127 = hir.exec @miden:cross-ctx-account-word-arg/foo@1.0.0/cross_ctx_account_word_arg/miden:cross-ctx-account-word-arg/foo@1.0.0#process-word(v111, v112, v113, v114, v115, v116, v117, v118, v119, v120, v121, v122, v123, v124, v125, v126) : felt + builtin.ret v127; }; }; \ No newline at end of file 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 1d54e9524..03443e74d 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 @@ -15,13 +15,13 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.12642424670700610466 - push.726580607729070103 - push.14722180543335400972 - push.3395382036106606298 + push.7028007876379170725 + push.18060021366771303825 + push.13412364500725888848 + push.14178532912296021363 adv.push_mapval push.262144 - push.2 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 @@ -59,80 +59,271 @@ export.miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1 exec.::intrinsics::mem::store_felt trace.252 nop - push.16384 - movup.15 - swap.1 - mul - push.8192 - movup.15 + push.1 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop swap.1 - mul - push.4096 - movup.15 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop + push.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - add - add - push.2048 - movup.13 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.1024 - movup.13 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.8 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.512 - movup.13 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.16 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.2 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop + push.32 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.256 - movup.13 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.64 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - add - add - add + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop push.128 - movup.10 - swap.1 - mul - push.64 - movup.10 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.32 - movup.10 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.256 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop + push.512 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.16 - movup.10 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.1024 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - add - add - add - push.8 - movup.7 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.2048 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.4 - movup.7 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.4096 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.4 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop + push.8192 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.2 - movup.7 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + push.16384 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.5 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::mul + trace.252 + nop swap.1 - mul - push.1 - movup.7 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + movup.2 + movup.3 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + movup.2 swap.1 - mul - add - add - add - add - add - add + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop locaddr.0 push.0 swap.1 @@ -141,7 +332,12 @@ export.miden:cross-ctx-account-word-arg/foo@1.0.0#process-word.1 exec.::intrinsics::mem::load_felt trace.252 nop - add + swap.1 + trace.240 + nop + exec.::miden:cross-ctx-account-word-arg/foo@1.0.0::cross_ctx_account_word_arg::intrinsics::felt::add + trace.252 + nop end proc.wit_bindgen_rt::run_ctors_once @@ -153,7 +349,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048604 + push.1048584 u32wrapping_add u32divmod.4 swap.1 @@ -188,7 +384,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048604 + push.1048584 movup.2 swap.1 u32wrapping_add @@ -216,3 +412,15 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.intrinsics::felt::add + add +end + +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::mul + mul +end + 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 685b8a4e2..bf5675f27 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 @@ -1,15 +1,5 @@ (component (type (;0;) - (instance - (type (;0;) (func (param "a" u32) (result f32))) - (export (;0;) "from-u32" (func (type 0))) - (type (;1;) (func (param "a" f32) (param "b" f32) (result f32))) - (export (;1;) "add" (func (type 1))) - (export (;2;) "mul" (func (type 1))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;0;) (type 0))) - (type (;1;) (instance (type (;0;) (record (field "inner" f32))) (export (;1;) "felt" (type (eq 0))) @@ -18,15 +8,12 @@ (export (;4;) "word" (type (eq 3))) ) ) - (import "miden:base/core-types@1.0.0" (instance (;1;) (type 1))) + (import "miden:base/core-types@1.0.0" (instance (;0;) (type 0))) (core module (;0;) - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32) (result f32))) - (type (;2;) (func)) - (type (;3;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "mul" (func $miden_stdlib_sys::intrinsics::felt::extern_mul (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "add" (func $miden_stdlib_sys::intrinsics::felt::extern_add (;2;) (type 1))) + (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))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -34,100 +21,100 @@ (export "memory" (memory 0)) (export "miden:cross-ctx-account-word-arg/foo@1.0.0#process-word" (func $miden:cross-ctx-account-word-arg/foo@1.0.0#process-word)) (elem (;0;) (i32.const 1) func $cross_ctx_account_word_arg::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;3;) (type 2)) - (func $cross_ctx_account_word_arg::bindings::__link_custom_section_describing_imports (;4;) (type 2)) - (func $miden:cross-ctx-account-word-arg/foo@1.0.0#process-word (;5;) (type 3) (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32) + (func $__wasm_call_ctors (;0;) (type 0)) + (func $cross_ctx_account_word_arg::bindings::__link_custom_section_describing_imports (;1;) (type 0)) + (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 $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul local.get 1 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 2 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 3 i32.const 8 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.set 3 local.get 4 i32.const 16 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul local.get 5 i32.const 32 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 6 i32.const 64 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 7 i32.const 128 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.set 7 local.get 8 i32.const 256 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul local.get 9 i32.const 512 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 10 i32.const 1024 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 11 i32.const 2048 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.set 11 local.get 12 i32.const 4096 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul local.get 13 i32.const 8192 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.get 14 i32.const 16384 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_mul - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::from_u32 + call $intrinsics::felt::mul + call $intrinsics::felt::add local.set 14 local.get 3 local.get 7 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::add local.get 11 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::add local.get 14 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::add local.get 15 - call $miden_stdlib_sys::intrinsics::felt::extern_add + call $intrinsics::felt::add ) - (func $wit_bindgen_rt::run_ctors_once (;6;) (type 2) + (func $wit_bindgen_rt::run_ctors_once (;3;) (type 0) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048604 + i32.const 1048584 i32.add i32.load8_u br_if 0 (;@1;) @@ -135,37 +122,32 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048604 + i32.const 1048584 i32.add i32.const 1 i32.store8 end ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00") - ) - (alias export 1 "word" (type (;2;))) - (alias export 1 "felt" (type (;3;))) - (alias export 0 "from-u32" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 0 "mul" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (alias export 0 "add" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (core instance (;0;) - (export "from-u32" (func 0)) - (export "mul" (func 1)) - (export "add" (func 2)) - ) - (core instance (;1;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 0)) + (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) + unreachable + ) + (func $intrinsics::felt::mul (;6;) (type 2) (param f32 f32) (result f32) + unreachable ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00") ) - (alias core export 1 "memory" (core memory (;0;))) - (type (;4;) (func (param "input1" 2) (param "input2" 2) (param "input3" 2) (param "felt1" 3) (param "felt2" 3) (param "felt3" 3) (param "felt4" 3) (result 3))) - (alias core export 1 "miden:cross-ctx-account-word-arg/foo@1.0.0#process-word" (core func (;3;))) - (func (;3;) (type 4) (canon lift (core func 3))) - (alias export 1 "felt" (type (;5;))) - (alias export 1 "word" (type (;6;))) + (alias export 0 "word" (type (;1;))) + (alias export 0 "felt" (type (;2;))) + (core instance (;0;) (instantiate 0)) + (alias core export 0 "memory" (core memory (;0;))) + (type (;3;) (func (param "input1" 1) (param "input2" 1) (param "input3" 1) (param "felt1" 2) (param "felt2" 2) (param "felt3" 2) (param "felt4" 2) (result 2))) + (alias core export 0 "miden:cross-ctx-account-word-arg/foo@1.0.0#process-word" (core func (;0;))) + (func (;0;) (type 3) (canon lift (core func 0))) + (alias export 0 "felt" (type (;4;))) + (alias export 0 "word" (type (;5;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -181,13 +163,13 @@ (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))) ) - (instance (;2;) (instantiate 0 - (with "import-func-process-word" (func 3)) - (with "import-type-felt" (type 5)) - (with "import-type-word" (type 6)) - (with "import-type-word0" (type 2)) - (with "import-type-felt0" (type 3)) + (instance (;1;) (instantiate 0 + (with "import-func-process-word" (func 0)) + (with "import-type-felt" (type 4)) + (with "import-type-word" (type 5)) + (with "import-type-word0" (type 1)) + (with "import-type-felt0" (type 2)) ) ) - (export (;3;) "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance 2)) + (export (;2;) "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance 1)) ) diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.hir b/tests/integration/expected/rust_sdk/cross_ctx_note.hir index 74d8854e7..10d5ce8af 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.hir @@ -22,7 +22,7 @@ builtin.component miden:base/note-script@1.0.0 { v9 = hir.bitcast v8 : ptr; v10 = hir.load v9 : i32; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/wit_bindgen_rt::run_ctors_once() - v11 = arith.constant 1048608 : i32; + v11 = arith.constant 1048588 : i32; v12 = arith.add v10, v11 : i32 #[overflow = wrapping]; v13 = hir.bitcast v12 : u32; v14 = arith.constant 4 : u32; @@ -30,17 +30,19 @@ builtin.component miden:base/note-script@1.0.0 { 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; + v18 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::from_u32(v17) : felt + v19 = arith.constant 11 : i32; + v20 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::from_u32(v19) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::assert_eq(v18, v20) 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; + v22 = arith.constant 53 : i32; + v23 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::from_u32(v22) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::assert_eq(v21, v23) + v24 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/intrinsics::felt::as_u64(v21) : i64 v27 = hir.bitcast v12 : u32; - v60 = arith.constant 4 : u32; - v29 = arith.mod v27, v60 : u32; + v66 = arith.constant 4 : u32; + v29 = arith.mod v27, v66 : 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; @@ -53,7 +55,7 @@ builtin.component miden:base/note-script@1.0.0 { 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 1048612 : 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; @@ -71,17 +73,35 @@ builtin.component miden:base/note-script@1.0.0 { v45 = hir.bitcast v44 : ptr; v46 = hir.load v45 : i32; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/__wasm_call_ctors() - v62 = arith.constant 1 : u8; - v64 = arith.constant 1048612 : i32; - v48 = arith.add v46, v64 : i32 #[overflow = wrapping]; + v68 = arith.constant 1 : u8; + v70 = arith.constant 1048592 : i32; + v48 = arith.add v46, v70 : i32 #[overflow = wrapping]; v52 = hir.bitcast v48 : u32; v53 = hir.int_to_ptr v52 : ptr; - hir.store v53, v62; + hir.store v53, v68; scf.yield ; }; builtin.ret ; }; + private builtin.function @intrinsics::felt::from_u32(v54: i32) -> felt { + ^block18(v54: i32): + v55 = hir.bitcast v54 : felt; + builtin.ret v55; + }; + + private builtin.function @intrinsics::felt::as_u64(v57: felt) -> i64 { + ^block20(v57: felt): + v58 = hir.cast v57 : i64; + builtin.ret v58; + }; + + private builtin.function @intrinsics::felt::assert_eq(v60: felt, v61: felt) { + ^block22(v60: felt, v61: felt): + hir.assert_eq v60, v61; + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -90,12 +110,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000000000000000000000000000b0000000100000001000000010000000100000001000000010000000100000001; + 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(v62: felt, v63: felt, v64: felt, v65: felt) { + ^block24(v62: felt, v63: felt, v64: felt, v65: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note/miden:base/note-script@1.0.0#run(v62, v63, v64, v65) 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 3a6de7d06..3bd00b4af 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.masm @@ -15,23 +15,23 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.1541034006978960305 - push.16592812514187420570 - push.4244443566959297210 - push.14820998509107190076 + push.10615597203579269634 + push.13770205199844343813 + push.15841743244050277340 + push.1132879909491380236 adv.push_mapval push.262144 - push.3 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 drop push.1048576 u32assert - mem_store.278544 + mem_store.278536 push.0 u32assert - mem_store.278545 + mem_store.278537 end # mod miden:base/note-script@1.0.0::cross_ctx_note @@ -57,7 +57,7 @@ export.miden:base/note-script@1.0.0#run drop drop drop - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -70,7 +70,7 @@ export.miden:base/note-script@1.0.0#run exec.::miden:base/note-script@1.0.0::cross_ctx_note::wit_bindgen_rt::run_ctors_once trace.252 nop - push.1048608 + push.1048588 u32wrapping_add dup.0 push.4 @@ -86,28 +86,53 @@ export.miden:base/note-script@1.0.0#run exec.::intrinsics::mem::load_sw trace.252 nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::from_u32 + trace.252 + nop push.11 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::from_u32 + trace.252 + nop dup.1 - swap.1 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::assert_eq + trace.252 + nop trace.240 nop exec.::miden:base/note-script@1.0.0::cross_ctx_note::cross_ctx_note::bindings::miden::cross_ctx_account::foo::process_felt::wit_import1 trace.252 nop push.53 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::from_u32 + trace.252 + nop dup.1 - swap.1 - assert_eq - swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::assert_eq + trace.252 + nop + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note::intrinsics::felt::as_u64 + trace.252 + nop + movup.2 push.4 dup.1 swap.1 u32mod u32assert assertz - swap.1 - u32split + movdn.2 drop swap.1 u32divmod.4 @@ -120,7 +145,7 @@ export.miden:base/note-script@1.0.0#run end proc.wit_bindgen_rt::run_ctors_once - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -128,7 +153,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048612 + push.1048592 u32wrapping_add u32divmod.4 swap.1 @@ -149,7 +174,7 @@ proc.wit_bindgen_rt::run_ctors_once if.true nop else - push.1114180 + push.1114148 u32divmod.4 swap.1 trace.240 @@ -163,7 +188,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048612 + push.1048592 movup.2 swap.1 u32wrapping_add @@ -191,3 +216,15 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::as_u64 + u32split +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + diff --git a/tests/integration/expected/rust_sdk/cross_ctx_note.wat b/tests/integration/expected/rust_sdk/cross_ctx_note.wat index 1eac4b6b5..a25bea82e 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note.wat @@ -19,28 +19,14 @@ ) ) (import "miden:cross-ctx-account/foo@1.0.0" (instance (;1;) (type 2))) - (type (;3;) - (instance - (type (;0;) (func (param "a" u32) (result f32))) - (export (;0;) "from-u32" (func (type 0))) - (type (;1;) (func (param "a" f32) (result u64))) - (export (;1;) "as-u64" (func (type 1))) - (type (;2;) (func (param "a" f32) (param "b" f32))) - (export (;2;) "assert-eq" (func (type 2))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;2;) (type 3))) (core module (;0;) - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32))) - (type (;2;) (func (param f32) (result f32))) - (type (;3;) (func (param f32) (result i64))) - (type (;4;) (func)) - (type (;5;) (func (param f32 f32 f32 f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;1;) (type 1))) - (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 (;2;) (type 2))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "as-u64" (func $miden_stdlib_sys::intrinsics::felt::extern_as_u64 (;3;) (type 3))) + (type (;0;) (func (param f32) (result f32))) + (type (;1;) (func)) + (type (;2;) (func (param f32 f32 f32 f32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32) (result i64))) + (type (;5;) (func (param f32 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) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -48,39 +34,39 @@ (export "memory" (memory 0)) (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $cross_ctx_note::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;4;) (type 4)) - (func $cross_ctx_note::bindings::__link_custom_section_describing_imports (;5;) (type 4)) - (func $miden:base/note-script@1.0.0#run (;6;) (type 5) (param f32 f32 f32 f32) + (func $__wasm_call_ctors (;1;) (type 1)) + (func $cross_ctx_note::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) (local i32 f32) global.get $GOT.data.internal.__memory_base local.set 4 call $wit_bindgen_rt::run_ctors_once local.get 4 - i32.const 1048608 + i32.const 1048588 i32.add local.tee 4 i32.load - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.tee 5 i32.const 11 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + 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 $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 4 local.get 5 - call $miden_stdlib_sys::intrinsics::felt::extern_as_u64 + call $intrinsics::felt::as_u64 i64.store32 ) - (func $wit_bindgen_rt::run_ctors_once (;7;) (type 4) + (func $wit_bindgen_rt::run_ctors_once (;4;) (type 1) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048612 + i32.const 1048592 i32.add i32.load8_u br_if 0 (;@1;) @@ -88,42 +74,39 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048612 + i32.const 1048592 i32.add i32.const 1 i32.store8 end ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\0b\00\00\00") + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::as_u64 (;6;) (type 4) (param f32) (result i64) + unreachable + ) + (func $intrinsics::felt::assert_eq (;7;) (type 5) (param f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\0b\00\00\00") ) - (alias export 0 "word" (type (;4;))) - (alias export 2 "from-u32" (func (;0;))) + (alias export 0 "word" (type (;3;))) + (alias export 1 "process-felt" (func (;0;))) (core func (;0;) (canon lower (func 0))) - (alias export 2 "assert-eq" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (alias export 2 "as-u64" (func (;2;))) - (core func (;2;) (canon lower (func 2))) (core instance (;0;) - (export "from-u32" (func 0)) - (export "assert-eq" (func 1)) - (export "as-u64" (func 2)) - ) - (alias export 1 "process-felt" (func (;3;))) - (core func (;3;) (canon lower (func 3))) - (core instance (;1;) - (export "process-felt" (func 3)) + (export "process-felt" (func 0)) ) - (core instance (;2;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 0)) - (with "miden:cross-ctx-account/foo@1.0.0" (instance 1)) + (core instance (;1;) (instantiate 0 + (with "miden:cross-ctx-account/foo@1.0.0" (instance 0)) ) ) - (alias core export 2 "memory" (core memory (;0;))) - (type (;5;) (func (param "arg" 4))) - (alias core export 2 "miden:base/note-script@1.0.0#run" (core func (;4;))) - (func (;4;) (type 5) (canon lift (core func 4))) - (alias export 0 "felt" (type (;6;))) - (alias export 0 "word" (type (;7;))) + (alias core export 1 "memory" (core memory (;0;))) + (type (;4;) (func (param "arg" 3))) + (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;1;))) + (func (;1;) (type 4) (canon lift (core func 1))) + (alias export 0 "felt" (type (;5;))) + (alias export 0 "word" (type (;6;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -137,12 +120,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;3;) (instantiate 0 - (with "import-func-run" (func 4)) - (with "import-type-felt" (type 6)) - (with "import-type-word" (type 7)) - (with "import-type-word0" (type 4)) + (instance (;2;) (instantiate 0 + (with "import-func-run" (func 1)) + (with "import-type-felt" (type 5)) + (with "import-type-word" (type 6)) + (with "import-type-word0" (type 3)) ) ) - (export (;4;) "miden:base/note-script@1.0.0" (instance 3)) + (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) ) 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 1a43245b7..c5701fa93 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.hir @@ -5,28 +5,28 @@ builtin.component miden:base/note-script@1.0.0 { 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)]; 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]; + v519 = arith.constant 0 : i32; + v520 = arith.constant 0 : i32; + v12 = arith.add v10, v520 : i32 #[overflow = unchecked]; + v14 = arith.add v12, v519 : i32 #[overflow = unchecked]; v15 = hir.int_to_ptr v14 : ptr; hir.store v15, v5; - v510 = arith.constant 0 : i32; + v518 = 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]; + v19 = arith.add v17, v518 : i32 #[overflow = unchecked]; v20 = hir.int_to_ptr v19 : ptr; hir.store v20, v6; - v509 = arith.constant 0 : i32; + v517 = 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]; + v24 = arith.add v22, v517 : i32 #[overflow = unchecked]; v25 = hir.int_to_ptr v24 : ptr; hir.store v25, v7; - v508 = arith.constant 0 : i32; + v516 = 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]; + v29 = arith.add v27, v516 : i32 #[overflow = unchecked]; v30 = hir.int_to_ptr v29 : ptr; hir.store v30, v8; builtin.ret ; @@ -37,28 +37,28 @@ builtin.component miden:base/note-script@1.0.0 { 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]; + v524 = arith.constant 0 : i32; + v525 = arith.constant 0 : i32; + v43 = arith.add v41, v525 : i32 #[overflow = unchecked]; + v45 = arith.add v43, v524 : i32 #[overflow = unchecked]; v46 = hir.int_to_ptr v45 : ptr; hir.store v46, v36; - v515 = arith.constant 0 : i32; + v523 = 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]; + v50 = arith.add v48, v523 : i32 #[overflow = unchecked]; v51 = hir.int_to_ptr v50 : ptr; hir.store v51, v37; - v514 = arith.constant 0 : i32; + v522 = 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]; + v55 = arith.add v53, v522 : i32 #[overflow = unchecked]; v56 = hir.int_to_ptr v55 : ptr; hir.store v56, v38; - v513 = arith.constant 0 : i32; + v521 = 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]; + v60 = arith.add v58, v521 : i32 #[overflow = unchecked]; v61 = hir.int_to_ptr v60 : ptr; hir.store v61, v39; builtin.ret ; @@ -73,16 +73,16 @@ builtin.component miden:base/note-script@1.0.0 { 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)]; - v519 = arith.constant 0 : i32; + v527 = 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]; + v72 = arith.add v70, v527 : i32 #[overflow = unchecked]; v73 = hir.int_to_ptr v72 : ptr; hir.store v73, v67; - v518 = arith.constant 0 : i32; + v526 = 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]; + v77 = arith.add v75, v526 : i32 #[overflow = unchecked]; v78 = hir.int_to_ptr v77 : ptr; hir.store v78, v68; builtin.ret ; @@ -91,22 +91,22 @@ builtin.component miden:base/note-script@1.0.0 { 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; + v530 = 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]; + v89 = arith.add v87, v530 : i32 #[overflow = unchecked]; v90 = hir.int_to_ptr v89 : ptr; hir.store v90, v83; - v521 = arith.constant 0 : i32; + v529 = 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]; + v94 = arith.add v92, v529 : i32 #[overflow = unchecked]; v95 = hir.int_to_ptr v94 : ptr; hir.store v95, v84; - v520 = arith.constant 0 : i32; + v528 = 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]; + v99 = arith.add v97, v528 : i32 #[overflow = unchecked]; v100 = hir.int_to_ptr v99 : ptr; hir.store v100, v85; builtin.ret ; @@ -120,10 +120,10 @@ builtin.component miden:base/note-script@1.0.0 { v117 = arith.add v108, v116 : i32 #[overflow = unchecked]; v118 = hir.int_to_ptr v117 : ptr; hir.store v118, v119; - v524 = arith.constant 0 : i32; + v532 = 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]; + v123 = arith.add v121, v532 : i32 #[overflow = unchecked]; v124 = hir.int_to_ptr v123 : ptr; hir.store v124, v110; v128 = hir.bitcast v111 : u32; @@ -131,10 +131,10 @@ builtin.component miden:base/note-script@1.0.0 { v126 = arith.add v108, v125 : i32 #[overflow = unchecked]; v127 = hir.int_to_ptr v126 : ptr; hir.store v127, v128; - v523 = arith.constant 0 : i32; + v531 = 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]; + v132 = arith.add v130, v531 : i32 #[overflow = unchecked]; v133 = hir.int_to_ptr v132 : ptr; hir.store v133, v112; v137 = hir.bitcast v113 : u8; @@ -160,22 +160,22 @@ builtin.component miden:base/note-script@1.0.0 { 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]; + v535 = arith.constant 0 : i32; + v536 = arith.constant 0 : i32; + v156 = arith.add v154, v536 : i32 #[overflow = unchecked]; + v158 = arith.add v156, v535 : i32 #[overflow = unchecked]; v159 = hir.int_to_ptr v158 : ptr; hir.store v159, v150; - v526 = arith.constant 0 : i32; + v534 = 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]; + v163 = arith.add v161, v534 : i32 #[overflow = unchecked]; v164 = hir.int_to_ptr v163 : ptr; hir.store v164, v151; - v525 = arith.constant 0 : i32; + v533 = 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]; + v168 = arith.add v166, v533 : i32 #[overflow = unchecked]; v169 = hir.int_to_ptr v168 : ptr; hir.store v169, v152; builtin.ret ; @@ -202,13 +202,17 @@ builtin.component miden:base/note-script@1.0.0 { v183 = hir.bitcast v182 : ptr; hir.store v183, v181; hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/wit_bindgen_rt::run_ctors_once() + v184 = arith.constant 2 : i32; + v185 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v184) : felt + v186 = arith.constant 3 : i32; + v187 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v186) : felt + v188 = arith.constant 4 : i32; + v189 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v188) : felt + v190 = arith.constant 5 : i32; + v191 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v190) : felt 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) + 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(v185, v187, v189, v191, v193) v195 = arith.constant 20 : u32; v194 = hir.bitcast v181 : u32; v196 = arith.add v194, v195 : u32 #[overflow = checked]; @@ -220,181 +224,198 @@ builtin.component miden:base/note-script@1.0.0 { 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; + v590 = arith.constant 4 : u32; + v205 = arith.mod v203, v590 : 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; + v589 = arith.constant 4 : u32; + v212 = arith.mod v210, v589 : 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; + v588 = arith.constant 4 : u32; + v219 = arith.mod v217, v588 : 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; + v587 = arith.constant 3 : i32; + v223 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v587) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v221, v223) + v586 = arith.constant 5 : i32; + v225 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v586) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v214, v225) + v226 = arith.constant 7 : i32; + v227 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v226) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v207, v227) + v228 = arith.constant 9 : i32; + v229 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v228) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v200, v229) + v585 = arith.constant 8 : i32; + v231 = arith.add v181, v585 : 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_import7(v185, v187, v189, v191, v231) + v584 = 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; + v234 = arith.add v232, v584 : u32 #[overflow = checked]; + v583 = arith.constant 4 : u32; + v236 = arith.mod v234, v583 : u32; hir.assertz v236 #[code = 250]; v237 = hir.int_to_ptr v234 : ptr; v238 = hir.load v237 : felt; - v607 = arith.constant 16 : u32; + v582 = 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; + v241 = arith.add v239, v582 : u32 #[overflow = checked]; + v581 = arith.constant 4 : u32; + v243 = arith.mod v241, v581 : u32; hir.assertz v243 #[code = 250]; v244 = hir.int_to_ptr v241 : ptr; v245 = hir.load v244 : felt; - v605 = arith.constant 12 : u32; + v580 = 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; + v248 = arith.add v246, v580 : u32 #[overflow = checked]; + v579 = arith.constant 4 : u32; + v250 = arith.mod v248, v579 : u32; hir.assertz v250 #[code = 250]; v251 = hir.int_to_ptr v248 : ptr; v252 = hir.load v251 : felt; - v603 = arith.constant 8 : u32; + v578 = 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; + v255 = arith.add v253, v578 : u32 #[overflow = checked]; + v577 = arith.constant 4 : u32; + v257 = arith.mod v255, v577 : 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; + v576 = arith.constant 4 : i32; + v261 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v576) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v259, v261) + v262 = arith.constant 6 : i32; + v263 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v262) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v252, v263) + v575 = arith.constant 8 : i32; + v265 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v575) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v245, v265) + v266 = arith.constant 10 : i32; + v267 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v266) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v238, v267) + v574 = arith.constant 9 : i32; + v269 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v574) : 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(v269) : felt + v271 = arith.constant 12 : i32; + v272 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v271) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v270, v272) + v573 = arith.constant 10 : i32; + v274 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v573) : felt + v275 = arith.constant 20 : i32; + v276 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v275) : felt + v572 = 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; + v280 = arith.add v278, v572 : u32 #[overflow = checked]; + v571 = arith.constant 8 : u32; + v282 = arith.mod v280, v571 : 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; + v570 = arith.constant 8 : i32; + v285 = arith.add v181, v570 : 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_pair::wit_import4(v274, v276, v285) + v569 = 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; + v288 = arith.add v286, v569 : u32 #[overflow = checked]; + v568 = arith.constant 4 : u32; + v290 = arith.mod v288, v568 : u32; hir.assertz v290 #[code = 250]; v291 = hir.int_to_ptr v288 : ptr; v292 = hir.load v291 : felt; - v593 = arith.constant 8 : u32; + v567 = 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; + v295 = arith.add v293, v567 : u32 #[overflow = checked]; + v566 = arith.constant 4 : u32; + v297 = arith.mod v295, v566 : 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; + v300 = arith.constant 14 : i32; + v301 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v300) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v299, v301) + v302 = arith.constant 24 : i32; + v303 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v302) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v292, v303) + v304 = arith.constant 100 : i32; + v305 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v304) : felt + v306 = arith.constant 200 : i32; + v307 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v306) : felt + v308 = arith.constant 300 : i32; + v309 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v308) : felt + v565 = arith.constant 8 : i32; + v311 = arith.add v181, v565 : 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_triple::wit_import5(v305, v307, v309, v311) + v564 = 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; + v314 = arith.add v312, v564 : u32 #[overflow = checked]; + v563 = arith.constant 4 : u32; + v316 = arith.mod v314, v563 : u32; hir.assertz v316 #[code = 250]; v317 = hir.int_to_ptr v314 : ptr; v318 = hir.load v317 : felt; - v588 = arith.constant 12 : u32; + v562 = 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; + v321 = arith.add v319, v562 : u32 #[overflow = checked]; + v561 = arith.constant 4 : u32; + v323 = arith.mod v321, v561 : u32; hir.assertz v323 #[code = 250]; v324 = hir.int_to_ptr v321 : ptr; v325 = hir.load v324 : felt; - v586 = arith.constant 8 : u32; + v560 = 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; + v328 = arith.add v326, v560 : u32 #[overflow = checked]; + v559 = arith.constant 4 : u32; + v330 = arith.mod v328, v559 : 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; + v333 = arith.constant 105 : i32; + v334 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v333) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v332, v334) + v335 = arith.constant 205 : i32; + v336 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v335) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v325, v336) + v337 = arith.constant 305 : i32; + v338 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v337) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v318, v338) + v340 = arith.constant -4294967302 : i64; + v341 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u64_unchecked(v340) : felt + v343 = arith.constant 50 : i32; + v344 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v343) : felt + v557 = arith.constant 8 : i32; + v349 = arith.add v181, v557 : i32 #[overflow = wrapping]; + v558 = 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 = hir.cast 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; + 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, v344, v345, v174, v558, v349) + v556 = 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; + v352 = arith.add v350, v556 : u32 #[overflow = checked]; + v555 = arith.constant 8 : u32; + v354 = arith.mod v352, v555 : u32; hir.assertz v354 #[code = 250]; v355 = hir.int_to_ptr v352 : ptr; v356 = hir.load v355 : i64; - v581 = arith.constant 0 : i32; + v554 = 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; + v362 = arith.neq v360, v554 : i1; cf.cond_br v362 ^block26, ^block27; ^block26: v364 = arith.constant 30 : u32; @@ -418,95 +439,105 @@ builtin.component miden:base/note-script@1.0.0 { 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; + v553 = arith.constant 4 : u32; + v390 = arith.mod v388, v553 : u32; hir.assertz v390 #[code = 250]; v391 = hir.int_to_ptr v388 : ptr; v392 = hir.load v391 : felt; - v579 = arith.constant 20 : u32; + v552 = 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; + v395 = arith.add v393, v552 : u32 #[overflow = checked]; + v551 = arith.constant 4 : u32; + v397 = arith.mod v395, v551 : u32; hir.assertz v397 #[code = 250]; v398 = hir.int_to_ptr v395 : ptr; v399 = hir.load v398 : i32; - v577 = arith.constant 16 : u32; + v550 = arith.constant 16 : u32; v400 = hir.bitcast v181 : u32; - v402 = arith.add v400, v577 : u32 #[overflow = checked]; - v576 = arith.constant 4 : u32; - v404 = arith.mod v402, v576 : u32; + v402 = arith.add v400, v550 : u32 #[overflow = checked]; + v549 = arith.constant 4 : u32; + v404 = arith.mod v402, v549 : u32; hir.assertz v404 #[code = 250]; v405 = hir.int_to_ptr v402 : ptr; v406 = hir.load v405 : felt; v407 = arith.constant -4294967296 : i64; - v408 = hir.cast v407 : felt; - hir.assert_eq v406, v408; + v408 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u64_unchecked(v407) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::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; + v411 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v410) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v409, v411) + v412 = arith.constant 57 : i32; + v413 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v412) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v392, v413) 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; + v415 = arith.constant 122 : i32; + v416 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v415) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v414, v416) + v548 = 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; + v420 = arith.neq v418, v548 : i1; v421 = arith.zext v420 : u32; v422 = hir.bitcast v421 : i32; - v423 = hir.bitcast v422 : felt; - hir.assert_eq v423, v536; + v423 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v422) : felt + v424 = arith.constant 1 : i32; + v425 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v424) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v423, v425) 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; - 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; + v547 = arith.constant 12 : i32; + v428 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v547) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v426, v428) + v429 = arith.constant 30 : i32; + v430 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v429) : felt + v431 = arith.constant 40 : i32; + v432 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v431) : felt + v546 = arith.constant 50 : i32; + v434 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v546) : felt + v545 = arith.constant 8 : i32; + v436 = arith.add v181, v545 : 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_nested::wit_import6(v430, v432, v434, v436) + v544 = arith.constant 16 : u32; v437 = hir.bitcast v181 : u32; - v439 = arith.add v437, v571 : u32 #[overflow = checked]; - v570 = arith.constant 4 : u32; - v441 = arith.mod v439, v570 : u32; + v439 = arith.add v437, v544 : u32 #[overflow = checked]; + v543 = arith.constant 4 : u32; + v441 = arith.mod v439, v543 : u32; hir.assertz v441 #[code = 250]; v442 = hir.int_to_ptr v439 : ptr; v443 = hir.load v442 : felt; - v569 = arith.constant 12 : u32; + v542 = arith.constant 12 : u32; v444 = hir.bitcast v181 : u32; - v446 = arith.add v444, v569 : u32 #[overflow = checked]; - v568 = arith.constant 4 : u32; - v448 = arith.mod v446, v568 : u32; + v446 = arith.add v444, v542 : u32 #[overflow = checked]; + v541 = arith.constant 4 : u32; + v448 = arith.mod v446, v541 : u32; hir.assertz v448 #[code = 250]; v449 = hir.int_to_ptr v446 : ptr; v450 = hir.load v449 : felt; - v567 = arith.constant 8 : u32; + v540 = arith.constant 8 : u32; v451 = hir.bitcast v181 : u32; - v453 = arith.add v451, v567 : u32 #[overflow = checked]; - v566 = arith.constant 4 : u32; - v455 = arith.mod v453, v566 : u32; + v453 = arith.add v451, v540 : u32 #[overflow = checked]; + v539 = arith.constant 4 : u32; + v455 = arith.mod v453, v539 : 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]; + v458 = arith.constant 38 : i32; + v459 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v458) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v457, v459) + v460 = arith.constant 48 : i32; + v461 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v460) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v450, v461) + v462 = arith.constant 58 : i32; + v463 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::from_u32(v462) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/intrinsics::felt::assert_eq(v443, v463) + v538 = arith.constant 32 : i32; + v465 = arith.add v181, v538 : 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; @@ -520,7 +551,7 @@ builtin.component miden:base/note-script@1.0.0 { 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 1048608 : 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; @@ -538,12 +569,12 @@ builtin.component miden:base/note-script@1.0.0 { v482 = hir.bitcast v481 : ptr; v483 = hir.load v482 : 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 1048608 : i32; - v485 = arith.add v483, v623 : i32 #[overflow = wrapping]; + v592 = arith.constant 1 : u8; + v594 = arith.constant 1048588 : i32; + v485 = arith.add v483, v594 : i32 #[overflow = wrapping]; v489 = hir.bitcast v485 : u32; v490 = hir.int_to_ptr v489 : ptr; - hir.store v490, v621; + hir.store v490, v592; scf.yield ; }; builtin.ret ; @@ -571,6 +602,24 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret v503; }; + private builtin.function @intrinsics::felt::from_u64_unchecked(v504: i64) -> felt { + ^block38(v504: i64): + v505 = hir.cast v504 : felt; + builtin.ret v505; + }; + + private builtin.function @intrinsics::felt::from_u32(v507: i32) -> felt { + ^block40(v507: i32): + v508 = hir.bitcast v507 : felt; + builtin.ret v508; + }; + + private builtin.function @intrinsics::felt::assert_eq(v510: felt, v511: felt) { + ^block42(v510: felt, v511: felt): + hir.assert_eq v510, v511; + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -579,12 +628,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000010000000100000001; }; - 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(v512: felt, v513: felt, v514: felt, v515: felt) { + ^block44(v512: felt, v513: felt, v514: felt, v515: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word/miden:base/note-script@1.0.0#run(v512, v513, v514, v515) 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 b656d80a3..afee39748 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.masm @@ -15,13 +15,13 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.4660167903984046333 - push.9732219132515748035 - push.17170632143226060807 - push.3805220732242151841 + push.511068398781876708 + push.4034132635148770913 + push.11946245983825022717 + push.413851799653899214 adv.push_mapval push.262144 - push.2 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 @@ -487,21 +487,49 @@ export.miden:base/note-script@1.0.0#run exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::wit_bindgen_rt::run_ctors_once trace.252 nop + push.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.3 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.4 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.5 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop push.8 - dup.1 + dup.5 swap.1 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 trace.252 nop push.20 - dup.1 + dup.5 add u32assert push.4 @@ -518,7 +546,7 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.16 - dup.2 + dup.6 add u32assert push.4 @@ -535,7 +563,7 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.12 - dup.3 + dup.7 add u32assert push.4 @@ -552,7 +580,7 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.8 - dup.4 + dup.8 add u32assert push.4 @@ -569,21 +597,61 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.3 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.5 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.7 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.9 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.8 - dup.1 + dup.5 swap.1 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 @@ -658,23 +726,90 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.4 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.6 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.8 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.10 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.9 trace.240 nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + 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 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop + push.10 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.20 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop push.8 - dup.1 + dup.3 add u32assert push.8 @@ -694,11 +829,10 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.8 - dup.1 + dup.3 swap.1 u32wrapping_add - push.20 - push.10 + swap.2 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 @@ -739,16 +873,53 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.14 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.24 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop + push.100 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.200 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.300 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop push.8 - dup.1 + dup.4 swap.1 u32wrapping_add - push.300 - push.200 - push.100 + movdn.3 + swap.2 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 @@ -806,36 +977,72 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.105 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.205 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.305 - assert_eq - push.8 - dup.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop swap.1 - u32wrapping_add - push.3 - push.0 - push.111 - push.50 - push.4294967285 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.4294967290 push.4294967294 - dup.1 - dup.1 - push.1 - push.4294967295 trace.240 nop - exec.::std::math::u64::lt + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u64_unchecked trace.252 nop - assert - mul.4294967296 - add + push.50 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.8 + dup.3 + swap.1 + u32wrapping_add + push.3 + push.0 + push.111 + push.4294967285 push.4294966295 push.4294967295 + movup.2 + swap.3 + swap.5 + swap.7 + swap.4 + swap.6 + swap.8 + movdn.2 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_mixed::wit_import4 @@ -982,56 +1189,126 @@ export.miden:base/note-script@1.0.0#run nop push.0 push.4294967295 - dup.1 - dup.1 - push.1 - push.4294967295 trace.240 nop - exec.::std::math::u64::lt + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u64_unchecked + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq trace.252 nop - assert - mul.4294967296 - add - assert_eq trace.240 nop exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::>::from trace.252 nop push.4294967295 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.57 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop trace.240 nop exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::>::from trace.252 nop push.122 - assert_eq - push.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.0 push.255 - movup.3 + movup.2 u32and neq - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop trace.240 nop exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::>::from trace.252 nop push.12 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop + push.30 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.40 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + push.50 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop push.8 - dup.1 + dup.4 swap.1 u32wrapping_add - push.50 - push.40 - push.30 + movdn.3 + swap.2 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,11 +1366,41 @@ export.miden:base/note-script@1.0.0#run trace.252 nop push.38 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.48 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.58 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word::intrinsics::felt::assert_eq + trace.252 + nop push.32 u32wrapping_add push.1114144 @@ -1120,7 +1427,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048608 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -1155,7 +1462,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048608 + push.1048588 movup.2 swap.1 u32wrapping_add @@ -1197,3 +1504,26 @@ proc.>::from u32and end +proc.intrinsics::felt::from_u64_unchecked + dup.1 + dup.1 + push.1 + push.4294967295 + trace.240 + nop + exec.::std::math::u64::lt + trace.252 + nop + assert + mul.4294967296 + add +end + +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::assert_eq + assert_eq +end + 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 e527d56ff..f397bb118 100644 --- a/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat +++ b/tests/integration/expected/rust_sdk/cross_ctx_note_word.wat @@ -41,38 +41,24 @@ ) ) (import "miden:cross-ctx-account-word/foo@1.0.0" (instance (;1;) (type 3))) - (type (;4;) - (instance - (type (;0;) (func (param "a" u64) (result f32))) - (export (;0;) "from-u64-unchecked" (func (type 0))) - (type (;1;) (func (param "a" u32) (result f32))) - (export (;1;) "from-u32" (func (type 1))) - (type (;2;) (func (param "a" f32) (param "b" f32))) - (export (;2;) "assert-eq" (func (type 2))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;2;) (type 4))) (core module (;0;) - (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (param f32 f32 f32 f32 i32))) - (type (;2;) (func (param f32 f32))) - (type (;3;) (func (param f32) (result f32))) - (type (;4;) (func (param f32 f32 i32))) - (type (;5;) (func (param f32 f32 f32 i32))) - (type (;6;) (func (param i64) (result f32))) - (type (;7;) (func (param i64 f32 i32 f32 i32 i32 i32 i32))) - (type (;8;) (func)) - (type (;9;) (func (param f32 f32 f32 f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (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_import7 (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;2;) (type 2))) - (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 (;3;) (type 1))) - (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 (;4;) (type 3))) - (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 (;5;) (type 4))) - (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 (;6;) (type 5))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u64-unchecked" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked (;7;) (type 6))) - (import "miden:cross-ctx-account-word/foo@1.0.0" "process-mixed" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4 (;8;) (type 7))) - (import "miden:cross-ctx-account-word/foo@1.0.0" "process-nested" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6 (;9;) (type 5))) + (type (;0;) (func (param f32 f32 f32 f32 i32))) + (type (;1;) (func (param f32) (result f32))) + (type (;2;) (func (param f32 f32 i32))) + (type (;3;) (func (param f32 f32 f32 i32))) + (type (;4;) (func (param i64 f32 i32 f32 i32 i32 i32 i32))) + (type (;5;) (func)) + (type (;6;) (func (param f32 f32 f32 f32))) + (type (;7;) (func (param i32) (result f32))) + (type (;8;) (func (param i64) (result f32))) + (type (;9;) (func (param f32 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-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))) + (import "miden:cross-ctx-account-word/foo@1.0.0" "process-mixed" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_mixed::wit_import4 (;5;) (type 4))) + (import "miden:cross-ctx-account-word/foo@1.0.0" "process-nested" (func $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_nested::wit_import6 (;6;) (type 3))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -80,9 +66,9 @@ (export "memory" (memory 0)) (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $cross_ctx_note_word::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;10;) (type 8)) - (func $cross_ctx_note_word::bindings::__link_custom_section_describing_imports (;11;) (type 8)) - (func $miden:base/note-script@1.0.0#run (;12;) (type 9) (param f32 f32 f32 f32) + (func $__wasm_call_ctors (;7;) (type 5)) + (func $cross_ctx_note_word::bindings::__link_custom_section_describing_imports (;8;) (type 5)) + (func $miden:base/note-script@1.0.0#run (;9;) (type 6) (param f32 f32 f32 f32) (local i32 f32 f32 f32 f32 f32 f32 f32 i32 i32 i32 i32) global.get $__stack_pointer i32.const 32 @@ -91,16 +77,16 @@ global.set $__stack_pointer call $wit_bindgen_rt::run_ctors_once i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.tee 5 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.tee 6 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.tee 7 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.tee 8 local.get 4 i32.const 8 @@ -118,20 +104,20 @@ local.get 4 f32.load offset=8 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 11 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 10 i32.const 7 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 9 i32.const 9 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 local.get 6 local.get 7 @@ -152,31 +138,31 @@ local.get 4 f32.load offset=8 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 7 i32.const 6 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 6 i32.const 8 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 10 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq i32.const 9 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 call $cross_ctx_note_word::bindings::miden::cross_ctx_account_word::foo::process_felt::wit_import1 i32.const 12 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq i32.const 10 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 5 i32.const 20 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 6 local.get 4 i64.const 0 @@ -193,18 +179,18 @@ local.get 4 f32.load offset=8 i32.const 14 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 24 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq i32.const 100 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 200 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 300 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.get 4 i32.const 8 i32.add @@ -218,22 +204,22 @@ local.get 4 f32.load offset=8 i32.const 105 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 6 i32.const 205 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 305 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq i64.const -1001 i64.const -4294967302 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked + call $intrinsics::felt::from_u64_unchecked i32.const -11 i32.const 50 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 111 i32.const 0 i32.const 3 @@ -267,42 +253,42 @@ local.get 4 f32.load offset=16 i64.const -4294967296 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u64_unchecked - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u64_unchecked + call $intrinsics::felt::assert_eq local.get 15 call $>::from i32.const -1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 57 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 14 call $>::from i32.const 122 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 13 i32.const 255 i32.and i32.const 0 i32.ne - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 12 call $>::from i32.const 12 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq i32.const 30 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 40 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 50 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.get 4 i32.const 8 i32.add @@ -316,26 +302,26 @@ local.get 4 f32.load offset=8 i32.const 38 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 6 i32.const 48 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 5 i32.const 58 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 4 i32.const 32 i32.add global.set $__stack_pointer ) - (func $wit_bindgen_rt::run_ctors_once (;13;) (type 8) + (func $wit_bindgen_rt::run_ctors_once (;10;) (type 5) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048608 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -343,29 +329,38 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048608 + i32.const 1048588 i32.add i32.const 1 i32.store8 end ) - (func $>::from (;14;) (type 0) (param i32) (result f32) + (func $>::from (;11;) (type 7) (param i32) (result f32) local.get 0 f32.reinterpret_i32 ) - (func $>::from (;15;) (type 0) (param i32) (result f32) + (func $>::from (;12;) (type 7) (param i32) (result f32) local.get 0 i32.const 65535 i32.and f32.reinterpret_i32 ) - (func $>::from (;16;) (type 0) (param i32) (result f32) + (func $>::from (;13;) (type 7) (param i32) (result f32) local.get 0 i32.const 255 i32.and f32.reinterpret_i32 ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00") + (func $intrinsics::felt::from_u64_unchecked (;14;) (type 8) (param i64) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;15;) (type 7) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;16;) (type 9) (param f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) (core module (;1;) (type (;0;) (func (param f32 f32 f32 f32 i32))) @@ -449,72 +444,60 @@ (elem (;0;) (i32.const 0) func 0 1 2 3 4 5) ) (core instance (;0;) (instantiate 1)) - (alias export 0 "word" (type (;5;))) - (alias export 2 "from-u32" (func (;0;))) - (core func (;0;) (canon lower (func 0))) - (alias export 2 "assert-eq" (func (;1;))) - (core func (;1;) (canon lower (func 1))) - (alias export 2 "from-u64-unchecked" (func (;2;))) - (core func (;2;) (canon lower (func 2))) + (alias export 0 "word" (type (;4;))) + (alias core export 0 "0" (core func (;0;))) + (alias core export 0 "1" (core func (;1;))) + (alias export 1 "process-felt" (func (;0;))) + (core func (;2;) (canon lower (func 0))) + (alias core export 0 "2" (core func (;3;))) + (alias core export 0 "3" (core func (;4;))) + (alias core export 0 "4" (core func (;5;))) + (alias core export 0 "5" (core func (;6;))) (core instance (;1;) - (export "from-u32" (func 0)) - (export "assert-eq" (func 1)) - (export "from-u64-unchecked" (func 2)) - ) - (alias core export 0 "0" (core func (;3;))) - (alias core export 0 "1" (core func (;4;))) - (alias export 1 "process-felt" (func (;3;))) - (core func (;5;) (canon lower (func 3))) - (alias core export 0 "2" (core func (;6;))) - (alias core export 0 "3" (core func (;7;))) - (alias core export 0 "4" (core func (;8;))) - (alias core export 0 "5" (core func (;9;))) - (core instance (;2;) - (export "process-word" (func 3)) - (export "process-another-word" (func 4)) - (export "process-felt" (func 5)) - (export "process-pair" (func 6)) - (export "process-triple" (func 7)) - (export "process-mixed" (func 8)) - (export "process-nested" (func 9)) + (export "process-word" (func 0)) + (export "process-another-word" (func 1)) + (export "process-felt" (func 2)) + (export "process-pair" (func 3)) + (export "process-triple" (func 4)) + (export "process-mixed" (func 5)) + (export "process-nested" (func 6)) ) - (core instance (;3;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 1)) - (with "miden:cross-ctx-account-word/foo@1.0.0" (instance 2)) + (core instance (;2;) (instantiate 0 + (with "miden:cross-ctx-account-word/foo@1.0.0" (instance 1)) ) ) - (alias core export 3 "memory" (core memory (;0;))) + (alias core export 2 "memory" (core memory (;0;))) (alias core export 0 "$imports" (core table (;0;))) - (alias export 1 "process-word" (func (;4;))) + (alias export 1 "process-word" (func (;1;))) + (core func (;7;) (canon lower (func 1) (memory 0))) + (alias export 1 "process-another-word" (func (;2;))) + (core func (;8;) (canon lower (func 2) (memory 0))) + (alias export 1 "process-pair" (func (;3;))) + (core func (;9;) (canon lower (func 3) (memory 0))) + (alias export 1 "process-triple" (func (;4;))) (core func (;10;) (canon lower (func 4) (memory 0))) - (alias export 1 "process-another-word" (func (;5;))) + (alias export 1 "process-mixed" (func (;5;))) (core func (;11;) (canon lower (func 5) (memory 0))) - (alias export 1 "process-pair" (func (;6;))) + (alias export 1 "process-nested" (func (;6;))) (core func (;12;) (canon lower (func 6) (memory 0))) - (alias export 1 "process-triple" (func (;7;))) - (core func (;13;) (canon lower (func 7) (memory 0))) - (alias export 1 "process-mixed" (func (;8;))) - (core func (;14;) (canon lower (func 8) (memory 0))) - (alias export 1 "process-nested" (func (;9;))) - (core func (;15;) (canon lower (func 9) (memory 0))) - (core instance (;4;) + (core instance (;3;) (export "$imports" (table 0)) - (export "0" (func 10)) - (export "1" (func 11)) - (export "2" (func 12)) - (export "3" (func 13)) - (export "4" (func 14)) - (export "5" (func 15)) + (export "0" (func 7)) + (export "1" (func 8)) + (export "2" (func 9)) + (export "3" (func 10)) + (export "4" (func 11)) + (export "5" (func 12)) ) - (core instance (;5;) (instantiate 2 - (with "" (instance 4)) + (core instance (;4;) (instantiate 2 + (with "" (instance 3)) ) ) - (type (;6;) (func (param "arg" 5))) - (alias core export 3 "miden:base/note-script@1.0.0#run" (core func (;16;))) - (func (;10;) (type 6) (canon lift (core func 16))) - (alias export 0 "felt" (type (;7;))) - (alias export 0 "word" (type (;8;))) + (type (;5;) (func (param "arg" 4))) + (alias core export 2 "miden:base/note-script@1.0.0#run" (core func (;13;))) + (func (;7;) (type 5) (canon lift (core func 13))) + (alias export 0 "felt" (type (;6;))) + (alias export 0 "word" (type (;7;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -528,12 +511,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;3;) (instantiate 0 - (with "import-func-run" (func 10)) - (with "import-type-felt" (type 7)) - (with "import-type-word" (type 8)) - (with "import-type-word0" (type 5)) + (instance (;2;) (instantiate 0 + (with "import-func-run" (func 7)) + (with "import-type-felt" (type 6)) + (with "import-type-word" (type 7)) + (with "import-type-word0" (type 4)) ) ) - (export (;4;) "miden:base/note-script@1.0.0" (instance 3)) + (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) ) 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 d9307407e..ff63605b4 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 @@ -19,24 +19,42 @@ builtin.component miden:base/note-script@1.0.0 { public 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; + v21 = arith.constant 1 : i32; + v22 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v21) : felt + v23 = arith.constant 2 : i32; + v24 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v23) : felt + v25 = arith.constant 3 : i32; + v26 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v25) : felt + v27 = arith.constant 4 : i32; + v28 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v27) : felt + v29 = arith.constant 5 : i32; + v30 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v29) : felt + v31 = arith.constant 6 : i32; + v32 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v31) : felt + v33 = arith.constant 7 : i32; + v34 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v33) : felt + v35 = arith.constant 8 : i32; + v36 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v35) : felt + v37 = arith.constant 9 : i32; + v38 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v37) : felt + v39 = arith.constant 10 : i32; + v40 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v39) : felt + v41 = arith.constant 11 : i32; + v42 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v41) : felt + v43 = arith.constant 12 : i32; + v44 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v43) : felt + v45 = arith.constant 13 : i32; + v46 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v45) : felt + v47 = arith.constant 14 : i32; + v48 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v47) : felt + v49 = arith.constant 15 : i32; + v50 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v49) : felt + v88 = arith.constant 7 : i32; + v52 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v88) : 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(v22, v24, v26, v28, v30, v32, v34, v36, v38, v40, v42, v44, v46, v48, v50, v52) : felt + v54 = arith.constant 458760 : i32; + v55 = hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::from_u32(v54) : felt + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/intrinsics::felt::assert_eq(v53, v55) builtin.ret ; }; @@ -45,7 +63,7 @@ builtin.component miden:base/note-script@1.0.0 { v57 = builtin.global_symbol @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/GOT.data.internal.__memory_base : ptr v58 = hir.bitcast v57 : ptr; v59 = hir.load v58 : i32; - v60 = arith.constant 1048608 : i32; + v60 = arith.constant 1048588 : i32; v61 = arith.add v59, v60 : i32 #[overflow = wrapping]; v62 = hir.bitcast v61 : u32; v63 = hir.int_to_ptr v62 : ptr; @@ -63,17 +81,29 @@ 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 1048608 : i32; - v73 = arith.add v71, v103 : i32 #[overflow = wrapping]; + v90 = arith.constant 1 : u8; + v92 = arith.constant 1048588 : i32; + v73 = arith.add v71, v92 : i32 #[overflow = wrapping]; v77 = hir.bitcast v73 : u32; v78 = hir.int_to_ptr v77 : ptr; - hir.store v78, v101; + hir.store v78, v90; scf.yield ; }; builtin.ret ; }; + private builtin.function @intrinsics::felt::from_u32(v79: i32) -> felt { + ^block18(v79: i32): + v80 = hir.bitcast v79 : felt; + builtin.ret v80; + }; + + private builtin.function @intrinsics::felt::assert_eq(v82: felt, v83: felt) { + ^block20(v82: felt, v83: felt): + hir.assert_eq v82, v83; + builtin.ret ; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; @@ -82,12 +112,12 @@ builtin.component miden:base/note-script@1.0.0 { builtin.ret_imm 0; }; - builtin.segment @1048576 = 0x0000000100000001000000010000000100000001000000010000000100000001; + builtin.segment @1048576 = 0x00000000000000010000000100000001; }; - public builtin.function @run(v79: felt, v80: felt, v81: felt, v82: felt) { - ^block18(v79: felt, v80: felt, v81: felt, v82: felt): - hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/miden:base/note-script@1.0.0#run(v79, v80, v81, v82) + public builtin.function @run(v84: felt, v85: felt, v86: felt, v87: felt) { + ^block22(v84: felt, v85: felt, v86: felt, v87: felt): + hir.exec @miden:base/note-script@1.0.0/cross_ctx_note_word_arg/miden:base/note-script@1.0.0#run(v84, v85, v86, v87) builtin.ret ; }; }; \ No newline at end of file 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 4b63bc889..5397ee635 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 @@ -15,13 +15,13 @@ export.init trace.240 exec.::intrinsics::mem::heap_init trace.252 - push.4660167903984046333 - push.9732219132515748035 - push.17170632143226060807 - push.3805220732242151841 + push.511068398781876708 + push.4034132635148770913 + push.11946245983825022717 + push.413851799653899214 adv.push_mapval push.262144 - push.2 + push.1 trace.240 exec.::std::mem::pipe_preimage_to_memory trace.252 @@ -62,36 +62,141 @@ export.miden:base/note-script@1.0.0#run exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::wit_bindgen_rt::run_ctors_once trace.252 nop + push.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.3 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.4 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.5 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.6 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop push.7 - push.15 - push.14 - push.13 - push.12 - push.11 - push.10 - push.9 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop push.8 - push.6 - push.5 - push.4 - push.3 - push.2 - push.1 - dup.14 - swap.15 - swap.6 - swap.5 - swap.4 - swap.3 - swap.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.9 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.10 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.11 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.12 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.13 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.14 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.15 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + push.7 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + movup.7 + swap.8 + movdn.7 + movup.6 + swap.9 + movdn.6 + movup.5 + swap.10 + movdn.5 + movup.4 + swap.11 + movdn.4 + movup.3 + swap.12 + movdn.3 + movup.2 + swap.13 + movdn.2 + swap.1 + swap.14 swap.1 + swap.15 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 trace.252 nop push.458760 - assert_eq + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::cross_ctx_note_word_arg::intrinsics::felt::assert_eq + trace.252 + nop end proc.wit_bindgen_rt::run_ctors_once @@ -103,7 +208,7 @@ proc.wit_bindgen_rt::run_ctors_once exec.::intrinsics::mem::load_sw trace.252 nop - push.1048608 + push.1048588 u32wrapping_add u32divmod.4 swap.1 @@ -138,7 +243,7 @@ proc.wit_bindgen_rt::run_ctors_once trace.252 nop push.1 - push.1048608 + push.1048588 movup.2 swap.1 u32wrapping_add @@ -166,3 +271,11 @@ proc.wit_bindgen_rt::run_ctors_once end end +proc.intrinsics::felt::from_u32 + nop +end + +proc.intrinsics::felt::assert_eq + 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 0772baad3..87300a44a 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 @@ -22,24 +22,13 @@ ) ) (import "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance (;1;) (type 3))) - (type (;4;) - (instance - (type (;0;) (func (param "a" u32) (result f32))) - (export (;0;) "from-u32" (func (type 0))) - (type (;1;) (func (param "a" f32) (param "b" f32))) - (export (;1;) "assert-eq" (func (type 1))) - ) - ) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance (;2;) (type 4))) (core module (;0;) - (type (;0;) (func (param i32) (result f32))) - (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))) - (type (;3;) (func)) - (type (;4;) (func (param f32 f32 f32 f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (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 (;1;) (type 1))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "assert-eq" (func $miden_stdlib_sys::intrinsics::felt::extern_assert_eq (;2;) (type 2))) + (type (;0;) (func (param f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32 f32) (result f32))) + (type (;1;) (func)) + (type (;2;) (func (param f32 f32 f32 f32))) + (type (;3;) (func (param i32) (result f32))) + (type (;4;) (func (param f32 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))) (table (;0;) 2 2 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -47,52 +36,52 @@ (export "memory" (memory 0)) (export "miden:base/note-script@1.0.0#run" (func $miden:base/note-script@1.0.0#run)) (elem (;0;) (i32.const 1) func $cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports) - (func $__wasm_call_ctors (;3;) (type 3)) - (func $cross_ctx_note_word_arg::bindings::__link_custom_section_describing_imports (;4;) (type 3)) - (func $miden:base/note-script@1.0.0#run (;5;) (type 4) (param f32 f32 f32 f32) + (func $__wasm_call_ctors (;1;) (type 1)) + (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 $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 4 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 5 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 6 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 7 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 8 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 9 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 10 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 11 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 12 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 13 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 14 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 15 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 i32.const 7 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + 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 $miden_stdlib_sys::intrinsics::felt::extern_from_u32 - call $miden_stdlib_sys::intrinsics::felt::extern_assert_eq + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq ) - (func $wit_bindgen_rt::run_ctors_once (;6;) (type 3) + (func $wit_bindgen_rt::run_ctors_once (;4;) (type 1) (local i32) block ;; label = @1 global.get $GOT.data.internal.__memory_base - i32.const 1048608 + i32.const 1048588 i32.add i32.load8_u br_if 0 (;@1;) @@ -100,39 +89,36 @@ local.set 0 call $__wasm_call_ctors local.get 0 - i32.const 1048608 + i32.const 1048588 i32.add i32.const 1 i32.store8 end ) - (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00\01\00\00\00") + (func $intrinsics::felt::from_u32 (;5;) (type 3) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;6;) (type 4) (param f32 f32) + unreachable + ) + (data $.data (;0;) (i32.const 1048576) "\01\00\00\00\01\00\00\00\01\00\00\00") ) - (alias export 0 "word" (type (;5;))) - (alias export 2 "from-u32" (func (;0;))) + (alias export 0 "word" (type (;4;))) + (alias export 1 "process-word" (func (;0;))) (core func (;0;) (canon lower (func 0))) - (alias export 2 "assert-eq" (func (;1;))) - (core func (;1;) (canon lower (func 1))) (core instance (;0;) - (export "from-u32" (func 0)) - (export "assert-eq" (func 1)) - ) - (alias export 1 "process-word" (func (;2;))) - (core func (;2;) (canon lower (func 2))) - (core instance (;1;) - (export "process-word" (func 2)) + (export "process-word" (func 0)) ) - (core instance (;2;) (instantiate 0 - (with "miden:core-intrinsics/intrinsics-felt@1.0.0" (instance 0)) - (with "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance 1)) + (core instance (;1;) (instantiate 0 + (with "miden:cross-ctx-account-word-arg/foo@1.0.0" (instance 0)) ) ) - (alias core export 2 "memory" (core memory (;0;))) - (type (;6;) (func (param "arg" 5))) - (alias core export 2 "miden:base/note-script@1.0.0#run" (core func (;3;))) - (func (;3;) (type 6) (canon lift (core func 3))) - (alias export 0 "felt" (type (;7;))) - (alias export 0 "word" (type (;8;))) + (alias core export 1 "memory" (core memory (;0;))) + (type (;5;) (func (param "arg" 4))) + (alias core export 1 "miden:base/note-script@1.0.0#run" (core func (;1;))) + (func (;1;) (type 5) (canon lift (core func 1))) + (alias export 0 "felt" (type (;6;))) + (alias export 0 "word" (type (;7;))) (component (;0;) (type (;0;) (record (field "inner" f32))) (import "import-type-felt" (type (;1;) (eq 0))) @@ -146,12 +132,12 @@ (type (;8;) (func (param "arg" 7))) (export (;1;) "run" (func 0) (func (type 8))) ) - (instance (;3;) (instantiate 0 - (with "import-func-run" (func 3)) - (with "import-type-felt" (type 7)) - (with "import-type-word" (type 8)) - (with "import-type-word0" (type 5)) + (instance (;2;) (instantiate 0 + (with "import-func-run" (func 1)) + (with "import-type-felt" (type 6)) + (with "import-type-word" (type 7)) + (with "import-type-word0" (type 4)) ) ) - (export (;4;) "miden:base/note-script@1.0.0" (instance 3)) + (export (;3;) "miden:base/note-script@1.0.0" (instance 2)) ) diff --git a/tests/integration/expected/sub_felt.hir b/tests/integration/expected/sub_felt.hir index 680f8ea1b..fd06f6d21 100644 --- a/tests/integration/expected/sub_felt.hir +++ b/tests/integration/expected/sub_felt.hir @@ -2,10 +2,16 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @sub_felt { public builtin.function @entrypoint(v0: felt, v1: felt) -> felt { ^block4(v0: felt, v1: felt): - v3 = arith.sub v0, v1 : felt #[overflow = unchecked]; + v3 = hir.exec @root_ns:root@1.0.0/sub_felt/intrinsics::felt::sub(v0, v1) : felt builtin.ret v3; }; + private builtin.function @intrinsics::felt::sub(v4: felt, v5: felt) -> felt { + ^block6(v4: felt, v5: felt): + v6 = arith.sub v4, v5 : felt #[overflow = unchecked]; + builtin.ret v6; + }; + builtin.global_variable private @#__stack_pointer : i32 { builtin.ret_imm 1048576; }; diff --git a/tests/integration/expected/sub_felt.masm b/tests/integration/expected/sub_felt.masm index b0562b4db..ecdcfbcff 100644 --- a/tests/integration/expected/sub_felt.masm +++ b/tests/integration/expected/sub_felt.masm @@ -13,6 +13,14 @@ end # mod root_ns:root@1.0.0::sub_felt export.entrypoint + trace.240 + nop + exec.::root_ns:root@1.0.0::sub_felt::intrinsics::felt::sub + trace.252 + nop +end + +proc.intrinsics::felt::sub swap.1 sub end diff --git a/tests/integration/expected/sub_felt.wat b/tests/integration/expected/sub_felt.wat index b2caac1f7..28109d06f 100644 --- a/tests/integration/expected/sub_felt.wat +++ b/tests/integration/expected/sub_felt.wat @@ -1,14 +1,16 @@ (module $sub_felt.wasm (type (;0;) (func (param f32 f32) (result f32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "sub" (func $miden_stdlib_sys::intrinsics::felt::extern_sub (;0;) (type 0))) (table (;0;) 1 1 funcref) (memory (;0;) 16) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $entrypoint (;1;) (type 0) (param f32 f32) (result f32) + (func $entrypoint (;0;) (type 0) (param f32 f32) (result f32) local.get 0 local.get 1 - call $miden_stdlib_sys::intrinsics::felt::extern_sub + call $intrinsics::felt::sub + ) + (func $intrinsics::felt::sub (;1;) (type 0) (param f32 f32) (result f32) + unreachable ) ) diff --git a/tests/integration/expected/vec_alloc_vec.hir b/tests/integration/expected/vec_alloc_vec.hir index a72bb74fd..10c30ffd4 100644 --- a/tests/integration/expected/vec_alloc_vec.hir +++ b/tests/integration/expected/vec_alloc_vec.hir @@ -1,7 +1,7 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @vec_alloc_vec { public builtin.function @entrypoint(v0: i32) -> felt { - ^block6(v0: i32): + ^block4(v0: i32): v4 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v5 = hir.bitcast v4 : ptr; v6 = hir.load v5 : i32; @@ -14,162 +14,165 @@ builtin.component root_ns:root@1.0.0 { v12 = arith.constant 4 : i32; v11 = arith.constant 12 : i32; v13 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_alloc(v11, v12) : i32 - v335 = arith.constant 0 : i32; + v338 = arith.constant 0 : i32; v2 = arith.constant 0 : i32; v15 = arith.eq v13, v2 : i1; v16 = arith.zext v15 : u32; v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v335 : i1; - v308, v309 = scf.if v19 : felt, u32 { - ^block9: - v333 = arith.constant 12 : i32; - v334 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::alloc::handle_alloc_error(v334, v333) - v300 = arith.constant 0 : u32; - v304 = ub.poison felt : felt; - scf.yield v304, v300; + v19 = arith.neq v17, v338 : i1; + v310, v311 = scf.if v19 : felt, u32 { + ^block7: + v336 = arith.constant 12 : i32; + v337 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::alloc::handle_alloc_error(v337, v336) + v302 = arith.constant 0 : u32; + v306 = ub.poison felt : felt; + scf.yield v306, v302; } else { - ^block10: + ^block8: + v20 = arith.constant 1 : i32; + v21 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v20) : felt + v22 = arith.constant 2 : i32; + v23 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v22) : felt + v24 = arith.constant 3 : i32; + v25 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/intrinsics::felt::from_u32(v24) : felt v27 = arith.constant 8 : u32; v26 = hir.bitcast v13 : u32; v28 = arith.add v26, v27 : u32 #[overflow = checked]; v29 = arith.constant 4 : u32; v30 = arith.mod v28, v29 : u32; hir.assertz v30 #[code = 250]; - v297 = arith.constant 3 : felt; v31 = hir.int_to_ptr v28 : ptr; - hir.store v31, v297; - v332 = arith.constant 4 : u32; + hir.store v31, v25; + v335 = arith.constant 4 : u32; v32 = hir.bitcast v13 : u32; - v34 = arith.add v32, v332 : u32 #[overflow = checked]; - v331 = arith.constant 4 : u32; - v36 = arith.mod v34, v331 : u32; + v34 = arith.add v32, v335 : u32 #[overflow = checked]; + v334 = arith.constant 4 : u32; + v36 = arith.mod v34, v334 : u32; hir.assertz v36 #[code = 250]; - v298 = arith.constant 2 : felt; v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v298; + hir.store v37, v23; v38 = hir.bitcast v13 : u32; - v330 = arith.constant 4 : u32; - v40 = arith.mod v38, v330 : u32; + v333 = arith.constant 4 : u32; + v40 = arith.mod v38, v333 : u32; hir.assertz v40 #[code = 250]; - v299 = arith.constant 1 : felt; v41 = hir.int_to_ptr v38 : ptr; - hir.store v41, v299; + hir.store v41, v21; v44 = arith.constant 12 : u32; v43 = hir.bitcast v8 : u32; v45 = arith.add v43, v44 : u32 #[overflow = checked]; - v329 = arith.constant 4 : u32; - v47 = arith.mod v45, v329 : u32; + v332 = arith.constant 4 : u32; + v47 = arith.mod v45, v332 : u32; hir.assertz v47 #[code = 250]; - v24 = arith.constant 3 : i32; + v331 = arith.constant 3 : i32; v48 = hir.int_to_ptr v45 : ptr; - hir.store v48, v24; - v328 = arith.constant 8 : u32; + hir.store v48, v331; + v330 = arith.constant 8 : u32; v49 = hir.bitcast v8 : u32; - v51 = arith.add v49, v328 : u32 #[overflow = checked]; - v327 = arith.constant 4 : u32; - v53 = arith.mod v51, v327 : u32; + v51 = arith.add v49, v330 : u32 #[overflow = checked]; + v329 = arith.constant 4 : u32; + v53 = arith.mod v51, v329 : u32; hir.assertz v53 #[code = 250]; v54 = hir.int_to_ptr v51 : ptr; hir.store v54, v13; - v326 = arith.constant 4 : u32; + v328 = arith.constant 4 : u32; v56 = hir.bitcast v8 : u32; - v58 = arith.add v56, v326 : u32 #[overflow = checked]; - v325 = arith.constant 4 : u32; - v60 = arith.mod v58, v325 : u32; + v58 = arith.add v56, v328 : u32 #[overflow = checked]; + v327 = arith.constant 4 : u32; + v60 = arith.mod v58, v327 : u32; hir.assertz v60 #[code = 250]; - v324 = arith.constant 3 : i32; + v326 = arith.constant 3 : i32; v61 = hir.int_to_ptr v58 : ptr; - hir.store v61, v324; - v323 = arith.constant 0 : i32; - v296 = arith.constant 3 : u32; + hir.store v61, v326; + v325 = arith.constant 0 : i32; + v301 = arith.constant 3 : u32; v63 = hir.bitcast v0 : u32; - v65 = arith.gte v63, v296 : i1; + v65 = arith.gte v63, v301 : i1; v66 = arith.zext v65 : u32; v67 = hir.bitcast v66 : i32; - v69 = arith.neq v67, v323 : i1; - v314 = scf.if v69 : felt { - ^block44: - v322 = ub.poison felt : felt; - scf.yield v322; + v69 = arith.neq v67, v325 : i1; + v316 = scf.if v69 : felt { + ^block48: + v324 = ub.poison felt : felt; + scf.yield v324; } else { - ^block11: - v295 = arith.constant 2 : u32; - v72 = arith.shl v0, v295 : i32; + ^block9: + v300 = arith.constant 2 : u32; + v72 = arith.shl v0, v300 : i32; v73 = arith.add v13, v72 : i32 #[overflow = wrapping]; v74 = hir.bitcast v73 : u32; - v321 = arith.constant 4 : u32; - v76 = arith.mod v74, v321 : u32; + v323 = arith.constant 4 : u32; + v76 = arith.mod v74, v323 : u32; hir.assertz v76 #[code = 250]; v77 = hir.int_to_ptr v74 : ptr; v78 = hir.load v77 : felt; - v319 = arith.constant 4 : i32; - v320 = arith.constant 4 : i32; - v80 = arith.add v8, v320 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::raw_vec::RawVecInner::deallocate(v80, v319, v319) - v318 = arith.constant 16 : i32; - v84 = arith.add v8, v318 : i32 #[overflow = wrapping]; + v321 = arith.constant 4 : i32; + v322 = arith.constant 4 : i32; + v80 = arith.add v8, v322 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::raw_vec::RawVecInner::deallocate(v80, v321, v321) + v320 = arith.constant 16 : i32; + v84 = arith.add v8, v320 : i32 #[overflow = wrapping]; v85 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v86 = hir.bitcast v85 : ptr; hir.store v86, v84; scf.yield v78; }; - v305 = arith.constant 1 : u32; - v317 = arith.constant 0 : u32; - v315 = cf.select v69, v317, v305 : u32; - scf.yield v314, v315; + v307 = arith.constant 1 : u32; + v319 = arith.constant 0 : u32; + v317 = cf.select v69, v319, v307 : u32; + scf.yield v316, v317; }; - v316 = arith.constant 0 : u32; - v313 = arith.eq v309, v316 : i1; - cf.cond_br v313 ^block8, ^block46(v308); - ^block8: + v318 = arith.constant 0 : u32; + v315 = arith.eq v311, v318 : i1; + cf.cond_br v315 ^block6, ^block50(v310); + ^block6: ub.unreachable ; - ^block46(v301: felt): - builtin.ret v301; + ^block50(v303: felt): + builtin.ret v303; }; private builtin.function @__rustc::__rust_alloc(v89: i32, v90: i32) -> i32 { - ^block12(v89: i32, v90: i32): + ^block10(v89: i32, v90: i32): v92 = arith.constant 1048576 : i32; v93 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::alloc(v92, v90, v89) : i32 builtin.ret v93; }; private builtin.function @__rustc::__rust_dealloc(v94: i32, v95: i32, v96: i32) { - ^block14(v94: i32, v95: i32, v96: i32): + ^block12(v94: i32, v95: i32, v96: i32): builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block16: + ^block14: builtin.ret ; }; private builtin.function @::alloc(v97: i32, v98: i32, v99: i32) -> i32 { - ^block18(v97: i32, v98: i32, v99: i32): + ^block16(v97: i32, v98: i32, v99: i32): v102 = arith.constant 16 : i32; v101 = arith.constant 0 : i32; - v337 = arith.constant 16 : u32; + v340 = arith.constant 16 : u32; v104 = hir.bitcast v98 : u32; - v106 = arith.gt v104, v337 : i1; + v106 = arith.gt v104, v340 : i1; v107 = arith.zext v106 : u32; v108 = hir.bitcast v107 : i32; v110 = arith.neq v108, v101 : i1; v111 = cf.select v110, v98, v102 : i32; - v377 = arith.constant 0 : i32; + v380 = 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, v377 : i1; - v346, v347 = scf.if v116 : i32, u32 { - ^block51: - v338 = arith.constant 0 : u32; - v342 = ub.poison i32 : i32; - scf.yield v342, v338; + v116 = arith.neq v114, v380 : i1; + v349, v350 = scf.if v116 : i32, u32 { + ^block55: + v341 = arith.constant 0 : u32; + v345 = ub.poison i32 : i32; + scf.yield v345, v341; } else { - ^block21: + ^block19: v118 = hir.exec @root_ns:root@1.0.0/vec_alloc_vec/core::ptr::alignment::Alignment::max(v98, v111) : i32 - v376 = arith.constant 0 : i32; + v379 = 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, v376 : i1; - v361 = scf.if v126 : i32 { - ^block50: - v375 = ub.poison i32 : i32; - scf.yield v375; + v126 = arith.neq v124, v379 : i1; + v364 = scf.if v126 : i32 { + ^block54: + v378 = ub.poison i32 : i32; + scf.yield v378; } else { - ^block22: - v373 = arith.constant 0 : i32; - v132 = arith.sub v373, v118 : i32 #[overflow = wrapping]; - v374 = arith.constant -1 : i32; + ^block20: + v376 = arith.constant 0 : i32; + v132 = arith.sub v376, v118 : i32 #[overflow = wrapping]; + v377 = arith.constant -1 : i32; v128 = arith.add v99, v118 : i32 #[overflow = wrapping]; - v130 = arith.add v128, v374 : i32 #[overflow = wrapping]; + v130 = arith.add v128, v377 : i32 #[overflow = wrapping]; v133 = arith.band v130, v132 : i32; v134 = hir.bitcast v97 : u32; v135 = arith.constant 4 : u32; @@ -196,51 +199,51 @@ 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; - v372 = arith.constant 0 : i32; - v140 = arith.neq v138, v372 : i1; + v375 = arith.constant 0 : i32; + v140 = arith.neq v138, v375 : i1; scf.if v140{ - ^block49: + ^block53: scf.yield ; } else { - ^block24: - v141 = hir.exec @intrinsics/mem/heap_base() : i32 + ^block22: + 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; - v371 = arith.constant 4 : u32; - v150 = arith.mod v148, v371 : u32; + v374 = arith.constant 4 : u32; + v150 = arith.mod v148, v374 : u32; hir.assertz v150 #[code = 250]; - v370 = arith.constant 16 : u32; + v373 = arith.constant 16 : u32; v143 = hir.bitcast v142 : i32; - v146 = arith.shl v143, v370 : i32; + v146 = arith.shl v143, v373 : 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; - v369 = arith.constant 4 : u32; - v156 = arith.mod v154, v369 : u32; + v372 = arith.constant 4 : u32; + v156 = arith.mod v154, v372 : u32; hir.assertz v156 #[code = 250]; v157 = hir.int_to_ptr v154 : ptr; v158 = hir.load v157 : i32; - v367 = arith.constant 0 : i32; - v368 = arith.constant -1 : i32; - v160 = arith.bxor v158, v368 : i32; + v370 = arith.constant 0 : i32; + v371 = arith.constant -1 : i32; + v160 = arith.bxor v158, v371 : 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, v367 : i1; - v360 = scf.if v167 : i32 { - ^block25: - v366 = arith.constant 0 : i32; - scf.yield v366; + v167 = arith.neq v165, v370 : i1; + v363 = scf.if v167 : i32 { + ^block23: + v369 = arith.constant 0 : i32; + scf.yield v369; } else { - ^block26: + ^block24: v169 = hir.bitcast v97 : u32; - v365 = arith.constant 4 : u32; - v171 = arith.mod v169, v365 : u32; + v368 = arith.constant 4 : u32; + v171 = arith.mod v169, v368 : u32; hir.assertz v171 #[code = 250]; v168 = arith.add v158, v133 : i32 #[overflow = wrapping]; v172 = hir.int_to_ptr v169 : ptr; @@ -248,189 +251,201 @@ builtin.component root_ns:root@1.0.0 { v174 = arith.add v158, v118 : i32 #[overflow = wrapping]; scf.yield v174; }; - scf.yield v360; + scf.yield v363; }; - v343 = arith.constant 1 : u32; - v364 = arith.constant 0 : u32; - v362 = cf.select v126, v364, v343 : u32; - scf.yield v361, v362; + v346 = arith.constant 1 : u32; + v367 = arith.constant 0 : u32; + v365 = cf.select v126, v367, v346 : u32; + scf.yield v364, v365; }; - v363 = arith.constant 0 : u32; - v359 = arith.eq v347, v363 : i1; - cf.cond_br v359 ^block20, ^block53(v346); - ^block20: + v366 = arith.constant 0 : u32; + v362 = arith.eq v350, v366 : i1; + cf.cond_br v362 ^block18, ^block57(v349); + ^block18: ub.unreachable ; - ^block53(v339: i32): - builtin.ret v339; + ^block57(v342: i32): + builtin.ret v342; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v177: i32, v178: i32, v179: i32) { - ^block27(v177: i32, v178: i32, v179: i32): - v181 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__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]; + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block25: + v177 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v177; + }; + + private builtin.function @intrinsics::felt::from_u32(v179: i32) -> felt { + ^block29(v179: i32): + v180 = hir.bitcast v179 : felt; + builtin.ret v180; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v182: i32, v183: i32, v184: i32) { + ^block31(v182: i32, v183: i32, v184: i32): v186 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr v187 = hir.bitcast v186 : ptr; - hir.store v187, v185; - v188 = arith.constant 4 : i32; - v189 = arith.add v185, v188 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::raw_vec::RawVecInner::current_memory(v189, v177, v178, v179) - v191 = arith.constant 8 : u32; - v190 = hir.bitcast v185 : 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 : i32; - v384 = arith.constant 0 : i32; - v180 = arith.constant 0 : i32; - v198 = arith.eq v196, v180 : i1; - v199 = arith.zext v198 : u32; - v200 = hir.bitcast v199 : i32; - v202 = arith.neq v200, v384 : i1; - scf.if v202{ - ^block57: + v188 = hir.load v187 : i32; + v189 = arith.constant 16 : i32; + v190 = arith.sub v188, v189 : i32 #[overflow = wrapping]; + v191 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr + v192 = hir.bitcast v191 : ptr; + hir.store v192, v190; + v193 = arith.constant 4 : i32; + v194 = arith.add v190, v193 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/alloc::raw_vec::RawVecInner::current_memory(v194, v182, v183, v184) + v196 = arith.constant 8 : u32; + v195 = hir.bitcast v190 : u32; + v197 = arith.add v195, v196 : u32 #[overflow = checked]; + v198 = arith.constant 4 : u32; + v199 = arith.mod v197, v198 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + v201 = hir.load v200 : i32; + v387 = arith.constant 0 : i32; + v185 = arith.constant 0 : i32; + v203 = arith.eq v201, v185 : i1; + v204 = arith.zext v203 : u32; + v205 = hir.bitcast v204 : i32; + v207 = arith.neq v205, v387 : i1; + scf.if v207{ + ^block61: scf.yield ; } else { - ^block30: - v383 = arith.constant 4 : u32; - v203 = hir.bitcast v185 : u32; - v205 = arith.add v203, v383 : u32 #[overflow = checked]; - v382 = arith.constant 4 : u32; - v207 = arith.mod v205, v382 : u32; - hir.assertz v207 #[code = 250]; - v208 = hir.int_to_ptr v205 : ptr; - v209 = hir.load v208 : i32; - v211 = arith.constant 12 : u32; - v210 = hir.bitcast v185 : u32; - v212 = arith.add v210, v211 : u32 #[overflow = checked]; - v381 = arith.constant 4 : u32; - v214 = arith.mod v212, v381 : u32; - hir.assertz v214 #[code = 250]; - v215 = hir.int_to_ptr v212 : ptr; - v216 = hir.load v215 : i32; - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v209, v196, v216) + ^block34: + v386 = arith.constant 4 : u32; + v208 = hir.bitcast v190 : u32; + v210 = arith.add v208, v386 : u32 #[overflow = checked]; + v385 = arith.constant 4 : u32; + v212 = arith.mod v210, v385 : u32; + hir.assertz v212 #[code = 250]; + v213 = hir.int_to_ptr v210 : ptr; + v214 = hir.load v213 : i32; + v216 = arith.constant 12 : u32; + v215 = hir.bitcast v190 : u32; + v217 = arith.add v215, v216 : u32 #[overflow = checked]; + v384 = arith.constant 4 : u32; + v219 = arith.mod v217, v384 : u32; + hir.assertz v219 #[code = 250]; + v220 = hir.int_to_ptr v217 : ptr; + v221 = hir.load v220 : i32; + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/::deallocate(v214, v201, v221) scf.yield ; }; - v380 = arith.constant 16 : i32; - v219 = arith.add v185, v380 : i32 #[overflow = wrapping]; - v220 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr - v221 = hir.bitcast v220 : ptr; - hir.store v221, v219; + v383 = arith.constant 16 : i32; + v224 = arith.add v190, v383 : i32 #[overflow = wrapping]; + v225 = builtin.global_symbol @root_ns:root@1.0.0/vec_alloc_vec/__stack_pointer : ptr + v226 = hir.bitcast v225 : ptr; + hir.store v226, v224; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v222: i32, v223: i32, v224: i32, v225: i32) { - ^block31(v222: i32, v223: i32, v224: i32, v225: i32): - v410 = arith.constant 0 : i32; - v226 = arith.constant 0 : i32; - v230 = arith.eq v225, v226 : i1; - v231 = arith.zext v230 : u32; - v232 = hir.bitcast v231 : i32; - v234 = arith.neq v232, v410 : i1; - v397, v398 = scf.if v234 : i32, i32 { - ^block60: - v409 = arith.constant 0 : i32; - v228 = arith.constant 4 : i32; - scf.yield v228, v409; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v227: i32, v228: i32, v229: i32, v230: i32) { + ^block35(v227: i32, v228: i32, v229: i32, v230: i32): + v413 = arith.constant 0 : i32; + v231 = arith.constant 0 : i32; + v235 = arith.eq v230, v231 : i1; + v236 = arith.zext v235 : u32; + v237 = hir.bitcast v236 : i32; + v239 = arith.neq v237, v413 : i1; + v400, v401 = scf.if v239 : i32, i32 { + ^block64: + v412 = arith.constant 0 : i32; + v233 = arith.constant 4 : i32; + scf.yield v233, v412; } else { - ^block34: - v235 = hir.bitcast v223 : u32; - v270 = arith.constant 4 : u32; - v237 = arith.mod v235, v270 : u32; - hir.assertz v237 #[code = 250]; - v238 = hir.int_to_ptr v235 : ptr; - v239 = hir.load v238 : i32; - v407 = arith.constant 0 : i32; - v408 = arith.constant 0 : i32; - v241 = arith.eq v239, v408 : i1; - v242 = arith.zext v241 : u32; - v243 = hir.bitcast v242 : i32; - v245 = arith.neq v243, v407 : i1; - v395 = scf.if v245 : i32 { - ^block59: - v406 = arith.constant 0 : i32; - scf.yield v406; + ^block38: + v240 = hir.bitcast v228 : u32; + v275 = arith.constant 4 : u32; + v242 = arith.mod v240, v275 : u32; + hir.assertz v242 #[code = 250]; + v243 = hir.int_to_ptr v240 : ptr; + v244 = hir.load v243 : i32; + v410 = arith.constant 0 : i32; + v411 = arith.constant 0 : i32; + v246 = arith.eq v244, v411 : i1; + v247 = arith.zext v246 : u32; + v248 = hir.bitcast v247 : i32; + v250 = arith.neq v248, v410 : i1; + v398 = scf.if v250 : i32 { + ^block63: + v409 = arith.constant 0 : i32; + scf.yield v409; } else { - ^block35: + ^block39: + v408 = arith.constant 4 : u32; + v251 = hir.bitcast v227 : u32; + v253 = arith.add v251, v408 : u32 #[overflow = checked]; + v407 = arith.constant 4 : u32; + v255 = arith.mod v253, v407 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + hir.store v256, v229; + v406 = arith.constant 4 : u32; + v257 = hir.bitcast v228 : u32; + v259 = arith.add v257, v406 : u32 #[overflow = checked]; v405 = arith.constant 4 : u32; - v246 = hir.bitcast v222 : u32; - v248 = arith.add v246, v405 : u32 #[overflow = checked]; - v404 = arith.constant 4 : u32; - v250 = arith.mod v248, v404 : u32; - hir.assertz v250 #[code = 250]; - v251 = hir.int_to_ptr v248 : ptr; - hir.store v251, v224; - v403 = arith.constant 4 : u32; - v252 = hir.bitcast v223 : u32; - v254 = arith.add v252, v403 : u32 #[overflow = checked]; - v402 = arith.constant 4 : u32; - v256 = arith.mod v254, v402 : u32; - hir.assertz v256 #[code = 250]; - v257 = hir.int_to_ptr v254 : ptr; - v258 = hir.load v257 : i32; - v259 = hir.bitcast v222 : u32; - v401 = arith.constant 4 : u32; - v261 = arith.mod v259, v401 : u32; + v261 = arith.mod v259, v405 : u32; hir.assertz v261 #[code = 250]; v262 = hir.int_to_ptr v259 : ptr; - hir.store v262, v258; - v263 = arith.mul v239, v225 : i32 #[overflow = wrapping]; - scf.yield v263; + v263 = hir.load v262 : i32; + v264 = hir.bitcast v227 : u32; + v404 = arith.constant 4 : u32; + v266 = arith.mod v264, v404 : u32; + hir.assertz v266 #[code = 250]; + v267 = hir.int_to_ptr v264 : ptr; + hir.store v267, v263; + v268 = arith.mul v244, v230 : i32 #[overflow = wrapping]; + scf.yield v268; }; - v264 = arith.constant 8 : i32; - v400 = arith.constant 4 : i32; - v396 = cf.select v245, v400, v264 : i32; - scf.yield v396, v395; + v269 = arith.constant 8 : i32; + v403 = arith.constant 4 : i32; + v399 = cf.select v250, v403, v269 : i32; + scf.yield v399, v398; }; - v267 = arith.add v222, v397 : i32 #[overflow = wrapping]; - v269 = hir.bitcast v267 : u32; - v399 = arith.constant 4 : u32; - v271 = arith.mod v269, v399 : u32; - hir.assertz v271 #[code = 250]; - v272 = hir.int_to_ptr v269 : ptr; - hir.store v272, v398; + v272 = arith.add v227, v400 : i32 #[overflow = wrapping]; + v274 = hir.bitcast v272 : u32; + v402 = arith.constant 4 : u32; + v276 = arith.mod v274, v402 : u32; + hir.assertz v276 #[code = 250]; + v277 = hir.int_to_ptr v274 : ptr; + hir.store v277, v401; builtin.ret ; }; - private builtin.function @::deallocate(v273: i32, v274: i32, v275: i32) { - ^block36(v273: i32, v274: i32, v275: i32): - v412 = arith.constant 0 : i32; - v276 = arith.constant 0 : i32; - v277 = arith.eq v275, v276 : i1; - v278 = arith.zext v277 : u32; - v279 = hir.bitcast v278 : i32; - v281 = arith.neq v279, v412 : i1; - scf.if v281{ - ^block38: + private builtin.function @::deallocate(v278: i32, v279: i32, v280: i32) { + ^block40(v278: i32, v279: i32, v280: i32): + v415 = arith.constant 0 : i32; + v281 = arith.constant 0 : i32; + v282 = arith.eq v280, v281 : i1; + v283 = arith.zext v282 : u32; + v284 = hir.bitcast v283 : i32; + v286 = arith.neq v284, v415 : i1; + scf.if v286{ + ^block42: scf.yield ; } else { - ^block39: - hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_dealloc(v273, v275, v274) + ^block43: + hir.exec @root_ns:root@1.0.0/vec_alloc_vec/__rustc::__rust_dealloc(v278, v280, v279) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::alloc::handle_alloc_error(v282: i32, v283: i32) { - ^block40(v282: i32, v283: i32): + private builtin.function @alloc::alloc::handle_alloc_error(v287: i32, v288: i32) { + ^block44(v287: i32, v288: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v284: i32, v285: i32) -> i32 { - ^block42(v284: i32, v285: i32): - v292 = arith.constant 0 : i32; - v288 = hir.bitcast v285 : u32; - v287 = hir.bitcast v284 : u32; - v289 = arith.gt v287, v288 : i1; - v290 = arith.zext v289 : u32; - v291 = hir.bitcast v290 : i32; - v293 = arith.neq v291, v292 : i1; - v294 = cf.select v293, v284, v285 : i32; - builtin.ret v294; + private builtin.function @core::ptr::alignment::Alignment::max(v289: i32, v290: i32) -> i32 { + ^block46(v289: i32, v290: i32): + v297 = arith.constant 0 : i32; + v293 = hir.bitcast v290 : u32; + v292 = hir.bitcast v289 : u32; + v294 = arith.gt v292, v293 : i1; + v295 = arith.zext v294 : u32; + v296 = hir.bitcast v295 : i32; + v298 = arith.neq v296, v297 : i1; + v299 = cf.select v298, v289, v290 : i32; + builtin.ret v299; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/tests/integration/expected/vec_alloc_vec.masm b/tests/integration/expected/vec_alloc_vec.masm index 6ded59c6e..74ae37856 100644 --- a/tests/integration/expected/vec_alloc_vec.masm +++ b/tests/integration/expected/vec_alloc_vec.masm @@ -65,8 +65,26 @@ export.entrypoint push.0 push.3735929054 else + push.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::felt::from_u32 + trace.252 + nop + push.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::felt::from_u32 + trace.252 + nop + push.3 + trace.240 + nop + exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::felt::from_u32 + trace.252 + nop push.8 - dup.1 + dup.4 add u32assert push.4 @@ -75,8 +93,6 @@ export.entrypoint u32mod u32assert assertz - push.3 - swap.1 u32divmod.4 swap.1 trace.240 @@ -85,7 +101,7 @@ export.entrypoint trace.252 nop push.4 - dup.1 + dup.3 add u32assert push.4 @@ -94,8 +110,6 @@ export.entrypoint u32mod u32assert assertz - push.2 - swap.1 u32divmod.4 swap.1 trace.240 @@ -103,15 +117,13 @@ export.entrypoint exec.::intrinsics::mem::store_felt trace.252 nop - dup.0 + dup.1 push.4 dup.1 swap.1 u32mod u32assert assertz - push.1 - swap.1 u32divmod.4 swap.1 trace.240 @@ -353,7 +365,7 @@ proc.::alloc else trace.240 nop - exec.::intrinsics::mem::heap_base + exec.::root_ns:root@1.0.0::vec_alloc_vec::intrinsics::mem::heap_base trace.252 nop trace.240 @@ -456,6 +468,18 @@ proc.::alloc end end +proc.intrinsics::mem::heap_base + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +proc.intrinsics::felt::from_u32 + nop +end + proc.alloc::raw_vec::RawVecInner::deallocate push.1114112 u32divmod.4 diff --git a/tests/integration/expected/vec_alloc_vec.wat b/tests/integration/expected/vec_alloc_vec.wat index 2eee0ecd5..2336a527b 100644 --- a/tests/integration/expected/vec_alloc_vec.wat +++ b/tests/integration/expected/vec_alloc_vec.wat @@ -1,20 +1,18 @@ (module $vec_alloc_vec.wasm (type (;0;) (func (param i32) (result f32))) - (type (;1;) (func (result i32))) - (type (;2;) (func (param i32 i32) (result i32))) - (type (;3;) (func (param i32 i32 i32))) - (type (;4;) (func)) - (type (;5;) (func (param i32 i32 i32) (result i32))) + (type (;1;) (func (param i32 i32) (result i32))) + (type (;2;) (func (param i32 i32 i32))) + (type (;3;) (func)) + (type (;4;) (func (param i32 i32 i32) (result i32))) + (type (;5;) (func (result i32))) (type (;6;) (func (param i32 i32 i32 i32))) (type (;7;) (func (param i32 i32))) - (import "miden:core-intrinsics/intrinsics-felt@1.0.0" "from-u32" (func $miden_stdlib_sys::intrinsics::felt::extern_from_u32 (;0;) (type 0))) - (import "miden:core-intrinsics/intrinsics-mem@1.0.0" "heap-base" (func $miden_sdk_alloc::heap_base (;1;) (type 1))) (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 $entrypoint (;2;) (type 0) (param i32) (result f32) + (func $entrypoint (;0;) (type 0) (param i32) (result f32) (local i32 i32 f32 f32) global.get $__stack_pointer i32.const 16 @@ -31,14 +29,14 @@ i32.eqz br_if 0 (;@2;) i32.const 1 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 3 i32.const 2 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 local.set 4 local.get 2 i32.const 3 - call $miden_stdlib_sys::intrinsics::felt::extern_from_u32 + call $intrinsics::felt::from_u32 f32.store offset=8 local.get 2 local.get 4 @@ -85,17 +83,17 @@ end unreachable ) - (func $__rustc::__rust_alloc (;3;) (type 2) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc (;1;) (type 1) (param i32 i32) (result i32) i32.const 1048576 local.get 1 local.get 0 call $::alloc ) - (func $__rustc::__rust_dealloc (;4;) (type 3) (param i32 i32 i32)) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;5;) (type 4) + (func $__rustc::__rust_dealloc (;2;) (type 2) (param i32 i32 i32)) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;3;) (type 3) return ) - (func $::alloc (;6;) (type 5) (param i32 i32 i32) (result i32) + (func $::alloc (;4;) (type 4) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -136,7 +134,7 @@ i32.load br_if 0 (;@2;) local.get 0 - call $miden_sdk_alloc::heap_base + call $intrinsics::mem::heap_base memory.size i32.const 16 i32.shl @@ -167,7 +165,13 @@ end unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;7;) (type 3) (param i32 i32 i32) + (func $intrinsics::mem::heap_base (;5;) (type 5) (result i32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;6;) (type 0) (param i32) (result f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;7;) (type 2) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -234,7 +238,7 @@ local.get 4 i32.store ) - (func $::deallocate (;9;) (type 3) (param i32 i32 i32) + (func $::deallocate (;9;) (type 2) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -248,7 +252,7 @@ (func $alloc::alloc::handle_alloc_error (;10;) (type 7) (param i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;11;) (type 2) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;11;) (type 1) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/tests/integration/src/compiler_test.rs b/tests/integration/src/compiler_test.rs index 16a398100..e94a4bb79 100644 --- a/tests/integration/src/compiler_test.rs +++ b/tests/integration/src/compiler_test.rs @@ -563,7 +563,7 @@ impl CompilerTestBuilder { panic = "abort" # optimize for size opt-level = "z" - debug = true + debug = false trim-paths = ["diagnostics", "object"] "#, sdk_alloc_path = sdk_alloc_path.display(), @@ -639,7 +639,7 @@ impl CompilerTestBuilder { panic = "abort" # optimize for size opt-level = "z" - debug = true + debug = false "#, sdk_path = sdk_path.display(), sdk_alloc_path = sdk_alloc_path.display(), diff --git a/tests/integration/src/rust_masm_tests/apps.rs b/tests/integration/src/rust_masm_tests/apps.rs index d1d5409d0..162b32cf7 100644 --- a/tests/integration/src/rust_masm_tests/apps.rs +++ b/tests/integration/src/rust_masm_tests/apps.rs @@ -40,7 +40,7 @@ fn cargo_toml(name: &str) -> String { opt-level = 1 debug-assertions = true overflow-checks = false - debug = true + debug = false "#, sdk_alloc_path = sdk_alloc_path.display(), sdk_path = sdk_path.display() diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index fa3334400..0c76b9dff 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -476,7 +476,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -516,7 +516,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -525,7 +525,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -537,7 +537,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -658,11 +658,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" 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 cfe1b8b3a..901f7da72 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 @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml index f1b1dc112..34c8e56b3 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/Cargo.toml @@ -49,9 +49,6 @@ package = "miden:cross-ctx-account-word-arg" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../../../sdk/base-sys/wit/miden-core-base.wit" } [package.metadata.cargo-machete] ignored = ["wit-bindgen-rt"] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/wit/cross-ctx-account-word.wit b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/wit/cross-ctx-account-word.wit index 7e6eb1750..92db0c2a5 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/wit/cross-ctx-account-word.wit +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word-arg/wit/cross-ctx-account-word.wit @@ -9,7 +9,5 @@ interface foo { } world foo-world { - include miden:core-intrinsics/intrinsics@1.0.0; - export foo; } 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 20fa9d385..424432ea8 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 @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml index 8c8559283..d7824e41a 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/Cargo.toml @@ -49,9 +49,6 @@ package = "miden:cross-ctx-account-word" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../../../sdk/base-sys/wit/miden-core-base.wit" } [package.metadata.cargo-machete] -ignored = ["wit-bindgen-rt"] \ No newline at end of file +ignored = ["wit-bindgen-rt"] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/wit/cross-ctx-account-word.wit b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/wit/cross-ctx-account-word.wit index d27766a3a..dfd7e7ba9 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/wit/cross-ctx-account-word.wit +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account-word/wit/cross-ctx-account-word.wit @@ -43,7 +43,5 @@ interface foo { } world foo-world { - include miden:core-intrinsics/intrinsics@1.0.0; - export foo; } 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 d3e57fd9b..ce7c7bc30 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 @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml index fe048d99f..e8f397894 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/Cargo.toml @@ -49,9 +49,6 @@ package = "miden:cross-ctx-account" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../../../sdk/base-sys/wit/miden-core-base.wit" } [package.metadata.cargo-machete] ignored = ["wit-bindgen-rt"] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/wit/cross-ctx-account.wit b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/wit/cross-ctx-account.wit index 936f30084..cc45a8ded 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/wit/cross-ctx-account.wit +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-account/wit/cross-ctx-account.wit @@ -9,7 +9,5 @@ interface foo { } world foo-world { - include miden:core-intrinsics/intrinsics@1.0.0; - export foo; } 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 391bb3002..5690612e8 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 @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml index 0b3cdf381..6a7179f85 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/Cargo.toml @@ -52,9 +52,6 @@ package = "miden:cross-ctx-note-word-arg" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../../../sdk/base-sys/wit/miden-core-base.wit" } "miden:cross-ctx-account-word-arg" = { path = "../cross-ctx-account-word-arg/wit/cross-ctx-account-word.wit" } [package.metadata.cargo-machete] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/wit/cross-ctx-note-word.wit b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/wit/cross-ctx-note-word.wit index 004df7011..c5554c8ba 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/wit/cross-ctx-note-word.wit +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word-arg/wit/cross-ctx-note-word.wit @@ -1,8 +1,6 @@ package miden:cross-ctx-note-word-arg@1.0.0; world cross-ctx-note-word-world { - include miden:core-intrinsics/intrinsics@1.0.0; - import miden:cross-ctx-account-word-arg/foo@1.0.0; export miden:base/note-script@1.0.0; } 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 51fcb6f88..3dcaed3eb 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 @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml index b5f1aa1cd..a321574e6 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/Cargo.toml @@ -52,9 +52,6 @@ project-kind = "note-script" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../../../sdk/base-sys/wit/miden-core-base.wit" } "miden:cross-ctx-account-word" = { path = "../cross-ctx-account-word/wit/cross-ctx-account-word.wit" } [package.metadata.cargo-machete] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/wit/cross-ctx-note-word.wit b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/wit/cross-ctx-note-word.wit index 92e47bc17..eade40429 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/wit/cross-ctx-note-word.wit +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note-word/wit/cross-ctx-note-word.wit @@ -1,8 +1,6 @@ package miden:cross-ctx-note-word@1.0.0; world cross-ctx-note-word-world { - include miden:core-intrinsics/intrinsics@1.0.0; - import miden:cross-ctx-account-word/foo@1.0.0; export miden:base/note-script@1.0.0; } 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 1bdcf2ad0..c149b9094 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 @@ -484,7 +484,7 @@ checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miden" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base", "miden-base-sys", @@ -524,7 +524,7 @@ dependencies = [ [[package]] name = "miden-base" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-base-macros", "miden-base-sys", @@ -533,7 +533,7 @@ dependencies = [ [[package]] name = "miden-base-macros" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-objects", "proc-macro2", @@ -545,7 +545,7 @@ dependencies = [ [[package]] name = "miden-base-sys" -version = "0.4.1" +version = "0.5.0" dependencies = [ "miden-stdlib-sys", ] @@ -666,11 +666,11 @@ dependencies = [ [[package]] name = "miden-sdk-alloc" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-stdlib-sys" -version = "0.4.1" +version = "0.5.0" [[package]] name = "miden-verifier" diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml index 6627eaa16..b78f42aa9 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/Cargo.toml @@ -52,9 +52,6 @@ package = "miden:cross-ctx-note" [package.metadata.component.target.dependencies] "miden:base" = { path = "../../../../sdk/base/wit/miden.wit" } -"miden:core-intrinsics" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-intrinsics.wit" } -"miden:core-stdlib" = { path = "../../../../sdk/stdlib-sys/wit/miden-core-stdlib.wit" } -"miden:core-base" = { path = "../../../../sdk/base-sys/wit/miden-core-base.wit" } "miden:cross-ctx-account" = { path = "../cross-ctx-account/wit/cross-ctx-account.wit" } [package.metadata.cargo-machete] diff --git a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/wit/cross-ctx-note.wit b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/wit/cross-ctx-note.wit index b1cd28b04..c2eb0aac5 100644 --- a/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/wit/cross-ctx-note.wit +++ b/tests/rust-apps-wasm/rust-sdk/cross-ctx-note/wit/cross-ctx-note.wit @@ -1,8 +1,6 @@ package miden:cross-ctx-note@1.0.0; world cross-ctx-note-world { - include miden:core-intrinsics/intrinsics@1.0.0; - import miden:cross-ctx-account/foo@1.0.0; export miden:base/note-script@1.0.0; } diff --git a/tools/cargo-miden/Cargo.toml b/tools/cargo-miden/Cargo.toml index 318bbe498..b5107b761 100644 --- a/tools/cargo-miden/Cargo.toml +++ b/tools/cargo-miden/Cargo.toml @@ -35,13 +35,7 @@ tokio.workspace = true cargo-config2 = "0.1.24" serde.workspace = true serde_json = "1.0" -miden-stdlib-sys = { version = "0.4.1", path = "../../sdk/stdlib-sys", features = [ - "wit", -] } -miden-base-sys = { version = "0.4.1", path = "../../sdk/base-sys", features = [ - "wit", -] } -miden-base = { version = "0.4.1", path = "../../sdk/base", features = ["wit"] } +miden-base = { version = "0.5.0", path = "../../sdk/base", features = ["wit"] } # from cargo-component semver.workspace = true diff --git a/tools/cargo-miden/src/commands/example_project.rs b/tools/cargo-miden/src/commands/example_project.rs index 1e61abb6f..de676e03a 100644 --- a/tools/cargo-miden/src/commands/example_project.rs +++ b/tools/cargo-miden/src/commands/example_project.rs @@ -19,13 +19,7 @@ const PAIRED_PROJECTS: &[(&str, &str)] = &[("counter-contract", "counter-note")] const TRIPLE_PROJECTS: &[(&str, &str, &str)] = &[("basic-wallet-tx-script", "basic-wallet", "p2id-note")]; -/// Core WIT dependency mappings (package name, file name) -const CORE_WIT_DEPS: &[(&str, &str)] = &[ - ("miden:base", "miden.wit"), - ("miden:core-intrinsics", "miden-core-intrinsics.wit"), - ("miden:core-stdlib", "miden-core-stdlib.wit"), - ("miden:core-base", "miden-core-base.wit"), -]; +const CORE_WIT_DEPS: &[(&str, &str)] = &[("miden:base", "miden.wit")]; /// Create a new Miden example project #[derive(Args)] diff --git a/tools/cargo-miden/src/commands/new_project.rs b/tools/cargo-miden/src/commands/new_project.rs index d377e98dc..ce71ca588 100644 --- a/tools/cargo-miden/src/commands/new_project.rs +++ b/tools/cargo-miden/src/commands/new_project.rs @@ -11,7 +11,7 @@ use clap::Args; /// /// Before changing it make sure the new tag exists in the rust-templates repo and points to the /// desired commit. -const TEMPLATES_REPO_TAG: &str = "v0.14.0"; +const TEMPLATES_REPO_TAG: &str = "v0.15.0"; /// The folder name to put Miden SDK WIT files in pub const WIT_DEPS_PATH: &str = "wit-deps"; @@ -223,19 +223,6 @@ pub fn deploy_wit_files(project_path: &Path) -> anyhow::Result<()> { let wit_dir = project_path.join(WIT_DEPS_PATH); fs::create_dir_all(&wit_dir)?; - // Write WIT files from stdlib-sys - write_wit_file( - &wit_dir.join("miden-core-stdlib.wit"), - miden_stdlib_sys::stdlib_wit::STDLIB_WIT, - )?; - write_wit_file( - &wit_dir.join("miden-core-intrinsics.wit"), - miden_stdlib_sys::stdlib_wit::INTRINSICS_WIT, - )?; - - // Write WIT file from base-sys - write_wit_file(&wit_dir.join("miden-core-base.wit"), miden_base_sys::base_sys_wit::BASE_WIT)?; - // Write WIT file from base write_wit_file(&wit_dir.join("miden.wit"), miden_base::base_wit::MIDEN_WIT)?; diff --git a/tools/cargo-miden/src/lib.rs b/tools/cargo-miden/src/lib.rs index 33c27c998..d871111c9 100644 --- a/tools/cargo-miden/src/lib.rs +++ b/tools/cargo-miden/src/lib.rs @@ -55,6 +55,9 @@ fn is_workspace_root_context(metadata: &Metadata, manifest_path: Option<&Path>) false } +// All wasm stub symbols are provided by miden-stdlib-sys and miden-base-sys +// via their respective build.rs scripts. + fn version() -> &'static str { option_env!("CARGO_VERSION_INFO").unwrap_or(env!("CARGO_PKG_VERSION")) } @@ -227,15 +230,27 @@ where None => { // Try to resolve via explicit manifest path if let Some(manifest_path) = cargo_args.manifest_path.as_deref() { - let mp = camino::Utf8Path::from_path(manifest_path) - .expect("manifest path must be valid UTF-8"); + let mp_utf8 = + camino::Utf8Path::from_path(manifest_path).ok_or_else(|| { + anyhow::anyhow!( + "manifest path is not valid UTF-8: {}", + manifest_path.display() + ) + })?; + let mp_abs = mp_utf8 + .as_std_path() + .absolutize() + .map_err(|e| { + anyhow::anyhow!( + "failed to absolutize manifest path {}: {e}", + manifest_path.display() + ) + })? + .into_owned(); metadata .packages .iter() - .find(|p| { - p.manifest_path.as_std_path() - == mp.as_std_path().absolutize().unwrap() - }) + .find(|p| p.manifest_path.as_std_path() == mp_abs.as_path()) .ok_or_else(|| { anyhow::anyhow!( "unable to determine root package: manifest `{}` does not \ @@ -290,23 +305,6 @@ where .into_iter() .map(|(k, v)| (k.to_string(), v.to_string())) .collect(); - // skip functions that are provided by the Miden SDK and/or intrinsics - // only function names (no CM path) - package.metadata.section.bindings.skip = vec![ - // Our function names can clash with user's function names leading to - // skipping the bindings generation of the user's function names - // see https://github.com/0xMiden/compiler/issues/341 - "remove-asset", - "create-note", - "heap-base", - "hash-one-to-one", - "hash-two-to-one", - "add-asset", - "unchecked-from-u64", - ] - .into_iter() - .map(|s| s.to_string()) - .collect(); } let mut spawn_args: Vec<_> = args.clone().into_iter().collect(); @@ -356,7 +354,7 @@ where spawn_args.push(format!("{key}={value}")); } - let extra_rust_flags = "-C target-feature=+bulk-memory,+wide-arithmetic"; + let extra_rust_flags = String::from("-C target-feature=+bulk-memory,+wide-arithmetic"); // Augment RUSTFLAGS to ensure we preserve any flags set by the user match std::env::var("RUSTFLAGS") { Ok(current) if !current.is_empty() => { @@ -379,9 +377,6 @@ where ); let mut builder = tokio::runtime::Builder::new_current_thread(); let rt = builder.enable_all().build()?; - // dbg!(&packages); - // dbg!(&spawn_args); - // dbg!(&target_env); let wasm_outputs = if matches!(target_env, TargetEnv::Rollup { .. }) { rt.block_on(async { let config = Config::new(terminal, None).await?; @@ -411,15 +406,14 @@ where )? }; assert_eq!(wasm_outputs.len(), 1, "expected only one Wasm artifact"); - let wasm_output = wasm_outputs.first().unwrap(); + let wasm_output = wasm_outputs.first().expect("expected at least one Wasm artifact"); let mut midenc_flags = midenc_flags_from_target(target_env, project_type, wasm_output); // Add dependency linker arguments for dep_path in dependency_packages_paths { midenc_flags.push("--link-library".to_string()); - // Ensure the path is valid OsStr - midenc_flags.push(dep_path.to_str().unwrap().to_string()); + midenc_flags.push(dep_path.to_string_lossy().to_string()); } match build_output_type {