From 6aa4eb1d87302973adbc8285680804ea6c77c919 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 5 Dec 2025 12:40:18 +0200 Subject: [PATCH 01/15] feature: introduce onchain/offchain serialization into felts --- Cargo.lock | 17 + examples/auth-component-no-auth/Cargo.lock | 8 + .../auth-component-rpo-falcon512/Cargo.lock | 8 + examples/basic-wallet-tx-script/Cargo.lock | 8 + examples/basic-wallet/Cargo.lock | 8 + examples/counter-contract/Cargo.lock | 8 + examples/counter-note/Cargo.lock | 8 + examples/p2id-note/Cargo.lock | 9 + examples/p2id-note/Cargo.toml | 1 + examples/p2id-note/src/lib.rs | 13 +- examples/p2ide-note/Cargo.lock | 8 + examples/storage-example/Cargo.lock | 8 + sdk/base-sys/Cargo.toml | 1 + sdk/base-sys/src/bindings/mod.rs | 1 + sdk/base-sys/src/bindings/types.rs | 12 +- sdk/felt-repr-offchain/Cargo.toml | 22 + sdk/felt-repr-offchain/src/account_id.rs | 26 + sdk/felt-repr-offchain/src/lib.rs | 25 + sdk/felt-repr-onchain/Cargo.toml | 21 + sdk/felt-repr-onchain/src/lib.rs | 12 + tests/integration-node/Cargo.toml | 1 + .../src/node_tests/basic_wallet.rs | 29 +- .../src/node_tests/helpers.rs | 9 +- tests/integration/expected/examples/p2id.hir | 2147 +++++++++-------- tests/integration/expected/examples/p2id.masm | 840 ++++--- tests/integration/expected/examples/p2id.wat | 115 +- tests/rust-apps-wasm/rust-sdk/add/Cargo.lock | 8 + .../component-macros-account/Cargo.lock | 8 + .../rust-sdk/component-macros-note/Cargo.lock | 8 + .../cross-ctx-account-word-arg/Cargo.lock | 8 + .../cross-ctx-account-word/Cargo.lock | 8 + .../rust-sdk/cross-ctx-account/Cargo.lock | 8 + .../cross-ctx-note-word-arg/Cargo.lock | 8 + .../rust-sdk/cross-ctx-note-word/Cargo.lock | 8 + .../rust-sdk/cross-ctx-note/Cargo.lock | 8 + tools/cargo-miden/tests/build.rs | 105 +- 36 files changed, 1955 insertions(+), 1587 deletions(-) create mode 100644 sdk/felt-repr-offchain/Cargo.toml create mode 100644 sdk/felt-repr-offchain/src/account_id.rs create mode 100644 sdk/felt-repr-offchain/src/lib.rs create mode 100644 sdk/felt-repr-onchain/Cargo.toml create mode 100644 sdk/felt-repr-onchain/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index e1b1880b4..2160c7b3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2286,6 +2286,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -2452,6 +2453,21 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "miden-felt-repr-offchain" +version = "0.7.1" +dependencies = [ + "miden-core", + "miden-objects", +] + +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -2470,6 +2486,7 @@ dependencies = [ "miden-client", "miden-client-sqlite-store", "miden-core", + "miden-felt-repr-offchain", "miden-integration-tests", "miden-mast-package", "miden-objects", diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 1347cb036..253606f4f 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -888,6 +888,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -964,6 +965,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index f0f96bb0a..e5a229e1b 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -889,6 +889,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -965,6 +966,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index b61a55f38..7b6a2cc07 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index 9b9ed7fe5..d10f83e46 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index e6f8437f5..f73bbdec8 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index 9d5bc2547..9e91042bf 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index 8739e9261..31dedc2fb 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -874,6 +874,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -950,6 +951,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" @@ -1251,6 +1259,7 @@ name = "p2id" version = "0.1.0" dependencies = [ "miden", + "miden-felt-repr-onchain", ] [[package]] diff --git a/examples/p2id-note/Cargo.toml b/examples/p2id-note/Cargo.toml index c1e47a173..062c2dbdd 100644 --- a/examples/p2id-note/Cargo.toml +++ b/examples/p2id-note/Cargo.toml @@ -14,6 +14,7 @@ crate-type = ["cdylib"] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup miden = { path = "../../sdk/sdk" } +miden-felt-repr-onchain = { path = "../../sdk/felt-repr-onchain" } [package.metadata.component] package = "miden:p2id" diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index dc3c31048..4671edcdf 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -1,25 +1,18 @@ // Do not link against libstd (i.e. anything defined in `std::`) #![no_std] -// However, we could still use some standard library types while -// remaining no-std compatible, if we uncommented the following lines: -// -// extern crate alloc; -// use alloc::vec::Vec; - use miden::*; +use miden_felt_repr_onchain::FromFeltRepr; use crate::bindings::Account; #[note_script] fn run(_arg: Word, account: &mut Account) { let inputs = active_note::get_inputs(); - let target_account_id_prefix = inputs[0]; - let target_account_id_suffix = inputs[1]; + let target_account_id = AccountId::from_felt_repr(&inputs); - let target_account = AccountId::from(target_account_id_prefix, target_account_id_suffix); let current_account = account.get_id(); - assert_eq!(current_account, target_account); + assert_eq!(current_account, target_account_id); let assets = active_note::get_assets(); for asset in assets { diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index 3c5c6af45..eacb02ca5 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -1072,6 +1072,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -1151,6 +1152,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 10fdfef34..1a5c10765 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -874,6 +874,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -950,6 +951,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/sdk/base-sys/Cargo.toml b/sdk/base-sys/Cargo.toml index 2d726a328..6984423eb 100644 --- a/sdk/base-sys/Cargo.toml +++ b/sdk/base-sys/Cargo.toml @@ -17,6 +17,7 @@ links = "miden_base_sys_stubs" [dependencies] miden-stdlib-sys = { version = "0.7.1", path = "../stdlib-sys" } +miden-felt-repr-onchain = { version = "0.7.1", path = "../felt-repr-onchain" } [features] default = [] diff --git a/sdk/base-sys/src/bindings/mod.rs b/sdk/base-sys/src/bindings/mod.rs index 45c257162..a29c58462 100644 --- a/sdk/base-sys/src/bindings/mod.rs +++ b/sdk/base-sys/src/bindings/mod.rs @@ -19,4 +19,5 @@ pub mod storage; pub mod tx; mod types; +pub use miden_felt_repr_onchain::FromFeltRepr; pub use types::*; diff --git a/sdk/base-sys/src/bindings/types.rs b/sdk/base-sys/src/bindings/types.rs index aa256d13a..e3f948814 100644 --- a/sdk/base-sys/src/bindings/types.rs +++ b/sdk/base-sys/src/bindings/types.rs @@ -1,6 +1,7 @@ +use miden_felt_repr_onchain::FromFeltRepr; use miden_stdlib_sys::{Felt, Word}; -#[allow(unused)] +/// Unique identifier for a Miden account, composed of two field elements. #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct AccountId { pub prefix: Felt, @@ -14,6 +15,15 @@ impl AccountId { } } +impl FromFeltRepr for AccountId { + fn from_felt_repr(felts: &[Felt]) -> Self { + Self { + prefix: felts[0], + suffix: felts[1], + } + } +} + #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(transparent)] pub struct Asset { diff --git a/sdk/felt-repr-offchain/Cargo.toml b/sdk/felt-repr-offchain/Cargo.toml new file mode 100644 index 000000000..d4d602fa8 --- /dev/null +++ b/sdk/felt-repr-offchain/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "miden-felt-repr-offchain" +description = "Serialization into felt representation for off-chain use" +version = "0.7.1" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +crate-type = ["rlib"] + +[dependencies] +miden-core.workspace = true +miden-objects.workspace = true + +[features] +default = [] diff --git a/sdk/felt-repr-offchain/src/account_id.rs b/sdk/felt-repr-offchain/src/account_id.rs new file mode 100644 index 000000000..d033ffe90 --- /dev/null +++ b/sdk/felt-repr-offchain/src/account_id.rs @@ -0,0 +1,26 @@ +//! AccountId wrapper for felt representation serialization. + +use alloc::vec::Vec; + +use miden_core::Felt; +use miden_objects::account::AccountId; + +use crate::ToFeltRepr; + +/// Wrapper around `AccountId` that implements `ToFeltRepr`. +/// +/// This wrapper serializes the account ID into its felt representation, +/// matching the memory layout expected by on-chain deserialization. +pub struct AccountIdFeltRepr<'a>(pub &'a AccountId); + +impl<'a> From<&'a AccountId> for AccountIdFeltRepr<'a> { + fn from(account_id: &'a AccountId) -> Self { + Self(account_id) + } +} + +impl ToFeltRepr for AccountIdFeltRepr<'_> { + fn to_felt_repr(&self) -> Vec { + Vec::from([self.0.prefix().as_felt(), self.0.suffix()]) + } +} diff --git a/sdk/felt-repr-offchain/src/lib.rs b/sdk/felt-repr-offchain/src/lib.rs new file mode 100644 index 000000000..0fc61f5f7 --- /dev/null +++ b/sdk/felt-repr-offchain/src/lib.rs @@ -0,0 +1,25 @@ +//! Serialization into felt representation for off-chain use. +//! +//! This crate provides serialization of types into their felt memory representation, +//! which can be used for zero-copy deserialization on-chain via `miden-felt-repr-onchain`. + +#![no_std] +#![deny(warnings)] + +extern crate alloc; + +mod account_id; + +use alloc::vec::Vec; + +pub use account_id::AccountIdFeltRepr; +use miden_core::Felt; + +/// Trait for serializing a type into its felt memory representation. +/// +/// Implementors must ensure that the serialized `Vec` matches the exact memory +/// layout of the type, so it can be used for zero-copy deserialization on-chain. +pub trait ToFeltRepr { + /// Serializes this value into a vector of `Felt` elements matching the type's memory layout. + fn to_felt_repr(&self) -> Vec; +} diff --git a/sdk/felt-repr-onchain/Cargo.toml b/sdk/felt-repr-onchain/Cargo.toml new file mode 100644 index 000000000..fcfe76b2b --- /dev/null +++ b/sdk/felt-repr-onchain/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "miden-felt-repr-onchain" +description = "Zero-copy deserialization from felt representation for on-chain execution" +version = "0.7.1" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +crate-type = ["rlib"] + +[dependencies] +miden-stdlib-sys = { path = "../stdlib-sys", version = "0.7.1" } + +[features] +default = [] diff --git a/sdk/felt-repr-onchain/src/lib.rs b/sdk/felt-repr-onchain/src/lib.rs new file mode 100644 index 000000000..fb6219cdf --- /dev/null +++ b/sdk/felt-repr-onchain/src/lib.rs @@ -0,0 +1,12 @@ +//! Deserialization from felt representation for on-chain execution. + +#![no_std] +#![deny(warnings)] + +use miden_stdlib_sys::Felt; + +/// Trait for deserialization from felt memory representation. +pub trait FromFeltRepr: Sized { + /// Deserializes from a slice of `Felt` elements. + fn from_felt_repr(felts: &[Felt]) -> Self; +} diff --git a/tests/integration-node/Cargo.toml b/tests/integration-node/Cargo.toml index a0032fce9..857f1e622 100644 --- a/tests/integration-node/Cargo.toml +++ b/tests/integration-node/Cargo.toml @@ -17,6 +17,7 @@ fs2 = "0.4" miden-client = { version = "0.12", features = ["std", "tonic"] } miden-client-sqlite-store = { version = "0.12" } miden-core.workspace = true +miden-felt-repr-offchain = { version = "0.7.1", path = "../../sdk/felt-repr-offchain" } miden-mast-package.workspace = true miden-objects = { workspace = true, features = ["std"] } midenc-frontend-wasm.workspace = true diff --git a/tests/integration-node/src/node_tests/basic_wallet.rs b/tests/integration-node/src/node_tests/basic_wallet.rs index a9e8ce019..00e0e640b 100644 --- a/tests/integration-node/src/node_tests/basic_wallet.rs +++ b/tests/integration-node/src/node_tests/basic_wallet.rs @@ -6,6 +6,7 @@ use miden_client::{ transaction::{OutputNote, TransactionRequestBuilder}, }; use miden_core::{utils::Serializable, Felt}; +use miden_felt_repr_offchain::{AccountIdFeltRepr, ToFeltRepr}; use super::helpers::*; use crate::local_node::ensure_shared_node; @@ -82,7 +83,7 @@ pub fn test_basic_wallet_p2id_local() { faucet_account.id(), NoteCreationConfig { assets: NoteAssets::new(vec![fungible_asset.into()]).unwrap(), - inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], + inputs: AccountIdFeltRepr(&alice_account.id()).to_felt_repr(), ..Default::default() }, ); @@ -266,7 +267,7 @@ pub fn test_basic_wallet_p2ide_local() { faucet_account.id(), NoteCreationConfig { assets: NoteAssets::new(vec![fungible_asset.into()]).unwrap(), - inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], + inputs: AccountIdFeltRepr(&alice_account.id()).to_felt_repr(), ..Default::default() }, ); @@ -338,12 +339,11 @@ pub fn test_basic_wallet_p2ide_local() { alice_account.id(), NoteCreationConfig { assets: NoteAssets::new(vec![transfer_asset.into()]).unwrap(), - inputs: vec![ - bob_account.id().prefix().as_felt(), - bob_account.id().suffix(), - timelock_height, - reclaim_height, - ], + inputs: { + let mut inputs = AccountIdFeltRepr(&bob_account.id()).to_felt_repr(); + inputs.extend([timelock_height, reclaim_height]); + inputs + }, ..Default::default() }, ); @@ -469,7 +469,7 @@ pub fn test_basic_wallet_p2ide_reclaim_local() { faucet_account.id(), NoteCreationConfig { assets: NoteAssets::new(vec![fungible_asset.into()]).unwrap(), - inputs: vec![alice_account.id().prefix().as_felt(), alice_account.id().suffix()], + inputs: AccountIdFeltRepr(&alice_account.id()).to_felt_repr(), ..Default::default() }, ); @@ -543,12 +543,11 @@ pub fn test_basic_wallet_p2ide_reclaim_local() { alice_account.id(), NoteCreationConfig { assets: NoteAssets::new(vec![transfer_asset.into()]).unwrap(), - inputs: vec![ - bob_account.id().prefix().as_felt(), - bob_account.id().suffix(), - timelock_height, - reclaim_height, - ], + inputs: { + let mut inputs = AccountIdFeltRepr(&bob_account.id()).to_felt_repr(); + inputs.extend([timelock_height, reclaim_height]); + inputs + }, ..Default::default() }, ); diff --git a/tests/integration-node/src/node_tests/helpers.rs b/tests/integration-node/src/node_tests/helpers.rs index 93360efc1..a25f90a35 100644 --- a/tests/integration-node/src/node_tests/helpers.rs +++ b/tests/integration-node/src/node_tests/helpers.rs @@ -23,6 +23,7 @@ use miden_client::{ }; use miden_client_sqlite_store::ClientBuilderSqliteExt; use miden_core::{Felt, FieldElement, Word}; +use miden_felt_repr_offchain::{AccountIdFeltRepr, ToFeltRepr}; use miden_integration_tests::CompilerTestBuilder; use miden_mast_package::{Package, SectionId}; use miden_objects::{ @@ -449,7 +450,7 @@ pub async fn send_asset_to_account( sender_account_id, NoteCreationConfig { assets: miden_client::note::NoteAssets::new(vec![asset.into()]).unwrap(), - inputs: vec![recipient_account_id.prefix().as_felt(), recipient_account_id.suffix()], + inputs: AccountIdFeltRepr(&recipient_account_id).to_felt_repr(), note_type: config.note_type, tag: config.tag, execution_hint: config.execution_hint, @@ -466,11 +467,7 @@ pub async fn send_asset_to_account( // Prepare note recipient let program_hash = tx_script_program.hash(); let serial_num = RpoRandomCoin::new(program_hash).draw_word(); - let inputs = NoteInputs::new(vec![ - recipient_account_id.prefix().as_felt(), - recipient_account_id.suffix(), - ]) - .unwrap(); + let inputs = NoteInputs::new(AccountIdFeltRepr(&recipient_account_id).to_felt_repr()).unwrap(); let note_recipient = NoteRecipient::new(serial_num, p2id_note.script().clone(), inputs); // Prepare commitment data diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index bda1e9f8d..403d393ff 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -35,33 +35,33 @@ builtin.component miden:base/note-script@1.0.0 { v22 = arith.constant 1048616 : 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 - v898 = arith.constant 0 : i32; + v910 = 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, v898 : i1; + v30 = arith.neq v28, v910 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v896 = arith.constant 0 : i32; - v897 = arith.constant 0 : i32; - v32 = arith.eq v16, v897 : i1; + v908 = arith.constant 0 : i32; + v909 = arith.constant 0 : i32; + v32 = arith.eq v16, v909 : i1; v33 = arith.zext v32 : u32; v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v896 : i1; + v36 = arith.neq v34, v908 : i1; scf.if v36{ - ^block114: + ^block117: scf.yield ; } else { ^block18: - v890 = arith.constant 0 : u8; + v902 = 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, v890; + hir.mem_set v41, v39, v902; scf.yield ; }; scf.yield ; @@ -88,1186 +88,1211 @@ builtin.component miden:base/note-script@1.0.0 { 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::active_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; - v956 = scf.index_switch v66 : u32 - case 0 { - ^block119: - v1000 = arith.constant 1 : u32; - scf.yield v1000; - } - case 1 { - ^block120: - v999 = arith.constant 1 : u32; - scf.yield v999; - } - default { + v62 = arith.constant 20 : u32; + v61 = hir.bitcast v54 : u32; + v63 = arith.add v61, v62 : u32 #[overflow = checked]; + v64 = arith.constant 4 : u32; + v65 = arith.mod v63, v64 : u32; + hir.assertz v65 #[code = 250]; + v66 = hir.int_to_ptr v63 : ptr; + v67 = hir.load v66 : i32; + v69 = arith.constant 24 : u32; + v68 = hir.bitcast v54 : u32; + v70 = arith.add v68, v69 : u32 #[overflow = checked]; + v1041 = arith.constant 4 : u32; + v72 = arith.mod v70, v1041 : u32; + hir.assertz v72 #[code = 250]; + v73 = hir.int_to_ptr v70 : ptr; + v74 = hir.load v73 : i32; + v59 = arith.constant 8 : i32; + v60 = arith.add v54, v59 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v60, v67, v74) + v76 = arith.constant 12 : u32; + v75 = hir.bitcast v54 : u32; + v77 = arith.add v75, v76 : u32 #[overflow = checked]; + v1040 = arith.constant 4 : u32; + v79 = arith.mod v77, v1040 : u32; + hir.assertz v79 #[code = 250]; + v80 = hir.int_to_ptr v77 : ptr; + v81 = hir.load v80 : felt; + v83 = arith.constant 8 : u32; + v82 = hir.bitcast v54 : u32; + v84 = arith.add v82, v83 : u32 #[overflow = checked]; + v1039 = arith.constant 4 : u32; + v86 = arith.mod v84, v1039 : u32; + hir.assertz v86 #[code = 250]; + v87 = hir.int_to_ptr v84 : ptr; + v88 = hir.load v87 : felt; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v54) + v1038 = arith.constant 4 : u32; + v89 = hir.bitcast v54 : u32; + v91 = arith.add v89, v1038 : u32 #[overflow = checked]; + v1037 = arith.constant 4 : u32; + v93 = arith.mod v91, v1037 : u32; + hir.assertz v93 #[code = 250]; + v94 = hir.int_to_ptr v91 : ptr; + v95 = hir.load v94 : felt; + v96 = hir.bitcast v54 : u32; + v1036 = arith.constant 4 : u32; + v98 = arith.mod v96, v1036 : u32; + hir.assertz v98 #[code = 250]; + v99 = hir.int_to_ptr v96 : ptr; + v100 = hir.load v99 : felt; + v101 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v100, v88) : i32 + v47 = arith.constant 0 : i32; + v102 = arith.constant 1 : i32; + v103 = arith.neq v101, v102 : i1; + v104 = arith.zext v103 : u32; + v105 = hir.bitcast v104 : i32; + v107 = arith.neq v105, v47 : i1; + v968 = scf.if v107 : u32 { + ^block121: + v912 = arith.constant 0 : u32; + scf.yield v912; + } else { ^block24: - v68 = arith.constant 20 : u32; - v67 = hir.bitcast v54 : u32; - v69 = arith.add v67, v68 : u32 #[overflow = checked]; - v1033 = arith.constant 4 : u32; - v71 = arith.mod v69, v1033 : u32; - hir.assertz v71 #[code = 250]; - v72 = hir.int_to_ptr v69 : ptr; - v73 = hir.load v72 : i32; - v1032 = arith.constant 4 : u32; - v74 = hir.bitcast v73 : u32; - v76 = arith.add v74, v1032 : u32 #[overflow = checked]; - v1031 = arith.constant 4 : u32; - v78 = arith.mod v76, v1031 : u32; - hir.assertz v78 #[code = 250]; - v79 = hir.int_to_ptr v76 : ptr; - v80 = hir.load v79 : felt; - v81 = hir.bitcast v73 : u32; - v1030 = arith.constant 4 : u32; - v83 = arith.mod v81, v1030 : 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::active_account::get_id(v87) - v89 = arith.constant 12 : u32; - v88 = hir.bitcast v54 : u32; - v90 = arith.add v88, v89 : u32 #[overflow = checked]; - v1029 = arith.constant 4 : u32; - v92 = arith.mod v90, v1029 : 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]; - v1028 = arith.constant 4 : u32; - v99 = arith.mod v97, v1028 : u32; - hir.assertz v99 #[code = 250]; - v100 = hir.int_to_ptr v97 : ptr; - v101 = hir.load v100 : felt; - v102 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v101, v85) : i32 - v47 = arith.constant 0 : i32; - v103 = arith.constant 1 : i32; - v104 = arith.neq v102, v103 : i1; - v105 = arith.zext v104 : u32; - v106 = hir.bitcast v105 : i32; - v108 = arith.neq v106, v47 : i1; - v958 = scf.if v108 : u32 { - ^block118: - v908 = arith.constant 1 : u32; - scf.yield v908; + v108 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v95, v81) : i32 + v1034 = arith.constant 0 : i32; + v1035 = arith.constant 1 : i32; + v110 = arith.neq v108, v1035 : i1; + v111 = arith.zext v110 : u32; + v112 = hir.bitcast v111 : i32; + v114 = arith.neq v112, v1034 : i1; + scf.if v114{ + ^block120: + scf.yield ; } else { ^block25: - v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 - v1026 = arith.constant 0 : i32; - v1027 = arith.constant 1 : i32; - v111 = arith.neq v109, v1027 : i1; - v112 = arith.zext v111 : u32; - v113 = hir.bitcast v112 : i32; - v115 = arith.neq v113, v1026 : i1; - scf.if v115{ - ^block117: - scf.yield ; - } else { - ^block26: - v116 = arith.constant 28 : i32; - v117 = arith.add v54, v116 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v117) - v119 = arith.constant 36 : u32; - v118 = hir.bitcast v54 : u32; - v120 = arith.add v118, v119 : u32 #[overflow = checked]; - v1025 = arith.constant 4 : u32; - v122 = arith.mod v120, v1025 : u32; - hir.assertz v122 #[code = 250]; - v123 = hir.int_to_ptr v120 : ptr; - v124 = hir.load v123 : i32; - v129 = arith.constant 28 : u32; - v128 = hir.bitcast v54 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v1024 = arith.constant 4 : u32; - v132 = arith.mod v130, v1024 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : i32; - v136 = arith.constant 32 : u32; - v135 = hir.bitcast v54 : u32; - v137 = arith.add v135, v136 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v139 = arith.mod v137, v1023 : u32; - hir.assertz v139 #[code = 250]; - v140 = hir.int_to_ptr v137 : ptr; - v141 = hir.load v140 : i32; - v1022 = arith.constant 4 : u32; - v127 = arith.shl v124, v1022 : i32; - v976, v977, v978, v979, v980, v981, v982, v983 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block132(v984: i32, v985: i32, v986: i32, v987: i32, v988: i32): - v1020 = arith.constant 0 : i32; - v1021 = arith.constant 0 : i32; - v144 = arith.eq v984, v1021 : i1; - v145 = arith.zext v144 : u32; - v146 = hir.bitcast v145 : i32; - v148 = arith.neq v146, v1020 : i1; - v969, v970 = scf.if v148 : i32, i32 { - ^block131: - v909 = ub.poison i32 : i32; - scf.yield v909, v909; - } else { - ^block30: - v150 = hir.bitcast v985 : u32; - v1019 = arith.constant 4 : u32; - v152 = arith.mod v150, v1019 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - v154 = hir.load v153 : felt; - v1018 = arith.constant 4 : u32; - v155 = hir.bitcast v985 : u32; - v157 = arith.add v155, v1018 : u32 #[overflow = checked]; - v1017 = arith.constant 4 : u32; - v159 = arith.mod v157, v1017 : u32; - hir.assertz v159 #[code = 250]; - v160 = hir.int_to_ptr v157 : ptr; - v161 = hir.load v160 : felt; - v1016 = arith.constant 8 : u32; - v162 = hir.bitcast v985 : u32; - v164 = arith.add v162, v1016 : u32 #[overflow = checked]; - v1015 = arith.constant 4 : u32; - v166 = arith.mod v164, v1015 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : felt; - v1014 = arith.constant 12 : u32; - v169 = hir.bitcast v985 : u32; - v171 = arith.add v169, v1014 : u32 #[overflow = checked]; - v1013 = arith.constant 4 : u32; - v173 = arith.mod v171, v1013 : u32; - hir.assertz v173 #[code = 250]; - v174 = hir.int_to_ptr v171 : ptr; - v175 = hir.load v174 : felt; - hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v154, v161, v168, v175) - v1012 = arith.constant 16 : i32; - v179 = arith.add v985, v1012 : i32 #[overflow = wrapping]; - v176 = arith.constant -16 : i32; - v177 = arith.add v984, v176 : i32 #[overflow = wrapping]; - scf.yield v177, v179; - }; - v1008 = ub.poison i32 : i32; - v973 = cf.select v148, v1008, v988 : i32; - v1009 = ub.poison i32 : i32; - v972 = cf.select v148, v1009, v987 : i32; - v1010 = ub.poison i32 : i32; - v971 = cf.select v148, v1010, v986 : i32; - v1011 = arith.constant 1 : u32; - v900 = arith.constant 0 : u32; - v975 = cf.select v148, v900, v1011 : u32; - v953 = arith.trunc v975 : i1; - scf.condition v953, v969, v970, v971, v972, v973, v986, v987, v988; - } do { - ^block133(v989: i32, v990: i32, v991: i32, v992: i32, v993: i32, v994: i32, v995: i32, v996: i32): - scf.yield v989, v990, v991, v992, v993; + v115 = arith.constant 28 : i32; + v116 = arith.add v54, v115 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v116) + v118 = arith.constant 36 : u32; + v117 = hir.bitcast v54 : u32; + v119 = arith.add v117, v118 : u32 #[overflow = checked]; + v1033 = arith.constant 4 : u32; + v121 = arith.mod v119, v1033 : u32; + hir.assertz v121 #[code = 250]; + v122 = hir.int_to_ptr v119 : ptr; + v123 = hir.load v122 : i32; + v128 = arith.constant 28 : u32; + v127 = hir.bitcast v54 : u32; + v129 = arith.add v127, v128 : u32 #[overflow = checked]; + v1032 = arith.constant 4 : u32; + v131 = arith.mod v129, v1032 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i32; + v135 = arith.constant 32 : u32; + v134 = hir.bitcast v54 : u32; + v136 = arith.add v134, v135 : u32 #[overflow = checked]; + v1031 = arith.constant 4 : u32; + v138 = arith.mod v136, v1031 : u32; + hir.assertz v138 #[code = 250]; + v139 = hir.int_to_ptr v136 : ptr; + v140 = hir.load v139 : i32; + v1030 = arith.constant 4 : u32; + v126 = arith.shl v123, v1030 : i32; + v986, v987, v988, v989, v990, v991, v992, v993 = scf.while v126, v140, v54, v140, v133 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block132(v994: i32, v995: i32, v996: i32, v997: i32, v998: i32): + v1028 = arith.constant 0 : i32; + v1029 = arith.constant 0 : i32; + v143 = arith.eq v994, v1029 : i1; + v144 = arith.zext v143 : u32; + v145 = hir.bitcast v144 : i32; + v147 = arith.neq v145, v1028 : i1; + v979, v980 = scf.if v147 : i32, i32 { + ^block131: + v921 = ub.poison i32 : i32; + scf.yield v921, v921; + } else { + ^block29: + v149 = hir.bitcast v995 : u32; + v1027 = arith.constant 4 : u32; + v151 = arith.mod v149, v1027 : u32; + hir.assertz v151 #[code = 250]; + v152 = hir.int_to_ptr v149 : ptr; + v153 = hir.load v152 : felt; + v1026 = arith.constant 4 : u32; + v154 = hir.bitcast v995 : u32; + v156 = arith.add v154, v1026 : u32 #[overflow = checked]; + v1025 = arith.constant 4 : u32; + v158 = arith.mod v156, v1025 : u32; + hir.assertz v158 #[code = 250]; + v159 = hir.int_to_ptr v156 : ptr; + v160 = hir.load v159 : felt; + v1024 = arith.constant 8 : u32; + v161 = hir.bitcast v995 : u32; + v163 = arith.add v161, v1024 : u32 #[overflow = checked]; + v1023 = arith.constant 4 : u32; + v165 = arith.mod v163, v1023 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + v167 = hir.load v166 : felt; + v1022 = arith.constant 12 : u32; + v168 = hir.bitcast v995 : u32; + v170 = arith.add v168, v1022 : u32 #[overflow = checked]; + v1021 = arith.constant 4 : u32; + v172 = arith.mod v170, v1021 : u32; + hir.assertz v172 #[code = 250]; + v173 = hir.int_to_ptr v170 : ptr; + v174 = hir.load v173 : felt; + hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v153, v160, v167, v174) + v1020 = arith.constant 16 : i32; + v178 = arith.add v995, v1020 : i32 #[overflow = wrapping]; + v175 = arith.constant -16 : i32; + v176 = arith.add v994, v175 : i32 #[overflow = wrapping]; + scf.yield v176, v178; }; - v183 = arith.constant 44 : u32; - v182 = hir.bitcast v981 : u32; - v184 = arith.add v182, v183 : u32 #[overflow = checked]; - v1007 = arith.constant 4 : u32; - v186 = arith.mod v184, v1007 : u32; - hir.assertz v186 #[code = 250]; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v982; - v190 = arith.constant 40 : u32; - v189 = hir.bitcast v981 : u32; - v191 = arith.add v189, v190 : u32 #[overflow = checked]; - v1006 = arith.constant 4 : u32; - v193 = arith.mod v191, v1006 : u32; - hir.assertz v193 #[code = 250]; - v194 = hir.int_to_ptr v191 : ptr; - hir.store v194, v983; - v1005 = arith.constant 16 : i32; - v195 = arith.constant 40 : i32; - v196 = arith.add v981, v195 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v1005, v1005) - v125 = arith.constant 4 : i32; - v1004 = arith.constant 16 : i32; - v200 = arith.add v981, v1004 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v200, v125, v125) - v1003 = arith.constant 48 : i32; - v204 = arith.add v981, v1003 : i32 #[overflow = wrapping]; - v205 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v206 = hir.bitcast v205 : ptr; - hir.store v206, v204; - scf.yield ; + v1016 = ub.poison i32 : i32; + v983 = cf.select v147, v1016, v998 : i32; + v1017 = ub.poison i32 : i32; + v982 = cf.select v147, v1017, v997 : i32; + v1018 = ub.poison i32 : i32; + v981 = cf.select v147, v1018, v996 : i32; + v920 = arith.constant 1 : u32; + v1019 = arith.constant 0 : u32; + v985 = cf.select v147, v1019, v920 : u32; + v965 = arith.trunc v985 : i1; + scf.condition v965, v979, v980, v981, v982, v983, v996, v997, v998; + } do { + ^block133(v999: i32, v1000: i32, v1001: i32, v1002: i32, v1003: i32, v1004: i32, v1005: i32, v1006: i32): + scf.yield v999, v1000, v1001, v1002, v1003; }; - v1001 = arith.constant 0 : u32; - v1002 = arith.constant 1 : u32; - v997 = cf.select v115, v1002, v1001 : u32; - scf.yield v997; + v182 = arith.constant 44 : u32; + v181 = hir.bitcast v991 : u32; + v183 = arith.add v181, v182 : u32 #[overflow = checked]; + v1015 = arith.constant 4 : u32; + v185 = arith.mod v183, v1015 : u32; + hir.assertz v185 #[code = 250]; + v186 = hir.int_to_ptr v183 : ptr; + hir.store v186, v992; + v189 = arith.constant 40 : u32; + v188 = hir.bitcast v991 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v1014 = arith.constant 4 : u32; + v192 = arith.mod v190, v1014 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + hir.store v193, v993; + v1013 = arith.constant 16 : i32; + v194 = arith.constant 40 : i32; + v195 = arith.add v991, v194 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v195, v1013, v1013) + v124 = arith.constant 4 : i32; + v1012 = arith.constant 16 : i32; + v199 = arith.add v991, v1012 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v199, v124, v124) + v1011 = arith.constant 48 : i32; + v203 = arith.add v991, v1011 : i32 #[overflow = wrapping]; + v204 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v205 = hir.bitcast v204 : ptr; + hir.store v205, v203; + scf.yield ; }; - scf.yield v958; + v1009 = arith.constant 1 : u32; + v1010 = arith.constant 0 : u32; + v1007 = cf.select v114, v1010, v1009 : u32; + scf.yield v1007; }; - v998 = arith.constant 0 : u32; - v968 = arith.eq v956, v998 : i1; - cf.cond_br v968 ^block122, ^block23; + v1008 = arith.constant 0 : u32; + v978 = arith.eq v968, v1008 : i1; + cf.cond_br v978 ^block23, ^block123; ^block23: ub.unreachable ; - ^block122: + ^block123: builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block31: + ^block30: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block33: - v208 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v209 = hir.bitcast v208 : ptr; - v210 = hir.load v209 : i32; - v211 = arith.constant 1048620 : i32; - v212 = arith.add v210, v211 : i32 #[overflow = wrapping]; - v213 = hir.bitcast v212 : u32; - v214 = hir.int_to_ptr v213 : ptr; - v215 = hir.load v214 : u8; - v207 = arith.constant 0 : i32; - v216 = arith.zext v215 : u32; - v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v207 : i1; - scf.if v219{ - ^block35: + ^block32: + v207 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v208 = hir.bitcast v207 : ptr; + v209 = hir.load v208 : i32; + v210 = arith.constant 1048620 : i32; + v211 = arith.add v209, v210 : i32 #[overflow = wrapping]; + v212 = hir.bitcast v211 : u32; + v213 = hir.int_to_ptr v212 : ptr; + v214 = hir.load v213 : u8; + v206 = arith.constant 0 : i32; + v215 = arith.zext v214 : u32; + v216 = hir.bitcast v215 : i32; + v218 = arith.neq v216, v206 : i1; + scf.if v218{ + ^block34: scf.yield ; } else { - ^block36: - v220 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v221 = hir.bitcast v220 : ptr; - v222 = hir.load v221 : i32; + ^block35: + v219 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v220 = hir.bitcast v219 : ptr; + v221 = hir.load v220 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1035 = arith.constant 1 : u8; - v1037 = arith.constant 1048620 : i32; - v224 = arith.add v222, v1037 : i32 #[overflow = wrapping]; - v228 = hir.bitcast v224 : u32; - v229 = hir.int_to_ptr v228 : ptr; - hir.store v229, v1035; + v1043 = arith.constant 1 : u8; + v1045 = arith.constant 1048620 : i32; + v223 = arith.add v221, v1045 : i32 #[overflow = wrapping]; + v227 = hir.bitcast v223 : u32; + v228 = hir.int_to_ptr v227 : ptr; + hir.store v228, v1043; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v230: i32, v231: i32, v232: i32) -> i32 { - ^block37(v230: i32, v231: i32, v232: i32): - v235 = arith.constant 16 : i32; - v234 = arith.constant 0 : i32; - v1039 = arith.constant 16 : u32; - v237 = hir.bitcast v231 : u32; - v239 = arith.gt v237, v1039 : i1; - v240 = arith.zext v239 : u32; - v241 = hir.bitcast v240 : i32; - v243 = arith.neq v241, v234 : i1; - v244 = cf.select v243, v231, v235 : i32; - v1079 = arith.constant 0 : i32; - v245 = arith.constant -1 : i32; - v246 = arith.add v244, v245 : i32 #[overflow = wrapping]; - v247 = arith.band v244, v246 : i32; - v249 = arith.neq v247, v1079 : i1; - v1048, v1049 = scf.if v249 : i32, u32 { + private builtin.function @::alloc(v229: i32, v230: i32, v231: i32) -> i32 { + ^block36(v229: i32, v230: i32, v231: i32): + v234 = arith.constant 16 : i32; + v233 = arith.constant 0 : i32; + v1047 = arith.constant 16 : u32; + v236 = hir.bitcast v230 : u32; + v238 = arith.gt v236, v1047 : i1; + v239 = arith.zext v238 : u32; + v240 = hir.bitcast v239 : i32; + v242 = arith.neq v240, v233 : i1; + v243 = cf.select v242, v230, v234 : i32; + v1087 = arith.constant 0 : i32; + v244 = arith.constant -1 : i32; + v245 = arith.add v243, v244 : i32 #[overflow = wrapping]; + v246 = arith.band v243, v245 : i32; + v248 = arith.neq v246, v1087 : i1; + v1056, v1057 = scf.if v248 : i32, u32 { ^block137: - v1040 = arith.constant 0 : u32; - v1044 = ub.poison i32 : i32; - scf.yield v1044, v1040; + v1048 = arith.constant 0 : u32; + v1052 = ub.poison i32 : i32; + scf.yield v1052, v1048; } else { - ^block40: - v251 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v231, v244) : i32 - v1078 = arith.constant 0 : i32; - v250 = arith.constant -2147483648 : i32; - v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; - v254 = hir.bitcast v252 : u32; - v253 = hir.bitcast v232 : u32; - v255 = arith.gt v253, v254 : i1; - v256 = arith.zext v255 : u32; - v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v1078 : i1; - v1063 = scf.if v259 : i32 { + ^block39: + v250 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v230, v243) : i32 + v1086 = arith.constant 0 : i32; + v249 = arith.constant -2147483648 : i32; + v251 = arith.sub v249, v250 : i32 #[overflow = wrapping]; + v253 = hir.bitcast v251 : u32; + v252 = hir.bitcast v231 : u32; + v254 = arith.gt v252, v253 : i1; + v255 = arith.zext v254 : u32; + v256 = hir.bitcast v255 : i32; + v258 = arith.neq v256, v1086 : i1; + v1071 = scf.if v258 : i32 { ^block136: - v1077 = ub.poison i32 : i32; - scf.yield v1077; + v1085 = ub.poison i32 : i32; + scf.yield v1085; } else { - ^block41: - v1075 = arith.constant 0 : i32; - v265 = arith.sub v1075, v251 : i32 #[overflow = wrapping]; - v1076 = arith.constant -1 : i32; - v261 = arith.add v232, v251 : i32 #[overflow = wrapping]; - v263 = arith.add v261, v1076 : i32 #[overflow = wrapping]; - v266 = arith.band v263, v265 : i32; - v267 = hir.bitcast v230 : u32; - v268 = arith.constant 4 : u32; - v269 = arith.mod v267, v268 : u32; - hir.assertz v269 #[code = 250]; - v270 = hir.int_to_ptr v267 : ptr; - v271 = hir.load v270 : i32; - v1074 = arith.constant 0 : i32; - v273 = arith.neq v271, v1074 : i1; - scf.if v273{ + ^block40: + v1083 = arith.constant 0 : i32; + v264 = arith.sub v1083, v250 : i32 #[overflow = wrapping]; + v1084 = arith.constant -1 : i32; + v260 = arith.add v231, v250 : i32 #[overflow = wrapping]; + v262 = arith.add v260, v1084 : i32 #[overflow = wrapping]; + v265 = arith.band v262, v264 : i32; + v266 = hir.bitcast v229 : u32; + v267 = arith.constant 4 : u32; + v268 = arith.mod v266, v267 : u32; + hir.assertz v268 #[code = 250]; + v269 = hir.int_to_ptr v266 : ptr; + v270 = hir.load v269 : i32; + v1082 = arith.constant 0 : i32; + v272 = arith.neq v270, v1082 : i1; + scf.if v272{ ^block135: scf.yield ; } else { - ^block43: - v274 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 - v275 = hir.mem_size : u32; - v281 = hir.bitcast v230 : u32; - v1073 = arith.constant 4 : u32; - v283 = arith.mod v281, v1073 : u32; - hir.assertz v283 #[code = 250]; - v1072 = arith.constant 16 : u32; - v276 = hir.bitcast v275 : i32; - v279 = arith.shl v276, v1072 : i32; - v280 = arith.add v274, v279 : i32 #[overflow = wrapping]; - v284 = hir.int_to_ptr v281 : ptr; - hir.store v284, v280; + ^block42: + v273 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 + v274 = hir.mem_size : u32; + v280 = hir.bitcast v229 : u32; + v1081 = arith.constant 4 : u32; + v282 = arith.mod v280, v1081 : u32; + hir.assertz v282 #[code = 250]; + v1080 = arith.constant 16 : u32; + v275 = hir.bitcast v274 : i32; + v278 = arith.shl v275, v1080 : i32; + v279 = arith.add v273, v278 : i32 #[overflow = wrapping]; + v283 = hir.int_to_ptr v280 : ptr; + hir.store v283, v279; scf.yield ; }; - v287 = hir.bitcast v230 : u32; - v1071 = arith.constant 4 : u32; - v289 = arith.mod v287, v1071 : u32; - hir.assertz v289 #[code = 250]; - v290 = hir.int_to_ptr v287 : ptr; - v291 = hir.load v290 : i32; - v1069 = arith.constant 0 : i32; - v1070 = arith.constant -1 : i32; - v293 = arith.bxor v291, v1070 : i32; - v295 = hir.bitcast v293 : u32; - v294 = hir.bitcast v266 : u32; - v296 = arith.gt v294, v295 : i1; - v297 = arith.zext v296 : u32; - v298 = hir.bitcast v297 : i32; - v300 = arith.neq v298, v1069 : i1; - v1062 = scf.if v300 : i32 { - ^block44: - v1068 = arith.constant 0 : i32; - scf.yield v1068; + v286 = hir.bitcast v229 : u32; + v1079 = arith.constant 4 : u32; + v288 = arith.mod v286, v1079 : u32; + hir.assertz v288 #[code = 250]; + v289 = hir.int_to_ptr v286 : ptr; + v290 = hir.load v289 : i32; + v1077 = arith.constant 0 : i32; + v1078 = arith.constant -1 : i32; + v292 = arith.bxor v290, v1078 : i32; + v294 = hir.bitcast v292 : u32; + v293 = hir.bitcast v265 : u32; + v295 = arith.gt v293, v294 : i1; + v296 = arith.zext v295 : u32; + v297 = hir.bitcast v296 : i32; + v299 = arith.neq v297, v1077 : i1; + v1070 = scf.if v299 : i32 { + ^block43: + v1076 = arith.constant 0 : i32; + scf.yield v1076; } else { - ^block45: - v302 = hir.bitcast v230 : u32; - v1067 = arith.constant 4 : u32; - v304 = arith.mod v302, v1067 : u32; - hir.assertz v304 #[code = 250]; - v301 = arith.add v291, v266 : i32 #[overflow = wrapping]; - v305 = hir.int_to_ptr v302 : ptr; - hir.store v305, v301; - v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; - scf.yield v307; + ^block44: + v301 = hir.bitcast v229 : u32; + v1075 = arith.constant 4 : u32; + v303 = arith.mod v301, v1075 : u32; + hir.assertz v303 #[code = 250]; + v300 = arith.add v290, v265 : i32 #[overflow = wrapping]; + v304 = hir.int_to_ptr v301 : ptr; + hir.store v304, v300; + v306 = arith.add v290, v250 : i32 #[overflow = wrapping]; + scf.yield v306; }; - scf.yield v1062; + scf.yield v1070; }; - v1045 = arith.constant 1 : u32; - v1066 = arith.constant 0 : u32; - v1064 = cf.select v259, v1066, v1045 : u32; - scf.yield v1063, v1064; + v1053 = arith.constant 1 : u32; + v1074 = arith.constant 0 : u32; + v1072 = cf.select v258, v1074, v1053 : u32; + scf.yield v1071, v1072; }; - v1065 = arith.constant 0 : u32; - v1061 = arith.eq v1049, v1065 : i1; - cf.cond_br v1061 ^block39, ^block139(v1048); - ^block39: + v1073 = arith.constant 0 : u32; + v1069 = arith.eq v1057, v1073 : i1; + cf.cond_br v1069 ^block38, ^block139(v1056); + ^block38: ub.unreachable ; - ^block139(v1041: i32): - builtin.ret v1041; + ^block139(v1049: i32): + builtin.ret v1049; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block46: - v310 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v310; - }; - - private builtin.function @alloc::vec::Vec::with_capacity(v312: i32) { - ^block50(v312: i32): - v315 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v316 = hir.bitcast v315 : ptr; - v317 = hir.load v316 : i32; - v318 = arith.constant 16 : i32; - v319 = arith.sub v317, v318 : i32 #[overflow = wrapping]; - v320 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v321 = hir.bitcast v320 : ptr; - hir.store v321, v319; - v1084 = arith.constant 16 : i32; - v322 = arith.constant 8 : i32; - v323 = arith.add v319, v322 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v323, v1084, v1084) - v327 = arith.constant 8 : u32; - v326 = hir.bitcast v319 : u32; - v328 = arith.add v326, v327 : u32 #[overflow = checked]; - v1083 = arith.constant 8 : u32; - v330 = arith.mod v328, v1083 : u32; - hir.assertz v330 #[code = 250]; - v331 = hir.int_to_ptr v328 : ptr; - v332 = hir.load v331 : i64; - v1082 = arith.constant 8 : u32; - v334 = hir.bitcast v312 : u32; - v336 = arith.add v334, v1082 : u32 #[overflow = checked]; - v337 = arith.constant 4 : u32; - v338 = arith.mod v336, v337 : u32; - hir.assertz v338 #[code = 250]; - v313 = arith.constant 0 : i32; - v339 = hir.int_to_ptr v336 : ptr; - hir.store v339, v313; - v340 = hir.bitcast v312 : u32; - v1081 = arith.constant 4 : u32; - v342 = arith.mod v340, v1081 : u32; - hir.assertz v342 #[code = 250]; - v343 = hir.int_to_ptr v340 : ptr; - hir.store v343, v332; - v1080 = arith.constant 16 : i32; - v345 = arith.add v319, v1080 : i32 #[overflow = wrapping]; - v346 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v347 = hir.bitcast v346 : ptr; - hir.store v347, v345; - builtin.ret ; + ^block45: + v309 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v309; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v348: i32, v349: i32, v350: i32) { - ^block52(v348: i32, v349: i32, v350: i32): - v352 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v353 = hir.bitcast v352 : ptr; - v354 = hir.load v353 : i32; - v355 = arith.constant 16 : i32; - v356 = arith.sub v354, v355 : i32 #[overflow = wrapping]; - v357 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v358 = hir.bitcast v357 : ptr; - hir.store v358, v356; - v351 = arith.constant 0 : i32; - v361 = arith.constant 256 : i32; - v359 = arith.constant 4 : i32; - v360 = arith.add v356, v359 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v360, v361, v351, v349, v350) - v364 = arith.constant 8 : u32; - v363 = hir.bitcast v356 : u32; - v365 = arith.add v363, v364 : u32 #[overflow = checked]; - v366 = arith.constant 4 : u32; - v367 = arith.mod v365, v366 : u32; - hir.assertz v367 #[code = 250]; - v368 = hir.int_to_ptr v365 : ptr; - v369 = hir.load v368 : i32; - v1095 = arith.constant 4 : u32; - v370 = hir.bitcast v356 : u32; - v372 = arith.add v370, v1095 : u32 #[overflow = checked]; - v1094 = arith.constant 4 : u32; - v374 = arith.mod v372, v1094 : u32; - hir.assertz v374 #[code = 250]; - v375 = hir.int_to_ptr v372 : ptr; - v376 = hir.load v375 : i32; - v1093 = arith.constant 0 : i32; - v377 = arith.constant 1 : i32; - v378 = arith.neq v376, v377 : i1; - v379 = arith.zext v378 : u32; - v380 = hir.bitcast v379 : i32; - v382 = arith.neq v380, v1093 : i1; - cf.cond_br v382 ^block54, ^block55; - ^block54: - v396 = arith.constant 12 : u32; - v395 = hir.bitcast v356 : u32; - v397 = arith.add v395, v396 : u32 #[overflow = checked]; - v1092 = arith.constant 4 : u32; - v399 = arith.mod v397, v1092 : u32; - hir.assertz v399 #[code = 250]; - v400 = hir.int_to_ptr v397 : ptr; - v401 = hir.load v400 : i32; - v1091 = arith.constant 4 : u32; - v402 = hir.bitcast v348 : u32; - v404 = arith.add v402, v1091 : u32 #[overflow = checked]; - v1090 = arith.constant 4 : u32; - v406 = arith.mod v404, v1090 : u32; - hir.assertz v406 #[code = 250]; - v407 = hir.int_to_ptr v404 : ptr; - hir.store v407, v401; - v408 = hir.bitcast v348 : u32; + private builtin.function @alloc::vec::Vec::with_capacity(v311: i32) { + ^block49(v311: i32): + v314 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v315 = hir.bitcast v314 : ptr; + v316 = hir.load v315 : i32; + v317 = arith.constant 16 : i32; + v318 = arith.sub v316, v317 : i32 #[overflow = wrapping]; + v319 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v320 = hir.bitcast v319 : ptr; + hir.store v320, v318; + v1092 = arith.constant 16 : i32; + v321 = arith.constant 8 : i32; + v322 = arith.add v318, v321 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v322, v1092, v1092) + v326 = arith.constant 8 : u32; + v325 = hir.bitcast v318 : u32; + v327 = arith.add v325, v326 : u32 #[overflow = checked]; + v1091 = arith.constant 8 : u32; + v329 = arith.mod v327, v1091 : u32; + hir.assertz v329 #[code = 250]; + v330 = hir.int_to_ptr v327 : ptr; + v331 = hir.load v330 : i64; + v1090 = arith.constant 8 : u32; + v333 = hir.bitcast v311 : u32; + v335 = arith.add v333, v1090 : u32 #[overflow = checked]; + v336 = arith.constant 4 : u32; + v337 = arith.mod v335, v336 : u32; + hir.assertz v337 #[code = 250]; + v312 = arith.constant 0 : i32; + v338 = hir.int_to_ptr v335 : ptr; + hir.store v338, v312; + v339 = hir.bitcast v311 : u32; v1089 = arith.constant 4 : u32; - v410 = arith.mod v408, v1089 : u32; - hir.assertz v410 #[code = 250]; - v411 = hir.int_to_ptr v408 : ptr; - hir.store v411, v369; + v341 = arith.mod v339, v1089 : u32; + hir.assertz v341 #[code = 250]; + v342 = hir.int_to_ptr v339 : ptr; + hir.store v342, v331; v1088 = arith.constant 16 : i32; - v413 = arith.add v356, v1088 : i32 #[overflow = wrapping]; - v414 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v415 = hir.bitcast v414 : ptr; - hir.store v415, v413; + v344 = arith.add v318, v1088 : i32 #[overflow = wrapping]; + v345 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v346 = hir.bitcast v345 : ptr; + hir.store v346, v344; builtin.ret ; - ^block55: - v383 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v384 = hir.bitcast v383 : ptr; - v385 = hir.load v384 : i32; - v1087 = arith.constant 12 : u32; - v386 = hir.bitcast v356 : u32; - v388 = arith.add v386, v1087 : u32 #[overflow = checked]; - v1086 = arith.constant 4 : u32; - v390 = arith.mod v388, v1086 : u32; - hir.assertz v390 #[code = 250]; - v391 = hir.int_to_ptr v388 : ptr; - v392 = hir.load v391 : i32; - v393 = arith.constant 1048600 : i32; - v394 = arith.add v385, v393 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v369, v392, v394) - ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_account::get_id(v416: i32) { - ^block56(v416: i32): - v418 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v419 = hir.bitcast v418 : ptr; - v420 = hir.load v419 : i32; - v421 = arith.constant 16 : i32; - v422 = arith.sub v420, v421 : i32 #[overflow = wrapping]; - v423 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v424 = hir.bitcast v423 : ptr; - hir.store v424, v422; - v425 = arith.constant 8 : i32; - v426 = arith.add v422, v425 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v426) - v428 = arith.constant 8 : u32; - v427 = hir.bitcast v422 : u32; - v429 = arith.add v427, v428 : u32 #[overflow = checked]; - v430 = arith.constant 4 : u32; - v431 = arith.mod v429, v430 : u32; - hir.assertz v431 #[code = 250]; - v432 = hir.int_to_ptr v429 : ptr; - v433 = hir.load v432 : i64; - v434 = hir.bitcast v416 : u32; - v1097 = arith.constant 8 : u32; - v436 = arith.mod v434, v1097 : u32; - hir.assertz v436 #[code = 250]; - v437 = hir.int_to_ptr v434 : ptr; - hir.store v437, v433; + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v347: i32, v348: i32, v349: i32) { + ^block51(v347: i32, v348: i32, v349: i32): + v351 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v352 = hir.bitcast v351 : ptr; + v353 = hir.load v352 : i32; + v354 = arith.constant 16 : i32; + v355 = arith.sub v353, v354 : i32 #[overflow = wrapping]; + v356 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v357 = hir.bitcast v356 : ptr; + hir.store v357, v355; + v350 = arith.constant 0 : i32; + v360 = arith.constant 256 : i32; + v358 = arith.constant 4 : i32; + v359 = arith.add v355, v358 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v359, v360, v350, v348, v349) + v363 = arith.constant 8 : u32; + v362 = hir.bitcast v355 : u32; + v364 = arith.add v362, v363 : u32 #[overflow = checked]; + v365 = arith.constant 4 : u32; + v366 = arith.mod v364, v365 : u32; + hir.assertz v366 #[code = 250]; + v367 = hir.int_to_ptr v364 : ptr; + v368 = hir.load v367 : i32; + v1103 = arith.constant 4 : u32; + v369 = hir.bitcast v355 : u32; + v371 = arith.add v369, v1103 : u32 #[overflow = checked]; + v1102 = arith.constant 4 : u32; + v373 = arith.mod v371, v1102 : u32; + hir.assertz v373 #[code = 250]; + v374 = hir.int_to_ptr v371 : ptr; + v375 = hir.load v374 : i32; + v1101 = arith.constant 0 : i32; + v376 = arith.constant 1 : i32; + v377 = arith.neq v375, v376 : i1; + v378 = arith.zext v377 : u32; + v379 = hir.bitcast v378 : i32; + v381 = arith.neq v379, v1101 : i1; + cf.cond_br v381 ^block53, ^block54; + ^block53: + v395 = arith.constant 12 : u32; + v394 = hir.bitcast v355 : u32; + v396 = arith.add v394, v395 : u32 #[overflow = checked]; + v1100 = arith.constant 4 : u32; + v398 = arith.mod v396, v1100 : u32; + hir.assertz v398 #[code = 250]; + v399 = hir.int_to_ptr v396 : ptr; + v400 = hir.load v399 : i32; + v1099 = arith.constant 4 : u32; + v401 = hir.bitcast v347 : u32; + v403 = arith.add v401, v1099 : u32 #[overflow = checked]; + v1098 = arith.constant 4 : u32; + v405 = arith.mod v403, v1098 : u32; + hir.assertz v405 #[code = 250]; + v406 = hir.int_to_ptr v403 : ptr; + hir.store v406, v400; + v407 = hir.bitcast v347 : u32; + v1097 = arith.constant 4 : u32; + v409 = arith.mod v407, v1097 : u32; + hir.assertz v409 #[code = 250]; + v410 = hir.int_to_ptr v407 : ptr; + hir.store v410, v368; v1096 = arith.constant 16 : i32; - v439 = arith.add v422, v1096 : i32 #[overflow = wrapping]; - v440 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v441 = hir.bitcast v440 : ptr; - hir.store v441, v439; + v412 = arith.add v355, v1096 : i32 #[overflow = wrapping]; + v413 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v414 = hir.bitcast v413 : ptr; + hir.store v414, v412; builtin.ret ; + ^block54: + v382 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v383 = hir.bitcast v382 : ptr; + v384 = hir.load v383 : i32; + v1095 = arith.constant 12 : u32; + v385 = hir.bitcast v355 : u32; + v387 = arith.add v385, v1095 : u32 #[overflow = checked]; + v1094 = arith.constant 4 : u32; + v389 = arith.mod v387, v1094 : u32; + hir.assertz v389 #[code = 250]; + v390 = hir.int_to_ptr v387 : ptr; + v391 = hir.load v390 : i32; + v392 = arith.constant 1048600 : i32; + v393 = arith.add v384, v392 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v368, v391, v393) + ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v442: i32) { - ^block58(v442: i32): - v444 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v445 = hir.bitcast v444 : ptr; - v446 = hir.load v445 : i32; - v447 = arith.constant 16 : i32; - v448 = arith.sub v446, v447 : i32 #[overflow = wrapping]; - v449 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v450 = hir.bitcast v449 : ptr; - hir.store v450, v448; - v453 = arith.constant 4 : i32; - v451 = arith.constant 8 : i32; - v452 = arith.add v448, v451 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v452, v453, v453) - v456 = arith.constant 8 : u32; - v455 = hir.bitcast v448 : u32; - v457 = arith.add v455, v456 : u32 #[overflow = checked]; - v458 = arith.constant 4 : u32; - v459 = arith.mod v457, v458 : u32; - hir.assertz v459 #[code = 250]; - v460 = hir.int_to_ptr v457 : ptr; - v461 = hir.load v460 : i32; - v463 = arith.constant 12 : u32; - v462 = hir.bitcast v448 : u32; - v464 = arith.add v462, v463 : u32 #[overflow = checked]; - v1105 = arith.constant 4 : u32; - v466 = arith.mod v464, v1105 : u32; - hir.assertz v466 #[code = 250]; - v467 = hir.int_to_ptr v464 : ptr; - v468 = hir.load v467 : i32; - v1098 = arith.constant 2 : u32; - v470 = hir.bitcast v468 : u32; - v472 = arith.shr v470, v1098 : u32; - v473 = hir.bitcast v472 : i32; - v474 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v473) : i32 - v1104 = arith.constant 8 : u32; - v475 = hir.bitcast v442 : u32; - v477 = arith.add v475, v1104 : u32 #[overflow = checked]; - v1103 = arith.constant 4 : u32; - v479 = arith.mod v477, v1103 : u32; - hir.assertz v479 #[code = 250]; - v480 = hir.int_to_ptr v477 : ptr; - hir.store v480, v474; - v1102 = arith.constant 4 : u32; - v481 = hir.bitcast v442 : u32; - v483 = arith.add v481, v1102 : u32 #[overflow = checked]; - v1101 = arith.constant 4 : u32; - v485 = arith.mod v483, v1101 : u32; - hir.assertz v485 #[code = 250]; - v486 = hir.int_to_ptr v483 : ptr; - hir.store v486, v468; - v487 = hir.bitcast v442 : u32; - v1100 = arith.constant 4 : u32; - v489 = arith.mod v487, v1100 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - hir.store v490, v461; - v1099 = arith.constant 16 : i32; - v492 = arith.add v448, v1099 : i32 #[overflow = wrapping]; - v493 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v494 = hir.bitcast v493 : ptr; - hir.store v494, v492; + private builtin.function @miden_base_sys::bindings::active_account::get_id(v415: i32) { + ^block55(v415: i32): + v417 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v418 = hir.bitcast v417 : ptr; + v419 = hir.load v418 : i32; + v420 = arith.constant 16 : i32; + v421 = arith.sub v419, v420 : i32 #[overflow = wrapping]; + v422 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v423 = hir.bitcast v422 : ptr; + hir.store v423, v421; + v424 = arith.constant 8 : i32; + v425 = arith.add v421, v424 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v425) + v427 = arith.constant 8 : u32; + v426 = hir.bitcast v421 : u32; + v428 = arith.add v426, v427 : u32 #[overflow = checked]; + v429 = arith.constant 4 : u32; + v430 = arith.mod v428, v429 : u32; + hir.assertz v430 #[code = 250]; + v431 = hir.int_to_ptr v428 : ptr; + v432 = hir.load v431 : i64; + v433 = hir.bitcast v415 : u32; + v1105 = arith.constant 8 : u32; + v435 = arith.mod v433, v1105 : u32; + hir.assertz v435 #[code = 250]; + v436 = hir.int_to_ptr v433 : ptr; + hir.store v436, v432; + v1104 = arith.constant 16 : i32; + v438 = arith.add v421, v1104 : i32 #[overflow = wrapping]; + v439 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v440 = hir.bitcast v439 : ptr; + hir.store v440, v438; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v495: i32) { - ^block60(v495: i32): - v497 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v498 = hir.bitcast v497 : ptr; - v499 = hir.load v498 : i32; - v500 = arith.constant 16 : i32; - v501 = arith.sub v499, v500 : 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; - v504 = arith.constant 4 : i32; - v505 = arith.add v501, v504 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v505) - v509 = arith.constant 8 : u32; - v508 = hir.bitcast v501 : u32; - v510 = arith.add v508, v509 : u32 #[overflow = checked]; - v511 = arith.constant 4 : u32; - v512 = arith.mod v510, v511 : u32; - hir.assertz v512 #[code = 250]; - v513 = hir.int_to_ptr v510 : ptr; - v514 = hir.load v513 : i32; + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v441: i32) { + ^block57(v441: i32): + v443 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v444 = hir.bitcast v443 : ptr; + v445 = hir.load v444 : i32; + v446 = arith.constant 16 : i32; + v447 = arith.sub v445, v446 : i32 #[overflow = wrapping]; + v448 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v449 = hir.bitcast v448 : ptr; + hir.store v449, v447; + v452 = arith.constant 4 : i32; + v450 = arith.constant 8 : i32; + v451 = arith.add v447, v450 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v451, v452, v452) + v455 = arith.constant 8 : u32; + v454 = hir.bitcast v447 : u32; + v456 = arith.add v454, v455 : u32 #[overflow = checked]; + v457 = arith.constant 4 : u32; + v458 = arith.mod v456, v457 : u32; + hir.assertz v458 #[code = 250]; + v459 = hir.int_to_ptr v456 : ptr; + v460 = hir.load v459 : i32; + v462 = arith.constant 12 : u32; + v461 = hir.bitcast v447 : u32; + v463 = arith.add v461, v462 : u32 #[overflow = checked]; + v1113 = arith.constant 4 : u32; + v465 = arith.mod v463, v1113 : u32; + hir.assertz v465 #[code = 250]; + v466 = hir.int_to_ptr v463 : ptr; + v467 = hir.load v466 : i32; v1106 = arith.constant 2 : u32; - v516 = hir.bitcast v514 : u32; - v518 = arith.shr v516, v1106 : u32; - v519 = hir.bitcast v518 : i32; - v520 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v519) : i32 - v506 = arith.constant 8 : i32; - v507 = arith.add v495, v506 : i32 #[overflow = wrapping]; - v521 = hir.bitcast v507 : u32; + v469 = hir.bitcast v467 : u32; + v471 = arith.shr v469, v1106 : u32; + v472 = hir.bitcast v471 : i32; + v473 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v472) : i32 + v1112 = arith.constant 8 : u32; + v474 = hir.bitcast v441 : u32; + v476 = arith.add v474, v1112 : u32 #[overflow = checked]; v1111 = arith.constant 4 : u32; - v523 = arith.mod v521, v1111 : u32; - hir.assertz v523 #[code = 250]; - v524 = hir.int_to_ptr v521 : ptr; - hir.store v524, v520; + v478 = arith.mod v476, v1111 : u32; + hir.assertz v478 #[code = 250]; + v479 = hir.int_to_ptr v476 : ptr; + hir.store v479, v473; v1110 = arith.constant 4 : u32; - v525 = hir.bitcast v501 : u32; - v527 = arith.add v525, v1110 : u32 #[overflow = checked]; + v480 = hir.bitcast v441 : u32; + v482 = arith.add v480, v1110 : u32 #[overflow = checked]; v1109 = arith.constant 4 : u32; - v529 = arith.mod v527, v1109 : u32; - hir.assertz v529 #[code = 250]; - v530 = hir.int_to_ptr v527 : ptr; - v531 = hir.load v530 : i64; - v532 = hir.bitcast v495 : u32; + v484 = arith.mod v482, v1109 : u32; + hir.assertz v484 #[code = 250]; + v485 = hir.int_to_ptr v482 : ptr; + hir.store v485, v467; + v486 = hir.bitcast v441 : u32; v1108 = arith.constant 4 : u32; - v534 = arith.mod v532, v1108 : u32; - hir.assertz v534 #[code = 250]; - v535 = hir.int_to_ptr v532 : ptr; - hir.store v535, v531; + v488 = arith.mod v486, v1108 : u32; + hir.assertz v488 #[code = 250]; + v489 = hir.int_to_ptr v486 : ptr; + hir.store v489, v460; v1107 = arith.constant 16 : i32; - v537 = arith.add v501, v1107 : i32 #[overflow = wrapping]; - v538 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v539 = hir.bitcast v538 : ptr; - hir.store v539, v537; + v491 = arith.add v447, v1107 : i32 #[overflow = wrapping]; + v492 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v493 = hir.bitcast v492 : ptr; + hir.store v493, v491; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v540: felt, v541: felt) -> i32 { - ^block62(v540: felt, v541: felt): - v542 = arith.eq v540, v541 : i1; - v543 = hir.cast v542 : i32; - builtin.ret v543; + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v494: i32) { + ^block59(v494: i32): + v496 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v497 = hir.bitcast v496 : ptr; + v498 = hir.load v497 : i32; + v499 = arith.constant 16 : i32; + v500 = arith.sub v498, v499 : i32 #[overflow = wrapping]; + v501 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v502 = hir.bitcast v501 : ptr; + hir.store v502, v500; + v503 = arith.constant 4 : i32; + v504 = arith.add v500, v503 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v504) + v508 = arith.constant 8 : u32; + v507 = hir.bitcast v500 : 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 : i32; + v1114 = arith.constant 2 : u32; + v515 = hir.bitcast v513 : u32; + v517 = arith.shr v515, v1114 : u32; + v518 = hir.bitcast v517 : i32; + v519 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v518) : i32 + v505 = arith.constant 8 : i32; + v506 = arith.add v494, v505 : i32 #[overflow = wrapping]; + v520 = hir.bitcast v506 : u32; + v1119 = arith.constant 4 : u32; + v522 = arith.mod v520, v1119 : u32; + hir.assertz v522 #[code = 250]; + v523 = hir.int_to_ptr v520 : ptr; + hir.store v523, v519; + v1118 = arith.constant 4 : u32; + v524 = hir.bitcast v500 : u32; + v526 = arith.add v524, v1118 : u32 #[overflow = checked]; + v1117 = arith.constant 4 : u32; + v528 = arith.mod v526, v1117 : u32; + hir.assertz v528 #[code = 250]; + v529 = hir.int_to_ptr v526 : ptr; + v530 = hir.load v529 : i64; + v531 = hir.bitcast v494 : u32; + v1116 = arith.constant 4 : u32; + v533 = arith.mod v531, v1116 : u32; + hir.assertz v533 #[code = 250]; + v534 = hir.int_to_ptr v531 : ptr; + hir.store v534, v530; + v1115 = arith.constant 16 : i32; + v536 = arith.add v500, v1115 : i32 #[overflow = wrapping]; + v537 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v538 = hir.bitcast v537 : ptr; + hir.store v538, v536; + builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v545: i32, v546: i32, v547: i32) { - ^block64(v545: i32, v546: i32, v547: i32): - v549 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v550 = hir.bitcast v549 : ptr; - v551 = hir.load v550 : i32; - v552 = arith.constant 16 : i32; - v553 = arith.sub v551, v552 : i32 #[overflow = wrapping]; - v554 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v555 = hir.bitcast v554 : ptr; - hir.store v555, v553; - v556 = arith.constant 4 : i32; - v557 = arith.add v553, v556 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v557, v545, v546, v547) - v559 = arith.constant 8 : u32; - v558 = hir.bitcast v553 : u32; - v560 = arith.add v558, v559 : u32 #[overflow = checked]; - v561 = arith.constant 4 : u32; - v562 = arith.mod v560, v561 : u32; - hir.assertz v562 #[code = 250]; - v563 = hir.int_to_ptr v560 : ptr; - v564 = hir.load v563 : i32; - v1118 = arith.constant 0 : i32; - v548 = arith.constant 0 : i32; - v566 = arith.eq v564, v548 : i1; - v567 = arith.zext v566 : u32; - v568 = hir.bitcast v567 : i32; - v570 = arith.neq v568, v1118 : i1; - scf.if v570{ + private builtin.function @::from_felt_repr(v539: i32, v540: i32, v541: i32) { + ^block61(v539: i32, v540: i32, v541: i32): + v542 = hir.cast v541 : u32; + v1123 = scf.index_switch v542 : u32 + case 0 { ^block145: + v1122 = arith.constant 1 : u32; + scf.yield v1122; + } + case 1 { + ^block146: + v1127 = arith.constant 1 : u32; + scf.yield v1127; + } + default { + ^block64: + v543 = hir.bitcast v540 : u32; + v544 = arith.constant 4 : u32; + v545 = arith.mod v543, v544 : u32; + hir.assertz v545 #[code = 250]; + v546 = hir.int_to_ptr v543 : ptr; + v547 = hir.load v546 : i64; + v548 = hir.bitcast v539 : u32; + v549 = arith.constant 8 : u32; + v550 = arith.mod v548, v549 : u32; + hir.assertz v550 #[code = 250]; + v551 = hir.int_to_ptr v548 : ptr; + hir.store v551, v547; + v1120 = arith.constant 0 : u32; + scf.yield v1120; + }; + v1126 = arith.constant 0 : u32; + v1125 = arith.eq v1123, v1126 : i1; + cf.cond_br v1125 ^block148, ^block63; + ^block63: + ub.unreachable ; + ^block148: + builtin.ret ; + }; + + private builtin.function @intrinsics::felt::eq(v552: felt, v553: felt) -> i32 { + ^block65(v552: felt, v553: felt): + v554 = arith.eq v552, v553 : i1; + v555 = hir.cast v554 : i32; + builtin.ret v555; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v557: i32, v558: i32, v559: i32) { + ^block67(v557: i32, v558: i32, v559: i32): + v561 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v562 = hir.bitcast v561 : ptr; + v563 = hir.load v562 : i32; + v564 = arith.constant 16 : i32; + v565 = arith.sub v563, v564 : i32 #[overflow = wrapping]; + v566 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v567 = hir.bitcast v566 : ptr; + hir.store v567, v565; + v568 = arith.constant 4 : i32; + v569 = arith.add v565, v568 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v569, v557, v558, v559) + v571 = arith.constant 8 : u32; + v570 = hir.bitcast v565 : u32; + v572 = arith.add v570, v571 : u32 #[overflow = checked]; + v573 = arith.constant 4 : u32; + v574 = arith.mod v572, v573 : u32; + hir.assertz v574 #[code = 250]; + v575 = hir.int_to_ptr v572 : ptr; + v576 = hir.load v575 : i32; + v1134 = arith.constant 0 : i32; + v560 = arith.constant 0 : i32; + v578 = arith.eq v576, v560 : i1; + v579 = arith.zext v578 : u32; + v580 = hir.bitcast v579 : i32; + v582 = arith.neq v580, v1134 : i1; + scf.if v582{ + ^block150: scf.yield ; } else { - ^block67: - v1117 = arith.constant 4 : u32; - v571 = hir.bitcast v553 : u32; - v573 = arith.add v571, v1117 : u32 #[overflow = checked]; - v1116 = arith.constant 4 : u32; - v575 = arith.mod v573, v1116 : u32; - hir.assertz v575 #[code = 250]; - v576 = hir.int_to_ptr v573 : ptr; - v577 = hir.load v576 : i32; - v579 = arith.constant 12 : u32; - v578 = hir.bitcast v553 : u32; - v580 = arith.add v578, v579 : u32 #[overflow = checked]; - v1115 = arith.constant 4 : u32; - v582 = arith.mod v580, v1115 : u32; - hir.assertz v582 #[code = 250]; - v583 = hir.int_to_ptr v580 : ptr; - v584 = hir.load v583 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v577, v564, v584) + ^block70: + v1133 = arith.constant 4 : u32; + v583 = hir.bitcast v565 : u32; + v585 = arith.add v583, v1133 : u32 #[overflow = checked]; + v1132 = arith.constant 4 : u32; + v587 = arith.mod v585, v1132 : u32; + hir.assertz v587 #[code = 250]; + v588 = hir.int_to_ptr v585 : ptr; + v589 = hir.load v588 : i32; + v591 = arith.constant 12 : u32; + v590 = hir.bitcast v565 : u32; + v592 = arith.add v590, v591 : u32 #[overflow = checked]; + v1131 = arith.constant 4 : u32; + v594 = arith.mod v592, v1131 : u32; + hir.assertz v594 #[code = 250]; + v595 = hir.int_to_ptr v592 : ptr; + v596 = hir.load v595 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v589, v576, v596) scf.yield ; }; - v1114 = arith.constant 16 : i32; - v587 = arith.add v553, v1114 : i32 #[overflow = wrapping]; - v588 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v589 = hir.bitcast v588 : ptr; - hir.store v589, v587; + v1130 = arith.constant 16 : i32; + v599 = arith.add v565, v1130 : i32 #[overflow = wrapping]; + v600 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v601 = hir.bitcast v600 : ptr; + hir.store v601, v599; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32) { - ^block68(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32): - v597 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v598 = hir.bitcast v597 : ptr; - v599 = hir.load v598 : i32; - v600 = arith.constant 16 : i32; - v601 = arith.sub v599, v600 : i32 #[overflow = wrapping]; - v602 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v603 = hir.bitcast v602 : ptr; - hir.store v603, v601; - v613 = hir.bitcast v591 : u32; - v614 = arith.zext v613 : u64; - v615 = hir.bitcast v614 : i64; - v595 = arith.constant 0 : i32; - v608 = arith.sub v595, v593 : i32 #[overflow = wrapping]; - v605 = arith.constant -1 : i32; - v604 = arith.add v593, v594 : i32 #[overflow = wrapping]; - v606 = arith.add v604, v605 : i32 #[overflow = wrapping]; - v609 = arith.band v606, v608 : i32; - v610 = hir.bitcast v609 : u32; - v611 = arith.zext v610 : u64; - v612 = hir.bitcast v611 : i64; - v616 = arith.mul v612, v615 : i64 #[overflow = wrapping]; - v1222 = arith.constant 0 : i32; - v617 = arith.constant 32 : i64; - v619 = hir.cast v617 : u32; - v618 = hir.bitcast v616 : u64; - v620 = arith.shr v618, v619 : u64; - v621 = hir.bitcast v620 : i64; - v622 = arith.trunc v621 : i32; - v624 = arith.neq v622, v1222 : i1; - v1134, v1135, v1136, v1137, v1138, v1139 = scf.if v624 : i32, i32, i32, i32, i32, u32 { - ^block147: - v1119 = arith.constant 0 : u32; - v1126 = ub.poison i32 : i32; - scf.yield v590, v601, v1126, v1126, v1126, v1119; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v602: i32, v603: i32, v604: i32, v605: i32, v606: i32) { + ^block71(v602: i32, v603: i32, v604: i32, v605: i32, v606: i32): + v609 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v610 = hir.bitcast v609 : ptr; + v611 = hir.load v610 : i32; + v612 = arith.constant 16 : i32; + v613 = arith.sub v611, v612 : i32 #[overflow = wrapping]; + v614 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v615 = hir.bitcast v614 : ptr; + hir.store v615, v613; + v625 = hir.bitcast v603 : u32; + v626 = arith.zext v625 : u64; + v627 = hir.bitcast v626 : i64; + v607 = arith.constant 0 : i32; + v620 = arith.sub v607, v605 : i32 #[overflow = wrapping]; + v617 = arith.constant -1 : i32; + v616 = arith.add v605, v606 : i32 #[overflow = wrapping]; + v618 = arith.add v616, v617 : i32 #[overflow = wrapping]; + v621 = arith.band v618, v620 : i32; + v622 = hir.bitcast v621 : u32; + v623 = arith.zext v622 : u64; + v624 = hir.bitcast v623 : i64; + v628 = arith.mul v624, v627 : i64 #[overflow = wrapping]; + v1238 = arith.constant 0 : i32; + v629 = arith.constant 32 : i64; + v631 = hir.cast v629 : u32; + v630 = hir.bitcast v628 : u64; + v632 = arith.shr v630, v631 : u64; + v633 = hir.bitcast v632 : i64; + v634 = arith.trunc v633 : i32; + v636 = arith.neq v634, v1238 : i1; + v1150, v1151, v1152, v1153, v1154, v1155 = scf.if v636 : i32, i32, i32, i32, i32, u32 { + ^block152: + v1135 = arith.constant 0 : u32; + v1142 = ub.poison i32 : i32; + scf.yield v602, v613, v1142, v1142, v1142, v1135; } else { - ^block73: - v625 = arith.trunc v616 : i32; - v1221 = arith.constant 0 : i32; - v626 = arith.constant -2147483648 : i32; - v627 = arith.sub v626, v593 : i32 #[overflow = wrapping]; - v629 = hir.bitcast v627 : u32; - v628 = hir.bitcast v625 : u32; - v630 = arith.lte v628, v629 : i1; - v631 = arith.zext v630 : u32; - v632 = hir.bitcast v631 : i32; - v634 = arith.neq v632, v1221 : i1; - v1182 = scf.if v634 : i32 { - ^block71: - v1220 = arith.constant 0 : i32; - v645 = arith.neq v625, v1220 : i1; - v1181 = scf.if v645 : i32 { - ^block75: - v1219 = arith.constant 0 : i32; - v661 = arith.neq v592, v1219 : i1; - v1180 = scf.if v661 : i32 { - ^block78: - v643 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v601, v593, v625, v643) - v672 = hir.bitcast v601 : u32; - v717 = arith.constant 4 : u32; - v674 = arith.mod v672, v717 : u32; - hir.assertz v674 #[code = 250]; - v675 = hir.int_to_ptr v672 : ptr; - v676 = hir.load v675 : i32; - scf.yield v676; + ^block76: + v637 = arith.trunc v628 : i32; + v1237 = arith.constant 0 : i32; + v638 = arith.constant -2147483648 : i32; + v639 = arith.sub v638, v605 : i32 #[overflow = wrapping]; + v641 = hir.bitcast v639 : u32; + v640 = hir.bitcast v637 : u32; + v642 = arith.lte v640, v641 : i1; + v643 = arith.zext v642 : u32; + v644 = hir.bitcast v643 : i32; + v646 = arith.neq v644, v1237 : i1; + v1198 = scf.if v646 : i32 { + ^block74: + v1236 = arith.constant 0 : i32; + v657 = arith.neq v637, v1236 : i1; + v1197 = scf.if v657 : i32 { + ^block78: + v1235 = arith.constant 0 : i32; + v673 = arith.neq v604, v1235 : i1; + v1196 = scf.if v673 : i32 { + ^block81: + v655 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v613, v605, v637, v655) + v684 = hir.bitcast v613 : u32; + v729 = arith.constant 4 : u32; + v686 = arith.mod v684, v729 : u32; + hir.assertz v686 #[code = 250]; + v687 = hir.int_to_ptr v684 : ptr; + v688 = hir.load v687 : i32; + scf.yield v688; } else { - ^block79: - v662 = arith.constant 8 : i32; - v663 = arith.add v601, v662 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v663, v593, v625) - v647 = arith.constant 8 : u32; - v664 = hir.bitcast v601 : u32; - v666 = arith.add v664, v647 : u32 #[overflow = checked]; - v1218 = arith.constant 4 : u32; - v668 = arith.mod v666, v1218 : u32; - hir.assertz v668 #[code = 250]; - v669 = hir.int_to_ptr v666 : ptr; - v670 = hir.load v669 : i32; - scf.yield v670; + ^block82: + v674 = arith.constant 8 : i32; + v675 = arith.add v613, v674 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v675, v605, v637) + v659 = arith.constant 8 : u32; + v676 = hir.bitcast v613 : u32; + v678 = arith.add v676, v659 : u32 #[overflow = checked]; + v1234 = arith.constant 4 : u32; + v680 = arith.mod v678, v1234 : u32; + hir.assertz v680 #[code = 250]; + v681 = hir.int_to_ptr v678 : ptr; + v682 = hir.load v681 : i32; + scf.yield v682; }; - v1216 = arith.constant 0 : i32; - v1217 = arith.constant 0 : i32; - v679 = arith.eq v1180, v1217 : i1; - v680 = arith.zext v679 : u32; - v681 = hir.bitcast v680 : i32; - v683 = arith.neq v681, v1216 : i1; - scf.if v683{ - ^block80: - v1215 = arith.constant 8 : u32; - v700 = hir.bitcast v590 : u32; - v702 = arith.add v700, v1215 : u32 #[overflow = checked]; - v1214 = arith.constant 4 : u32; - v704 = arith.mod v702, v1214 : u32; - hir.assertz v704 #[code = 250]; - v705 = hir.int_to_ptr v702 : ptr; - hir.store v705, v625; - v1213 = arith.constant 4 : u32; - v707 = hir.bitcast v590 : u32; - v709 = arith.add v707, v1213 : u32 #[overflow = checked]; - v1212 = arith.constant 4 : u32; - v711 = arith.mod v709, v1212 : u32; - hir.assertz v711 #[code = 250]; - v712 = hir.int_to_ptr v709 : ptr; - hir.store v712, v593; + v1232 = arith.constant 0 : i32; + v1233 = arith.constant 0 : i32; + v691 = arith.eq v1196, v1233 : i1; + v692 = arith.zext v691 : u32; + v693 = hir.bitcast v692 : i32; + v695 = arith.neq v693, v1232 : i1; + scf.if v695{ + ^block83: + v1231 = arith.constant 8 : u32; + v712 = hir.bitcast v602 : u32; + v714 = arith.add v712, v1231 : u32 #[overflow = checked]; + v1230 = arith.constant 4 : u32; + v716 = arith.mod v714, v1230 : u32; + hir.assertz v716 #[code = 250]; + v717 = hir.int_to_ptr v714 : ptr; + hir.store v717, v637; + v1229 = arith.constant 4 : u32; + v719 = hir.bitcast v602 : u32; + v721 = arith.add v719, v1229 : u32 #[overflow = checked]; + v1228 = arith.constant 4 : u32; + v723 = arith.mod v721, v1228 : u32; + hir.assertz v723 #[code = 250]; + v724 = hir.int_to_ptr v721 : ptr; + hir.store v724, v605; scf.yield ; } else { - ^block81: - v1211 = arith.constant 8 : u32; - v685 = hir.bitcast v590 : u32; - v687 = arith.add v685, v1211 : u32 #[overflow = checked]; - v1210 = arith.constant 4 : u32; - v689 = arith.mod v687, v1210 : u32; - hir.assertz v689 #[code = 250]; - v690 = hir.int_to_ptr v687 : ptr; - hir.store v690, v1180; - v1209 = arith.constant 4 : u32; - v692 = hir.bitcast v590 : u32; - v694 = arith.add v692, v1209 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v696 = arith.mod v694, v1208 : u32; - hir.assertz v696 #[code = 250]; - v697 = hir.int_to_ptr v694 : ptr; - hir.store v697, v591; + ^block84: + v1227 = arith.constant 8 : u32; + v697 = hir.bitcast v602 : u32; + v699 = arith.add v697, v1227 : u32 #[overflow = checked]; + v1226 = arith.constant 4 : u32; + v701 = arith.mod v699, v1226 : u32; + hir.assertz v701 #[code = 250]; + v702 = hir.int_to_ptr v699 : ptr; + hir.store v702, v1196; + v1225 = arith.constant 4 : u32; + v704 = hir.bitcast v602 : u32; + v706 = arith.add v704, v1225 : u32 #[overflow = checked]; + v1224 = arith.constant 4 : u32; + v708 = arith.mod v706, v1224 : u32; + hir.assertz v708 #[code = 250]; + v709 = hir.int_to_ptr v706 : ptr; + hir.store v709, v603; scf.yield ; }; - v1206 = arith.constant 0 : i32; - v1207 = arith.constant 1 : i32; - v1179 = cf.select v683, v1207, v1206 : i32; - scf.yield v1179; + v1222 = arith.constant 0 : i32; + v1223 = arith.constant 1 : i32; + v1195 = cf.select v695, v1223, v1222 : i32; + scf.yield v1195; } else { - ^block76: - v1205 = arith.constant 8 : u32; - v646 = hir.bitcast v590 : u32; - v648 = arith.add v646, v1205 : u32 #[overflow = checked]; - v1204 = arith.constant 4 : u32; - v650 = arith.mod v648, v1204 : u32; - hir.assertz v650 #[code = 250]; - v651 = hir.int_to_ptr v648 : ptr; - hir.store v651, v593; - v1203 = arith.constant 4 : u32; - v654 = hir.bitcast v590 : u32; - v656 = arith.add v654, v1203 : u32 #[overflow = checked]; - v1202 = arith.constant 4 : u32; - v658 = arith.mod v656, v1202 : u32; - hir.assertz v658 #[code = 250]; - v1201 = arith.constant 0 : i32; - v659 = hir.int_to_ptr v656 : ptr; - hir.store v659, v1201; - v1200 = arith.constant 0 : i32; - scf.yield v1200; + ^block79: + v1221 = arith.constant 8 : u32; + v658 = hir.bitcast v602 : u32; + v660 = arith.add v658, v1221 : u32 #[overflow = checked]; + v1220 = arith.constant 4 : u32; + v662 = arith.mod v660, v1220 : u32; + hir.assertz v662 #[code = 250]; + v663 = hir.int_to_ptr v660 : ptr; + hir.store v663, v605; + v1219 = arith.constant 4 : u32; + v666 = hir.bitcast v602 : u32; + v668 = arith.add v666, v1219 : u32 #[overflow = checked]; + v1218 = arith.constant 4 : u32; + v670 = arith.mod v668, v1218 : u32; + hir.assertz v670 #[code = 250]; + v1217 = arith.constant 0 : i32; + v671 = hir.int_to_ptr v668 : ptr; + hir.store v671, v1217; + v1216 = arith.constant 0 : i32; + scf.yield v1216; }; - scf.yield v1181; + scf.yield v1197; } else { - ^block74: - v1199 = ub.poison i32 : i32; - scf.yield v1199; + ^block77: + v1215 = ub.poison i32 : i32; + scf.yield v1215; }; - v1194 = arith.constant 0 : u32; - v1127 = arith.constant 1 : u32; - v1187 = cf.select v634, v1127, v1194 : u32; - v1195 = ub.poison i32 : i32; - v1186 = cf.select v634, v601, v1195 : i32; - v1196 = ub.poison i32 : i32; - v1185 = cf.select v634, v590, v1196 : i32; - v1197 = ub.poison i32 : i32; - v1184 = cf.select v634, v1197, v601 : i32; - v1198 = ub.poison i32 : i32; - v1183 = cf.select v634, v1198, v590 : i32; - scf.yield v1183, v1184, v1185, v1182, v1186, v1187; + v1210 = arith.constant 0 : u32; + v1143 = arith.constant 1 : u32; + v1203 = cf.select v646, v1143, v1210 : u32; + v1211 = ub.poison i32 : i32; + v1202 = cf.select v646, v613, v1211 : i32; + v1212 = ub.poison i32 : i32; + v1201 = cf.select v646, v602, v1212 : i32; + v1213 = ub.poison i32 : i32; + v1200 = cf.select v646, v1213, v613 : i32; + v1214 = ub.poison i32 : i32; + v1199 = cf.select v646, v1214, v602 : i32; + scf.yield v1199, v1200, v1201, v1198, v1202, v1203; }; - v1140, v1141, v1142 = scf.index_switch v1139 : i32, i32, i32 + v1156, v1157, v1158 = scf.index_switch v1155 : i32, i32, i32 case 0 { - ^block72: - v1193 = arith.constant 4 : u32; - v637 = hir.bitcast v1134 : u32; - v639 = arith.add v637, v1193 : u32 #[overflow = checked]; - v1192 = arith.constant 4 : u32; - v641 = arith.mod v639, v1192 : u32; - hir.assertz v641 #[code = 250]; - v1191 = arith.constant 0 : i32; - v642 = hir.int_to_ptr v639 : ptr; - hir.store v642, v1191; - v1190 = arith.constant 1 : i32; - scf.yield v1134, v1190, v1135; + ^block75: + v1209 = arith.constant 4 : u32; + v649 = hir.bitcast v1150 : u32; + v651 = arith.add v649, v1209 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v653 = arith.mod v651, v1208 : u32; + hir.assertz v653 #[code = 250]; + v1207 = arith.constant 0 : i32; + v654 = hir.int_to_ptr v651 : ptr; + hir.store v654, v1207; + v1206 = arith.constant 1 : i32; + scf.yield v1150, v1206, v1151; } default { - ^block151: - scf.yield v1136, v1137, v1138; + ^block156: + scf.yield v1152, v1153, v1154; }; - v716 = hir.bitcast v1140 : u32; - v1189 = arith.constant 4 : u32; - v718 = arith.mod v716, v1189 : u32; - hir.assertz v718 #[code = 250]; - v719 = hir.int_to_ptr v716 : ptr; - hir.store v719, v1141; - v1188 = arith.constant 16 : i32; - v724 = arith.add v1142, v1188 : i32 #[overflow = wrapping]; - v725 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v726 = hir.bitcast v725 : ptr; - hir.store v726, v724; + v728 = hir.bitcast v1156 : u32; + v1205 = arith.constant 4 : u32; + v730 = arith.mod v728, v1205 : u32; + hir.assertz v730 #[code = 250]; + v731 = hir.int_to_ptr v728 : ptr; + hir.store v731, v1157; + v1204 = arith.constant 16 : i32; + v736 = arith.add v1158, v1204 : i32 #[overflow = wrapping]; + v737 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v738 = hir.bitcast v737 : ptr; + hir.store v738, v736; builtin.ret ; }; - private builtin.function @::allocate(v727: i32, v728: i32, v729: i32) { - ^block82(v727: i32, v728: i32, v729: i32): - v731 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v732 = hir.bitcast v731 : ptr; - v733 = hir.load v732 : i32; - v734 = arith.constant 16 : i32; - v735 = arith.sub v733, v734 : i32 #[overflow = wrapping]; - v736 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v737 = hir.bitcast v736 : ptr; - hir.store v737, v735; - v730 = arith.constant 0 : i32; - v738 = arith.constant 8 : i32; - v739 = arith.add v735, v738 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v739, v728, v729, v730) - v742 = arith.constant 12 : u32; - v741 = hir.bitcast v735 : u32; - v743 = arith.add v741, v742 : u32 #[overflow = checked]; - v744 = arith.constant 4 : u32; - v745 = arith.mod v743, v744 : u32; - hir.assertz v745 #[code = 250]; - v746 = hir.int_to_ptr v743 : ptr; - v747 = hir.load v746 : i32; - v749 = arith.constant 8 : u32; - v748 = hir.bitcast v735 : u32; - v750 = arith.add v748, v749 : u32 #[overflow = checked]; - v1227 = arith.constant 4 : u32; - v752 = arith.mod v750, v1227 : u32; - hir.assertz v752 #[code = 250]; - v753 = hir.int_to_ptr v750 : ptr; - v754 = hir.load v753 : i32; - v755 = hir.bitcast v727 : u32; - v1226 = arith.constant 4 : u32; - v757 = arith.mod v755, v1226 : u32; + private builtin.function @::allocate(v739: i32, v740: i32, v741: i32) { + ^block85(v739: i32, v740: i32, v741: i32): + v743 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v744 = hir.bitcast v743 : ptr; + v745 = hir.load v744 : i32; + v746 = arith.constant 16 : i32; + v747 = arith.sub v745, v746 : i32 #[overflow = wrapping]; + v748 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v749 = hir.bitcast v748 : ptr; + hir.store v749, v747; + v742 = arith.constant 0 : i32; + v750 = arith.constant 8 : i32; + v751 = arith.add v747, v750 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v751, v740, v741, v742) + v754 = arith.constant 12 : u32; + v753 = hir.bitcast v747 : u32; + v755 = arith.add v753, v754 : u32 #[overflow = checked]; + v756 = arith.constant 4 : u32; + v757 = arith.mod v755, v756 : u32; hir.assertz v757 #[code = 250]; v758 = hir.int_to_ptr v755 : ptr; - hir.store v758, v754; - v1225 = arith.constant 4 : u32; - v759 = hir.bitcast v727 : u32; - v761 = arith.add v759, v1225 : u32 #[overflow = checked]; - v1224 = arith.constant 4 : u32; - v763 = arith.mod v761, v1224 : u32; - hir.assertz v763 #[code = 250]; - v764 = hir.int_to_ptr v761 : ptr; - hir.store v764, v747; - v1223 = arith.constant 16 : i32; - v766 = arith.add v735, v1223 : i32 #[overflow = wrapping]; - v767 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v768 = hir.bitcast v767 : ptr; - hir.store v768, v766; + v759 = hir.load v758 : i32; + v761 = arith.constant 8 : u32; + v760 = hir.bitcast v747 : u32; + v762 = arith.add v760, v761 : u32 #[overflow = checked]; + v1243 = arith.constant 4 : u32; + v764 = arith.mod v762, v1243 : u32; + hir.assertz v764 #[code = 250]; + v765 = hir.int_to_ptr v762 : ptr; + v766 = hir.load v765 : i32; + v767 = hir.bitcast v739 : u32; + v1242 = arith.constant 4 : u32; + v769 = arith.mod v767, v1242 : u32; + hir.assertz v769 #[code = 250]; + v770 = hir.int_to_ptr v767 : ptr; + hir.store v770, v766; + v1241 = arith.constant 4 : u32; + v771 = hir.bitcast v739 : u32; + v773 = arith.add v771, v1241 : u32 #[overflow = checked]; + v1240 = arith.constant 4 : u32; + v775 = arith.mod v773, v1240 : u32; + hir.assertz v775 #[code = 250]; + v776 = hir.int_to_ptr v773 : ptr; + hir.store v776, v759; + v1239 = arith.constant 16 : i32; + v778 = arith.add v747, v1239 : i32 #[overflow = wrapping]; + v779 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v780 = hir.bitcast v779 : ptr; + hir.store v780, v778; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v769: i32, v770: i32, v771: i32, v772: i32) { - ^block84(v769: i32, v770: i32, v771: i32, v772: i32): - v1243 = arith.constant 0 : i32; - v773 = arith.constant 0 : i32; - v774 = arith.eq v771, v773 : i1; - v775 = arith.zext v774 : u32; - v776 = hir.bitcast v775 : i32; - v778 = arith.neq v776, v1243 : i1; - v1239 = scf.if v778 : i32 { - ^block154: - scf.yield v770; + private builtin.function @alloc::alloc::Global::alloc_impl(v781: i32, v782: i32, v783: i32, v784: i32) { + ^block87(v781: i32, v782: i32, v783: i32, v784: i32): + v1259 = arith.constant 0 : i32; + v785 = arith.constant 0 : i32; + v786 = arith.eq v783, v785 : i1; + v787 = arith.zext v786 : u32; + v788 = hir.bitcast v787 : i32; + v790 = arith.neq v788, v1259 : i1; + v1255 = scf.if v790 : i32 { + ^block159: + scf.yield v782; } else { - ^block87: + ^block90: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1242 = arith.constant 0 : i32; - v780 = arith.neq v772, v1242 : i1; - v1238 = scf.if v780 : i32 { - ^block88: - v782 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v771, v770) : i32 - scf.yield v782; + v1258 = arith.constant 0 : i32; + v792 = arith.neq v784, v1258 : i1; + v1254 = scf.if v792 : i32 { + ^block91: + v794 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v783, v782) : i32 + scf.yield v794; } else { - ^block89: - v781 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v771, v770) : i32 - scf.yield v781; + ^block92: + v793 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v783, v782) : i32 + scf.yield v793; }; - scf.yield v1238; + scf.yield v1254; }; - v786 = arith.constant 4 : u32; - v785 = hir.bitcast v769 : u32; - v787 = arith.add v785, v786 : u32 #[overflow = checked]; - v1241 = arith.constant 4 : u32; - v789 = arith.mod v787, v1241 : u32; - hir.assertz v789 #[code = 250]; - v790 = hir.int_to_ptr v787 : ptr; - hir.store v790, v771; - v792 = hir.bitcast v769 : u32; - v1240 = arith.constant 4 : u32; - v794 = arith.mod v792, v1240 : u32; - hir.assertz v794 #[code = 250]; - v795 = hir.int_to_ptr v792 : ptr; - hir.store v795, v1239; + v798 = arith.constant 4 : u32; + v797 = hir.bitcast v781 : u32; + v799 = arith.add v797, v798 : u32 #[overflow = checked]; + v1257 = arith.constant 4 : u32; + v801 = arith.mod v799, v1257 : u32; + hir.assertz v801 #[code = 250]; + v802 = hir.int_to_ptr v799 : ptr; + hir.store v802, v783; + v804 = hir.bitcast v781 : u32; + v1256 = arith.constant 4 : u32; + v806 = arith.mod v804, v1256 : u32; + hir.assertz v806 #[code = 250]; + v807 = hir.int_to_ptr v804 : ptr; + hir.store v807, v1255; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v796: i32, v797: i32, v798: i32, v799: i32) { - ^block90(v796: i32, v797: i32, v798: i32, v799: i32): - v1269 = arith.constant 0 : i32; - v800 = arith.constant 0 : i32; - v804 = arith.eq v799, v800 : i1; - v805 = arith.zext v804 : u32; - v806 = hir.bitcast v805 : i32; - v808 = arith.neq v806, v1269 : i1; - v1256, v1257 = scf.if v808 : i32, i32 { - ^block158: - v1268 = arith.constant 0 : i32; - v802 = arith.constant 4 : i32; - scf.yield v802, v1268; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v808: i32, v809: i32, v810: i32, v811: i32) { + ^block93(v808: i32, v809: i32, v810: i32, v811: i32): + v1285 = arith.constant 0 : i32; + v812 = arith.constant 0 : i32; + v816 = arith.eq v811, v812 : i1; + v817 = arith.zext v816 : u32; + v818 = hir.bitcast v817 : i32; + v820 = arith.neq v818, v1285 : i1; + v1272, v1273 = scf.if v820 : i32, i32 { + ^block163: + v1284 = arith.constant 0 : i32; + v814 = arith.constant 4 : i32; + scf.yield v814, v1284; } else { - ^block93: - v809 = hir.bitcast v797 : u32; - v844 = arith.constant 4 : u32; - v811 = arith.mod v809, v844 : u32; - hir.assertz v811 #[code = 250]; - v812 = hir.int_to_ptr v809 : ptr; - v813 = hir.load v812 : i32; - v1266 = arith.constant 0 : i32; - v1267 = arith.constant 0 : i32; - v815 = arith.eq v813, v1267 : i1; - v816 = arith.zext v815 : u32; - v817 = hir.bitcast v816 : i32; - v819 = arith.neq v817, v1266 : i1; - v1254 = scf.if v819 : i32 { - ^block157: - v1265 = arith.constant 0 : i32; - scf.yield v1265; + ^block96: + v821 = hir.bitcast v809 : u32; + v856 = arith.constant 4 : u32; + v823 = arith.mod v821, v856 : u32; + hir.assertz v823 #[code = 250]; + v824 = hir.int_to_ptr v821 : ptr; + v825 = hir.load v824 : i32; + v1282 = arith.constant 0 : i32; + v1283 = arith.constant 0 : i32; + v827 = arith.eq v825, v1283 : i1; + v828 = arith.zext v827 : u32; + v829 = hir.bitcast v828 : i32; + v831 = arith.neq v829, v1282 : i1; + v1270 = scf.if v831 : i32 { + ^block162: + v1281 = arith.constant 0 : i32; + scf.yield v1281; } else { - ^block94: - v1264 = arith.constant 4 : u32; - v820 = hir.bitcast v796 : u32; - v822 = arith.add v820, v1264 : u32 #[overflow = checked]; - v1263 = arith.constant 4 : u32; - v824 = arith.mod v822, v1263 : u32; - hir.assertz v824 #[code = 250]; - v825 = hir.int_to_ptr v822 : ptr; - hir.store v825, v798; - v1262 = arith.constant 4 : u32; - v826 = hir.bitcast v797 : u32; - v828 = arith.add v826, v1262 : u32 #[overflow = checked]; - v1261 = arith.constant 4 : u32; - v830 = arith.mod v828, v1261 : u32; - hir.assertz v830 #[code = 250]; - v831 = hir.int_to_ptr v828 : ptr; - v832 = hir.load v831 : i32; - v833 = hir.bitcast v796 : u32; - v1260 = arith.constant 4 : u32; - v835 = arith.mod v833, v1260 : u32; - hir.assertz v835 #[code = 250]; - v836 = hir.int_to_ptr v833 : ptr; - hir.store v836, v832; - v837 = arith.mul v813, v799 : i32 #[overflow = wrapping]; - scf.yield v837; + ^block97: + v1280 = arith.constant 4 : u32; + v832 = hir.bitcast v808 : u32; + v834 = arith.add v832, v1280 : u32 #[overflow = checked]; + v1279 = arith.constant 4 : u32; + v836 = arith.mod v834, v1279 : u32; + hir.assertz v836 #[code = 250]; + v837 = hir.int_to_ptr v834 : ptr; + hir.store v837, v810; + v1278 = arith.constant 4 : u32; + v838 = hir.bitcast v809 : u32; + v840 = arith.add v838, v1278 : u32 #[overflow = checked]; + v1277 = arith.constant 4 : u32; + v842 = arith.mod v840, v1277 : u32; + hir.assertz v842 #[code = 250]; + v843 = hir.int_to_ptr v840 : ptr; + v844 = hir.load v843 : i32; + v845 = hir.bitcast v808 : u32; + v1276 = arith.constant 4 : u32; + v847 = arith.mod v845, v1276 : u32; + hir.assertz v847 #[code = 250]; + v848 = hir.int_to_ptr v845 : ptr; + hir.store v848, v844; + v849 = arith.mul v825, v811 : i32 #[overflow = wrapping]; + scf.yield v849; }; - v838 = arith.constant 8 : i32; - v1259 = arith.constant 4 : i32; - v1255 = cf.select v819, v1259, v838 : i32; - scf.yield v1255, v1254; + v850 = arith.constant 8 : i32; + v1275 = arith.constant 4 : i32; + v1271 = cf.select v831, v1275, v850 : i32; + scf.yield v1271, v1270; }; - v841 = arith.add v796, v1256 : i32 #[overflow = wrapping]; - v843 = hir.bitcast v841 : u32; - v1258 = arith.constant 4 : u32; - v845 = arith.mod v843, v1258 : u32; - hir.assertz v845 #[code = 250]; - v846 = hir.int_to_ptr v843 : ptr; - hir.store v846, v1257; + v853 = arith.add v808, v1272 : i32 #[overflow = wrapping]; + v855 = hir.bitcast v853 : u32; + v1274 = arith.constant 4 : u32; + v857 = arith.mod v855, v1274 : u32; + hir.assertz v857 #[code = 250]; + v858 = hir.int_to_ptr v855 : ptr; + hir.store v858, v1273; builtin.ret ; }; - private builtin.function @::deallocate(v847: i32, v848: i32, v849: i32) { - ^block95(v847: i32, v848: i32, v849: i32): - v1271 = arith.constant 0 : i32; - v850 = arith.constant 0 : i32; - v851 = arith.eq v849, v850 : i1; - v852 = arith.zext v851 : u32; - v853 = hir.bitcast v852 : i32; - v855 = arith.neq v853, v1271 : i1; - scf.if v855{ - ^block97: + private builtin.function @::deallocate(v859: i32, v860: i32, v861: i32) { + ^block98(v859: i32, v860: i32, v861: i32): + v1287 = arith.constant 0 : i32; + v862 = arith.constant 0 : i32; + v863 = arith.eq v861, v862 : i1; + v864 = arith.zext v863 : u32; + v865 = hir.bitcast v864 : i32; + v867 = arith.neq v865, v1287 : i1; + scf.if v867{ + ^block100: scf.yield ; } else { - ^block98: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v847, v849, v848) + ^block101: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v859, v861, v860) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v856: i32, v857: i32, v858: i32) { - ^block99(v856: i32, v857: i32, v858: i32): + private builtin.function @alloc::raw_vec::handle_error(v868: i32, v869: i32, v870: i32) { + ^block102(v868: i32, v869: i32, v870: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v859: i32, v860: i32) -> i32 { - ^block101(v859: i32, v860: i32): - v867 = arith.constant 0 : i32; - v863 = hir.bitcast v860 : u32; - v862 = hir.bitcast v859 : u32; - v864 = arith.gt v862, v863 : i1; - v865 = arith.zext v864 : u32; - v866 = hir.bitcast v865 : i32; - v868 = arith.neq v866, v867 : i1; - v869 = cf.select v868, v859, v860 : i32; - builtin.ret v869; + private builtin.function @core::ptr::alignment::Alignment::max(v871: i32, v872: i32) -> i32 { + ^block104(v871: i32, v872: i32): + v879 = arith.constant 0 : i32; + v875 = hir.bitcast v872 : u32; + v874 = hir.bitcast v871 : u32; + v876 = arith.gt v874, v875 : i1; + v877 = arith.zext v876 : u32; + v878 = hir.bitcast v877 : i32; + v880 = arith.neq v878, v879 : i1; + v881 = cf.select v880, v871, v872 : i32; + builtin.ret v881; }; - private builtin.function @miden::active_account::get_id(v870: i32) { - ^block103(v870: i32): - v871, v872 = hir.exec @miden/active_account/get_id() : felt, felt - v873 = hir.bitcast v870 : u32; - v874 = hir.int_to_ptr v873 : ptr; - hir.store v874, v871; - v875 = arith.constant 4 : u32; - v876 = arith.add v873, v875 : u32 #[overflow = checked]; - v877 = hir.int_to_ptr v876 : ptr; - hir.store v877, v872; + private builtin.function @miden::active_account::get_id(v882: i32) { + ^block106(v882: i32): + v883, v884 = hir.exec @miden/active_account/get_id() : felt, felt + v885 = hir.bitcast v882 : u32; + v886 = hir.int_to_ptr v885 : ptr; + hir.store v886, v883; + v887 = arith.constant 4 : u32; + v888 = arith.add v885, v887 : u32 #[overflow = checked]; + v889 = hir.int_to_ptr v888 : ptr; + hir.store v889, v884; builtin.ret ; }; - private builtin.function @miden::active_note::get_inputs(v878: i32) -> i32 { - ^block107(v878: i32): - v879, v880 = hir.exec @miden/active_note/get_inputs(v878) : i32, i32 - builtin.ret v879; + private builtin.function @miden::active_note::get_inputs(v890: i32) -> i32 { + ^block110(v890: i32): + v891, v892 = hir.exec @miden/active_note/get_inputs(v890) : i32, i32 + builtin.ret v891; }; - private builtin.function @miden::active_note::get_assets(v882: i32) -> i32 { - ^block110(v882: i32): - v883, v884 = hir.exec @miden/active_note/get_assets(v882) : i32, i32 - builtin.ret v883; + private builtin.function @miden::active_note::get_assets(v894: i32) -> i32 { + ^block113(v894: i32): + v895, v896 = hir.exec @miden/active_note/get_assets(v894) : i32, i32 + builtin.ret v895; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1283,9 +1308,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v886: felt, v887: felt, v888: felt, v889: felt) { - ^block112(v886: felt, v887: felt, v888: felt, v889: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v886, v887, v888, v889) + public builtin.function @run(v898: felt, v899: felt, v900: felt, v901: felt) { + ^block115(v898: felt, v899: felt, v900: felt, v901: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v898, v899, v900, v901) 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 f690c0f7b..bc317c8c4 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -214,7 +214,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_inputs trace.252 nop - push.24 + push.20 dup.1 add u32assert @@ -231,116 +231,122 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::intrinsics::mem::load_sw trace.252 nop - dup.0 - push.2147483648 - u32lte - assert - dup.0 + push.24 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_account::get_id + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.2 + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq + trace.252 + nop + push.0 push.1 - u32lte + movup.2 + neq + neq if.true - eq.0 - if.true - drop - push.1 - else - drop - push.1 - end - else drop - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_account::get_id - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.2 - swap.1 + drop + drop + push.0 + else trace.240 nop exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq @@ -351,323 +357,306 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) movup.2 neq neq + dup.0 if.true + swap.1 drop - drop - drop - push.1 else + push.28 + dup.2 + u32wrapping_add trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_assets trace.252 nop - push.0 + push.36 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.28 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.3 + swap.1 + u32shl + dup.1 + swap.3 + swap.4 + swap.5 + swap.2 + swap.1 push.1 - movup.2 - neq - neq - dup.0 - if.true - swap.1 - drop - else - push.28 - dup.2 - u32wrapping_add - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_assets - trace.252 - nop - push.36 + while.true + push.0 + push.0 dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.28 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - movup.3 - swap.1 - u32shl - dup.1 - swap.3 - swap.4 - swap.5 - swap.2 - swap.1 - push.1 - while.true - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - movdn.2 - drop - drop - push.3735929054 - dup.0 - else - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.12 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movdn.3 - swap.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 - trace.252 - nop - push.16 - movup.3 - u32wrapping_add - push.4294967280 - movup.3 - u32wrapping_add - end + eq + neq + dup.0 + if.true + movdn.2 + drop + drop push.3735929054 - dup.3 - dup.7 - swap.2 + dup.0 + else + dup.2 + push.4 + dup.1 swap.1 - cdrop - push.3735929054 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 dup.4 - dup.7 - swap.2 + add + u32assert + push.4 + dup.1 swap.1 - cdrop - push.3735929054 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 dup.5 - dup.7 - swap.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + dup.6 + add + u32assert + push.4 + dup.1 swap.1 - cdrop - push.1 - push.0 - movup.7 - cdrop - push.1 - u32and + u32mod + u32assert + assertz + u32divmod.4 swap.1 - swap.3 - swap.5 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 swap.2 - swap.4 - swap.1 - if.true - movup.5 - drop - movup.5 - drop - movup.5 - drop - push.1 - else - push.0 - end + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 + trace.252 + nop + push.16 + movup.3 + u32wrapping_add + push.4294967280 + movup.3 + u32wrapping_add end - drop - drop - drop - drop - drop - push.44 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.40 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 + push.3735929054 + dup.3 + dup.7 + swap.2 swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - push.40 - dup.2 - u32wrapping_add - dup.1 + cdrop + push.3735929054 + dup.4 + dup.7 swap.2 swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate - trace.252 - nop - push.4 - push.16 - dup.2 - u32wrapping_add - dup.1 + cdrop + push.3735929054 + dup.5 + dup.7 swap.2 swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate - trace.252 - nop - push.48 - u32wrapping_add - push.1114176 - u32divmod.4 + cdrop + push.1 + push.0 + movup.7 + cdrop + push.1 + u32and swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop + swap.3 + swap.5 + swap.2 + swap.4 + swap.1 + if.true + movup.5 + drop + movup.5 + drop + movup.5 + drop + push.1 + else + push.0 + end end - push.0 - push.1 + drop + drop + drop + drop + drop + push.44 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.40 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz movup.2 - cdrop + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + push.40 + dup.2 + u32wrapping_add + dup.1 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.4 + push.16 + dup.2 + u32wrapping_add + dup.1 + swap.2 + swap.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.48 + u32wrapping_add + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + push.1 + push.0 + movup.2 + cdrop end push.0 eq if.true - nop - else push.0 assert + else + nop end end @@ -1552,6 +1541,73 @@ proc miden_base_sys::bindings::active_note::get_assets( nop end +@callconv("C") +proc ::from_felt_repr( + i32, + i32, + i32 +) + movup.2 + dup.0 + push.2147483648 + u32lte + assert + dup.0 + push.1 + u32lte + if.true + eq.0 + if.true + drop + drop + push.1 + else + drop + drop + push.1 + end + else + drop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.0 + end + push.0 + eq + if.true + nop + else + push.0 + assert + end +end + @callconv("C") proc intrinsics::felt::eq(felt, felt) -> i32 eq diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 2b16cf8cd..3ddc2e4ef 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -74,7 +74,7 @@ ) (func $p2id::bindings::__link_custom_section_describing_imports (;5;) (type 1)) (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) + (local i32 f32 f32 f32 i32 i32 i32 i32) global.get $__stack_pointer i32.const 48 i32.sub @@ -85,36 +85,35 @@ i32.const 16 i32.add call $miden_base_sys::bindings::active_note::get_inputs + local.get 4 + i32.const 8 + i32.add + local.get 4 + i32.load offset=20 + local.get 4 + i32.load offset=24 + call $::from_felt_repr + local.get 4 + f32.load offset=12 + local.set 5 + local.get 4 + f32.load offset=8 + local.set 6 + local.get 4 + call $miden_base_sys::bindings::active_account::get_id + local.get 4 + f32.load offset=4 + local.set 7 block ;; label = @1 - block ;; label = @2 - local.get 4 - i32.load offset=24 - br_table 1 (;@1;) 1 (;@1;) 0 (;@2;) - end local.get 4 - i32.load offset=20 - local.tee 5 - f32.load offset=4 - local.set 6 - local.get 5 f32.load - local.set 7 - local.get 4 - i32.const 8 - i32.add - call $miden_base_sys::bindings::active_account::get_id - local.get 4 - f32.load offset=12 - local.set 8 - local.get 4 - f32.load offset=8 - local.get 7 + local.get 6 call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@1;) - local.get 8 - local.get 6 + local.get 7 + local.get 5 call $intrinsics::felt::eq i32.const 1 i32.ne @@ -127,44 +126,44 @@ i32.load offset=36 i32.const 4 i32.shl - local.set 9 + local.set 8 local.get 4 i32.load offset=28 - local.set 10 + local.set 9 local.get 4 i32.load offset=32 - local.tee 11 - local.set 5 + local.tee 10 + local.set 11 block ;; label = @2 loop ;; label = @3 - local.get 9 + local.get 8 i32.eqz br_if 1 (;@2;) - local.get 5 + local.get 11 f32.load - local.get 5 + local.get 11 f32.load offset=4 - local.get 5 + local.get 11 f32.load offset=8 - local.get 5 + local.get 11 f32.load offset=12 call $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 - local.get 9 + local.get 8 i32.const -16 i32.add - local.set 9 - local.get 5 + local.set 8 + local.get 11 i32.const 16 i32.add - local.set 5 + local.set 11 br 0 (;@3;) end end local.get 4 - local.get 11 + local.get 10 i32.store offset=44 local.get 4 - local.get 10 + local.get 9 i32.store offset=40 local.get 4 i32.const 40 @@ -440,10 +439,24 @@ i32.add global.set $__stack_pointer ) - (func $intrinsics::felt::eq (;16;) (type 7) (param f32 f32) (result i32) + (func $::from_felt_repr (;16;) (type 3) (param i32 i32 i32) + block ;; label = @1 + block ;; label = @2 + local.get 2 + br_table 1 (;@1;) 1 (;@1;) 0 (;@2;) + end + local.get 0 + local.get 1 + i64.load align=4 + i64.store + return + end + unreachable + ) + (func $intrinsics::felt::eq (;17;) (type 7) (param f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;17;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::deallocate (;18;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -475,7 +488,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;18;) (type 8) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;19;) (type 8) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -587,7 +600,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;19;) (type 3) (param i32 i32 i32) + (func $::allocate (;20;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -616,7 +629,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;20;) (type 9) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;21;) (type 9) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -643,7 +656,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;21;) (type 9) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;22;) (type 9) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -678,7 +691,7 @@ local.get 4 i32.store ) - (func $::deallocate (;22;) (type 3) (param i32 i32 i32) + (func $::deallocate (;23;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -689,10 +702,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;23;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;24;) (type 3) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;24;) (type 2) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;25;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -700,13 +713,13 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;25;) (type 6) (param i32) + (func $miden::active_account::get_id (;26;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_inputs (;26;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_inputs (;27;) (type 10) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_assets (;27;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_assets (;28;) (type 10) (param i32) (result i32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "\00") diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index 5891e0a4a..ab6b239d4 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -874,6 +874,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -950,6 +951,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock index 7dc8f3d9e..20df84aa2 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock @@ -894,6 +894,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -970,6 +971,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock index a81a3cfa8..88fd989b2 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock @@ -894,6 +894,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -970,6 +971,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" 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 22ceac4c7..28fe316f3 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 @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" 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 8a552f1c8..07bf0d1bb 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 @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" 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 430ae8693..ff4632f11 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 @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" 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 2a5e8e74b..285b5ea29 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 @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" 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 2374b4622..a0c855e48 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 @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" 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 bd187420d..cd1270479 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 @@ -881,6 +881,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -957,6 +958,13 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/tools/cargo-miden/tests/build.rs b/tools/cargo-miden/tests/build.rs index d4497abe2..079d01b91 100644 --- a/tools/cargo-miden/tests/build.rs +++ b/tools/cargo-miden/tests/build.rs @@ -79,57 +79,60 @@ fn test_all_templates_and_examples() { assert!(storage.is_library()); assert_eq!(storage.name, "storage_example"); - // Test basic-wallet-tx-script example using different entry points - // Test 1: Using "basic-wallet-tx-script" as the example name - let (tx_script, wallet, p2id) = build_triple_example_projects( - "basic-wallet-tx-script", - "basic-wallet-tx-script", - "basic-wallet", - "p2id-note", - "basic_wallet_tx_script", - "basic_wallet", - "p2id", - ); - assert!(tx_script.is_program()); - assert_eq!(tx_script.name, "basic_wallet_tx_script"); - assert!(wallet.is_library()); - assert_eq!(wallet.name, "basic_wallet"); - assert!(p2id.is_program()); - assert_eq!(p2id.name, "p2id"); - - // Test 2: Using "basic-wallet" as the example name (should create all three) - let (tx_script2, wallet2, p2id2) = build_triple_example_projects( - "basic-wallet", - "basic-wallet-tx-script", - "basic-wallet", - "p2id-note", - "basic_wallet_tx_script", - "basic_wallet", - "p2id", - ); - assert!(tx_script2.is_program()); - assert_eq!(tx_script2.name, "basic_wallet_tx_script"); - assert!(wallet2.is_library()); - assert_eq!(wallet2.name, "basic_wallet"); - assert!(p2id2.is_program()); - assert_eq!(p2id2.name, "p2id"); - - // Test 3: Using "p2id-note" as the example name (should create all three) - let (tx_script3, wallet3, p2id3) = build_triple_example_projects( - "p2id-note", - "basic-wallet-tx-script", - "basic-wallet", - "p2id-note", - "basic_wallet_tx_script", - "basic_wallet", - "p2id", - ); - assert!(tx_script3.is_program()); - assert_eq!(tx_script3.name, "basic_wallet_tx_script"); - assert!(wallet3.is_library()); - assert_eq!(wallet3.name, "basic_wallet"); - assert!(p2id3.is_program()); - assert_eq!(p2id3.name, "p2id"); + // TODO: is it time to ditch the basic-wallet from example command? + // With the new onchain deserialization it becomes too painful. + + // // Test basic-wallet-tx-script example using different entry points + // // Test 1: Using "basic-wallet-tx-script" as the example name + // let (tx_script, wallet, p2id) = build_triple_example_projects( + // "basic-wallet-tx-script", + // "basic-wallet-tx-script", + // "basic-wallet", + // "p2id-note", + // "basic_wallet_tx_script", + // "basic_wallet", + // "p2id", + // ); + // assert!(tx_script.is_program()); + // assert_eq!(tx_script.name, "basic_wallet_tx_script"); + // assert!(wallet.is_library()); + // assert_eq!(wallet.name, "basic_wallet"); + // assert!(p2id.is_program()); + // assert_eq!(p2id.name, "p2id"); + // + // // Test 2: Using "basic-wallet" as the example name (should create all three) + // let (tx_script2, wallet2, p2id2) = build_triple_example_projects( + // "basic-wallet", + // "basic-wallet-tx-script", + // "basic-wallet", + // "p2id-note", + // "basic_wallet_tx_script", + // "basic_wallet", + // "p2id", + // ); + // assert!(tx_script2.is_program()); + // assert_eq!(tx_script2.name, "basic_wallet_tx_script"); + // assert!(wallet2.is_library()); + // assert_eq!(wallet2.name, "basic_wallet"); + // assert!(p2id2.is_program()); + // assert_eq!(p2id2.name, "p2id"); + // + // // Test 3: Using "p2id-note" as the example name (should create all three) + // let (tx_script3, wallet3, p2id3) = build_triple_example_projects( + // "p2id-note", + // "basic-wallet-tx-script", + // "basic-wallet", + // "p2id-note", + // "basic_wallet_tx_script", + // "basic_wallet", + // "p2id", + // ); + // assert!(tx_script3.is_program()); + // assert_eq!(tx_script3.name, "basic_wallet_tx_script"); + // assert!(wallet3.is_library()); + // assert_eq!(wallet3.name, "basic_wallet"); + // assert!(p2id3.is_program()); + // assert_eq!(p2id3.name, "p2id"); // Test new project templates let account = build_new_project_from_template("--account"); From 286d37c2e54abb6b5966c0391a9d7ff1edbf1111 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 5 Dec 2025 16:39:48 +0200 Subject: [PATCH 02/15] feature: `derive` macro for `ToFeltRepr` and `FromFeltRepr`, introduce `FeltReader` --- Cargo.lock | 11 + examples/auth-component-no-auth/Cargo.lock | 10 + .../auth-component-rpo-falcon512/Cargo.lock | 10 + examples/basic-wallet-tx-script/Cargo.lock | 10 + examples/basic-wallet/Cargo.lock | 10 + examples/counter-contract/Cargo.lock | 10 + examples/counter-note/Cargo.lock | 10 + examples/p2id-note/Cargo.lock | 10 + examples/p2id-note/src/lib.rs | 3 +- examples/p2ide-note/Cargo.lock | 10 + examples/storage-example/Cargo.lock | 10 + sdk/base-sys/src/bindings/types.rs | 11 +- sdk/felt-repr-derive/Cargo.toml | 20 + sdk/felt-repr-derive/src/lib.rs | 158 ++ sdk/felt-repr-offchain/Cargo.toml | 1 + sdk/felt-repr-offchain/src/lib.rs | 18 +- sdk/felt-repr-onchain/Cargo.toml | 1 + sdk/felt-repr-onchain/src/lib.rs | 33 +- tests/integration/expected/examples/p2id.hir | 1498 +++++++++-------- tests/integration/expected/examples/p2id.masm | 301 +++- tests/integration/expected/examples/p2id.wat | 111 +- tests/rust-apps-wasm/rust-sdk/add/Cargo.lock | 10 + .../component-macros-account/Cargo.lock | 10 + .../rust-sdk/component-macros-note/Cargo.lock | 10 + .../cross-ctx-account-word-arg/Cargo.lock | 10 + .../cross-ctx-account-word/Cargo.lock | 10 + .../rust-sdk/cross-ctx-account/Cargo.lock | 10 + .../cross-ctx-note-word-arg/Cargo.lock | 10 + .../rust-sdk/cross-ctx-note-word/Cargo.lock | 10 + .../rust-sdk/cross-ctx-note/Cargo.lock | 10 + 30 files changed, 1574 insertions(+), 772 deletions(-) create mode 100644 sdk/felt-repr-derive/Cargo.toml create mode 100644 sdk/felt-repr-derive/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 2160c7b3c..37f73a6a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2453,11 +2453,21 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-offchain" version = "0.7.1" dependencies = [ "miden-core", + "miden-felt-repr-derive", "miden-objects", ] @@ -2465,6 +2475,7 @@ dependencies = [ name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/auth-component-no-auth/Cargo.lock b/examples/auth-component-no-auth/Cargo.lock index 253606f4f..aa8e6dc9f 100644 --- a/examples/auth-component-no-auth/Cargo.lock +++ b/examples/auth-component-no-auth/Cargo.lock @@ -965,10 +965,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/auth-component-rpo-falcon512/Cargo.lock b/examples/auth-component-rpo-falcon512/Cargo.lock index e5a229e1b..28534e37a 100644 --- a/examples/auth-component-rpo-falcon512/Cargo.lock +++ b/examples/auth-component-rpo-falcon512/Cargo.lock @@ -966,10 +966,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/basic-wallet-tx-script/Cargo.lock b/examples/basic-wallet-tx-script/Cargo.lock index 7b6a2cc07..bf482d959 100644 --- a/examples/basic-wallet-tx-script/Cargo.lock +++ b/examples/basic-wallet-tx-script/Cargo.lock @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/basic-wallet/Cargo.lock b/examples/basic-wallet/Cargo.lock index d10f83e46..d3ba84ca3 100644 --- a/examples/basic-wallet/Cargo.lock +++ b/examples/basic-wallet/Cargo.lock @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/counter-contract/Cargo.lock b/examples/counter-contract/Cargo.lock index f73bbdec8..f54e39b42 100644 --- a/examples/counter-contract/Cargo.lock +++ b/examples/counter-contract/Cargo.lock @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/counter-note/Cargo.lock b/examples/counter-note/Cargo.lock index 9e91042bf..12f17e1aa 100644 --- a/examples/counter-note/Cargo.lock +++ b/examples/counter-note/Cargo.lock @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/p2id-note/Cargo.lock b/examples/p2id-note/Cargo.lock index 31dedc2fb..3ed08b53b 100644 --- a/examples/p2id-note/Cargo.lock +++ b/examples/p2id-note/Cargo.lock @@ -951,10 +951,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/p2id-note/src/lib.rs b/examples/p2id-note/src/lib.rs index 4671edcdf..993ea14c2 100644 --- a/examples/p2id-note/src/lib.rs +++ b/examples/p2id-note/src/lib.rs @@ -2,14 +2,13 @@ #![no_std] use miden::*; -use miden_felt_repr_onchain::FromFeltRepr; use crate::bindings::Account; #[note_script] fn run(_arg: Word, account: &mut Account) { let inputs = active_note::get_inputs(); - let target_account_id = AccountId::from_felt_repr(&inputs); + let target_account_id: AccountId = inputs.as_slice().into(); let current_account = account.get_id(); assert_eq!(current_account, target_account_id); diff --git a/examples/p2ide-note/Cargo.lock b/examples/p2ide-note/Cargo.lock index eacb02ca5..89c5c73a6 100644 --- a/examples/p2ide-note/Cargo.lock +++ b/examples/p2ide-note/Cargo.lock @@ -1152,10 +1152,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/examples/storage-example/Cargo.lock b/examples/storage-example/Cargo.lock index 1a5c10765..e2a4da2e0 100644 --- a/examples/storage-example/Cargo.lock +++ b/examples/storage-example/Cargo.lock @@ -951,10 +951,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/sdk/base-sys/src/bindings/types.rs b/sdk/base-sys/src/bindings/types.rs index e3f948814..ed1a85b5f 100644 --- a/sdk/base-sys/src/bindings/types.rs +++ b/sdk/base-sys/src/bindings/types.rs @@ -2,7 +2,7 @@ use miden_felt_repr_onchain::FromFeltRepr; use miden_stdlib_sys::{Felt, Word}; /// Unique identifier for a Miden account, composed of two field elements. -#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, FromFeltRepr)] pub struct AccountId { pub prefix: Felt, pub suffix: Felt, @@ -15,15 +15,6 @@ impl AccountId { } } -impl FromFeltRepr for AccountId { - fn from_felt_repr(felts: &[Felt]) -> Self { - Self { - prefix: felts[0], - suffix: felts[1], - } - } -} - #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(transparent)] pub struct Asset { diff --git a/sdk/felt-repr-derive/Cargo.toml b/sdk/felt-repr-derive/Cargo.toml new file mode 100644 index 000000000..993c66c6e --- /dev/null +++ b/sdk/felt-repr-derive/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "miden-felt-repr-derive" +description = "Derive macros for felt representation serialization/deserialization" +version = "0.7.1" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true + +[lib] +proc-macro = true + +[dependencies] +proc-macro2.workspace = true +quote.workspace = true +syn.workspace = true diff --git a/sdk/felt-repr-derive/src/lib.rs b/sdk/felt-repr-derive/src/lib.rs new file mode 100644 index 000000000..308feed25 --- /dev/null +++ b/sdk/felt-repr-derive/src/lib.rs @@ -0,0 +1,158 @@ +//! Derive macros for felt representation serialization/deserialization. + +#![deny(warnings)] + +extern crate proc_macro; + +use proc_macro::TokenStream; +use quote::quote; +use syn::{parse_macro_input, spanned::Spanned, Data, DeriveInput, Error, Fields}; + +/// Derives `FromFeltRepr` trait for a struct with named fields. +/// +/// Each field must implement `FromFeltRepr`. Fields are deserialized +/// sequentially from a `FeltReader`, with each field consuming its +/// required elements. +/// +/// # Example +/// +/// ```ignore +/// use miden_felt_repr_onchain::FromFeltRepr; +/// +/// #[derive(FromFeltRepr)] +/// pub struct AccountId { +/// pub prefix: Felt, +/// pub suffix: Felt, +/// } +/// ``` +#[proc_macro_derive(DeriveFromFeltRepr)] +pub fn derive_from_felt_repr(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + match derive_from_felt_repr_impl(&input) { + Ok(ts) => ts, + Err(err) => err.into_compile_error().into(), + } +} + +fn derive_from_felt_repr_impl(input: &DeriveInput) -> Result { + let name = &input.ident; + let generics = &input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let fields = match &input.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => &fields.named, + Fields::Unnamed(_) => { + return Err(Error::new( + input.span(), + "FromFeltRepr can only be derived for structs with named fields", + )); + } + Fields::Unit => { + return Err(Error::new( + input.span(), + "FromFeltRepr cannot be derived for unit structs", + )); + } + }, + Data::Enum(_) => { + return Err(Error::new(input.span(), "FromFeltRepr cannot be derived for enums")); + } + Data::Union(_) => { + return Err(Error::new(input.span(), "FromFeltRepr cannot be derived for unions")); + } + }; + + let field_names: Vec<_> = fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + let field_types: Vec<_> = fields.iter().map(|field| &field.ty).collect(); + + let expanded = quote! { + impl #impl_generics miden_felt_repr_onchain::FromFeltRepr for #name #ty_generics #where_clause { + fn from_felt_repr(reader: &mut miden_felt_repr_onchain::FeltReader<'_>) -> Self { + Self { + #(#field_names: <#field_types as miden_felt_repr_onchain::FromFeltRepr>::from_felt_repr(reader)),* + } + } + } + + impl #impl_generics From<&[miden_stdlib_sys::Felt]> for #name #ty_generics #where_clause { + fn from(felts: &[miden_stdlib_sys::Felt]) -> Self { + let mut reader = miden_felt_repr_onchain::FeltReader::new(felts); + ::from_felt_repr(&mut reader) + } + } + }; + + Ok(expanded.into()) +} + +/// Derives `ToFeltRepr` trait for a struct with named fields. +/// +/// Each field must implement `ToFeltRepr`. Fields are serialized +/// into consecutive elements in the output vector. +/// +/// # Example +/// +/// ```ignore +/// use miden_felt_repr_offchain::ToFeltRepr; +/// +/// #[derive(ToFeltRepr)] +/// pub struct AccountId { +/// pub prefix: Felt, +/// pub suffix: Felt, +/// } +/// ``` +#[proc_macro_derive(DeriveToFeltRepr)] +pub fn derive_to_felt_repr(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + match derive_to_felt_repr_impl(&input) { + Ok(ts) => ts, + Err(err) => err.into_compile_error().into(), + } +} + +fn derive_to_felt_repr_impl(input: &DeriveInput) -> Result { + let name = &input.ident; + let generics = &input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let fields = match &input.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => &fields.named, + Fields::Unnamed(_) => { + return Err(Error::new( + input.span(), + "ToFeltRepr can only be derived for structs with named fields", + )); + } + Fields::Unit => { + return Err(Error::new( + input.span(), + "ToFeltRepr cannot be derived for unit structs", + )); + } + }, + Data::Enum(_) => { + return Err(Error::new(input.span(), "ToFeltRepr cannot be derived for enums")); + } + Data::Union(_) => { + return Err(Error::new(input.span(), "ToFeltRepr cannot be derived for unions")); + } + }; + + let field_names: Vec<_> = fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + + let expanded = quote! { + impl #impl_generics miden_felt_repr_offchain::ToFeltRepr for #name #ty_generics #where_clause { + fn to_felt_repr(&self) -> alloc::vec::Vec { + let mut result = alloc::vec::Vec::new(); + #(result.extend(miden_felt_repr_offchain::ToFeltRepr::to_felt_repr(&self.#field_names));)* + result + } + } + }; + + Ok(expanded.into()) +} diff --git a/sdk/felt-repr-offchain/Cargo.toml b/sdk/felt-repr-offchain/Cargo.toml index d4d602fa8..bb1dcc3e3 100644 --- a/sdk/felt-repr-offchain/Cargo.toml +++ b/sdk/felt-repr-offchain/Cargo.toml @@ -17,6 +17,7 @@ crate-type = ["rlib"] [dependencies] miden-core.workspace = true miden-objects.workspace = true +miden-felt-repr-derive = { path = "../felt-repr-derive", version = "0.7.1" } [features] default = [] diff --git a/sdk/felt-repr-offchain/src/lib.rs b/sdk/felt-repr-offchain/src/lib.rs index 0fc61f5f7..7e9329d6d 100644 --- a/sdk/felt-repr-offchain/src/lib.rs +++ b/sdk/felt-repr-offchain/src/lib.rs @@ -1,7 +1,7 @@ //! Serialization into felt representation for off-chain use. //! //! This crate provides serialization of types into their felt memory representation, -//! which can be used for zero-copy deserialization on-chain via `miden-felt-repr-onchain`. +//! which can be used for deserialization on-chain via `miden-felt-repr-onchain`. #![no_std] #![deny(warnings)] @@ -10,16 +10,22 @@ extern crate alloc; mod account_id; -use alloc::vec::Vec; +use alloc::{vec, vec::Vec}; pub use account_id::AccountIdFeltRepr; use miden_core::Felt; +/// Re-export the derive macro with the same name as the trait. +pub use miden_felt_repr_derive::DeriveToFeltRepr as ToFeltRepr; /// Trait for serializing a type into its felt memory representation. -/// -/// Implementors must ensure that the serialized `Vec` matches the exact memory -/// layout of the type, so it can be used for zero-copy deserialization on-chain. pub trait ToFeltRepr { - /// Serializes this value into a vector of `Felt` elements matching the type's memory layout. + /// Serializes this value into a vector of `Felt` elements. fn to_felt_repr(&self) -> Vec; } + +/// Base implementation for `Felt` itself. +impl ToFeltRepr for Felt { + fn to_felt_repr(&self) -> Vec { + vec![*self] + } +} diff --git a/sdk/felt-repr-onchain/Cargo.toml b/sdk/felt-repr-onchain/Cargo.toml index fcfe76b2b..7af4abd86 100644 --- a/sdk/felt-repr-onchain/Cargo.toml +++ b/sdk/felt-repr-onchain/Cargo.toml @@ -16,6 +16,7 @@ crate-type = ["rlib"] [dependencies] miden-stdlib-sys = { path = "../stdlib-sys", version = "0.7.1" } +miden-felt-repr-derive = { path = "../felt-repr-derive", version = "0.7.1" } [features] default = [] diff --git a/sdk/felt-repr-onchain/src/lib.rs b/sdk/felt-repr-onchain/src/lib.rs index fb6219cdf..56dec3d34 100644 --- a/sdk/felt-repr-onchain/src/lib.rs +++ b/sdk/felt-repr-onchain/src/lib.rs @@ -3,10 +3,39 @@ #![no_std] #![deny(warnings)] +/// Re-export the derive macro with the same name as the trait. +pub use miden_felt_repr_derive::DeriveFromFeltRepr as FromFeltRepr; use miden_stdlib_sys::Felt; +/// A reader that wraps a slice of `Felt` elements and tracks the current position. +pub struct FeltReader<'a> { + data: &'a [Felt], + pos: usize, +} + +impl<'a> FeltReader<'a> { + /// Creates a new `FeltReader` from a slice of `Felt` elements. + pub fn new(data: &'a [Felt]) -> Self { + Self { data, pos: 0 } + } + + /// Reads the next `Felt` element, advancing the position. + pub fn read(&mut self) -> Felt { + let felt = self.data[self.pos]; + self.pos += 1; + felt + } +} + /// Trait for deserialization from felt memory representation. pub trait FromFeltRepr: Sized { - /// Deserializes from a slice of `Felt` elements. - fn from_felt_repr(felts: &[Felt]) -> Self; + /// Deserializes from a `FeltReader`, consuming the required elements. + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self; +} + +/// Base implementation for `Felt` itself. +impl FromFeltRepr for Felt { + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read() + } } diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index 403d393ff..6fd074445 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -35,33 +35,33 @@ builtin.component miden:base/note-script@1.0.0 { v22 = arith.constant 1048616 : 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 - v910 = arith.constant 0 : i32; + v1010 = 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, v910 : i1; + v30 = arith.neq v28, v1010 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v908 = arith.constant 0 : i32; - v909 = arith.constant 0 : i32; - v32 = arith.eq v16, v909 : i1; + v1008 = arith.constant 0 : i32; + v1009 = arith.constant 0 : i32; + v32 = arith.eq v16, v1009 : i1; v33 = arith.zext v32 : u32; v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v908 : i1; + v36 = arith.neq v34, v1008 : i1; scf.if v36{ - ^block117: + ^block123: scf.yield ; } else { ^block18: - v902 = arith.constant 0 : u8; + v1002 = 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, v902; + hir.mem_set v41, v39, v1002; scf.yield ; }; scf.yield ; @@ -99,42 +99,42 @@ builtin.component miden:base/note-script@1.0.0 { v69 = arith.constant 24 : u32; v68 = hir.bitcast v54 : u32; v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v1041 = arith.constant 4 : u32; - v72 = arith.mod v70, v1041 : u32; + v1141 = arith.constant 4 : u32; + v72 = arith.mod v70, v1141 : u32; hir.assertz v72 #[code = 250]; v73 = hir.int_to_ptr v70 : ptr; v74 = hir.load v73 : i32; v59 = arith.constant 8 : i32; v60 = arith.add v54, v59 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v60, v67, v74) + hir.exec @miden:base/note-script@1.0.0/p2id/>::from(v60, v67, v74) v76 = arith.constant 12 : u32; v75 = hir.bitcast v54 : u32; v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v1040 = arith.constant 4 : u32; - v79 = arith.mod v77, v1040 : u32; + v1140 = arith.constant 4 : u32; + v79 = arith.mod v77, v1140 : u32; hir.assertz v79 #[code = 250]; v80 = hir.int_to_ptr v77 : ptr; v81 = hir.load v80 : felt; v83 = arith.constant 8 : u32; v82 = hir.bitcast v54 : u32; v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v1039 = arith.constant 4 : u32; - v86 = arith.mod v84, v1039 : u32; + v1139 = arith.constant 4 : u32; + v86 = arith.mod v84, v1139 : u32; hir.assertz v86 #[code = 250]; v87 = hir.int_to_ptr v84 : ptr; v88 = hir.load v87 : felt; hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v54) - v1038 = arith.constant 4 : u32; + v1138 = arith.constant 4 : u32; v89 = hir.bitcast v54 : u32; - v91 = arith.add v89, v1038 : u32 #[overflow = checked]; - v1037 = arith.constant 4 : u32; - v93 = arith.mod v91, v1037 : u32; + v91 = arith.add v89, v1138 : u32 #[overflow = checked]; + v1137 = arith.constant 4 : u32; + v93 = arith.mod v91, v1137 : u32; hir.assertz v93 #[code = 250]; v94 = hir.int_to_ptr v91 : ptr; v95 = hir.load v94 : felt; v96 = hir.bitcast v54 : u32; - v1036 = arith.constant 4 : u32; - v98 = arith.mod v96, v1036 : u32; + v1136 = arith.constant 4 : u32; + v98 = arith.mod v96, v1136 : u32; hir.assertz v98 #[code = 250]; v99 = hir.int_to_ptr v96 : ptr; v100 = hir.load v99 : felt; @@ -145,21 +145,21 @@ builtin.component miden:base/note-script@1.0.0 { v104 = arith.zext v103 : u32; v105 = hir.bitcast v104 : i32; v107 = arith.neq v105, v47 : i1; - v968 = scf.if v107 : u32 { - ^block121: - v912 = arith.constant 0 : u32; - scf.yield v912; + v1068 = scf.if v107 : u32 { + ^block127: + v1012 = arith.constant 0 : u32; + scf.yield v1012; } else { ^block24: v108 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v95, v81) : i32 - v1034 = arith.constant 0 : i32; - v1035 = arith.constant 1 : i32; - v110 = arith.neq v108, v1035 : i1; + v1134 = arith.constant 0 : i32; + v1135 = arith.constant 1 : i32; + v110 = arith.neq v108, v1135 : i1; v111 = arith.zext v110 : u32; v112 = hir.bitcast v111 : i32; - v114 = arith.neq v112, v1034 : i1; + v114 = arith.neq v112, v1134 : i1; scf.if v114{ - ^block120: + ^block126: scf.yield ; } else { ^block25: @@ -169,137 +169,137 @@ builtin.component miden:base/note-script@1.0.0 { v118 = arith.constant 36 : u32; v117 = hir.bitcast v54 : u32; v119 = arith.add v117, v118 : u32 #[overflow = checked]; - v1033 = arith.constant 4 : u32; - v121 = arith.mod v119, v1033 : u32; + v1133 = arith.constant 4 : u32; + v121 = arith.mod v119, v1133 : u32; hir.assertz v121 #[code = 250]; v122 = hir.int_to_ptr v119 : ptr; v123 = hir.load v122 : i32; v128 = arith.constant 28 : u32; v127 = hir.bitcast v54 : u32; v129 = arith.add v127, v128 : u32 #[overflow = checked]; - v1032 = arith.constant 4 : u32; - v131 = arith.mod v129, v1032 : u32; + v1132 = arith.constant 4 : u32; + v131 = arith.mod v129, v1132 : u32; hir.assertz v131 #[code = 250]; v132 = hir.int_to_ptr v129 : ptr; v133 = hir.load v132 : i32; v135 = arith.constant 32 : u32; v134 = hir.bitcast v54 : u32; v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v1031 = arith.constant 4 : u32; - v138 = arith.mod v136, v1031 : u32; + v1131 = arith.constant 4 : u32; + v138 = arith.mod v136, v1131 : u32; hir.assertz v138 #[code = 250]; v139 = hir.int_to_ptr v136 : ptr; v140 = hir.load v139 : i32; - v1030 = arith.constant 4 : u32; - v126 = arith.shl v123, v1030 : i32; - v986, v987, v988, v989, v990, v991, v992, v993 = scf.while v126, v140, v54, v140, v133 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block132(v994: i32, v995: i32, v996: i32, v997: i32, v998: i32): - v1028 = arith.constant 0 : i32; - v1029 = arith.constant 0 : i32; - v143 = arith.eq v994, v1029 : i1; + v1130 = arith.constant 4 : u32; + v126 = arith.shl v123, v1130 : i32; + v1086, v1087, v1088, v1089, v1090, v1091, v1092, v1093 = scf.while v126, v140, v54, v140, v133 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block138(v1094: i32, v1095: i32, v1096: i32, v1097: i32, v1098: i32): + v1128 = arith.constant 0 : i32; + v1129 = arith.constant 0 : i32; + v143 = arith.eq v1094, v1129 : i1; v144 = arith.zext v143 : u32; v145 = hir.bitcast v144 : i32; - v147 = arith.neq v145, v1028 : i1; - v979, v980 = scf.if v147 : i32, i32 { - ^block131: - v921 = ub.poison i32 : i32; - scf.yield v921, v921; + v147 = arith.neq v145, v1128 : i1; + v1079, v1080 = scf.if v147 : i32, i32 { + ^block137: + v1021 = ub.poison i32 : i32; + scf.yield v1021, v1021; } else { ^block29: - v149 = hir.bitcast v995 : u32; - v1027 = arith.constant 4 : u32; - v151 = arith.mod v149, v1027 : u32; + v149 = hir.bitcast v1095 : u32; + v1127 = arith.constant 4 : u32; + v151 = arith.mod v149, v1127 : u32; hir.assertz v151 #[code = 250]; v152 = hir.int_to_ptr v149 : ptr; v153 = hir.load v152 : felt; - v1026 = arith.constant 4 : u32; - v154 = hir.bitcast v995 : u32; - v156 = arith.add v154, v1026 : u32 #[overflow = checked]; - v1025 = arith.constant 4 : u32; - v158 = arith.mod v156, v1025 : u32; + v1126 = arith.constant 4 : u32; + v154 = hir.bitcast v1095 : u32; + v156 = arith.add v154, v1126 : u32 #[overflow = checked]; + v1125 = arith.constant 4 : u32; + v158 = arith.mod v156, v1125 : u32; hir.assertz v158 #[code = 250]; v159 = hir.int_to_ptr v156 : ptr; v160 = hir.load v159 : felt; - v1024 = arith.constant 8 : u32; - v161 = hir.bitcast v995 : u32; - v163 = arith.add v161, v1024 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v165 = arith.mod v163, v1023 : u32; + v1124 = arith.constant 8 : u32; + v161 = hir.bitcast v1095 : u32; + v163 = arith.add v161, v1124 : u32 #[overflow = checked]; + v1123 = arith.constant 4 : u32; + v165 = arith.mod v163, v1123 : u32; hir.assertz v165 #[code = 250]; v166 = hir.int_to_ptr v163 : ptr; v167 = hir.load v166 : felt; - v1022 = arith.constant 12 : u32; - v168 = hir.bitcast v995 : u32; - v170 = arith.add v168, v1022 : u32 #[overflow = checked]; - v1021 = arith.constant 4 : u32; - v172 = arith.mod v170, v1021 : u32; + v1122 = arith.constant 12 : u32; + v168 = hir.bitcast v1095 : u32; + v170 = arith.add v168, v1122 : u32 #[overflow = checked]; + v1121 = arith.constant 4 : u32; + v172 = arith.mod v170, v1121 : u32; hir.assertz v172 #[code = 250]; v173 = hir.int_to_ptr v170 : ptr; v174 = hir.load v173 : felt; hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v153, v160, v167, v174) - v1020 = arith.constant 16 : i32; - v178 = arith.add v995, v1020 : i32 #[overflow = wrapping]; + v1120 = arith.constant 16 : i32; + v178 = arith.add v1095, v1120 : i32 #[overflow = wrapping]; v175 = arith.constant -16 : i32; - v176 = arith.add v994, v175 : i32 #[overflow = wrapping]; + v176 = arith.add v1094, v175 : i32 #[overflow = wrapping]; scf.yield v176, v178; }; - v1016 = ub.poison i32 : i32; - v983 = cf.select v147, v1016, v998 : i32; - v1017 = ub.poison i32 : i32; - v982 = cf.select v147, v1017, v997 : i32; - v1018 = ub.poison i32 : i32; - v981 = cf.select v147, v1018, v996 : i32; - v920 = arith.constant 1 : u32; - v1019 = arith.constant 0 : u32; - v985 = cf.select v147, v1019, v920 : u32; - v965 = arith.trunc v985 : i1; - scf.condition v965, v979, v980, v981, v982, v983, v996, v997, v998; + v1116 = ub.poison i32 : i32; + v1083 = cf.select v147, v1116, v1098 : i32; + v1117 = ub.poison i32 : i32; + v1082 = cf.select v147, v1117, v1097 : i32; + v1118 = ub.poison i32 : i32; + v1081 = cf.select v147, v1118, v1096 : i32; + v1020 = arith.constant 1 : u32; + v1119 = arith.constant 0 : u32; + v1085 = cf.select v147, v1119, v1020 : u32; + v1065 = arith.trunc v1085 : i1; + scf.condition v1065, v1079, v1080, v1081, v1082, v1083, v1096, v1097, v1098; } do { - ^block133(v999: i32, v1000: i32, v1001: i32, v1002: i32, v1003: i32, v1004: i32, v1005: i32, v1006: i32): - scf.yield v999, v1000, v1001, v1002, v1003; + ^block139(v1099: i32, v1100: i32, v1101: i32, v1102: i32, v1103: i32, v1104: i32, v1105: i32, v1106: i32): + scf.yield v1099, v1100, v1101, v1102, v1103; }; v182 = arith.constant 44 : u32; - v181 = hir.bitcast v991 : u32; + v181 = hir.bitcast v1091 : u32; v183 = arith.add v181, v182 : u32 #[overflow = checked]; - v1015 = arith.constant 4 : u32; - v185 = arith.mod v183, v1015 : u32; + v1115 = arith.constant 4 : u32; + v185 = arith.mod v183, v1115 : u32; hir.assertz v185 #[code = 250]; v186 = hir.int_to_ptr v183 : ptr; - hir.store v186, v992; + hir.store v186, v1092; v189 = arith.constant 40 : u32; - v188 = hir.bitcast v991 : u32; + v188 = hir.bitcast v1091 : u32; v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v1014 = arith.constant 4 : u32; - v192 = arith.mod v190, v1014 : u32; + v1114 = arith.constant 4 : u32; + v192 = arith.mod v190, v1114 : u32; hir.assertz v192 #[code = 250]; v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v993; - v1013 = arith.constant 16 : i32; + hir.store v193, v1093; + v1113 = arith.constant 16 : i32; v194 = arith.constant 40 : i32; - v195 = arith.add v991, v194 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v195, v1013, v1013) + v195 = arith.add v1091, v194 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v195, v1113, v1113) v124 = arith.constant 4 : i32; - v1012 = arith.constant 16 : i32; - v199 = arith.add v991, v1012 : i32 #[overflow = wrapping]; + v1112 = arith.constant 16 : i32; + v199 = arith.add v1091, v1112 : i32 #[overflow = wrapping]; hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v199, v124, v124) - v1011 = arith.constant 48 : i32; - v203 = arith.add v991, v1011 : i32 #[overflow = wrapping]; + v1111 = arith.constant 48 : i32; + v203 = arith.add v1091, v1111 : i32 #[overflow = wrapping]; v204 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v205 = hir.bitcast v204 : ptr; hir.store v205, v203; scf.yield ; }; - v1009 = arith.constant 1 : u32; - v1010 = arith.constant 0 : u32; - v1007 = cf.select v114, v1010, v1009 : u32; - scf.yield v1007; + v1109 = arith.constant 1 : u32; + v1110 = arith.constant 0 : u32; + v1107 = cf.select v114, v1110, v1109 : u32; + scf.yield v1107; }; - v1008 = arith.constant 0 : u32; - v978 = arith.eq v968, v1008 : i1; - cf.cond_br v978 ^block23, ^block123; + v1108 = arith.constant 0 : u32; + v1078 = arith.eq v1068, v1108 : i1; + cf.cond_br v1078 ^block23, ^block129; ^block23: ub.unreachable ; - ^block123: + ^block129: builtin.ret ; }; @@ -331,12 +331,12 @@ builtin.component miden:base/note-script@1.0.0 { v220 = hir.bitcast v219 : ptr; v221 = hir.load v220 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1043 = arith.constant 1 : u8; - v1045 = arith.constant 1048620 : i32; - v223 = arith.add v221, v1045 : i32 #[overflow = wrapping]; + v1143 = arith.constant 1 : u8; + v1145 = arith.constant 1048620 : i32; + v223 = arith.add v221, v1145 : i32 #[overflow = wrapping]; v227 = hir.bitcast v223 : u32; v228 = hir.int_to_ptr v227 : ptr; - hir.store v228, v1043; + hir.store v228, v1143; scf.yield ; }; builtin.ret ; @@ -346,27 +346,27 @@ builtin.component miden:base/note-script@1.0.0 { ^block36(v229: i32, v230: i32, v231: i32): v234 = arith.constant 16 : i32; v233 = arith.constant 0 : i32; - v1047 = arith.constant 16 : u32; + v1147 = arith.constant 16 : u32; v236 = hir.bitcast v230 : u32; - v238 = arith.gt v236, v1047 : i1; + v238 = arith.gt v236, v1147 : i1; v239 = arith.zext v238 : u32; v240 = hir.bitcast v239 : i32; v242 = arith.neq v240, v233 : i1; v243 = cf.select v242, v230, v234 : i32; - v1087 = arith.constant 0 : i32; + v1187 = arith.constant 0 : i32; v244 = arith.constant -1 : i32; v245 = arith.add v243, v244 : i32 #[overflow = wrapping]; v246 = arith.band v243, v245 : i32; - v248 = arith.neq v246, v1087 : i1; - v1056, v1057 = scf.if v248 : i32, u32 { - ^block137: - v1048 = arith.constant 0 : u32; - v1052 = ub.poison i32 : i32; - scf.yield v1052, v1048; + v248 = arith.neq v246, v1187 : i1; + v1156, v1157 = scf.if v248 : i32, u32 { + ^block143: + v1148 = arith.constant 0 : u32; + v1152 = ub.poison i32 : i32; + scf.yield v1152, v1148; } else { ^block39: v250 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v230, v243) : i32 - v1086 = arith.constant 0 : i32; + v1186 = arith.constant 0 : i32; v249 = arith.constant -2147483648 : i32; v251 = arith.sub v249, v250 : i32 #[overflow = wrapping]; v253 = hir.bitcast v251 : u32; @@ -374,18 +374,18 @@ builtin.component miden:base/note-script@1.0.0 { v254 = arith.gt v252, v253 : i1; v255 = arith.zext v254 : u32; v256 = hir.bitcast v255 : i32; - v258 = arith.neq v256, v1086 : i1; - v1071 = scf.if v258 : i32 { - ^block136: - v1085 = ub.poison i32 : i32; - scf.yield v1085; + v258 = arith.neq v256, v1186 : i1; + v1171 = scf.if v258 : i32 { + ^block142: + v1185 = ub.poison i32 : i32; + scf.yield v1185; } else { ^block40: - v1083 = arith.constant 0 : i32; - v264 = arith.sub v1083, v250 : i32 #[overflow = wrapping]; - v1084 = arith.constant -1 : i32; + v1183 = arith.constant 0 : i32; + v264 = arith.sub v1183, v250 : i32 #[overflow = wrapping]; + v1184 = arith.constant -1 : i32; v260 = arith.add v231, v250 : i32 #[overflow = wrapping]; - v262 = arith.add v260, v1084 : i32 #[overflow = wrapping]; + v262 = arith.add v260, v1184 : i32 #[overflow = wrapping]; v265 = arith.band v262, v264 : i32; v266 = hir.bitcast v229 : u32; v267 = arith.constant 4 : u32; @@ -393,51 +393,51 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v268 #[code = 250]; v269 = hir.int_to_ptr v266 : ptr; v270 = hir.load v269 : i32; - v1082 = arith.constant 0 : i32; - v272 = arith.neq v270, v1082 : i1; + v1182 = arith.constant 0 : i32; + v272 = arith.neq v270, v1182 : i1; scf.if v272{ - ^block135: + ^block141: scf.yield ; } else { ^block42: v273 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 v274 = hir.mem_size : u32; v280 = hir.bitcast v229 : u32; - v1081 = arith.constant 4 : u32; - v282 = arith.mod v280, v1081 : u32; + v1181 = arith.constant 4 : u32; + v282 = arith.mod v280, v1181 : u32; hir.assertz v282 #[code = 250]; - v1080 = arith.constant 16 : u32; + v1180 = arith.constant 16 : u32; v275 = hir.bitcast v274 : i32; - v278 = arith.shl v275, v1080 : i32; + v278 = arith.shl v275, v1180 : i32; v279 = arith.add v273, v278 : i32 #[overflow = wrapping]; v283 = hir.int_to_ptr v280 : ptr; hir.store v283, v279; scf.yield ; }; v286 = hir.bitcast v229 : u32; - v1079 = arith.constant 4 : u32; - v288 = arith.mod v286, v1079 : u32; + v1179 = arith.constant 4 : u32; + v288 = arith.mod v286, v1179 : u32; hir.assertz v288 #[code = 250]; v289 = hir.int_to_ptr v286 : ptr; v290 = hir.load v289 : i32; - v1077 = arith.constant 0 : i32; - v1078 = arith.constant -1 : i32; - v292 = arith.bxor v290, v1078 : i32; + v1177 = arith.constant 0 : i32; + v1178 = arith.constant -1 : i32; + v292 = arith.bxor v290, v1178 : i32; v294 = hir.bitcast v292 : u32; v293 = hir.bitcast v265 : u32; v295 = arith.gt v293, v294 : i1; v296 = arith.zext v295 : u32; v297 = hir.bitcast v296 : i32; - v299 = arith.neq v297, v1077 : i1; - v1070 = scf.if v299 : i32 { + v299 = arith.neq v297, v1177 : i1; + v1170 = scf.if v299 : i32 { ^block43: - v1076 = arith.constant 0 : i32; - scf.yield v1076; + v1176 = arith.constant 0 : i32; + scf.yield v1176; } else { ^block44: v301 = hir.bitcast v229 : u32; - v1075 = arith.constant 4 : u32; - v303 = arith.mod v301, v1075 : u32; + v1175 = arith.constant 4 : u32; + v303 = arith.mod v301, v1175 : u32; hir.assertz v303 #[code = 250]; v300 = arith.add v290, v265 : i32 #[overflow = wrapping]; v304 = hir.int_to_ptr v301 : ptr; @@ -445,20 +445,20 @@ builtin.component miden:base/note-script@1.0.0 { v306 = arith.add v290, v250 : i32 #[overflow = wrapping]; scf.yield v306; }; - scf.yield v1070; + scf.yield v1170; }; - v1053 = arith.constant 1 : u32; - v1074 = arith.constant 0 : u32; - v1072 = cf.select v258, v1074, v1053 : u32; - scf.yield v1071, v1072; + v1153 = arith.constant 1 : u32; + v1174 = arith.constant 0 : u32; + v1172 = cf.select v258, v1174, v1153 : u32; + scf.yield v1171, v1172; }; - v1073 = arith.constant 0 : u32; - v1069 = arith.eq v1057, v1073 : i1; - cf.cond_br v1069 ^block38, ^block139(v1056); + v1173 = arith.constant 0 : u32; + v1169 = arith.eq v1157, v1173 : i1; + cf.cond_br v1169 ^block38, ^block145(v1156); ^block38: ub.unreachable ; - ^block139(v1049: i32): - builtin.ret v1049; + ^block145(v1149: i32): + builtin.ret v1149; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { @@ -477,21 +477,21 @@ builtin.component miden:base/note-script@1.0.0 { v319 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v320 = hir.bitcast v319 : ptr; hir.store v320, v318; - v1092 = arith.constant 16 : i32; + v1192 = arith.constant 16 : i32; v321 = arith.constant 8 : i32; v322 = arith.add v318, v321 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v322, v1092, v1092) + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v322, v1192, v1192) v326 = arith.constant 8 : u32; v325 = hir.bitcast v318 : u32; v327 = arith.add v325, v326 : u32 #[overflow = checked]; - v1091 = arith.constant 8 : u32; - v329 = arith.mod v327, v1091 : u32; + v1191 = arith.constant 8 : u32; + v329 = arith.mod v327, v1191 : u32; hir.assertz v329 #[code = 250]; v330 = hir.int_to_ptr v327 : ptr; v331 = hir.load v330 : i64; - v1090 = arith.constant 8 : u32; + v1190 = arith.constant 8 : u32; v333 = hir.bitcast v311 : u32; - v335 = arith.add v333, v1090 : u32 #[overflow = checked]; + v335 = arith.add v333, v1190 : u32 #[overflow = checked]; v336 = arith.constant 4 : u32; v337 = arith.mod v335, v336 : u32; hir.assertz v337 #[code = 250]; @@ -499,13 +499,13 @@ builtin.component miden:base/note-script@1.0.0 { v338 = hir.int_to_ptr v335 : ptr; hir.store v338, v312; v339 = hir.bitcast v311 : u32; - v1089 = arith.constant 4 : u32; - v341 = arith.mod v339, v1089 : u32; + v1189 = arith.constant 4 : u32; + v341 = arith.mod v339, v1189 : u32; hir.assertz v341 #[code = 250]; v342 = hir.int_to_ptr v339 : ptr; hir.store v342, v331; - v1088 = arith.constant 16 : i32; - v344 = arith.add v318, v1088 : i32 #[overflow = wrapping]; + v1188 = arith.constant 16 : i32; + v344 = arith.add v318, v1188 : i32 #[overflow = wrapping]; v345 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v346 = hir.bitcast v345 : ptr; hir.store v346, v344; @@ -535,46 +535,46 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v366 #[code = 250]; v367 = hir.int_to_ptr v364 : ptr; v368 = hir.load v367 : i32; - v1103 = arith.constant 4 : u32; + v1203 = arith.constant 4 : u32; v369 = hir.bitcast v355 : u32; - v371 = arith.add v369, v1103 : u32 #[overflow = checked]; - v1102 = arith.constant 4 : u32; - v373 = arith.mod v371, v1102 : u32; + v371 = arith.add v369, v1203 : u32 #[overflow = checked]; + v1202 = arith.constant 4 : u32; + v373 = arith.mod v371, v1202 : u32; hir.assertz v373 #[code = 250]; v374 = hir.int_to_ptr v371 : ptr; v375 = hir.load v374 : i32; - v1101 = arith.constant 0 : i32; + v1201 = arith.constant 0 : i32; v376 = arith.constant 1 : i32; v377 = arith.neq v375, v376 : i1; v378 = arith.zext v377 : u32; v379 = hir.bitcast v378 : i32; - v381 = arith.neq v379, v1101 : i1; + v381 = arith.neq v379, v1201 : i1; cf.cond_br v381 ^block53, ^block54; ^block53: v395 = arith.constant 12 : u32; v394 = hir.bitcast v355 : u32; v396 = arith.add v394, v395 : u32 #[overflow = checked]; - v1100 = arith.constant 4 : u32; - v398 = arith.mod v396, v1100 : u32; + v1200 = arith.constant 4 : u32; + v398 = arith.mod v396, v1200 : u32; hir.assertz v398 #[code = 250]; v399 = hir.int_to_ptr v396 : ptr; v400 = hir.load v399 : i32; - v1099 = arith.constant 4 : u32; + v1199 = arith.constant 4 : u32; v401 = hir.bitcast v347 : u32; - v403 = arith.add v401, v1099 : u32 #[overflow = checked]; - v1098 = arith.constant 4 : u32; - v405 = arith.mod v403, v1098 : u32; + v403 = arith.add v401, v1199 : u32 #[overflow = checked]; + v1198 = arith.constant 4 : u32; + v405 = arith.mod v403, v1198 : u32; hir.assertz v405 #[code = 250]; v406 = hir.int_to_ptr v403 : ptr; hir.store v406, v400; v407 = hir.bitcast v347 : u32; - v1097 = arith.constant 4 : u32; - v409 = arith.mod v407, v1097 : u32; + v1197 = arith.constant 4 : u32; + v409 = arith.mod v407, v1197 : u32; hir.assertz v409 #[code = 250]; v410 = hir.int_to_ptr v407 : ptr; hir.store v410, v368; - v1096 = arith.constant 16 : i32; - v412 = arith.add v355, v1096 : i32 #[overflow = wrapping]; + v1196 = arith.constant 16 : i32; + v412 = arith.add v355, v1196 : i32 #[overflow = wrapping]; v413 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v414 = hir.bitcast v413 : ptr; hir.store v414, v412; @@ -583,11 +583,11 @@ builtin.component miden:base/note-script@1.0.0 { v382 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr v383 = hir.bitcast v382 : ptr; v384 = hir.load v383 : i32; - v1095 = arith.constant 12 : u32; + v1195 = arith.constant 12 : u32; v385 = hir.bitcast v355 : u32; - v387 = arith.add v385, v1095 : u32 #[overflow = checked]; - v1094 = arith.constant 4 : u32; - v389 = arith.mod v387, v1094 : u32; + v387 = arith.add v385, v1195 : u32 #[overflow = checked]; + v1194 = arith.constant 4 : u32; + v389 = arith.mod v387, v1194 : u32; hir.assertz v389 #[code = 250]; v390 = hir.int_to_ptr v387 : ptr; v391 = hir.load v390 : i32; @@ -619,13 +619,13 @@ builtin.component miden:base/note-script@1.0.0 { v431 = hir.int_to_ptr v428 : ptr; v432 = hir.load v431 : i64; v433 = hir.bitcast v415 : u32; - v1105 = arith.constant 8 : u32; - v435 = arith.mod v433, v1105 : u32; + v1205 = arith.constant 8 : u32; + v435 = arith.mod v433, v1205 : u32; hir.assertz v435 #[code = 250]; v436 = hir.int_to_ptr v433 : ptr; hir.store v436, v432; - v1104 = arith.constant 16 : i32; - v438 = arith.add v421, v1104 : i32 #[overflow = wrapping]; + v1204 = arith.constant 16 : i32; + v438 = arith.add v421, v1204 : i32 #[overflow = wrapping]; v439 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v440 = hir.bitcast v439 : ptr; hir.store v440, v438; @@ -657,40 +657,40 @@ builtin.component miden:base/note-script@1.0.0 { v462 = arith.constant 12 : u32; v461 = hir.bitcast v447 : u32; v463 = arith.add v461, v462 : u32 #[overflow = checked]; - v1113 = arith.constant 4 : u32; - v465 = arith.mod v463, v1113 : u32; + v1213 = arith.constant 4 : u32; + v465 = arith.mod v463, v1213 : u32; hir.assertz v465 #[code = 250]; v466 = hir.int_to_ptr v463 : ptr; v467 = hir.load v466 : i32; - v1106 = arith.constant 2 : u32; + v1206 = arith.constant 2 : u32; v469 = hir.bitcast v467 : u32; - v471 = arith.shr v469, v1106 : u32; + v471 = arith.shr v469, v1206 : u32; v472 = hir.bitcast v471 : i32; v473 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v472) : i32 - v1112 = arith.constant 8 : u32; + v1212 = arith.constant 8 : u32; v474 = hir.bitcast v441 : u32; - v476 = arith.add v474, v1112 : u32 #[overflow = checked]; - v1111 = arith.constant 4 : u32; - v478 = arith.mod v476, v1111 : u32; + v476 = arith.add v474, v1212 : u32 #[overflow = checked]; + v1211 = arith.constant 4 : u32; + v478 = arith.mod v476, v1211 : u32; hir.assertz v478 #[code = 250]; v479 = hir.int_to_ptr v476 : ptr; hir.store v479, v473; - v1110 = arith.constant 4 : u32; + v1210 = arith.constant 4 : u32; v480 = hir.bitcast v441 : u32; - v482 = arith.add v480, v1110 : u32 #[overflow = checked]; - v1109 = arith.constant 4 : u32; - v484 = arith.mod v482, v1109 : u32; + v482 = arith.add v480, v1210 : u32 #[overflow = checked]; + v1209 = arith.constant 4 : u32; + v484 = arith.mod v482, v1209 : u32; hir.assertz v484 #[code = 250]; v485 = hir.int_to_ptr v482 : ptr; hir.store v485, v467; v486 = hir.bitcast v441 : u32; - v1108 = arith.constant 4 : u32; - v488 = arith.mod v486, v1108 : u32; + v1208 = arith.constant 4 : u32; + v488 = arith.mod v486, v1208 : u32; hir.assertz v488 #[code = 250]; v489 = hir.int_to_ptr v486 : ptr; hir.store v489, v460; - v1107 = arith.constant 16 : i32; - v491 = arith.add v447, v1107 : i32 #[overflow = wrapping]; + v1207 = arith.constant 16 : i32; + v491 = arith.add v447, v1207 : i32 #[overflow = wrapping]; v492 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v493 = hir.bitcast v492 : ptr; hir.store v493, v491; @@ -718,581 +718,687 @@ builtin.component miden:base/note-script@1.0.0 { hir.assertz v511 #[code = 250]; v512 = hir.int_to_ptr v509 : ptr; v513 = hir.load v512 : i32; - v1114 = arith.constant 2 : u32; + v1214 = arith.constant 2 : u32; v515 = hir.bitcast v513 : u32; - v517 = arith.shr v515, v1114 : u32; + v517 = arith.shr v515, v1214 : u32; v518 = hir.bitcast v517 : i32; v519 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v518) : i32 v505 = arith.constant 8 : i32; v506 = arith.add v494, v505 : i32 #[overflow = wrapping]; v520 = hir.bitcast v506 : u32; - v1119 = arith.constant 4 : u32; - v522 = arith.mod v520, v1119 : u32; + v1219 = arith.constant 4 : u32; + v522 = arith.mod v520, v1219 : u32; hir.assertz v522 #[code = 250]; v523 = hir.int_to_ptr v520 : ptr; hir.store v523, v519; - v1118 = arith.constant 4 : u32; + v1218 = arith.constant 4 : u32; v524 = hir.bitcast v500 : u32; - v526 = arith.add v524, v1118 : u32 #[overflow = checked]; - v1117 = arith.constant 4 : u32; - v528 = arith.mod v526, v1117 : u32; + v526 = arith.add v524, v1218 : u32 #[overflow = checked]; + v1217 = arith.constant 4 : u32; + v528 = arith.mod v526, v1217 : u32; hir.assertz v528 #[code = 250]; v529 = hir.int_to_ptr v526 : ptr; v530 = hir.load v529 : i64; v531 = hir.bitcast v494 : u32; - v1116 = arith.constant 4 : u32; - v533 = arith.mod v531, v1116 : u32; + v1216 = arith.constant 4 : u32; + v533 = arith.mod v531, v1216 : u32; hir.assertz v533 #[code = 250]; v534 = hir.int_to_ptr v531 : ptr; hir.store v534, v530; - v1115 = arith.constant 16 : i32; - v536 = arith.add v500, v1115 : i32 #[overflow = wrapping]; + v1215 = arith.constant 16 : i32; + v536 = arith.add v500, v1215 : i32 #[overflow = wrapping]; v537 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr v538 = hir.bitcast v537 : ptr; hir.store v538, v536; builtin.ret ; }; - private builtin.function @::from_felt_repr(v539: i32, v540: i32, v541: i32) { - ^block61(v539: i32, v540: i32, v541: i32): - v542 = hir.cast v541 : u32; - v1123 = scf.index_switch v542 : u32 - case 0 { - ^block145: - v1122 = arith.constant 1 : u32; - scf.yield v1122; - } - case 1 { - ^block146: - v1127 = arith.constant 1 : u32; - scf.yield v1127; - } - default { - ^block64: - v543 = hir.bitcast v540 : u32; - v544 = arith.constant 4 : u32; - v545 = arith.mod v543, v544 : u32; - hir.assertz v545 #[code = 250]; - v546 = hir.int_to_ptr v543 : ptr; - v547 = hir.load v546 : i64; - v548 = hir.bitcast v539 : u32; - v549 = arith.constant 8 : u32; - v550 = arith.mod v548, v549 : u32; - hir.assertz v550 #[code = 250]; - v551 = hir.int_to_ptr v548 : ptr; - hir.store v551, v547; - v1120 = arith.constant 0 : u32; - scf.yield v1120; - }; - v1126 = arith.constant 0 : u32; - v1125 = arith.eq v1123, v1126 : i1; - cf.cond_br v1125 ^block148, ^block63; - ^block63: - ub.unreachable ; - ^block148: + private builtin.function @::from_felt_repr(v539: i32, v540: i32) { + ^block61(v539: i32, v540: i32): + v542 = hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v540) : felt + v543 = hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v540) : felt + v545 = arith.constant 4 : u32; + v544 = hir.bitcast v539 : u32; + v546 = arith.add v544, v545 : u32 #[overflow = checked]; + v1221 = arith.constant 4 : u32; + v548 = arith.mod v546, v1221 : u32; + hir.assertz v548 #[code = 250]; + v549 = hir.int_to_ptr v546 : ptr; + hir.store v549, v543; + v550 = hir.bitcast v539 : u32; + v1220 = arith.constant 4 : u32; + v552 = arith.mod v550, v1220 : u32; + hir.assertz v552 #[code = 250]; + v553 = hir.int_to_ptr v550 : ptr; + hir.store v553, v542; builtin.ret ; }; - private builtin.function @intrinsics::felt::eq(v552: felt, v553: felt) -> i32 { - ^block65(v552: felt, v553: felt): - v554 = arith.eq v552, v553 : i1; - v555 = hir.cast v554 : i32; - builtin.ret v555; + private builtin.function @>::from(v554: i32, v555: i32, v556: i32) { + ^block63(v554: i32, v555: i32, v556: i32): + v558 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v559 = hir.bitcast v558 : ptr; + v560 = hir.load v559 : i32; + v561 = arith.constant 32 : i32; + v562 = arith.sub v560, v561 : i32 #[overflow = wrapping]; + v563 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v564 = hir.bitcast v563 : ptr; + hir.store v564, v562; + v567 = arith.constant 28 : u32; + v566 = hir.bitcast v562 : u32; + v568 = arith.add v566, v567 : u32 #[overflow = checked]; + v569 = arith.constant 4 : u32; + v570 = arith.mod v568, v569 : u32; + hir.assertz v570 #[code = 250]; + v557 = arith.constant 0 : i32; + v571 = hir.int_to_ptr v568 : ptr; + hir.store v571, v557; + v573 = arith.constant 24 : u32; + v572 = hir.bitcast v562 : u32; + v574 = arith.add v572, v573 : u32 #[overflow = checked]; + v1226 = arith.constant 4 : u32; + v576 = arith.mod v574, v1226 : u32; + hir.assertz v576 #[code = 250]; + v577 = hir.int_to_ptr v574 : ptr; + hir.store v577, v556; + v579 = arith.constant 20 : u32; + v578 = hir.bitcast v562 : u32; + v580 = arith.add v578, v579 : u32 #[overflow = checked]; + v1225 = arith.constant 4 : u32; + v582 = arith.mod v580, v1225 : u32; + hir.assertz v582 #[code = 250]; + v583 = hir.int_to_ptr v580 : ptr; + hir.store v583, v555; + v586 = arith.constant 20 : i32; + v587 = arith.add v562, v586 : i32 #[overflow = wrapping]; + v584 = arith.constant 8 : i32; + v585 = arith.add v562, v584 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v585, v587) + v589 = arith.constant 8 : u32; + v588 = hir.bitcast v562 : u32; + v590 = arith.add v588, v589 : u32 #[overflow = checked]; + v1224 = arith.constant 8 : u32; + v592 = arith.mod v590, v1224 : u32; + hir.assertz v592 #[code = 250]; + v593 = hir.int_to_ptr v590 : ptr; + v594 = hir.load v593 : i64; + v595 = hir.bitcast v554 : u32; + v1223 = arith.constant 8 : u32; + v597 = arith.mod v595, v1223 : u32; + hir.assertz v597 #[code = 250]; + v598 = hir.int_to_ptr v595 : ptr; + hir.store v598, v594; + v1222 = arith.constant 32 : i32; + v600 = arith.add v562, v1222 : i32 #[overflow = wrapping]; + v601 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v602 = hir.bitcast v601 : ptr; + hir.store v602, v600; + builtin.ret ; + }; + + private builtin.function @miden_felt_repr_onchain::FeltReader::read(v603: i32) -> felt { + ^block65(v603: i32): + v607 = arith.constant 8 : u32; + v606 = hir.bitcast v603 : u32; + v608 = arith.add v606, v607 : u32 #[overflow = checked]; + v609 = arith.constant 4 : u32; + v610 = arith.mod v608, v609 : u32; + hir.assertz v610 #[code = 250]; + v611 = hir.int_to_ptr v608 : ptr; + v612 = hir.load v611 : i32; + v1235 = arith.constant 4 : u32; + v613 = hir.bitcast v603 : u32; + v615 = arith.add v613, v1235 : u32 #[overflow = checked]; + v1234 = arith.constant 4 : u32; + v617 = arith.mod v615, v1234 : u32; + hir.assertz v617 #[code = 250]; + v618 = hir.int_to_ptr v615 : ptr; + v619 = hir.load v618 : i32; + v605 = arith.constant 0 : i32; + v621 = hir.bitcast v619 : u32; + v620 = hir.bitcast v612 : u32; + v622 = arith.gte v620, v621 : i1; + v623 = arith.zext v622 : u32; + v624 = hir.bitcast v623 : i32; + v626 = arith.neq v624, v605 : i1; + cf.cond_br v626 ^block67, ^block68; + ^block67: + ub.unreachable ; + ^block68: + v1233 = arith.constant 8 : u32; + v629 = hir.bitcast v603 : u32; + v631 = arith.add v629, v1233 : u32 #[overflow = checked]; + v1232 = arith.constant 4 : u32; + v633 = arith.mod v631, v1232 : u32; + hir.assertz v633 #[code = 250]; + v627 = arith.constant 1 : i32; + v628 = arith.add v612, v627 : i32 #[overflow = wrapping]; + v634 = hir.int_to_ptr v631 : ptr; + hir.store v634, v628; + v635 = hir.bitcast v603 : u32; + v1231 = arith.constant 4 : u32; + v637 = arith.mod v635, v1231 : u32; + hir.assertz v637 #[code = 250]; + v638 = hir.int_to_ptr v635 : ptr; + v639 = hir.load v638 : i32; + v1227 = arith.constant 2 : u32; + v642 = arith.shl v612, v1227 : i32; + v643 = arith.add v639, v642 : i32 #[overflow = wrapping]; + v644 = hir.bitcast v643 : u32; + v1230 = arith.constant 4 : u32; + v646 = arith.mod v644, v1230 : u32; + hir.assertz v646 #[code = 250]; + v647 = hir.int_to_ptr v644 : ptr; + v648 = hir.load v647 : felt; + builtin.ret v648; + }; + + private builtin.function @::from_felt_repr(v649: i32) -> felt { + ^block69(v649: i32): + v651 = hir.exec @miden:base/note-script@1.0.0/p2id/miden_felt_repr_onchain::FeltReader::read(v649) : felt + builtin.ret v651; + }; + + private builtin.function @intrinsics::felt::eq(v652: felt, v653: felt) -> i32 { + ^block71(v652: felt, v653: felt): + v654 = arith.eq v652, v653 : i1; + v655 = hir.cast v654 : i32; + builtin.ret v655; }; - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v557: i32, v558: i32, v559: i32) { - ^block67(v557: i32, v558: i32, v559: i32): - v561 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v562 = hir.bitcast v561 : ptr; - v563 = hir.load v562 : i32; - v564 = arith.constant 16 : i32; - v565 = arith.sub v563, v564 : i32 #[overflow = wrapping]; - v566 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v567 = hir.bitcast v566 : ptr; - hir.store v567, v565; - v568 = arith.constant 4 : i32; - v569 = arith.add v565, v568 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v569, v557, v558, v559) - v571 = arith.constant 8 : u32; - v570 = hir.bitcast v565 : u32; - v572 = arith.add v570, v571 : u32 #[overflow = checked]; - v573 = arith.constant 4 : u32; - v574 = arith.mod v572, v573 : u32; - hir.assertz v574 #[code = 250]; - v575 = hir.int_to_ptr v572 : ptr; - v576 = hir.load v575 : i32; - v1134 = arith.constant 0 : i32; - v560 = arith.constant 0 : i32; - v578 = arith.eq v576, v560 : i1; - v579 = arith.zext v578 : u32; - v580 = hir.bitcast v579 : i32; - v582 = arith.neq v580, v1134 : i1; - scf.if v582{ - ^block150: + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v657: i32, v658: i32, v659: i32) { + ^block73(v657: i32, v658: i32, v659: i32): + v661 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v662 = hir.bitcast v661 : ptr; + v663 = hir.load v662 : i32; + v664 = arith.constant 16 : i32; + v665 = arith.sub v663, v664 : i32 #[overflow = wrapping]; + v666 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v667 = hir.bitcast v666 : ptr; + hir.store v667, v665; + v668 = arith.constant 4 : i32; + v669 = arith.add v665, v668 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v669, v657, v658, v659) + v671 = arith.constant 8 : u32; + v670 = hir.bitcast v665 : u32; + v672 = arith.add v670, v671 : u32 #[overflow = checked]; + v673 = arith.constant 4 : u32; + v674 = arith.mod v672, v673 : u32; + hir.assertz v674 #[code = 250]; + v675 = hir.int_to_ptr v672 : ptr; + v676 = hir.load v675 : i32; + v1242 = arith.constant 0 : i32; + v660 = arith.constant 0 : i32; + v678 = arith.eq v676, v660 : i1; + v679 = arith.zext v678 : u32; + v680 = hir.bitcast v679 : i32; + v682 = arith.neq v680, v1242 : i1; + scf.if v682{ + ^block153: scf.yield ; } else { - ^block70: - v1133 = arith.constant 4 : u32; - v583 = hir.bitcast v565 : u32; - v585 = arith.add v583, v1133 : u32 #[overflow = checked]; - v1132 = arith.constant 4 : u32; - v587 = arith.mod v585, v1132 : u32; - hir.assertz v587 #[code = 250]; - v588 = hir.int_to_ptr v585 : ptr; - v589 = hir.load v588 : i32; - v591 = arith.constant 12 : u32; - v590 = hir.bitcast v565 : u32; - v592 = arith.add v590, v591 : u32 #[overflow = checked]; - v1131 = arith.constant 4 : u32; - v594 = arith.mod v592, v1131 : u32; - hir.assertz v594 #[code = 250]; - v595 = hir.int_to_ptr v592 : ptr; - v596 = hir.load v595 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v589, v576, v596) + ^block76: + v1241 = arith.constant 4 : u32; + v683 = hir.bitcast v665 : u32; + v685 = arith.add v683, v1241 : u32 #[overflow = checked]; + v1240 = arith.constant 4 : u32; + v687 = arith.mod v685, v1240 : u32; + hir.assertz v687 #[code = 250]; + v688 = hir.int_to_ptr v685 : ptr; + v689 = hir.load v688 : i32; + v691 = arith.constant 12 : u32; + v690 = hir.bitcast v665 : u32; + v692 = arith.add v690, v691 : u32 #[overflow = checked]; + v1239 = arith.constant 4 : u32; + v694 = arith.mod v692, v1239 : u32; + hir.assertz v694 #[code = 250]; + v695 = hir.int_to_ptr v692 : ptr; + v696 = hir.load v695 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v689, v676, v696) scf.yield ; }; - v1130 = arith.constant 16 : i32; - v599 = arith.add v565, v1130 : i32 #[overflow = wrapping]; - v600 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v601 = hir.bitcast v600 : ptr; - hir.store v601, v599; + v1238 = arith.constant 16 : i32; + v699 = arith.add v665, v1238 : i32 #[overflow = wrapping]; + v700 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v701 = hir.bitcast v700 : ptr; + hir.store v701, v699; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v602: i32, v603: i32, v604: i32, v605: i32, v606: i32) { - ^block71(v602: i32, v603: i32, v604: i32, v605: i32, v606: i32): - v609 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v610 = hir.bitcast v609 : ptr; - v611 = hir.load v610 : i32; - v612 = arith.constant 16 : i32; - v613 = arith.sub v611, v612 : i32 #[overflow = wrapping]; - v614 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v615 = hir.bitcast v614 : ptr; - hir.store v615, v613; - v625 = hir.bitcast v603 : u32; - v626 = arith.zext v625 : u64; - v627 = hir.bitcast v626 : i64; - v607 = arith.constant 0 : i32; - v620 = arith.sub v607, v605 : i32 #[overflow = wrapping]; - v617 = arith.constant -1 : i32; - v616 = arith.add v605, v606 : i32 #[overflow = wrapping]; - v618 = arith.add v616, v617 : i32 #[overflow = wrapping]; - v621 = arith.band v618, v620 : i32; - v622 = hir.bitcast v621 : u32; - v623 = arith.zext v622 : u64; - v624 = hir.bitcast v623 : i64; - v628 = arith.mul v624, v627 : i64 #[overflow = wrapping]; - v1238 = arith.constant 0 : i32; - v629 = arith.constant 32 : i64; - v631 = hir.cast v629 : u32; - v630 = hir.bitcast v628 : u64; - v632 = arith.shr v630, v631 : u64; - v633 = hir.bitcast v632 : i64; - v634 = arith.trunc v633 : i32; - v636 = arith.neq v634, v1238 : i1; - v1150, v1151, v1152, v1153, v1154, v1155 = scf.if v636 : i32, i32, i32, i32, i32, u32 { - ^block152: - v1135 = arith.constant 0 : u32; - v1142 = ub.poison i32 : i32; - scf.yield v602, v613, v1142, v1142, v1142, v1135; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v702: i32, v703: i32, v704: i32, v705: i32, v706: i32) { + ^block77(v702: i32, v703: i32, v704: i32, v705: i32, v706: i32): + v709 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v710 = hir.bitcast v709 : ptr; + v711 = hir.load v710 : i32; + v712 = arith.constant 16 : i32; + v713 = arith.sub v711, v712 : i32 #[overflow = wrapping]; + v714 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v715 = hir.bitcast v714 : ptr; + hir.store v715, v713; + v725 = hir.bitcast v703 : u32; + v726 = arith.zext v725 : u64; + v727 = hir.bitcast v726 : i64; + v707 = arith.constant 0 : i32; + v720 = arith.sub v707, v705 : i32 #[overflow = wrapping]; + v717 = arith.constant -1 : i32; + v716 = arith.add v705, v706 : i32 #[overflow = wrapping]; + v718 = arith.add v716, v717 : i32 #[overflow = wrapping]; + v721 = arith.band v718, v720 : i32; + v722 = hir.bitcast v721 : u32; + v723 = arith.zext v722 : u64; + v724 = hir.bitcast v723 : i64; + v728 = arith.mul v724, v727 : i64 #[overflow = wrapping]; + v1346 = arith.constant 0 : i32; + v729 = arith.constant 32 : i64; + v731 = hir.cast v729 : u32; + v730 = hir.bitcast v728 : u64; + v732 = arith.shr v730, v731 : u64; + v733 = hir.bitcast v732 : i64; + v734 = arith.trunc v733 : i32; + v736 = arith.neq v734, v1346 : i1; + v1258, v1259, v1260, v1261, v1262, v1263 = scf.if v736 : i32, i32, i32, i32, i32, u32 { + ^block155: + v1243 = arith.constant 0 : u32; + v1250 = ub.poison i32 : i32; + scf.yield v702, v713, v1250, v1250, v1250, v1243; } else { - ^block76: - v637 = arith.trunc v628 : i32; - v1237 = arith.constant 0 : i32; - v638 = arith.constant -2147483648 : i32; - v639 = arith.sub v638, v605 : i32 #[overflow = wrapping]; - v641 = hir.bitcast v639 : u32; - v640 = hir.bitcast v637 : u32; - v642 = arith.lte v640, v641 : i1; - v643 = arith.zext v642 : u32; - v644 = hir.bitcast v643 : i32; - v646 = arith.neq v644, v1237 : i1; - v1198 = scf.if v646 : i32 { - ^block74: - v1236 = arith.constant 0 : i32; - v657 = arith.neq v637, v1236 : i1; - v1197 = scf.if v657 : i32 { - ^block78: - v1235 = arith.constant 0 : i32; - v673 = arith.neq v604, v1235 : i1; - v1196 = scf.if v673 : i32 { - ^block81: - v655 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v613, v605, v637, v655) - v684 = hir.bitcast v613 : u32; - v729 = arith.constant 4 : u32; - v686 = arith.mod v684, v729 : u32; - hir.assertz v686 #[code = 250]; - v687 = hir.int_to_ptr v684 : ptr; - v688 = hir.load v687 : i32; - scf.yield v688; + ^block82: + v737 = arith.trunc v728 : i32; + v1345 = arith.constant 0 : i32; + v738 = arith.constant -2147483648 : i32; + v739 = arith.sub v738, v705 : i32 #[overflow = wrapping]; + v741 = hir.bitcast v739 : u32; + v740 = hir.bitcast v737 : u32; + v742 = arith.lte v740, v741 : i1; + v743 = arith.zext v742 : u32; + v744 = hir.bitcast v743 : i32; + v746 = arith.neq v744, v1345 : i1; + v1306 = scf.if v746 : i32 { + ^block80: + v1344 = arith.constant 0 : i32; + v757 = arith.neq v737, v1344 : i1; + v1305 = scf.if v757 : i32 { + ^block84: + v1343 = arith.constant 0 : i32; + v773 = arith.neq v704, v1343 : i1; + v1304 = scf.if v773 : i32 { + ^block87: + v755 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v713, v705, v737, v755) + v784 = hir.bitcast v713 : u32; + v829 = arith.constant 4 : u32; + v786 = arith.mod v784, v829 : u32; + hir.assertz v786 #[code = 250]; + v787 = hir.int_to_ptr v784 : ptr; + v788 = hir.load v787 : i32; + scf.yield v788; } else { - ^block82: - v674 = arith.constant 8 : i32; - v675 = arith.add v613, v674 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v675, v605, v637) - v659 = arith.constant 8 : u32; - v676 = hir.bitcast v613 : u32; - v678 = arith.add v676, v659 : u32 #[overflow = checked]; - v1234 = arith.constant 4 : u32; - v680 = arith.mod v678, v1234 : u32; - hir.assertz v680 #[code = 250]; - v681 = hir.int_to_ptr v678 : ptr; - v682 = hir.load v681 : i32; - scf.yield v682; + ^block88: + v774 = arith.constant 8 : i32; + v775 = arith.add v713, v774 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v775, v705, v737) + v759 = arith.constant 8 : u32; + v776 = hir.bitcast v713 : u32; + v778 = arith.add v776, v759 : u32 #[overflow = checked]; + v1342 = arith.constant 4 : u32; + v780 = arith.mod v778, v1342 : u32; + hir.assertz v780 #[code = 250]; + v781 = hir.int_to_ptr v778 : ptr; + v782 = hir.load v781 : i32; + scf.yield v782; }; - v1232 = arith.constant 0 : i32; - v1233 = arith.constant 0 : i32; - v691 = arith.eq v1196, v1233 : i1; - v692 = arith.zext v691 : u32; - v693 = hir.bitcast v692 : i32; - v695 = arith.neq v693, v1232 : i1; - scf.if v695{ - ^block83: - v1231 = arith.constant 8 : u32; - v712 = hir.bitcast v602 : u32; - v714 = arith.add v712, v1231 : u32 #[overflow = checked]; - v1230 = arith.constant 4 : u32; - v716 = arith.mod v714, v1230 : u32; - hir.assertz v716 #[code = 250]; - v717 = hir.int_to_ptr v714 : ptr; - hir.store v717, v637; - v1229 = arith.constant 4 : u32; - v719 = hir.bitcast v602 : u32; - v721 = arith.add v719, v1229 : u32 #[overflow = checked]; - v1228 = arith.constant 4 : u32; - v723 = arith.mod v721, v1228 : u32; - hir.assertz v723 #[code = 250]; - v724 = hir.int_to_ptr v721 : ptr; - hir.store v724, v605; + v1340 = arith.constant 0 : i32; + v1341 = arith.constant 0 : i32; + v791 = arith.eq v1304, v1341 : i1; + v792 = arith.zext v791 : u32; + v793 = hir.bitcast v792 : i32; + v795 = arith.neq v793, v1340 : i1; + scf.if v795{ + ^block89: + v1339 = arith.constant 8 : u32; + v812 = hir.bitcast v702 : u32; + v814 = arith.add v812, v1339 : u32 #[overflow = checked]; + v1338 = arith.constant 4 : u32; + v816 = arith.mod v814, v1338 : u32; + hir.assertz v816 #[code = 250]; + v817 = hir.int_to_ptr v814 : ptr; + hir.store v817, v737; + v1337 = arith.constant 4 : u32; + v819 = hir.bitcast v702 : u32; + v821 = arith.add v819, v1337 : u32 #[overflow = checked]; + v1336 = arith.constant 4 : u32; + v823 = arith.mod v821, v1336 : u32; + hir.assertz v823 #[code = 250]; + v824 = hir.int_to_ptr v821 : ptr; + hir.store v824, v705; scf.yield ; } else { - ^block84: - v1227 = arith.constant 8 : u32; - v697 = hir.bitcast v602 : u32; - v699 = arith.add v697, v1227 : u32 #[overflow = checked]; - v1226 = arith.constant 4 : u32; - v701 = arith.mod v699, v1226 : u32; - hir.assertz v701 #[code = 250]; - v702 = hir.int_to_ptr v699 : ptr; - hir.store v702, v1196; - v1225 = arith.constant 4 : u32; - v704 = hir.bitcast v602 : u32; - v706 = arith.add v704, v1225 : u32 #[overflow = checked]; - v1224 = arith.constant 4 : u32; - v708 = arith.mod v706, v1224 : u32; - hir.assertz v708 #[code = 250]; - v709 = hir.int_to_ptr v706 : ptr; - hir.store v709, v603; + ^block90: + v1335 = arith.constant 8 : u32; + v797 = hir.bitcast v702 : u32; + v799 = arith.add v797, v1335 : u32 #[overflow = checked]; + v1334 = arith.constant 4 : u32; + v801 = arith.mod v799, v1334 : u32; + hir.assertz v801 #[code = 250]; + v802 = hir.int_to_ptr v799 : ptr; + hir.store v802, v1304; + v1333 = arith.constant 4 : u32; + v804 = hir.bitcast v702 : u32; + v806 = arith.add v804, v1333 : u32 #[overflow = checked]; + v1332 = arith.constant 4 : u32; + v808 = arith.mod v806, v1332 : u32; + hir.assertz v808 #[code = 250]; + v809 = hir.int_to_ptr v806 : ptr; + hir.store v809, v703; scf.yield ; }; - v1222 = arith.constant 0 : i32; - v1223 = arith.constant 1 : i32; - v1195 = cf.select v695, v1223, v1222 : i32; - scf.yield v1195; + v1330 = arith.constant 0 : i32; + v1331 = arith.constant 1 : i32; + v1303 = cf.select v795, v1331, v1330 : i32; + scf.yield v1303; } else { - ^block79: - v1221 = arith.constant 8 : u32; - v658 = hir.bitcast v602 : u32; - v660 = arith.add v658, v1221 : u32 #[overflow = checked]; - v1220 = arith.constant 4 : u32; - v662 = arith.mod v660, v1220 : u32; - hir.assertz v662 #[code = 250]; - v663 = hir.int_to_ptr v660 : ptr; - hir.store v663, v605; - v1219 = arith.constant 4 : u32; - v666 = hir.bitcast v602 : u32; - v668 = arith.add v666, v1219 : u32 #[overflow = checked]; - v1218 = arith.constant 4 : u32; - v670 = arith.mod v668, v1218 : u32; - hir.assertz v670 #[code = 250]; - v1217 = arith.constant 0 : i32; - v671 = hir.int_to_ptr v668 : ptr; - hir.store v671, v1217; - v1216 = arith.constant 0 : i32; - scf.yield v1216; + ^block85: + v1329 = arith.constant 8 : u32; + v758 = hir.bitcast v702 : u32; + v760 = arith.add v758, v1329 : u32 #[overflow = checked]; + v1328 = arith.constant 4 : u32; + v762 = arith.mod v760, v1328 : u32; + hir.assertz v762 #[code = 250]; + v763 = hir.int_to_ptr v760 : ptr; + hir.store v763, v705; + v1327 = arith.constant 4 : u32; + v766 = hir.bitcast v702 : u32; + v768 = arith.add v766, v1327 : u32 #[overflow = checked]; + v1326 = arith.constant 4 : u32; + v770 = arith.mod v768, v1326 : u32; + hir.assertz v770 #[code = 250]; + v1325 = arith.constant 0 : i32; + v771 = hir.int_to_ptr v768 : ptr; + hir.store v771, v1325; + v1324 = arith.constant 0 : i32; + scf.yield v1324; }; - scf.yield v1197; + scf.yield v1305; } else { - ^block77: - v1215 = ub.poison i32 : i32; - scf.yield v1215; + ^block83: + v1323 = ub.poison i32 : i32; + scf.yield v1323; }; - v1210 = arith.constant 0 : u32; - v1143 = arith.constant 1 : u32; - v1203 = cf.select v646, v1143, v1210 : u32; - v1211 = ub.poison i32 : i32; - v1202 = cf.select v646, v613, v1211 : i32; - v1212 = ub.poison i32 : i32; - v1201 = cf.select v646, v602, v1212 : i32; - v1213 = ub.poison i32 : i32; - v1200 = cf.select v646, v1213, v613 : i32; - v1214 = ub.poison i32 : i32; - v1199 = cf.select v646, v1214, v602 : i32; - scf.yield v1199, v1200, v1201, v1198, v1202, v1203; + v1318 = arith.constant 0 : u32; + v1251 = arith.constant 1 : u32; + v1311 = cf.select v746, v1251, v1318 : u32; + v1319 = ub.poison i32 : i32; + v1310 = cf.select v746, v713, v1319 : i32; + v1320 = ub.poison i32 : i32; + v1309 = cf.select v746, v702, v1320 : i32; + v1321 = ub.poison i32 : i32; + v1308 = cf.select v746, v1321, v713 : i32; + v1322 = ub.poison i32 : i32; + v1307 = cf.select v746, v1322, v702 : i32; + scf.yield v1307, v1308, v1309, v1306, v1310, v1311; }; - v1156, v1157, v1158 = scf.index_switch v1155 : i32, i32, i32 + v1264, v1265, v1266 = scf.index_switch v1263 : i32, i32, i32 case 0 { - ^block75: - v1209 = arith.constant 4 : u32; - v649 = hir.bitcast v1150 : u32; - v651 = arith.add v649, v1209 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v653 = arith.mod v651, v1208 : u32; - hir.assertz v653 #[code = 250]; - v1207 = arith.constant 0 : i32; - v654 = hir.int_to_ptr v651 : ptr; - hir.store v654, v1207; - v1206 = arith.constant 1 : i32; - scf.yield v1150, v1206, v1151; + ^block81: + v1317 = arith.constant 4 : u32; + v749 = hir.bitcast v1258 : u32; + v751 = arith.add v749, v1317 : u32 #[overflow = checked]; + v1316 = arith.constant 4 : u32; + v753 = arith.mod v751, v1316 : u32; + hir.assertz v753 #[code = 250]; + v1315 = arith.constant 0 : i32; + v754 = hir.int_to_ptr v751 : ptr; + hir.store v754, v1315; + v1314 = arith.constant 1 : i32; + scf.yield v1258, v1314, v1259; } default { - ^block156: - scf.yield v1152, v1153, v1154; + ^block159: + scf.yield v1260, v1261, v1262; }; - v728 = hir.bitcast v1156 : u32; - v1205 = arith.constant 4 : u32; - v730 = arith.mod v728, v1205 : u32; - hir.assertz v730 #[code = 250]; - v731 = hir.int_to_ptr v728 : ptr; - hir.store v731, v1157; - v1204 = arith.constant 16 : i32; - v736 = arith.add v1158, v1204 : i32 #[overflow = wrapping]; - v737 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v738 = hir.bitcast v737 : ptr; - hir.store v738, v736; + v828 = hir.bitcast v1264 : u32; + v1313 = arith.constant 4 : u32; + v830 = arith.mod v828, v1313 : u32; + hir.assertz v830 #[code = 250]; + v831 = hir.int_to_ptr v828 : ptr; + hir.store v831, v1265; + v1312 = arith.constant 16 : i32; + v836 = arith.add v1266, v1312 : i32 #[overflow = wrapping]; + v837 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v838 = hir.bitcast v837 : ptr; + hir.store v838, v836; builtin.ret ; }; - private builtin.function @::allocate(v739: i32, v740: i32, v741: i32) { - ^block85(v739: i32, v740: i32, v741: i32): - v743 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v744 = hir.bitcast v743 : ptr; - v745 = hir.load v744 : i32; - v746 = arith.constant 16 : i32; - v747 = arith.sub v745, v746 : i32 #[overflow = wrapping]; - v748 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v749 = hir.bitcast v748 : ptr; - hir.store v749, v747; - v742 = arith.constant 0 : i32; - v750 = arith.constant 8 : i32; - v751 = arith.add v747, v750 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v751, v740, v741, v742) - v754 = arith.constant 12 : u32; - v753 = hir.bitcast v747 : u32; - v755 = arith.add v753, v754 : u32 #[overflow = checked]; - v756 = arith.constant 4 : u32; - v757 = arith.mod v755, v756 : u32; - hir.assertz v757 #[code = 250]; - v758 = hir.int_to_ptr v755 : ptr; - v759 = hir.load v758 : i32; - v761 = arith.constant 8 : u32; - v760 = hir.bitcast v747 : u32; - v762 = arith.add v760, v761 : u32 #[overflow = checked]; - v1243 = arith.constant 4 : u32; - v764 = arith.mod v762, v1243 : u32; - hir.assertz v764 #[code = 250]; - v765 = hir.int_to_ptr v762 : ptr; - v766 = hir.load v765 : i32; - v767 = hir.bitcast v739 : u32; - v1242 = arith.constant 4 : u32; - v769 = arith.mod v767, v1242 : u32; - hir.assertz v769 #[code = 250]; - v770 = hir.int_to_ptr v767 : ptr; - hir.store v770, v766; - v1241 = arith.constant 4 : u32; - v771 = hir.bitcast v739 : u32; - v773 = arith.add v771, v1241 : u32 #[overflow = checked]; - v1240 = arith.constant 4 : u32; - v775 = arith.mod v773, v1240 : u32; - hir.assertz v775 #[code = 250]; - v776 = hir.int_to_ptr v773 : ptr; - hir.store v776, v759; - v1239 = arith.constant 16 : i32; - v778 = arith.add v747, v1239 : i32 #[overflow = wrapping]; - v779 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v780 = hir.bitcast v779 : ptr; - hir.store v780, v778; + private builtin.function @::allocate(v839: i32, v840: i32, v841: i32) { + ^block91(v839: i32, v840: i32, v841: i32): + v843 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v844 = hir.bitcast v843 : ptr; + v845 = hir.load v844 : i32; + v846 = arith.constant 16 : i32; + v847 = arith.sub v845, v846 : i32 #[overflow = wrapping]; + v848 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v849 = hir.bitcast v848 : ptr; + hir.store v849, v847; + v842 = arith.constant 0 : i32; + v850 = arith.constant 8 : i32; + v851 = arith.add v847, v850 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v851, v840, v841, v842) + v854 = arith.constant 12 : u32; + v853 = hir.bitcast v847 : u32; + v855 = arith.add v853, v854 : u32 #[overflow = checked]; + v856 = arith.constant 4 : u32; + v857 = arith.mod v855, v856 : u32; + hir.assertz v857 #[code = 250]; + v858 = hir.int_to_ptr v855 : ptr; + v859 = hir.load v858 : i32; + v861 = arith.constant 8 : u32; + v860 = hir.bitcast v847 : u32; + v862 = arith.add v860, v861 : u32 #[overflow = checked]; + v1351 = arith.constant 4 : u32; + v864 = arith.mod v862, v1351 : u32; + hir.assertz v864 #[code = 250]; + v865 = hir.int_to_ptr v862 : ptr; + v866 = hir.load v865 : i32; + v867 = hir.bitcast v839 : u32; + v1350 = arith.constant 4 : u32; + v869 = arith.mod v867, v1350 : u32; + hir.assertz v869 #[code = 250]; + v870 = hir.int_to_ptr v867 : ptr; + hir.store v870, v866; + v1349 = arith.constant 4 : u32; + v871 = hir.bitcast v839 : u32; + v873 = arith.add v871, v1349 : u32 #[overflow = checked]; + v1348 = arith.constant 4 : u32; + v875 = arith.mod v873, v1348 : u32; + hir.assertz v875 #[code = 250]; + v876 = hir.int_to_ptr v873 : ptr; + hir.store v876, v859; + v1347 = arith.constant 16 : i32; + v878 = arith.add v847, v1347 : i32 #[overflow = wrapping]; + v879 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v880 = hir.bitcast v879 : ptr; + hir.store v880, v878; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v781: i32, v782: i32, v783: i32, v784: i32) { - ^block87(v781: i32, v782: i32, v783: i32, v784: i32): - v1259 = arith.constant 0 : i32; - v785 = arith.constant 0 : i32; - v786 = arith.eq v783, v785 : i1; - v787 = arith.zext v786 : u32; - v788 = hir.bitcast v787 : i32; - v790 = arith.neq v788, v1259 : i1; - v1255 = scf.if v790 : i32 { - ^block159: - scf.yield v782; + private builtin.function @alloc::alloc::Global::alloc_impl(v881: i32, v882: i32, v883: i32, v884: i32) { + ^block93(v881: i32, v882: i32, v883: i32, v884: i32): + v1367 = arith.constant 0 : i32; + v885 = arith.constant 0 : i32; + v886 = arith.eq v883, v885 : i1; + v887 = arith.zext v886 : u32; + v888 = hir.bitcast v887 : i32; + v890 = arith.neq v888, v1367 : i1; + v1363 = scf.if v890 : i32 { + ^block162: + scf.yield v882; } else { - ^block90: + ^block96: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1258 = arith.constant 0 : i32; - v792 = arith.neq v784, v1258 : i1; - v1254 = scf.if v792 : i32 { - ^block91: - v794 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v783, v782) : i32 - scf.yield v794; + v1366 = arith.constant 0 : i32; + v892 = arith.neq v884, v1366 : i1; + v1362 = scf.if v892 : i32 { + ^block97: + v894 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v883, v882) : i32 + scf.yield v894; } else { - ^block92: - v793 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v783, v782) : i32 - scf.yield v793; + ^block98: + v893 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v883, v882) : i32 + scf.yield v893; }; - scf.yield v1254; + scf.yield v1362; }; - v798 = arith.constant 4 : u32; - v797 = hir.bitcast v781 : u32; - v799 = arith.add v797, v798 : u32 #[overflow = checked]; - v1257 = arith.constant 4 : u32; - v801 = arith.mod v799, v1257 : u32; - hir.assertz v801 #[code = 250]; - v802 = hir.int_to_ptr v799 : ptr; - hir.store v802, v783; - v804 = hir.bitcast v781 : u32; - v1256 = arith.constant 4 : u32; - v806 = arith.mod v804, v1256 : u32; - hir.assertz v806 #[code = 250]; - v807 = hir.int_to_ptr v804 : ptr; - hir.store v807, v1255; + v898 = arith.constant 4 : u32; + v897 = hir.bitcast v881 : u32; + v899 = arith.add v897, v898 : u32 #[overflow = checked]; + v1365 = arith.constant 4 : u32; + v901 = arith.mod v899, v1365 : u32; + hir.assertz v901 #[code = 250]; + v902 = hir.int_to_ptr v899 : ptr; + hir.store v902, v883; + v904 = hir.bitcast v881 : u32; + v1364 = arith.constant 4 : u32; + v906 = arith.mod v904, v1364 : u32; + hir.assertz v906 #[code = 250]; + v907 = hir.int_to_ptr v904 : ptr; + hir.store v907, v1363; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v808: i32, v809: i32, v810: i32, v811: i32) { - ^block93(v808: i32, v809: i32, v810: i32, v811: i32): - v1285 = arith.constant 0 : i32; - v812 = arith.constant 0 : i32; - v816 = arith.eq v811, v812 : i1; - v817 = arith.zext v816 : u32; - v818 = hir.bitcast v817 : i32; - v820 = arith.neq v818, v1285 : i1; - v1272, v1273 = scf.if v820 : i32, i32 { - ^block163: - v1284 = arith.constant 0 : i32; - v814 = arith.constant 4 : i32; - scf.yield v814, v1284; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v908: i32, v909: i32, v910: i32, v911: i32) { + ^block99(v908: i32, v909: i32, v910: i32, v911: i32): + v1393 = arith.constant 0 : i32; + v912 = arith.constant 0 : i32; + v916 = arith.eq v911, v912 : i1; + v917 = arith.zext v916 : u32; + v918 = hir.bitcast v917 : i32; + v920 = arith.neq v918, v1393 : i1; + v1380, v1381 = scf.if v920 : i32, i32 { + ^block166: + v1392 = arith.constant 0 : i32; + v914 = arith.constant 4 : i32; + scf.yield v914, v1392; } else { - ^block96: - v821 = hir.bitcast v809 : u32; - v856 = arith.constant 4 : u32; - v823 = arith.mod v821, v856 : u32; - hir.assertz v823 #[code = 250]; - v824 = hir.int_to_ptr v821 : ptr; - v825 = hir.load v824 : i32; - v1282 = arith.constant 0 : i32; - v1283 = arith.constant 0 : i32; - v827 = arith.eq v825, v1283 : i1; - v828 = arith.zext v827 : u32; - v829 = hir.bitcast v828 : i32; - v831 = arith.neq v829, v1282 : i1; - v1270 = scf.if v831 : i32 { - ^block162: - v1281 = arith.constant 0 : i32; - scf.yield v1281; + ^block102: + v921 = hir.bitcast v909 : u32; + v956 = arith.constant 4 : u32; + v923 = arith.mod v921, v956 : u32; + hir.assertz v923 #[code = 250]; + v924 = hir.int_to_ptr v921 : ptr; + v925 = hir.load v924 : i32; + v1390 = arith.constant 0 : i32; + v1391 = arith.constant 0 : i32; + v927 = arith.eq v925, v1391 : i1; + v928 = arith.zext v927 : u32; + v929 = hir.bitcast v928 : i32; + v931 = arith.neq v929, v1390 : i1; + v1378 = scf.if v931 : i32 { + ^block165: + v1389 = arith.constant 0 : i32; + scf.yield v1389; } else { - ^block97: - v1280 = arith.constant 4 : u32; - v832 = hir.bitcast v808 : u32; - v834 = arith.add v832, v1280 : u32 #[overflow = checked]; - v1279 = arith.constant 4 : u32; - v836 = arith.mod v834, v1279 : u32; - hir.assertz v836 #[code = 250]; - v837 = hir.int_to_ptr v834 : ptr; - hir.store v837, v810; - v1278 = arith.constant 4 : u32; - v838 = hir.bitcast v809 : u32; - v840 = arith.add v838, v1278 : u32 #[overflow = checked]; - v1277 = arith.constant 4 : u32; - v842 = arith.mod v840, v1277 : u32; - hir.assertz v842 #[code = 250]; - v843 = hir.int_to_ptr v840 : ptr; - v844 = hir.load v843 : i32; - v845 = hir.bitcast v808 : u32; - v1276 = arith.constant 4 : u32; - v847 = arith.mod v845, v1276 : u32; - hir.assertz v847 #[code = 250]; - v848 = hir.int_to_ptr v845 : ptr; - hir.store v848, v844; - v849 = arith.mul v825, v811 : i32 #[overflow = wrapping]; - scf.yield v849; + ^block103: + v1388 = arith.constant 4 : u32; + v932 = hir.bitcast v908 : u32; + v934 = arith.add v932, v1388 : u32 #[overflow = checked]; + v1387 = arith.constant 4 : u32; + v936 = arith.mod v934, v1387 : u32; + hir.assertz v936 #[code = 250]; + v937 = hir.int_to_ptr v934 : ptr; + hir.store v937, v910; + v1386 = arith.constant 4 : u32; + v938 = hir.bitcast v909 : u32; + v940 = arith.add v938, v1386 : u32 #[overflow = checked]; + v1385 = arith.constant 4 : u32; + v942 = arith.mod v940, v1385 : u32; + hir.assertz v942 #[code = 250]; + v943 = hir.int_to_ptr v940 : ptr; + v944 = hir.load v943 : i32; + v945 = hir.bitcast v908 : u32; + v1384 = arith.constant 4 : u32; + v947 = arith.mod v945, v1384 : u32; + hir.assertz v947 #[code = 250]; + v948 = hir.int_to_ptr v945 : ptr; + hir.store v948, v944; + v949 = arith.mul v925, v911 : i32 #[overflow = wrapping]; + scf.yield v949; }; - v850 = arith.constant 8 : i32; - v1275 = arith.constant 4 : i32; - v1271 = cf.select v831, v1275, v850 : i32; - scf.yield v1271, v1270; + v950 = arith.constant 8 : i32; + v1383 = arith.constant 4 : i32; + v1379 = cf.select v931, v1383, v950 : i32; + scf.yield v1379, v1378; }; - v853 = arith.add v808, v1272 : i32 #[overflow = wrapping]; - v855 = hir.bitcast v853 : u32; - v1274 = arith.constant 4 : u32; - v857 = arith.mod v855, v1274 : u32; - hir.assertz v857 #[code = 250]; - v858 = hir.int_to_ptr v855 : ptr; - hir.store v858, v1273; + v953 = arith.add v908, v1380 : i32 #[overflow = wrapping]; + v955 = hir.bitcast v953 : u32; + v1382 = arith.constant 4 : u32; + v957 = arith.mod v955, v1382 : u32; + hir.assertz v957 #[code = 250]; + v958 = hir.int_to_ptr v955 : ptr; + hir.store v958, v1381; builtin.ret ; }; - private builtin.function @::deallocate(v859: i32, v860: i32, v861: i32) { - ^block98(v859: i32, v860: i32, v861: i32): - v1287 = arith.constant 0 : i32; - v862 = arith.constant 0 : i32; - v863 = arith.eq v861, v862 : i1; - v864 = arith.zext v863 : u32; - v865 = hir.bitcast v864 : i32; - v867 = arith.neq v865, v1287 : i1; - scf.if v867{ - ^block100: + private builtin.function @::deallocate(v959: i32, v960: i32, v961: i32) { + ^block104(v959: i32, v960: i32, v961: i32): + v1395 = arith.constant 0 : i32; + v962 = arith.constant 0 : i32; + v963 = arith.eq v961, v962 : i1; + v964 = arith.zext v963 : u32; + v965 = hir.bitcast v964 : i32; + v967 = arith.neq v965, v1395 : i1; + scf.if v967{ + ^block106: scf.yield ; } else { - ^block101: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v859, v861, v860) + ^block107: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v959, v961, v960) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v868: i32, v869: i32, v870: i32) { - ^block102(v868: i32, v869: i32, v870: i32): + private builtin.function @alloc::raw_vec::handle_error(v968: i32, v969: i32, v970: i32) { + ^block108(v968: i32, v969: i32, v970: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v871: i32, v872: i32) -> i32 { - ^block104(v871: i32, v872: i32): - v879 = arith.constant 0 : i32; - v875 = hir.bitcast v872 : u32; - v874 = hir.bitcast v871 : u32; - v876 = arith.gt v874, v875 : i1; - v877 = arith.zext v876 : u32; - v878 = hir.bitcast v877 : i32; - v880 = arith.neq v878, v879 : i1; - v881 = cf.select v880, v871, v872 : i32; - builtin.ret v881; + private builtin.function @core::ptr::alignment::Alignment::max(v971: i32, v972: i32) -> i32 { + ^block110(v971: i32, v972: i32): + v979 = arith.constant 0 : i32; + v975 = hir.bitcast v972 : u32; + v974 = hir.bitcast v971 : u32; + v976 = arith.gt v974, v975 : i1; + v977 = arith.zext v976 : u32; + v978 = hir.bitcast v977 : i32; + v980 = arith.neq v978, v979 : i1; + v981 = cf.select v980, v971, v972 : i32; + builtin.ret v981; }; - private builtin.function @miden::active_account::get_id(v882: i32) { - ^block106(v882: i32): - v883, v884 = hir.exec @miden/active_account/get_id() : felt, felt - v885 = hir.bitcast v882 : u32; - v886 = hir.int_to_ptr v885 : ptr; - hir.store v886, v883; - v887 = arith.constant 4 : u32; - v888 = arith.add v885, v887 : u32 #[overflow = checked]; - v889 = hir.int_to_ptr v888 : ptr; - hir.store v889, v884; + private builtin.function @miden::active_account::get_id(v982: i32) { + ^block112(v982: i32): + v983, v984 = hir.exec @miden/active_account/get_id() : felt, felt + v985 = hir.bitcast v982 : u32; + v986 = hir.int_to_ptr v985 : ptr; + hir.store v986, v983; + v987 = arith.constant 4 : u32; + v988 = arith.add v985, v987 : u32 #[overflow = checked]; + v989 = hir.int_to_ptr v988 : ptr; + hir.store v989, v984; builtin.ret ; }; - private builtin.function @miden::active_note::get_inputs(v890: i32) -> i32 { - ^block110(v890: i32): - v891, v892 = hir.exec @miden/active_note/get_inputs(v890) : i32, i32 - builtin.ret v891; + private builtin.function @miden::active_note::get_inputs(v990: i32) -> i32 { + ^block116(v990: i32): + v991, v992 = hir.exec @miden/active_note/get_inputs(v990) : i32, i32 + builtin.ret v991; }; - private builtin.function @miden::active_note::get_assets(v894: i32) -> i32 { - ^block113(v894: i32): - v895, v896 = hir.exec @miden/active_note/get_assets(v894) : i32, i32 - builtin.ret v895; + private builtin.function @miden::active_note::get_assets(v994: i32) -> i32 { + ^block119(v994: i32): + v995, v996 = hir.exec @miden/active_note/get_assets(v994) : i32, i32 + builtin.ret v995; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1308,9 +1414,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v898: felt, v899: felt, v900: felt, v901: felt) { - ^block115(v898: felt, v899: felt, v900: felt, v901: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v898, v899, v900, v901) + public builtin.function @run(v998: felt, v999: felt, v1000: felt, v1001: felt) { + ^block121(v998: felt, v999: felt, v1000: felt, v1001: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v998, v999, v1000, v1001) 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 bc317c8c4..eaf8815f8 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -255,7 +255,7 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr + exec.::miden:base/note-script@1.0.0::p2id::>::from trace.252 nop push.12 @@ -1543,31 +1543,262 @@ end @callconv("C") proc ::from_felt_repr( - i32, i32, i32 ) + dup.1 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr + trace.252 + nop movup.2 - dup.0 - push.2147483648 - u32lte - assert - dup.0 - push.1 - u32lte + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32, + i32, + i32 +) + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114176 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.20 + dup.1 + u32wrapping_add + push.8 + dup.2 + u32wrapping_add + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.8 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc miden_felt_repr_onchain::FeltReader::read( + i32 +) -> felt + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + dup.2 + swap.1 + u32gte + neq if.true - eq.0 - if.true - drop - drop - push.1 - else - drop - drop - push.1 - end - else drop + drop + push.0 + assert + else + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop swap.1 push.4 dup.1 @@ -1579,11 +1810,15 @@ proc ::from_felt_repr( + i32 +) -> felt + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::miden_felt_repr_onchain::FeltReader::read + trace.252 + nop +end + @callconv("C") proc intrinsics::felt::eq(felt, felt) -> i32 eq diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 3ddc2e4ef..0dbae55a0 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -29,10 +29,12 @@ (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) (type (;6;) (func (param i32))) - (type (;7;) (func (param f32 f32) (result i32))) - (type (;8;) (func (param i32 i32 i32 i32 i32))) - (type (;9;) (func (param i32 i32 i32 i32))) - (type (;10;) (func (param i32) (result i32))) + (type (;7;) (func (param i32 i32))) + (type (;8;) (func (param i32) (result f32))) + (type (;9;) (func (param f32 f32) (result i32))) + (type (;10;) (func (param i32 i32 i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32))) + (type (;12;) (func (param i32) (result i32))) (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -92,7 +94,7 @@ i32.load offset=20 local.get 4 i32.load offset=24 - call $::from_felt_repr + call $>::from local.get 4 f32.load offset=12 local.set 5 @@ -439,24 +441,85 @@ i32.add global.set $__stack_pointer ) - (func $::from_felt_repr (;16;) (type 3) (param i32 i32 i32) + (func $::from_felt_repr (;16;) (type 7) (param i32 i32) + (local f32) + local.get 1 + call $::from_felt_repr + local.set 2 + local.get 0 + local.get 1 + call $::from_felt_repr + f32.store offset=4 + local.get 0 + local.get 2 + f32.store + ) + (func $>::from (;17;) (type 3) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 0 + i32.store offset=28 + local.get 3 + local.get 2 + i32.store offset=24 + local.get 3 + local.get 1 + i32.store offset=20 + local.get 3 + i32.const 8 + i32.add + local.get 3 + i32.const 20 + i32.add + call $::from_felt_repr + local.get 0 + local.get 3 + i64.load offset=8 + i64.store + local.get 3 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $miden_felt_repr_onchain::FeltReader::read (;18;) (type 8) (param i32) (result f32) + (local i32) block ;; label = @1 - block ;; label = @2 - local.get 2 - br_table 1 (;@1;) 1 (;@1;) 0 (;@2;) - end + local.get 0 + i32.load offset=8 + local.tee 1 + local.get 0 + i32.load offset=4 + i32.ge_u + br_if 0 (;@1;) local.get 0 local.get 1 - i64.load align=4 - i64.store + i32.const 1 + i32.add + i32.store offset=8 + local.get 0 + i32.load + local.get 1 + i32.const 2 + i32.shl + i32.add + f32.load return end unreachable ) - (func $intrinsics::felt::eq (;17;) (type 7) (param f32 f32) (result i32) + (func $::from_felt_repr (;19;) (type 8) (param i32) (result f32) + local.get 0 + call $miden_felt_repr_onchain::FeltReader::read + ) + (func $intrinsics::felt::eq (;20;) (type 9) (param f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;18;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::deallocate (;21;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -488,7 +551,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;19;) (type 8) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;22;) (type 10) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -600,7 +663,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;20;) (type 3) (param i32 i32 i32) + (func $::allocate (;23;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -629,7 +692,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;21;) (type 9) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;24;) (type 11) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -656,7 +719,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;22;) (type 9) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;25;) (type 11) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -691,7 +754,7 @@ local.get 4 i32.store ) - (func $::deallocate (;23;) (type 3) (param i32 i32 i32) + (func $::deallocate (;26;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -702,10 +765,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;24;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;27;) (type 3) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;25;) (type 2) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;28;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -713,13 +776,13 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;26;) (type 6) (param i32) + (func $miden::active_account::get_id (;29;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_inputs (;27;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_inputs (;30;) (type 12) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_assets (;28;) (type 10) (param i32) (result i32) + (func $miden::active_note::get_assets (;31;) (type 12) (param i32) (result i32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "\00") diff --git a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock index ab6b239d4..85ade53b8 100644 --- a/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/add/Cargo.lock @@ -951,10 +951,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock index 20df84aa2..9a5142635 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-account/Cargo.lock @@ -971,10 +971,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] diff --git a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock index 88fd989b2..34e4eda46 100644 --- a/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/component-macros-note/Cargo.lock @@ -971,10 +971,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] 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 28fe316f3..1ad4b4305 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 @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] 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 07bf0d1bb..bdf76cb27 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 @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] 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 ff4632f11..b4794a30e 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 @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] 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 285b5ea29..b02a89b72 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 @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] 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 a0c855e48..12f151ba8 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 @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] 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 cd1270479..27405c5c7 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 @@ -958,10 +958,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miden-felt-repr-onchain" version = "0.7.1" dependencies = [ + "miden-felt-repr-derive", "miden-stdlib-sys", ] From 76d20e7d3e6f27894c3a287d8a8ae7d570c09e5d Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 5 Dec 2025 17:12:52 +0200 Subject: [PATCH 03/15] refactor: move `felt-repr` crates to the separate folder --- Cargo.toml | 1 + examples/p2id-note/Cargo.toml | 2 +- {sdk/felt-repr-derive => felt-repr/derive}/Cargo.toml | 0 {sdk/felt-repr-derive => felt-repr/derive}/src/lib.rs | 0 {sdk/felt-repr-offchain => felt-repr/offchain}/Cargo.toml | 2 +- .../offchain}/src/account_id.rs | 0 {sdk/felt-repr-offchain => felt-repr/offchain}/src/lib.rs | 0 {sdk/felt-repr-onchain => felt-repr/onchain}/Cargo.toml | 4 ++-- {sdk/felt-repr-onchain => felt-repr/onchain}/src/lib.rs | 0 sdk/base-sys/Cargo.toml | 2 +- tests/integration-node/Cargo.toml | 2 +- 11 files changed, 7 insertions(+), 6 deletions(-) rename {sdk/felt-repr-derive => felt-repr/derive}/Cargo.toml (100%) rename {sdk/felt-repr-derive => felt-repr/derive}/src/lib.rs (100%) rename {sdk/felt-repr-offchain => felt-repr/offchain}/Cargo.toml (86%) rename {sdk/felt-repr-offchain => felt-repr/offchain}/src/account_id.rs (100%) rename {sdk/felt-repr-offchain => felt-repr/offchain}/src/lib.rs (100%) rename {sdk/felt-repr-onchain => felt-repr/onchain}/Cargo.toml (75%) rename {sdk/felt-repr-onchain => felt-repr/onchain}/src/lib.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index b87cb4de8..30db1d96c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "codegen/*", "dialects/*", "eval", + "felt-repr/*", "frontend/*", "hir", "hir-analysis", diff --git a/examples/p2id-note/Cargo.toml b/examples/p2id-note/Cargo.toml index 062c2dbdd..5027323b4 100644 --- a/examples/p2id-note/Cargo.toml +++ b/examples/p2id-note/Cargo.toml @@ -14,7 +14,7 @@ crate-type = ["cdylib"] # Miden SDK consists of a stdlib (intrinsic functions for VM ops, stdlib functions and types) # and transaction kernel API for the Miden rollup miden = { path = "../../sdk/sdk" } -miden-felt-repr-onchain = { path = "../../sdk/felt-repr-onchain" } +miden-felt-repr-onchain = { path = "../../felt-repr/onchain" } [package.metadata.component] package = "miden:p2id" diff --git a/sdk/felt-repr-derive/Cargo.toml b/felt-repr/derive/Cargo.toml similarity index 100% rename from sdk/felt-repr-derive/Cargo.toml rename to felt-repr/derive/Cargo.toml diff --git a/sdk/felt-repr-derive/src/lib.rs b/felt-repr/derive/src/lib.rs similarity index 100% rename from sdk/felt-repr-derive/src/lib.rs rename to felt-repr/derive/src/lib.rs diff --git a/sdk/felt-repr-offchain/Cargo.toml b/felt-repr/offchain/Cargo.toml similarity index 86% rename from sdk/felt-repr-offchain/Cargo.toml rename to felt-repr/offchain/Cargo.toml index bb1dcc3e3..df6ddabea 100644 --- a/sdk/felt-repr-offchain/Cargo.toml +++ b/felt-repr/offchain/Cargo.toml @@ -17,7 +17,7 @@ crate-type = ["rlib"] [dependencies] miden-core.workspace = true miden-objects.workspace = true -miden-felt-repr-derive = { path = "../felt-repr-derive", version = "0.7.1" } +miden-felt-repr-derive = { path = "../derive", version = "0.7.1" } [features] default = [] diff --git a/sdk/felt-repr-offchain/src/account_id.rs b/felt-repr/offchain/src/account_id.rs similarity index 100% rename from sdk/felt-repr-offchain/src/account_id.rs rename to felt-repr/offchain/src/account_id.rs diff --git a/sdk/felt-repr-offchain/src/lib.rs b/felt-repr/offchain/src/lib.rs similarity index 100% rename from sdk/felt-repr-offchain/src/lib.rs rename to felt-repr/offchain/src/lib.rs diff --git a/sdk/felt-repr-onchain/Cargo.toml b/felt-repr/onchain/Cargo.toml similarity index 75% rename from sdk/felt-repr-onchain/Cargo.toml rename to felt-repr/onchain/Cargo.toml index 7af4abd86..a74136af1 100644 --- a/sdk/felt-repr-onchain/Cargo.toml +++ b/felt-repr/onchain/Cargo.toml @@ -15,8 +15,8 @@ edition.workspace = true crate-type = ["rlib"] [dependencies] -miden-stdlib-sys = { path = "../stdlib-sys", version = "0.7.1" } -miden-felt-repr-derive = { path = "../felt-repr-derive", version = "0.7.1" } +miden-stdlib-sys = { path = "../../sdk/stdlib-sys", version = "0.7.1" } +miden-felt-repr-derive = { path = "../derive", version = "0.7.1" } [features] default = [] diff --git a/sdk/felt-repr-onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs similarity index 100% rename from sdk/felt-repr-onchain/src/lib.rs rename to felt-repr/onchain/src/lib.rs diff --git a/sdk/base-sys/Cargo.toml b/sdk/base-sys/Cargo.toml index 6984423eb..273ac17b6 100644 --- a/sdk/base-sys/Cargo.toml +++ b/sdk/base-sys/Cargo.toml @@ -17,7 +17,7 @@ links = "miden_base_sys_stubs" [dependencies] miden-stdlib-sys = { version = "0.7.1", path = "../stdlib-sys" } -miden-felt-repr-onchain = { version = "0.7.1", path = "../felt-repr-onchain" } +miden-felt-repr-onchain = { version = "0.7.1", path = "../../felt-repr/onchain" } [features] default = [] diff --git a/tests/integration-node/Cargo.toml b/tests/integration-node/Cargo.toml index 857f1e622..c37cfafcf 100644 --- a/tests/integration-node/Cargo.toml +++ b/tests/integration-node/Cargo.toml @@ -17,7 +17,7 @@ fs2 = "0.4" miden-client = { version = "0.12", features = ["std", "tonic"] } miden-client-sqlite-store = { version = "0.12" } miden-core.workspace = true -miden-felt-repr-offchain = { version = "0.7.1", path = "../../sdk/felt-repr-offchain" } +miden-felt-repr-offchain = { version = "0.7.1", path = "../../felt-repr/offchain" } miden-mast-package.workspace = true miden-objects = { workspace = true, features = ["std"] } midenc-frontend-wasm.workspace = true From 0e43e6b02b6dfb38682f3870b55f3d0fe9fbb060 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Fri, 5 Dec 2025 17:27:29 +0200 Subject: [PATCH 04/15] feature: add the deserialization trait in the `miden-felt-repr-offchain` and serialization trait in the `miden-felt-repr-onchain` --- felt-repr/derive/src/lib.rs | 151 +++++++++++++++++- felt-repr/offchain/src/lib.rs | 41 ++++- felt-repr/onchain/src/lib.rs | 22 ++- .../rust-sdk/account-test/Cargo.lock | 18 +++ 4 files changed, 224 insertions(+), 8 deletions(-) diff --git a/felt-repr/derive/src/lib.rs b/felt-repr/derive/src/lib.rs index 308feed25..e24ba8258 100644 --- a/felt-repr/derive/src/lib.rs +++ b/felt-repr/derive/src/lib.rs @@ -87,7 +87,7 @@ fn derive_from_felt_repr_impl(input: &DeriveInput) -> Result Ok(expanded.into()) } -/// Derives `ToFeltRepr` trait for a struct with named fields. +/// Derives `ToFeltRepr` trait (offchain) for a struct with named fields. /// /// Each field must implement `ToFeltRepr`. Fields are serialized /// into consecutive elements in the output vector. @@ -156,3 +156,152 @@ fn derive_to_felt_repr_impl(input: &DeriveInput) -> Result { Ok(expanded.into()) } + +/// Derives `ToFeltRepr` trait (onchain) for a struct with named fields. +/// +/// Each field must implement `ToFeltRepr`. Fields are serialized +/// into consecutive elements in the output vector. +/// +/// # Example +/// +/// ```ignore +/// use miden_felt_repr_onchain::ToFeltRepr; +/// +/// #[derive(ToFeltRepr)] +/// pub struct AccountId { +/// pub prefix: Felt, +/// pub suffix: Felt, +/// } +/// ``` +#[proc_macro_derive(DeriveToFeltReprOnchain)] +pub fn derive_to_felt_repr_onchain(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + match derive_to_felt_repr_onchain_impl(&input) { + Ok(ts) => ts, + Err(err) => err.into_compile_error().into(), + } +} + +fn derive_to_felt_repr_onchain_impl(input: &DeriveInput) -> Result { + let name = &input.ident; + let generics = &input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let fields = match &input.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => &fields.named, + Fields::Unnamed(_) => { + return Err(Error::new( + input.span(), + "ToFeltRepr can only be derived for structs with named fields", + )); + } + Fields::Unit => { + return Err(Error::new( + input.span(), + "ToFeltRepr cannot be derived for unit structs", + )); + } + }, + Data::Enum(_) => { + return Err(Error::new(input.span(), "ToFeltRepr cannot be derived for enums")); + } + Data::Union(_) => { + return Err(Error::new(input.span(), "ToFeltRepr cannot be derived for unions")); + } + }; + + let field_names: Vec<_> = fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + + let expanded = quote! { + impl #impl_generics miden_felt_repr_onchain::ToFeltRepr for #name #ty_generics #where_clause { + fn to_felt_repr(&self) -> alloc::vec::Vec { + let mut result = alloc::vec::Vec::new(); + #(result.extend(miden_felt_repr_onchain::ToFeltRepr::to_felt_repr(&self.#field_names));)* + result + } + } + }; + + Ok(expanded.into()) +} + +/// Derives `FromFeltRepr` trait (offchain) for a struct with named fields. +/// +/// Each field must implement `FromFeltRepr`. Fields are deserialized +/// sequentially from a `FeltReader`, with each field consuming its +/// required elements. +/// +/// # Example +/// +/// ```ignore +/// use miden_felt_repr_offchain::FromFeltRepr; +/// +/// #[derive(FromFeltRepr)] +/// pub struct AccountId { +/// pub prefix: Felt, +/// pub suffix: Felt, +/// } +/// ``` +#[proc_macro_derive(DeriveFromFeltReprOffchain)] +pub fn derive_from_felt_repr_offchain(input: TokenStream) -> TokenStream { + let input = parse_macro_input!(input as DeriveInput); + + match derive_from_felt_repr_offchain_impl(&input) { + Ok(ts) => ts, + Err(err) => err.into_compile_error().into(), + } +} + +fn derive_from_felt_repr_offchain_impl(input: &DeriveInput) -> Result { + let name = &input.ident; + let generics = &input.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let fields = match &input.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => &fields.named, + Fields::Unnamed(_) => { + return Err(Error::new( + input.span(), + "FromFeltRepr can only be derived for structs with named fields", + )); + } + Fields::Unit => { + return Err(Error::new( + input.span(), + "FromFeltRepr cannot be derived for unit structs", + )); + } + }, + Data::Enum(_) => { + return Err(Error::new(input.span(), "FromFeltRepr cannot be derived for enums")); + } + Data::Union(_) => { + return Err(Error::new(input.span(), "FromFeltRepr cannot be derived for unions")); + } + }; + + let field_names: Vec<_> = fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + let field_types: Vec<_> = fields.iter().map(|field| &field.ty).collect(); + + let expanded = quote! { + impl #impl_generics miden_felt_repr_offchain::FromFeltRepr for #name #ty_generics #where_clause { + fn from_felt_repr(reader: &mut miden_felt_repr_offchain::FeltReader<'_>) -> Self { + Self { + #(#field_names: <#field_types as miden_felt_repr_offchain::FromFeltRepr>::from_felt_repr(reader)),* + } + } + } + + impl #impl_generics From<&[miden_core::Felt]> for #name #ty_generics #where_clause { + fn from(felts: &[miden_core::Felt]) -> Self { + let mut reader = miden_felt_repr_offchain::FeltReader::new(felts); + ::from_felt_repr(&mut reader) + } + } + }; + + Ok(expanded.into()) +} diff --git a/felt-repr/offchain/src/lib.rs b/felt-repr/offchain/src/lib.rs index 7e9329d6d..6639cf26d 100644 --- a/felt-repr/offchain/src/lib.rs +++ b/felt-repr/offchain/src/lib.rs @@ -1,7 +1,4 @@ -//! Serialization into felt representation for off-chain use. -//! -//! This crate provides serialization of types into their felt memory representation, -//! which can be used for deserialization on-chain via `miden-felt-repr-onchain`. +//! Serialization/deserialization for felt representation in off-chain use. #![no_std] #![deny(warnings)] @@ -14,9 +11,43 @@ use alloc::{vec, vec::Vec}; pub use account_id::AccountIdFeltRepr; use miden_core::Felt; -/// Re-export the derive macro with the same name as the trait. +/// Re-export the derive macros with the same name as the traits. +pub use miden_felt_repr_derive::DeriveFromFeltReprOffchain as FromFeltRepr; pub use miden_felt_repr_derive::DeriveToFeltRepr as ToFeltRepr; +/// A reader that wraps a slice of `Felt` elements and tracks the current position. +pub struct FeltReader<'a> { + data: &'a [Felt], + pos: usize, +} + +impl<'a> FeltReader<'a> { + /// Creates a new `FeltReader` from a slice of `Felt` elements. + pub fn new(data: &'a [Felt]) -> Self { + Self { data, pos: 0 } + } + + /// Reads the next `Felt` element, advancing the position. + pub fn read(&mut self) -> Felt { + let felt = self.data[self.pos]; + self.pos += 1; + felt + } +} + +/// Trait for deserialization from felt memory representation. +pub trait FromFeltRepr: Sized { + /// Deserializes from a `FeltReader`, consuming the required elements. + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self; +} + +/// Base implementation for `Felt` itself. +impl FromFeltRepr for Felt { + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read() + } +} + /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { /// Serializes this value into a vector of `Felt` elements. diff --git a/felt-repr/onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs index 56dec3d34..6d828dceb 100644 --- a/felt-repr/onchain/src/lib.rs +++ b/felt-repr/onchain/src/lib.rs @@ -1,10 +1,15 @@ -//! Deserialization from felt representation for on-chain execution. +//! Serialization/deserialization for felt representation in on-chain execution. #![no_std] #![deny(warnings)] -/// Re-export the derive macro with the same name as the trait. +extern crate alloc; + +use alloc::{vec, vec::Vec}; + +/// Re-export the derive macros with the same name as the traits. pub use miden_felt_repr_derive::DeriveFromFeltRepr as FromFeltRepr; +pub use miden_felt_repr_derive::DeriveToFeltReprOnchain as ToFeltRepr; use miden_stdlib_sys::Felt; /// A reader that wraps a slice of `Felt` elements and tracks the current position. @@ -39,3 +44,16 @@ impl FromFeltRepr for Felt { reader.read() } } + +/// Trait for serializing a type into its felt memory representation. +pub trait ToFeltRepr { + /// Serializes this value into a vector of `Felt` elements. + fn to_felt_repr(&self) -> Vec; +} + +/// Base implementation for `Felt` itself. +impl ToFeltRepr for Felt { + fn to_felt_repr(&self) -> Vec { + vec![*self] + } +} diff --git a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock index f2b291770..f1b39d4a5 100644 --- a/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock +++ b/tests/rust-apps-wasm/rust-sdk/account-test/Cargo.lock @@ -1072,6 +1072,7 @@ dependencies = [ name = "miden-base-sys" version = "0.8.0" dependencies = [ + "miden-felt-repr-onchain", "miden-stdlib-sys", ] @@ -1151,6 +1152,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "miden-felt-repr-derive" +version = "0.7.1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "miden-felt-repr-onchain" +version = "0.7.1" +dependencies = [ + "miden-felt-repr-derive", + "miden-stdlib-sys", +] + [[package]] name = "miden-formatting" version = "0.1.1" From 93323571a92579ea450188262b13b7c5585eb3e1 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 8 Dec 2025 12:46:23 +0200 Subject: [PATCH 05/15] chore: introduce the `miden-felt-repr-tests` suite for super roundtrip tests These tests verify the round-trip correctness of serializing data off-chain, passing it to on-chain code where it's deserialized and re-serialized, then deserializing the result off-chain and comparing to the original. --- Cargo.lock | 14 + felt-repr/derive/src/lib.rs | 10 +- felt-repr/onchain/src/lib.rs | 4 + felt-repr/tests/Cargo.toml | 25 + felt-repr/tests/src/lib.rs | 131 + felt-repr/tests/src/offchain.rs | 53 + felt-repr/tests/src/onchain.rs | 139 + tests/integration/expected/examples/p2id.hir | 2275 ++++++++--------- tests/integration/expected/examples/p2id.masm | 1183 ++++----- tests/integration/expected/examples/p2id.wat | 186 +- 10 files changed, 1947 insertions(+), 2073 deletions(-) create mode 100644 felt-repr/tests/Cargo.toml create mode 100644 felt-repr/tests/src/lib.rs create mode 100644 felt-repr/tests/src/offchain.rs create mode 100644 felt-repr/tests/src/onchain.rs diff --git a/Cargo.lock b/Cargo.lock index 37f73a6a0..583fb410e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2479,6 +2479,20 @@ dependencies = [ "miden-stdlib-sys", ] +[[package]] +name = "miden-felt-repr-tests" +version = "0.7.1" +dependencies = [ + "miden-core", + "miden-debug", + "miden-felt-repr-offchain", + "miden-integration-tests", + "miden-lib", + "miden-processor", + "midenc-frontend-wasm", + "midenc-session", +] + [[package]] name = "miden-formatting" version = "0.1.1" diff --git a/felt-repr/derive/src/lib.rs b/felt-repr/derive/src/lib.rs index e24ba8258..1ffbe11a7 100644 --- a/felt-repr/derive/src/lib.rs +++ b/felt-repr/derive/src/lib.rs @@ -69,6 +69,7 @@ fn derive_from_felt_repr_impl(input: &DeriveInput) -> Result let expanded = quote! { impl #impl_generics miden_felt_repr_onchain::FromFeltRepr for #name #ty_generics #where_clause { + #[inline(always)] fn from_felt_repr(reader: &mut miden_felt_repr_onchain::FeltReader<'_>) -> Self { Self { #(#field_names: <#field_types as miden_felt_repr_onchain::FromFeltRepr>::from_felt_repr(reader)),* @@ -77,6 +78,7 @@ fn derive_from_felt_repr_impl(input: &DeriveInput) -> Result } impl #impl_generics From<&[miden_stdlib_sys::Felt]> for #name #ty_generics #where_clause { + #[inline(always)] fn from(felts: &[miden_stdlib_sys::Felt]) -> Self { let mut reader = miden_felt_repr_onchain::FeltReader::new(felts); ::from_felt_repr(&mut reader) @@ -214,11 +216,17 @@ fn derive_to_felt_repr_onchain_impl(input: &DeriveInput) -> Result = fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); + // Use for loop with push instead of extend to work around Wasm compilation issue with extend let expanded = quote! { impl #impl_generics miden_felt_repr_onchain::ToFeltRepr for #name #ty_generics #where_clause { + #[inline(always)] fn to_felt_repr(&self) -> alloc::vec::Vec { let mut result = alloc::vec::Vec::new(); - #(result.extend(miden_felt_repr_onchain::ToFeltRepr::to_felt_repr(&self.#field_names));)* + #( + for item in miden_felt_repr_onchain::ToFeltRepr::to_felt_repr(&self.#field_names) { + result.push(item); + } + )* result } } diff --git a/felt-repr/onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs index 6d828dceb..f0908c12b 100644 --- a/felt-repr/onchain/src/lib.rs +++ b/felt-repr/onchain/src/lib.rs @@ -20,11 +20,13 @@ pub struct FeltReader<'a> { impl<'a> FeltReader<'a> { /// Creates a new `FeltReader` from a slice of `Felt` elements. + #[inline(always)] pub fn new(data: &'a [Felt]) -> Self { Self { data, pos: 0 } } /// Reads the next `Felt` element, advancing the position. + #[inline(always)] pub fn read(&mut self) -> Felt { let felt = self.data[self.pos]; self.pos += 1; @@ -40,6 +42,7 @@ pub trait FromFeltRepr: Sized { /// Base implementation for `Felt` itself. impl FromFeltRepr for Felt { + #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { reader.read() } @@ -53,6 +56,7 @@ pub trait ToFeltRepr { /// Base implementation for `Felt` itself. impl ToFeltRepr for Felt { + #[inline(always)] fn to_felt_repr(&self) -> Vec { vec![*self] } diff --git a/felt-repr/tests/Cargo.toml b/felt-repr/tests/Cargo.toml new file mode 100644 index 000000000..062c6de9f --- /dev/null +++ b/felt-repr/tests/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "miden-felt-repr-tests" +description = "Integration tests for felt representation serialization/deserialization" +version = "0.7.1" +rust-version.workspace = true +authors.workspace = true +repository.workspace = true +categories.workspace = true +keywords.workspace = true +license.workspace = true +readme.workspace = true +edition.workspace = true +publish = false + +[dependencies] +miden-felt-repr-offchain = { path = "../offchain", version = "0.7.1" } +miden-core.workspace = true + +[dev-dependencies] +miden-integration-tests = { path = "../../tests/integration" } +midenc-frontend-wasm.workspace = true +midenc-session.workspace = true +miden-debug.workspace = true +miden-lib.workspace = true +miden-processor.workspace = true diff --git a/felt-repr/tests/src/lib.rs b/felt-repr/tests/src/lib.rs new file mode 100644 index 000000000..5064d0c60 --- /dev/null +++ b/felt-repr/tests/src/lib.rs @@ -0,0 +1,131 @@ +//! Integration tests for felt representation serialization/deserialization. +//! +//! These tests verify the round-trip correctness of serializing data off-chain, +//! passing it to on-chain code where it's deserialized and re-serialized, +//! then deserializing the result off-chain and comparing to the original. + +#![cfg(test)] + +mod offchain; +mod onchain; + +extern crate alloc; + +use std::{fs, path::PathBuf}; + +use miden_integration_tests::CompilerTest; +use midenc_frontend_wasm::WasmTranslationConfig; + +/// Get the path to the felt-repr/onchain crate +fn felt_repr_onchain_path() -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir).parent().unwrap().join("onchain") +} + +/// Get the path to the stdlib-sys crate +fn stdlib_sys_path() -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir) + .parent() + .unwrap() + .parent() + .unwrap() + .join("sdk") + .join("stdlib-sys") +} + +/// Get the path to the sdk-alloc crate +fn sdk_alloc_path() -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir) + .parent() + .unwrap() + .parent() + .unwrap() + .join("sdk") + .join("alloc") +} + +/// Get a temporary directory for test projects +fn test_project_dir(name: &str) -> PathBuf { + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + PathBuf::from(manifest_dir) + .parent() + .unwrap() + .parent() + .unwrap() + .join("target") + .join("felt-repr-test-projects") + .join(name) +} + +/// Build a compiler test with felt-repr-onchain dependency +fn build_felt_repr_test(name: &str, fn_body: &str, config: WasmTranslationConfig) -> CompilerTest { + let felt_repr_onchain = felt_repr_onchain_path(); + let stdlib_sys = stdlib_sys_path(); + let sdk_alloc = sdk_alloc_path(); + + let cargo_toml = format!( + r#"cargo-features = ["trim-paths"] + +[package] +name = "{name}" +version = "0.0.1" +edition = "2021" +authors = [] + +[dependencies] +miden-sdk-alloc = {{ path = "{sdk_alloc}" }} +miden-stdlib-sys = {{ path = "{stdlib_sys}" }} +miden-felt-repr-onchain = {{ path = "{felt_repr_onchain}" }} + +[lib] +crate-type = ["cdylib"] + +[profile.release] +panic = "abort" +opt-level = "z" +debug = false +trim-paths = ["diagnostics", "object"] + +[workspace] +"#, + sdk_alloc = sdk_alloc.display(), + stdlib_sys = stdlib_sys.display(), + felt_repr_onchain = felt_repr_onchain.display(), + ); + + let lib_rs = format!( + r#"#![no_std] +#![no_main] +#![allow(unused_imports)] + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! {{ + core::arch::wasm32::unreachable() +}} + +#[global_allocator] +static ALLOC: miden_sdk_alloc::BumpAlloc = miden_sdk_alloc::BumpAlloc::new(); + +extern crate miden_stdlib_sys; +use miden_stdlib_sys::{{*, intrinsics}}; + +extern crate alloc; + +#[no_mangle] +#[allow(improper_ctypes_definitions)] +pub extern "C" fn entrypoint{fn_body} +"# + ); + + // Create project directory + let project_dir = test_project_dir(name); + let src_dir = project_dir.join("src"); + fs::create_dir_all(&src_dir).expect("failed to create project directory"); + fs::write(project_dir.join("Cargo.toml"), cargo_toml).expect("failed to write Cargo.toml"); + fs::write(src_dir.join("lib.rs"), lib_rs).expect("failed to write lib.rs"); + + // Use --test-harness to enable proper advice stack handling + CompilerTest::rust_source_cargo_miden(project_dir, config, ["--test-harness".into()]) +} diff --git a/felt-repr/tests/src/offchain.rs b/felt-repr/tests/src/offchain.rs new file mode 100644 index 000000000..faf4a29fc --- /dev/null +++ b/felt-repr/tests/src/offchain.rs @@ -0,0 +1,53 @@ +//! Off-chain serialization/deserialization tests. +//! +//! These tests verify the correctness of the off-chain `ToFeltRepr` and `FromFeltRepr` +//! implementations without involving on-chain execution. + +use miden_core::Felt; +use miden_felt_repr_offchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + +/// Test struct for off-chain serialization tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct TwoFelts { + a: Felt, + b: Felt, +} + +#[test] +fn serialization() { + let value = TwoFelts { + a: Felt::new(12345), + b: Felt::new(67890), + }; + + let felts = value.to_felt_repr(); + + assert_eq!(felts.len(), 2); + assert_eq!(felts[0], Felt::new(12345)); + assert_eq!(felts[1], Felt::new(67890)); +} + +#[test] +fn deserialization() { + let felts = [Felt::new(12345), Felt::new(67890)]; + + let mut reader = FeltReader::new(&felts); + let value = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(value.a, Felt::new(12345)); + assert_eq!(value.b, Felt::new(67890)); +} + +#[test] +fn roundtrip() { + let original = TwoFelts { + a: Felt::new(12345), + b: Felt::new(67890), + }; + + let felts = original.to_felt_repr(); + let mut reader = FeltReader::new(&felts); + let result = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(result, original); +} diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs new file mode 100644 index 000000000..65429aafd --- /dev/null +++ b/felt-repr/tests/src/onchain.rs @@ -0,0 +1,139 @@ +//! On-chain serialization/deserialization tests. +//! +//! These tests verify the full round-trip: off-chain serialize -> on-chain deserialize/serialize +//! -> off-chain deserialize. + +use std::borrow::Cow; + +use miden_core::{Felt, FieldElement}; +use miden_debug::Felt as TestFelt; +use miden_felt_repr_offchain::{FeltReader, FromFeltRepr, ToFeltRepr}; +use miden_integration_tests::testing::{eval_package, Initializer}; +use midenc_frontend_wasm::WasmTranslationConfig; + +use crate::build_felt_repr_test; + +/// Test struct for round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct TwoFelts { + a: Felt, + b: Felt, +} + +/// Test using actual FeltReader from miden-felt-repr-onchain. +#[test] +fn felt_reader() { + let original = TwoFelts { + a: Felt::new(12345), + b: Felt::new(67890), + }; + let serialized = original.to_felt_repr(); + + let onchain_code = r#"(input: Word) -> Word { + use miden_felt_repr_onchain::FeltReader; + + let input_arr: [Felt; 4] = input.into(); + + let mut reader = FeltReader::new(&input_arr); + let first = reader.read(); + let second = reader.read(); + + Word::from([first, second, felt!(0), felt!(0)]) + }"#; + + let config = WasmTranslationConfig::default(); + let mut test = build_felt_repr_test("onchain_felt_reader", onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_word: Vec = vec![serialized[0], serialized[1], Felt::ZERO, Felt::ZERO]; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_word), + }]; + + let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; + + let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_word: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read result from memory"); + + let result_felts = [result_word[0].0, result_word[1].0]; + let mut reader = FeltReader::new(&result_felts); + let result_struct = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Round-trip failed: values don't match"); + Ok(()) + }) + .unwrap(); +} + +/// Test full round-trip using the actual FromFeltRepr and ToFeltRepr from onchain crate. +/// +/// This tests the full flow: off-chain serialize -> on-chain deserialize via derive +/// -> on-chain serialize -> off-chain deserialize. +#[test] +fn from_to_felt_repr() { + let original = TwoFelts { + a: Felt::new(12345), + b: Felt::new(67890), + }; + let serialized = original.to_felt_repr(); + + let onchain_code = r#"(input: Word) -> Word { + use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct OnchainTwoFelts { + a: Felt, + b: Felt, + } + + let input_arr: [Felt; 4] = input.into(); + + let mut reader = FeltReader::new(&input_arr); + let deserialized = OnchainTwoFelts::from_felt_repr(&mut reader); + + let re_serialized = deserialized.to_felt_repr(); + + Word::from([re_serialized[0], re_serialized[1], felt!(0), felt!(0)]) + }"#; + + let config = WasmTranslationConfig::default(); + let mut test = build_felt_repr_test("onchain_from_to_felt_repr", onchain_code, config); + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_word: Vec = vec![serialized[0], serialized[1], Felt::ZERO, Felt::ZERO]; + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_word), + }]; + + let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; + + let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let result_word: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read result from memory"); + + let result_felts = [result_word[0].0, result_word[1].0]; + let mut reader = FeltReader::new(&result_felts); + let result_struct = TwoFelts::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Full FromFeltRepr/ToFeltRepr round-trip failed"); + Ok(()) + }) + .unwrap(); +} diff --git a/tests/integration/expected/examples/p2id.hir b/tests/integration/expected/examples/p2id.hir index 6fd074445..bda1e9f8d 100644 --- a/tests/integration/expected/examples/p2id.hir +++ b/tests/integration/expected/examples/p2id.hir @@ -35,33 +35,33 @@ builtin.component miden:base/note-script@1.0.0 { v22 = arith.constant 1048616 : 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 - v1010 = arith.constant 0 : i32; + v898 = 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, v1010 : i1; + v30 = arith.neq v28, v898 : i1; scf.if v30{ ^block16: scf.yield ; } else { ^block17: - v1008 = arith.constant 0 : i32; - v1009 = arith.constant 0 : i32; - v32 = arith.eq v16, v1009 : i1; + v896 = arith.constant 0 : i32; + v897 = arith.constant 0 : i32; + v32 = arith.eq v16, v897 : i1; v33 = arith.zext v32 : u32; v34 = hir.bitcast v33 : i32; - v36 = arith.neq v34, v1008 : i1; + v36 = arith.neq v34, v896 : i1; scf.if v36{ - ^block123: + ^block114: scf.yield ; } else { ^block18: - v1002 = arith.constant 0 : u8; + v890 = 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, v1002; + hir.mem_set v41, v39, v890; scf.yield ; }; scf.yield ; @@ -88,1317 +88,1186 @@ builtin.component miden:base/note-script@1.0.0 { 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::active_note::get_inputs(v58) - v62 = arith.constant 20 : u32; - v61 = hir.bitcast v54 : u32; - v63 = arith.add v61, v62 : u32 #[overflow = checked]; - v64 = arith.constant 4 : u32; - v65 = arith.mod v63, v64 : u32; - hir.assertz v65 #[code = 250]; - v66 = hir.int_to_ptr v63 : ptr; - v67 = hir.load v66 : i32; - v69 = arith.constant 24 : u32; - v68 = hir.bitcast v54 : u32; - v70 = arith.add v68, v69 : u32 #[overflow = checked]; - v1141 = arith.constant 4 : u32; - v72 = arith.mod v70, v1141 : u32; - hir.assertz v72 #[code = 250]; - v73 = hir.int_to_ptr v70 : ptr; - v74 = hir.load v73 : i32; - v59 = arith.constant 8 : i32; - v60 = arith.add v54, v59 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/>::from(v60, v67, v74) - v76 = arith.constant 12 : u32; - v75 = hir.bitcast v54 : u32; - v77 = arith.add v75, v76 : u32 #[overflow = checked]; - v1140 = arith.constant 4 : u32; - v79 = arith.mod v77, v1140 : u32; - hir.assertz v79 #[code = 250]; - v80 = hir.int_to_ptr v77 : ptr; - v81 = hir.load v80 : felt; - v83 = arith.constant 8 : u32; - v82 = hir.bitcast v54 : u32; - v84 = arith.add v82, v83 : u32 #[overflow = checked]; - v1139 = arith.constant 4 : u32; - v86 = arith.mod v84, v1139 : u32; - hir.assertz v86 #[code = 250]; - v87 = hir.int_to_ptr v84 : ptr; - v88 = hir.load v87 : felt; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_account::get_id(v54) - v1138 = arith.constant 4 : u32; - v89 = hir.bitcast v54 : u32; - v91 = arith.add v89, v1138 : u32 #[overflow = checked]; - v1137 = arith.constant 4 : u32; - v93 = arith.mod v91, v1137 : u32; - hir.assertz v93 #[code = 250]; - v94 = hir.int_to_ptr v91 : ptr; - v95 = hir.load v94 : felt; - v96 = hir.bitcast v54 : u32; - v1136 = arith.constant 4 : u32; - v98 = arith.mod v96, v1136 : u32; - hir.assertz v98 #[code = 250]; - v99 = hir.int_to_ptr v96 : ptr; - v100 = hir.load v99 : felt; - v101 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v100, v88) : i32 - v47 = arith.constant 0 : i32; - v102 = arith.constant 1 : i32; - v103 = arith.neq v101, v102 : i1; - v104 = arith.zext v103 : u32; - v105 = hir.bitcast v104 : i32; - v107 = arith.neq v105, v47 : i1; - v1068 = scf.if v107 : u32 { - ^block127: - v1012 = arith.constant 0 : u32; - scf.yield v1012; - } else { + 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; + v956 = scf.index_switch v66 : u32 + case 0 { + ^block119: + v1000 = arith.constant 1 : u32; + scf.yield v1000; + } + case 1 { + ^block120: + v999 = arith.constant 1 : u32; + scf.yield v999; + } + default { ^block24: - v108 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v95, v81) : i32 - v1134 = arith.constant 0 : i32; - v1135 = arith.constant 1 : i32; - v110 = arith.neq v108, v1135 : i1; - v111 = arith.zext v110 : u32; - v112 = hir.bitcast v111 : i32; - v114 = arith.neq v112, v1134 : i1; - scf.if v114{ - ^block126: - scf.yield ; + v68 = arith.constant 20 : u32; + v67 = hir.bitcast v54 : u32; + v69 = arith.add v67, v68 : u32 #[overflow = checked]; + v1033 = arith.constant 4 : u32; + v71 = arith.mod v69, v1033 : u32; + hir.assertz v71 #[code = 250]; + v72 = hir.int_to_ptr v69 : ptr; + v73 = hir.load v72 : i32; + v1032 = arith.constant 4 : u32; + v74 = hir.bitcast v73 : u32; + v76 = arith.add v74, v1032 : u32 #[overflow = checked]; + v1031 = arith.constant 4 : u32; + v78 = arith.mod v76, v1031 : u32; + hir.assertz v78 #[code = 250]; + v79 = hir.int_to_ptr v76 : ptr; + v80 = hir.load v79 : felt; + v81 = hir.bitcast v73 : u32; + v1030 = arith.constant 4 : u32; + v83 = arith.mod v81, v1030 : 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::active_account::get_id(v87) + v89 = arith.constant 12 : u32; + v88 = hir.bitcast v54 : u32; + v90 = arith.add v88, v89 : u32 #[overflow = checked]; + v1029 = arith.constant 4 : u32; + v92 = arith.mod v90, v1029 : 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]; + v1028 = arith.constant 4 : u32; + v99 = arith.mod v97, v1028 : u32; + hir.assertz v99 #[code = 250]; + v100 = hir.int_to_ptr v97 : ptr; + v101 = hir.load v100 : felt; + v102 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v101, v85) : i32 + v47 = arith.constant 0 : i32; + v103 = arith.constant 1 : i32; + v104 = arith.neq v102, v103 : i1; + v105 = arith.zext v104 : u32; + v106 = hir.bitcast v105 : i32; + v108 = arith.neq v106, v47 : i1; + v958 = scf.if v108 : u32 { + ^block118: + v908 = arith.constant 1 : u32; + scf.yield v908; } else { ^block25: - v115 = arith.constant 28 : i32; - v116 = arith.add v54, v115 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v116) - v118 = arith.constant 36 : u32; - v117 = hir.bitcast v54 : u32; - v119 = arith.add v117, v118 : u32 #[overflow = checked]; - v1133 = arith.constant 4 : u32; - v121 = arith.mod v119, v1133 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - v123 = hir.load v122 : i32; - v128 = arith.constant 28 : u32; - v127 = hir.bitcast v54 : u32; - v129 = arith.add v127, v128 : u32 #[overflow = checked]; - v1132 = arith.constant 4 : u32; - v131 = arith.mod v129, v1132 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i32; - v135 = arith.constant 32 : u32; - v134 = hir.bitcast v54 : u32; - v136 = arith.add v134, v135 : u32 #[overflow = checked]; - v1131 = arith.constant 4 : u32; - v138 = arith.mod v136, v1131 : u32; - hir.assertz v138 #[code = 250]; - v139 = hir.int_to_ptr v136 : ptr; - v140 = hir.load v139 : i32; - v1130 = arith.constant 4 : u32; - v126 = arith.shl v123, v1130 : i32; - v1086, v1087, v1088, v1089, v1090, v1091, v1092, v1093 = scf.while v126, v140, v54, v140, v133 : i32, i32, i32, i32, i32, i32, i32, i32 { - ^block138(v1094: i32, v1095: i32, v1096: i32, v1097: i32, v1098: i32): - v1128 = arith.constant 0 : i32; - v1129 = arith.constant 0 : i32; - v143 = arith.eq v1094, v1129 : i1; - v144 = arith.zext v143 : u32; - v145 = hir.bitcast v144 : i32; - v147 = arith.neq v145, v1128 : i1; - v1079, v1080 = scf.if v147 : i32, i32 { - ^block137: - v1021 = ub.poison i32 : i32; - scf.yield v1021, v1021; - } else { - ^block29: - v149 = hir.bitcast v1095 : u32; - v1127 = arith.constant 4 : u32; - v151 = arith.mod v149, v1127 : u32; - hir.assertz v151 #[code = 250]; - v152 = hir.int_to_ptr v149 : ptr; - v153 = hir.load v152 : felt; - v1126 = arith.constant 4 : u32; - v154 = hir.bitcast v1095 : u32; - v156 = arith.add v154, v1126 : u32 #[overflow = checked]; - v1125 = arith.constant 4 : u32; - v158 = arith.mod v156, v1125 : u32; - hir.assertz v158 #[code = 250]; - v159 = hir.int_to_ptr v156 : ptr; - v160 = hir.load v159 : felt; - v1124 = arith.constant 8 : u32; - v161 = hir.bitcast v1095 : u32; - v163 = arith.add v161, v1124 : u32 #[overflow = checked]; - v1123 = arith.constant 4 : u32; - v165 = arith.mod v163, v1123 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - v167 = hir.load v166 : felt; - v1122 = arith.constant 12 : u32; - v168 = hir.bitcast v1095 : u32; - v170 = arith.add v168, v1122 : u32 #[overflow = checked]; - v1121 = arith.constant 4 : u32; - v172 = arith.mod v170, v1121 : u32; - hir.assertz v172 #[code = 250]; - v173 = hir.int_to_ptr v170 : ptr; - v174 = hir.load v173 : felt; - hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v153, v160, v167, v174) - v1120 = arith.constant 16 : i32; - v178 = arith.add v1095, v1120 : i32 #[overflow = wrapping]; - v175 = arith.constant -16 : i32; - v176 = arith.add v1094, v175 : i32 #[overflow = wrapping]; - scf.yield v176, v178; + v109 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::felt::eq(v94, v80) : i32 + v1026 = arith.constant 0 : i32; + v1027 = arith.constant 1 : i32; + v111 = arith.neq v109, v1027 : i1; + v112 = arith.zext v111 : u32; + v113 = hir.bitcast v112 : i32; + v115 = arith.neq v113, v1026 : i1; + scf.if v115{ + ^block117: + scf.yield ; + } else { + ^block26: + v116 = arith.constant 28 : i32; + v117 = arith.add v54, v116 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden_base_sys::bindings::active_note::get_assets(v117) + v119 = arith.constant 36 : u32; + v118 = hir.bitcast v54 : u32; + v120 = arith.add v118, v119 : u32 #[overflow = checked]; + v1025 = arith.constant 4 : u32; + v122 = arith.mod v120, v1025 : u32; + hir.assertz v122 #[code = 250]; + v123 = hir.int_to_ptr v120 : ptr; + v124 = hir.load v123 : i32; + v129 = arith.constant 28 : u32; + v128 = hir.bitcast v54 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v1024 = arith.constant 4 : u32; + v132 = arith.mod v130, v1024 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : i32; + v136 = arith.constant 32 : u32; + v135 = hir.bitcast v54 : u32; + v137 = arith.add v135, v136 : u32 #[overflow = checked]; + v1023 = arith.constant 4 : u32; + v139 = arith.mod v137, v1023 : u32; + hir.assertz v139 #[code = 250]; + v140 = hir.int_to_ptr v137 : ptr; + v141 = hir.load v140 : i32; + v1022 = arith.constant 4 : u32; + v127 = arith.shl v124, v1022 : i32; + v976, v977, v978, v979, v980, v981, v982, v983 = scf.while v127, v141, v54, v141, v134 : i32, i32, i32, i32, i32, i32, i32, i32 { + ^block132(v984: i32, v985: i32, v986: i32, v987: i32, v988: i32): + v1020 = arith.constant 0 : i32; + v1021 = arith.constant 0 : i32; + v144 = arith.eq v984, v1021 : i1; + v145 = arith.zext v144 : u32; + v146 = hir.bitcast v145 : i32; + v148 = arith.neq v146, v1020 : i1; + v969, v970 = scf.if v148 : i32, i32 { + ^block131: + v909 = ub.poison i32 : i32; + scf.yield v909, v909; + } else { + ^block30: + v150 = hir.bitcast v985 : u32; + v1019 = arith.constant 4 : u32; + v152 = arith.mod v150, v1019 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : felt; + v1018 = arith.constant 4 : u32; + v155 = hir.bitcast v985 : u32; + v157 = arith.add v155, v1018 : u32 #[overflow = checked]; + v1017 = arith.constant 4 : u32; + v159 = arith.mod v157, v1017 : u32; + hir.assertz v159 #[code = 250]; + v160 = hir.int_to_ptr v157 : ptr; + v161 = hir.load v160 : felt; + v1016 = arith.constant 8 : u32; + v162 = hir.bitcast v985 : u32; + v164 = arith.add v162, v1016 : u32 #[overflow = checked]; + v1015 = arith.constant 4 : u32; + v166 = arith.mod v164, v1015 : u32; + hir.assertz v166 #[code = 250]; + v167 = hir.int_to_ptr v164 : ptr; + v168 = hir.load v167 : felt; + v1014 = arith.constant 12 : u32; + v169 = hir.bitcast v985 : u32; + v171 = arith.add v169, v1014 : u32 #[overflow = checked]; + v1013 = arith.constant 4 : u32; + v173 = arith.mod v171, v1013 : u32; + hir.assertz v173 #[code = 250]; + v174 = hir.int_to_ptr v171 : ptr; + v175 = hir.load v174 : felt; + hir.exec @miden:base/note-script@1.0.0/p2id/p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7(v154, v161, v168, v175) + v1012 = arith.constant 16 : i32; + v179 = arith.add v985, v1012 : i32 #[overflow = wrapping]; + v176 = arith.constant -16 : i32; + v177 = arith.add v984, v176 : i32 #[overflow = wrapping]; + scf.yield v177, v179; + }; + v1008 = ub.poison i32 : i32; + v973 = cf.select v148, v1008, v988 : i32; + v1009 = ub.poison i32 : i32; + v972 = cf.select v148, v1009, v987 : i32; + v1010 = ub.poison i32 : i32; + v971 = cf.select v148, v1010, v986 : i32; + v1011 = arith.constant 1 : u32; + v900 = arith.constant 0 : u32; + v975 = cf.select v148, v900, v1011 : u32; + v953 = arith.trunc v975 : i1; + scf.condition v953, v969, v970, v971, v972, v973, v986, v987, v988; + } do { + ^block133(v989: i32, v990: i32, v991: i32, v992: i32, v993: i32, v994: i32, v995: i32, v996: i32): + scf.yield v989, v990, v991, v992, v993; }; - v1116 = ub.poison i32 : i32; - v1083 = cf.select v147, v1116, v1098 : i32; - v1117 = ub.poison i32 : i32; - v1082 = cf.select v147, v1117, v1097 : i32; - v1118 = ub.poison i32 : i32; - v1081 = cf.select v147, v1118, v1096 : i32; - v1020 = arith.constant 1 : u32; - v1119 = arith.constant 0 : u32; - v1085 = cf.select v147, v1119, v1020 : u32; - v1065 = arith.trunc v1085 : i1; - scf.condition v1065, v1079, v1080, v1081, v1082, v1083, v1096, v1097, v1098; - } do { - ^block139(v1099: i32, v1100: i32, v1101: i32, v1102: i32, v1103: i32, v1104: i32, v1105: i32, v1106: i32): - scf.yield v1099, v1100, v1101, v1102, v1103; + v183 = arith.constant 44 : u32; + v182 = hir.bitcast v981 : u32; + v184 = arith.add v182, v183 : u32 #[overflow = checked]; + v1007 = arith.constant 4 : u32; + v186 = arith.mod v184, v1007 : u32; + hir.assertz v186 #[code = 250]; + v187 = hir.int_to_ptr v184 : ptr; + hir.store v187, v982; + v190 = arith.constant 40 : u32; + v189 = hir.bitcast v981 : u32; + v191 = arith.add v189, v190 : u32 #[overflow = checked]; + v1006 = arith.constant 4 : u32; + v193 = arith.mod v191, v1006 : u32; + hir.assertz v193 #[code = 250]; + v194 = hir.int_to_ptr v191 : ptr; + hir.store v194, v983; + v1005 = arith.constant 16 : i32; + v195 = arith.constant 40 : i32; + v196 = arith.add v981, v195 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v196, v1005, v1005) + v125 = arith.constant 4 : i32; + v1004 = arith.constant 16 : i32; + v200 = arith.add v981, v1004 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v200, v125, v125) + v1003 = arith.constant 48 : i32; + v204 = arith.add v981, v1003 : i32 #[overflow = wrapping]; + v205 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v206 = hir.bitcast v205 : ptr; + hir.store v206, v204; + scf.yield ; }; - v182 = arith.constant 44 : u32; - v181 = hir.bitcast v1091 : u32; - v183 = arith.add v181, v182 : u32 #[overflow = checked]; - v1115 = arith.constant 4 : u32; - v185 = arith.mod v183, v1115 : u32; - hir.assertz v185 #[code = 250]; - v186 = hir.int_to_ptr v183 : ptr; - hir.store v186, v1092; - v189 = arith.constant 40 : u32; - v188 = hir.bitcast v1091 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v1114 = arith.constant 4 : u32; - v192 = arith.mod v190, v1114 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - hir.store v193, v1093; - v1113 = arith.constant 16 : i32; - v194 = arith.constant 40 : i32; - v195 = arith.add v1091, v194 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v195, v1113, v1113) - v124 = arith.constant 4 : i32; - v1112 = arith.constant 16 : i32; - v199 = arith.add v1091, v1112 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::deallocate(v199, v124, v124) - v1111 = arith.constant 48 : i32; - v203 = arith.add v1091, v1111 : i32 #[overflow = wrapping]; - v204 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v205 = hir.bitcast v204 : ptr; - hir.store v205, v203; - scf.yield ; + v1001 = arith.constant 0 : u32; + v1002 = arith.constant 1 : u32; + v997 = cf.select v115, v1002, v1001 : u32; + scf.yield v997; }; - v1109 = arith.constant 1 : u32; - v1110 = arith.constant 0 : u32; - v1107 = cf.select v114, v1110, v1109 : u32; - scf.yield v1107; + scf.yield v958; }; - v1108 = arith.constant 0 : u32; - v1078 = arith.eq v1068, v1108 : i1; - cf.cond_br v1078 ^block23, ^block129; + v998 = arith.constant 0 : u32; + v968 = arith.eq v956, v998 : i1; + cf.cond_br v968 ^block122, ^block23; ^block23: ub.unreachable ; - ^block129: + ^block122: builtin.ret ; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block30: + ^block31: builtin.ret ; }; private builtin.function @wit_bindgen::rt::run_ctors_once() { - ^block32: - v207 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v208 = hir.bitcast v207 : ptr; - v209 = hir.load v208 : i32; - v210 = arith.constant 1048620 : i32; - v211 = arith.add v209, v210 : i32 #[overflow = wrapping]; - v212 = hir.bitcast v211 : u32; - v213 = hir.int_to_ptr v212 : ptr; - v214 = hir.load v213 : u8; - v206 = arith.constant 0 : i32; - v215 = arith.zext v214 : u32; - v216 = hir.bitcast v215 : i32; - v218 = arith.neq v216, v206 : i1; - scf.if v218{ - ^block34: + ^block33: + v208 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v209 = hir.bitcast v208 : ptr; + v210 = hir.load v209 : i32; + v211 = arith.constant 1048620 : i32; + v212 = arith.add v210, v211 : i32 #[overflow = wrapping]; + v213 = hir.bitcast v212 : u32; + v214 = hir.int_to_ptr v213 : ptr; + v215 = hir.load v214 : u8; + v207 = arith.constant 0 : i32; + v216 = arith.zext v215 : u32; + v217 = hir.bitcast v216 : i32; + v219 = arith.neq v217, v207 : i1; + scf.if v219{ + ^block35: scf.yield ; } else { - ^block35: - v219 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v220 = hir.bitcast v219 : ptr; - v221 = hir.load v220 : i32; + ^block36: + v220 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v221 = hir.bitcast v220 : ptr; + v222 = hir.load v221 : i32; hir.exec @miden:base/note-script@1.0.0/p2id/__wasm_call_ctors() - v1143 = arith.constant 1 : u8; - v1145 = arith.constant 1048620 : i32; - v223 = arith.add v221, v1145 : i32 #[overflow = wrapping]; - v227 = hir.bitcast v223 : u32; - v228 = hir.int_to_ptr v227 : ptr; - hir.store v228, v1143; + v1035 = arith.constant 1 : u8; + v1037 = arith.constant 1048620 : i32; + v224 = arith.add v222, v1037 : i32 #[overflow = wrapping]; + v228 = hir.bitcast v224 : u32; + v229 = hir.int_to_ptr v228 : ptr; + hir.store v229, v1035; scf.yield ; }; builtin.ret ; }; - private builtin.function @::alloc(v229: i32, v230: i32, v231: i32) -> i32 { - ^block36(v229: i32, v230: i32, v231: i32): - v234 = arith.constant 16 : i32; - v233 = arith.constant 0 : i32; - v1147 = arith.constant 16 : u32; - v236 = hir.bitcast v230 : u32; - v238 = arith.gt v236, v1147 : i1; - v239 = arith.zext v238 : u32; - v240 = hir.bitcast v239 : i32; - v242 = arith.neq v240, v233 : i1; - v243 = cf.select v242, v230, v234 : i32; - v1187 = arith.constant 0 : i32; - v244 = arith.constant -1 : i32; - v245 = arith.add v243, v244 : i32 #[overflow = wrapping]; - v246 = arith.band v243, v245 : i32; - v248 = arith.neq v246, v1187 : i1; - v1156, v1157 = scf.if v248 : i32, u32 { - ^block143: - v1148 = arith.constant 0 : u32; - v1152 = ub.poison i32 : i32; - scf.yield v1152, v1148; + private builtin.function @::alloc(v230: i32, v231: i32, v232: i32) -> i32 { + ^block37(v230: i32, v231: i32, v232: i32): + v235 = arith.constant 16 : i32; + v234 = arith.constant 0 : i32; + v1039 = arith.constant 16 : u32; + v237 = hir.bitcast v231 : u32; + v239 = arith.gt v237, v1039 : i1; + v240 = arith.zext v239 : u32; + v241 = hir.bitcast v240 : i32; + v243 = arith.neq v241, v234 : i1; + v244 = cf.select v243, v231, v235 : i32; + v1079 = arith.constant 0 : i32; + v245 = arith.constant -1 : i32; + v246 = arith.add v244, v245 : i32 #[overflow = wrapping]; + v247 = arith.band v244, v246 : i32; + v249 = arith.neq v247, v1079 : i1; + v1048, v1049 = scf.if v249 : i32, u32 { + ^block137: + v1040 = arith.constant 0 : u32; + v1044 = ub.poison i32 : i32; + scf.yield v1044, v1040; } else { - ^block39: - v250 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v230, v243) : i32 - v1186 = arith.constant 0 : i32; - v249 = arith.constant -2147483648 : i32; - v251 = arith.sub v249, v250 : i32 #[overflow = wrapping]; - v253 = hir.bitcast v251 : u32; - v252 = hir.bitcast v231 : u32; - v254 = arith.gt v252, v253 : i1; - v255 = arith.zext v254 : u32; - v256 = hir.bitcast v255 : i32; - v258 = arith.neq v256, v1186 : i1; - v1171 = scf.if v258 : i32 { - ^block142: - v1185 = ub.poison i32 : i32; - scf.yield v1185; + ^block40: + v251 = hir.exec @miden:base/note-script@1.0.0/p2id/core::ptr::alignment::Alignment::max(v231, v244) : i32 + v1078 = arith.constant 0 : i32; + v250 = arith.constant -2147483648 : i32; + v252 = arith.sub v250, v251 : i32 #[overflow = wrapping]; + v254 = hir.bitcast v252 : u32; + v253 = hir.bitcast v232 : u32; + v255 = arith.gt v253, v254 : i1; + v256 = arith.zext v255 : u32; + v257 = hir.bitcast v256 : i32; + v259 = arith.neq v257, v1078 : i1; + v1063 = scf.if v259 : i32 { + ^block136: + v1077 = ub.poison i32 : i32; + scf.yield v1077; } else { - ^block40: - v1183 = arith.constant 0 : i32; - v264 = arith.sub v1183, v250 : i32 #[overflow = wrapping]; - v1184 = arith.constant -1 : i32; - v260 = arith.add v231, v250 : i32 #[overflow = wrapping]; - v262 = arith.add v260, v1184 : i32 #[overflow = wrapping]; - v265 = arith.band v262, v264 : i32; - v266 = hir.bitcast v229 : u32; - v267 = arith.constant 4 : u32; - v268 = arith.mod v266, v267 : u32; - hir.assertz v268 #[code = 250]; - v269 = hir.int_to_ptr v266 : ptr; - v270 = hir.load v269 : i32; - v1182 = arith.constant 0 : i32; - v272 = arith.neq v270, v1182 : i1; - scf.if v272{ - ^block141: + ^block41: + v1075 = arith.constant 0 : i32; + v265 = arith.sub v1075, v251 : i32 #[overflow = wrapping]; + v1076 = arith.constant -1 : i32; + v261 = arith.add v232, v251 : i32 #[overflow = wrapping]; + v263 = arith.add v261, v1076 : i32 #[overflow = wrapping]; + v266 = arith.band v263, v265 : i32; + v267 = hir.bitcast v230 : u32; + v268 = arith.constant 4 : u32; + v269 = arith.mod v267, v268 : u32; + hir.assertz v269 #[code = 250]; + v270 = hir.int_to_ptr v267 : ptr; + v271 = hir.load v270 : i32; + v1074 = arith.constant 0 : i32; + v273 = arith.neq v271, v1074 : i1; + scf.if v273{ + ^block135: scf.yield ; } else { - ^block42: - v273 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 - v274 = hir.mem_size : u32; - v280 = hir.bitcast v229 : u32; - v1181 = arith.constant 4 : u32; - v282 = arith.mod v280, v1181 : u32; - hir.assertz v282 #[code = 250]; - v1180 = arith.constant 16 : u32; - v275 = hir.bitcast v274 : i32; - v278 = arith.shl v275, v1180 : i32; - v279 = arith.add v273, v278 : i32 #[overflow = wrapping]; - v283 = hir.int_to_ptr v280 : ptr; - hir.store v283, v279; + ^block43: + v274 = hir.exec @miden:base/note-script@1.0.0/p2id/intrinsics::mem::heap_base() : i32 + v275 = hir.mem_size : u32; + v281 = hir.bitcast v230 : u32; + v1073 = arith.constant 4 : u32; + v283 = arith.mod v281, v1073 : u32; + hir.assertz v283 #[code = 250]; + v1072 = arith.constant 16 : u32; + v276 = hir.bitcast v275 : i32; + v279 = arith.shl v276, v1072 : i32; + v280 = arith.add v274, v279 : i32 #[overflow = wrapping]; + v284 = hir.int_to_ptr v281 : ptr; + hir.store v284, v280; scf.yield ; }; - v286 = hir.bitcast v229 : u32; - v1179 = arith.constant 4 : u32; - v288 = arith.mod v286, v1179 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - v290 = hir.load v289 : i32; - v1177 = arith.constant 0 : i32; - v1178 = arith.constant -1 : i32; - v292 = arith.bxor v290, v1178 : i32; - v294 = hir.bitcast v292 : u32; - v293 = hir.bitcast v265 : u32; - v295 = arith.gt v293, v294 : i1; - v296 = arith.zext v295 : u32; - v297 = hir.bitcast v296 : i32; - v299 = arith.neq v297, v1177 : i1; - v1170 = scf.if v299 : i32 { - ^block43: - v1176 = arith.constant 0 : i32; - scf.yield v1176; - } else { + v287 = hir.bitcast v230 : u32; + v1071 = arith.constant 4 : u32; + v289 = arith.mod v287, v1071 : u32; + hir.assertz v289 #[code = 250]; + v290 = hir.int_to_ptr v287 : ptr; + v291 = hir.load v290 : i32; + v1069 = arith.constant 0 : i32; + v1070 = arith.constant -1 : i32; + v293 = arith.bxor v291, v1070 : i32; + v295 = hir.bitcast v293 : u32; + v294 = hir.bitcast v266 : u32; + v296 = arith.gt v294, v295 : i1; + v297 = arith.zext v296 : u32; + v298 = hir.bitcast v297 : i32; + v300 = arith.neq v298, v1069 : i1; + v1062 = scf.if v300 : i32 { ^block44: - v301 = hir.bitcast v229 : u32; - v1175 = arith.constant 4 : u32; - v303 = arith.mod v301, v1175 : u32; - hir.assertz v303 #[code = 250]; - v300 = arith.add v290, v265 : i32 #[overflow = wrapping]; - v304 = hir.int_to_ptr v301 : ptr; - hir.store v304, v300; - v306 = arith.add v290, v250 : i32 #[overflow = wrapping]; - scf.yield v306; + v1068 = arith.constant 0 : i32; + scf.yield v1068; + } else { + ^block45: + v302 = hir.bitcast v230 : u32; + v1067 = arith.constant 4 : u32; + v304 = arith.mod v302, v1067 : u32; + hir.assertz v304 #[code = 250]; + v301 = arith.add v291, v266 : i32 #[overflow = wrapping]; + v305 = hir.int_to_ptr v302 : ptr; + hir.store v305, v301; + v307 = arith.add v291, v251 : i32 #[overflow = wrapping]; + scf.yield v307; }; - scf.yield v1170; + scf.yield v1062; }; - v1153 = arith.constant 1 : u32; - v1174 = arith.constant 0 : u32; - v1172 = cf.select v258, v1174, v1153 : u32; - scf.yield v1171, v1172; + v1045 = arith.constant 1 : u32; + v1066 = arith.constant 0 : u32; + v1064 = cf.select v259, v1066, v1045 : u32; + scf.yield v1063, v1064; }; - v1173 = arith.constant 0 : u32; - v1169 = arith.eq v1157, v1173 : i1; - cf.cond_br v1169 ^block38, ^block145(v1156); - ^block38: + v1065 = arith.constant 0 : u32; + v1061 = arith.eq v1049, v1065 : i1; + cf.cond_br v1061 ^block39, ^block139(v1048); + ^block39: ub.unreachable ; - ^block145(v1149: i32): - builtin.ret v1149; + ^block139(v1041: i32): + builtin.ret v1041; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block45: - v309 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v309; + ^block46: + v310 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v310; }; - private builtin.function @alloc::vec::Vec::with_capacity(v311: i32) { - ^block49(v311: i32): - v314 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v315 = hir.bitcast v314 : ptr; - v316 = hir.load v315 : i32; - v317 = arith.constant 16 : i32; - v318 = arith.sub v316, v317 : i32 #[overflow = wrapping]; - v319 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v320 = hir.bitcast v319 : ptr; - hir.store v320, v318; - v1192 = arith.constant 16 : i32; - v321 = arith.constant 8 : i32; - v322 = arith.add v318, v321 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v322, v1192, v1192) - v326 = arith.constant 8 : u32; - v325 = hir.bitcast v318 : u32; - v327 = arith.add v325, v326 : u32 #[overflow = checked]; - v1191 = arith.constant 8 : u32; - v329 = arith.mod v327, v1191 : u32; - hir.assertz v329 #[code = 250]; - v330 = hir.int_to_ptr v327 : ptr; - v331 = hir.load v330 : i64; - v1190 = arith.constant 8 : u32; - v333 = hir.bitcast v311 : u32; - v335 = arith.add v333, v1190 : u32 #[overflow = checked]; - v336 = arith.constant 4 : u32; - v337 = arith.mod v335, v336 : u32; - hir.assertz v337 #[code = 250]; - v312 = arith.constant 0 : i32; - v338 = hir.int_to_ptr v335 : ptr; - hir.store v338, v312; - v339 = hir.bitcast v311 : u32; - v1189 = arith.constant 4 : u32; - v341 = arith.mod v339, v1189 : u32; - hir.assertz v341 #[code = 250]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v331; - v1188 = arith.constant 16 : i32; - v344 = arith.add v318, v1188 : i32 #[overflow = wrapping]; - v345 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v346 = hir.bitcast v345 : ptr; - hir.store v346, v344; + private builtin.function @alloc::vec::Vec::with_capacity(v312: i32) { + ^block50(v312: i32): + v315 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v316 = hir.bitcast v315 : ptr; + v317 = hir.load v316 : i32; + v318 = arith.constant 16 : i32; + v319 = arith.sub v317, v318 : i32 #[overflow = wrapping]; + v320 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v321 = hir.bitcast v320 : ptr; + hir.store v321, v319; + v1084 = arith.constant 16 : i32; + v322 = arith.constant 8 : i32; + v323 = arith.add v319, v322 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v323, v1084, v1084) + v327 = arith.constant 8 : u32; + v326 = hir.bitcast v319 : u32; + v328 = arith.add v326, v327 : u32 #[overflow = checked]; + v1083 = arith.constant 8 : u32; + v330 = arith.mod v328, v1083 : u32; + hir.assertz v330 #[code = 250]; + v331 = hir.int_to_ptr v328 : ptr; + v332 = hir.load v331 : i64; + v1082 = arith.constant 8 : u32; + v334 = hir.bitcast v312 : u32; + v336 = arith.add v334, v1082 : u32 #[overflow = checked]; + v337 = arith.constant 4 : u32; + v338 = arith.mod v336, v337 : u32; + hir.assertz v338 #[code = 250]; + v313 = arith.constant 0 : i32; + v339 = hir.int_to_ptr v336 : ptr; + hir.store v339, v313; + v340 = hir.bitcast v312 : u32; + v1081 = arith.constant 4 : u32; + v342 = arith.mod v340, v1081 : u32; + hir.assertz v342 #[code = 250]; + v343 = hir.int_to_ptr v340 : ptr; + hir.store v343, v332; + v1080 = arith.constant 16 : i32; + v345 = arith.add v319, v1080 : i32 #[overflow = wrapping]; + v346 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v347 = hir.bitcast v346 : ptr; + hir.store v347, v345; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v347: i32, v348: i32, v349: i32) { - ^block51(v347: i32, v348: i32, v349: i32): - v351 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v352 = hir.bitcast v351 : ptr; - v353 = hir.load v352 : i32; - v354 = arith.constant 16 : i32; - v355 = arith.sub v353, v354 : i32 #[overflow = wrapping]; - v356 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v357 = hir.bitcast v356 : ptr; - hir.store v357, v355; - v350 = arith.constant 0 : i32; - v360 = arith.constant 256 : i32; - v358 = arith.constant 4 : i32; - v359 = arith.add v355, v358 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v359, v360, v350, v348, v349) - v363 = arith.constant 8 : u32; - v362 = hir.bitcast v355 : u32; - v364 = arith.add v362, v363 : u32 #[overflow = checked]; - v365 = arith.constant 4 : u32; - v366 = arith.mod v364, v365 : u32; - hir.assertz v366 #[code = 250]; - v367 = hir.int_to_ptr v364 : ptr; - v368 = hir.load v367 : i32; - v1203 = arith.constant 4 : u32; - v369 = hir.bitcast v355 : u32; - v371 = arith.add v369, v1203 : u32 #[overflow = checked]; - v1202 = arith.constant 4 : u32; - v373 = arith.mod v371, v1202 : u32; - hir.assertz v373 #[code = 250]; - v374 = hir.int_to_ptr v371 : ptr; - v375 = hir.load v374 : i32; - v1201 = arith.constant 0 : i32; - v376 = arith.constant 1 : i32; - v377 = arith.neq v375, v376 : i1; - v378 = arith.zext v377 : u32; - v379 = hir.bitcast v378 : i32; - v381 = arith.neq v379, v1201 : i1; - cf.cond_br v381 ^block53, ^block54; - ^block53: - v395 = arith.constant 12 : u32; - v394 = hir.bitcast v355 : u32; - v396 = arith.add v394, v395 : u32 #[overflow = checked]; - v1200 = arith.constant 4 : u32; - v398 = arith.mod v396, v1200 : u32; - hir.assertz v398 #[code = 250]; - v399 = hir.int_to_ptr v396 : ptr; - v400 = hir.load v399 : i32; - v1199 = arith.constant 4 : u32; - v401 = hir.bitcast v347 : u32; - v403 = arith.add v401, v1199 : u32 #[overflow = checked]; - v1198 = arith.constant 4 : u32; - v405 = arith.mod v403, v1198 : u32; - hir.assertz v405 #[code = 250]; - v406 = hir.int_to_ptr v403 : ptr; - hir.store v406, v400; - v407 = hir.bitcast v347 : u32; - v1197 = arith.constant 4 : u32; - v409 = arith.mod v407, v1197 : u32; - hir.assertz v409 #[code = 250]; - v410 = hir.int_to_ptr v407 : ptr; - hir.store v410, v368; - v1196 = arith.constant 16 : i32; - v412 = arith.add v355, v1196 : i32 #[overflow = wrapping]; - v413 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v414 = hir.bitcast v413 : ptr; - hir.store v414, v412; - builtin.ret ; + private builtin.function @alloc::raw_vec::RawVecInner::with_capacity_in(v348: i32, v349: i32, v350: i32) { + ^block52(v348: i32, v349: i32, v350: i32): + v352 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v353 = hir.bitcast v352 : ptr; + v354 = hir.load v353 : i32; + v355 = arith.constant 16 : i32; + v356 = arith.sub v354, v355 : i32 #[overflow = wrapping]; + v357 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v358 = hir.bitcast v357 : ptr; + hir.store v358, v356; + v351 = arith.constant 0 : i32; + v361 = arith.constant 256 : i32; + v359 = arith.constant 4 : i32; + v360 = arith.add v356, v359 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::try_allocate_in(v360, v361, v351, v349, v350) + v364 = arith.constant 8 : u32; + v363 = hir.bitcast v356 : u32; + v365 = arith.add v363, v364 : u32 #[overflow = checked]; + v366 = arith.constant 4 : u32; + v367 = arith.mod v365, v366 : u32; + hir.assertz v367 #[code = 250]; + v368 = hir.int_to_ptr v365 : ptr; + v369 = hir.load v368 : i32; + v1095 = arith.constant 4 : u32; + v370 = hir.bitcast v356 : u32; + v372 = arith.add v370, v1095 : u32 #[overflow = checked]; + v1094 = arith.constant 4 : u32; + v374 = arith.mod v372, v1094 : u32; + hir.assertz v374 #[code = 250]; + v375 = hir.int_to_ptr v372 : ptr; + v376 = hir.load v375 : i32; + v1093 = arith.constant 0 : i32; + v377 = arith.constant 1 : i32; + v378 = arith.neq v376, v377 : i1; + v379 = arith.zext v378 : u32; + v380 = hir.bitcast v379 : i32; + v382 = arith.neq v380, v1093 : i1; + cf.cond_br v382 ^block54, ^block55; ^block54: - v382 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr - v383 = hir.bitcast v382 : ptr; - v384 = hir.load v383 : i32; - v1195 = arith.constant 12 : u32; - v385 = hir.bitcast v355 : u32; - v387 = arith.add v385, v1195 : u32 #[overflow = checked]; - v1194 = arith.constant 4 : u32; - v389 = arith.mod v387, v1194 : u32; - hir.assertz v389 #[code = 250]; - v390 = hir.int_to_ptr v387 : ptr; - v391 = hir.load v390 : i32; - v392 = arith.constant 1048600 : i32; - v393 = arith.add v384, v392 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v368, v391, v393) - ub.unreachable ; - }; - - private builtin.function @miden_base_sys::bindings::active_account::get_id(v415: i32) { - ^block55(v415: i32): - v417 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v418 = hir.bitcast v417 : ptr; - v419 = hir.load v418 : i32; - v420 = arith.constant 16 : i32; - v421 = arith.sub v419, v420 : i32 #[overflow = wrapping]; - v422 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v423 = hir.bitcast v422 : ptr; - hir.store v423, v421; - v424 = arith.constant 8 : i32; - v425 = arith.add v421, v424 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v425) - v427 = arith.constant 8 : u32; - v426 = hir.bitcast v421 : u32; - v428 = arith.add v426, v427 : u32 #[overflow = checked]; - v429 = arith.constant 4 : u32; - v430 = arith.mod v428, v429 : u32; - hir.assertz v430 #[code = 250]; - v431 = hir.int_to_ptr v428 : ptr; - v432 = hir.load v431 : i64; - v433 = hir.bitcast v415 : u32; - v1205 = arith.constant 8 : u32; - v435 = arith.mod v433, v1205 : u32; - hir.assertz v435 #[code = 250]; - v436 = hir.int_to_ptr v433 : ptr; - hir.store v436, v432; - v1204 = arith.constant 16 : i32; - v438 = arith.add v421, v1204 : i32 #[overflow = wrapping]; - v439 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v440 = hir.bitcast v439 : ptr; - hir.store v440, v438; + v396 = arith.constant 12 : u32; + v395 = hir.bitcast v356 : u32; + v397 = arith.add v395, v396 : u32 #[overflow = checked]; + v1092 = arith.constant 4 : u32; + v399 = arith.mod v397, v1092 : u32; + hir.assertz v399 #[code = 250]; + v400 = hir.int_to_ptr v397 : ptr; + v401 = hir.load v400 : i32; + v1091 = arith.constant 4 : u32; + v402 = hir.bitcast v348 : u32; + v404 = arith.add v402, v1091 : u32 #[overflow = checked]; + v1090 = arith.constant 4 : u32; + v406 = arith.mod v404, v1090 : u32; + hir.assertz v406 #[code = 250]; + v407 = hir.int_to_ptr v404 : ptr; + hir.store v407, v401; + v408 = hir.bitcast v348 : u32; + v1089 = arith.constant 4 : u32; + v410 = arith.mod v408, v1089 : u32; + hir.assertz v410 #[code = 250]; + v411 = hir.int_to_ptr v408 : ptr; + hir.store v411, v369; + v1088 = arith.constant 16 : i32; + v413 = arith.add v356, v1088 : i32 #[overflow = wrapping]; + v414 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v415 = hir.bitcast v414 : ptr; + hir.store v415, v413; builtin.ret ; + ^block55: + v383 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/GOT.data.internal.__memory_base : ptr + v384 = hir.bitcast v383 : ptr; + v385 = hir.load v384 : i32; + v1087 = arith.constant 12 : u32; + v386 = hir.bitcast v356 : u32; + v388 = arith.add v386, v1087 : u32 #[overflow = checked]; + v1086 = arith.constant 4 : u32; + v390 = arith.mod v388, v1086 : u32; + hir.assertz v390 #[code = 250]; + v391 = hir.int_to_ptr v388 : ptr; + v392 = hir.load v391 : i32; + v393 = arith.constant 1048600 : i32; + v394 = arith.add v385, v393 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::handle_error(v369, v392, v394) + ub.unreachable ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v441: i32) { - ^block57(v441: i32): - v443 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v444 = hir.bitcast v443 : ptr; - v445 = hir.load v444 : i32; - v446 = arith.constant 16 : i32; - v447 = arith.sub v445, v446 : i32 #[overflow = wrapping]; - v448 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v449 = hir.bitcast v448 : ptr; - hir.store v449, v447; - v452 = arith.constant 4 : i32; - v450 = arith.constant 8 : i32; - v451 = arith.add v447, v450 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v451, v452, v452) - v455 = arith.constant 8 : u32; - v454 = hir.bitcast v447 : u32; - v456 = arith.add v454, v455 : u32 #[overflow = checked]; - v457 = arith.constant 4 : u32; - v458 = arith.mod v456, v457 : u32; - hir.assertz v458 #[code = 250]; - v459 = hir.int_to_ptr v456 : ptr; - v460 = hir.load v459 : i32; - v462 = arith.constant 12 : u32; - v461 = hir.bitcast v447 : u32; - v463 = arith.add v461, v462 : u32 #[overflow = checked]; - v1213 = arith.constant 4 : u32; - v465 = arith.mod v463, v1213 : u32; - hir.assertz v465 #[code = 250]; - v466 = hir.int_to_ptr v463 : ptr; - v467 = hir.load v466 : i32; - v1206 = arith.constant 2 : u32; - v469 = hir.bitcast v467 : u32; - v471 = arith.shr v469, v1206 : u32; - v472 = hir.bitcast v471 : i32; - v473 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v472) : i32 - v1212 = arith.constant 8 : u32; - v474 = hir.bitcast v441 : u32; - v476 = arith.add v474, v1212 : u32 #[overflow = checked]; - v1211 = arith.constant 4 : u32; - v478 = arith.mod v476, v1211 : u32; - hir.assertz v478 #[code = 250]; - v479 = hir.int_to_ptr v476 : ptr; - hir.store v479, v473; - v1210 = arith.constant 4 : u32; - v480 = hir.bitcast v441 : u32; - v482 = arith.add v480, v1210 : u32 #[overflow = checked]; - v1209 = arith.constant 4 : u32; - v484 = arith.mod v482, v1209 : u32; - hir.assertz v484 #[code = 250]; - v485 = hir.int_to_ptr v482 : ptr; - hir.store v485, v467; - v486 = hir.bitcast v441 : u32; - v1208 = arith.constant 4 : u32; - v488 = arith.mod v486, v1208 : u32; - hir.assertz v488 #[code = 250]; - v489 = hir.int_to_ptr v486 : ptr; - hir.store v489, v460; - v1207 = arith.constant 16 : i32; - v491 = arith.add v447, v1207 : i32 #[overflow = wrapping]; - v492 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v493 = hir.bitcast v492 : ptr; - hir.store v493, v491; + private builtin.function @miden_base_sys::bindings::active_account::get_id(v416: i32) { + ^block56(v416: i32): + v418 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v419 = hir.bitcast v418 : ptr; + v420 = hir.load v419 : i32; + v421 = arith.constant 16 : i32; + v422 = arith.sub v420, v421 : i32 #[overflow = wrapping]; + v423 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v424 = hir.bitcast v423 : ptr; + hir.store v424, v422; + v425 = arith.constant 8 : i32; + v426 = arith.add v422, v425 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_account::get_id(v426) + v428 = arith.constant 8 : u32; + v427 = hir.bitcast v422 : u32; + v429 = arith.add v427, v428 : u32 #[overflow = checked]; + v430 = arith.constant 4 : u32; + v431 = arith.mod v429, v430 : u32; + hir.assertz v431 #[code = 250]; + v432 = hir.int_to_ptr v429 : ptr; + v433 = hir.load v432 : i64; + v434 = hir.bitcast v416 : u32; + v1097 = arith.constant 8 : u32; + v436 = arith.mod v434, v1097 : u32; + hir.assertz v436 #[code = 250]; + v437 = hir.int_to_ptr v434 : ptr; + hir.store v437, v433; + v1096 = arith.constant 16 : i32; + v439 = arith.add v422, v1096 : i32 #[overflow = wrapping]; + v440 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v441 = hir.bitcast v440 : ptr; + hir.store v441, v439; builtin.ret ; }; - private builtin.function @miden_base_sys::bindings::active_note::get_assets(v494: i32) { - ^block59(v494: i32): - v496 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v497 = hir.bitcast v496 : ptr; - v498 = hir.load v497 : i32; - v499 = arith.constant 16 : i32; - v500 = arith.sub v498, v499 : i32 #[overflow = wrapping]; - v501 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v502 = hir.bitcast v501 : ptr; - hir.store v502, v500; - v503 = arith.constant 4 : i32; - v504 = arith.add v500, v503 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v504) - v508 = arith.constant 8 : u32; - v507 = hir.bitcast v500 : 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 : i32; - v1214 = arith.constant 2 : u32; - v515 = hir.bitcast v513 : u32; - v517 = arith.shr v515, v1214 : u32; - v518 = hir.bitcast v517 : i32; - v519 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v518) : i32 - v505 = arith.constant 8 : i32; - v506 = arith.add v494, v505 : i32 #[overflow = wrapping]; - v520 = hir.bitcast v506 : u32; - v1219 = arith.constant 4 : u32; - v522 = arith.mod v520, v1219 : u32; - hir.assertz v522 #[code = 250]; - v523 = hir.int_to_ptr v520 : ptr; - hir.store v523, v519; - v1218 = arith.constant 4 : u32; - v524 = hir.bitcast v500 : u32; - v526 = arith.add v524, v1218 : u32 #[overflow = checked]; - v1217 = arith.constant 4 : u32; - v528 = arith.mod v526, v1217 : u32; - hir.assertz v528 #[code = 250]; - v529 = hir.int_to_ptr v526 : ptr; - v530 = hir.load v529 : i64; - v531 = hir.bitcast v494 : u32; - v1216 = arith.constant 4 : u32; - v533 = arith.mod v531, v1216 : u32; - hir.assertz v533 #[code = 250]; - v534 = hir.int_to_ptr v531 : ptr; - hir.store v534, v530; - v1215 = arith.constant 16 : i32; - v536 = arith.add v500, v1215 : i32 #[overflow = wrapping]; - v537 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v538 = hir.bitcast v537 : ptr; - hir.store v538, v536; + private builtin.function @miden_base_sys::bindings::active_note::get_inputs(v442: i32) { + ^block58(v442: i32): + v444 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v445 = hir.bitcast v444 : ptr; + v446 = hir.load v445 : i32; + v447 = arith.constant 16 : i32; + v448 = arith.sub v446, v447 : i32 #[overflow = wrapping]; + v449 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v450 = hir.bitcast v449 : ptr; + hir.store v450, v448; + v453 = arith.constant 4 : i32; + v451 = arith.constant 8 : i32; + v452 = arith.add v448, v451 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::with_capacity_in(v452, v453, v453) + v456 = arith.constant 8 : u32; + v455 = hir.bitcast v448 : u32; + v457 = arith.add v455, v456 : u32 #[overflow = checked]; + v458 = arith.constant 4 : u32; + v459 = arith.mod v457, v458 : u32; + hir.assertz v459 #[code = 250]; + v460 = hir.int_to_ptr v457 : ptr; + v461 = hir.load v460 : i32; + v463 = arith.constant 12 : u32; + v462 = hir.bitcast v448 : u32; + v464 = arith.add v462, v463 : u32 #[overflow = checked]; + v1105 = arith.constant 4 : u32; + v466 = arith.mod v464, v1105 : u32; + hir.assertz v466 #[code = 250]; + v467 = hir.int_to_ptr v464 : ptr; + v468 = hir.load v467 : i32; + v1098 = arith.constant 2 : u32; + v470 = hir.bitcast v468 : u32; + v472 = arith.shr v470, v1098 : u32; + v473 = hir.bitcast v472 : i32; + v474 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_inputs(v473) : i32 + v1104 = arith.constant 8 : u32; + v475 = hir.bitcast v442 : u32; + v477 = arith.add v475, v1104 : u32 #[overflow = checked]; + v1103 = arith.constant 4 : u32; + v479 = arith.mod v477, v1103 : u32; + hir.assertz v479 #[code = 250]; + v480 = hir.int_to_ptr v477 : ptr; + hir.store v480, v474; + v1102 = arith.constant 4 : u32; + v481 = hir.bitcast v442 : u32; + v483 = arith.add v481, v1102 : u32 #[overflow = checked]; + v1101 = arith.constant 4 : u32; + v485 = arith.mod v483, v1101 : u32; + hir.assertz v485 #[code = 250]; + v486 = hir.int_to_ptr v483 : ptr; + hir.store v486, v468; + v487 = hir.bitcast v442 : u32; + v1100 = arith.constant 4 : u32; + v489 = arith.mod v487, v1100 : u32; + hir.assertz v489 #[code = 250]; + v490 = hir.int_to_ptr v487 : ptr; + hir.store v490, v461; + v1099 = arith.constant 16 : i32; + v492 = arith.add v448, v1099 : i32 #[overflow = wrapping]; + v493 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v494 = hir.bitcast v493 : ptr; + hir.store v494, v492; builtin.ret ; }; - private builtin.function @::from_felt_repr(v539: i32, v540: i32) { - ^block61(v539: i32, v540: i32): - v542 = hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v540) : felt - v543 = hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v540) : felt - v545 = arith.constant 4 : u32; - v544 = hir.bitcast v539 : u32; - v546 = arith.add v544, v545 : u32 #[overflow = checked]; - v1221 = arith.constant 4 : u32; - v548 = arith.mod v546, v1221 : u32; - hir.assertz v548 #[code = 250]; - v549 = hir.int_to_ptr v546 : ptr; - hir.store v549, v543; - v550 = hir.bitcast v539 : u32; - v1220 = arith.constant 4 : u32; - v552 = arith.mod v550, v1220 : u32; - hir.assertz v552 #[code = 250]; - v553 = hir.int_to_ptr v550 : ptr; - hir.store v553, v542; + private builtin.function @miden_base_sys::bindings::active_note::get_assets(v495: i32) { + ^block60(v495: i32): + v497 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v498 = hir.bitcast v497 : ptr; + v499 = hir.load v498 : i32; + v500 = arith.constant 16 : i32; + v501 = arith.sub v499, v500 : 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; + v504 = arith.constant 4 : i32; + v505 = arith.add v501, v504 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::vec::Vec::with_capacity(v505) + v509 = arith.constant 8 : u32; + v508 = hir.bitcast v501 : u32; + v510 = arith.add v508, v509 : u32 #[overflow = checked]; + v511 = arith.constant 4 : u32; + v512 = arith.mod v510, v511 : u32; + hir.assertz v512 #[code = 250]; + v513 = hir.int_to_ptr v510 : ptr; + v514 = hir.load v513 : i32; + v1106 = arith.constant 2 : u32; + v516 = hir.bitcast v514 : u32; + v518 = arith.shr v516, v1106 : u32; + v519 = hir.bitcast v518 : i32; + v520 = hir.exec @miden:base/note-script@1.0.0/p2id/miden::active_note::get_assets(v519) : i32 + v506 = arith.constant 8 : i32; + v507 = arith.add v495, v506 : i32 #[overflow = wrapping]; + v521 = hir.bitcast v507 : u32; + v1111 = arith.constant 4 : u32; + v523 = arith.mod v521, v1111 : u32; + hir.assertz v523 #[code = 250]; + v524 = hir.int_to_ptr v521 : ptr; + hir.store v524, v520; + v1110 = arith.constant 4 : u32; + v525 = hir.bitcast v501 : u32; + v527 = arith.add v525, v1110 : u32 #[overflow = checked]; + v1109 = arith.constant 4 : u32; + v529 = arith.mod v527, v1109 : u32; + hir.assertz v529 #[code = 250]; + v530 = hir.int_to_ptr v527 : ptr; + v531 = hir.load v530 : i64; + v532 = hir.bitcast v495 : u32; + v1108 = arith.constant 4 : u32; + v534 = arith.mod v532, v1108 : u32; + hir.assertz v534 #[code = 250]; + v535 = hir.int_to_ptr v532 : ptr; + hir.store v535, v531; + v1107 = arith.constant 16 : i32; + v537 = arith.add v501, v1107 : i32 #[overflow = wrapping]; + v538 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v539 = hir.bitcast v538 : ptr; + hir.store v539, v537; builtin.ret ; }; - private builtin.function @>::from(v554: i32, v555: i32, v556: i32) { - ^block63(v554: i32, v555: i32, v556: i32): - v558 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v559 = hir.bitcast v558 : ptr; - v560 = hir.load v559 : i32; - v561 = arith.constant 32 : i32; - v562 = arith.sub v560, v561 : i32 #[overflow = wrapping]; - v563 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v564 = hir.bitcast v563 : ptr; - hir.store v564, v562; - v567 = arith.constant 28 : u32; - v566 = hir.bitcast v562 : u32; - v568 = arith.add v566, v567 : u32 #[overflow = checked]; - v569 = arith.constant 4 : u32; - v570 = arith.mod v568, v569 : u32; - hir.assertz v570 #[code = 250]; - v557 = arith.constant 0 : i32; - v571 = hir.int_to_ptr v568 : ptr; - hir.store v571, v557; - v573 = arith.constant 24 : u32; - v572 = hir.bitcast v562 : u32; - v574 = arith.add v572, v573 : u32 #[overflow = checked]; - v1226 = arith.constant 4 : u32; - v576 = arith.mod v574, v1226 : u32; - hir.assertz v576 #[code = 250]; - v577 = hir.int_to_ptr v574 : ptr; - hir.store v577, v556; - v579 = arith.constant 20 : u32; - v578 = hir.bitcast v562 : u32; - v580 = arith.add v578, v579 : u32 #[overflow = checked]; - v1225 = arith.constant 4 : u32; - v582 = arith.mod v580, v1225 : u32; - hir.assertz v582 #[code = 250]; - v583 = hir.int_to_ptr v580 : ptr; - hir.store v583, v555; - v586 = arith.constant 20 : i32; - v587 = arith.add v562, v586 : i32 #[overflow = wrapping]; - v584 = arith.constant 8 : i32; - v585 = arith.add v562, v584 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::from_felt_repr(v585, v587) - v589 = arith.constant 8 : u32; - v588 = hir.bitcast v562 : u32; - v590 = arith.add v588, v589 : u32 #[overflow = checked]; - v1224 = arith.constant 8 : u32; - v592 = arith.mod v590, v1224 : u32; - hir.assertz v592 #[code = 250]; - v593 = hir.int_to_ptr v590 : ptr; - v594 = hir.load v593 : i64; - v595 = hir.bitcast v554 : u32; - v1223 = arith.constant 8 : u32; - v597 = arith.mod v595, v1223 : u32; - hir.assertz v597 #[code = 250]; - v598 = hir.int_to_ptr v595 : ptr; - hir.store v598, v594; - v1222 = arith.constant 32 : i32; - v600 = arith.add v562, v1222 : i32 #[overflow = wrapping]; - v601 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v602 = hir.bitcast v601 : ptr; - hir.store v602, v600; - builtin.ret ; + private builtin.function @intrinsics::felt::eq(v540: felt, v541: felt) -> i32 { + ^block62(v540: felt, v541: felt): + v542 = arith.eq v540, v541 : i1; + v543 = hir.cast v542 : i32; + builtin.ret v543; }; - private builtin.function @miden_felt_repr_onchain::FeltReader::read(v603: i32) -> felt { - ^block65(v603: i32): - v607 = arith.constant 8 : u32; - v606 = hir.bitcast v603 : u32; - v608 = arith.add v606, v607 : u32 #[overflow = checked]; - v609 = arith.constant 4 : u32; - v610 = arith.mod v608, v609 : u32; - hir.assertz v610 #[code = 250]; - v611 = hir.int_to_ptr v608 : ptr; - v612 = hir.load v611 : i32; - v1235 = arith.constant 4 : u32; - v613 = hir.bitcast v603 : u32; - v615 = arith.add v613, v1235 : u32 #[overflow = checked]; - v1234 = arith.constant 4 : u32; - v617 = arith.mod v615, v1234 : u32; - hir.assertz v617 #[code = 250]; - v618 = hir.int_to_ptr v615 : ptr; - v619 = hir.load v618 : i32; - v605 = arith.constant 0 : i32; - v621 = hir.bitcast v619 : u32; - v620 = hir.bitcast v612 : u32; - v622 = arith.gte v620, v621 : i1; - v623 = arith.zext v622 : u32; - v624 = hir.bitcast v623 : i32; - v626 = arith.neq v624, v605 : i1; - cf.cond_br v626 ^block67, ^block68; - ^block67: - ub.unreachable ; - ^block68: - v1233 = arith.constant 8 : u32; - v629 = hir.bitcast v603 : u32; - v631 = arith.add v629, v1233 : u32 #[overflow = checked]; - v1232 = arith.constant 4 : u32; - v633 = arith.mod v631, v1232 : u32; - hir.assertz v633 #[code = 250]; - v627 = arith.constant 1 : i32; - v628 = arith.add v612, v627 : i32 #[overflow = wrapping]; - v634 = hir.int_to_ptr v631 : ptr; - hir.store v634, v628; - v635 = hir.bitcast v603 : u32; - v1231 = arith.constant 4 : u32; - v637 = arith.mod v635, v1231 : u32; - hir.assertz v637 #[code = 250]; - v638 = hir.int_to_ptr v635 : ptr; - v639 = hir.load v638 : i32; - v1227 = arith.constant 2 : u32; - v642 = arith.shl v612, v1227 : i32; - v643 = arith.add v639, v642 : i32 #[overflow = wrapping]; - v644 = hir.bitcast v643 : u32; - v1230 = arith.constant 4 : u32; - v646 = arith.mod v644, v1230 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - v648 = hir.load v647 : felt; - builtin.ret v648; - }; - - private builtin.function @::from_felt_repr(v649: i32) -> felt { - ^block69(v649: i32): - v651 = hir.exec @miden:base/note-script@1.0.0/p2id/miden_felt_repr_onchain::FeltReader::read(v649) : felt - builtin.ret v651; - }; - - private builtin.function @intrinsics::felt::eq(v652: felt, v653: felt) -> i32 { - ^block71(v652: felt, v653: felt): - v654 = arith.eq v652, v653 : i1; - v655 = hir.cast v654 : i32; - builtin.ret v655; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v657: i32, v658: i32, v659: i32) { - ^block73(v657: i32, v658: i32, v659: i32): - v661 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v662 = hir.bitcast v661 : ptr; - v663 = hir.load v662 : i32; - v664 = arith.constant 16 : i32; - v665 = arith.sub v663, v664 : i32 #[overflow = wrapping]; - v666 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v667 = hir.bitcast v666 : ptr; - hir.store v667, v665; - v668 = arith.constant 4 : i32; - v669 = arith.add v665, v668 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v669, v657, v658, v659) - v671 = arith.constant 8 : u32; - v670 = hir.bitcast v665 : u32; - v672 = arith.add v670, v671 : u32 #[overflow = checked]; - v673 = arith.constant 4 : u32; - v674 = arith.mod v672, v673 : u32; - hir.assertz v674 #[code = 250]; - v675 = hir.int_to_ptr v672 : ptr; - v676 = hir.load v675 : i32; - v1242 = arith.constant 0 : i32; - v660 = arith.constant 0 : i32; - v678 = arith.eq v676, v660 : i1; - v679 = arith.zext v678 : u32; - v680 = hir.bitcast v679 : i32; - v682 = arith.neq v680, v1242 : i1; - scf.if v682{ - ^block153: + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v545: i32, v546: i32, v547: i32) { + ^block64(v545: i32, v546: i32, v547: i32): + v549 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v550 = hir.bitcast v549 : ptr; + v551 = hir.load v550 : i32; + v552 = arith.constant 16 : i32; + v553 = arith.sub v551, v552 : i32 #[overflow = wrapping]; + v554 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v555 = hir.bitcast v554 : ptr; + hir.store v555, v553; + v556 = arith.constant 4 : i32; + v557 = arith.add v553, v556 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::raw_vec::RawVecInner::current_memory(v557, v545, v546, v547) + v559 = arith.constant 8 : u32; + v558 = hir.bitcast v553 : u32; + v560 = arith.add v558, v559 : u32 #[overflow = checked]; + v561 = arith.constant 4 : u32; + v562 = arith.mod v560, v561 : u32; + hir.assertz v562 #[code = 250]; + v563 = hir.int_to_ptr v560 : ptr; + v564 = hir.load v563 : i32; + v1118 = arith.constant 0 : i32; + v548 = arith.constant 0 : i32; + v566 = arith.eq v564, v548 : i1; + v567 = arith.zext v566 : u32; + v568 = hir.bitcast v567 : i32; + v570 = arith.neq v568, v1118 : i1; + scf.if v570{ + ^block145: scf.yield ; } else { - ^block76: - v1241 = arith.constant 4 : u32; - v683 = hir.bitcast v665 : u32; - v685 = arith.add v683, v1241 : u32 #[overflow = checked]; - v1240 = arith.constant 4 : u32; - v687 = arith.mod v685, v1240 : u32; - hir.assertz v687 #[code = 250]; - v688 = hir.int_to_ptr v685 : ptr; - v689 = hir.load v688 : i32; - v691 = arith.constant 12 : u32; - v690 = hir.bitcast v665 : u32; - v692 = arith.add v690, v691 : u32 #[overflow = checked]; - v1239 = arith.constant 4 : u32; - v694 = arith.mod v692, v1239 : u32; - hir.assertz v694 #[code = 250]; - v695 = hir.int_to_ptr v692 : ptr; - v696 = hir.load v695 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v689, v676, v696) + ^block67: + v1117 = arith.constant 4 : u32; + v571 = hir.bitcast v553 : u32; + v573 = arith.add v571, v1117 : u32 #[overflow = checked]; + v1116 = arith.constant 4 : u32; + v575 = arith.mod v573, v1116 : u32; + hir.assertz v575 #[code = 250]; + v576 = hir.int_to_ptr v573 : ptr; + v577 = hir.load v576 : i32; + v579 = arith.constant 12 : u32; + v578 = hir.bitcast v553 : u32; + v580 = arith.add v578, v579 : u32 #[overflow = checked]; + v1115 = arith.constant 4 : u32; + v582 = arith.mod v580, v1115 : u32; + hir.assertz v582 #[code = 250]; + v583 = hir.int_to_ptr v580 : ptr; + v584 = hir.load v583 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/::deallocate(v577, v564, v584) scf.yield ; }; - v1238 = arith.constant 16 : i32; - v699 = arith.add v665, v1238 : i32 #[overflow = wrapping]; - v700 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v701 = hir.bitcast v700 : ptr; - hir.store v701, v699; + v1114 = arith.constant 16 : i32; + v587 = arith.add v553, v1114 : i32 #[overflow = wrapping]; + v588 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v589 = hir.bitcast v588 : ptr; + hir.store v589, v587; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v702: i32, v703: i32, v704: i32, v705: i32, v706: i32) { - ^block77(v702: i32, v703: i32, v704: i32, v705: i32, v706: i32): - v709 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v710 = hir.bitcast v709 : ptr; - v711 = hir.load v710 : i32; - v712 = arith.constant 16 : i32; - v713 = arith.sub v711, v712 : i32 #[overflow = wrapping]; - v714 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v715 = hir.bitcast v714 : ptr; - hir.store v715, v713; - v725 = hir.bitcast v703 : u32; - v726 = arith.zext v725 : u64; - v727 = hir.bitcast v726 : i64; - v707 = arith.constant 0 : i32; - v720 = arith.sub v707, v705 : i32 #[overflow = wrapping]; - v717 = arith.constant -1 : i32; - v716 = arith.add v705, v706 : i32 #[overflow = wrapping]; - v718 = arith.add v716, v717 : i32 #[overflow = wrapping]; - v721 = arith.band v718, v720 : i32; - v722 = hir.bitcast v721 : u32; - v723 = arith.zext v722 : u64; - v724 = hir.bitcast v723 : i64; - v728 = arith.mul v724, v727 : i64 #[overflow = wrapping]; - v1346 = arith.constant 0 : i32; - v729 = arith.constant 32 : i64; - v731 = hir.cast v729 : u32; - v730 = hir.bitcast v728 : u64; - v732 = arith.shr v730, v731 : u64; - v733 = hir.bitcast v732 : i64; - v734 = arith.trunc v733 : i32; - v736 = arith.neq v734, v1346 : i1; - v1258, v1259, v1260, v1261, v1262, v1263 = scf.if v736 : i32, i32, i32, i32, i32, u32 { - ^block155: - v1243 = arith.constant 0 : u32; - v1250 = ub.poison i32 : i32; - scf.yield v702, v713, v1250, v1250, v1250, v1243; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32) { + ^block68(v590: i32, v591: i32, v592: i32, v593: i32, v594: i32): + v597 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v598 = hir.bitcast v597 : ptr; + v599 = hir.load v598 : i32; + v600 = arith.constant 16 : i32; + v601 = arith.sub v599, v600 : i32 #[overflow = wrapping]; + v602 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v603 = hir.bitcast v602 : ptr; + hir.store v603, v601; + v613 = hir.bitcast v591 : u32; + v614 = arith.zext v613 : u64; + v615 = hir.bitcast v614 : i64; + v595 = arith.constant 0 : i32; + v608 = arith.sub v595, v593 : i32 #[overflow = wrapping]; + v605 = arith.constant -1 : i32; + v604 = arith.add v593, v594 : i32 #[overflow = wrapping]; + v606 = arith.add v604, v605 : i32 #[overflow = wrapping]; + v609 = arith.band v606, v608 : i32; + v610 = hir.bitcast v609 : u32; + v611 = arith.zext v610 : u64; + v612 = hir.bitcast v611 : i64; + v616 = arith.mul v612, v615 : i64 #[overflow = wrapping]; + v1222 = arith.constant 0 : i32; + v617 = arith.constant 32 : i64; + v619 = hir.cast v617 : u32; + v618 = hir.bitcast v616 : u64; + v620 = arith.shr v618, v619 : u64; + v621 = hir.bitcast v620 : i64; + v622 = arith.trunc v621 : i32; + v624 = arith.neq v622, v1222 : i1; + v1134, v1135, v1136, v1137, v1138, v1139 = scf.if v624 : i32, i32, i32, i32, i32, u32 { + ^block147: + v1119 = arith.constant 0 : u32; + v1126 = ub.poison i32 : i32; + scf.yield v590, v601, v1126, v1126, v1126, v1119; } else { - ^block82: - v737 = arith.trunc v728 : i32; - v1345 = arith.constant 0 : i32; - v738 = arith.constant -2147483648 : i32; - v739 = arith.sub v738, v705 : i32 #[overflow = wrapping]; - v741 = hir.bitcast v739 : u32; - v740 = hir.bitcast v737 : u32; - v742 = arith.lte v740, v741 : i1; - v743 = arith.zext v742 : u32; - v744 = hir.bitcast v743 : i32; - v746 = arith.neq v744, v1345 : i1; - v1306 = scf.if v746 : i32 { - ^block80: - v1344 = arith.constant 0 : i32; - v757 = arith.neq v737, v1344 : i1; - v1305 = scf.if v757 : i32 { - ^block84: - v1343 = arith.constant 0 : i32; - v773 = arith.neq v704, v1343 : i1; - v1304 = scf.if v773 : i32 { - ^block87: - v755 = arith.constant 1 : i32; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v713, v705, v737, v755) - v784 = hir.bitcast v713 : u32; - v829 = arith.constant 4 : u32; - v786 = arith.mod v784, v829 : u32; - hir.assertz v786 #[code = 250]; - v787 = hir.int_to_ptr v784 : ptr; - v788 = hir.load v787 : i32; - scf.yield v788; + ^block73: + v625 = arith.trunc v616 : i32; + v1221 = arith.constant 0 : i32; + v626 = arith.constant -2147483648 : i32; + v627 = arith.sub v626, v593 : i32 #[overflow = wrapping]; + v629 = hir.bitcast v627 : u32; + v628 = hir.bitcast v625 : u32; + v630 = arith.lte v628, v629 : i1; + v631 = arith.zext v630 : u32; + v632 = hir.bitcast v631 : i32; + v634 = arith.neq v632, v1221 : i1; + v1182 = scf.if v634 : i32 { + ^block71: + v1220 = arith.constant 0 : i32; + v645 = arith.neq v625, v1220 : i1; + v1181 = scf.if v645 : i32 { + ^block75: + v1219 = arith.constant 0 : i32; + v661 = arith.neq v592, v1219 : i1; + v1180 = scf.if v661 : i32 { + ^block78: + v643 = arith.constant 1 : i32; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v601, v593, v625, v643) + v672 = hir.bitcast v601 : u32; + v717 = arith.constant 4 : u32; + v674 = arith.mod v672, v717 : u32; + hir.assertz v674 #[code = 250]; + v675 = hir.int_to_ptr v672 : ptr; + v676 = hir.load v675 : i32; + scf.yield v676; } else { - ^block88: - v774 = arith.constant 8 : i32; - v775 = arith.add v713, v774 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v775, v705, v737) - v759 = arith.constant 8 : u32; - v776 = hir.bitcast v713 : u32; - v778 = arith.add v776, v759 : u32 #[overflow = checked]; - v1342 = arith.constant 4 : u32; - v780 = arith.mod v778, v1342 : u32; - hir.assertz v780 #[code = 250]; - v781 = hir.int_to_ptr v778 : ptr; - v782 = hir.load v781 : i32; - scf.yield v782; + ^block79: + v662 = arith.constant 8 : i32; + v663 = arith.add v601, v662 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/::allocate(v663, v593, v625) + v647 = arith.constant 8 : u32; + v664 = hir.bitcast v601 : u32; + v666 = arith.add v664, v647 : u32 #[overflow = checked]; + v1218 = arith.constant 4 : u32; + v668 = arith.mod v666, v1218 : u32; + hir.assertz v668 #[code = 250]; + v669 = hir.int_to_ptr v666 : ptr; + v670 = hir.load v669 : i32; + scf.yield v670; }; - v1340 = arith.constant 0 : i32; - v1341 = arith.constant 0 : i32; - v791 = arith.eq v1304, v1341 : i1; - v792 = arith.zext v791 : u32; - v793 = hir.bitcast v792 : i32; - v795 = arith.neq v793, v1340 : i1; - scf.if v795{ - ^block89: - v1339 = arith.constant 8 : u32; - v812 = hir.bitcast v702 : u32; - v814 = arith.add v812, v1339 : u32 #[overflow = checked]; - v1338 = arith.constant 4 : u32; - v816 = arith.mod v814, v1338 : u32; - hir.assertz v816 #[code = 250]; - v817 = hir.int_to_ptr v814 : ptr; - hir.store v817, v737; - v1337 = arith.constant 4 : u32; - v819 = hir.bitcast v702 : u32; - v821 = arith.add v819, v1337 : u32 #[overflow = checked]; - v1336 = arith.constant 4 : u32; - v823 = arith.mod v821, v1336 : u32; - hir.assertz v823 #[code = 250]; - v824 = hir.int_to_ptr v821 : ptr; - hir.store v824, v705; + v1216 = arith.constant 0 : i32; + v1217 = arith.constant 0 : i32; + v679 = arith.eq v1180, v1217 : i1; + v680 = arith.zext v679 : u32; + v681 = hir.bitcast v680 : i32; + v683 = arith.neq v681, v1216 : i1; + scf.if v683{ + ^block80: + v1215 = arith.constant 8 : u32; + v700 = hir.bitcast v590 : u32; + v702 = arith.add v700, v1215 : u32 #[overflow = checked]; + v1214 = arith.constant 4 : u32; + v704 = arith.mod v702, v1214 : u32; + hir.assertz v704 #[code = 250]; + v705 = hir.int_to_ptr v702 : ptr; + hir.store v705, v625; + v1213 = arith.constant 4 : u32; + v707 = hir.bitcast v590 : u32; + v709 = arith.add v707, v1213 : u32 #[overflow = checked]; + v1212 = arith.constant 4 : u32; + v711 = arith.mod v709, v1212 : u32; + hir.assertz v711 #[code = 250]; + v712 = hir.int_to_ptr v709 : ptr; + hir.store v712, v593; scf.yield ; } else { - ^block90: - v1335 = arith.constant 8 : u32; - v797 = hir.bitcast v702 : u32; - v799 = arith.add v797, v1335 : u32 #[overflow = checked]; - v1334 = arith.constant 4 : u32; - v801 = arith.mod v799, v1334 : u32; - hir.assertz v801 #[code = 250]; - v802 = hir.int_to_ptr v799 : ptr; - hir.store v802, v1304; - v1333 = arith.constant 4 : u32; - v804 = hir.bitcast v702 : u32; - v806 = arith.add v804, v1333 : u32 #[overflow = checked]; - v1332 = arith.constant 4 : u32; - v808 = arith.mod v806, v1332 : u32; - hir.assertz v808 #[code = 250]; - v809 = hir.int_to_ptr v806 : ptr; - hir.store v809, v703; + ^block81: + v1211 = arith.constant 8 : u32; + v685 = hir.bitcast v590 : u32; + v687 = arith.add v685, v1211 : u32 #[overflow = checked]; + v1210 = arith.constant 4 : u32; + v689 = arith.mod v687, v1210 : u32; + hir.assertz v689 #[code = 250]; + v690 = hir.int_to_ptr v687 : ptr; + hir.store v690, v1180; + v1209 = arith.constant 4 : u32; + v692 = hir.bitcast v590 : u32; + v694 = arith.add v692, v1209 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v696 = arith.mod v694, v1208 : u32; + hir.assertz v696 #[code = 250]; + v697 = hir.int_to_ptr v694 : ptr; + hir.store v697, v591; scf.yield ; }; - v1330 = arith.constant 0 : i32; - v1331 = arith.constant 1 : i32; - v1303 = cf.select v795, v1331, v1330 : i32; - scf.yield v1303; + v1206 = arith.constant 0 : i32; + v1207 = arith.constant 1 : i32; + v1179 = cf.select v683, v1207, v1206 : i32; + scf.yield v1179; } else { - ^block85: - v1329 = arith.constant 8 : u32; - v758 = hir.bitcast v702 : u32; - v760 = arith.add v758, v1329 : u32 #[overflow = checked]; - v1328 = arith.constant 4 : u32; - v762 = arith.mod v760, v1328 : u32; - hir.assertz v762 #[code = 250]; - v763 = hir.int_to_ptr v760 : ptr; - hir.store v763, v705; - v1327 = arith.constant 4 : u32; - v766 = hir.bitcast v702 : u32; - v768 = arith.add v766, v1327 : u32 #[overflow = checked]; - v1326 = arith.constant 4 : u32; - v770 = arith.mod v768, v1326 : u32; - hir.assertz v770 #[code = 250]; - v1325 = arith.constant 0 : i32; - v771 = hir.int_to_ptr v768 : ptr; - hir.store v771, v1325; - v1324 = arith.constant 0 : i32; - scf.yield v1324; + ^block76: + v1205 = arith.constant 8 : u32; + v646 = hir.bitcast v590 : u32; + v648 = arith.add v646, v1205 : u32 #[overflow = checked]; + v1204 = arith.constant 4 : u32; + v650 = arith.mod v648, v1204 : u32; + hir.assertz v650 #[code = 250]; + v651 = hir.int_to_ptr v648 : ptr; + hir.store v651, v593; + v1203 = arith.constant 4 : u32; + v654 = hir.bitcast v590 : u32; + v656 = arith.add v654, v1203 : u32 #[overflow = checked]; + v1202 = arith.constant 4 : u32; + v658 = arith.mod v656, v1202 : u32; + hir.assertz v658 #[code = 250]; + v1201 = arith.constant 0 : i32; + v659 = hir.int_to_ptr v656 : ptr; + hir.store v659, v1201; + v1200 = arith.constant 0 : i32; + scf.yield v1200; }; - scf.yield v1305; + scf.yield v1181; } else { - ^block83: - v1323 = ub.poison i32 : i32; - scf.yield v1323; + ^block74: + v1199 = ub.poison i32 : i32; + scf.yield v1199; }; - v1318 = arith.constant 0 : u32; - v1251 = arith.constant 1 : u32; - v1311 = cf.select v746, v1251, v1318 : u32; - v1319 = ub.poison i32 : i32; - v1310 = cf.select v746, v713, v1319 : i32; - v1320 = ub.poison i32 : i32; - v1309 = cf.select v746, v702, v1320 : i32; - v1321 = ub.poison i32 : i32; - v1308 = cf.select v746, v1321, v713 : i32; - v1322 = ub.poison i32 : i32; - v1307 = cf.select v746, v1322, v702 : i32; - scf.yield v1307, v1308, v1309, v1306, v1310, v1311; + v1194 = arith.constant 0 : u32; + v1127 = arith.constant 1 : u32; + v1187 = cf.select v634, v1127, v1194 : u32; + v1195 = ub.poison i32 : i32; + v1186 = cf.select v634, v601, v1195 : i32; + v1196 = ub.poison i32 : i32; + v1185 = cf.select v634, v590, v1196 : i32; + v1197 = ub.poison i32 : i32; + v1184 = cf.select v634, v1197, v601 : i32; + v1198 = ub.poison i32 : i32; + v1183 = cf.select v634, v1198, v590 : i32; + scf.yield v1183, v1184, v1185, v1182, v1186, v1187; }; - v1264, v1265, v1266 = scf.index_switch v1263 : i32, i32, i32 + v1140, v1141, v1142 = scf.index_switch v1139 : i32, i32, i32 case 0 { - ^block81: - v1317 = arith.constant 4 : u32; - v749 = hir.bitcast v1258 : u32; - v751 = arith.add v749, v1317 : u32 #[overflow = checked]; - v1316 = arith.constant 4 : u32; - v753 = arith.mod v751, v1316 : u32; - hir.assertz v753 #[code = 250]; - v1315 = arith.constant 0 : i32; - v754 = hir.int_to_ptr v751 : ptr; - hir.store v754, v1315; - v1314 = arith.constant 1 : i32; - scf.yield v1258, v1314, v1259; + ^block72: + v1193 = arith.constant 4 : u32; + v637 = hir.bitcast v1134 : u32; + v639 = arith.add v637, v1193 : u32 #[overflow = checked]; + v1192 = arith.constant 4 : u32; + v641 = arith.mod v639, v1192 : u32; + hir.assertz v641 #[code = 250]; + v1191 = arith.constant 0 : i32; + v642 = hir.int_to_ptr v639 : ptr; + hir.store v642, v1191; + v1190 = arith.constant 1 : i32; + scf.yield v1134, v1190, v1135; } default { - ^block159: - scf.yield v1260, v1261, v1262; + ^block151: + scf.yield v1136, v1137, v1138; }; - v828 = hir.bitcast v1264 : u32; - v1313 = arith.constant 4 : u32; - v830 = arith.mod v828, v1313 : u32; - hir.assertz v830 #[code = 250]; - v831 = hir.int_to_ptr v828 : ptr; - hir.store v831, v1265; - v1312 = arith.constant 16 : i32; - v836 = arith.add v1266, v1312 : i32 #[overflow = wrapping]; - v837 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v838 = hir.bitcast v837 : ptr; - hir.store v838, v836; + v716 = hir.bitcast v1140 : u32; + v1189 = arith.constant 4 : u32; + v718 = arith.mod v716, v1189 : u32; + hir.assertz v718 #[code = 250]; + v719 = hir.int_to_ptr v716 : ptr; + hir.store v719, v1141; + v1188 = arith.constant 16 : i32; + v724 = arith.add v1142, v1188 : i32 #[overflow = wrapping]; + v725 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v726 = hir.bitcast v725 : ptr; + hir.store v726, v724; builtin.ret ; }; - private builtin.function @::allocate(v839: i32, v840: i32, v841: i32) { - ^block91(v839: i32, v840: i32, v841: i32): - v843 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v844 = hir.bitcast v843 : ptr; - v845 = hir.load v844 : i32; - v846 = arith.constant 16 : i32; - v847 = arith.sub v845, v846 : i32 #[overflow = wrapping]; - v848 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v849 = hir.bitcast v848 : ptr; - hir.store v849, v847; - v842 = arith.constant 0 : i32; - v850 = arith.constant 8 : i32; - v851 = arith.add v847, v850 : i32 #[overflow = wrapping]; - hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v851, v840, v841, v842) - v854 = arith.constant 12 : u32; - v853 = hir.bitcast v847 : u32; - v855 = arith.add v853, v854 : u32 #[overflow = checked]; - v856 = arith.constant 4 : u32; - v857 = arith.mod v855, v856 : u32; - hir.assertz v857 #[code = 250]; - v858 = hir.int_to_ptr v855 : ptr; - v859 = hir.load v858 : i32; - v861 = arith.constant 8 : u32; - v860 = hir.bitcast v847 : u32; - v862 = arith.add v860, v861 : u32 #[overflow = checked]; - v1351 = arith.constant 4 : u32; - v864 = arith.mod v862, v1351 : u32; - hir.assertz v864 #[code = 250]; - v865 = hir.int_to_ptr v862 : ptr; - v866 = hir.load v865 : i32; - v867 = hir.bitcast v839 : u32; - v1350 = arith.constant 4 : u32; - v869 = arith.mod v867, v1350 : u32; - hir.assertz v869 #[code = 250]; - v870 = hir.int_to_ptr v867 : ptr; - hir.store v870, v866; - v1349 = arith.constant 4 : u32; - v871 = hir.bitcast v839 : u32; - v873 = arith.add v871, v1349 : u32 #[overflow = checked]; - v1348 = arith.constant 4 : u32; - v875 = arith.mod v873, v1348 : u32; - hir.assertz v875 #[code = 250]; - v876 = hir.int_to_ptr v873 : ptr; - hir.store v876, v859; - v1347 = arith.constant 16 : i32; - v878 = arith.add v847, v1347 : i32 #[overflow = wrapping]; - v879 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr - v880 = hir.bitcast v879 : ptr; - hir.store v880, v878; + private builtin.function @::allocate(v727: i32, v728: i32, v729: i32) { + ^block82(v727: i32, v728: i32, v729: i32): + v731 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v732 = hir.bitcast v731 : ptr; + v733 = hir.load v732 : i32; + v734 = arith.constant 16 : i32; + v735 = arith.sub v733, v734 : i32 #[overflow = wrapping]; + v736 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v737 = hir.bitcast v736 : ptr; + hir.store v737, v735; + v730 = arith.constant 0 : i32; + v738 = arith.constant 8 : i32; + v739 = arith.add v735, v738 : i32 #[overflow = wrapping]; + hir.exec @miden:base/note-script@1.0.0/p2id/alloc::alloc::Global::alloc_impl(v739, v728, v729, v730) + v742 = arith.constant 12 : u32; + v741 = hir.bitcast v735 : u32; + v743 = arith.add v741, v742 : u32 #[overflow = checked]; + v744 = arith.constant 4 : u32; + v745 = arith.mod v743, v744 : u32; + hir.assertz v745 #[code = 250]; + v746 = hir.int_to_ptr v743 : ptr; + v747 = hir.load v746 : i32; + v749 = arith.constant 8 : u32; + v748 = hir.bitcast v735 : u32; + v750 = arith.add v748, v749 : u32 #[overflow = checked]; + v1227 = arith.constant 4 : u32; + v752 = arith.mod v750, v1227 : u32; + hir.assertz v752 #[code = 250]; + v753 = hir.int_to_ptr v750 : ptr; + v754 = hir.load v753 : i32; + v755 = hir.bitcast v727 : u32; + v1226 = arith.constant 4 : u32; + v757 = arith.mod v755, v1226 : u32; + hir.assertz v757 #[code = 250]; + v758 = hir.int_to_ptr v755 : ptr; + hir.store v758, v754; + v1225 = arith.constant 4 : u32; + v759 = hir.bitcast v727 : u32; + v761 = arith.add v759, v1225 : u32 #[overflow = checked]; + v1224 = arith.constant 4 : u32; + v763 = arith.mod v761, v1224 : u32; + hir.assertz v763 #[code = 250]; + v764 = hir.int_to_ptr v761 : ptr; + hir.store v764, v747; + v1223 = arith.constant 16 : i32; + v766 = arith.add v735, v1223 : i32 #[overflow = wrapping]; + v767 = builtin.global_symbol @miden:base/note-script@1.0.0/p2id/__stack_pointer : ptr + v768 = hir.bitcast v767 : ptr; + hir.store v768, v766; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v881: i32, v882: i32, v883: i32, v884: i32) { - ^block93(v881: i32, v882: i32, v883: i32, v884: i32): - v1367 = arith.constant 0 : i32; - v885 = arith.constant 0 : i32; - v886 = arith.eq v883, v885 : i1; - v887 = arith.zext v886 : u32; - v888 = hir.bitcast v887 : i32; - v890 = arith.neq v888, v1367 : i1; - v1363 = scf.if v890 : i32 { - ^block162: - scf.yield v882; + private builtin.function @alloc::alloc::Global::alloc_impl(v769: i32, v770: i32, v771: i32, v772: i32) { + ^block84(v769: i32, v770: i32, v771: i32, v772: i32): + v1243 = arith.constant 0 : i32; + v773 = arith.constant 0 : i32; + v774 = arith.eq v771, v773 : i1; + v775 = arith.zext v774 : u32; + v776 = hir.bitcast v775 : i32; + v778 = arith.neq v776, v1243 : i1; + v1239 = scf.if v778 : i32 { + ^block154: + scf.yield v770; } else { - ^block96: + ^block87: hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1366 = arith.constant 0 : i32; - v892 = arith.neq v884, v1366 : i1; - v1362 = scf.if v892 : i32 { - ^block97: - v894 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v883, v882) : i32 - scf.yield v894; + v1242 = arith.constant 0 : i32; + v780 = arith.neq v772, v1242 : i1; + v1238 = scf.if v780 : i32 { + ^block88: + v782 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc_zeroed(v771, v770) : i32 + scf.yield v782; } else { - ^block98: - v893 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v883, v882) : i32 - scf.yield v893; + ^block89: + v781 = hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_alloc(v771, v770) : i32 + scf.yield v781; }; - scf.yield v1362; + scf.yield v1238; }; - v898 = arith.constant 4 : u32; - v897 = hir.bitcast v881 : u32; - v899 = arith.add v897, v898 : u32 #[overflow = checked]; - v1365 = arith.constant 4 : u32; - v901 = arith.mod v899, v1365 : u32; - hir.assertz v901 #[code = 250]; - v902 = hir.int_to_ptr v899 : ptr; - hir.store v902, v883; - v904 = hir.bitcast v881 : u32; - v1364 = arith.constant 4 : u32; - v906 = arith.mod v904, v1364 : u32; - hir.assertz v906 #[code = 250]; - v907 = hir.int_to_ptr v904 : ptr; - hir.store v907, v1363; + v786 = arith.constant 4 : u32; + v785 = hir.bitcast v769 : u32; + v787 = arith.add v785, v786 : u32 #[overflow = checked]; + v1241 = arith.constant 4 : u32; + v789 = arith.mod v787, v1241 : u32; + hir.assertz v789 #[code = 250]; + v790 = hir.int_to_ptr v787 : ptr; + hir.store v790, v771; + v792 = hir.bitcast v769 : u32; + v1240 = arith.constant 4 : u32; + v794 = arith.mod v792, v1240 : u32; + hir.assertz v794 #[code = 250]; + v795 = hir.int_to_ptr v792 : ptr; + hir.store v795, v1239; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v908: i32, v909: i32, v910: i32, v911: i32) { - ^block99(v908: i32, v909: i32, v910: i32, v911: i32): - v1393 = arith.constant 0 : i32; - v912 = arith.constant 0 : i32; - v916 = arith.eq v911, v912 : i1; - v917 = arith.zext v916 : u32; - v918 = hir.bitcast v917 : i32; - v920 = arith.neq v918, v1393 : i1; - v1380, v1381 = scf.if v920 : i32, i32 { - ^block166: - v1392 = arith.constant 0 : i32; - v914 = arith.constant 4 : i32; - scf.yield v914, v1392; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v796: i32, v797: i32, v798: i32, v799: i32) { + ^block90(v796: i32, v797: i32, v798: i32, v799: i32): + v1269 = arith.constant 0 : i32; + v800 = arith.constant 0 : i32; + v804 = arith.eq v799, v800 : i1; + v805 = arith.zext v804 : u32; + v806 = hir.bitcast v805 : i32; + v808 = arith.neq v806, v1269 : i1; + v1256, v1257 = scf.if v808 : i32, i32 { + ^block158: + v1268 = arith.constant 0 : i32; + v802 = arith.constant 4 : i32; + scf.yield v802, v1268; } else { - ^block102: - v921 = hir.bitcast v909 : u32; - v956 = arith.constant 4 : u32; - v923 = arith.mod v921, v956 : u32; - hir.assertz v923 #[code = 250]; - v924 = hir.int_to_ptr v921 : ptr; - v925 = hir.load v924 : i32; - v1390 = arith.constant 0 : i32; - v1391 = arith.constant 0 : i32; - v927 = arith.eq v925, v1391 : i1; - v928 = arith.zext v927 : u32; - v929 = hir.bitcast v928 : i32; - v931 = arith.neq v929, v1390 : i1; - v1378 = scf.if v931 : i32 { - ^block165: - v1389 = arith.constant 0 : i32; - scf.yield v1389; + ^block93: + v809 = hir.bitcast v797 : u32; + v844 = arith.constant 4 : u32; + v811 = arith.mod v809, v844 : u32; + hir.assertz v811 #[code = 250]; + v812 = hir.int_to_ptr v809 : ptr; + v813 = hir.load v812 : i32; + v1266 = arith.constant 0 : i32; + v1267 = arith.constant 0 : i32; + v815 = arith.eq v813, v1267 : i1; + v816 = arith.zext v815 : u32; + v817 = hir.bitcast v816 : i32; + v819 = arith.neq v817, v1266 : i1; + v1254 = scf.if v819 : i32 { + ^block157: + v1265 = arith.constant 0 : i32; + scf.yield v1265; } else { - ^block103: - v1388 = arith.constant 4 : u32; - v932 = hir.bitcast v908 : u32; - v934 = arith.add v932, v1388 : u32 #[overflow = checked]; - v1387 = arith.constant 4 : u32; - v936 = arith.mod v934, v1387 : u32; - hir.assertz v936 #[code = 250]; - v937 = hir.int_to_ptr v934 : ptr; - hir.store v937, v910; - v1386 = arith.constant 4 : u32; - v938 = hir.bitcast v909 : u32; - v940 = arith.add v938, v1386 : u32 #[overflow = checked]; - v1385 = arith.constant 4 : u32; - v942 = arith.mod v940, v1385 : u32; - hir.assertz v942 #[code = 250]; - v943 = hir.int_to_ptr v940 : ptr; - v944 = hir.load v943 : i32; - v945 = hir.bitcast v908 : u32; - v1384 = arith.constant 4 : u32; - v947 = arith.mod v945, v1384 : u32; - hir.assertz v947 #[code = 250]; - v948 = hir.int_to_ptr v945 : ptr; - hir.store v948, v944; - v949 = arith.mul v925, v911 : i32 #[overflow = wrapping]; - scf.yield v949; + ^block94: + v1264 = arith.constant 4 : u32; + v820 = hir.bitcast v796 : u32; + v822 = arith.add v820, v1264 : u32 #[overflow = checked]; + v1263 = arith.constant 4 : u32; + v824 = arith.mod v822, v1263 : u32; + hir.assertz v824 #[code = 250]; + v825 = hir.int_to_ptr v822 : ptr; + hir.store v825, v798; + v1262 = arith.constant 4 : u32; + v826 = hir.bitcast v797 : u32; + v828 = arith.add v826, v1262 : u32 #[overflow = checked]; + v1261 = arith.constant 4 : u32; + v830 = arith.mod v828, v1261 : u32; + hir.assertz v830 #[code = 250]; + v831 = hir.int_to_ptr v828 : ptr; + v832 = hir.load v831 : i32; + v833 = hir.bitcast v796 : u32; + v1260 = arith.constant 4 : u32; + v835 = arith.mod v833, v1260 : u32; + hir.assertz v835 #[code = 250]; + v836 = hir.int_to_ptr v833 : ptr; + hir.store v836, v832; + v837 = arith.mul v813, v799 : i32 #[overflow = wrapping]; + scf.yield v837; }; - v950 = arith.constant 8 : i32; - v1383 = arith.constant 4 : i32; - v1379 = cf.select v931, v1383, v950 : i32; - scf.yield v1379, v1378; + v838 = arith.constant 8 : i32; + v1259 = arith.constant 4 : i32; + v1255 = cf.select v819, v1259, v838 : i32; + scf.yield v1255, v1254; }; - v953 = arith.add v908, v1380 : i32 #[overflow = wrapping]; - v955 = hir.bitcast v953 : u32; - v1382 = arith.constant 4 : u32; - v957 = arith.mod v955, v1382 : u32; - hir.assertz v957 #[code = 250]; - v958 = hir.int_to_ptr v955 : ptr; - hir.store v958, v1381; + v841 = arith.add v796, v1256 : i32 #[overflow = wrapping]; + v843 = hir.bitcast v841 : u32; + v1258 = arith.constant 4 : u32; + v845 = arith.mod v843, v1258 : u32; + hir.assertz v845 #[code = 250]; + v846 = hir.int_to_ptr v843 : ptr; + hir.store v846, v1257; builtin.ret ; }; - private builtin.function @::deallocate(v959: i32, v960: i32, v961: i32) { - ^block104(v959: i32, v960: i32, v961: i32): - v1395 = arith.constant 0 : i32; - v962 = arith.constant 0 : i32; - v963 = arith.eq v961, v962 : i1; - v964 = arith.zext v963 : u32; - v965 = hir.bitcast v964 : i32; - v967 = arith.neq v965, v1395 : i1; - scf.if v967{ - ^block106: + private builtin.function @::deallocate(v847: i32, v848: i32, v849: i32) { + ^block95(v847: i32, v848: i32, v849: i32): + v1271 = arith.constant 0 : i32; + v850 = arith.constant 0 : i32; + v851 = arith.eq v849, v850 : i1; + v852 = arith.zext v851 : u32; + v853 = hir.bitcast v852 : i32; + v855 = arith.neq v853, v1271 : i1; + scf.if v855{ + ^block97: scf.yield ; } else { - ^block107: - hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v959, v961, v960) + ^block98: + hir.exec @miden:base/note-script@1.0.0/p2id/__rustc::__rust_dealloc(v847, v849, v848) scf.yield ; }; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v968: i32, v969: i32, v970: i32) { - ^block108(v968: i32, v969: i32, v970: i32): + private builtin.function @alloc::raw_vec::handle_error(v856: i32, v857: i32, v858: i32) { + ^block99(v856: i32, v857: i32, v858: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v971: i32, v972: i32) -> i32 { - ^block110(v971: i32, v972: i32): - v979 = arith.constant 0 : i32; - v975 = hir.bitcast v972 : u32; - v974 = hir.bitcast v971 : u32; - v976 = arith.gt v974, v975 : i1; - v977 = arith.zext v976 : u32; - v978 = hir.bitcast v977 : i32; - v980 = arith.neq v978, v979 : i1; - v981 = cf.select v980, v971, v972 : i32; - builtin.ret v981; + private builtin.function @core::ptr::alignment::Alignment::max(v859: i32, v860: i32) -> i32 { + ^block101(v859: i32, v860: i32): + v867 = arith.constant 0 : i32; + v863 = hir.bitcast v860 : u32; + v862 = hir.bitcast v859 : u32; + v864 = arith.gt v862, v863 : i1; + v865 = arith.zext v864 : u32; + v866 = hir.bitcast v865 : i32; + v868 = arith.neq v866, v867 : i1; + v869 = cf.select v868, v859, v860 : i32; + builtin.ret v869; }; - private builtin.function @miden::active_account::get_id(v982: i32) { - ^block112(v982: i32): - v983, v984 = hir.exec @miden/active_account/get_id() : felt, felt - v985 = hir.bitcast v982 : u32; - v986 = hir.int_to_ptr v985 : ptr; - hir.store v986, v983; - v987 = arith.constant 4 : u32; - v988 = arith.add v985, v987 : u32 #[overflow = checked]; - v989 = hir.int_to_ptr v988 : ptr; - hir.store v989, v984; + private builtin.function @miden::active_account::get_id(v870: i32) { + ^block103(v870: i32): + v871, v872 = hir.exec @miden/active_account/get_id() : felt, felt + v873 = hir.bitcast v870 : u32; + v874 = hir.int_to_ptr v873 : ptr; + hir.store v874, v871; + v875 = arith.constant 4 : u32; + v876 = arith.add v873, v875 : u32 #[overflow = checked]; + v877 = hir.int_to_ptr v876 : ptr; + hir.store v877, v872; builtin.ret ; }; - private builtin.function @miden::active_note::get_inputs(v990: i32) -> i32 { - ^block116(v990: i32): - v991, v992 = hir.exec @miden/active_note/get_inputs(v990) : i32, i32 - builtin.ret v991; + private builtin.function @miden::active_note::get_inputs(v878: i32) -> i32 { + ^block107(v878: i32): + v879, v880 = hir.exec @miden/active_note/get_inputs(v878) : i32, i32 + builtin.ret v879; }; - private builtin.function @miden::active_note::get_assets(v994: i32) -> i32 { - ^block119(v994: i32): - v995, v996 = hir.exec @miden/active_note/get_assets(v994) : i32, i32 - builtin.ret v995; + private builtin.function @miden::active_note::get_assets(v882: i32) -> i32 { + ^block110(v882: i32): + v883, v884 = hir.exec @miden/active_note/get_assets(v882) : i32, i32 + builtin.ret v883; }; builtin.global_variable private @#__stack_pointer : i32 { @@ -1414,9 +1283,9 @@ builtin.component miden:base/note-script@1.0.0 { builtin.segment @1048588 = 0x00000000000000000000000a00100000000000010000000100000001; }; - public builtin.function @run(v998: felt, v999: felt, v1000: felt, v1001: felt) { - ^block121(v998: felt, v999: felt, v1000: felt, v1001: felt): - hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v998, v999, v1000, v1001) + public builtin.function @run(v886: felt, v887: felt, v888: felt, v889: felt) { + ^block112(v886: felt, v887: felt, v888: felt, v889: felt): + hir.exec @miden:base/note-script@1.0.0/p2id/miden:base/note-script@1.0.0#run(v886, v887, v888, v889) 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 eaf8815f8..f690c0f7b 100644 --- a/tests/integration/expected/examples/p2id.masm +++ b/tests/integration/expected/examples/p2id.masm @@ -214,69 +214,8 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_inputs trace.252 nop - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop push.24 - dup.2 - add - u32assert - push.4 dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::>::from - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.2 add u32assert push.4 @@ -289,64 +228,119 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) swap.1 trace.240 nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_account::get_id - trace.252 - nop - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.2 - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq + exec.::intrinsics::mem::load_sw trace.252 nop - push.0 + dup.0 + push.2147483648 + u32lte + assert + dup.0 push.1 - movup.2 - neq - neq + u32lte if.true - drop - drop - drop - push.0 + eq.0 + if.true + drop + push.1 + else + drop + push.1 + end else + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_account::get_id + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.2 + swap.1 trace.240 nop exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq @@ -357,306 +351,323 @@ proc miden:base/note-script@1.0.0#run(felt, felt, felt, felt) movup.2 neq neq - dup.0 if.true - swap.1 drop + drop + drop + push.1 else - push.28 - dup.2 - u32wrapping_add - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_assets - trace.252 - nop - push.36 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.28 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::miden:base/note-script@1.0.0::p2id::intrinsics::felt::eq trace.252 nop - push.32 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - movup.3 - swap.1 - u32shl - dup.1 - swap.3 - swap.4 - swap.5 - swap.2 - swap.1 + push.0 push.1 - while.true - push.0 - push.0 + movup.2 + neq + neq + dup.0 + if.true + swap.1 + drop + else + push.28 dup.2 - eq - neq - dup.0 - if.true - movdn.2 - drop - drop - push.3735929054 - dup.0 - else + u32wrapping_add + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::miden_base_sys::bindings::active_note::get_assets + trace.252 + nop + push.36 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.28 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + movup.3 + swap.1 + u32shl + dup.1 + swap.3 + swap.4 + swap.5 + swap.2 + swap.1 + push.1 + while.true + push.0 + push.0 dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + eq + neq + dup.0 + if.true + movdn.2 + drop + drop + push.3735929054 + dup.0 + else + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movdn.3 + swap.2 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 + trace.252 + nop + push.16 + movup.3 + u32wrapping_add + push.4294967280 + movup.3 + u32wrapping_add + end + push.3735929054 + dup.3 + dup.7 + swap.2 swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 + cdrop + push.3735929054 dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + dup.7 + swap.2 swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 + cdrop + push.3735929054 dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.12 - dup.6 - add - u32assert - push.4 - dup.1 + dup.7 + swap.2 swap.1 - u32mod - u32assert - assertz - u32divmod.4 + cdrop + push.1 + push.0 + movup.7 + cdrop + push.1 + u32and swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movdn.3 + swap.3 + swap.5 swap.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 - trace.252 - nop - push.16 - movup.3 - u32wrapping_add - push.4294967280 - movup.3 - u32wrapping_add + swap.4 + swap.1 + if.true + movup.5 + drop + movup.5 + drop + movup.5 + drop + push.1 + else + push.0 + end end - push.3735929054 - dup.3 - dup.7 - swap.2 + drop + drop + drop + drop + drop + push.44 + dup.1 + add + u32assert + push.4 + dup.1 swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.2 + u32mod + u32assert + assertz + movup.2 swap.1 - cdrop - push.3735929054 - dup.5 - dup.7 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.40 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + push.40 + dup.2 + u32wrapping_add + dup.1 swap.2 swap.1 - cdrop - push.1 - push.0 - movup.7 - cdrop - push.1 - u32and - swap.1 - swap.3 - swap.5 + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.4 + push.16 + dup.2 + u32wrapping_add + dup.1 swap.2 - swap.4 swap.1 - if.true - movup.5 - drop - movup.5 - drop - movup.5 - drop - push.1 - else - push.0 - end + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.48 + u32wrapping_add + push.1114176 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end - drop - drop - drop - drop - drop - push.44 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.40 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz + push.0 + push.1 movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - push.40 - dup.2 - u32wrapping_add - dup.1 - swap.2 - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate - trace.252 - nop - push.4 - push.16 - dup.2 - u32wrapping_add - dup.1 - swap.2 - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::deallocate - trace.252 - nop - push.48 - u32wrapping_add - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop + cdrop end - push.1 - push.0 - movup.2 - cdrop end push.0 eq if.true + nop + else push.0 assert - else - nop end end @@ -1270,146 +1281,7 @@ proc miden_base_sys::bindings::active_account::get_id( swap.1 trace.240 nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - u32wrapping_add - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc miden_base_sys::bindings::active_note::get_inputs( - i32 -) - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114176 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - push.8 - dup.2 - u32wrapping_add - dup.1 - swap.2 - swap.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::with_capacity_in - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.1 - swap.1 - u32shr - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_inputs - trace.252 - nop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::store_dw trace.252 nop push.16 @@ -1425,7 +1297,7 @@ proc miden_base_sys::bindings::active_note::get_inputs( end @callconv("C") -proc miden_base_sys::bindings::active_note::get_assets( +proc miden_base_sys::bindings::active_note::get_inputs( i32 ) push.1114176 @@ -1449,11 +1321,15 @@ proc miden_base_sys::bindings::active_note::get_assets( trace.252 nop push.4 - dup.1 + push.8 + dup.2 u32wrapping_add + dup.1 + swap.2 + swap.1 trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::alloc::vec::Vec::with_capacity + exec.::miden:base/note-script@1.0.0::p2id::alloc::raw_vec::RawVecInner::with_capacity_in trace.252 nop push.8 @@ -1473,18 +1349,10 @@ proc miden_base_sys::bindings::active_note::get_assets( exec.::intrinsics::mem::load_sw trace.252 nop - push.2 - swap.1 - swap.1 - u32shr - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_assets - trace.252 - nop - push.8 - dup.3 - u32wrapping_add + push.12 + dup.2 + add + u32assert push.4 dup.1 swap.1 @@ -1495,11 +1363,20 @@ proc miden_base_sys::bindings::active_note::get_assets( swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 + push.2 dup.1 + swap.1 + u32shr + trace.240 + nop + exec.::miden:base/note-script@1.0.0::p2id::miden::active_note::get_inputs + trace.252 + nop + push.8 + dup.5 add u32assert push.4 @@ -1512,10 +1389,13 @@ proc miden_base_sys::bindings::active_note::get_assets( swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::store_sw trace.252 nop - movup.3 + push.4 + dup.4 + add + u32assert push.4 dup.1 swap.1 @@ -1526,42 +1406,10 @@ proc miden_base_sys::bindings::active_note::get_assets( swap.1 trace.240 nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - u32wrapping_add - push.1114176 - u32divmod.4 - swap.1 - trace.240 - nop exec.::intrinsics::mem::store_sw trace.252 nop -end - -@callconv("C") -proc ::from_felt_repr( - i32, - i32 -) - dup.1 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr - trace.252 - nop movup.2 - trace.240 - nop - exec.::miden:base/note-script@1.0.0::p2id::::from_felt_repr - trace.252 - nop - push.4 - dup.3 - add - u32assert push.4 dup.1 swap.1 @@ -1572,29 +1420,23 @@ proc >::from( - i32, - i32, +proc miden_base_sys::bindings::active_note::get_assets( i32 ) push.1114176 @@ -1605,7 +1447,7 @@ proc ::with_capacity trace.252 nop - push.24 + push.8 dup.1 add u32assert @@ -1646,64 +1477,26 @@ proc ::from_felt_repr - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.8 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.3 - push.8 + push.4 dup.1 swap.1 u32mod @@ -1713,26 +1506,10 @@ proc felt - push.8 + push.4 dup.1 add u32assert @@ -1746,13 +1523,10 @@ proc miden_felt_repr_onchain::FeltReader::read( swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::load_dw trace.252 nop - push.4 - dup.2 - add - u32assert + movup.3 push.4 dup.1 swap.1 @@ -1763,84 +1537,17 @@ proc miden_felt_repr_onchain::FeltReader::read( swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_dw trace.252 nop - push.0 - swap.1 - dup.2 + push.16 + u32wrapping_add + push.1114176 + u32divmod.4 swap.1 - u32gte - neq - if.true - drop - drop - push.0 - assert - else - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - movup.2 - swap.1 - u32shl - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - end -end - -@callconv("C") -proc ::from_felt_repr( - i32 -) -> felt trace.240 nop - exec.::miden:base/note-script@1.0.0::p2id::miden_felt_repr_onchain::FeltReader::read + exec.::intrinsics::mem::store_sw trace.252 nop end diff --git a/tests/integration/expected/examples/p2id.wat b/tests/integration/expected/examples/p2id.wat index 0dbae55a0..2b16cf8cd 100644 --- a/tests/integration/expected/examples/p2id.wat +++ b/tests/integration/expected/examples/p2id.wat @@ -29,12 +29,10 @@ (type (;4;) (func (param i32 i32 i32) (result i32))) (type (;5;) (func (result i32))) (type (;6;) (func (param i32))) - (type (;7;) (func (param i32 i32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param f32 f32) (result i32))) - (type (;10;) (func (param i32 i32 i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32))) - (type (;12;) (func (param i32) (result i32))) + (type (;7;) (func (param f32 f32) (result i32))) + (type (;8;) (func (param i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32 i32))) + (type (;10;) (func (param i32) (result i32))) (import "miden:basic-wallet/basic-wallet@0.1.0" "receive-asset" (func $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 (;0;) (type 0))) (table (;0;) 2 2 funcref) (memory (;0;) 17) @@ -76,7 +74,7 @@ ) (func $p2id::bindings::__link_custom_section_describing_imports (;5;) (type 1)) (func $miden:base/note-script@1.0.0#run (;6;) (type 0) (param f32 f32 f32 f32) - (local i32 f32 f32 f32 i32 i32 i32 i32) + (local i32 i32 f32 f32 f32 i32 i32 i32) global.get $__stack_pointer i32.const 48 i32.sub @@ -87,35 +85,36 @@ i32.const 16 i32.add call $miden_base_sys::bindings::active_note::get_inputs - local.get 4 - i32.const 8 - i32.add - local.get 4 - i32.load offset=20 - local.get 4 - i32.load offset=24 - call $>::from - local.get 4 - f32.load offset=12 - local.set 5 - local.get 4 - f32.load offset=8 - local.set 6 - local.get 4 - call $miden_base_sys::bindings::active_account::get_id - local.get 4 - f32.load offset=4 - local.set 7 block ;; label = @1 + block ;; label = @2 + local.get 4 + i32.load offset=24 + br_table 1 (;@1;) 1 (;@1;) 0 (;@2;) + end local.get 4 + i32.load offset=20 + local.tee 5 + f32.load offset=4 + local.set 6 + local.get 5 f32.load - local.get 6 + local.set 7 + local.get 4 + i32.const 8 + i32.add + call $miden_base_sys::bindings::active_account::get_id + local.get 4 + f32.load offset=12 + local.set 8 + local.get 4 + f32.load offset=8 + local.get 7 call $intrinsics::felt::eq i32.const 1 i32.ne br_if 0 (;@1;) - local.get 7 - local.get 5 + local.get 8 + local.get 6 call $intrinsics::felt::eq i32.const 1 i32.ne @@ -128,44 +127,44 @@ i32.load offset=36 i32.const 4 i32.shl - local.set 8 + local.set 9 local.get 4 i32.load offset=28 - local.set 9 + local.set 10 local.get 4 i32.load offset=32 - local.tee 10 - local.set 11 + local.tee 11 + local.set 5 block ;; label = @2 loop ;; label = @3 - local.get 8 + local.get 9 i32.eqz br_if 1 (;@2;) - local.get 11 + local.get 5 f32.load - local.get 11 + local.get 5 f32.load offset=4 - local.get 11 + local.get 5 f32.load offset=8 - local.get 11 + local.get 5 f32.load offset=12 call $p2id::bindings::miden::basic_wallet::basic_wallet::receive_asset::wit_import7 - local.get 8 + local.get 9 i32.const -16 i32.add - local.set 8 - local.get 11 + local.set 9 + local.get 5 i32.const 16 i32.add - local.set 11 + local.set 5 br 0 (;@3;) end end local.get 4 - local.get 10 + local.get 11 i32.store offset=44 local.get 4 - local.get 9 + local.get 10 i32.store offset=40 local.get 4 i32.const 40 @@ -441,85 +440,10 @@ i32.add global.set $__stack_pointer ) - (func $::from_felt_repr (;16;) (type 7) (param i32 i32) - (local f32) - local.get 1 - call $::from_felt_repr - local.set 2 - local.get 0 - local.get 1 - call $::from_felt_repr - f32.store offset=4 - local.get 0 - local.get 2 - f32.store - ) - (func $>::from (;17;) (type 3) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 0 - i32.store offset=28 - local.get 3 - local.get 2 - i32.store offset=24 - local.get 3 - local.get 1 - i32.store offset=20 - local.get 3 - i32.const 8 - i32.add - local.get 3 - i32.const 20 - i32.add - call $::from_felt_repr - local.get 0 - local.get 3 - i64.load offset=8 - i64.store - local.get 3 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $miden_felt_repr_onchain::FeltReader::read (;18;) (type 8) (param i32) (result f32) - (local i32) - block ;; label = @1 - local.get 0 - i32.load offset=8 - local.tee 1 - local.get 0 - i32.load offset=4 - i32.ge_u - br_if 0 (;@1;) - local.get 0 - local.get 1 - i32.const 1 - i32.add - i32.store offset=8 - local.get 0 - i32.load - local.get 1 - i32.const 2 - i32.shl - i32.add - f32.load - return - end - unreachable - ) - (func $::from_felt_repr (;19;) (type 8) (param i32) (result f32) - local.get 0 - call $miden_felt_repr_onchain::FeltReader::read - ) - (func $intrinsics::felt::eq (;20;) (type 9) (param f32 f32) (result i32) + (func $intrinsics::felt::eq (;16;) (type 7) (param f32 f32) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::deallocate (;21;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::deallocate (;17;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -551,7 +475,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;22;) (type 10) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;18;) (type 8) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -663,7 +587,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;23;) (type 3) (param i32 i32 i32) + (func $::allocate (;19;) (type 3) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -692,7 +616,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;24;) (type 11) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;20;) (type 9) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -719,7 +643,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;25;) (type 11) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;21;) (type 9) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -754,7 +678,7 @@ local.get 4 i32.store ) - (func $::deallocate (;26;) (type 3) (param i32 i32 i32) + (func $::deallocate (;22;) (type 3) (param i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -765,10 +689,10 @@ call $__rustc::__rust_dealloc end ) - (func $alloc::raw_vec::handle_error (;27;) (type 3) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;23;) (type 3) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;28;) (type 2) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;24;) (type 2) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 @@ -776,13 +700,13 @@ i32.gt_u select ) - (func $miden::active_account::get_id (;29;) (type 6) (param i32) + (func $miden::active_account::get_id (;25;) (type 6) (param i32) unreachable ) - (func $miden::active_note::get_inputs (;30;) (type 12) (param i32) (result i32) + (func $miden::active_note::get_inputs (;26;) (type 10) (param i32) (result i32) unreachable ) - (func $miden::active_note::get_assets (;31;) (type 12) (param i32) (result i32) + (func $miden::active_note::get_assets (;27;) (type 10) (param i32) (result i32) unreachable ) (data $.rodata (;0;) (i32.const 1048576) "\00") From 66a2ddb1ddbe5bb5b33eefe887271a1df870ad38 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 8 Dec 2025 14:10:53 +0200 Subject: [PATCH 06/15] refactor(test): make super roundtrip test onchain code receive array and return Vec --- felt-repr/tests/src/lib.rs | 1 + felt-repr/tests/src/onchain.rs | 37 +++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/felt-repr/tests/src/lib.rs b/felt-repr/tests/src/lib.rs index 5064d0c60..f605a7be6 100644 --- a/felt-repr/tests/src/lib.rs +++ b/felt-repr/tests/src/lib.rs @@ -112,6 +112,7 @@ extern crate miden_stdlib_sys; use miden_stdlib_sys::{{*, intrinsics}}; extern crate alloc; +use alloc::vec::Vec; #[no_mangle] #[allow(improper_ctypes_definitions)] diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index 65429aafd..e102272f0 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -86,7 +86,7 @@ fn from_to_felt_repr() { }; let serialized = original.to_felt_repr(); - let onchain_code = r#"(input: Word) -> Word { + let onchain_code = r#"(input: [Felt; 2]) -> Vec { use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; #[derive(FromFeltRepr, ToFeltRepr)] @@ -95,14 +95,10 @@ fn from_to_felt_repr() { b: Felt, } - let input_arr: [Felt; 4] = input.into(); - - let mut reader = FeltReader::new(&input_arr); + let mut reader = FeltReader::new(&input); let deserialized = OnchainTwoFelts::from_felt_repr(&mut reader); - let re_serialized = deserialized.to_felt_repr(); - - Word::from([re_serialized[0], re_serialized[1], felt!(0), felt!(0)]) + deserialized.to_felt_repr() }"#; let config = WasmTranslationConfig::default(); @@ -114,21 +110,38 @@ fn from_to_felt_repr() { let in_byte_addr = in_elem_addr * 4; let out_byte_addr = out_elem_addr * 4; - let input_word: Vec = vec![serialized[0], serialized[1], Felt::ZERO, Felt::ZERO]; + let input_felts: Vec = vec![serialized[0], serialized[1]]; let initializers = [Initializer::MemoryFelts { addr: in_elem_addr, - felts: Cow::from(input_word), + felts: Cow::from(input_felts), }]; let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { - let result_word: [TestFelt; 4] = trace + // Vec is returned as (ptr, len, capacity) via C ABI + // First read the Vec metadata from output address + let vec_metadata: [TestFelt; 4] = trace .read_from_rust_memory(out_byte_addr) - .expect("Failed to read result from memory"); + .expect("Failed to read Vec metadata from memory"); - let result_felts = [result_word[0].0, result_word[1].0]; + // The Word is stored in reverse order when read as [TestFelt; 4]: + // Word[0] -> TestFelt[3] = pointer + // Word[1] -> TestFelt[2] = length + // Word[2] -> TestFelt[1] = (unused) + // Word[3] -> TestFelt[0] = capacity + let data_ptr = vec_metadata[3].0.as_int() as u32; + let len = vec_metadata[2].0.as_int() as usize; + + assert_eq!(len, 2, "Expected Vec with 2 felts"); + + // Read the actual data from the Vec's data pointer + let result_data: [TestFelt; 4] = trace + .read_from_rust_memory(data_ptr) + .expect("Failed to read Vec data from memory"); + + let result_felts = [result_data[0].0, result_data[1].0]; let mut reader = FeltReader::new(&result_felts); let result_struct = TwoFelts::from_felt_repr(&mut reader); From 45e57afed675bf056e5a3d548d0e6ba447745ba1 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 8 Dec 2025 16:23:46 +0200 Subject: [PATCH 07/15] chore: add test for 5-felt struct triggering a spill issue --- Cargo.lock | 1 + felt-repr/offchain/src/lib.rs | 36 + felt-repr/onchain/src/lib.rs | 42 + felt-repr/tests/Cargo.toml | 1 + .../expected/onchain_four_felts_struct.hir | 1515 ++++++++ .../expected/onchain_four_felts_struct.masm | 3049 +++++++++++++++++ .../expected/onchain_four_felts_struct.wat | 861 +++++ .../expected/onchain_two_felts_struct.hir | 1311 +++++++ .../expected/onchain_two_felts_struct.masm | 2561 ++++++++++++++ .../expected/onchain_two_felts_struct.wat | 761 ++++ felt-repr/tests/src/onchain.rs | 77 +- 11 files changed, 10211 insertions(+), 4 deletions(-) create mode 100644 felt-repr/tests/expected/onchain_four_felts_struct.hir create mode 100644 felt-repr/tests/expected/onchain_four_felts_struct.masm create mode 100644 felt-repr/tests/expected/onchain_four_felts_struct.wat create mode 100644 felt-repr/tests/expected/onchain_two_felts_struct.hir create mode 100644 felt-repr/tests/expected/onchain_two_felts_struct.masm create mode 100644 felt-repr/tests/expected/onchain_two_felts_struct.wat diff --git a/Cargo.lock b/Cargo.lock index 583fb410e..b3969136d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2489,6 +2489,7 @@ dependencies = [ "miden-integration-tests", "miden-lib", "miden-processor", + "midenc-expect-test", "midenc-frontend-wasm", "midenc-session", ] diff --git a/felt-repr/offchain/src/lib.rs b/felt-repr/offchain/src/lib.rs index 6639cf26d..0ae66ea1d 100644 --- a/felt-repr/offchain/src/lib.rs +++ b/felt-repr/offchain/src/lib.rs @@ -48,6 +48,24 @@ impl FromFeltRepr for Felt { } } +impl FromFeltRepr for u64 { + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_int() + } +} + +impl FromFeltRepr for u32 { + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_int() as u32 + } +} + +impl FromFeltRepr for u8 { + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_int() as u8 + } +} + /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { /// Serializes this value into a vector of `Felt` elements. @@ -60,3 +78,21 @@ impl ToFeltRepr for Felt { vec![*self] } } + +impl ToFeltRepr for u64 { + fn to_felt_repr(&self) -> Vec { + vec![Felt::new(*self)] + } +} + +impl ToFeltRepr for u32 { + fn to_felt_repr(&self) -> Vec { + vec![Felt::new(*self as u64)] + } +} + +impl ToFeltRepr for u8 { + fn to_felt_repr(&self) -> Vec { + vec![Felt::new(*self as u64)] + } +} diff --git a/felt-repr/onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs index f0908c12b..93d906b99 100644 --- a/felt-repr/onchain/src/lib.rs +++ b/felt-repr/onchain/src/lib.rs @@ -48,6 +48,27 @@ impl FromFeltRepr for Felt { } } +impl FromFeltRepr for u64 { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() + } +} + +impl FromFeltRepr for u32 { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() as u32 + } +} + +impl FromFeltRepr for u8 { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() as u8 + } +} + /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { /// Serializes this value into a vector of `Felt` elements. @@ -61,3 +82,24 @@ impl ToFeltRepr for Felt { vec![*self] } } + +impl ToFeltRepr for u64 { + #[inline(always)] + fn to_felt_repr(&self) -> Vec { + vec![Felt::from_u64_unchecked(*self)] + } +} + +impl ToFeltRepr for u32 { + #[inline(always)] + fn to_felt_repr(&self) -> Vec { + vec![Felt::from(*self)] + } +} + +impl ToFeltRepr for u8 { + #[inline(always)] + fn to_felt_repr(&self) -> Vec { + vec![Felt::from(*self as u32)] + } +} diff --git a/felt-repr/tests/Cargo.toml b/felt-repr/tests/Cargo.toml index 062c6de9f..0eaa0c5b5 100644 --- a/felt-repr/tests/Cargo.toml +++ b/felt-repr/tests/Cargo.toml @@ -20,6 +20,7 @@ miden-core.workspace = true miden-integration-tests = { path = "../../tests/integration" } midenc-frontend-wasm.workspace = true midenc-session.workspace = true +midenc-expect-test.workspace = true miden-debug.workspace = true miden-lib.workspace = true miden-processor.workspace = true diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.hir b/felt-repr/tests/expected/onchain_four_felts_struct.hir new file mode 100644 index 000000000..b7aeb3e71 --- /dev/null +++ b/felt-repr/tests/expected/onchain_four_felts_struct.hir @@ -0,0 +1,1515 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @onchain_four_felts_struct { + private builtin.function @core::ptr::drop_in_place>(v0: i32) { + ^block4(v0: i32): + v2 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__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/onchain_four_felts_struct/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + v9 = hir.bitcast v0 : u32; + v10 = arith.constant 4 : u32; + v11 = arith.mod v9, v10 : u32; + hir.assertz v11 #[code = 250]; + v12 = hir.int_to_ptr v9 : ptr; + v13 = hir.load v12 : i32; + v15 = arith.constant 12 : u32; + v14 = hir.bitcast v6 : u32; + v16 = arith.add v14, v15 : u32 #[overflow = checked]; + v1079 = arith.constant 4 : u32; + v18 = arith.mod v16, v1079 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + hir.store v19, v13; + v21 = arith.constant 8 : u32; + v20 = hir.bitcast v0 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v1078 = arith.constant 4 : u32; + v24 = arith.mod v22, v1078 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + v26 = hir.load v25 : i32; + v1077 = arith.constant 8 : u32; + v27 = hir.bitcast v6 : u32; + v29 = arith.add v27, v1077 : u32 #[overflow = checked]; + v1076 = arith.constant 4 : u32; + v31 = arith.mod v29, v1076 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v26; + v35 = arith.constant 4 : i32; + v33 = arith.constant 8 : i32; + v34 = arith.add v6, v33 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::deallocate(v34, v35, v35) + v1075 = arith.constant 16 : i32; + v38 = arith.add v6, v1075 : i32 #[overflow = wrapping]; + v39 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v40 = hir.bitcast v39 : ptr; + hir.store v40, v38; + builtin.ret ; + }; + + private builtin.function @alloc::vec::Vec::push(v41: i32, v42: felt) { + ^block6(v41: i32, v42: felt): + v45 = arith.constant 8 : u32; + v44 = hir.bitcast v41 : u32; + v46 = arith.add v44, v45 : u32 #[overflow = checked]; + v47 = arith.constant 4 : u32; + v48 = arith.mod v46, v47 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i32; + v51 = hir.bitcast v41 : u32; + v1090 = arith.constant 4 : u32; + v53 = arith.mod v51, v1090 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i32; + v43 = arith.constant 0 : i32; + v56 = arith.neq v50, v55 : i1; + v57 = arith.zext v56 : u32; + v58 = hir.bitcast v57 : i32; + v60 = arith.neq v58, v43 : i1; + scf.if v60{ + ^block112: + scf.yield ; + } else { + ^block9: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVec::grow_one(v41) + scf.yield ; + }; + v1089 = arith.constant 4 : u32; + v62 = hir.bitcast v41 : u32; + v64 = arith.add v62, v1089 : u32 #[overflow = checked]; + v1088 = arith.constant 4 : u32; + v66 = arith.mod v64, v1088 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : i32; + v1080 = arith.constant 2 : u32; + v72 = arith.shl v50, v1080 : i32; + v73 = arith.add v68, v72 : i32 #[overflow = wrapping]; + v75 = hir.bitcast v73 : u32; + v1087 = arith.constant 4 : u32; + v77 = arith.mod v75, v1087 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + hir.store v78, v42; + v1086 = arith.constant 8 : u32; + v81 = hir.bitcast v41 : u32; + v83 = arith.add v81, v1086 : u32 #[overflow = checked]; + v1085 = arith.constant 4 : u32; + v85 = arith.mod v83, v1085 : u32; + hir.assertz v85 #[code = 250]; + v79 = arith.constant 1 : i32; + v80 = arith.add v50, v79 : i32 #[overflow = wrapping]; + v86 = hir.int_to_ptr v83 : ptr; + hir.store v86, v80; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVec::grow_one(v87: i32) { + ^block10(v87: i32): + v89 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v90 = hir.bitcast v89 : ptr; + v91 = hir.load v90 : i32; + v92 = arith.constant 16 : i32; + v93 = arith.sub v91, v92 : i32 #[overflow = wrapping]; + v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + hir.store v95, v93; + v98 = hir.bitcast v87 : u32; + v99 = arith.constant 4 : u32; + v100 = arith.mod v98, v99 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + v102 = hir.load v101 : i32; + v104 = arith.constant 4 : i32; + v103 = arith.constant 1 : i32; + v96 = arith.constant 8 : i32; + v97 = arith.add v93, v96 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v97, v87, v102, v103, v104, v104) + v107 = arith.constant 8 : u32; + v106 = hir.bitcast v93 : u32; + v108 = arith.add v106, v107 : u32 #[overflow = checked]; + v1094 = arith.constant 4 : u32; + v110 = arith.mod v108, v1094 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : i32; + v88 = arith.constant 0 : i32; + v113 = arith.constant -2147483647 : i32; + v114 = arith.eq v112, v113 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v88 : i1; + cf.cond_br v118 ^block12, ^block13; + ^block12: + v1093 = arith.constant 16 : i32; + v128 = arith.add v93, v1093 : i32 #[overflow = wrapping]; + v129 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v130 = hir.bitcast v129 : ptr; + hir.store v130, v128; + builtin.ret ; + ^block13: + v120 = arith.constant 12 : u32; + v119 = hir.bitcast v93 : u32; + v121 = arith.add v119, v120 : u32 #[overflow = checked]; + v1092 = arith.constant 4 : u32; + v123 = arith.mod v121, v1092 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i32; + v126 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::handle_error(v112, v125, v126) + ub.unreachable ; + }; + + private builtin.function @alloc::alloc::exchange_malloc() -> i32 { + ^block14: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v133 = arith.constant 4 : i32; + v135 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc(v133, v133) : i32 + v132 = arith.constant 0 : i32; + v137 = arith.neq v135, v132 : i1; + cf.cond_br v137 ^block16, ^block17; + ^block16: + builtin.ret v135; + ^block17: + v1097 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::handle_alloc_error(v1097, v1097) + ub.unreachable ; + }; + + private builtin.function @__rustc::__rust_alloc(v140: i32, v141: i32) -> i32 { + ^block18(v140: i32, v141: i32): + v143 = arith.constant 1048604 : i32; + v144 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v143, v141, v140) : i32 + builtin.ret v144; + }; + + public builtin.function @entrypoint(v145: i32, v146: i32) { + ^block20(v145: i32, v146: i32): + v150 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v151 = hir.bitcast v150 : ptr; + v152 = hir.load v151 : i32; + v153 = arith.constant 32 : i32; + v154 = arith.sub v152, v153 : i32 #[overflow = wrapping]; + v155 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v156 = hir.bitcast v155 : ptr; + hir.store v156, v154; + v158 = arith.constant 12 : u32; + v157 = hir.bitcast v146 : u32; + v159 = arith.add v157, v158 : u32 #[overflow = checked]; + v160 = arith.constant 4 : u32; + v161 = arith.mod v159, v160 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : felt; + v165 = arith.constant 8 : u32; + v164 = hir.bitcast v146 : u32; + v166 = arith.add v164, v165 : u32 #[overflow = checked]; + v1622 = arith.constant 4 : u32; + v168 = arith.mod v166, v1622 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + v170 = hir.load v169 : felt; + v1621 = arith.constant 4 : u32; + v171 = hir.bitcast v146 : u32; + v173 = arith.add v171, v1621 : u32 #[overflow = checked]; + v1620 = arith.constant 4 : u32; + v175 = arith.mod v173, v1620 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : felt; + v178 = hir.bitcast v146 : u32; + v1619 = arith.constant 4 : u32; + v180 = arith.mod v178, v1619 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + v182 = hir.load v181 : felt; + v1618 = arith.constant 12 : u32; + v185 = hir.bitcast v154 : u32; + v187 = arith.add v185, v1618 : u32 #[overflow = checked]; + v1617 = arith.constant 4 : u32; + v189 = arith.mod v187, v1617 : u32; + hir.assertz v189 #[code = 250]; + v147 = arith.constant 0 : i32; + v190 = hir.int_to_ptr v187 : ptr; + hir.store v190, v147; + v1616 = arith.constant 4 : u32; + v192 = hir.bitcast v154 : u32; + v194 = arith.add v192, v1616 : u32 #[overflow = checked]; + v1615 = arith.constant 4 : u32; + v196 = arith.mod v194, v1615 : u32; + hir.assertz v196 #[code = 250]; + v191 = arith.constant 17179869184 : i64; + v197 = hir.int_to_ptr v194 : ptr; + hir.store v197, v191; + v198 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 + v199 = hir.bitcast v198 : u32; + v1614 = arith.constant 4 : u32; + v201 = arith.mod v199, v1614 : u32; + hir.assertz v201 #[code = 250]; + v202 = hir.int_to_ptr v199 : ptr; + hir.store v202, v182; + v206 = arith.constant 28 : u32; + v205 = hir.bitcast v154 : u32; + v207 = arith.add v205, v206 : u32 #[overflow = checked]; + v1613 = arith.constant 4 : u32; + v209 = arith.mod v207, v1613 : u32; + hir.assertz v209 #[code = 250]; + v203 = arith.constant 4 : i32; + v204 = arith.add v198, v203 : i32 #[overflow = wrapping]; + v210 = hir.int_to_ptr v207 : ptr; + hir.store v210, v204; + v213 = arith.constant 24 : u32; + v212 = hir.bitcast v154 : u32; + v214 = arith.add v212, v213 : u32 #[overflow = checked]; + v1612 = arith.constant 4 : u32; + v216 = arith.mod v214, v1612 : u32; + hir.assertz v216 #[code = 250]; + v211 = arith.constant 1 : i32; + v217 = hir.int_to_ptr v214 : ptr; + hir.store v217, v211; + v219 = arith.constant 16 : u32; + v218 = hir.bitcast v154 : u32; + v220 = arith.add v218, v219 : u32 #[overflow = checked]; + v1611 = arith.constant 4 : u32; + v222 = arith.mod v220, v1611 : u32; + hir.assertz v222 #[code = 250]; + v223 = hir.int_to_ptr v220 : ptr; + hir.store v223, v198; + v1610 = arith.constant 0 : i32; + v1483, v1484, v1485, v1486, v1487, v1488, v1489, v1490, v1491, v1492, v1493, v1494, v1495 = scf.while v198, v1610, v154, v177, v170, v163, v145 : i32, i32, i32, felt, felt, felt, i32, i32, felt, felt, felt, i32, i32 { + ^block149(v1496: i32, v1497: i32, v1498: i32, v1499: felt, v1500: felt, v1501: felt, v1502: i32): + v226 = arith.add v1496, v1497 : i32 #[overflow = wrapping]; + v1608 = arith.constant 0 : i32; + v1609 = arith.constant 4 : i32; + v228 = arith.eq v1497, v1609 : i1; + v229 = arith.zext v228 : u32; + v230 = hir.bitcast v229 : i32; + v232 = arith.neq v230, v1608 : i1; + v1474 = scf.if v232 : i32 { + ^block139: + v1106 = ub.poison i32 : i32; + scf.yield v1106; + } else { + ^block25: + v236 = hir.bitcast v226 : u32; + v1607 = arith.constant 4 : u32; + v238 = arith.mod v236, v1607 : u32; + hir.assertz v238 #[code = 250]; + v239 = hir.int_to_ptr v236 : ptr; + v240 = hir.load v239 : felt; + v1606 = arith.constant 4 : i32; + v235 = arith.add v1498, v1606 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v235, v240) + v1605 = arith.constant 4 : i32; + v242 = arith.add v1497, v1605 : i32 #[overflow = wrapping]; + scf.yield v242; + }; + v1600 = ub.poison i32 : i32; + v1480 = cf.select v232, v1600, v1502 : i32; + v1601 = ub.poison felt : felt; + v1479 = cf.select v232, v1601, v1501 : felt; + v1602 = ub.poison felt : felt; + v1478 = cf.select v232, v1602, v1500 : felt; + v1153 = ub.poison felt : felt; + v1477 = cf.select v232, v1153, v1499 : felt; + v1603 = ub.poison i32 : i32; + v1476 = cf.select v232, v1603, v1498 : i32; + v1604 = ub.poison i32 : i32; + v1475 = cf.select v232, v1604, v1496 : i32; + v1105 = arith.constant 1 : u32; + v1098 = arith.constant 0 : u32; + v1482 = cf.select v232, v1098, v1105 : u32; + v1353 = arith.trunc v1482 : i1; + scf.condition v1353, v1475, v1474, v1476, v1477, v1478, v1479, v1480, v1498, v1499, v1500, v1501, v1502, v226; + } do { + ^block150(v1503: i32, v1504: i32, v1505: i32, v1506: felt, v1507: felt, v1508: felt, v1509: i32, v1510: i32, v1511: felt, v1512: felt, v1513: felt, v1514: i32, v1515: i32): + scf.yield v1503, v1504, v1505, v1506, v1507, v1508, v1509; + }; + v244 = arith.constant 20 : u32; + v243 = hir.bitcast v1490 : u32; + v245 = arith.add v243, v244 : u32 #[overflow = checked]; + v1599 = arith.constant 4 : u32; + v247 = arith.mod v245, v1599 : u32; + hir.assertz v247 #[code = 250]; + v248 = hir.int_to_ptr v245 : ptr; + hir.store v248, v1495; + v249 = arith.constant 16 : i32; + v250 = arith.add v1490, v249 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v250) + v251 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 + v253 = hir.bitcast v251 : u32; + v1598 = arith.constant 4 : u32; + v255 = arith.mod v253, v1598 : u32; + hir.assertz v255 #[code = 250]; + v256 = hir.int_to_ptr v253 : ptr; + hir.store v256, v1491; + v1597 = arith.constant 28 : u32; + v259 = hir.bitcast v1490 : u32; + v261 = arith.add v259, v1597 : u32 #[overflow = checked]; + v1596 = arith.constant 4 : u32; + v263 = arith.mod v261, v1596 : u32; + hir.assertz v263 #[code = 250]; + v1595 = arith.constant 4 : i32; + v258 = arith.add v251, v1595 : i32 #[overflow = wrapping]; + v264 = hir.int_to_ptr v261 : ptr; + hir.store v264, v258; + v1594 = arith.constant 24 : u32; + v266 = hir.bitcast v1490 : u32; + v268 = arith.add v266, v1594 : u32 #[overflow = checked]; + v1593 = arith.constant 4 : u32; + v270 = arith.mod v268, v1593 : u32; + hir.assertz v270 #[code = 250]; + v1592 = arith.constant 1 : i32; + v271 = hir.int_to_ptr v268 : ptr; + hir.store v271, v1592; + v1591 = arith.constant 16 : u32; + v272 = hir.bitcast v1490 : u32; + v274 = arith.add v272, v1591 : u32 #[overflow = checked]; + v1590 = arith.constant 4 : u32; + v276 = arith.mod v274, v1590 : u32; + hir.assertz v276 #[code = 250]; + v277 = hir.int_to_ptr v274 : ptr; + hir.store v277, v251; + v1589 = arith.constant 0 : i32; + v1446, v1447, v1448, v1449, v1450, v1451, v1452, v1453, v1454, v1455, v1456 = scf.while v251, v1589, v1490, v1492, v1493, v1494 : i32, i32, i32, felt, felt, i32, i32, felt, felt, i32, i32 { + ^block147(v1457: i32, v1458: i32, v1459: i32, v1460: felt, v1461: felt, v1462: i32): + v281 = arith.add v1457, v1458 : i32 #[overflow = wrapping]; + v1587 = arith.constant 0 : i32; + v1588 = arith.constant 4 : i32; + v283 = arith.eq v1458, v1588 : i1; + v284 = arith.zext v283 : u32; + v285 = hir.bitcast v284 : i32; + v287 = arith.neq v285, v1587 : i1; + v1438 = scf.if v287 : i32 { + ^block140: + v1586 = ub.poison i32 : i32; + scf.yield v1586; + } else { + ^block29: + v291 = hir.bitcast v281 : u32; + v1585 = arith.constant 4 : u32; + v293 = arith.mod v291, v1585 : u32; + hir.assertz v293 #[code = 250]; + v294 = hir.int_to_ptr v291 : ptr; + v295 = hir.load v294 : felt; + v1584 = arith.constant 4 : i32; + v290 = arith.add v1459, v1584 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v290, v295) + v1583 = arith.constant 4 : i32; + v297 = arith.add v1458, v1583 : i32 #[overflow = wrapping]; + scf.yield v297; + }; + v1576 = ub.poison i32 : i32; + v1443 = cf.select v287, v1576, v1462 : i32; + v1577 = ub.poison felt : felt; + v1442 = cf.select v287, v1577, v1461 : felt; + v1578 = ub.poison felt : felt; + v1441 = cf.select v287, v1578, v1460 : felt; + v1579 = ub.poison i32 : i32; + v1440 = cf.select v287, v1579, v1459 : i32; + v1580 = ub.poison i32 : i32; + v1439 = cf.select v287, v1580, v1457 : i32; + v1581 = arith.constant 1 : u32; + v1582 = arith.constant 0 : u32; + v1445 = cf.select v287, v1582, v1581 : u32; + v1272 = arith.trunc v1445 : i1; + scf.condition v1272, v1439, v1438, v1440, v1441, v1442, v1443, v1459, v1460, v1461, v1462, v281; + } do { + ^block148(v1463: i32, v1464: i32, v1465: i32, v1466: felt, v1467: felt, v1468: i32, v1469: i32, v1470: felt, v1471: felt, v1472: i32, v1473: i32): + scf.yield v1463, v1464, v1465, v1466, v1467, v1468; + }; + v1575 = arith.constant 20 : u32; + v298 = hir.bitcast v1452 : u32; + v300 = arith.add v298, v1575 : u32 #[overflow = checked]; + v1574 = arith.constant 4 : u32; + v302 = arith.mod v300, v1574 : u32; + hir.assertz v302 #[code = 250]; + v303 = hir.int_to_ptr v300 : ptr; + hir.store v303, v1456; + v1573 = arith.constant 16 : i32; + v305 = arith.add v1452, v1573 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v305) + v306 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 + v309 = hir.bitcast v306 : u32; + v1572 = arith.constant 4 : u32; + v311 = arith.mod v309, v1572 : u32; + hir.assertz v311 #[code = 250]; + v312 = hir.int_to_ptr v309 : ptr; + hir.store v312, v1453; + v1571 = arith.constant 28 : u32; + v315 = hir.bitcast v1452 : u32; + v317 = arith.add v315, v1571 : u32 #[overflow = checked]; + v1570 = arith.constant 4 : u32; + v319 = arith.mod v317, v1570 : u32; + hir.assertz v319 #[code = 250]; + v1569 = arith.constant 4 : i32; + v314 = arith.add v306, v1569 : i32 #[overflow = wrapping]; + v320 = hir.int_to_ptr v317 : ptr; + hir.store v320, v314; + v1568 = arith.constant 24 : u32; + v322 = hir.bitcast v1452 : u32; + v324 = arith.add v322, v1568 : u32 #[overflow = checked]; + v1567 = arith.constant 4 : u32; + v326 = arith.mod v324, v1567 : u32; + hir.assertz v326 #[code = 250]; + v1566 = arith.constant 1 : i32; + v327 = hir.int_to_ptr v324 : ptr; + hir.store v327, v1566; + v1565 = arith.constant 16 : u32; + v328 = hir.bitcast v1452 : u32; + v330 = arith.add v328, v1565 : u32 #[overflow = checked]; + v1564 = arith.constant 4 : u32; + v332 = arith.mod v330, v1564 : u32; + hir.assertz v332 #[code = 250]; + v333 = hir.int_to_ptr v330 : ptr; + hir.store v333, v306; + v1563 = arith.constant 0 : i32; + v1415, v1416, v1417, v1418, v1419, v1420, v1421, v1422, v1423 = scf.while v306, v1563, v1452, v1454, v1455 : i32, i32, i32, felt, i32, i32, felt, i32, i32 { + ^block145(v1424: i32, v1425: i32, v1426: i32, v1427: felt, v1428: i32): + v337 = arith.add v1424, v1425 : i32 #[overflow = wrapping]; + v1561 = arith.constant 0 : i32; + v1562 = arith.constant 4 : i32; + v339 = arith.eq v1425, v1562 : i1; + v340 = arith.zext v339 : u32; + v341 = hir.bitcast v340 : i32; + v343 = arith.neq v341, v1561 : i1; + v1408 = scf.if v343 : i32 { + ^block141: + v1560 = ub.poison i32 : i32; + scf.yield v1560; + } else { + ^block33: + v347 = hir.bitcast v337 : u32; + v1559 = arith.constant 4 : u32; + v349 = arith.mod v347, v1559 : u32; + hir.assertz v349 #[code = 250]; + v350 = hir.int_to_ptr v347 : ptr; + v351 = hir.load v350 : felt; + v1558 = arith.constant 4 : i32; + v346 = arith.add v1426, v1558 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v346, v351) + v1557 = arith.constant 4 : i32; + v353 = arith.add v1425, v1557 : i32 #[overflow = wrapping]; + scf.yield v353; + }; + v1551 = ub.poison i32 : i32; + v1412 = cf.select v343, v1551, v1428 : i32; + v1552 = ub.poison felt : felt; + v1411 = cf.select v343, v1552, v1427 : felt; + v1553 = ub.poison i32 : i32; + v1410 = cf.select v343, v1553, v1426 : i32; + v1554 = ub.poison i32 : i32; + v1409 = cf.select v343, v1554, v1424 : i32; + v1555 = arith.constant 1 : u32; + v1556 = arith.constant 0 : u32; + v1414 = cf.select v343, v1556, v1555 : u32; + v1203 = arith.trunc v1414 : i1; + scf.condition v1203, v1409, v1408, v1410, v1411, v1412, v1426, v1427, v1428, v337; + } do { + ^block146(v1429: i32, v1430: i32, v1431: i32, v1432: felt, v1433: i32, v1434: i32, v1435: felt, v1436: i32, v1437: i32): + scf.yield v1429, v1430, v1431, v1432, v1433; + }; + v1550 = arith.constant 20 : u32; + v354 = hir.bitcast v1420 : u32; + v356 = arith.add v354, v1550 : u32 #[overflow = checked]; + v1549 = arith.constant 4 : u32; + v358 = arith.mod v356, v1549 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + hir.store v359, v1423; + v1548 = arith.constant 16 : i32; + v361 = arith.add v1420, v1548 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v361) + v362 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 + v366 = hir.bitcast v362 : u32; + v1547 = arith.constant 4 : u32; + v368 = arith.mod v366, v1547 : u32; + hir.assertz v368 #[code = 250]; + v369 = hir.int_to_ptr v366 : ptr; + hir.store v369, v1421; + v1546 = arith.constant 28 : u32; + v372 = hir.bitcast v1420 : u32; + v374 = arith.add v372, v1546 : u32 #[overflow = checked]; + v1545 = arith.constant 4 : u32; + v376 = arith.mod v374, v1545 : u32; + hir.assertz v376 #[code = 250]; + v1544 = arith.constant 4 : i32; + v371 = arith.add v362, v1544 : i32 #[overflow = wrapping]; + v377 = hir.int_to_ptr v374 : ptr; + hir.store v377, v371; + v1543 = arith.constant 24 : u32; + v379 = hir.bitcast v1420 : u32; + v381 = arith.add v379, v1543 : u32 #[overflow = checked]; + v1542 = arith.constant 4 : u32; + v383 = arith.mod v381, v1542 : u32; + hir.assertz v383 #[code = 250]; + v1541 = arith.constant 1 : i32; + v384 = hir.int_to_ptr v381 : ptr; + hir.store v384, v1541; + v1540 = arith.constant 16 : u32; + v385 = hir.bitcast v1420 : u32; + v387 = arith.add v385, v1540 : u32 #[overflow = checked]; + v1539 = arith.constant 4 : u32; + v389 = arith.mod v387, v1539 : u32; + hir.assertz v389 #[code = 250]; + v390 = hir.int_to_ptr v387 : ptr; + hir.store v390, v362; + v1538 = arith.constant 0 : i32; + v1390, v1391, v1392, v1393, v1394, v1395, v1396 = scf.while v362, v1538, v1420, v1422 : i32, i32, i32, i32, i32, i32, i32 { + ^block143(v1397: i32, v1398: i32, v1399: i32, v1400: i32): + v394 = arith.add v1397, v1398 : i32 #[overflow = wrapping]; + v1536 = arith.constant 0 : i32; + v1537 = arith.constant 4 : i32; + v396 = arith.eq v1398, v1537 : i1; + v397 = arith.zext v396 : u32; + v398 = hir.bitcast v397 : i32; + v400 = arith.neq v398, v1536 : i1; + v1384 = scf.if v400 : i32 { + ^block142: + v1535 = ub.poison i32 : i32; + scf.yield v1535; + } else { + ^block37: + v404 = hir.bitcast v394 : u32; + v1534 = arith.constant 4 : u32; + v406 = arith.mod v404, v1534 : u32; + hir.assertz v406 #[code = 250]; + v407 = hir.int_to_ptr v404 : ptr; + v408 = hir.load v407 : felt; + v1533 = arith.constant 4 : i32; + v403 = arith.add v1399, v1533 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v403, v408) + v1532 = arith.constant 4 : i32; + v410 = arith.add v1398, v1532 : i32 #[overflow = wrapping]; + scf.yield v410; + }; + v1527 = ub.poison i32 : i32; + v1387 = cf.select v400, v1527, v1400 : i32; + v1528 = ub.poison i32 : i32; + v1386 = cf.select v400, v1528, v1399 : i32; + v1529 = ub.poison i32 : i32; + v1385 = cf.select v400, v1529, v1397 : i32; + v1530 = arith.constant 1 : u32; + v1531 = arith.constant 0 : u32; + v1389 = cf.select v400, v1531, v1530 : u32; + v1145 = arith.trunc v1389 : i1; + scf.condition v1145, v1385, v1384, v1386, v1387, v1399, v1400, v394; + } do { + ^block144(v1401: i32, v1402: i32, v1403: i32, v1404: i32, v1405: i32, v1406: i32, v1407: i32): + scf.yield v1401, v1402, v1403, v1404; + }; + v1526 = arith.constant 20 : u32; + v411 = hir.bitcast v1394 : u32; + v413 = arith.add v411, v1526 : u32 #[overflow = checked]; + v1525 = arith.constant 4 : u32; + v415 = arith.mod v413, v1525 : u32; + hir.assertz v415 #[code = 250]; + v416 = hir.int_to_ptr v413 : ptr; + hir.store v416, v1396; + v1524 = arith.constant 16 : i32; + v418 = arith.add v1394, v1524 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v418) + v423 = arith.constant 8 : i32; + v1523 = arith.constant 4 : i32; + v426 = arith.add v1394, v1523 : i32 #[overflow = wrapping]; + v428 = arith.add v426, v423 : i32 #[overflow = wrapping]; + v429 = hir.bitcast v428 : u32; + v1522 = arith.constant 4 : u32; + v431 = arith.mod v429, v1522 : u32; + hir.assertz v431 #[code = 250]; + v432 = hir.int_to_ptr v429 : ptr; + v433 = hir.load v432 : i32; + v1521 = arith.constant 8 : i32; + v424 = arith.add v1395, v1521 : i32 #[overflow = wrapping]; + v434 = hir.bitcast v424 : u32; + v1520 = arith.constant 4 : u32; + v436 = arith.mod v434, v1520 : u32; + hir.assertz v436 #[code = 250]; + v437 = hir.int_to_ptr v434 : ptr; + hir.store v437, v433; + v1519 = arith.constant 4 : u32; + v438 = hir.bitcast v1394 : u32; + v440 = arith.add v438, v1519 : u32 #[overflow = checked]; + v1518 = arith.constant 4 : u32; + v442 = arith.mod v440, v1518 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + v444 = hir.load v443 : i64; + v445 = hir.bitcast v1395 : u32; + v1517 = arith.constant 4 : u32; + v447 = arith.mod v445, v1517 : u32; + hir.assertz v447 #[code = 250]; + v448 = hir.int_to_ptr v445 : ptr; + hir.store v448, v444; + v1516 = arith.constant 32 : i32; + v450 = arith.add v1394, v1516 : i32 #[overflow = wrapping]; + v451 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v452 = hir.bitcast v451 : ptr; + hir.store v452, v450; + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_dealloc(v453: i32, v454: i32, v455: i32) { + ^block38(v453: i32, v454: i32, v455: i32): + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_realloc(v456: i32, v457: i32, v458: i32, v459: i32) -> i32 { + ^block40(v456: i32, v457: i32, v458: i32, v459: i32): + v461 = arith.constant 1048604 : i32; + v462 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v461, v458, v459) : i32 + v1631 = arith.constant 0 : i32; + v463 = arith.constant 0 : i32; + v464 = arith.eq v462, v463 : i1; + v465 = arith.zext v464 : u32; + v466 = hir.bitcast v465 : i32; + v468 = arith.neq v466, v1631 : i1; + scf.if v468{ + ^block42: + scf.yield ; + } else { + ^block43: + v1630 = arith.constant 0 : i32; + v470 = hir.bitcast v457 : u32; + v469 = hir.bitcast v459 : u32; + v471 = arith.lt v469, v470 : i1; + v472 = arith.zext v471 : u32; + v473 = hir.bitcast v472 : i32; + v475 = arith.neq v473, v1630 : i1; + v476 = cf.select v475, v459, v457 : i32; + v1628 = arith.constant 0 : i32; + v1629 = arith.constant 0 : i32; + v478 = arith.eq v476, v1629 : i1; + v479 = arith.zext v478 : u32; + v480 = hir.bitcast v479 : i32; + v482 = arith.neq v480, v1628 : i1; + scf.if v482{ + ^block151: + scf.yield ; + } else { + ^block44: + v483 = hir.bitcast v476 : u32; + v484 = hir.bitcast v462 : u32; + v485 = hir.int_to_ptr v484 : ptr; + v486 = hir.bitcast v456 : u32; + v487 = hir.int_to_ptr v486 : ptr; + hir.mem_cpy v487, v485, v483; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v462; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v489: i32, v490: i32) -> i32 { + ^block45(v489: i32, v490: i32): + v492 = arith.constant 1048604 : i32; + v493 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v492, v490, v489) : i32 + v1640 = arith.constant 0 : i32; + v494 = arith.constant 0 : i32; + v495 = arith.eq v493, v494 : i1; + v496 = arith.zext v495 : u32; + v497 = hir.bitcast v496 : i32; + v499 = arith.neq v497, v1640 : i1; + scf.if v499{ + ^block47: + scf.yield ; + } else { + ^block48: + v1638 = arith.constant 0 : i32; + v1639 = arith.constant 0 : i32; + v501 = arith.eq v489, v1639 : i1; + v502 = arith.zext v501 : u32; + v503 = hir.bitcast v502 : i32; + v505 = arith.neq v503, v1638 : i1; + scf.if v505{ + ^block154: + scf.yield ; + } else { + ^block49: + v1632 = arith.constant 0 : u8; + v508 = hir.bitcast v489 : u32; + v509 = hir.bitcast v493 : u32; + v510 = hir.int_to_ptr v509 : ptr; + hir.mem_set v510, v508, v1632; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v493; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block50: + builtin.ret ; + }; + + private builtin.function @::alloc(v512: i32, v513: i32, v514: i32) -> i32 { + ^block52(v512: i32, v513: i32, v514: i32): + v517 = arith.constant 16 : i32; + v516 = arith.constant 0 : i32; + v1642 = arith.constant 16 : u32; + v519 = hir.bitcast v513 : u32; + v521 = arith.gt v519, v1642 : i1; + v522 = arith.zext v521 : u32; + v523 = hir.bitcast v522 : i32; + v525 = arith.neq v523, v516 : i1; + v526 = cf.select v525, v513, v517 : i32; + v1682 = arith.constant 0 : i32; + v527 = arith.constant -1 : i32; + v528 = arith.add v526, v527 : i32 #[overflow = wrapping]; + v529 = arith.band v526, v528 : i32; + v531 = arith.neq v529, v1682 : i1; + v1651, v1652 = scf.if v531 : i32, u32 { + ^block159: + v1643 = arith.constant 0 : u32; + v1647 = ub.poison i32 : i32; + scf.yield v1647, v1643; + } else { + ^block55: + v533 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::alignment::Alignment::max(v513, v526) : i32 + v1681 = arith.constant 0 : i32; + v532 = arith.constant -2147483648 : i32; + v534 = arith.sub v532, v533 : i32 #[overflow = wrapping]; + v536 = hir.bitcast v534 : u32; + v535 = hir.bitcast v514 : u32; + v537 = arith.gt v535, v536 : i1; + v538 = arith.zext v537 : u32; + v539 = hir.bitcast v538 : i32; + v541 = arith.neq v539, v1681 : i1; + v1666 = scf.if v541 : i32 { + ^block158: + v1680 = ub.poison i32 : i32; + scf.yield v1680; + } else { + ^block56: + v1678 = arith.constant 0 : i32; + v547 = arith.sub v1678, v533 : i32 #[overflow = wrapping]; + v1679 = arith.constant -1 : i32; + v543 = arith.add v514, v533 : i32 #[overflow = wrapping]; + v545 = arith.add v543, v1679 : i32 #[overflow = wrapping]; + v548 = arith.band v545, v547 : i32; + v549 = hir.bitcast v512 : u32; + v550 = arith.constant 4 : u32; + v551 = arith.mod v549, v550 : u32; + hir.assertz v551 #[code = 250]; + v552 = hir.int_to_ptr v549 : ptr; + v553 = hir.load v552 : i32; + v1677 = arith.constant 0 : i32; + v555 = arith.neq v553, v1677 : i1; + scf.if v555{ + ^block157: + scf.yield ; + } else { + ^block58: + v556 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/intrinsics::mem::heap_base() : i32 + v557 = hir.mem_size : u32; + v563 = hir.bitcast v512 : u32; + v1676 = arith.constant 4 : u32; + v565 = arith.mod v563, v1676 : u32; + hir.assertz v565 #[code = 250]; + v1675 = arith.constant 16 : u32; + v558 = hir.bitcast v557 : i32; + v561 = arith.shl v558, v1675 : i32; + v562 = arith.add v556, v561 : i32 #[overflow = wrapping]; + v566 = hir.int_to_ptr v563 : ptr; + hir.store v566, v562; + scf.yield ; + }; + v569 = hir.bitcast v512 : u32; + v1674 = arith.constant 4 : u32; + v571 = arith.mod v569, v1674 : u32; + hir.assertz v571 #[code = 250]; + v572 = hir.int_to_ptr v569 : ptr; + v573 = hir.load v572 : i32; + v1672 = arith.constant 0 : i32; + v1673 = arith.constant -1 : i32; + v575 = arith.bxor v573, v1673 : i32; + v577 = hir.bitcast v575 : u32; + v576 = hir.bitcast v548 : u32; + v578 = arith.gt v576, v577 : i1; + v579 = arith.zext v578 : u32; + v580 = hir.bitcast v579 : i32; + v582 = arith.neq v580, v1672 : i1; + v1665 = scf.if v582 : i32 { + ^block59: + v1671 = arith.constant 0 : i32; + scf.yield v1671; + } else { + ^block60: + v584 = hir.bitcast v512 : u32; + v1670 = arith.constant 4 : u32; + v586 = arith.mod v584, v1670 : u32; + hir.assertz v586 #[code = 250]; + v583 = arith.add v573, v548 : i32 #[overflow = wrapping]; + v587 = hir.int_to_ptr v584 : ptr; + hir.store v587, v583; + v589 = arith.add v573, v533 : i32 #[overflow = wrapping]; + scf.yield v589; + }; + scf.yield v1665; + }; + v1648 = arith.constant 1 : u32; + v1669 = arith.constant 0 : u32; + v1667 = cf.select v541, v1669, v1648 : u32; + scf.yield v1666, v1667; + }; + v1668 = arith.constant 0 : u32; + v1664 = arith.eq v1652, v1668 : i1; + cf.cond_br v1664 ^block54, ^block161(v1651); + ^block54: + ub.unreachable ; + ^block161(v1644: i32): + builtin.ret v1644; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block61: + v592 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v592; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v594: i32, v595: i32, v596: i32, v597: i32, v598: i32, v599: i32) { + ^block65(v594: i32, v595: i32, v596: i32, v597: i32, v598: i32, v599: i32): + v602 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v603 = hir.bitcast v602 : ptr; + v604 = hir.load v603 : i32; + v605 = arith.constant 32 : i32; + v606 = arith.sub v604, v605 : i32 #[overflow = wrapping]; + v607 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v608 = hir.bitcast v607 : ptr; + hir.store v608, v606; + v1759 = arith.constant 0 : i32; + v600 = arith.constant 0 : i32; + v611 = arith.eq v599, v600 : i1; + v612 = arith.zext v611 : u32; + v613 = hir.bitcast v612 : i32; + v615 = arith.neq v613, v1759 : i1; + v1730, v1731 = scf.if v615 : i32, i32 { + ^block68: + v1758 = arith.constant 0 : i32; + scf.yield v1758, v1758; + } else { + ^block69: + v616 = arith.add v596, v597 : i32 #[overflow = wrapping]; + v1757 = arith.constant 0 : i32; + v618 = hir.bitcast v596 : u32; + v617 = hir.bitcast v616 : u32; + v619 = arith.lt v617, v618 : i1; + v620 = arith.zext v619 : u32; + v621 = hir.bitcast v620 : i32; + v623 = arith.neq v621, v1757 : i1; + v1728, v1729 = scf.if v623 : i32, i32 { + ^block167: + v1756 = arith.constant 0 : i32; + scf.yield v1756, v1756; + } else { + ^block70: + v634 = hir.bitcast v595 : u32; + v748 = arith.constant 4 : u32; + v636 = arith.mod v634, v748 : u32; + hir.assertz v636 #[code = 250]; + v637 = hir.int_to_ptr v634 : ptr; + v638 = hir.load v637 : i32; + v1684 = arith.constant 1 : u32; + v641 = arith.shl v638, v1684 : i32; + v1755 = arith.constant 0 : i32; + v643 = hir.bitcast v641 : u32; + v642 = hir.bitcast v616 : u32; + v644 = arith.gt v642, v643 : i1; + v645 = arith.zext v644 : u32; + v646 = hir.bitcast v645 : i32; + v648 = arith.neq v646, v1755 : i1; + v649 = cf.select v648, v616, v641 : i32; + v1752 = arith.constant 1 : i32; + v651 = arith.constant 4 : i32; + v1753 = arith.constant 0 : i32; + v1683 = arith.constant 1025 : u32; + v654 = hir.bitcast v599 : u32; + v656 = arith.lt v654, v1683 : i1; + v657 = arith.zext v656 : u32; + v658 = hir.bitcast v657 : i32; + v660 = arith.neq v658, v1753 : i1; + v661 = cf.select v660, v651, v1752 : i32; + v650 = arith.constant 8 : i32; + v1754 = arith.constant 0 : i32; + v639 = arith.constant 1 : i32; + v663 = arith.eq v599, v639 : i1; + v664 = arith.zext v663 : u32; + v665 = hir.bitcast v664 : i32; + v667 = arith.neq v665, v1754 : i1; + v668 = cf.select v667, v650, v661 : i32; + v1751 = arith.constant 0 : i32; + v670 = hir.bitcast v668 : u32; + v669 = hir.bitcast v649 : u32; + v671 = arith.gt v669, v670 : i1; + v672 = arith.zext v671 : u32; + v673 = hir.bitcast v672 : i32; + v675 = arith.neq v673, v1751 : i1; + v676 = cf.select v675, v649, v668 : i32; + v677 = hir.bitcast v676 : u32; + v678 = arith.zext v677 : u64; + v679 = hir.bitcast v678 : i64; + v1750 = arith.constant 0 : i32; + v629 = arith.sub v1750, v598 : i32 #[overflow = wrapping]; + v626 = arith.constant -1 : i32; + v625 = arith.add v598, v599 : i32 #[overflow = wrapping]; + v627 = arith.add v625, v626 : i32 #[overflow = wrapping]; + v630 = arith.band v627, v629 : i32; + v631 = hir.bitcast v630 : u32; + v632 = arith.zext v631 : u64; + v633 = hir.bitcast v632 : i64; + v680 = arith.mul v633, v679 : i64 #[overflow = wrapping]; + v1749 = arith.constant 0 : i32; + v681 = arith.constant 32 : i64; + v683 = hir.cast v681 : u32; + v682 = hir.bitcast v680 : u64; + v684 = arith.shr v682, v683 : u64; + v685 = hir.bitcast v684 : i64; + v686 = arith.trunc v685 : i32; + v688 = arith.neq v686, v1749 : i1; + v1726, v1727 = scf.if v688 : i32, i32 { + ^block166: + v1748 = arith.constant 0 : i32; + scf.yield v649, v1748; + } else { + ^block71: + v689 = arith.trunc v680 : i32; + v1747 = arith.constant 0 : i32; + v690 = arith.constant -2147483648 : i32; + v691 = arith.sub v690, v598 : i32 #[overflow = wrapping]; + v693 = hir.bitcast v691 : u32; + v692 = hir.bitcast v689 : u32; + v694 = arith.gt v692, v693 : i1; + v695 = arith.zext v694 : u32; + v696 = hir.bitcast v695 : i32; + v698 = arith.neq v696, v1747 : i1; + v1724, v1725 = scf.if v698 : i32, i32 { + ^block165: + v1746 = arith.constant 0 : i32; + scf.yield v649, v1746; + } else { + ^block72: + v699 = arith.constant 20 : i32; + v700 = arith.add v606, v699 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v700, v595, v598, v599) + v1744 = arith.constant 20 : i32; + v704 = arith.add v606, v1744 : i32 #[overflow = wrapping]; + v1745 = arith.constant 8 : i32; + v702 = arith.add v606, v1745 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::finish_grow(v702, v598, v689, v704, v594) + v706 = arith.constant 12 : u32; + v705 = hir.bitcast v606 : u32; + v707 = arith.add v705, v706 : u32 #[overflow = checked]; + v1743 = arith.constant 4 : u32; + v709 = arith.mod v707, v1743 : u32; + hir.assertz v709 #[code = 250]; + v710 = hir.int_to_ptr v707 : ptr; + v711 = hir.load v710 : i32; + v713 = arith.constant 8 : u32; + v712 = hir.bitcast v606 : u32; + v714 = arith.add v712, v713 : u32 #[overflow = checked]; + v1742 = arith.constant 4 : u32; + v716 = arith.mod v714, v1742 : u32; + hir.assertz v716 #[code = 250]; + v717 = hir.int_to_ptr v714 : ptr; + v718 = hir.load v717 : i32; + v1740 = arith.constant 0 : i32; + v1741 = arith.constant 0 : i32; + v720 = arith.eq v718, v1741 : i1; + v721 = arith.zext v720 : u32; + v722 = hir.bitcast v721 : i32; + v724 = arith.neq v722, v1740 : i1; + v1722 = scf.if v724 : i32 { + ^block73: + v732 = hir.bitcast v595 : u32; + v1739 = arith.constant 4 : u32; + v734 = arith.mod v732, v1739 : u32; + hir.assertz v734 #[code = 250]; + v735 = hir.int_to_ptr v732 : ptr; + hir.store v735, v676; + v1738 = arith.constant 4 : u32; + v736 = hir.bitcast v595 : u32; + v738 = arith.add v736, v1738 : u32 #[overflow = checked]; + v1737 = arith.constant 4 : u32; + v740 = arith.mod v738, v1737 : u32; + hir.assertz v740 #[code = 250]; + v741 = hir.int_to_ptr v738 : ptr; + hir.store v741, v711; + scf.yield v649; + } else { + ^block74: + v726 = arith.constant 16 : u32; + v725 = hir.bitcast v606 : u32; + v727 = arith.add v725, v726 : u32 #[overflow = checked]; + v1736 = arith.constant 4 : u32; + v729 = arith.mod v727, v1736 : u32; + hir.assertz v729 #[code = 250]; + v730 = hir.int_to_ptr v727 : ptr; + v731 = hir.load v730 : i32; + scf.yield v731; + }; + v742 = arith.constant -2147483647 : i32; + v1723 = cf.select v724, v742, v711 : i32; + scf.yield v1722, v1723; + }; + scf.yield v1724, v1725; + }; + scf.yield v1726, v1727; + }; + scf.yield v1728, v1729; + }; + v1735 = arith.constant 4 : u32; + v747 = hir.bitcast v594 : u32; + v749 = arith.add v747, v1735 : u32 #[overflow = checked]; + v1734 = arith.constant 4 : u32; + v751 = arith.mod v749, v1734 : u32; + hir.assertz v751 #[code = 250]; + v752 = hir.int_to_ptr v749 : ptr; + hir.store v752, v1730; + v755 = hir.bitcast v594 : u32; + v1733 = arith.constant 4 : u32; + v757 = arith.mod v755, v1733 : u32; + hir.assertz v757 #[code = 250]; + v758 = hir.int_to_ptr v755 : ptr; + hir.store v758, v1731; + v1732 = arith.constant 32 : i32; + v762 = arith.add v606, v1732 : i32 #[overflow = wrapping]; + v763 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v764 = hir.bitcast v763 : ptr; + hir.store v764, v762; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v765: i32, v766: i32, v767: i32) { + ^block75(v765: i32, v766: i32, v767: i32): + v769 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v770 = hir.bitcast v769 : ptr; + v771 = hir.load v770 : i32; + v772 = arith.constant 16 : i32; + v773 = arith.sub v771, v772 : i32 #[overflow = wrapping]; + v774 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v775 = hir.bitcast v774 : ptr; + hir.store v775, v773; + v776 = arith.constant 4 : i32; + v777 = arith.add v773, v776 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v777, v765, v766, v767) + v779 = arith.constant 8 : u32; + v778 = hir.bitcast v773 : u32; + v780 = arith.add v778, v779 : u32 #[overflow = checked]; + v781 = arith.constant 4 : u32; + v782 = arith.mod v780, v781 : u32; + hir.assertz v782 #[code = 250]; + v783 = hir.int_to_ptr v780 : ptr; + v784 = hir.load v783 : i32; + v1766 = arith.constant 0 : i32; + v768 = arith.constant 0 : i32; + v786 = arith.eq v784, v768 : i1; + v787 = arith.zext v786 : u32; + v788 = hir.bitcast v787 : i32; + v790 = arith.neq v788, v1766 : i1; + scf.if v790{ + ^block173: + scf.yield ; + } else { + ^block78: + v1765 = arith.constant 4 : u32; + v791 = hir.bitcast v773 : u32; + v793 = arith.add v791, v1765 : u32 #[overflow = checked]; + v1764 = arith.constant 4 : u32; + v795 = arith.mod v793, v1764 : u32; + hir.assertz v795 #[code = 250]; + v796 = hir.int_to_ptr v793 : ptr; + v797 = hir.load v796 : i32; + v799 = arith.constant 12 : u32; + v798 = hir.bitcast v773 : u32; + v800 = arith.add v798, v799 : u32 #[overflow = checked]; + v1763 = arith.constant 4 : u32; + v802 = arith.mod v800, v1763 : u32; + hir.assertz v802 #[code = 250]; + v803 = hir.int_to_ptr v800 : ptr; + v804 = hir.load v803 : i32; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::deallocate(v797, v784, v804) + scf.yield ; + }; + v1762 = arith.constant 16 : i32; + v807 = arith.add v773, v1762 : i32 #[overflow = wrapping]; + v808 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v809 = hir.bitcast v808 : ptr; + hir.store v809, v807; + builtin.ret ; + }; + + private builtin.function @::allocate(v810: i32, v811: i32, v812: i32) { + ^block79(v810: i32, v811: i32, v812: i32): + v814 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v815 = hir.bitcast v814 : ptr; + v816 = hir.load v815 : i32; + v817 = arith.constant 16 : i32; + v818 = arith.sub v816, v817 : i32 #[overflow = wrapping]; + v819 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v820 = hir.bitcast v819 : ptr; + hir.store v820, v818; + v813 = arith.constant 0 : i32; + v821 = arith.constant 8 : i32; + v822 = arith.add v818, v821 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v822, v811, v812, v813) + v825 = arith.constant 12 : u32; + v824 = hir.bitcast v818 : u32; + v826 = arith.add v824, v825 : u32 #[overflow = checked]; + v827 = arith.constant 4 : u32; + v828 = arith.mod v826, v827 : u32; + hir.assertz v828 #[code = 250]; + v829 = hir.int_to_ptr v826 : ptr; + v830 = hir.load v829 : i32; + v832 = arith.constant 8 : u32; + v831 = hir.bitcast v818 : u32; + v833 = arith.add v831, v832 : u32 #[overflow = checked]; + v1771 = arith.constant 4 : u32; + v835 = arith.mod v833, v1771 : u32; + hir.assertz v835 #[code = 250]; + v836 = hir.int_to_ptr v833 : ptr; + v837 = hir.load v836 : i32; + v838 = hir.bitcast v810 : u32; + v1770 = arith.constant 4 : u32; + v840 = arith.mod v838, v1770 : u32; + hir.assertz v840 #[code = 250]; + v841 = hir.int_to_ptr v838 : ptr; + hir.store v841, v837; + v1769 = arith.constant 4 : u32; + v842 = hir.bitcast v810 : u32; + v844 = arith.add v842, v1769 : u32 #[overflow = checked]; + v1768 = arith.constant 4 : u32; + v846 = arith.mod v844, v1768 : u32; + hir.assertz v846 #[code = 250]; + v847 = hir.int_to_ptr v844 : ptr; + hir.store v847, v830; + v1767 = arith.constant 16 : i32; + v849 = arith.add v818, v1767 : i32 #[overflow = wrapping]; + v850 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v851 = hir.bitcast v850 : ptr; + hir.store v851, v849; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v852: i32, v853: i32, v854: i32, v855: i32) { + ^block81(v852: i32, v853: i32, v854: i32, v855: i32): + v1787 = arith.constant 0 : i32; + v856 = arith.constant 0 : i32; + v857 = arith.eq v854, v856 : i1; + v858 = arith.zext v857 : u32; + v859 = hir.bitcast v858 : i32; + v861 = arith.neq v859, v1787 : i1; + v1783 = scf.if v861 : i32 { + ^block175: + scf.yield v853; + } else { + ^block84: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1786 = arith.constant 0 : i32; + v863 = arith.neq v855, v1786 : i1; + v1782 = scf.if v863 : i32 { + ^block85: + v865 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc_zeroed(v854, v853) : i32 + scf.yield v865; + } else { + ^block86: + v864 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc(v854, v853) : i32 + scf.yield v864; + }; + scf.yield v1782; + }; + v869 = arith.constant 4 : u32; + v868 = hir.bitcast v852 : u32; + v870 = arith.add v868, v869 : u32 #[overflow = checked]; + v1785 = arith.constant 4 : u32; + v872 = arith.mod v870, v1785 : u32; + hir.assertz v872 #[code = 250]; + v873 = hir.int_to_ptr v870 : ptr; + hir.store v873, v854; + v875 = hir.bitcast v852 : u32; + v1784 = arith.constant 4 : u32; + v877 = arith.mod v875, v1784 : u32; + hir.assertz v877 #[code = 250]; + v878 = hir.int_to_ptr v875 : ptr; + hir.store v878, v1783; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v879: i32, v880: i32, v881: i32, v882: i32) { + ^block87(v879: i32, v880: i32, v881: i32, v882: i32): + v1813 = arith.constant 0 : i32; + v883 = arith.constant 0 : i32; + v887 = arith.eq v882, v883 : i1; + v888 = arith.zext v887 : u32; + v889 = hir.bitcast v888 : i32; + v891 = arith.neq v889, v1813 : i1; + v1800, v1801 = scf.if v891 : i32, i32 { + ^block179: + v1812 = arith.constant 0 : i32; + v885 = arith.constant 4 : i32; + scf.yield v885, v1812; + } else { + ^block90: + v892 = hir.bitcast v880 : u32; + v927 = arith.constant 4 : u32; + v894 = arith.mod v892, v927 : u32; + hir.assertz v894 #[code = 250]; + v895 = hir.int_to_ptr v892 : ptr; + v896 = hir.load v895 : i32; + v1810 = arith.constant 0 : i32; + v1811 = arith.constant 0 : i32; + v898 = arith.eq v896, v1811 : i1; + v899 = arith.zext v898 : u32; + v900 = hir.bitcast v899 : i32; + v902 = arith.neq v900, v1810 : i1; + v1798 = scf.if v902 : i32 { + ^block178: + v1809 = arith.constant 0 : i32; + scf.yield v1809; + } else { + ^block91: + v1808 = arith.constant 4 : u32; + v903 = hir.bitcast v879 : u32; + v905 = arith.add v903, v1808 : u32 #[overflow = checked]; + v1807 = arith.constant 4 : u32; + v907 = arith.mod v905, v1807 : u32; + hir.assertz v907 #[code = 250]; + v908 = hir.int_to_ptr v905 : ptr; + hir.store v908, v881; + v1806 = arith.constant 4 : u32; + v909 = hir.bitcast v880 : u32; + v911 = arith.add v909, v1806 : u32 #[overflow = checked]; + v1805 = arith.constant 4 : u32; + v913 = arith.mod v911, v1805 : u32; + hir.assertz v913 #[code = 250]; + v914 = hir.int_to_ptr v911 : ptr; + v915 = hir.load v914 : i32; + v916 = hir.bitcast v879 : u32; + v1804 = arith.constant 4 : u32; + v918 = arith.mod v916, v1804 : u32; + hir.assertz v918 #[code = 250]; + v919 = hir.int_to_ptr v916 : ptr; + hir.store v919, v915; + v920 = arith.mul v896, v882 : i32 #[overflow = wrapping]; + scf.yield v920; + }; + v921 = arith.constant 8 : i32; + v1803 = arith.constant 4 : i32; + v1799 = cf.select v902, v1803, v921 : i32; + scf.yield v1799, v1798; + }; + v924 = arith.add v879, v1800 : i32 #[overflow = wrapping]; + v926 = hir.bitcast v924 : u32; + v1802 = arith.constant 4 : u32; + v928 = arith.mod v926, v1802 : u32; + hir.assertz v928 #[code = 250]; + v929 = hir.int_to_ptr v926 : ptr; + hir.store v929, v1801; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::finish_grow(v930: i32, v931: i32, v932: i32, v933: i32, v934: i32) { + ^block92(v930: i32, v931: i32, v932: i32, v933: i32, v934: i32): + v936 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v937 = hir.bitcast v936 : ptr; + v938 = hir.load v937 : i32; + v939 = arith.constant 16 : i32; + v940 = arith.sub v938, v939 : i32 #[overflow = wrapping]; + v941 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v942 = hir.bitcast v941 : ptr; + hir.store v942, v940; + v1868 = arith.constant 0 : i32; + v935 = arith.constant 0 : i32; + v945 = arith.gte v932, v935 : i1; + v946 = arith.zext v945 : u32; + v947 = hir.bitcast v946 : i32; + v949 = arith.neq v947, v1868 : i1; + v1842, v1843 = scf.if v949 : i32, i32 { + ^block95: + v1036 = arith.constant 4 : u32; + v952 = hir.bitcast v933 : u32; + v954 = arith.add v952, v1036 : u32 #[overflow = checked]; + v1867 = arith.constant 4 : u32; + v956 = arith.mod v954, v1867 : u32; + hir.assertz v956 #[code = 250]; + v957 = hir.int_to_ptr v954 : ptr; + v958 = hir.load v957 : i32; + v1865 = arith.constant 0 : i32; + v1866 = arith.constant 0 : i32; + v960 = arith.eq v958, v1866 : i1; + v961 = arith.zext v960 : u32; + v962 = hir.bitcast v961 : i32; + v964 = arith.neq v962, v1865 : i1; + v1840, v1841 = scf.if v964 : i32, i32 { + ^block98: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::allocate(v940, v931, v932) + v1864 = arith.constant 4 : u32; + v997 = hir.bitcast v940 : u32; + v999 = arith.add v997, v1864 : u32 #[overflow = checked]; + v1863 = arith.constant 4 : u32; + v1001 = arith.mod v999, v1863 : u32; + hir.assertz v1001 #[code = 250]; + v1002 = hir.int_to_ptr v999 : ptr; + v1003 = hir.load v1002 : i32; + v1004 = hir.bitcast v940 : u32; + v1862 = arith.constant 4 : u32; + v1006 = arith.mod v1004, v1862 : u32; + hir.assertz v1006 #[code = 250]; + v1007 = hir.int_to_ptr v1004 : ptr; + v1008 = hir.load v1007 : i32; + scf.yield v1008, v1003; + } else { + ^block99: + v966 = arith.constant 8 : u32; + v965 = hir.bitcast v933 : u32; + v967 = arith.add v965, v966 : u32 #[overflow = checked]; + v1861 = arith.constant 4 : u32; + v969 = arith.mod v967, v1861 : u32; + hir.assertz v969 #[code = 250]; + v970 = hir.int_to_ptr v967 : ptr; + v971 = hir.load v970 : i32; + v1860 = arith.constant 0 : i32; + v973 = arith.neq v971, v1860 : i1; + v1838, v1839 = scf.if v973 : i32, i32 { + ^block100: + v991 = hir.bitcast v933 : u32; + v1859 = arith.constant 4 : u32; + v993 = arith.mod v991, v1859 : u32; + hir.assertz v993 #[code = 250]; + v994 = hir.int_to_ptr v991 : ptr; + v995 = hir.load v994 : i32; + v996 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_realloc(v995, v971, v931, v932) : i32 + scf.yield v996, v932; + } else { + ^block101: + v1858 = arith.constant 0 : i32; + v1030 = arith.constant 8 : i32; + v975 = arith.add v940, v1030 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v975, v931, v932, v1858) + v978 = arith.constant 12 : u32; + v977 = hir.bitcast v940 : u32; + v979 = arith.add v977, v978 : u32 #[overflow = checked]; + v1857 = arith.constant 4 : u32; + v981 = arith.mod v979, v1857 : u32; + hir.assertz v981 #[code = 250]; + v982 = hir.int_to_ptr v979 : ptr; + v983 = hir.load v982 : i32; + v1856 = arith.constant 8 : u32; + v984 = hir.bitcast v940 : u32; + v986 = arith.add v984, v1856 : u32 #[overflow = checked]; + v1855 = arith.constant 4 : u32; + v988 = arith.mod v986, v1855 : u32; + hir.assertz v988 #[code = 250]; + v989 = hir.int_to_ptr v986 : ptr; + v990 = hir.load v989 : i32; + scf.yield v990, v983; + }; + scf.yield v1838, v1839; + }; + v1854 = arith.constant 4 : u32; + v1015 = hir.bitcast v930 : u32; + v1017 = arith.add v1015, v1854 : u32 #[overflow = checked]; + v1853 = arith.constant 4 : u32; + v1019 = arith.mod v1017, v1853 : u32; + hir.assertz v1019 #[code = 250]; + v1852 = arith.constant 0 : i32; + v1013 = arith.neq v1840, v1852 : i1; + v1014 = cf.select v1013, v1840, v931 : i32; + v1020 = hir.int_to_ptr v1017 : ptr; + hir.store v1020, v1014; + v1850 = arith.constant 0 : i32; + v1027 = arith.eq v1840, v1850 : i1; + v1028 = arith.zext v1027 : u32; + v1029 = hir.bitcast v1028 : i32; + v1851 = arith.constant 0 : i32; + v1024 = arith.neq v1840, v1851 : i1; + v1025 = cf.select v1024, v1841, v932 : i32; + scf.yield v1025, v1029; + } else { + ^block96: + v950 = arith.constant 1 : i32; + v1849 = arith.constant 0 : i32; + scf.yield v1849, v950; + }; + v951 = arith.constant 4 : i32; + v1848 = arith.constant 8 : i32; + v1844 = cf.select v949, v1848, v951 : i32; + v1033 = arith.add v930, v1844 : i32 #[overflow = wrapping]; + v1035 = hir.bitcast v1033 : u32; + v1847 = arith.constant 4 : u32; + v1037 = arith.mod v1035, v1847 : u32; + hir.assertz v1037 #[code = 250]; + v1038 = hir.int_to_ptr v1035 : ptr; + hir.store v1038, v1842; + v1040 = hir.bitcast v930 : u32; + v1846 = arith.constant 4 : u32; + v1042 = arith.mod v1040, v1846 : u32; + hir.assertz v1042 #[code = 250]; + v1043 = hir.int_to_ptr v1040 : ptr; + hir.store v1043, v1843; + v1845 = arith.constant 16 : i32; + v1047 = arith.add v940, v1845 : i32 #[overflow = wrapping]; + v1048 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v1049 = hir.bitcast v1048 : ptr; + hir.store v1049, v1047; + builtin.ret ; + }; + + private builtin.function @::deallocate(v1050: i32, v1051: i32, v1052: i32) { + ^block102(v1050: i32, v1051: i32, v1052: i32): + v1870 = arith.constant 0 : i32; + v1053 = arith.constant 0 : i32; + v1054 = arith.eq v1052, v1053 : i1; + v1055 = arith.zext v1054 : u32; + v1056 = hir.bitcast v1055 : i32; + v1058 = arith.neq v1056, v1870 : i1; + scf.if v1058{ + ^block104: + scf.yield ; + } else { + ^block105: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_dealloc(v1050, v1052, v1051) + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v1059: i32, v1060: i32, v1061: i32) { + ^block106(v1059: i32, v1060: i32, v1061: i32): + ub.unreachable ; + }; + + private builtin.function @alloc::alloc::handle_alloc_error(v1062: i32, v1063: i32) { + ^block108(v1062: i32, v1063: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v1064: i32, v1065: i32) -> i32 { + ^block110(v1064: i32, v1065: i32): + v1072 = arith.constant 0 : i32; + v1068 = hir.bitcast v1065 : u32; + v1067 = hir.bitcast v1064 : u32; + v1069 = arith.gt v1067, v1068 : i1; + v1070 = arith.zext v1069 : u32; + v1071 = hir.bitcast v1070 : i32; + v1073 = arith.neq v1071, v1072 : i1; + v1074 = cf.select v1073, v1064, v1065 : i32; + builtin.ret v1074; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; + }; +}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.masm b/felt-repr/tests/expected/onchain_four_felts_struct.masm new file mode 100644 index 000000000..252c04591 --- /dev/null +++ b/felt-repr/tests/expected/onchain_four_felts_struct.masm @@ -0,0 +1,3049 @@ +# mod root_ns:root@1.0.0 + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 +end + +# mod root_ns:root@1.0.0::onchain_four_felts_struct + +@callconv("C") +proc core::ptr::drop_in_place>( + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + push.8 + dup.2 + u32wrapping_add + dup.1 + swap.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::vec::Vec::push(i32, felt) + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + dup.2 + neq + neq + if.true + nop + else + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVec::grow_one + trace.252 + nop + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + dup.2 + swap.1 + u32shl + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVec::grow_one(i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + push.1 + push.8 + dup.4 + u32wrapping_add + dup.2 + movup.2 + swap.3 + swap.4 + movdn.2 + swap.5 + swap.6 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::grow_amortized + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2147483649 + dup.2 + eq + neq + if.true + drop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc alloc::alloc::exchange_malloc( + +) -> i32 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.4 + dup.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_alloc + trace.252 + nop + push.0 + dup.1 + neq + if.true + nop + else + drop + push.4 + dup.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::handle_alloc_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc + trace.252 + nop +end + +@callconv("C") +pub proc entrypoint(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + push.4 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.4 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + movup.2 + swap.3 + swap.4 + swap.5 + movdn.2 + swap.1 + push.1 + while.true + dup.0 + dup.2 + u32wrapping_add + push.0 + push.4 + dup.4 + eq + neq + dup.0 + if.true + movup.3 + drop + push.3735929054 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + movup.4 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.10 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.10 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.10 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.5 + dup.10 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.6 + dup.10 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.7 + movup.2 + swap.10 + movdn.2 + cdrop + push.1 + push.0 + movup.8 + cdrop + push.1 + u32and + movup.3 + swap.5 + swap.7 + swap.13 + swap.12 + swap.11 + swap.10 + swap.9 + swap.8 + movdn.3 + movup.2 + swap.4 + swap.6 + movdn.2 + if.true + movup.7 + drop + movup.7 + drop + movup.7 + drop + movup.7 + drop + movup.7 + drop + movup.7 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + drop + drop + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.6 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.4 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + push.1 + while.true + dup.0 + dup.2 + u32wrapping_add + push.0 + push.4 + dup.4 + eq + neq + dup.0 + if.true + movup.3 + drop + push.3735929054 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + movup.4 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.9 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.9 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.9 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.5 + dup.9 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.6 + movup.2 + swap.9 + movdn.2 + cdrop + push.1 + push.0 + movup.7 + cdrop + push.1 + u32and + movup.2 + swap.4 + swap.6 + swap.11 + swap.10 + swap.9 + swap.8 + swap.7 + swap.3 + swap.5 + movdn.2 + if.true + movup.6 + drop + movup.6 + drop + movup.6 + drop + movup.6 + drop + movup.6 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + drop + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.4 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + push.1 + while.true + dup.0 + dup.2 + u32wrapping_add + push.0 + push.4 + dup.4 + eq + neq + dup.0 + if.true + movup.3 + drop + push.3735929054 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + movup.4 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.8 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.8 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.8 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.8 + movdn.2 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + movup.3 + swap.5 + swap.9 + swap.8 + swap.7 + swap.6 + movdn.3 + movup.2 + swap.4 + movdn.2 + if.true + movup.5 + drop + movup.5 + drop + movup.5 + drop + movup.5 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.4 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + push.1 + while.true + dup.0 + dup.2 + u32wrapping_add + push.0 + push.4 + dup.4 + eq + neq + dup.0 + if.true + movup.3 + drop + push.3735929054 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + movup.4 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.7 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.7 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + movup.2 + swap.7 + movdn.2 + cdrop + push.1 + push.0 + movup.5 + cdrop + push.1 + u32and + movup.2 + swap.4 + swap.7 + swap.6 + swap.5 + swap.3 + movdn.2 + if.true + movup.4 + drop + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> + trace.252 + nop + push.8 + push.4 + dup.2 + u32wrapping_add + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 + swap.2 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + movdn.3 + drop + drop + drop + else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + drop + else + dup.2 + movup.2 + push.0 + dup.3 + push.0 + gte + while.true + dup.2 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.4 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::grow_amortized( + i32, + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.8 + eq + neq + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + movup.4 + dup.4 + u32wrapping_add + push.0 + movup.5 + dup.2 + swap.1 + u32lt + neq + if.true + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32shl + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + push.1 + push.4 + push.0 + push.1025 + dup.9 + swap.1 + u32lt + neq + cdrop + push.8 + push.0 + push.1 + dup.9 + eq + neq + cdrop + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + dup.2 + swap.1 + cdrop + dup.0 + push.0 + push.0 + dup.8 + u32wrapping_sub + push.4294967295 + dup.9 + dup.11 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + drop + push.0 + push.2147483648 + dup.8 + u32wrapping_sub + dup.2 + swap.1 + u32gt + neq + if.true + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + push.20 + dup.4 + u32wrapping_add + dup.6 + dup.8 + movup.3 + swap.10 + movdn.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.20 + dup.3 + u32wrapping_add + push.8 + dup.4 + u32wrapping_add + dup.5 + movup.2 + swap.3 + swap.9 + movdn.2 + swap.4 + swap.8 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::finish_grow + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.4 + else + movup.2 + swap.6 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.4 + drop + drop + drop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + end + push.2147483649 + movdn.2 + movdn.3 + cdrop + swap.1 + end + end + end + end + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + u32wrapping_add + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + else + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::deallocate + trace.252 + nop + end + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) + movup.4 + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::i32::is_gte + trace.252 + nop + neq + dup.0 + if.true + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + movup.5 + drop + dup.4 + dup.4 + dup.3 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::allocate + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + neq + if.true + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.5 + dup.7 + swap.3 + swap.1 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_realloc + trace.252 + nop + dup.5 + swap.1 + else + movup.6 + swap.1 + drop + drop + push.0 + push.8 + dup.3 + u32wrapping_add + dup.5 + dup.7 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + end + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + dup.2 + neq + dup.2 + movup.2 + swap.8 + movdn.2 + swap.1 + cdrop + movup.6 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + dup.1 + eq + push.0 + movup.2 + neq + swap.1 + swap.6 + swap.2 + swap.1 + cdrop + movup.4 + swap.1 + else + movup.2 + swap.5 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.3 + drop + drop + drop + push.1 + push.0 + end + push.4 + push.8 + movup.4 + cdrop + dup.4 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + drop + drop + drop + else + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_dealloc + trace.252 + nop + end +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc alloc::alloc::handle_alloc_error(i32, i32) + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.wat b/felt-repr/tests/expected/onchain_four_felts_struct.wat new file mode 100644 index 000000000..696968c2e --- /dev/null +++ b/felt-repr/tests/expected/onchain_four_felts_struct.wat @@ -0,0 +1,861 @@ +(module $onchain_four_felts_struct.wasm + (type (;0;) (func (param i32))) + (type (;1;) (func (param i32 f32))) + (type (;2;) (func (result i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param i32 i32))) + (type (;5;) (func (param i32 i32 i32))) + (type (;6;) (func (param i32 i32 i32 i32) (result i32))) + (type (;7;) (func)) + (type (;8;) (func (param i32 i32 i32) (result i32))) + (type (;9;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32 i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $core::ptr::drop_in_place> (;0;) (type 0) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + local.get 0 + i32.load + i32.store offset=12 + local.get 1 + local.get 0 + i32.load offset=8 + i32.store offset=8 + local.get 1 + i32.const 8 + i32.add + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::deallocate + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::vec::Vec::push (;1;) (type 1) (param i32 f32) + (local i32) + block ;; label = @1 + local.get 0 + i32.load offset=8 + local.tee 2 + local.get 0 + i32.load + i32.ne + br_if 0 (;@1;) + local.get 0 + call $alloc::raw_vec::RawVec::grow_one + end + local.get 0 + i32.load offset=4 + local.get 2 + i32.const 2 + i32.shl + i32.add + local.get 1 + f32.store + local.get 0 + local.get 2 + i32.const 1 + i32.add + i32.store offset=8 + ) + (func $alloc::raw_vec::RawVec::grow_one (;2;) (type 0) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 8 + i32.add + local.get 0 + local.get 0 + i32.load + i32.const 1 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::grow_amortized + block ;; label = @1 + local.get 1 + i32.load offset=8 + local.tee 0 + i32.const -2147483647 + i32.eq + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.load offset=12 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::exchange_malloc (;3;) (type 2) (result i32) + (local i32) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @1 + i32.const 4 + i32.const 4 + call $__rustc::__rust_alloc + local.tee 0 + br_if 0 (;@1;) + i32.const 4 + i32.const 4 + call $alloc::alloc::handle_alloc_error + unreachable + end + local.get 0 + ) + (func $__rustc::__rust_alloc (;4;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $entrypoint (;5;) (type 4) (param i32 i32) + (local i32 f32 f32 f32 f32 i32 i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=12 + local.set 3 + local.get 1 + f32.load offset=8 + local.set 4 + local.get 1 + f32.load offset=4 + local.set 5 + local.get 1 + f32.load + local.set 6 + i32.const 0 + local.set 1 + local.get 2 + i32.const 0 + i32.store offset=12 + local.get 2 + i64.const 17179869184 + i64.store offset=4 align=4 + call $alloc::alloc::exchange_malloc + local.tee 7 + local.get 6 + f32.store + local.get 2 + local.get 7 + i32.const 4 + i32.add + i32.store offset=28 + local.get 2 + i32.const 1 + i32.store offset=24 + local.get 2 + local.get 7 + i32.store offset=16 + block ;; label = @1 + loop ;; label = @2 + local.get 7 + local.get 1 + i32.add + local.set 8 + local.get 1 + i32.const 4 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 4 + i32.add + local.get 8 + f32.load + call $alloc::vec::Vec::push + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + local.get 8 + i32.store offset=20 + local.get 2 + i32.const 16 + i32.add + call $core::ptr::drop_in_place> + call $alloc::alloc::exchange_malloc + local.tee 7 + local.get 5 + f32.store + local.get 2 + local.get 7 + i32.const 4 + i32.add + i32.store offset=28 + local.get 2 + i32.const 1 + i32.store offset=24 + local.get 2 + local.get 7 + i32.store offset=16 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 7 + local.get 1 + i32.add + local.set 8 + local.get 1 + i32.const 4 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 4 + i32.add + local.get 8 + f32.load + call $alloc::vec::Vec::push + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + local.get 8 + i32.store offset=20 + local.get 2 + i32.const 16 + i32.add + call $core::ptr::drop_in_place> + call $alloc::alloc::exchange_malloc + local.tee 7 + local.get 4 + f32.store + local.get 2 + local.get 7 + i32.const 4 + i32.add + i32.store offset=28 + local.get 2 + i32.const 1 + i32.store offset=24 + local.get 2 + local.get 7 + i32.store offset=16 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 7 + local.get 1 + i32.add + local.set 8 + local.get 1 + i32.const 4 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 4 + i32.add + local.get 8 + f32.load + call $alloc::vec::Vec::push + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + local.get 8 + i32.store offset=20 + local.get 2 + i32.const 16 + i32.add + call $core::ptr::drop_in_place> + call $alloc::alloc::exchange_malloc + local.tee 7 + local.get 3 + f32.store + local.get 2 + local.get 7 + i32.const 4 + i32.add + i32.store offset=28 + local.get 2 + i32.const 1 + i32.store offset=24 + local.get 2 + local.get 7 + i32.store offset=16 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 7 + local.get 1 + i32.add + local.set 8 + local.get 1 + i32.const 4 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 4 + i32.add + local.get 8 + f32.load + call $alloc::vec::Vec::push + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + local.get 8 + i32.store offset=20 + local.get 2 + i32.const 16 + i32.add + call $core::ptr::drop_in_place> + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.const 4 + i32.add + i32.const 8 + i32.add + i32.load + i32.store + local.get 0 + local.get 2 + i64.load offset=4 align=4 + i64.store align=4 + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $__rustc::__rust_dealloc (;6;) (type 5) (param i32 i32 i32)) + (func $__rustc::__rust_realloc (;7;) (type 6) (param i32 i32 i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 2 + local.get 3 + call $::alloc + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 1 + local.get 3 + local.get 1 + i32.lt_u + select + local.tee 3 + i32.eqz + br_if 0 (;@1;) + local.get 2 + local.get 0 + local.get 3 + memory.copy + end + local.get 2 + ) + (func $__rustc::__rust_alloc_zeroed (;8;) (type 3) (param i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;9;) (type 7) + return + ) + (func $::alloc (;10;) (type 8) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;11;) (type 2) (result i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;12;) (type 9) (param i32 i32 i32 i32 i32 i32) + (local i32 i32 i32 i64) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 6 + global.set $__stack_pointer + i32.const 0 + local.set 7 + block ;; label = @1 + block ;; label = @2 + local.get 5 + i32.eqz + br_if 0 (;@2;) + local.get 2 + local.get 3 + i32.add + local.tee 3 + local.get 2 + i32.lt_u + br_if 1 (;@1;) + i32.const 0 + local.set 7 + local.get 4 + local.get 5 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 4 + i32.sub + i32.and + i64.extend_i32_u + local.get 3 + local.get 1 + i32.load + i32.const 1 + i32.shl + local.tee 8 + local.get 3 + local.get 8 + i32.gt_u + select + local.tee 8 + i32.const 8 + i32.const 4 + i32.const 1 + local.get 5 + i32.const 1025 + i32.lt_u + select + local.get 5 + i32.const 1 + i32.eq + select + local.tee 2 + local.get 8 + local.get 2 + i32.gt_u + select + local.tee 2 + i64.extend_i32_u + i64.mul + local.tee 9 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@2;) + local.get 9 + i32.wrap_i64 + local.tee 3 + i32.const -2147483648 + local.get 4 + i32.sub + i32.gt_u + br_if 1 (;@1;) + local.get 6 + i32.const 20 + i32.add + local.get 1 + local.get 4 + local.get 5 + call $alloc::raw_vec::RawVecInner::current_memory + local.get 6 + i32.const 8 + i32.add + local.get 4 + local.get 3 + local.get 6 + i32.const 20 + i32.add + local.get 0 + call $alloc::raw_vec::finish_grow + local.get 6 + i32.load offset=12 + local.set 7 + block ;; label = @3 + local.get 6 + i32.load offset=8 + i32.eqz + br_if 0 (;@3;) + local.get 6 + i32.load offset=16 + local.set 8 + br 2 (;@1;) + end + local.get 1 + local.get 2 + i32.store + local.get 1 + local.get 7 + i32.store offset=4 + i32.const -2147483647 + local.set 7 + br 1 (;@1;) + end + end + local.get 0 + local.get 8 + i32.store offset=4 + local.get 0 + local.get 7 + i32.store + local.get 6 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 5) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 4 + i32.add + local.get 0 + local.get 1 + local.get 2 + call $alloc::raw_vec::RawVecInner::current_memory + block ;; label = @1 + local.get 3 + i32.load offset=8 + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + i32.load offset=4 + local.get 2 + local.get 3 + i32.load offset=12 + call $::deallocate + end + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;14;) (type 5) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;15;) (type 10) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;16;) (type 10) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $alloc::raw_vec::finish_grow (;17;) (type 11) (param i32 i32 i32 i32 i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + i32.const 0 + local.set 6 + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.const 0 + i32.ge_s + br_if 0 (;@2;) + i32.const 1 + local.set 2 + i32.const 4 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 3 + i32.load offset=4 + i32.eqz + br_if 0 (;@3;) + block ;; label = @4 + local.get 3 + i32.load offset=8 + local.tee 6 + br_if 0 (;@4;) + local.get 5 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load offset=12 + local.set 6 + local.get 5 + i32.load offset=8 + local.set 3 + br 2 (;@2;) + end + local.get 3 + i32.load + local.get 6 + local.get 1 + local.get 2 + call $__rustc::__rust_realloc + local.set 3 + local.get 2 + local.set 6 + br 1 (;@2;) + end + local.get 5 + local.get 1 + local.get 2 + call $::allocate + local.get 5 + i32.load offset=4 + local.set 6 + local.get 5 + i32.load + local.set 3 + end + local.get 0 + local.get 3 + local.get 1 + local.get 3 + select + i32.store offset=4 + local.get 6 + local.get 2 + local.get 3 + select + local.set 6 + local.get 3 + i32.eqz + local.set 2 + i32.const 8 + local.set 3 + end + local.get 0 + local.get 3 + i32.add + local.get 6 + i32.store + local.get 0 + local.get 2 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::deallocate (;18;) (type 5) (param i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + local.get 1 + call $__rustc::__rust_dealloc + end + ) + (func $alloc::raw_vec::handle_error (;19;) (type 5) (param i32 i32 i32) + unreachable + ) + (func $alloc::alloc::handle_alloc_error (;20;) (type 4) (param i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;21;) (type 3) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") +) diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.hir b/felt-repr/tests/expected/onchain_two_felts_struct.hir new file mode 100644 index 000000000..52a2cd528 --- /dev/null +++ b/felt-repr/tests/expected/onchain_two_felts_struct.hir @@ -0,0 +1,1311 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @onchain_two_felts_struct { + private builtin.function @core::ptr::drop_in_place>(v0: i32) { + ^block4(v0: i32): + v2 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__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/onchain_two_felts_struct/__stack_pointer : ptr + v8 = hir.bitcast v7 : ptr; + hir.store v8, v6; + v9 = hir.bitcast v0 : u32; + v10 = arith.constant 4 : u32; + v11 = arith.mod v9, v10 : u32; + hir.assertz v11 #[code = 250]; + v12 = hir.int_to_ptr v9 : ptr; + v13 = hir.load v12 : i32; + v15 = arith.constant 12 : u32; + v14 = hir.bitcast v6 : u32; + v16 = arith.add v14, v15 : u32 #[overflow = checked]; + v950 = arith.constant 4 : u32; + v18 = arith.mod v16, v950 : u32; + hir.assertz v18 #[code = 250]; + v19 = hir.int_to_ptr v16 : ptr; + hir.store v19, v13; + v21 = arith.constant 8 : u32; + v20 = hir.bitcast v0 : u32; + v22 = arith.add v20, v21 : u32 #[overflow = checked]; + v949 = arith.constant 4 : u32; + v24 = arith.mod v22, v949 : u32; + hir.assertz v24 #[code = 250]; + v25 = hir.int_to_ptr v22 : ptr; + v26 = hir.load v25 : i32; + v948 = arith.constant 8 : u32; + v27 = hir.bitcast v6 : u32; + v29 = arith.add v27, v948 : u32 #[overflow = checked]; + v947 = arith.constant 4 : u32; + v31 = arith.mod v29, v947 : u32; + hir.assertz v31 #[code = 250]; + v32 = hir.int_to_ptr v29 : ptr; + hir.store v32, v26; + v35 = arith.constant 4 : i32; + v33 = arith.constant 8 : i32; + v34 = arith.add v6, v33 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::deallocate(v34, v35, v35) + v946 = arith.constant 16 : i32; + v38 = arith.add v6, v946 : i32 #[overflow = wrapping]; + v39 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v40 = hir.bitcast v39 : ptr; + hir.store v40, v38; + builtin.ret ; + }; + + private builtin.function @alloc::vec::Vec::push(v41: i32, v42: felt) { + ^block6(v41: i32, v42: felt): + v45 = arith.constant 8 : u32; + v44 = hir.bitcast v41 : u32; + v46 = arith.add v44, v45 : u32 #[overflow = checked]; + v47 = arith.constant 4 : u32; + v48 = arith.mod v46, v47 : u32; + hir.assertz v48 #[code = 250]; + v49 = hir.int_to_ptr v46 : ptr; + v50 = hir.load v49 : i32; + v51 = hir.bitcast v41 : u32; + v961 = arith.constant 4 : u32; + v53 = arith.mod v51, v961 : u32; + hir.assertz v53 #[code = 250]; + v54 = hir.int_to_ptr v51 : ptr; + v55 = hir.load v54 : i32; + v43 = arith.constant 0 : i32; + v56 = arith.neq v50, v55 : i1; + v57 = arith.zext v56 : u32; + v58 = hir.bitcast v57 : i32; + v60 = arith.neq v58, v43 : i1; + scf.if v60{ + ^block104: + scf.yield ; + } else { + ^block9: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVec::grow_one(v41) + scf.yield ; + }; + v960 = arith.constant 4 : u32; + v62 = hir.bitcast v41 : u32; + v64 = arith.add v62, v960 : u32 #[overflow = checked]; + v959 = arith.constant 4 : u32; + v66 = arith.mod v64, v959 : u32; + hir.assertz v66 #[code = 250]; + v67 = hir.int_to_ptr v64 : ptr; + v68 = hir.load v67 : i32; + v951 = arith.constant 2 : u32; + v72 = arith.shl v50, v951 : i32; + v73 = arith.add v68, v72 : i32 #[overflow = wrapping]; + v75 = hir.bitcast v73 : u32; + v958 = arith.constant 4 : u32; + v77 = arith.mod v75, v958 : u32; + hir.assertz v77 #[code = 250]; + v78 = hir.int_to_ptr v75 : ptr; + hir.store v78, v42; + v957 = arith.constant 8 : u32; + v81 = hir.bitcast v41 : u32; + v83 = arith.add v81, v957 : u32 #[overflow = checked]; + v956 = arith.constant 4 : u32; + v85 = arith.mod v83, v956 : u32; + hir.assertz v85 #[code = 250]; + v79 = arith.constant 1 : i32; + v80 = arith.add v50, v79 : i32 #[overflow = wrapping]; + v86 = hir.int_to_ptr v83 : ptr; + hir.store v86, v80; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVec::grow_one(v87: i32) { + ^block10(v87: i32): + v89 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v90 = hir.bitcast v89 : ptr; + v91 = hir.load v90 : i32; + v92 = arith.constant 16 : i32; + v93 = arith.sub v91, v92 : i32 #[overflow = wrapping]; + v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + hir.store v95, v93; + v98 = hir.bitcast v87 : u32; + v99 = arith.constant 4 : u32; + v100 = arith.mod v98, v99 : u32; + hir.assertz v100 #[code = 250]; + v101 = hir.int_to_ptr v98 : ptr; + v102 = hir.load v101 : i32; + v104 = arith.constant 4 : i32; + v103 = arith.constant 1 : i32; + v96 = arith.constant 8 : i32; + v97 = arith.add v93, v96 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v97, v87, v102, v103, v104, v104) + v107 = arith.constant 8 : u32; + v106 = hir.bitcast v93 : u32; + v108 = arith.add v106, v107 : u32 #[overflow = checked]; + v965 = arith.constant 4 : u32; + v110 = arith.mod v108, v965 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : i32; + v88 = arith.constant 0 : i32; + v113 = arith.constant -2147483647 : i32; + v114 = arith.eq v112, v113 : i1; + v115 = arith.zext v114 : u32; + v116 = hir.bitcast v115 : i32; + v118 = arith.neq v116, v88 : i1; + cf.cond_br v118 ^block12, ^block13; + ^block12: + v964 = arith.constant 16 : i32; + v128 = arith.add v93, v964 : i32 #[overflow = wrapping]; + v129 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v130 = hir.bitcast v129 : ptr; + hir.store v130, v128; + builtin.ret ; + ^block13: + v120 = arith.constant 12 : u32; + v119 = hir.bitcast v93 : u32; + v121 = arith.add v119, v120 : u32 #[overflow = checked]; + v963 = arith.constant 4 : u32; + v123 = arith.mod v121, v963 : u32; + hir.assertz v123 #[code = 250]; + v124 = hir.int_to_ptr v121 : ptr; + v125 = hir.load v124 : i32; + v126 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::handle_error(v112, v125, v126) + ub.unreachable ; + }; + + private builtin.function @alloc::alloc::exchange_malloc() -> i32 { + ^block14: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v133 = arith.constant 4 : i32; + v135 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v133, v133) : i32 + v132 = arith.constant 0 : i32; + v137 = arith.neq v135, v132 : i1; + cf.cond_br v137 ^block16, ^block17; + ^block16: + builtin.ret v135; + ^block17: + v968 = arith.constant 4 : i32; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::handle_alloc_error(v968, v968) + ub.unreachable ; + }; + + private builtin.function @__rustc::__rust_alloc(v140: i32, v141: i32) -> i32 { + ^block18(v140: i32, v141: i32): + v143 = arith.constant 1048604 : i32; + v144 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v143, v141, v140) : i32 + builtin.ret v144; + }; + + public builtin.function @entrypoint(v145: i32, v146: i32) { + ^block20(v145: i32, v146: i32): + v150 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v151 = hir.bitcast v150 : ptr; + v152 = hir.load v151 : i32; + v153 = arith.constant 32 : i32; + v154 = arith.sub v152, v153 : i32 #[overflow = wrapping]; + v155 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v156 = hir.bitcast v155 : ptr; + hir.store v156, v154; + v158 = arith.constant 4 : u32; + v157 = hir.bitcast v146 : u32; + v159 = arith.add v157, v158 : u32 #[overflow = checked]; + v1192 = arith.constant 4 : u32; + v161 = arith.mod v159, v1192 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : felt; + v164 = hir.bitcast v146 : u32; + v1191 = arith.constant 4 : u32; + v166 = arith.mod v164, v1191 : u32; + hir.assertz v166 #[code = 250]; + v167 = hir.int_to_ptr v164 : ptr; + v168 = hir.load v167 : felt; + v172 = arith.constant 12 : u32; + v171 = hir.bitcast v154 : u32; + v173 = arith.add v171, v172 : u32 #[overflow = checked]; + v1190 = arith.constant 4 : u32; + v175 = arith.mod v173, v1190 : u32; + hir.assertz v175 #[code = 250]; + v147 = arith.constant 0 : i32; + v176 = hir.int_to_ptr v173 : ptr; + hir.store v176, v147; + v1189 = arith.constant 4 : u32; + v178 = hir.bitcast v154 : u32; + v180 = arith.add v178, v1189 : u32 #[overflow = checked]; + v1188 = arith.constant 4 : u32; + v182 = arith.mod v180, v1188 : u32; + hir.assertz v182 #[code = 250]; + v177 = arith.constant 17179869184 : i64; + v183 = hir.int_to_ptr v180 : ptr; + hir.store v183, v177; + v184 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::exchange_malloc() : i32 + v185 = hir.bitcast v184 : u32; + v1187 = arith.constant 4 : u32; + v187 = arith.mod v185, v1187 : u32; + hir.assertz v187 #[code = 250]; + v188 = hir.int_to_ptr v185 : ptr; + hir.store v188, v168; + v192 = arith.constant 28 : u32; + v191 = hir.bitcast v154 : u32; + v193 = arith.add v191, v192 : u32 #[overflow = checked]; + v1186 = arith.constant 4 : u32; + v195 = arith.mod v193, v1186 : u32; + hir.assertz v195 #[code = 250]; + v189 = arith.constant 4 : i32; + v190 = arith.add v184, v189 : i32 #[overflow = wrapping]; + v196 = hir.int_to_ptr v193 : ptr; + hir.store v196, v190; + v199 = arith.constant 24 : u32; + v198 = hir.bitcast v154 : u32; + v200 = arith.add v198, v199 : u32 #[overflow = checked]; + v1185 = arith.constant 4 : u32; + v202 = arith.mod v200, v1185 : u32; + hir.assertz v202 #[code = 250]; + v197 = arith.constant 1 : i32; + v203 = hir.int_to_ptr v200 : ptr; + hir.store v203, v197; + v205 = arith.constant 16 : u32; + v204 = hir.bitcast v154 : u32; + v206 = arith.add v204, v205 : u32 #[overflow = checked]; + v1184 = arith.constant 4 : u32; + v208 = arith.mod v206, v1184 : u32; + hir.assertz v208 #[code = 250]; + v209 = hir.int_to_ptr v206 : ptr; + hir.store v209, v184; + v1183 = arith.constant 0 : i32; + v1119, v1120, v1121, v1122, v1123, v1124, v1125, v1126, v1127 = scf.while v184, v1183, v154, v163, v145 : i32, i32, i32, felt, i32, i32, felt, i32, i32 { + ^block125(v1128: i32, v1129: i32, v1130: i32, v1131: felt, v1132: i32): + v212 = arith.add v1128, v1129 : i32 #[overflow = wrapping]; + v1181 = arith.constant 0 : i32; + v1182 = arith.constant 4 : i32; + v214 = arith.eq v1129, v1182 : i1; + v215 = arith.zext v214 : u32; + v216 = hir.bitcast v215 : i32; + v218 = arith.neq v216, v1181 : i1; + v1112 = scf.if v218 : i32 { + ^block121: + v977 = ub.poison i32 : i32; + scf.yield v977; + } else { + ^block25: + v222 = hir.bitcast v212 : u32; + v1180 = arith.constant 4 : u32; + v224 = arith.mod v222, v1180 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : felt; + v1179 = arith.constant 4 : i32; + v221 = arith.add v1130, v1179 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v221, v226) + v1178 = arith.constant 4 : i32; + v228 = arith.add v1129, v1178 : i32 #[overflow = wrapping]; + scf.yield v228; + }; + v1175 = ub.poison i32 : i32; + v1116 = cf.select v218, v1175, v1132 : i32; + v1024 = ub.poison felt : felt; + v1115 = cf.select v218, v1024, v1131 : felt; + v1176 = ub.poison i32 : i32; + v1114 = cf.select v218, v1176, v1130 : i32; + v1177 = ub.poison i32 : i32; + v1113 = cf.select v218, v1177, v1128 : i32; + v976 = arith.constant 1 : u32; + v969 = arith.constant 0 : u32; + v1118 = cf.select v218, v969, v976 : u32; + v1074 = arith.trunc v1118 : i1; + scf.condition v1074, v1113, v1112, v1114, v1115, v1116, v1130, v1131, v1132, v212; + } do { + ^block126(v1133: i32, v1134: i32, v1135: i32, v1136: felt, v1137: i32, v1138: i32, v1139: felt, v1140: i32, v1141: i32): + scf.yield v1133, v1134, v1135, v1136, v1137; + }; + v230 = arith.constant 20 : u32; + v229 = hir.bitcast v1124 : u32; + v231 = arith.add v229, v230 : u32 #[overflow = checked]; + v1174 = arith.constant 4 : u32; + v233 = arith.mod v231, v1174 : u32; + hir.assertz v233 #[code = 250]; + v234 = hir.int_to_ptr v231 : ptr; + hir.store v234, v1127; + v235 = arith.constant 16 : i32; + v236 = arith.add v1124, v235 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::drop_in_place>(v236) + v237 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::exchange_malloc() : i32 + v239 = hir.bitcast v237 : u32; + v1173 = arith.constant 4 : u32; + v241 = arith.mod v239, v1173 : u32; + hir.assertz v241 #[code = 250]; + v242 = hir.int_to_ptr v239 : ptr; + hir.store v242, v1125; + v1172 = arith.constant 28 : u32; + v245 = hir.bitcast v1124 : u32; + v247 = arith.add v245, v1172 : u32 #[overflow = checked]; + v1171 = arith.constant 4 : u32; + v249 = arith.mod v247, v1171 : u32; + hir.assertz v249 #[code = 250]; + v1170 = arith.constant 4 : i32; + v244 = arith.add v237, v1170 : i32 #[overflow = wrapping]; + v250 = hir.int_to_ptr v247 : ptr; + hir.store v250, v244; + v1169 = arith.constant 24 : u32; + v252 = hir.bitcast v1124 : u32; + v254 = arith.add v252, v1169 : u32 #[overflow = checked]; + v1168 = arith.constant 4 : u32; + v256 = arith.mod v254, v1168 : u32; + hir.assertz v256 #[code = 250]; + v1167 = arith.constant 1 : i32; + v257 = hir.int_to_ptr v254 : ptr; + hir.store v257, v1167; + v1166 = arith.constant 16 : u32; + v258 = hir.bitcast v1124 : u32; + v260 = arith.add v258, v1166 : u32 #[overflow = checked]; + v1165 = arith.constant 4 : u32; + v262 = arith.mod v260, v1165 : u32; + hir.assertz v262 #[code = 250]; + v263 = hir.int_to_ptr v260 : ptr; + hir.store v263, v237; + v1164 = arith.constant 0 : i32; + v1094, v1095, v1096, v1097, v1098, v1099, v1100 = scf.while v237, v1164, v1124, v1126 : i32, i32, i32, i32, i32, i32, i32 { + ^block123(v1101: i32, v1102: i32, v1103: i32, v1104: i32): + v267 = arith.add v1101, v1102 : i32 #[overflow = wrapping]; + v1162 = arith.constant 0 : i32; + v1163 = arith.constant 4 : i32; + v269 = arith.eq v1102, v1163 : i1; + v270 = arith.zext v269 : u32; + v271 = hir.bitcast v270 : i32; + v273 = arith.neq v271, v1162 : i1; + v1088 = scf.if v273 : i32 { + ^block122: + v1161 = ub.poison i32 : i32; + scf.yield v1161; + } else { + ^block29: + v277 = hir.bitcast v267 : u32; + v1160 = arith.constant 4 : u32; + v279 = arith.mod v277, v1160 : u32; + hir.assertz v279 #[code = 250]; + v280 = hir.int_to_ptr v277 : ptr; + v281 = hir.load v280 : felt; + v1159 = arith.constant 4 : i32; + v276 = arith.add v1103, v1159 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v276, v281) + v1158 = arith.constant 4 : i32; + v283 = arith.add v1102, v1158 : i32 #[overflow = wrapping]; + scf.yield v283; + }; + v1153 = ub.poison i32 : i32; + v1091 = cf.select v273, v1153, v1104 : i32; + v1154 = ub.poison i32 : i32; + v1090 = cf.select v273, v1154, v1103 : i32; + v1155 = ub.poison i32 : i32; + v1089 = cf.select v273, v1155, v1101 : i32; + v1156 = arith.constant 1 : u32; + v1157 = arith.constant 0 : u32; + v1093 = cf.select v273, v1157, v1156 : u32; + v1016 = arith.trunc v1093 : i1; + scf.condition v1016, v1089, v1088, v1090, v1091, v1103, v1104, v267; + } do { + ^block124(v1105: i32, v1106: i32, v1107: i32, v1108: i32, v1109: i32, v1110: i32, v1111: i32): + scf.yield v1105, v1106, v1107, v1108; + }; + v1152 = arith.constant 20 : u32; + v284 = hir.bitcast v1098 : u32; + v286 = arith.add v284, v1152 : u32 #[overflow = checked]; + v1151 = arith.constant 4 : u32; + v288 = arith.mod v286, v1151 : u32; + hir.assertz v288 #[code = 250]; + v289 = hir.int_to_ptr v286 : ptr; + hir.store v289, v1100; + v1150 = arith.constant 16 : i32; + v291 = arith.add v1098, v1150 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::drop_in_place>(v291) + v294 = arith.constant 8 : i32; + v1149 = arith.constant 4 : i32; + v297 = arith.add v1098, v1149 : i32 #[overflow = wrapping]; + v299 = arith.add v297, v294 : i32 #[overflow = wrapping]; + v300 = hir.bitcast v299 : u32; + v1148 = arith.constant 4 : u32; + v302 = arith.mod v300, v1148 : u32; + hir.assertz v302 #[code = 250]; + v303 = hir.int_to_ptr v300 : ptr; + v304 = hir.load v303 : i32; + v1147 = arith.constant 8 : i32; + v295 = arith.add v1099, v1147 : i32 #[overflow = wrapping]; + v305 = hir.bitcast v295 : u32; + v1146 = arith.constant 4 : u32; + v307 = arith.mod v305, v1146 : u32; + hir.assertz v307 #[code = 250]; + v308 = hir.int_to_ptr v305 : ptr; + hir.store v308, v304; + v1145 = arith.constant 4 : u32; + v309 = hir.bitcast v1098 : u32; + v311 = arith.add v309, v1145 : u32 #[overflow = checked]; + v1144 = arith.constant 4 : u32; + v313 = arith.mod v311, v1144 : u32; + hir.assertz v313 #[code = 250]; + v314 = hir.int_to_ptr v311 : ptr; + v315 = hir.load v314 : i64; + v316 = hir.bitcast v1099 : u32; + v1143 = arith.constant 4 : u32; + v318 = arith.mod v316, v1143 : u32; + hir.assertz v318 #[code = 250]; + v319 = hir.int_to_ptr v316 : ptr; + hir.store v319, v315; + v1142 = arith.constant 32 : i32; + v321 = arith.add v1098, v1142 : i32 #[overflow = wrapping]; + v322 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v323 = hir.bitcast v322 : ptr; + hir.store v323, v321; + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_dealloc(v324: i32, v325: i32, v326: i32) { + ^block30(v324: i32, v325: i32, v326: i32): + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_realloc(v327: i32, v328: i32, v329: i32, v330: i32) -> i32 { + ^block32(v327: i32, v328: i32, v329: i32, v330: i32): + v332 = arith.constant 1048604 : i32; + v333 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v332, v329, v330) : i32 + v1201 = arith.constant 0 : i32; + v334 = arith.constant 0 : i32; + v335 = arith.eq v333, v334 : i1; + v336 = arith.zext v335 : u32; + v337 = hir.bitcast v336 : i32; + v339 = arith.neq v337, v1201 : i1; + scf.if v339{ + ^block34: + scf.yield ; + } else { + ^block35: + v1200 = arith.constant 0 : i32; + v341 = hir.bitcast v328 : u32; + v340 = hir.bitcast v330 : u32; + v342 = arith.lt v340, v341 : i1; + v343 = arith.zext v342 : u32; + v344 = hir.bitcast v343 : i32; + v346 = arith.neq v344, v1200 : i1; + v347 = cf.select v346, v330, v328 : i32; + v1198 = arith.constant 0 : i32; + v1199 = arith.constant 0 : i32; + v349 = arith.eq v347, v1199 : i1; + v350 = arith.zext v349 : u32; + v351 = hir.bitcast v350 : i32; + v353 = arith.neq v351, v1198 : i1; + scf.if v353{ + ^block127: + scf.yield ; + } else { + ^block36: + v354 = hir.bitcast v347 : u32; + v355 = hir.bitcast v333 : u32; + v356 = hir.int_to_ptr v355 : ptr; + v357 = hir.bitcast v327 : u32; + v358 = hir.int_to_ptr v357 : ptr; + hir.mem_cpy v358, v356, v354; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v333; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v360: i32, v361: i32) -> i32 { + ^block37(v360: i32, v361: i32): + v363 = arith.constant 1048604 : i32; + v364 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v363, v361, v360) : i32 + v1210 = arith.constant 0 : i32; + v365 = arith.constant 0 : i32; + v366 = arith.eq v364, v365 : i1; + v367 = arith.zext v366 : u32; + v368 = hir.bitcast v367 : i32; + v370 = arith.neq v368, v1210 : i1; + scf.if v370{ + ^block39: + scf.yield ; + } else { + ^block40: + v1208 = arith.constant 0 : i32; + v1209 = arith.constant 0 : i32; + v372 = arith.eq v360, v1209 : i1; + v373 = arith.zext v372 : u32; + v374 = hir.bitcast v373 : i32; + v376 = arith.neq v374, v1208 : i1; + scf.if v376{ + ^block130: + scf.yield ; + } else { + ^block41: + v1202 = arith.constant 0 : u8; + v379 = hir.bitcast v360 : u32; + v380 = hir.bitcast v364 : u32; + v381 = hir.int_to_ptr v380 : ptr; + hir.mem_set v381, v379, v1202; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v364; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block42: + builtin.ret ; + }; + + private builtin.function @::alloc(v383: i32, v384: i32, v385: i32) -> i32 { + ^block44(v383: i32, v384: i32, v385: i32): + v388 = arith.constant 16 : i32; + v387 = arith.constant 0 : i32; + v1212 = arith.constant 16 : u32; + v390 = hir.bitcast v384 : u32; + v392 = arith.gt v390, v1212 : i1; + v393 = arith.zext v392 : u32; + v394 = hir.bitcast v393 : i32; + v396 = arith.neq v394, v387 : i1; + v397 = cf.select v396, v384, v388 : i32; + v1252 = arith.constant 0 : i32; + v398 = arith.constant -1 : i32; + v399 = arith.add v397, v398 : i32 #[overflow = wrapping]; + v400 = arith.band v397, v399 : i32; + v402 = arith.neq v400, v1252 : i1; + v1221, v1222 = scf.if v402 : i32, u32 { + ^block135: + v1213 = arith.constant 0 : u32; + v1217 = ub.poison i32 : i32; + scf.yield v1217, v1213; + } else { + ^block47: + v404 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::alignment::Alignment::max(v384, v397) : i32 + v1251 = arith.constant 0 : i32; + v403 = arith.constant -2147483648 : i32; + v405 = arith.sub v403, v404 : i32 #[overflow = wrapping]; + v407 = hir.bitcast v405 : u32; + v406 = hir.bitcast v385 : u32; + v408 = arith.gt v406, v407 : i1; + v409 = arith.zext v408 : u32; + v410 = hir.bitcast v409 : i32; + v412 = arith.neq v410, v1251 : i1; + v1236 = scf.if v412 : i32 { + ^block134: + v1250 = ub.poison i32 : i32; + scf.yield v1250; + } else { + ^block48: + v1248 = arith.constant 0 : i32; + v418 = arith.sub v1248, v404 : i32 #[overflow = wrapping]; + v1249 = arith.constant -1 : i32; + v414 = arith.add v385, v404 : i32 #[overflow = wrapping]; + v416 = arith.add v414, v1249 : i32 #[overflow = wrapping]; + v419 = arith.band v416, v418 : i32; + v420 = hir.bitcast v383 : u32; + v421 = arith.constant 4 : u32; + v422 = arith.mod v420, v421 : u32; + hir.assertz v422 #[code = 250]; + v423 = hir.int_to_ptr v420 : ptr; + v424 = hir.load v423 : i32; + v1247 = arith.constant 0 : i32; + v426 = arith.neq v424, v1247 : i1; + scf.if v426{ + ^block133: + scf.yield ; + } else { + ^block50: + v427 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/intrinsics::mem::heap_base() : i32 + v428 = hir.mem_size : u32; + v434 = hir.bitcast v383 : u32; + v1246 = arith.constant 4 : u32; + v436 = arith.mod v434, v1246 : u32; + hir.assertz v436 #[code = 250]; + v1245 = arith.constant 16 : u32; + v429 = hir.bitcast v428 : i32; + v432 = arith.shl v429, v1245 : i32; + v433 = arith.add v427, v432 : i32 #[overflow = wrapping]; + v437 = hir.int_to_ptr v434 : ptr; + hir.store v437, v433; + scf.yield ; + }; + v440 = hir.bitcast v383 : u32; + v1244 = arith.constant 4 : u32; + v442 = arith.mod v440, v1244 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + v444 = hir.load v443 : i32; + v1242 = arith.constant 0 : i32; + v1243 = arith.constant -1 : i32; + v446 = arith.bxor v444, v1243 : i32; + v448 = hir.bitcast v446 : u32; + v447 = hir.bitcast v419 : u32; + v449 = arith.gt v447, v448 : i1; + v450 = arith.zext v449 : u32; + v451 = hir.bitcast v450 : i32; + v453 = arith.neq v451, v1242 : i1; + v1235 = scf.if v453 : i32 { + ^block51: + v1241 = arith.constant 0 : i32; + scf.yield v1241; + } else { + ^block52: + v455 = hir.bitcast v383 : u32; + v1240 = arith.constant 4 : u32; + v457 = arith.mod v455, v1240 : u32; + hir.assertz v457 #[code = 250]; + v454 = arith.add v444, v419 : i32 #[overflow = wrapping]; + v458 = hir.int_to_ptr v455 : ptr; + hir.store v458, v454; + v460 = arith.add v444, v404 : i32 #[overflow = wrapping]; + scf.yield v460; + }; + scf.yield v1235; + }; + v1218 = arith.constant 1 : u32; + v1239 = arith.constant 0 : u32; + v1237 = cf.select v412, v1239, v1218 : u32; + scf.yield v1236, v1237; + }; + v1238 = arith.constant 0 : u32; + v1234 = arith.eq v1222, v1238 : i1; + cf.cond_br v1234 ^block46, ^block137(v1221); + ^block46: + ub.unreachable ; + ^block137(v1214: i32): + builtin.ret v1214; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block53: + v463 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v463; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v465: i32, v466: i32, v467: i32, v468: i32, v469: i32, v470: i32) { + ^block57(v465: i32, v466: i32, v467: i32, v468: i32, v469: i32, v470: i32): + v473 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v474 = hir.bitcast v473 : ptr; + v475 = hir.load v474 : i32; + v476 = arith.constant 32 : i32; + v477 = arith.sub v475, v476 : i32 #[overflow = wrapping]; + v478 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v479 = hir.bitcast v478 : ptr; + hir.store v479, v477; + v1329 = arith.constant 0 : i32; + v471 = arith.constant 0 : i32; + v482 = arith.eq v470, v471 : i1; + v483 = arith.zext v482 : u32; + v484 = hir.bitcast v483 : i32; + v486 = arith.neq v484, v1329 : i1; + v1300, v1301 = scf.if v486 : i32, i32 { + ^block60: + v1328 = arith.constant 0 : i32; + scf.yield v1328, v1328; + } else { + ^block61: + v487 = arith.add v467, v468 : i32 #[overflow = wrapping]; + v1327 = arith.constant 0 : i32; + v489 = hir.bitcast v467 : u32; + v488 = hir.bitcast v487 : u32; + v490 = arith.lt v488, v489 : i1; + v491 = arith.zext v490 : u32; + v492 = hir.bitcast v491 : i32; + v494 = arith.neq v492, v1327 : i1; + v1298, v1299 = scf.if v494 : i32, i32 { + ^block143: + v1326 = arith.constant 0 : i32; + scf.yield v1326, v1326; + } else { + ^block62: + v505 = hir.bitcast v466 : u32; + v619 = arith.constant 4 : u32; + v507 = arith.mod v505, v619 : u32; + hir.assertz v507 #[code = 250]; + v508 = hir.int_to_ptr v505 : ptr; + v509 = hir.load v508 : i32; + v1254 = arith.constant 1 : u32; + v512 = arith.shl v509, v1254 : i32; + v1325 = arith.constant 0 : i32; + v514 = hir.bitcast v512 : u32; + v513 = hir.bitcast v487 : u32; + v515 = arith.gt v513, v514 : i1; + v516 = arith.zext v515 : u32; + v517 = hir.bitcast v516 : i32; + v519 = arith.neq v517, v1325 : i1; + v520 = cf.select v519, v487, v512 : i32; + v1322 = arith.constant 1 : i32; + v522 = arith.constant 4 : i32; + v1323 = arith.constant 0 : i32; + v1253 = arith.constant 1025 : u32; + v525 = hir.bitcast v470 : u32; + v527 = arith.lt v525, v1253 : i1; + v528 = arith.zext v527 : u32; + v529 = hir.bitcast v528 : i32; + v531 = arith.neq v529, v1323 : i1; + v532 = cf.select v531, v522, v1322 : i32; + v521 = arith.constant 8 : i32; + v1324 = arith.constant 0 : i32; + v510 = arith.constant 1 : i32; + v534 = arith.eq v470, v510 : i1; + v535 = arith.zext v534 : u32; + v536 = hir.bitcast v535 : i32; + v538 = arith.neq v536, v1324 : i1; + v539 = cf.select v538, v521, v532 : i32; + v1321 = arith.constant 0 : i32; + v541 = hir.bitcast v539 : u32; + v540 = hir.bitcast v520 : u32; + v542 = arith.gt v540, v541 : i1; + v543 = arith.zext v542 : u32; + v544 = hir.bitcast v543 : i32; + v546 = arith.neq v544, v1321 : i1; + v547 = cf.select v546, v520, v539 : i32; + v548 = hir.bitcast v547 : u32; + v549 = arith.zext v548 : u64; + v550 = hir.bitcast v549 : i64; + v1320 = arith.constant 0 : i32; + v500 = arith.sub v1320, v469 : i32 #[overflow = wrapping]; + v497 = arith.constant -1 : i32; + v496 = arith.add v469, v470 : i32 #[overflow = wrapping]; + v498 = arith.add v496, v497 : i32 #[overflow = wrapping]; + v501 = arith.band v498, v500 : i32; + v502 = hir.bitcast v501 : u32; + v503 = arith.zext v502 : u64; + v504 = hir.bitcast v503 : i64; + v551 = arith.mul v504, v550 : i64 #[overflow = wrapping]; + v1319 = arith.constant 0 : i32; + v552 = arith.constant 32 : i64; + v554 = hir.cast v552 : u32; + v553 = hir.bitcast v551 : u64; + v555 = arith.shr v553, v554 : u64; + v556 = hir.bitcast v555 : i64; + v557 = arith.trunc v556 : i32; + v559 = arith.neq v557, v1319 : i1; + v1296, v1297 = scf.if v559 : i32, i32 { + ^block142: + v1318 = arith.constant 0 : i32; + scf.yield v520, v1318; + } else { + ^block63: + v560 = arith.trunc v551 : i32; + v1317 = arith.constant 0 : i32; + v561 = arith.constant -2147483648 : i32; + v562 = arith.sub v561, v469 : i32 #[overflow = wrapping]; + v564 = hir.bitcast v562 : u32; + v563 = hir.bitcast v560 : u32; + v565 = arith.gt v563, v564 : i1; + v566 = arith.zext v565 : u32; + v567 = hir.bitcast v566 : i32; + v569 = arith.neq v567, v1317 : i1; + v1294, v1295 = scf.if v569 : i32, i32 { + ^block141: + v1316 = arith.constant 0 : i32; + scf.yield v520, v1316; + } else { + ^block64: + v570 = arith.constant 20 : i32; + v571 = arith.add v477, v570 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v571, v466, v469, v470) + v1314 = arith.constant 20 : i32; + v575 = arith.add v477, v1314 : i32 #[overflow = wrapping]; + v1315 = arith.constant 8 : i32; + v573 = arith.add v477, v1315 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::finish_grow(v573, v469, v560, v575, v465) + v577 = arith.constant 12 : u32; + v576 = hir.bitcast v477 : u32; + v578 = arith.add v576, v577 : u32 #[overflow = checked]; + v1313 = arith.constant 4 : u32; + v580 = arith.mod v578, v1313 : u32; + hir.assertz v580 #[code = 250]; + v581 = hir.int_to_ptr v578 : ptr; + v582 = hir.load v581 : i32; + v584 = arith.constant 8 : u32; + v583 = hir.bitcast v477 : u32; + v585 = arith.add v583, v584 : u32 #[overflow = checked]; + v1312 = arith.constant 4 : u32; + v587 = arith.mod v585, v1312 : u32; + hir.assertz v587 #[code = 250]; + v588 = hir.int_to_ptr v585 : ptr; + v589 = hir.load v588 : i32; + v1310 = arith.constant 0 : i32; + v1311 = arith.constant 0 : i32; + v591 = arith.eq v589, v1311 : i1; + v592 = arith.zext v591 : u32; + v593 = hir.bitcast v592 : i32; + v595 = arith.neq v593, v1310 : i1; + v1292 = scf.if v595 : i32 { + ^block65: + v603 = hir.bitcast v466 : u32; + v1309 = arith.constant 4 : u32; + v605 = arith.mod v603, v1309 : u32; + hir.assertz v605 #[code = 250]; + v606 = hir.int_to_ptr v603 : ptr; + hir.store v606, v547; + v1308 = arith.constant 4 : u32; + v607 = hir.bitcast v466 : u32; + v609 = arith.add v607, v1308 : u32 #[overflow = checked]; + v1307 = arith.constant 4 : u32; + v611 = arith.mod v609, v1307 : u32; + hir.assertz v611 #[code = 250]; + v612 = hir.int_to_ptr v609 : ptr; + hir.store v612, v582; + scf.yield v520; + } else { + ^block66: + v597 = arith.constant 16 : u32; + v596 = hir.bitcast v477 : u32; + v598 = arith.add v596, v597 : u32 #[overflow = checked]; + v1306 = arith.constant 4 : u32; + v600 = arith.mod v598, v1306 : u32; + hir.assertz v600 #[code = 250]; + v601 = hir.int_to_ptr v598 : ptr; + v602 = hir.load v601 : i32; + scf.yield v602; + }; + v613 = arith.constant -2147483647 : i32; + v1293 = cf.select v595, v613, v582 : i32; + scf.yield v1292, v1293; + }; + scf.yield v1294, v1295; + }; + scf.yield v1296, v1297; + }; + scf.yield v1298, v1299; + }; + v1305 = arith.constant 4 : u32; + v618 = hir.bitcast v465 : u32; + v620 = arith.add v618, v1305 : u32 #[overflow = checked]; + v1304 = arith.constant 4 : u32; + v622 = arith.mod v620, v1304 : u32; + hir.assertz v622 #[code = 250]; + v623 = hir.int_to_ptr v620 : ptr; + hir.store v623, v1300; + v626 = hir.bitcast v465 : u32; + v1303 = arith.constant 4 : u32; + v628 = arith.mod v626, v1303 : u32; + hir.assertz v628 #[code = 250]; + v629 = hir.int_to_ptr v626 : ptr; + hir.store v629, v1301; + v1302 = arith.constant 32 : i32; + v633 = arith.add v477, v1302 : i32 #[overflow = wrapping]; + v634 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v635 = hir.bitcast v634 : ptr; + hir.store v635, v633; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v636: i32, v637: i32, v638: i32) { + ^block67(v636: i32, v637: i32, v638: i32): + v640 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v641 = hir.bitcast v640 : ptr; + v642 = hir.load v641 : i32; + v643 = arith.constant 16 : i32; + v644 = arith.sub v642, v643 : i32 #[overflow = wrapping]; + v645 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v646 = hir.bitcast v645 : ptr; + hir.store v646, v644; + v647 = arith.constant 4 : i32; + v648 = arith.add v644, v647 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v648, v636, v637, v638) + v650 = arith.constant 8 : u32; + v649 = hir.bitcast v644 : u32; + v651 = arith.add v649, v650 : u32 #[overflow = checked]; + v652 = arith.constant 4 : u32; + v653 = arith.mod v651, v652 : u32; + hir.assertz v653 #[code = 250]; + v654 = hir.int_to_ptr v651 : ptr; + v655 = hir.load v654 : i32; + v1336 = arith.constant 0 : i32; + v639 = arith.constant 0 : i32; + v657 = arith.eq v655, v639 : i1; + v658 = arith.zext v657 : u32; + v659 = hir.bitcast v658 : i32; + v661 = arith.neq v659, v1336 : i1; + scf.if v661{ + ^block149: + scf.yield ; + } else { + ^block70: + v1335 = arith.constant 4 : u32; + v662 = hir.bitcast v644 : u32; + v664 = arith.add v662, v1335 : u32 #[overflow = checked]; + v1334 = arith.constant 4 : u32; + v666 = arith.mod v664, v1334 : u32; + hir.assertz v666 #[code = 250]; + v667 = hir.int_to_ptr v664 : ptr; + v668 = hir.load v667 : i32; + v670 = arith.constant 12 : u32; + v669 = hir.bitcast v644 : u32; + v671 = arith.add v669, v670 : u32 #[overflow = checked]; + v1333 = arith.constant 4 : u32; + v673 = arith.mod v671, v1333 : u32; + hir.assertz v673 #[code = 250]; + v674 = hir.int_to_ptr v671 : ptr; + v675 = hir.load v674 : i32; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::deallocate(v668, v655, v675) + scf.yield ; + }; + v1332 = arith.constant 16 : i32; + v678 = arith.add v644, v1332 : i32 #[overflow = wrapping]; + v679 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v680 = hir.bitcast v679 : ptr; + hir.store v680, v678; + builtin.ret ; + }; + + private builtin.function @::allocate(v681: i32, v682: i32, v683: i32) { + ^block71(v681: i32, v682: i32, v683: i32): + v685 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v686 = hir.bitcast v685 : ptr; + v687 = hir.load v686 : i32; + v688 = arith.constant 16 : i32; + v689 = arith.sub v687, v688 : i32 #[overflow = wrapping]; + v690 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v691 = hir.bitcast v690 : ptr; + hir.store v691, v689; + v684 = arith.constant 0 : i32; + v692 = arith.constant 8 : i32; + v693 = arith.add v689, v692 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v693, v682, v683, v684) + v696 = arith.constant 12 : u32; + v695 = hir.bitcast v689 : u32; + v697 = arith.add v695, v696 : u32 #[overflow = checked]; + v698 = arith.constant 4 : u32; + v699 = arith.mod v697, v698 : u32; + hir.assertz v699 #[code = 250]; + v700 = hir.int_to_ptr v697 : ptr; + v701 = hir.load v700 : i32; + v703 = arith.constant 8 : u32; + v702 = hir.bitcast v689 : u32; + v704 = arith.add v702, v703 : u32 #[overflow = checked]; + v1341 = arith.constant 4 : u32; + v706 = arith.mod v704, v1341 : u32; + hir.assertz v706 #[code = 250]; + v707 = hir.int_to_ptr v704 : ptr; + v708 = hir.load v707 : i32; + v709 = hir.bitcast v681 : u32; + v1340 = arith.constant 4 : u32; + v711 = arith.mod v709, v1340 : u32; + hir.assertz v711 #[code = 250]; + v712 = hir.int_to_ptr v709 : ptr; + hir.store v712, v708; + v1339 = arith.constant 4 : u32; + v713 = hir.bitcast v681 : u32; + v715 = arith.add v713, v1339 : u32 #[overflow = checked]; + v1338 = arith.constant 4 : u32; + v717 = arith.mod v715, v1338 : u32; + hir.assertz v717 #[code = 250]; + v718 = hir.int_to_ptr v715 : ptr; + hir.store v718, v701; + v1337 = arith.constant 16 : i32; + v720 = arith.add v689, v1337 : i32 #[overflow = wrapping]; + v721 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v722 = hir.bitcast v721 : ptr; + hir.store v722, v720; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v723: i32, v724: i32, v725: i32, v726: i32) { + ^block73(v723: i32, v724: i32, v725: i32, v726: i32): + v1357 = arith.constant 0 : i32; + v727 = arith.constant 0 : i32; + v728 = arith.eq v725, v727 : i1; + v729 = arith.zext v728 : u32; + v730 = hir.bitcast v729 : i32; + v732 = arith.neq v730, v1357 : i1; + v1353 = scf.if v732 : i32 { + ^block151: + scf.yield v724; + } else { + ^block76: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1356 = arith.constant 0 : i32; + v734 = arith.neq v726, v1356 : i1; + v1352 = scf.if v734 : i32 { + ^block77: + v736 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc_zeroed(v725, v724) : i32 + scf.yield v736; + } else { + ^block78: + v735 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v725, v724) : i32 + scf.yield v735; + }; + scf.yield v1352; + }; + v740 = arith.constant 4 : u32; + v739 = hir.bitcast v723 : u32; + v741 = arith.add v739, v740 : u32 #[overflow = checked]; + v1355 = arith.constant 4 : u32; + v743 = arith.mod v741, v1355 : u32; + hir.assertz v743 #[code = 250]; + v744 = hir.int_to_ptr v741 : ptr; + hir.store v744, v725; + v746 = hir.bitcast v723 : u32; + v1354 = arith.constant 4 : u32; + v748 = arith.mod v746, v1354 : u32; + hir.assertz v748 #[code = 250]; + v749 = hir.int_to_ptr v746 : ptr; + hir.store v749, v1353; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v750: i32, v751: i32, v752: i32, v753: i32) { + ^block79(v750: i32, v751: i32, v752: i32, v753: i32): + v1383 = arith.constant 0 : i32; + v754 = arith.constant 0 : i32; + v758 = arith.eq v753, v754 : i1; + v759 = arith.zext v758 : u32; + v760 = hir.bitcast v759 : i32; + v762 = arith.neq v760, v1383 : i1; + v1370, v1371 = scf.if v762 : i32, i32 { + ^block155: + v1382 = arith.constant 0 : i32; + v756 = arith.constant 4 : i32; + scf.yield v756, v1382; + } else { + ^block82: + v763 = hir.bitcast v751 : u32; + v798 = arith.constant 4 : u32; + v765 = arith.mod v763, v798 : u32; + hir.assertz v765 #[code = 250]; + v766 = hir.int_to_ptr v763 : ptr; + v767 = hir.load v766 : i32; + v1380 = arith.constant 0 : i32; + v1381 = arith.constant 0 : i32; + v769 = arith.eq v767, v1381 : i1; + v770 = arith.zext v769 : u32; + v771 = hir.bitcast v770 : i32; + v773 = arith.neq v771, v1380 : i1; + v1368 = scf.if v773 : i32 { + ^block154: + v1379 = arith.constant 0 : i32; + scf.yield v1379; + } else { + ^block83: + v1378 = arith.constant 4 : u32; + v774 = hir.bitcast v750 : u32; + v776 = arith.add v774, v1378 : u32 #[overflow = checked]; + v1377 = arith.constant 4 : u32; + v778 = arith.mod v776, v1377 : u32; + hir.assertz v778 #[code = 250]; + v779 = hir.int_to_ptr v776 : ptr; + hir.store v779, v752; + v1376 = arith.constant 4 : u32; + v780 = hir.bitcast v751 : u32; + v782 = arith.add v780, v1376 : u32 #[overflow = checked]; + v1375 = arith.constant 4 : u32; + v784 = arith.mod v782, v1375 : u32; + hir.assertz v784 #[code = 250]; + v785 = hir.int_to_ptr v782 : ptr; + v786 = hir.load v785 : i32; + v787 = hir.bitcast v750 : u32; + v1374 = arith.constant 4 : u32; + v789 = arith.mod v787, v1374 : u32; + hir.assertz v789 #[code = 250]; + v790 = hir.int_to_ptr v787 : ptr; + hir.store v790, v786; + v791 = arith.mul v767, v753 : i32 #[overflow = wrapping]; + scf.yield v791; + }; + v792 = arith.constant 8 : i32; + v1373 = arith.constant 4 : i32; + v1369 = cf.select v773, v1373, v792 : i32; + scf.yield v1369, v1368; + }; + v795 = arith.add v750, v1370 : i32 #[overflow = wrapping]; + v797 = hir.bitcast v795 : u32; + v1372 = arith.constant 4 : u32; + v799 = arith.mod v797, v1372 : u32; + hir.assertz v799 #[code = 250]; + v800 = hir.int_to_ptr v797 : ptr; + hir.store v800, v1371; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::finish_grow(v801: i32, v802: i32, v803: i32, v804: i32, v805: i32) { + ^block84(v801: i32, v802: i32, v803: i32, v804: i32, v805: i32): + v807 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v808 = hir.bitcast v807 : ptr; + v809 = hir.load v808 : i32; + v810 = arith.constant 16 : i32; + v811 = arith.sub v809, v810 : i32 #[overflow = wrapping]; + v812 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v813 = hir.bitcast v812 : ptr; + hir.store v813, v811; + v1438 = arith.constant 0 : i32; + v806 = arith.constant 0 : i32; + v816 = arith.gte v803, v806 : i1; + v817 = arith.zext v816 : u32; + v818 = hir.bitcast v817 : i32; + v820 = arith.neq v818, v1438 : i1; + v1412, v1413 = scf.if v820 : i32, i32 { + ^block87: + v907 = arith.constant 4 : u32; + v823 = hir.bitcast v804 : u32; + v825 = arith.add v823, v907 : u32 #[overflow = checked]; + v1437 = arith.constant 4 : u32; + v827 = arith.mod v825, v1437 : u32; + hir.assertz v827 #[code = 250]; + v828 = hir.int_to_ptr v825 : ptr; + v829 = hir.load v828 : i32; + v1435 = arith.constant 0 : i32; + v1436 = arith.constant 0 : i32; + v831 = arith.eq v829, v1436 : i1; + v832 = arith.zext v831 : u32; + v833 = hir.bitcast v832 : i32; + v835 = arith.neq v833, v1435 : i1; + v1410, v1411 = scf.if v835 : i32, i32 { + ^block90: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v811, v802, v803) + v1434 = arith.constant 4 : u32; + v868 = hir.bitcast v811 : u32; + v870 = arith.add v868, v1434 : u32 #[overflow = checked]; + v1433 = arith.constant 4 : u32; + v872 = arith.mod v870, v1433 : u32; + hir.assertz v872 #[code = 250]; + v873 = hir.int_to_ptr v870 : ptr; + v874 = hir.load v873 : i32; + v875 = hir.bitcast v811 : u32; + v1432 = arith.constant 4 : u32; + v877 = arith.mod v875, v1432 : u32; + hir.assertz v877 #[code = 250]; + v878 = hir.int_to_ptr v875 : ptr; + v879 = hir.load v878 : i32; + scf.yield v879, v874; + } else { + ^block91: + v837 = arith.constant 8 : u32; + v836 = hir.bitcast v804 : u32; + v838 = arith.add v836, v837 : u32 #[overflow = checked]; + v1431 = arith.constant 4 : u32; + v840 = arith.mod v838, v1431 : u32; + hir.assertz v840 #[code = 250]; + v841 = hir.int_to_ptr v838 : ptr; + v842 = hir.load v841 : i32; + v1430 = arith.constant 0 : i32; + v844 = arith.neq v842, v1430 : i1; + v1408, v1409 = scf.if v844 : i32, i32 { + ^block92: + v862 = hir.bitcast v804 : u32; + v1429 = arith.constant 4 : u32; + v864 = arith.mod v862, v1429 : u32; + hir.assertz v864 #[code = 250]; + v865 = hir.int_to_ptr v862 : ptr; + v866 = hir.load v865 : i32; + v867 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_realloc(v866, v842, v802, v803) : i32 + scf.yield v867, v803; + } else { + ^block93: + v1428 = arith.constant 0 : i32; + v901 = arith.constant 8 : i32; + v846 = arith.add v811, v901 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v846, v802, v803, v1428) + v849 = arith.constant 12 : u32; + v848 = hir.bitcast v811 : u32; + v850 = arith.add v848, v849 : u32 #[overflow = checked]; + v1427 = arith.constant 4 : u32; + v852 = arith.mod v850, v1427 : u32; + hir.assertz v852 #[code = 250]; + v853 = hir.int_to_ptr v850 : ptr; + v854 = hir.load v853 : i32; + v1426 = arith.constant 8 : u32; + v855 = hir.bitcast v811 : u32; + v857 = arith.add v855, v1426 : u32 #[overflow = checked]; + v1425 = arith.constant 4 : u32; + v859 = arith.mod v857, v1425 : u32; + hir.assertz v859 #[code = 250]; + v860 = hir.int_to_ptr v857 : ptr; + v861 = hir.load v860 : i32; + scf.yield v861, v854; + }; + scf.yield v1408, v1409; + }; + v1424 = arith.constant 4 : u32; + v886 = hir.bitcast v801 : u32; + v888 = arith.add v886, v1424 : u32 #[overflow = checked]; + v1423 = arith.constant 4 : u32; + v890 = arith.mod v888, v1423 : u32; + hir.assertz v890 #[code = 250]; + v1422 = arith.constant 0 : i32; + v884 = arith.neq v1410, v1422 : i1; + v885 = cf.select v884, v1410, v802 : i32; + v891 = hir.int_to_ptr v888 : ptr; + hir.store v891, v885; + v1420 = arith.constant 0 : i32; + v898 = arith.eq v1410, v1420 : i1; + v899 = arith.zext v898 : u32; + v900 = hir.bitcast v899 : i32; + v1421 = arith.constant 0 : i32; + v895 = arith.neq v1410, v1421 : i1; + v896 = cf.select v895, v1411, v803 : i32; + scf.yield v896, v900; + } else { + ^block88: + v821 = arith.constant 1 : i32; + v1419 = arith.constant 0 : i32; + scf.yield v1419, v821; + }; + v822 = arith.constant 4 : i32; + v1418 = arith.constant 8 : i32; + v1414 = cf.select v820, v1418, v822 : i32; + v904 = arith.add v801, v1414 : i32 #[overflow = wrapping]; + v906 = hir.bitcast v904 : u32; + v1417 = arith.constant 4 : u32; + v908 = arith.mod v906, v1417 : u32; + hir.assertz v908 #[code = 250]; + v909 = hir.int_to_ptr v906 : ptr; + hir.store v909, v1412; + v911 = hir.bitcast v801 : u32; + v1416 = arith.constant 4 : u32; + v913 = arith.mod v911, v1416 : u32; + hir.assertz v913 #[code = 250]; + v914 = hir.int_to_ptr v911 : ptr; + hir.store v914, v1413; + v1415 = arith.constant 16 : i32; + v918 = arith.add v811, v1415 : i32 #[overflow = wrapping]; + v919 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v920 = hir.bitcast v919 : ptr; + hir.store v920, v918; + builtin.ret ; + }; + + private builtin.function @::deallocate(v921: i32, v922: i32, v923: i32) { + ^block94(v921: i32, v922: i32, v923: i32): + v1440 = arith.constant 0 : i32; + v924 = arith.constant 0 : i32; + v925 = arith.eq v923, v924 : i1; + v926 = arith.zext v925 : u32; + v927 = hir.bitcast v926 : i32; + v929 = arith.neq v927, v1440 : i1; + scf.if v929{ + ^block96: + scf.yield ; + } else { + ^block97: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_dealloc(v921, v923, v922) + scf.yield ; + }; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v930: i32, v931: i32, v932: i32) { + ^block98(v930: i32, v931: i32, v932: i32): + ub.unreachable ; + }; + + private builtin.function @alloc::alloc::handle_alloc_error(v933: i32, v934: i32) { + ^block100(v933: i32, v934: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v935: i32, v936: i32) -> i32 { + ^block102(v935: i32, v936: i32): + v943 = arith.constant 0 : i32; + v939 = hir.bitcast v936 : u32; + v938 = hir.bitcast v935 : u32; + v940 = arith.gt v938, v939 : i1; + v941 = arith.zext v940 : u32; + v942 = hir.bitcast v941 : i32; + v944 = arith.neq v942, v943 : i1; + v945 = cf.select v944, v935, v936 : i32; + builtin.ret v945; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; + }; +}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.masm b/felt-repr/tests/expected/onchain_two_felts_struct.masm new file mode 100644 index 000000000..e20a43583 --- /dev/null +++ b/felt-repr/tests/expected/onchain_two_felts_struct.masm @@ -0,0 +1,2561 @@ +# mod root_ns:root@1.0.0 + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 +end + +# mod root_ns:root@1.0.0::onchain_two_felts_struct + +@callconv("C") +proc core::ptr::drop_in_place>( + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + push.8 + dup.2 + u32wrapping_add + dup.1 + swap.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::deallocate + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::vec::Vec::push(i32, felt) + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + dup.2 + neq + neq + if.true + nop + else + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVec::grow_one + trace.252 + nop + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + dup.2 + swap.1 + u32shl + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVec::grow_one(i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + push.1 + push.8 + dup.4 + u32wrapping_add + dup.2 + movup.2 + swap.3 + swap.4 + movdn.2 + swap.5 + swap.6 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::grow_amortized + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2147483649 + dup.2 + eq + neq + if.true + drop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc alloc::alloc::exchange_malloc( + +) -> i32 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.4 + dup.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_alloc + trace.252 + nop + push.0 + dup.1 + neq + if.true + nop + else + drop + push.4 + dup.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::handle_alloc_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop +end + +@callconv("C") +pub proc entrypoint(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + push.4 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::exchange_malloc + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.4 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + movup.2 + swap.3 + movdn.2 + swap.1 + push.1 + while.true + dup.0 + dup.2 + u32wrapping_add + push.0 + push.4 + dup.4 + eq + neq + dup.0 + if.true + movup.3 + drop + push.3735929054 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + movup.4 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.8 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.8 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.8 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.8 + movdn.2 + cdrop + push.1 + push.0 + movup.6 + cdrop + push.1 + u32and + movup.3 + swap.5 + swap.9 + swap.8 + swap.7 + swap.6 + movdn.3 + movup.2 + swap.4 + movdn.2 + if.true + movup.5 + drop + movup.5 + drop + movup.5 + drop + movup.5 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::core::ptr::drop_in_place> + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::exchange_malloc + trace.252 + nop + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.28 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.4 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.24 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + push.1 + while.true + dup.0 + dup.2 + u32wrapping_add + push.0 + push.4 + dup.4 + eq + neq + dup.0 + if.true + movup.3 + drop + push.3735929054 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + movup.4 + u32wrapping_add + end + push.3735929054 + dup.2 + dup.7 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.3 + dup.7 + swap.2 + swap.1 + cdrop + push.3735929054 + dup.4 + movup.2 + swap.7 + movdn.2 + cdrop + push.1 + push.0 + movup.5 + cdrop + push.1 + u32and + movup.2 + swap.4 + swap.7 + swap.6 + swap.5 + swap.3 + movdn.2 + if.true + movup.4 + drop + movup.4 + drop + movup.4 + drop + push.1 + else + push.0 + end + end + drop + drop + drop + drop + push.20 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.1 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::core::ptr::drop_in_place> + trace.252 + nop + push.8 + push.4 + dup.2 + u32wrapping_add + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_dealloc(i32, i32, i32) + drop + drop + drop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 + swap.2 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + movdn.3 + drop + drop + drop + else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + drop + else + dup.2 + movup.2 + push.0 + dup.3 + push.0 + gte + while.true + dup.2 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.4 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::grow_amortized( + i32, + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.8 + eq + neq + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + movup.4 + dup.4 + u32wrapping_add + push.0 + movup.5 + dup.2 + swap.1 + u32lt + neq + if.true + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32shl + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + push.1 + push.4 + push.0 + push.1025 + dup.9 + swap.1 + u32lt + neq + cdrop + push.8 + push.0 + push.1 + dup.9 + eq + neq + cdrop + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + dup.2 + swap.1 + cdrop + dup.0 + push.0 + push.0 + dup.8 + u32wrapping_sub + push.4294967295 + dup.9 + dup.11 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + drop + push.0 + push.2147483648 + dup.8 + u32wrapping_sub + dup.2 + swap.1 + u32gt + neq + if.true + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + push.20 + dup.4 + u32wrapping_add + dup.6 + dup.8 + movup.3 + swap.10 + movdn.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.20 + dup.3 + u32wrapping_add + push.8 + dup.4 + u32wrapping_add + dup.5 + movup.2 + swap.3 + swap.9 + movdn.2 + swap.4 + swap.8 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::finish_grow + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.4 + else + movup.2 + swap.6 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.4 + drop + drop + drop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + end + push.2147483649 + movdn.2 + movdn.3 + cdrop + swap.1 + end + end + end + end + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::deallocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + u32wrapping_add + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + else + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + movdn.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::deallocate + trace.252 + nop + end + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) + movup.4 + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::i32::is_gte + trace.252 + nop + neq + dup.0 + if.true + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + movup.5 + drop + dup.4 + dup.4 + dup.3 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::allocate + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + neq + if.true + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.5 + dup.7 + swap.3 + swap.1 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_realloc + trace.252 + nop + dup.5 + swap.1 + else + movup.6 + swap.1 + drop + drop + push.0 + push.8 + dup.3 + u32wrapping_add + dup.5 + dup.7 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + end + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + dup.2 + neq + dup.2 + movup.2 + swap.8 + movdn.2 + swap.1 + cdrop + movup.6 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + dup.1 + eq + push.0 + movup.2 + neq + swap.1 + swap.6 + swap.2 + swap.1 + cdrop + movup.4 + swap.1 + else + movup.2 + swap.5 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.3 + drop + drop + drop + push.1 + push.0 + end + push.4 + push.8 + movup.4 + cdrop + dup.4 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::deallocate( + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + drop + drop + drop + else + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_dealloc + trace.252 + nop + end +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc alloc::alloc::handle_alloc_error(i32, i32) + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.wat b/felt-repr/tests/expected/onchain_two_felts_struct.wat new file mode 100644 index 000000000..e67e1e1d1 --- /dev/null +++ b/felt-repr/tests/expected/onchain_two_felts_struct.wat @@ -0,0 +1,761 @@ +(module $onchain_two_felts_struct.wasm + (type (;0;) (func (param i32))) + (type (;1;) (func (param i32 f32))) + (type (;2;) (func (result i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param i32 i32))) + (type (;5;) (func (param i32 i32 i32))) + (type (;6;) (func (param i32 i32 i32 i32) (result i32))) + (type (;7;) (func)) + (type (;8;) (func (param i32 i32 i32) (result i32))) + (type (;9;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32 i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $core::ptr::drop_in_place> (;0;) (type 0) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + local.get 0 + i32.load + i32.store offset=12 + local.get 1 + local.get 0 + i32.load offset=8 + i32.store offset=8 + local.get 1 + i32.const 8 + i32.add + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::deallocate + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::vec::Vec::push (;1;) (type 1) (param i32 f32) + (local i32) + block ;; label = @1 + local.get 0 + i32.load offset=8 + local.tee 2 + local.get 0 + i32.load + i32.ne + br_if 0 (;@1;) + local.get 0 + call $alloc::raw_vec::RawVec::grow_one + end + local.get 0 + i32.load offset=4 + local.get 2 + i32.const 2 + i32.shl + i32.add + local.get 1 + f32.store + local.get 0 + local.get 2 + i32.const 1 + i32.add + i32.store offset=8 + ) + (func $alloc::raw_vec::RawVec::grow_one (;2;) (type 0) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 8 + i32.add + local.get 0 + local.get 0 + i32.load + i32.const 1 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::grow_amortized + block ;; label = @1 + local.get 1 + i32.load offset=8 + local.tee 0 + i32.const -2147483647 + i32.eq + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.load offset=12 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::exchange_malloc (;3;) (type 2) (result i32) + (local i32) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @1 + i32.const 4 + i32.const 4 + call $__rustc::__rust_alloc + local.tee 0 + br_if 0 (;@1;) + i32.const 4 + i32.const 4 + call $alloc::alloc::handle_alloc_error + unreachable + end + local.get 0 + ) + (func $__rustc::__rust_alloc (;4;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $entrypoint (;5;) (type 4) (param i32 i32) + (local i32 f32 f32 i32 i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=4 + local.set 3 + local.get 1 + f32.load + local.set 4 + i32.const 0 + local.set 1 + local.get 2 + i32.const 0 + i32.store offset=12 + local.get 2 + i64.const 17179869184 + i64.store offset=4 align=4 + call $alloc::alloc::exchange_malloc + local.tee 5 + local.get 4 + f32.store + local.get 2 + local.get 5 + i32.const 4 + i32.add + i32.store offset=28 + local.get 2 + i32.const 1 + i32.store offset=24 + local.get 2 + local.get 5 + i32.store offset=16 + block ;; label = @1 + loop ;; label = @2 + local.get 5 + local.get 1 + i32.add + local.set 6 + local.get 1 + i32.const 4 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 4 + i32.add + local.get 6 + f32.load + call $alloc::vec::Vec::push + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + local.get 6 + i32.store offset=20 + local.get 2 + i32.const 16 + i32.add + call $core::ptr::drop_in_place> + call $alloc::alloc::exchange_malloc + local.tee 5 + local.get 3 + f32.store + local.get 2 + local.get 5 + i32.const 4 + i32.add + i32.store offset=28 + local.get 2 + i32.const 1 + i32.store offset=24 + local.get 2 + local.get 5 + i32.store offset=16 + i32.const 0 + local.set 1 + block ;; label = @1 + loop ;; label = @2 + local.get 5 + local.get 1 + i32.add + local.set 6 + local.get 1 + i32.const 4 + i32.eq + br_if 1 (;@1;) + local.get 2 + i32.const 4 + i32.add + local.get 6 + f32.load + call $alloc::vec::Vec::push + local.get 1 + i32.const 4 + i32.add + local.set 1 + br 0 (;@2;) + end + end + local.get 2 + local.get 6 + i32.store offset=20 + local.get 2 + i32.const 16 + i32.add + call $core::ptr::drop_in_place> + local.get 0 + i32.const 8 + i32.add + local.get 2 + i32.const 4 + i32.add + i32.const 8 + i32.add + i32.load + i32.store + local.get 0 + local.get 2 + i64.load offset=4 align=4 + i64.store align=4 + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $__rustc::__rust_dealloc (;6;) (type 5) (param i32 i32 i32)) + (func $__rustc::__rust_realloc (;7;) (type 6) (param i32 i32 i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 2 + local.get 3 + call $::alloc + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 1 + local.get 3 + local.get 1 + i32.lt_u + select + local.tee 3 + i32.eqz + br_if 0 (;@1;) + local.get 2 + local.get 0 + local.get 3 + memory.copy + end + local.get 2 + ) + (func $__rustc::__rust_alloc_zeroed (;8;) (type 3) (param i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;9;) (type 7) + return + ) + (func $::alloc (;10;) (type 8) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;11;) (type 2) (result i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;12;) (type 9) (param i32 i32 i32 i32 i32 i32) + (local i32 i32 i32 i64) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 6 + global.set $__stack_pointer + i32.const 0 + local.set 7 + block ;; label = @1 + block ;; label = @2 + local.get 5 + i32.eqz + br_if 0 (;@2;) + local.get 2 + local.get 3 + i32.add + local.tee 3 + local.get 2 + i32.lt_u + br_if 1 (;@1;) + i32.const 0 + local.set 7 + local.get 4 + local.get 5 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 4 + i32.sub + i32.and + i64.extend_i32_u + local.get 3 + local.get 1 + i32.load + i32.const 1 + i32.shl + local.tee 8 + local.get 3 + local.get 8 + i32.gt_u + select + local.tee 8 + i32.const 8 + i32.const 4 + i32.const 1 + local.get 5 + i32.const 1025 + i32.lt_u + select + local.get 5 + i32.const 1 + i32.eq + select + local.tee 2 + local.get 8 + local.get 2 + i32.gt_u + select + local.tee 2 + i64.extend_i32_u + i64.mul + local.tee 9 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@2;) + local.get 9 + i32.wrap_i64 + local.tee 3 + i32.const -2147483648 + local.get 4 + i32.sub + i32.gt_u + br_if 1 (;@1;) + local.get 6 + i32.const 20 + i32.add + local.get 1 + local.get 4 + local.get 5 + call $alloc::raw_vec::RawVecInner::current_memory + local.get 6 + i32.const 8 + i32.add + local.get 4 + local.get 3 + local.get 6 + i32.const 20 + i32.add + local.get 0 + call $alloc::raw_vec::finish_grow + local.get 6 + i32.load offset=12 + local.set 7 + block ;; label = @3 + local.get 6 + i32.load offset=8 + i32.eqz + br_if 0 (;@3;) + local.get 6 + i32.load offset=16 + local.set 8 + br 2 (;@1;) + end + local.get 1 + local.get 2 + i32.store + local.get 1 + local.get 7 + i32.store offset=4 + i32.const -2147483647 + local.set 7 + br 1 (;@1;) + end + end + local.get 0 + local.get 8 + i32.store offset=4 + local.get 0 + local.get 7 + i32.store + local.get 6 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 5) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 4 + i32.add + local.get 0 + local.get 1 + local.get 2 + call $alloc::raw_vec::RawVecInner::current_memory + block ;; label = @1 + local.get 3 + i32.load offset=8 + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + i32.load offset=4 + local.get 2 + local.get 3 + i32.load offset=12 + call $::deallocate + end + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;14;) (type 5) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;15;) (type 10) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;16;) (type 10) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $alloc::raw_vec::finish_grow (;17;) (type 11) (param i32 i32 i32 i32 i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + i32.const 0 + local.set 6 + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.const 0 + i32.ge_s + br_if 0 (;@2;) + i32.const 1 + local.set 2 + i32.const 4 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 3 + i32.load offset=4 + i32.eqz + br_if 0 (;@3;) + block ;; label = @4 + local.get 3 + i32.load offset=8 + local.tee 6 + br_if 0 (;@4;) + local.get 5 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load offset=12 + local.set 6 + local.get 5 + i32.load offset=8 + local.set 3 + br 2 (;@2;) + end + local.get 3 + i32.load + local.get 6 + local.get 1 + local.get 2 + call $__rustc::__rust_realloc + local.set 3 + local.get 2 + local.set 6 + br 1 (;@2;) + end + local.get 5 + local.get 1 + local.get 2 + call $::allocate + local.get 5 + i32.load offset=4 + local.set 6 + local.get 5 + i32.load + local.set 3 + end + local.get 0 + local.get 3 + local.get 1 + local.get 3 + select + i32.store offset=4 + local.get 6 + local.get 2 + local.get 3 + select + local.set 6 + local.get 3 + i32.eqz + local.set 2 + i32.const 8 + local.set 3 + end + local.get 0 + local.get 3 + i32.add + local.get 6 + i32.store + local.get 0 + local.get 2 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::deallocate (;18;) (type 5) (param i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + local.get 1 + call $__rustc::__rust_dealloc + end + ) + (func $alloc::raw_vec::handle_error (;19;) (type 5) (param i32 i32 i32) + unreachable + ) + (func $alloc::alloc::handle_alloc_error (;20;) (type 4) (param i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;21;) (type 3) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") +) diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index e102272f0..6755c7b40 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -9,6 +9,7 @@ use miden_core::{Felt, FieldElement}; use miden_debug::Felt as TestFelt; use miden_felt_repr_offchain::{FeltReader, FromFeltRepr, ToFeltRepr}; use miden_integration_tests::testing::{eval_package, Initializer}; +use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use crate::build_felt_repr_test; @@ -76,10 +77,12 @@ fn felt_reader() { /// Test full round-trip using the actual FromFeltRepr and ToFeltRepr from onchain crate. /// +/// Test struct serialization with 2 Felt fields. +/// /// This tests the full flow: off-chain serialize -> on-chain deserialize via derive /// -> on-chain serialize -> off-chain deserialize. #[test] -fn from_to_felt_repr() { +fn two_felts_struct_round_trip() { let original = TwoFelts { a: Felt::new(12345), b: Felt::new(67890), @@ -90,19 +93,25 @@ fn from_to_felt_repr() { use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; #[derive(FromFeltRepr, ToFeltRepr)] - struct OnchainTwoFelts { + struct TestStruct { a: Felt, b: Felt, } let mut reader = FeltReader::new(&input); - let deserialized = OnchainTwoFelts::from_felt_repr(&mut reader); + let deserialized = TestStruct::from_felt_repr(&mut reader); deserialized.to_felt_repr() }"#; let config = WasmTranslationConfig::default(); - let mut test = build_felt_repr_test("onchain_from_to_felt_repr", onchain_code, config); + let artifact_name = "onchain_two_felts_struct"; + let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + + test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); + let package = test.compiled_package(); let in_elem_addr = 21u32 * 16384; @@ -150,3 +159,63 @@ fn from_to_felt_repr() { }) .unwrap(); } + +/// Test struct serialization with 4 Felt fields. +#[test] +fn four_felts_struct_round_trip() { + let onchain_code = r#"(input: [Felt; 4]) -> Vec { + use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + a: Felt, + b: Felt, + c: Felt, + d: Felt, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let artifact_name = "onchain_four_felts_struct"; + let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + + test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); + + let _package = test.compiled_package(); +} + +/// Test struct serialization with 5 Felt fields - triggers spills issue. +#[test] +#[should_panic(expected = "not yet implemented")] +fn five_felts_struct_round_trip() { + let onchain_code = r#"(input: [Felt; 5]) -> Vec { + use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + a: Felt, + b: Felt, + c: Felt, + d: Felt, + e: Felt, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let mut test = build_felt_repr_test("onchain_five_felts_struct", onchain_code, config); + + // This will panic with "not yet implemented" due to spills issue + let _package = test.compiled_package(); +} From 07e2ed3507b06db314ad12654022254270d1898b Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Mon, 8 Dec 2025 16:43:08 +0200 Subject: [PATCH 08/15] refactor: introduce `FeltWriter` in felt-repr crates --- felt-repr/derive/src/lib.rs | 17 +- felt-repr/offchain/src/account_id.rs | 10 +- felt-repr/offchain/src/lib.rs | 48 +- felt-repr/onchain/src/lib.rs | 50 +- .../expected/onchain_five_felts_struct.hir | 1012 ++++++++ .../expected/onchain_five_felts_struct.masm | 1942 ++++++++++++++ .../expected/onchain_five_felts_struct.wat | 613 +++++ .../expected/onchain_four_felts_struct.hir | 2296 +++++++---------- .../expected/onchain_four_felts_struct.masm | 1356 +--------- .../expected/onchain_four_felts_struct.wat | 348 +-- .../expected/onchain_two_felts_struct.hir | 2070 +++++++-------- .../expected/onchain_two_felts_struct.masm | 902 +------ .../expected/onchain_two_felts_struct.wat | 260 +- felt-repr/tests/src/onchain.rs | 11 +- 14 files changed, 5716 insertions(+), 5219 deletions(-) create mode 100644 felt-repr/tests/expected/onchain_five_felts_struct.hir create mode 100644 felt-repr/tests/expected/onchain_five_felts_struct.masm create mode 100644 felt-repr/tests/expected/onchain_five_felts_struct.wat diff --git a/felt-repr/derive/src/lib.rs b/felt-repr/derive/src/lib.rs index 1ffbe11a7..87bac90c8 100644 --- a/felt-repr/derive/src/lib.rs +++ b/felt-repr/derive/src/lib.rs @@ -148,10 +148,8 @@ fn derive_to_felt_repr_impl(input: &DeriveInput) -> Result { let expanded = quote! { impl #impl_generics miden_felt_repr_offchain::ToFeltRepr for #name #ty_generics #where_clause { - fn to_felt_repr(&self) -> alloc::vec::Vec { - let mut result = alloc::vec::Vec::new(); - #(result.extend(miden_felt_repr_offchain::ToFeltRepr::to_felt_repr(&self.#field_names));)* - result + fn write_felt_repr(&self, writer: &mut miden_felt_repr_offchain::FeltWriter<'_>) { + #(miden_felt_repr_offchain::ToFeltRepr::write_felt_repr(&self.#field_names, writer);)* } } }; @@ -216,18 +214,11 @@ fn derive_to_felt_repr_onchain_impl(input: &DeriveInput) -> Result = fields.iter().map(|field| field.ident.as_ref().unwrap()).collect(); - // Use for loop with push instead of extend to work around Wasm compilation issue with extend let expanded = quote! { impl #impl_generics miden_felt_repr_onchain::ToFeltRepr for #name #ty_generics #where_clause { #[inline(always)] - fn to_felt_repr(&self) -> alloc::vec::Vec { - let mut result = alloc::vec::Vec::new(); - #( - for item in miden_felt_repr_onchain::ToFeltRepr::to_felt_repr(&self.#field_names) { - result.push(item); - } - )* - result + fn write_felt_repr(&self, writer: &mut miden_felt_repr_onchain::FeltWriter<'_>) { + #(miden_felt_repr_onchain::ToFeltRepr::write_felt_repr(&self.#field_names, writer);)* } } }; diff --git a/felt-repr/offchain/src/account_id.rs b/felt-repr/offchain/src/account_id.rs index d033ffe90..140e9561f 100644 --- a/felt-repr/offchain/src/account_id.rs +++ b/felt-repr/offchain/src/account_id.rs @@ -1,11 +1,8 @@ //! AccountId wrapper for felt representation serialization. -use alloc::vec::Vec; - -use miden_core::Felt; use miden_objects::account::AccountId; -use crate::ToFeltRepr; +use crate::{FeltWriter, ToFeltRepr}; /// Wrapper around `AccountId` that implements `ToFeltRepr`. /// @@ -20,7 +17,8 @@ impl<'a> From<&'a AccountId> for AccountIdFeltRepr<'a> { } impl ToFeltRepr for AccountIdFeltRepr<'_> { - fn to_felt_repr(&self) -> Vec { - Vec::from([self.0.prefix().as_felt(), self.0.suffix()]) + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(self.0.prefix().as_felt()); + writer.write(self.0.suffix()); } } diff --git a/felt-repr/offchain/src/lib.rs b/felt-repr/offchain/src/lib.rs index 0ae66ea1d..d14783fa3 100644 --- a/felt-repr/offchain/src/lib.rs +++ b/felt-repr/offchain/src/lib.rs @@ -7,7 +7,7 @@ extern crate alloc; mod account_id; -use alloc::{vec, vec::Vec}; +use alloc::vec::Vec; pub use account_id::AccountIdFeltRepr; use miden_core::Felt; @@ -35,13 +35,29 @@ impl<'a> FeltReader<'a> { } } +/// A writer that wraps a `Vec` and appends elements to it. +pub struct FeltWriter<'a> { + data: &'a mut Vec, +} + +impl<'a> FeltWriter<'a> { + /// Creates a new `FeltWriter` from a mutable reference to a `Vec`. + pub fn new(data: &'a mut Vec) -> Self { + Self { data } + } + + /// Writes a `Felt` element to the output. + pub fn write(&mut self, felt: Felt) { + self.data.push(felt); + } +} + /// Trait for deserialization from felt memory representation. pub trait FromFeltRepr: Sized { /// Deserializes from a `FeltReader`, consuming the required elements. fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self; } -/// Base implementation for `Felt` itself. impl FromFeltRepr for Felt { fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { reader.read() @@ -68,31 +84,37 @@ impl FromFeltRepr for u8 { /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { - /// Serializes this value into a vector of `Felt` elements. - fn to_felt_repr(&self) -> Vec; + /// Writes this value's felt representation to the writer. + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>); + + /// Convenience method that allocates and returns a `Vec`. + fn to_felt_repr(&self) -> Vec { + let mut data = Vec::new(); + self.write_felt_repr(&mut FeltWriter::new(&mut data)); + data + } } -/// Base implementation for `Felt` itself. impl ToFeltRepr for Felt { - fn to_felt_repr(&self) -> Vec { - vec![*self] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(*self); } } impl ToFeltRepr for u64 { - fn to_felt_repr(&self) -> Vec { - vec![Felt::new(*self)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::new(*self)); } } impl ToFeltRepr for u32 { - fn to_felt_repr(&self) -> Vec { - vec![Felt::new(*self as u64)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::new(*self as u64)); } } impl ToFeltRepr for u8 { - fn to_felt_repr(&self) -> Vec { - vec![Felt::new(*self as u64)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::new(*self as u64)); } } diff --git a/felt-repr/onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs index 93d906b99..c24fefcb6 100644 --- a/felt-repr/onchain/src/lib.rs +++ b/felt-repr/onchain/src/lib.rs @@ -5,7 +5,7 @@ extern crate alloc; -use alloc::{vec, vec::Vec}; +use alloc::vec::Vec; /// Re-export the derive macros with the same name as the traits. pub use miden_felt_repr_derive::DeriveFromFeltRepr as FromFeltRepr; @@ -34,13 +34,31 @@ impl<'a> FeltReader<'a> { } } +/// A writer that wraps a `Vec` and appends elements to it. +pub struct FeltWriter<'a> { + data: &'a mut Vec, +} + +impl<'a> FeltWriter<'a> { + /// Creates a new `FeltWriter` from a mutable reference to a `Vec`. + #[inline(always)] + pub fn new(data: &'a mut Vec) -> Self { + Self { data } + } + + /// Writes a `Felt` element to the output. + #[inline(always)] + pub fn write(&mut self, felt: Felt) { + self.data.push(felt); + } +} + /// Trait for deserialization from felt memory representation. pub trait FromFeltRepr: Sized { /// Deserializes from a `FeltReader`, consuming the required elements. fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self; } -/// Base implementation for `Felt` itself. impl FromFeltRepr for Felt { #[inline(always)] fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { @@ -71,35 +89,41 @@ impl FromFeltRepr for u8 { /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { - /// Serializes this value into a vector of `Felt` elements. - fn to_felt_repr(&self) -> Vec; + /// Writes this value's felt representation to the writer. + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>); + + /// Convenience method that allocates and returns a `Vec`. + fn to_felt_repr(&self) -> Vec { + let mut data = Vec::new(); + self.write_felt_repr(&mut FeltWriter::new(&mut data)); + data + } } -/// Base implementation for `Felt` itself. impl ToFeltRepr for Felt { #[inline(always)] - fn to_felt_repr(&self) -> Vec { - vec![*self] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(*self); } } impl ToFeltRepr for u64 { #[inline(always)] - fn to_felt_repr(&self) -> Vec { - vec![Felt::from_u64_unchecked(*self)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from_u64_unchecked(*self)); } } impl ToFeltRepr for u32 { #[inline(always)] - fn to_felt_repr(&self) -> Vec { - vec![Felt::from(*self)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from(*self)); } } impl ToFeltRepr for u8 { #[inline(always)] - fn to_felt_repr(&self) -> Vec { - vec![Felt::from(*self as u32)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from(*self as u32)); } } diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.hir b/felt-repr/tests/expected/onchain_five_felts_struct.hir new file mode 100644 index 000000000..1dcd2dd8e --- /dev/null +++ b/felt-repr/tests/expected/onchain_five_felts_struct.hir @@ -0,0 +1,1012 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @onchain_five_felts_struct { + private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { + ^block4(v0: i32, v1: felt): + v4 = arith.constant 8 : u32; + v3 = hir.bitcast v0 : u32; + v5 = arith.add v3, v4 : u32 #[overflow = checked]; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : i32; + v10 = hir.bitcast v0 : u32; + v764 = arith.constant 4 : u32; + v12 = arith.mod v10, v764 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v2 = arith.constant 0 : i32; + v15 = arith.neq v9, v14 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v2 : i1; + scf.if v19{ + ^block78: + scf.yield ; + } else { + ^block7: + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) + scf.yield ; + }; + v763 = arith.constant 4 : u32; + v21 = hir.bitcast v0 : u32; + v23 = arith.add v21, v763 : u32 #[overflow = checked]; + v762 = arith.constant 4 : u32; + v25 = arith.mod v23, v762 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; + v754 = arith.constant 2 : u32; + v31 = arith.shl v9, v754 : i32; + v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; + v34 = hir.bitcast v32 : u32; + v761 = arith.constant 4 : u32; + v36 = arith.mod v34, v761 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v1; + v760 = arith.constant 8 : u32; + v40 = hir.bitcast v0 : u32; + v42 = arith.add v40, v760 : u32 #[overflow = checked]; + v759 = arith.constant 4 : u32; + v44 = arith.mod v42, v759 : u32; + hir.assertz v44 #[code = 250]; + v38 = arith.constant 1 : i32; + v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { + ^block8(v46: i32): + v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 16 : i32; + v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v54 = hir.bitcast v53 : ptr; + hir.store v54, v52; + v57 = hir.bitcast v46 : u32; + v58 = arith.constant 4 : u32; + v59 = arith.mod v57, v58 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i32; + v63 = arith.constant 4 : i32; + v62 = arith.constant 1 : i32; + v55 = arith.constant 8 : i32; + v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) + v66 = arith.constant 8 : u32; + v65 = hir.bitcast v52 : u32; + v67 = arith.add v65, v66 : u32 #[overflow = checked]; + v768 = arith.constant 4 : u32; + v69 = arith.mod v67, v768 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v47 = arith.constant 0 : i32; + v72 = arith.constant -2147483647 : i32; + v73 = arith.eq v71, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v47 : i1; + cf.cond_br v77 ^block10, ^block11; + ^block10: + v767 = arith.constant 16 : i32; + v87 = arith.add v52, v767 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; + builtin.ret ; + ^block11: + v79 = arith.constant 12 : u32; + v78 = hir.bitcast v52 : u32; + v80 = arith.add v78, v79 : u32 #[overflow = checked]; + v766 = arith.constant 4 : u32; + v82 = arith.mod v80, v766 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::handle_error(v71, v84, v85) + ub.unreachable ; + }; + + public builtin.function @entrypoint(v90: i32, v91: i32) { + ^block12(v90: i32, v91: i32): + v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + v96 = hir.load v95 : i32; + v97 = arith.constant 16 : i32; + v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v102 = arith.constant 16 : u32; + v101 = hir.bitcast v91 : u32; + v103 = arith.add v101, v102 : u32 #[overflow = checked]; + v104 = arith.constant 4 : u32; + v105 = arith.mod v103, v104 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + v107 = hir.load v106 : felt; + v109 = arith.constant 12 : u32; + v108 = hir.bitcast v91 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v788 = arith.constant 4 : u32; + v112 = arith.mod v110, v788 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v116 = arith.constant 8 : u32; + v115 = hir.bitcast v91 : u32; + v117 = arith.add v115, v116 : u32 #[overflow = checked]; + v787 = arith.constant 4 : u32; + v119 = arith.mod v117, v787 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v786 = arith.constant 4 : u32; + v122 = hir.bitcast v91 : u32; + v124 = arith.add v122, v786 : u32 #[overflow = checked]; + v785 = arith.constant 4 : u32; + v126 = arith.mod v124, v785 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + v128 = hir.load v127 : felt; + v129 = hir.bitcast v91 : u32; + v784 = arith.constant 4 : u32; + v131 = arith.mod v129, v784 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : felt; + v136 = arith.constant 8 : i32; + v134 = arith.constant 4 : i32; + v135 = arith.add v98, v134 : i32 #[overflow = wrapping]; + v137 = arith.add v135, v136 : i32 #[overflow = wrapping]; + v139 = hir.bitcast v137 : u32; + v783 = arith.constant 4 : u32; + v141 = arith.mod v139, v783 : u32; + hir.assertz v141 #[code = 250]; + v92 = arith.constant 0 : i32; + v142 = hir.int_to_ptr v139 : ptr; + hir.store v142, v92; + v782 = arith.constant 4 : u32; + v144 = hir.bitcast v98 : u32; + v146 = arith.add v144, v782 : u32 #[overflow = checked]; + v781 = arith.constant 4 : u32; + v148 = arith.mod v146, v781 : u32; + hir.assertz v148 #[code = 250]; + v143 = arith.constant 17179869184 : i64; + v149 = hir.int_to_ptr v146 : ptr; + hir.store v149, v143; + v780 = arith.constant 4 : i32; + v151 = arith.add v98, v780 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v151, v133) + v779 = arith.constant 4 : i32; + v153 = arith.add v98, v779 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v153, v128) + v778 = arith.constant 4 : i32; + v155 = arith.add v98, v778 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v155, v121) + v777 = arith.constant 4 : i32; + v157 = arith.add v98, v777 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v157, v114) + v776 = arith.constant 4 : i32; + v159 = arith.add v98, v776 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v159, v107) + v162 = hir.bitcast v137 : u32; + v775 = arith.constant 4 : u32; + v164 = arith.mod v162, v775 : u32; + hir.assertz v164 #[code = 250]; + v165 = hir.int_to_ptr v162 : ptr; + v166 = hir.load v165 : i32; + v774 = arith.constant 8 : i32; + v161 = arith.add v90, v774 : i32 #[overflow = wrapping]; + v167 = hir.bitcast v161 : u32; + v773 = arith.constant 4 : u32; + v169 = arith.mod v167, v773 : u32; + hir.assertz v169 #[code = 250]; + v170 = hir.int_to_ptr v167 : ptr; + hir.store v170, v166; + v772 = arith.constant 4 : u32; + v171 = hir.bitcast v98 : u32; + v173 = arith.add v171, v772 : u32 #[overflow = checked]; + v771 = arith.constant 4 : u32; + v175 = arith.mod v173, v771 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i64; + v178 = hir.bitcast v90 : u32; + v770 = arith.constant 4 : u32; + v180 = arith.mod v178, v770 : u32; + hir.assertz v180 #[code = 250]; + v181 = hir.int_to_ptr v178 : ptr; + hir.store v181, v177; + v769 = arith.constant 16 : i32; + v183 = arith.add v98, v769 : i32 #[overflow = wrapping]; + v184 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v185 = hir.bitcast v184 : ptr; + hir.store v185, v183; + builtin.ret ; + }; + + private builtin.function @__rustc::__rust_alloc(v186: i32, v187: i32) -> i32 { + ^block14(v186: i32, v187: i32): + v189 = arith.constant 1048604 : i32; + v190 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v189, v187, v186) : i32 + builtin.ret v190; + }; + + private builtin.function @__rustc::__rust_realloc(v191: i32, v192: i32, v193: i32, v194: i32) -> i32 { + ^block16(v191: i32, v192: i32, v193: i32, v194: i32): + v196 = arith.constant 1048604 : i32; + v197 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v196, v193, v194) : i32 + v797 = arith.constant 0 : i32; + v198 = arith.constant 0 : i32; + v199 = arith.eq v197, v198 : i1; + v200 = arith.zext v199 : u32; + v201 = hir.bitcast v200 : i32; + v203 = arith.neq v201, v797 : i1; + scf.if v203{ + ^block18: + scf.yield ; + } else { + ^block19: + v796 = arith.constant 0 : i32; + v205 = hir.bitcast v192 : u32; + v204 = hir.bitcast v194 : u32; + v206 = arith.lt v204, v205 : i1; + v207 = arith.zext v206 : u32; + v208 = hir.bitcast v207 : i32; + v210 = arith.neq v208, v796 : i1; + v211 = cf.select v210, v194, v192 : i32; + v794 = arith.constant 0 : i32; + v795 = arith.constant 0 : i32; + v213 = arith.eq v211, v795 : i1; + v214 = arith.zext v213 : u32; + v215 = hir.bitcast v214 : i32; + v217 = arith.neq v215, v794 : i1; + scf.if v217{ + ^block82: + scf.yield ; + } else { + ^block20: + v218 = hir.bitcast v211 : u32; + v219 = hir.bitcast v197 : u32; + v220 = hir.int_to_ptr v219 : ptr; + v221 = hir.bitcast v191 : u32; + v222 = hir.int_to_ptr v221 : ptr; + hir.mem_cpy v222, v220, v218; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v197; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v224: i32, v225: i32) -> i32 { + ^block21(v224: i32, v225: i32): + v227 = arith.constant 1048604 : i32; + v228 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v227, v225, v224) : i32 + v806 = arith.constant 0 : i32; + v229 = arith.constant 0 : i32; + v230 = arith.eq v228, v229 : i1; + v231 = arith.zext v230 : u32; + v232 = hir.bitcast v231 : i32; + v234 = arith.neq v232, v806 : i1; + scf.if v234{ + ^block23: + scf.yield ; + } else { + ^block24: + v804 = arith.constant 0 : i32; + v805 = arith.constant 0 : i32; + v236 = arith.eq v224, v805 : i1; + v237 = arith.zext v236 : u32; + v238 = hir.bitcast v237 : i32; + v240 = arith.neq v238, v804 : i1; + scf.if v240{ + ^block85: + scf.yield ; + } else { + ^block25: + v798 = arith.constant 0 : u8; + v243 = hir.bitcast v224 : u32; + v244 = hir.bitcast v228 : u32; + v245 = hir.int_to_ptr v244 : ptr; + hir.mem_set v245, v243, v798; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v228; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block26: + builtin.ret ; + }; + + private builtin.function @::alloc(v247: i32, v248: i32, v249: i32) -> i32 { + ^block28(v247: i32, v248: i32, v249: i32): + v252 = arith.constant 16 : i32; + v251 = arith.constant 0 : i32; + v808 = arith.constant 16 : u32; + v254 = hir.bitcast v248 : u32; + v256 = arith.gt v254, v808 : i1; + v257 = arith.zext v256 : u32; + v258 = hir.bitcast v257 : i32; + v260 = arith.neq v258, v251 : i1; + v261 = cf.select v260, v248, v252 : i32; + v848 = arith.constant 0 : i32; + v262 = arith.constant -1 : i32; + v263 = arith.add v261, v262 : i32 #[overflow = wrapping]; + v264 = arith.band v261, v263 : i32; + v266 = arith.neq v264, v848 : i1; + v817, v818 = scf.if v266 : i32, u32 { + ^block90: + v809 = arith.constant 0 : u32; + v813 = ub.poison i32 : i32; + scf.yield v813, v809; + } else { + ^block31: + v268 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v248, v261) : i32 + v847 = arith.constant 0 : i32; + v267 = arith.constant -2147483648 : i32; + v269 = arith.sub v267, v268 : i32 #[overflow = wrapping]; + v271 = hir.bitcast v269 : u32; + v270 = hir.bitcast v249 : u32; + v272 = arith.gt v270, v271 : i1; + v273 = arith.zext v272 : u32; + v274 = hir.bitcast v273 : i32; + v276 = arith.neq v274, v847 : i1; + v832 = scf.if v276 : i32 { + ^block89: + v846 = ub.poison i32 : i32; + scf.yield v846; + } else { + ^block32: + v844 = arith.constant 0 : i32; + v282 = arith.sub v844, v268 : i32 #[overflow = wrapping]; + v845 = arith.constant -1 : i32; + v278 = arith.add v249, v268 : i32 #[overflow = wrapping]; + v280 = arith.add v278, v845 : i32 #[overflow = wrapping]; + v283 = arith.band v280, v282 : i32; + v284 = hir.bitcast v247 : u32; + v285 = arith.constant 4 : u32; + v286 = arith.mod v284, v285 : u32; + hir.assertz v286 #[code = 250]; + v287 = hir.int_to_ptr v284 : ptr; + v288 = hir.load v287 : i32; + v843 = arith.constant 0 : i32; + v290 = arith.neq v288, v843 : i1; + scf.if v290{ + ^block88: + scf.yield ; + } else { + ^block34: + v291 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 + v292 = hir.mem_size : u32; + v298 = hir.bitcast v247 : u32; + v842 = arith.constant 4 : u32; + v300 = arith.mod v298, v842 : u32; + hir.assertz v300 #[code = 250]; + v841 = arith.constant 16 : u32; + v293 = hir.bitcast v292 : i32; + v296 = arith.shl v293, v841 : i32; + v297 = arith.add v291, v296 : i32 #[overflow = wrapping]; + v301 = hir.int_to_ptr v298 : ptr; + hir.store v301, v297; + scf.yield ; + }; + v304 = hir.bitcast v247 : u32; + v840 = arith.constant 4 : u32; + v306 = arith.mod v304, v840 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : i32; + v838 = arith.constant 0 : i32; + v839 = arith.constant -1 : i32; + v310 = arith.bxor v308, v839 : i32; + v312 = hir.bitcast v310 : u32; + v311 = hir.bitcast v283 : u32; + v313 = arith.gt v311, v312 : i1; + v314 = arith.zext v313 : u32; + v315 = hir.bitcast v314 : i32; + v317 = arith.neq v315, v838 : i1; + v831 = scf.if v317 : i32 { + ^block35: + v837 = arith.constant 0 : i32; + scf.yield v837; + } else { + ^block36: + v319 = hir.bitcast v247 : u32; + v836 = arith.constant 4 : u32; + v321 = arith.mod v319, v836 : u32; + hir.assertz v321 #[code = 250]; + v318 = arith.add v308, v283 : i32 #[overflow = wrapping]; + v322 = hir.int_to_ptr v319 : ptr; + hir.store v322, v318; + v324 = arith.add v308, v268 : i32 #[overflow = wrapping]; + scf.yield v324; + }; + scf.yield v831; + }; + v814 = arith.constant 1 : u32; + v835 = arith.constant 0 : u32; + v833 = cf.select v276, v835, v814 : u32; + scf.yield v832, v833; + }; + v834 = arith.constant 0 : u32; + v830 = arith.eq v818, v834 : i1; + cf.cond_br v830 ^block30, ^block92(v817); + ^block30: + ub.unreachable ; + ^block92(v810: i32): + builtin.ret v810; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block37: + v327 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v327; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v329: i32, v330: i32, v331: i32, v332: i32, v333: i32, v334: i32) { + ^block41(v329: i32, v330: i32, v331: i32, v332: i32, v333: i32, v334: i32): + v337 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v338 = hir.bitcast v337 : ptr; + v339 = hir.load v338 : i32; + v340 = arith.constant 32 : i32; + v341 = arith.sub v339, v340 : i32 #[overflow = wrapping]; + v342 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v343 = hir.bitcast v342 : ptr; + hir.store v343, v341; + v925 = arith.constant 0 : i32; + v335 = arith.constant 0 : i32; + v346 = arith.eq v334, v335 : i1; + v347 = arith.zext v346 : u32; + v348 = hir.bitcast v347 : i32; + v350 = arith.neq v348, v925 : i1; + v896, v897 = scf.if v350 : i32, i32 { + ^block44: + v924 = arith.constant 0 : i32; + scf.yield v924, v924; + } else { + ^block45: + v351 = arith.add v331, v332 : i32 #[overflow = wrapping]; + v923 = arith.constant 0 : i32; + v353 = hir.bitcast v331 : u32; + v352 = hir.bitcast v351 : u32; + v354 = arith.lt v352, v353 : i1; + v355 = arith.zext v354 : u32; + v356 = hir.bitcast v355 : i32; + v358 = arith.neq v356, v923 : i1; + v894, v895 = scf.if v358 : i32, i32 { + ^block98: + v922 = arith.constant 0 : i32; + scf.yield v922, v922; + } else { + ^block46: + v369 = hir.bitcast v330 : u32; + v483 = arith.constant 4 : u32; + v371 = arith.mod v369, v483 : u32; + hir.assertz v371 #[code = 250]; + v372 = hir.int_to_ptr v369 : ptr; + v373 = hir.load v372 : i32; + v850 = arith.constant 1 : u32; + v376 = arith.shl v373, v850 : i32; + v921 = arith.constant 0 : i32; + v378 = hir.bitcast v376 : u32; + v377 = hir.bitcast v351 : u32; + v379 = arith.gt v377, v378 : i1; + v380 = arith.zext v379 : u32; + v381 = hir.bitcast v380 : i32; + v383 = arith.neq v381, v921 : i1; + v384 = cf.select v383, v351, v376 : i32; + v918 = arith.constant 1 : i32; + v386 = arith.constant 4 : i32; + v919 = arith.constant 0 : i32; + v849 = arith.constant 1025 : u32; + v389 = hir.bitcast v334 : u32; + v391 = arith.lt v389, v849 : i1; + v392 = arith.zext v391 : u32; + v393 = hir.bitcast v392 : i32; + v395 = arith.neq v393, v919 : i1; + v396 = cf.select v395, v386, v918 : i32; + v385 = arith.constant 8 : i32; + v920 = arith.constant 0 : i32; + v374 = arith.constant 1 : i32; + v398 = arith.eq v334, v374 : i1; + v399 = arith.zext v398 : u32; + v400 = hir.bitcast v399 : i32; + v402 = arith.neq v400, v920 : i1; + v403 = cf.select v402, v385, v396 : i32; + v917 = arith.constant 0 : i32; + v405 = hir.bitcast v403 : u32; + v404 = hir.bitcast v384 : u32; + v406 = arith.gt v404, v405 : i1; + v407 = arith.zext v406 : u32; + v408 = hir.bitcast v407 : i32; + v410 = arith.neq v408, v917 : i1; + v411 = cf.select v410, v384, v403 : i32; + v412 = hir.bitcast v411 : u32; + v413 = arith.zext v412 : u64; + v414 = hir.bitcast v413 : i64; + v916 = arith.constant 0 : i32; + v364 = arith.sub v916, v333 : i32 #[overflow = wrapping]; + v361 = arith.constant -1 : i32; + v360 = arith.add v333, v334 : i32 #[overflow = wrapping]; + v362 = arith.add v360, v361 : i32 #[overflow = wrapping]; + v365 = arith.band v362, v364 : i32; + v366 = hir.bitcast v365 : u32; + v367 = arith.zext v366 : u64; + v368 = hir.bitcast v367 : i64; + v415 = arith.mul v368, v414 : i64 #[overflow = wrapping]; + v915 = arith.constant 0 : i32; + v416 = arith.constant 32 : i64; + v418 = hir.cast v416 : u32; + v417 = hir.bitcast v415 : u64; + v419 = arith.shr v417, v418 : u64; + v420 = hir.bitcast v419 : i64; + v421 = arith.trunc v420 : i32; + v423 = arith.neq v421, v915 : i1; + v892, v893 = scf.if v423 : i32, i32 { + ^block97: + v914 = arith.constant 0 : i32; + scf.yield v384, v914; + } else { + ^block47: + v424 = arith.trunc v415 : i32; + v913 = arith.constant 0 : i32; + v425 = arith.constant -2147483648 : i32; + v426 = arith.sub v425, v333 : i32 #[overflow = wrapping]; + v428 = hir.bitcast v426 : u32; + v427 = hir.bitcast v424 : u32; + v429 = arith.gt v427, v428 : i1; + v430 = arith.zext v429 : u32; + v431 = hir.bitcast v430 : i32; + v433 = arith.neq v431, v913 : i1; + v890, v891 = scf.if v433 : i32, i32 { + ^block96: + v912 = arith.constant 0 : i32; + scf.yield v384, v912; + } else { + ^block48: + v434 = arith.constant 20 : i32; + v435 = arith.add v341, v434 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v435, v330, v333, v334) + v910 = arith.constant 20 : i32; + v439 = arith.add v341, v910 : i32 #[overflow = wrapping]; + v911 = arith.constant 8 : i32; + v437 = arith.add v341, v911 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v437, v333, v424, v439, v329) + v441 = arith.constant 12 : u32; + v440 = hir.bitcast v341 : u32; + v442 = arith.add v440, v441 : u32 #[overflow = checked]; + v909 = arith.constant 4 : u32; + v444 = arith.mod v442, v909 : u32; + hir.assertz v444 #[code = 250]; + v445 = hir.int_to_ptr v442 : ptr; + v446 = hir.load v445 : i32; + v448 = arith.constant 8 : u32; + v447 = hir.bitcast v341 : u32; + v449 = arith.add v447, v448 : u32 #[overflow = checked]; + v908 = arith.constant 4 : u32; + v451 = arith.mod v449, v908 : u32; + hir.assertz v451 #[code = 250]; + v452 = hir.int_to_ptr v449 : ptr; + v453 = hir.load v452 : i32; + v906 = arith.constant 0 : i32; + v907 = arith.constant 0 : i32; + v455 = arith.eq v453, v907 : i1; + v456 = arith.zext v455 : u32; + v457 = hir.bitcast v456 : i32; + v459 = arith.neq v457, v906 : i1; + v888 = scf.if v459 : i32 { + ^block49: + v467 = hir.bitcast v330 : u32; + v905 = arith.constant 4 : u32; + v469 = arith.mod v467, v905 : u32; + hir.assertz v469 #[code = 250]; + v470 = hir.int_to_ptr v467 : ptr; + hir.store v470, v411; + v904 = arith.constant 4 : u32; + v471 = hir.bitcast v330 : u32; + v473 = arith.add v471, v904 : u32 #[overflow = checked]; + v903 = arith.constant 4 : u32; + v475 = arith.mod v473, v903 : u32; + hir.assertz v475 #[code = 250]; + v476 = hir.int_to_ptr v473 : ptr; + hir.store v476, v446; + scf.yield v384; + } else { + ^block50: + v461 = arith.constant 16 : u32; + v460 = hir.bitcast v341 : u32; + v462 = arith.add v460, v461 : u32 #[overflow = checked]; + v902 = arith.constant 4 : u32; + v464 = arith.mod v462, v902 : u32; + hir.assertz v464 #[code = 250]; + v465 = hir.int_to_ptr v462 : ptr; + v466 = hir.load v465 : i32; + scf.yield v466; + }; + v477 = arith.constant -2147483647 : i32; + v889 = cf.select v459, v477, v446 : i32; + scf.yield v888, v889; + }; + scf.yield v890, v891; + }; + scf.yield v892, v893; + }; + scf.yield v894, v895; + }; + v901 = arith.constant 4 : u32; + v482 = hir.bitcast v329 : u32; + v484 = arith.add v482, v901 : u32 #[overflow = checked]; + v900 = arith.constant 4 : u32; + v486 = arith.mod v484, v900 : u32; + hir.assertz v486 #[code = 250]; + v487 = hir.int_to_ptr v484 : ptr; + hir.store v487, v896; + v490 = hir.bitcast v329 : u32; + v899 = arith.constant 4 : u32; + v492 = arith.mod v490, v899 : u32; + hir.assertz v492 #[code = 250]; + v493 = hir.int_to_ptr v490 : ptr; + hir.store v493, v897; + v898 = arith.constant 32 : i32; + v497 = arith.add v341, v898 : i32 #[overflow = wrapping]; + v498 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v499 = hir.bitcast v498 : ptr; + hir.store v499, v497; + builtin.ret ; + }; + + private builtin.function @::allocate(v500: i32, v501: i32, v502: i32) { + ^block51(v500: i32, v501: i32, v502: i32): + v504 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v505 = hir.bitcast v504 : ptr; + v506 = hir.load v505 : i32; + v507 = arith.constant 16 : i32; + v508 = arith.sub v506, v507 : i32 #[overflow = wrapping]; + v509 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v510 = hir.bitcast v509 : ptr; + hir.store v510, v508; + v503 = arith.constant 0 : i32; + v511 = arith.constant 8 : i32; + v512 = arith.add v508, v511 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v512, v501, v502, v503) + v515 = arith.constant 12 : u32; + v514 = hir.bitcast v508 : u32; + v516 = arith.add v514, v515 : u32 #[overflow = checked]; + v517 = arith.constant 4 : u32; + v518 = arith.mod v516, v517 : u32; + hir.assertz v518 #[code = 250]; + v519 = hir.int_to_ptr v516 : ptr; + v520 = hir.load v519 : i32; + v522 = arith.constant 8 : u32; + v521 = hir.bitcast v508 : u32; + v523 = arith.add v521, v522 : u32 #[overflow = checked]; + v930 = arith.constant 4 : u32; + v525 = arith.mod v523, v930 : u32; + hir.assertz v525 #[code = 250]; + v526 = hir.int_to_ptr v523 : ptr; + v527 = hir.load v526 : i32; + v528 = hir.bitcast v500 : u32; + v929 = arith.constant 4 : u32; + v530 = arith.mod v528, v929 : u32; + hir.assertz v530 #[code = 250]; + v531 = hir.int_to_ptr v528 : ptr; + hir.store v531, v527; + v928 = arith.constant 4 : u32; + v532 = hir.bitcast v500 : u32; + v534 = arith.add v532, v928 : u32 #[overflow = checked]; + v927 = arith.constant 4 : u32; + v536 = arith.mod v534, v927 : u32; + hir.assertz v536 #[code = 250]; + v537 = hir.int_to_ptr v534 : ptr; + hir.store v537, v520; + v926 = arith.constant 16 : i32; + v539 = arith.add v508, v926 : i32 #[overflow = wrapping]; + v540 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v541 = hir.bitcast v540 : ptr; + hir.store v541, v539; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v542: i32, v543: i32, v544: i32, v545: i32) { + ^block53(v542: i32, v543: i32, v544: i32, v545: i32): + v946 = arith.constant 0 : i32; + v546 = arith.constant 0 : i32; + v547 = arith.eq v544, v546 : i1; + v548 = arith.zext v547 : u32; + v549 = hir.bitcast v548 : i32; + v551 = arith.neq v549, v946 : i1; + v942 = scf.if v551 : i32 { + ^block104: + scf.yield v543; + } else { + ^block56: + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v945 = arith.constant 0 : i32; + v553 = arith.neq v545, v945 : i1; + v941 = scf.if v553 : i32 { + ^block57: + v555 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v544, v543) : i32 + scf.yield v555; + } else { + ^block58: + v554 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v544, v543) : i32 + scf.yield v554; + }; + scf.yield v941; + }; + v559 = arith.constant 4 : u32; + v558 = hir.bitcast v542 : u32; + v560 = arith.add v558, v559 : u32 #[overflow = checked]; + v944 = arith.constant 4 : u32; + v562 = arith.mod v560, v944 : u32; + hir.assertz v562 #[code = 250]; + v563 = hir.int_to_ptr v560 : ptr; + hir.store v563, v544; + v565 = hir.bitcast v542 : u32; + v943 = arith.constant 4 : u32; + v567 = arith.mod v565, v943 : u32; + hir.assertz v567 #[code = 250]; + v568 = hir.int_to_ptr v565 : ptr; + hir.store v568, v942; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v569: i32, v570: i32, v571: i32, v572: i32) { + ^block59(v569: i32, v570: i32, v571: i32, v572: i32): + v972 = arith.constant 0 : i32; + v573 = arith.constant 0 : i32; + v577 = arith.eq v572, v573 : i1; + v578 = arith.zext v577 : u32; + v579 = hir.bitcast v578 : i32; + v581 = arith.neq v579, v972 : i1; + v959, v960 = scf.if v581 : i32, i32 { + ^block108: + v971 = arith.constant 0 : i32; + v575 = arith.constant 4 : i32; + scf.yield v575, v971; + } else { + ^block62: + v582 = hir.bitcast v570 : u32; + v617 = arith.constant 4 : u32; + v584 = arith.mod v582, v617 : u32; + hir.assertz v584 #[code = 250]; + v585 = hir.int_to_ptr v582 : ptr; + v586 = hir.load v585 : i32; + v969 = arith.constant 0 : i32; + v970 = arith.constant 0 : i32; + v588 = arith.eq v586, v970 : i1; + v589 = arith.zext v588 : u32; + v590 = hir.bitcast v589 : i32; + v592 = arith.neq v590, v969 : i1; + v957 = scf.if v592 : i32 { + ^block107: + v968 = arith.constant 0 : i32; + scf.yield v968; + } else { + ^block63: + v967 = arith.constant 4 : u32; + v593 = hir.bitcast v569 : u32; + v595 = arith.add v593, v967 : u32 #[overflow = checked]; + v966 = arith.constant 4 : u32; + v597 = arith.mod v595, v966 : u32; + hir.assertz v597 #[code = 250]; + v598 = hir.int_to_ptr v595 : ptr; + hir.store v598, v571; + v965 = arith.constant 4 : u32; + v599 = hir.bitcast v570 : u32; + v601 = arith.add v599, v965 : u32 #[overflow = checked]; + v964 = arith.constant 4 : u32; + v603 = arith.mod v601, v964 : u32; + hir.assertz v603 #[code = 250]; + v604 = hir.int_to_ptr v601 : ptr; + v605 = hir.load v604 : i32; + v606 = hir.bitcast v569 : u32; + v963 = arith.constant 4 : u32; + v608 = arith.mod v606, v963 : u32; + hir.assertz v608 #[code = 250]; + v609 = hir.int_to_ptr v606 : ptr; + hir.store v609, v605; + v610 = arith.mul v586, v572 : i32 #[overflow = wrapping]; + scf.yield v610; + }; + v611 = arith.constant 8 : i32; + v962 = arith.constant 4 : i32; + v958 = cf.select v592, v962, v611 : i32; + scf.yield v958, v957; + }; + v614 = arith.add v569, v959 : i32 #[overflow = wrapping]; + v616 = hir.bitcast v614 : u32; + v961 = arith.constant 4 : u32; + v618 = arith.mod v616, v961 : u32; + hir.assertz v618 #[code = 250]; + v619 = hir.int_to_ptr v616 : ptr; + hir.store v619, v960; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::finish_grow(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32) { + ^block64(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32): + v626 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v627 = hir.bitcast v626 : ptr; + v628 = hir.load v627 : i32; + v629 = arith.constant 16 : i32; + v630 = arith.sub v628, v629 : i32 #[overflow = wrapping]; + v631 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v632 = hir.bitcast v631 : ptr; + hir.store v632, v630; + v1027 = arith.constant 0 : i32; + v625 = arith.constant 0 : i32; + v635 = arith.gte v622, v625 : i1; + v636 = arith.zext v635 : u32; + v637 = hir.bitcast v636 : i32; + v639 = arith.neq v637, v1027 : i1; + v1001, v1002 = scf.if v639 : i32, i32 { + ^block67: + v726 = arith.constant 4 : u32; + v642 = hir.bitcast v623 : u32; + v644 = arith.add v642, v726 : u32 #[overflow = checked]; + v1026 = arith.constant 4 : u32; + v646 = arith.mod v644, v1026 : u32; + hir.assertz v646 #[code = 250]; + v647 = hir.int_to_ptr v644 : ptr; + v648 = hir.load v647 : i32; + v1024 = arith.constant 0 : i32; + v1025 = arith.constant 0 : i32; + v650 = arith.eq v648, v1025 : i1; + v651 = arith.zext v650 : u32; + v652 = hir.bitcast v651 : i32; + v654 = arith.neq v652, v1024 : i1; + v999, v1000 = scf.if v654 : i32, i32 { + ^block70: + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v630, v621, v622) + v1023 = arith.constant 4 : u32; + v687 = hir.bitcast v630 : u32; + v689 = arith.add v687, v1023 : u32 #[overflow = checked]; + v1022 = arith.constant 4 : u32; + v691 = arith.mod v689, v1022 : u32; + hir.assertz v691 #[code = 250]; + v692 = hir.int_to_ptr v689 : ptr; + v693 = hir.load v692 : i32; + v694 = hir.bitcast v630 : u32; + v1021 = arith.constant 4 : u32; + v696 = arith.mod v694, v1021 : u32; + hir.assertz v696 #[code = 250]; + v697 = hir.int_to_ptr v694 : ptr; + v698 = hir.load v697 : i32; + scf.yield v698, v693; + } else { + ^block71: + v656 = arith.constant 8 : u32; + v655 = hir.bitcast v623 : u32; + v657 = arith.add v655, v656 : u32 #[overflow = checked]; + v1020 = arith.constant 4 : u32; + v659 = arith.mod v657, v1020 : u32; + hir.assertz v659 #[code = 250]; + v660 = hir.int_to_ptr v657 : ptr; + v661 = hir.load v660 : i32; + v1019 = arith.constant 0 : i32; + v663 = arith.neq v661, v1019 : i1; + v997, v998 = scf.if v663 : i32, i32 { + ^block72: + v681 = hir.bitcast v623 : u32; + v1018 = arith.constant 4 : u32; + v683 = arith.mod v681, v1018 : u32; + hir.assertz v683 #[code = 250]; + v684 = hir.int_to_ptr v681 : ptr; + v685 = hir.load v684 : i32; + v686 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v685, v661, v621, v622) : i32 + scf.yield v686, v622; + } else { + ^block73: + v1017 = arith.constant 0 : i32; + v720 = arith.constant 8 : i32; + v665 = arith.add v630, v720 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v665, v621, v622, v1017) + v668 = arith.constant 12 : u32; + v667 = hir.bitcast v630 : u32; + v669 = arith.add v667, v668 : u32 #[overflow = checked]; + v1016 = arith.constant 4 : u32; + v671 = arith.mod v669, v1016 : u32; + hir.assertz v671 #[code = 250]; + v672 = hir.int_to_ptr v669 : ptr; + v673 = hir.load v672 : i32; + v1015 = arith.constant 8 : u32; + v674 = hir.bitcast v630 : u32; + v676 = arith.add v674, v1015 : u32 #[overflow = checked]; + v1014 = arith.constant 4 : u32; + v678 = arith.mod v676, v1014 : u32; + hir.assertz v678 #[code = 250]; + v679 = hir.int_to_ptr v676 : ptr; + v680 = hir.load v679 : i32; + scf.yield v680, v673; + }; + scf.yield v997, v998; + }; + v1013 = arith.constant 4 : u32; + v705 = hir.bitcast v620 : u32; + v707 = arith.add v705, v1013 : u32 #[overflow = checked]; + v1012 = arith.constant 4 : u32; + v709 = arith.mod v707, v1012 : u32; + hir.assertz v709 #[code = 250]; + v1011 = arith.constant 0 : i32; + v703 = arith.neq v999, v1011 : i1; + v704 = cf.select v703, v999, v621 : i32; + v710 = hir.int_to_ptr v707 : ptr; + hir.store v710, v704; + v1009 = arith.constant 0 : i32; + v717 = arith.eq v999, v1009 : i1; + v718 = arith.zext v717 : u32; + v719 = hir.bitcast v718 : i32; + v1010 = arith.constant 0 : i32; + v714 = arith.neq v999, v1010 : i1; + v715 = cf.select v714, v1000, v622 : i32; + scf.yield v715, v719; + } else { + ^block68: + v640 = arith.constant 1 : i32; + v1008 = arith.constant 0 : i32; + scf.yield v1008, v640; + }; + v641 = arith.constant 4 : i32; + v1007 = arith.constant 8 : i32; + v1003 = cf.select v639, v1007, v641 : i32; + v723 = arith.add v620, v1003 : i32 #[overflow = wrapping]; + v725 = hir.bitcast v723 : u32; + v1006 = arith.constant 4 : u32; + v727 = arith.mod v725, v1006 : u32; + hir.assertz v727 #[code = 250]; + v728 = hir.int_to_ptr v725 : ptr; + hir.store v728, v1001; + v730 = hir.bitcast v620 : u32; + v1005 = arith.constant 4 : u32; + v732 = arith.mod v730, v1005 : u32; + hir.assertz v732 #[code = 250]; + v733 = hir.int_to_ptr v730 : ptr; + hir.store v733, v1002; + v1004 = arith.constant 16 : i32; + v737 = arith.add v630, v1004 : i32 #[overflow = wrapping]; + v738 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v739 = hir.bitcast v738 : ptr; + hir.store v739, v737; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v740: i32, v741: i32, v742: i32) { + ^block74(v740: i32, v741: i32, v742: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v743: i32, v744: i32) -> i32 { + ^block76(v743: i32, v744: i32): + v751 = arith.constant 0 : i32; + v747 = hir.bitcast v744 : u32; + v746 = hir.bitcast v743 : u32; + v748 = arith.gt v746, v747 : i1; + v749 = arith.zext v748 : u32; + v750 = hir.bitcast v749 : i32; + v752 = arith.neq v750, v751 : i1; + v753 = cf.select v752, v743, v744 : i32; + builtin.ret v753; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; + }; +}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.masm b/felt-repr/tests/expected/onchain_five_felts_struct.masm new file mode 100644 index 000000000..a29cdcc9e --- /dev/null +++ b/felt-repr/tests/expected/onchain_five_felts_struct.masm @@ -0,0 +1,1942 @@ +# mod root_ns:root@1.0.0 + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 +end + +# mod root_ns:root@1.0.0::onchain_five_felts_struct + +@callconv("C") +proc alloc::vec::Vec::push(i32, felt) + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + dup.2 + neq + neq + if.true + nop + else + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVec::grow_one + trace.252 + nop + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + dup.2 + swap.1 + u32shl + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVec::grow_one(i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + push.1 + push.8 + dup.4 + u32wrapping_add + dup.2 + movup.2 + swap.3 + swap.4 + movdn.2 + swap.5 + swap.6 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVecInner::grow_amortized + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2147483649 + dup.2 + eq + neq + if.true + drop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +pub proc entrypoint(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.12 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + push.4 + dup.7 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.7 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + push.4 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.7 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.6 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.5 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.4 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.3 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 + swap.2 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + movdn.3 + drop + drop + drop + else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + drop + else + dup.2 + movup.2 + push.0 + dup.3 + push.0 + gte + while.true + dup.2 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.4 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::grow_amortized( + i32, + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.8 + eq + neq + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + movup.4 + dup.4 + u32wrapping_add + push.0 + movup.5 + dup.2 + swap.1 + u32lt + neq + if.true + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32shl + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + push.1 + push.4 + push.0 + push.1025 + dup.9 + swap.1 + u32lt + neq + cdrop + push.8 + push.0 + push.1 + dup.9 + eq + neq + cdrop + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + dup.2 + swap.1 + cdrop + dup.0 + push.0 + push.0 + dup.8 + u32wrapping_sub + push.4294967295 + dup.9 + dup.11 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + drop + push.0 + push.2147483648 + dup.8 + u32wrapping_sub + dup.2 + swap.1 + u32gt + neq + if.true + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + push.20 + dup.4 + u32wrapping_add + dup.6 + dup.8 + movup.3 + swap.10 + movdn.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.20 + dup.3 + u32wrapping_add + push.8 + dup.4 + u32wrapping_add + dup.5 + movup.2 + swap.3 + swap.9 + movdn.2 + swap.4 + swap.8 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::finish_grow + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.4 + else + movup.2 + swap.6 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.4 + drop + drop + drop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + end + push.2147483649 + movdn.2 + movdn.3 + cdrop + swap.1 + end + end + end + end + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) + movup.4 + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::i32::is_gte + trace.252 + nop + neq + dup.0 + if.true + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + movup.5 + drop + dup.4 + dup.4 + dup.3 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::allocate + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + neq + if.true + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.5 + dup.7 + swap.3 + swap.1 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_realloc + trace.252 + nop + dup.5 + swap.1 + else + movup.6 + swap.1 + drop + drop + push.0 + push.8 + dup.3 + u32wrapping_add + dup.5 + dup.7 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + end + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + dup.2 + neq + dup.2 + movup.2 + swap.8 + movdn.2 + swap.1 + cdrop + movup.6 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + dup.1 + eq + push.0 + movup.2 + neq + swap.1 + swap.6 + swap.2 + swap.1 + cdrop + movup.4 + swap.1 + else + movup.2 + swap.5 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.3 + drop + drop + drop + push.1 + push.0 + end + push.4 + push.8 + movup.4 + cdrop + dup.4 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.wat b/felt-repr/tests/expected/onchain_five_felts_struct.wat new file mode 100644 index 000000000..0ae2f6aee --- /dev/null +++ b/felt-repr/tests/expected/onchain_five_felts_struct.wat @@ -0,0 +1,613 @@ +(module $onchain_five_felts_struct.wasm + (type (;0;) (func (param i32 f32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func)) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (result i32))) + (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32))) + (type (;10;) (func (param i32 i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) + (local i32) + block ;; label = @1 + local.get 0 + i32.load offset=8 + local.tee 2 + local.get 0 + i32.load + i32.ne + br_if 0 (;@1;) + local.get 0 + call $alloc::raw_vec::RawVec::grow_one + end + local.get 0 + i32.load offset=4 + local.get 2 + i32.const 2 + i32.shl + i32.add + local.get 1 + f32.store + local.get 0 + local.get 2 + i32.const 1 + i32.add + i32.store offset=8 + ) + (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 8 + i32.add + local.get 0 + local.get 0 + i32.load + i32.const 1 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::grow_amortized + block ;; label = @1 + local.get 1 + i32.load offset=8 + local.tee 0 + i32.const -2147483647 + i32.eq + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.load offset=12 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $entrypoint (;2;) (type 2) (param i32 i32) + (local i32 f32 f32 f32 f32 f32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=16 + local.set 3 + local.get 1 + f32.load offset=12 + local.set 4 + local.get 1 + f32.load offset=8 + local.set 5 + local.get 1 + f32.load offset=4 + local.set 6 + local.get 1 + f32.load + local.set 7 + local.get 2 + i32.const 4 + i32.add + i32.const 8 + i32.add + local.tee 1 + i32.const 0 + i32.store + local.get 2 + i64.const 17179869184 + i64.store offset=4 align=4 + local.get 2 + i32.const 4 + i32.add + local.get 7 + call $alloc::vec::Vec::push + local.get 2 + i32.const 4 + i32.add + local.get 6 + call $alloc::vec::Vec::push + local.get 2 + i32.const 4 + i32.add + local.get 5 + call $alloc::vec::Vec::push + local.get 2 + i32.const 4 + i32.add + local.get 4 + call $alloc::vec::Vec::push + local.get 2 + i32.const 4 + i32.add + local.get 3 + call $alloc::vec::Vec::push + local.get 0 + i32.const 8 + i32.add + local.get 1 + i32.load + i32.store + local.get 0 + local.get 2 + i64.load offset=4 align=4 + i64.store align=4 + local.get 2 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 2 + local.get 3 + call $::alloc + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 1 + local.get 3 + local.get 1 + i32.lt_u + select + local.tee 3 + i32.eqz + br_if 0 (;@1;) + local.get 2 + local.get 0 + local.get 3 + memory.copy + end + local.get 2 + ) + (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) + return + ) + (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) + (local i32 i32 i32 i64) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 6 + global.set $__stack_pointer + i32.const 0 + local.set 7 + block ;; label = @1 + block ;; label = @2 + local.get 5 + i32.eqz + br_if 0 (;@2;) + local.get 2 + local.get 3 + i32.add + local.tee 3 + local.get 2 + i32.lt_u + br_if 1 (;@1;) + i32.const 0 + local.set 7 + local.get 4 + local.get 5 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 4 + i32.sub + i32.and + i64.extend_i32_u + local.get 3 + local.get 1 + i32.load + i32.const 1 + i32.shl + local.tee 8 + local.get 3 + local.get 8 + i32.gt_u + select + local.tee 8 + i32.const 8 + i32.const 4 + i32.const 1 + local.get 5 + i32.const 1025 + i32.lt_u + select + local.get 5 + i32.const 1 + i32.eq + select + local.tee 2 + local.get 8 + local.get 2 + i32.gt_u + select + local.tee 2 + i64.extend_i32_u + i64.mul + local.tee 9 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@2;) + local.get 9 + i32.wrap_i64 + local.tee 3 + i32.const -2147483648 + local.get 4 + i32.sub + i32.gt_u + br_if 1 (;@1;) + local.get 6 + i32.const 20 + i32.add + local.get 1 + local.get 4 + local.get 5 + call $alloc::raw_vec::RawVecInner::current_memory + local.get 6 + i32.const 8 + i32.add + local.get 4 + local.get 3 + local.get 6 + i32.const 20 + i32.add + local.get 0 + call $alloc::raw_vec::finish_grow + local.get 6 + i32.load offset=12 + local.set 7 + block ;; label = @3 + local.get 6 + i32.load offset=8 + i32.eqz + br_if 0 (;@3;) + local.get 6 + i32.load offset=16 + local.set 8 + br 2 (;@1;) + end + local.get 1 + local.get 2 + i32.store + local.get 1 + local.get 7 + i32.store offset=4 + i32.const -2147483647 + local.set 7 + br 1 (;@1;) + end + end + local.get 0 + local.get 8 + i32.store offset=4 + local.get 0 + local.get 7 + i32.store + local.get 6 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;10;) (type 9) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;11;) (type 10) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;12;) (type 10) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $alloc::raw_vec::finish_grow (;13;) (type 11) (param i32 i32 i32 i32 i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + i32.const 0 + local.set 6 + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.const 0 + i32.ge_s + br_if 0 (;@2;) + i32.const 1 + local.set 2 + i32.const 4 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 3 + i32.load offset=4 + i32.eqz + br_if 0 (;@3;) + block ;; label = @4 + local.get 3 + i32.load offset=8 + local.tee 6 + br_if 0 (;@4;) + local.get 5 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load offset=12 + local.set 6 + local.get 5 + i32.load offset=8 + local.set 3 + br 2 (;@2;) + end + local.get 3 + i32.load + local.get 6 + local.get 1 + local.get 2 + call $__rustc::__rust_realloc + local.set 3 + local.get 2 + local.set 6 + br 1 (;@2;) + end + local.get 5 + local.get 1 + local.get 2 + call $::allocate + local.get 5 + i32.load offset=4 + local.set 6 + local.get 5 + i32.load + local.set 3 + end + local.get 0 + local.get 3 + local.get 1 + local.get 3 + select + i32.store offset=4 + local.get 6 + local.get 2 + local.get 3 + select + local.set 6 + local.get 3 + i32.eqz + local.set 2 + i32.const 8 + local.set 3 + end + local.get 0 + local.get 3 + i32.add + local.get 6 + i32.store + local.get 0 + local.get 2 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::handle_error (;14;) (type 9) (param i32 i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;15;) (type 3) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") +) diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.hir b/felt-repr/tests/expected/onchain_four_felts_struct.hir index b7aeb3e71..c8e4af66c 100644 --- a/felt-repr/tests/expected/onchain_four_felts_struct.hir +++ b/felt-repr/tests/expected/onchain_four_felts_struct.hir @@ -1,1509 +1,995 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @onchain_four_felts_struct { - private builtin.function @core::ptr::drop_in_place>(v0: i32) { - ^block4(v0: i32): - v2 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__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/onchain_four_felts_struct/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; - v9 = hir.bitcast v0 : u32; - v10 = arith.constant 4 : u32; - v11 = arith.mod v9, v10 : u32; - hir.assertz v11 #[code = 250]; - v12 = hir.int_to_ptr v9 : ptr; - v13 = hir.load v12 : i32; - v15 = arith.constant 12 : u32; - v14 = hir.bitcast v6 : u32; - v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v1079 = arith.constant 4 : u32; - v18 = arith.mod v16, v1079 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - hir.store v19, v13; - v21 = arith.constant 8 : u32; - v20 = hir.bitcast v0 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v1078 = arith.constant 4 : u32; - v24 = arith.mod v22, v1078 : u32; - hir.assertz v24 #[code = 250]; - v25 = hir.int_to_ptr v22 : ptr; - v26 = hir.load v25 : i32; - v1077 = arith.constant 8 : u32; - v27 = hir.bitcast v6 : u32; - v29 = arith.add v27, v1077 : u32 #[overflow = checked]; - v1076 = arith.constant 4 : u32; - v31 = arith.mod v29, v1076 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v26; - v35 = arith.constant 4 : i32; - v33 = arith.constant 8 : i32; - v34 = arith.add v6, v33 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::deallocate(v34, v35, v35) - v1075 = arith.constant 16 : i32; - v38 = arith.add v6, v1075 : i32 #[overflow = wrapping]; - v39 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v40 = hir.bitcast v39 : ptr; - hir.store v40, v38; - builtin.ret ; - }; - - private builtin.function @alloc::vec::Vec::push(v41: i32, v42: felt) { - ^block6(v41: i32, v42: felt): - v45 = arith.constant 8 : u32; - v44 = hir.bitcast v41 : u32; - v46 = arith.add v44, v45 : u32 #[overflow = checked]; - v47 = arith.constant 4 : u32; - v48 = arith.mod v46, v47 : u32; - hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i32; - v51 = hir.bitcast v41 : u32; - v1090 = arith.constant 4 : u32; - v53 = arith.mod v51, v1090 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - v55 = hir.load v54 : i32; - v43 = arith.constant 0 : i32; - v56 = arith.neq v50, v55 : i1; - v57 = arith.zext v56 : u32; - v58 = hir.bitcast v57 : i32; - v60 = arith.neq v58, v43 : i1; - scf.if v60{ - ^block112: + private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { + ^block4(v0: i32, v1: felt): + v4 = arith.constant 8 : u32; + v3 = hir.bitcast v0 : u32; + v5 = arith.add v3, v4 : u32 #[overflow = checked]; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : i32; + v10 = hir.bitcast v0 : u32; + v755 = arith.constant 4 : u32; + v12 = arith.mod v10, v755 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v2 = arith.constant 0 : i32; + v15 = arith.neq v9, v14 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v2 : i1; + scf.if v19{ + ^block78: scf.yield ; } else { - ^block9: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVec::grow_one(v41) + ^block7: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) scf.yield ; }; - v1089 = arith.constant 4 : u32; - v62 = hir.bitcast v41 : u32; - v64 = arith.add v62, v1089 : u32 #[overflow = checked]; - v1088 = arith.constant 4 : u32; - v66 = arith.mod v64, v1088 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - v68 = hir.load v67 : i32; - v1080 = arith.constant 2 : u32; - v72 = arith.shl v50, v1080 : i32; - v73 = arith.add v68, v72 : i32 #[overflow = wrapping]; - v75 = hir.bitcast v73 : u32; - v1087 = arith.constant 4 : u32; - v77 = arith.mod v75, v1087 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - hir.store v78, v42; - v1086 = arith.constant 8 : u32; - v81 = hir.bitcast v41 : u32; - v83 = arith.add v81, v1086 : u32 #[overflow = checked]; - v1085 = arith.constant 4 : u32; - v85 = arith.mod v83, v1085 : u32; - hir.assertz v85 #[code = 250]; - v79 = arith.constant 1 : i32; - v80 = arith.add v50, v79 : i32 #[overflow = wrapping]; - v86 = hir.int_to_ptr v83 : ptr; - hir.store v86, v80; + v754 = arith.constant 4 : u32; + v21 = hir.bitcast v0 : u32; + v23 = arith.add v21, v754 : u32 #[overflow = checked]; + v753 = arith.constant 4 : u32; + v25 = arith.mod v23, v753 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; + v745 = arith.constant 2 : u32; + v31 = arith.shl v9, v745 : i32; + v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; + v34 = hir.bitcast v32 : u32; + v752 = arith.constant 4 : u32; + v36 = arith.mod v34, v752 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v1; + v751 = arith.constant 8 : u32; + v40 = hir.bitcast v0 : u32; + v42 = arith.add v40, v751 : u32 #[overflow = checked]; + v750 = arith.constant 4 : u32; + v44 = arith.mod v42, v750 : u32; + hir.assertz v44 #[code = 250]; + v38 = arith.constant 1 : i32; + v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVec::grow_one(v87: i32) { - ^block10(v87: i32): - v89 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v90 = hir.bitcast v89 : ptr; - v91 = hir.load v90 : i32; - v92 = arith.constant 16 : i32; - v93 = arith.sub v91, v92 : i32 #[overflow = wrapping]; - v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - hir.store v95, v93; - v98 = hir.bitcast v87 : u32; - v99 = arith.constant 4 : u32; - v100 = arith.mod v98, v99 : u32; - hir.assertz v100 #[code = 250]; - v101 = hir.int_to_ptr v98 : ptr; - v102 = hir.load v101 : i32; - v104 = arith.constant 4 : i32; - v103 = arith.constant 1 : i32; - v96 = arith.constant 8 : i32; - v97 = arith.add v93, v96 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v97, v87, v102, v103, v104, v104) - v107 = arith.constant 8 : u32; - v106 = hir.bitcast v93 : u32; - v108 = arith.add v106, v107 : u32 #[overflow = checked]; - v1094 = arith.constant 4 : u32; - v110 = arith.mod v108, v1094 : u32; - hir.assertz v110 #[code = 250]; - v111 = hir.int_to_ptr v108 : ptr; - v112 = hir.load v111 : i32; - v88 = arith.constant 0 : i32; - v113 = arith.constant -2147483647 : i32; - v114 = arith.eq v112, v113 : i1; - v115 = arith.zext v114 : u32; - v116 = hir.bitcast v115 : i32; - v118 = arith.neq v116, v88 : i1; - cf.cond_br v118 ^block12, ^block13; - ^block12: - v1093 = arith.constant 16 : i32; - v128 = arith.add v93, v1093 : i32 #[overflow = wrapping]; - v129 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v130 = hir.bitcast v129 : ptr; - hir.store v130, v128; + private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { + ^block8(v46: i32): + v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 16 : i32; + v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v54 = hir.bitcast v53 : ptr; + hir.store v54, v52; + v57 = hir.bitcast v46 : u32; + v58 = arith.constant 4 : u32; + v59 = arith.mod v57, v58 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i32; + v63 = arith.constant 4 : i32; + v62 = arith.constant 1 : i32; + v55 = arith.constant 8 : i32; + v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) + v66 = arith.constant 8 : u32; + v65 = hir.bitcast v52 : u32; + v67 = arith.add v65, v66 : u32 #[overflow = checked]; + v759 = arith.constant 4 : u32; + v69 = arith.mod v67, v759 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v47 = arith.constant 0 : i32; + v72 = arith.constant -2147483647 : i32; + v73 = arith.eq v71, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v47 : i1; + cf.cond_br v77 ^block10, ^block11; + ^block10: + v758 = arith.constant 16 : i32; + v87 = arith.add v52, v758 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; builtin.ret ; - ^block13: - v120 = arith.constant 12 : u32; - v119 = hir.bitcast v93 : u32; - v121 = arith.add v119, v120 : u32 #[overflow = checked]; - v1092 = arith.constant 4 : u32; - v123 = arith.mod v121, v1092 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : i32; - v126 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::handle_error(v112, v125, v126) + ^block11: + v79 = arith.constant 12 : u32; + v78 = hir.bitcast v52 : u32; + v80 = arith.add v78, v79 : u32 #[overflow = checked]; + v757 = arith.constant 4 : u32; + v82 = arith.mod v80, v757 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::handle_error(v71, v84, v85) ub.unreachable ; }; - private builtin.function @alloc::alloc::exchange_malloc() -> i32 { - ^block14: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v133 = arith.constant 4 : i32; - v135 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc(v133, v133) : i32 - v132 = arith.constant 0 : i32; - v137 = arith.neq v135, v132 : i1; - cf.cond_br v137 ^block16, ^block17; - ^block16: - builtin.ret v135; - ^block17: - v1097 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::handle_alloc_error(v1097, v1097) - ub.unreachable ; - }; - - private builtin.function @__rustc::__rust_alloc(v140: i32, v141: i32) -> i32 { - ^block18(v140: i32, v141: i32): - v143 = arith.constant 1048604 : i32; - v144 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v143, v141, v140) : i32 - builtin.ret v144; - }; - - public builtin.function @entrypoint(v145: i32, v146: i32) { - ^block20(v145: i32, v146: i32): - v150 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v151 = hir.bitcast v150 : ptr; - v152 = hir.load v151 : i32; - v153 = arith.constant 32 : i32; - v154 = arith.sub v152, v153 : i32 #[overflow = wrapping]; - v155 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v156 = hir.bitcast v155 : ptr; - hir.store v156, v154; - v158 = arith.constant 12 : u32; - v157 = hir.bitcast v146 : u32; - v159 = arith.add v157, v158 : u32 #[overflow = checked]; - v160 = arith.constant 4 : u32; - v161 = arith.mod v159, v160 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : felt; - v165 = arith.constant 8 : u32; - v164 = hir.bitcast v146 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v1622 = arith.constant 4 : u32; - v168 = arith.mod v166, v1622 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - v170 = hir.load v169 : felt; - v1621 = arith.constant 4 : u32; - v171 = hir.bitcast v146 : u32; - v173 = arith.add v171, v1621 : u32 #[overflow = checked]; - v1620 = arith.constant 4 : u32; - v175 = arith.mod v173, v1620 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : felt; - v178 = hir.bitcast v146 : u32; - v1619 = arith.constant 4 : u32; - v180 = arith.mod v178, v1619 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - v182 = hir.load v181 : felt; - v1618 = arith.constant 12 : u32; - v185 = hir.bitcast v154 : u32; - v187 = arith.add v185, v1618 : u32 #[overflow = checked]; - v1617 = arith.constant 4 : u32; - v189 = arith.mod v187, v1617 : u32; - hir.assertz v189 #[code = 250]; - v147 = arith.constant 0 : i32; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v147; - v1616 = arith.constant 4 : u32; - v192 = hir.bitcast v154 : u32; - v194 = arith.add v192, v1616 : u32 #[overflow = checked]; - v1615 = arith.constant 4 : u32; - v196 = arith.mod v194, v1615 : u32; - hir.assertz v196 #[code = 250]; - v191 = arith.constant 17179869184 : i64; - v197 = hir.int_to_ptr v194 : ptr; - hir.store v197, v191; - v198 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 - v199 = hir.bitcast v198 : u32; - v1614 = arith.constant 4 : u32; - v201 = arith.mod v199, v1614 : u32; - hir.assertz v201 #[code = 250]; - v202 = hir.int_to_ptr v199 : ptr; - hir.store v202, v182; - v206 = arith.constant 28 : u32; - v205 = hir.bitcast v154 : u32; - v207 = arith.add v205, v206 : u32 #[overflow = checked]; - v1613 = arith.constant 4 : u32; - v209 = arith.mod v207, v1613 : u32; - hir.assertz v209 #[code = 250]; - v203 = arith.constant 4 : i32; - v204 = arith.add v198, v203 : i32 #[overflow = wrapping]; - v210 = hir.int_to_ptr v207 : ptr; - hir.store v210, v204; - v213 = arith.constant 24 : u32; - v212 = hir.bitcast v154 : u32; - v214 = arith.add v212, v213 : u32 #[overflow = checked]; - v1612 = arith.constant 4 : u32; - v216 = arith.mod v214, v1612 : u32; - hir.assertz v216 #[code = 250]; - v211 = arith.constant 1 : i32; - v217 = hir.int_to_ptr v214 : ptr; - hir.store v217, v211; - v219 = arith.constant 16 : u32; - v218 = hir.bitcast v154 : u32; - v220 = arith.add v218, v219 : u32 #[overflow = checked]; - v1611 = arith.constant 4 : u32; - v222 = arith.mod v220, v1611 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - hir.store v223, v198; - v1610 = arith.constant 0 : i32; - v1483, v1484, v1485, v1486, v1487, v1488, v1489, v1490, v1491, v1492, v1493, v1494, v1495 = scf.while v198, v1610, v154, v177, v170, v163, v145 : i32, i32, i32, felt, felt, felt, i32, i32, felt, felt, felt, i32, i32 { - ^block149(v1496: i32, v1497: i32, v1498: i32, v1499: felt, v1500: felt, v1501: felt, v1502: i32): - v226 = arith.add v1496, v1497 : i32 #[overflow = wrapping]; - v1608 = arith.constant 0 : i32; - v1609 = arith.constant 4 : i32; - v228 = arith.eq v1497, v1609 : i1; - v229 = arith.zext v228 : u32; - v230 = hir.bitcast v229 : i32; - v232 = arith.neq v230, v1608 : i1; - v1474 = scf.if v232 : i32 { - ^block139: - v1106 = ub.poison i32 : i32; - scf.yield v1106; - } else { - ^block25: - v236 = hir.bitcast v226 : u32; - v1607 = arith.constant 4 : u32; - v238 = arith.mod v236, v1607 : u32; - hir.assertz v238 #[code = 250]; - v239 = hir.int_to_ptr v236 : ptr; - v240 = hir.load v239 : felt; - v1606 = arith.constant 4 : i32; - v235 = arith.add v1498, v1606 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v235, v240) - v1605 = arith.constant 4 : i32; - v242 = arith.add v1497, v1605 : i32 #[overflow = wrapping]; - scf.yield v242; - }; - v1600 = ub.poison i32 : i32; - v1480 = cf.select v232, v1600, v1502 : i32; - v1601 = ub.poison felt : felt; - v1479 = cf.select v232, v1601, v1501 : felt; - v1602 = ub.poison felt : felt; - v1478 = cf.select v232, v1602, v1500 : felt; - v1153 = ub.poison felt : felt; - v1477 = cf.select v232, v1153, v1499 : felt; - v1603 = ub.poison i32 : i32; - v1476 = cf.select v232, v1603, v1498 : i32; - v1604 = ub.poison i32 : i32; - v1475 = cf.select v232, v1604, v1496 : i32; - v1105 = arith.constant 1 : u32; - v1098 = arith.constant 0 : u32; - v1482 = cf.select v232, v1098, v1105 : u32; - v1353 = arith.trunc v1482 : i1; - scf.condition v1353, v1475, v1474, v1476, v1477, v1478, v1479, v1480, v1498, v1499, v1500, v1501, v1502, v226; - } do { - ^block150(v1503: i32, v1504: i32, v1505: i32, v1506: felt, v1507: felt, v1508: felt, v1509: i32, v1510: i32, v1511: felt, v1512: felt, v1513: felt, v1514: i32, v1515: i32): - scf.yield v1503, v1504, v1505, v1506, v1507, v1508, v1509; - }; - v244 = arith.constant 20 : u32; - v243 = hir.bitcast v1490 : u32; - v245 = arith.add v243, v244 : u32 #[overflow = checked]; - v1599 = arith.constant 4 : u32; - v247 = arith.mod v245, v1599 : u32; - hir.assertz v247 #[code = 250]; - v248 = hir.int_to_ptr v245 : ptr; - hir.store v248, v1495; - v249 = arith.constant 16 : i32; - v250 = arith.add v1490, v249 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v250) - v251 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 - v253 = hir.bitcast v251 : u32; - v1598 = arith.constant 4 : u32; - v255 = arith.mod v253, v1598 : u32; - hir.assertz v255 #[code = 250]; - v256 = hir.int_to_ptr v253 : ptr; - hir.store v256, v1491; - v1597 = arith.constant 28 : u32; - v259 = hir.bitcast v1490 : u32; - v261 = arith.add v259, v1597 : u32 #[overflow = checked]; - v1596 = arith.constant 4 : u32; - v263 = arith.mod v261, v1596 : u32; - hir.assertz v263 #[code = 250]; - v1595 = arith.constant 4 : i32; - v258 = arith.add v251, v1595 : i32 #[overflow = wrapping]; - v264 = hir.int_to_ptr v261 : ptr; - hir.store v264, v258; - v1594 = arith.constant 24 : u32; - v266 = hir.bitcast v1490 : u32; - v268 = arith.add v266, v1594 : u32 #[overflow = checked]; - v1593 = arith.constant 4 : u32; - v270 = arith.mod v268, v1593 : u32; - hir.assertz v270 #[code = 250]; - v1592 = arith.constant 1 : i32; - v271 = hir.int_to_ptr v268 : ptr; - hir.store v271, v1592; - v1591 = arith.constant 16 : u32; - v272 = hir.bitcast v1490 : u32; - v274 = arith.add v272, v1591 : u32 #[overflow = checked]; - v1590 = arith.constant 4 : u32; - v276 = arith.mod v274, v1590 : u32; - hir.assertz v276 #[code = 250]; - v277 = hir.int_to_ptr v274 : ptr; - hir.store v277, v251; - v1589 = arith.constant 0 : i32; - v1446, v1447, v1448, v1449, v1450, v1451, v1452, v1453, v1454, v1455, v1456 = scf.while v251, v1589, v1490, v1492, v1493, v1494 : i32, i32, i32, felt, felt, i32, i32, felt, felt, i32, i32 { - ^block147(v1457: i32, v1458: i32, v1459: i32, v1460: felt, v1461: felt, v1462: i32): - v281 = arith.add v1457, v1458 : i32 #[overflow = wrapping]; - v1587 = arith.constant 0 : i32; - v1588 = arith.constant 4 : i32; - v283 = arith.eq v1458, v1588 : i1; - v284 = arith.zext v283 : u32; - v285 = hir.bitcast v284 : i32; - v287 = arith.neq v285, v1587 : i1; - v1438 = scf.if v287 : i32 { - ^block140: - v1586 = ub.poison i32 : i32; - scf.yield v1586; - } else { - ^block29: - v291 = hir.bitcast v281 : u32; - v1585 = arith.constant 4 : u32; - v293 = arith.mod v291, v1585 : u32; - hir.assertz v293 #[code = 250]; - v294 = hir.int_to_ptr v291 : ptr; - v295 = hir.load v294 : felt; - v1584 = arith.constant 4 : i32; - v290 = arith.add v1459, v1584 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v290, v295) - v1583 = arith.constant 4 : i32; - v297 = arith.add v1458, v1583 : i32 #[overflow = wrapping]; - scf.yield v297; - }; - v1576 = ub.poison i32 : i32; - v1443 = cf.select v287, v1576, v1462 : i32; - v1577 = ub.poison felt : felt; - v1442 = cf.select v287, v1577, v1461 : felt; - v1578 = ub.poison felt : felt; - v1441 = cf.select v287, v1578, v1460 : felt; - v1579 = ub.poison i32 : i32; - v1440 = cf.select v287, v1579, v1459 : i32; - v1580 = ub.poison i32 : i32; - v1439 = cf.select v287, v1580, v1457 : i32; - v1581 = arith.constant 1 : u32; - v1582 = arith.constant 0 : u32; - v1445 = cf.select v287, v1582, v1581 : u32; - v1272 = arith.trunc v1445 : i1; - scf.condition v1272, v1439, v1438, v1440, v1441, v1442, v1443, v1459, v1460, v1461, v1462, v281; - } do { - ^block148(v1463: i32, v1464: i32, v1465: i32, v1466: felt, v1467: felt, v1468: i32, v1469: i32, v1470: felt, v1471: felt, v1472: i32, v1473: i32): - scf.yield v1463, v1464, v1465, v1466, v1467, v1468; - }; - v1575 = arith.constant 20 : u32; - v298 = hir.bitcast v1452 : u32; - v300 = arith.add v298, v1575 : u32 #[overflow = checked]; - v1574 = arith.constant 4 : u32; - v302 = arith.mod v300, v1574 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - hir.store v303, v1456; - v1573 = arith.constant 16 : i32; - v305 = arith.add v1452, v1573 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v305) - v306 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 - v309 = hir.bitcast v306 : u32; - v1572 = arith.constant 4 : u32; - v311 = arith.mod v309, v1572 : u32; - hir.assertz v311 #[code = 250]; - v312 = hir.int_to_ptr v309 : ptr; - hir.store v312, v1453; - v1571 = arith.constant 28 : u32; - v315 = hir.bitcast v1452 : u32; - v317 = arith.add v315, v1571 : u32 #[overflow = checked]; - v1570 = arith.constant 4 : u32; - v319 = arith.mod v317, v1570 : u32; - hir.assertz v319 #[code = 250]; - v1569 = arith.constant 4 : i32; - v314 = arith.add v306, v1569 : i32 #[overflow = wrapping]; - v320 = hir.int_to_ptr v317 : ptr; - hir.store v320, v314; - v1568 = arith.constant 24 : u32; - v322 = hir.bitcast v1452 : u32; - v324 = arith.add v322, v1568 : u32 #[overflow = checked]; - v1567 = arith.constant 4 : u32; - v326 = arith.mod v324, v1567 : u32; - hir.assertz v326 #[code = 250]; - v1566 = arith.constant 1 : i32; - v327 = hir.int_to_ptr v324 : ptr; - hir.store v327, v1566; - v1565 = arith.constant 16 : u32; - v328 = hir.bitcast v1452 : u32; - v330 = arith.add v328, v1565 : u32 #[overflow = checked]; - v1564 = arith.constant 4 : u32; - v332 = arith.mod v330, v1564 : u32; - hir.assertz v332 #[code = 250]; - v333 = hir.int_to_ptr v330 : ptr; - hir.store v333, v306; - v1563 = arith.constant 0 : i32; - v1415, v1416, v1417, v1418, v1419, v1420, v1421, v1422, v1423 = scf.while v306, v1563, v1452, v1454, v1455 : i32, i32, i32, felt, i32, i32, felt, i32, i32 { - ^block145(v1424: i32, v1425: i32, v1426: i32, v1427: felt, v1428: i32): - v337 = arith.add v1424, v1425 : i32 #[overflow = wrapping]; - v1561 = arith.constant 0 : i32; - v1562 = arith.constant 4 : i32; - v339 = arith.eq v1425, v1562 : i1; - v340 = arith.zext v339 : u32; - v341 = hir.bitcast v340 : i32; - v343 = arith.neq v341, v1561 : i1; - v1408 = scf.if v343 : i32 { - ^block141: - v1560 = ub.poison i32 : i32; - scf.yield v1560; - } else { - ^block33: - v347 = hir.bitcast v337 : u32; - v1559 = arith.constant 4 : u32; - v349 = arith.mod v347, v1559 : u32; - hir.assertz v349 #[code = 250]; - v350 = hir.int_to_ptr v347 : ptr; - v351 = hir.load v350 : felt; - v1558 = arith.constant 4 : i32; - v346 = arith.add v1426, v1558 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v346, v351) - v1557 = arith.constant 4 : i32; - v353 = arith.add v1425, v1557 : i32 #[overflow = wrapping]; - scf.yield v353; - }; - v1551 = ub.poison i32 : i32; - v1412 = cf.select v343, v1551, v1428 : i32; - v1552 = ub.poison felt : felt; - v1411 = cf.select v343, v1552, v1427 : felt; - v1553 = ub.poison i32 : i32; - v1410 = cf.select v343, v1553, v1426 : i32; - v1554 = ub.poison i32 : i32; - v1409 = cf.select v343, v1554, v1424 : i32; - v1555 = arith.constant 1 : u32; - v1556 = arith.constant 0 : u32; - v1414 = cf.select v343, v1556, v1555 : u32; - v1203 = arith.trunc v1414 : i1; - scf.condition v1203, v1409, v1408, v1410, v1411, v1412, v1426, v1427, v1428, v337; - } do { - ^block146(v1429: i32, v1430: i32, v1431: i32, v1432: felt, v1433: i32, v1434: i32, v1435: felt, v1436: i32, v1437: i32): - scf.yield v1429, v1430, v1431, v1432, v1433; - }; - v1550 = arith.constant 20 : u32; - v354 = hir.bitcast v1420 : u32; - v356 = arith.add v354, v1550 : u32 #[overflow = checked]; - v1549 = arith.constant 4 : u32; - v358 = arith.mod v356, v1549 : u32; - hir.assertz v358 #[code = 250]; - v359 = hir.int_to_ptr v356 : ptr; - hir.store v359, v1423; - v1548 = arith.constant 16 : i32; - v361 = arith.add v1420, v1548 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v361) - v362 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::exchange_malloc() : i32 - v366 = hir.bitcast v362 : u32; - v1547 = arith.constant 4 : u32; - v368 = arith.mod v366, v1547 : u32; - hir.assertz v368 #[code = 250]; - v369 = hir.int_to_ptr v366 : ptr; - hir.store v369, v1421; - v1546 = arith.constant 28 : u32; - v372 = hir.bitcast v1420 : u32; - v374 = arith.add v372, v1546 : u32 #[overflow = checked]; - v1545 = arith.constant 4 : u32; - v376 = arith.mod v374, v1545 : u32; - hir.assertz v376 #[code = 250]; - v1544 = arith.constant 4 : i32; - v371 = arith.add v362, v1544 : i32 #[overflow = wrapping]; - v377 = hir.int_to_ptr v374 : ptr; - hir.store v377, v371; - v1543 = arith.constant 24 : u32; - v379 = hir.bitcast v1420 : u32; - v381 = arith.add v379, v1543 : u32 #[overflow = checked]; - v1542 = arith.constant 4 : u32; - v383 = arith.mod v381, v1542 : u32; - hir.assertz v383 #[code = 250]; - v1541 = arith.constant 1 : i32; - v384 = hir.int_to_ptr v381 : ptr; - hir.store v384, v1541; - v1540 = arith.constant 16 : u32; - v385 = hir.bitcast v1420 : u32; - v387 = arith.add v385, v1540 : u32 #[overflow = checked]; - v1539 = arith.constant 4 : u32; - v389 = arith.mod v387, v1539 : u32; - hir.assertz v389 #[code = 250]; - v390 = hir.int_to_ptr v387 : ptr; - hir.store v390, v362; - v1538 = arith.constant 0 : i32; - v1390, v1391, v1392, v1393, v1394, v1395, v1396 = scf.while v362, v1538, v1420, v1422 : i32, i32, i32, i32, i32, i32, i32 { - ^block143(v1397: i32, v1398: i32, v1399: i32, v1400: i32): - v394 = arith.add v1397, v1398 : i32 #[overflow = wrapping]; - v1536 = arith.constant 0 : i32; - v1537 = arith.constant 4 : i32; - v396 = arith.eq v1398, v1537 : i1; - v397 = arith.zext v396 : u32; - v398 = hir.bitcast v397 : i32; - v400 = arith.neq v398, v1536 : i1; - v1384 = scf.if v400 : i32 { - ^block142: - v1535 = ub.poison i32 : i32; - scf.yield v1535; - } else { - ^block37: - v404 = hir.bitcast v394 : u32; - v1534 = arith.constant 4 : u32; - v406 = arith.mod v404, v1534 : u32; - hir.assertz v406 #[code = 250]; - v407 = hir.int_to_ptr v404 : ptr; - v408 = hir.load v407 : felt; - v1533 = arith.constant 4 : i32; - v403 = arith.add v1399, v1533 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v403, v408) - v1532 = arith.constant 4 : i32; - v410 = arith.add v1398, v1532 : i32 #[overflow = wrapping]; - scf.yield v410; - }; - v1527 = ub.poison i32 : i32; - v1387 = cf.select v400, v1527, v1400 : i32; - v1528 = ub.poison i32 : i32; - v1386 = cf.select v400, v1528, v1399 : i32; - v1529 = ub.poison i32 : i32; - v1385 = cf.select v400, v1529, v1397 : i32; - v1530 = arith.constant 1 : u32; - v1531 = arith.constant 0 : u32; - v1389 = cf.select v400, v1531, v1530 : u32; - v1145 = arith.trunc v1389 : i1; - scf.condition v1145, v1385, v1384, v1386, v1387, v1399, v1400, v394; - } do { - ^block144(v1401: i32, v1402: i32, v1403: i32, v1404: i32, v1405: i32, v1406: i32, v1407: i32): - scf.yield v1401, v1402, v1403, v1404; - }; - v1526 = arith.constant 20 : u32; - v411 = hir.bitcast v1394 : u32; - v413 = arith.add v411, v1526 : u32 #[overflow = checked]; - v1525 = arith.constant 4 : u32; - v415 = arith.mod v413, v1525 : u32; - hir.assertz v415 #[code = 250]; - v416 = hir.int_to_ptr v413 : ptr; - hir.store v416, v1396; - v1524 = arith.constant 16 : i32; - v418 = arith.add v1394, v1524 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::drop_in_place>(v418) - v423 = arith.constant 8 : i32; - v1523 = arith.constant 4 : i32; - v426 = arith.add v1394, v1523 : i32 #[overflow = wrapping]; - v428 = arith.add v426, v423 : i32 #[overflow = wrapping]; - v429 = hir.bitcast v428 : u32; - v1522 = arith.constant 4 : u32; - v431 = arith.mod v429, v1522 : u32; - hir.assertz v431 #[code = 250]; - v432 = hir.int_to_ptr v429 : ptr; - v433 = hir.load v432 : i32; - v1521 = arith.constant 8 : i32; - v424 = arith.add v1395, v1521 : i32 #[overflow = wrapping]; - v434 = hir.bitcast v424 : u32; - v1520 = arith.constant 4 : u32; - v436 = arith.mod v434, v1520 : u32; - hir.assertz v436 #[code = 250]; - v437 = hir.int_to_ptr v434 : ptr; - hir.store v437, v433; - v1519 = arith.constant 4 : u32; - v438 = hir.bitcast v1394 : u32; - v440 = arith.add v438, v1519 : u32 #[overflow = checked]; - v1518 = arith.constant 4 : u32; - v442 = arith.mod v440, v1518 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - v444 = hir.load v443 : i64; - v445 = hir.bitcast v1395 : u32; - v1517 = arith.constant 4 : u32; - v447 = arith.mod v445, v1517 : u32; - hir.assertz v447 #[code = 250]; - v448 = hir.int_to_ptr v445 : ptr; - hir.store v448, v444; - v1516 = arith.constant 32 : i32; - v450 = arith.add v1394, v1516 : i32 #[overflow = wrapping]; - v451 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v452 = hir.bitcast v451 : ptr; - hir.store v452, v450; + public builtin.function @entrypoint(v90: i32, v91: i32) { + ^block12(v90: i32, v91: i32): + v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + v96 = hir.load v95 : i32; + v97 = arith.constant 16 : i32; + v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v102 = arith.constant 12 : u32; + v101 = hir.bitcast v91 : u32; + v103 = arith.add v101, v102 : u32 #[overflow = checked]; + v104 = arith.constant 4 : u32; + v105 = arith.mod v103, v104 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + v107 = hir.load v106 : felt; + v109 = arith.constant 8 : u32; + v108 = hir.bitcast v91 : u32; + v110 = arith.add v108, v109 : u32 #[overflow = checked]; + v777 = arith.constant 4 : u32; + v112 = arith.mod v110, v777 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v776 = arith.constant 4 : u32; + v115 = hir.bitcast v91 : u32; + v117 = arith.add v115, v776 : u32 #[overflow = checked]; + v775 = arith.constant 4 : u32; + v119 = arith.mod v117, v775 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v122 = hir.bitcast v91 : u32; + v774 = arith.constant 4 : u32; + v124 = arith.mod v122, v774 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + v129 = arith.constant 8 : i32; + v127 = arith.constant 4 : i32; + v128 = arith.add v98, v127 : i32 #[overflow = wrapping]; + v130 = arith.add v128, v129 : i32 #[overflow = wrapping]; + v132 = hir.bitcast v130 : u32; + v773 = arith.constant 4 : u32; + v134 = arith.mod v132, v773 : u32; + hir.assertz v134 #[code = 250]; + v92 = arith.constant 0 : i32; + v135 = hir.int_to_ptr v132 : ptr; + hir.store v135, v92; + v772 = arith.constant 4 : u32; + v137 = hir.bitcast v98 : u32; + v139 = arith.add v137, v772 : u32 #[overflow = checked]; + v771 = arith.constant 4 : u32; + v141 = arith.mod v139, v771 : u32; + hir.assertz v141 #[code = 250]; + v136 = arith.constant 17179869184 : i64; + v142 = hir.int_to_ptr v139 : ptr; + hir.store v142, v136; + v770 = arith.constant 4 : i32; + v144 = arith.add v98, v770 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v144, v126) + v769 = arith.constant 4 : i32; + v146 = arith.add v98, v769 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v146, v121) + v768 = arith.constant 4 : i32; + v148 = arith.add v98, v768 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v148, v114) + v767 = arith.constant 4 : i32; + v150 = arith.add v98, v767 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v150, v107) + v153 = hir.bitcast v130 : u32; + v766 = arith.constant 4 : u32; + v155 = arith.mod v153, v766 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : i32; + v765 = arith.constant 8 : i32; + v152 = arith.add v90, v765 : i32 #[overflow = wrapping]; + v158 = hir.bitcast v152 : u32; + v764 = arith.constant 4 : u32; + v160 = arith.mod v158, v764 : u32; + hir.assertz v160 #[code = 250]; + v161 = hir.int_to_ptr v158 : ptr; + hir.store v161, v157; + v763 = arith.constant 4 : u32; + v162 = hir.bitcast v98 : u32; + v164 = arith.add v162, v763 : u32 #[overflow = checked]; + v762 = arith.constant 4 : u32; + v166 = arith.mod v164, v762 : u32; + hir.assertz v166 #[code = 250]; + v167 = hir.int_to_ptr v164 : ptr; + v168 = hir.load v167 : i64; + v169 = hir.bitcast v90 : u32; + v761 = arith.constant 4 : u32; + v171 = arith.mod v169, v761 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v168; + v760 = arith.constant 16 : i32; + v174 = arith.add v98, v760 : i32 #[overflow = wrapping]; + v175 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v176 = hir.bitcast v175 : ptr; + hir.store v176, v174; builtin.ret ; }; - private builtin.function @__rustc::__rust_dealloc(v453: i32, v454: i32, v455: i32) { - ^block38(v453: i32, v454: i32, v455: i32): - builtin.ret ; + private builtin.function @__rustc::__rust_alloc(v177: i32, v178: i32) -> i32 { + ^block14(v177: i32, v178: i32): + v180 = arith.constant 1048604 : i32; + v181 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v180, v178, v177) : i32 + builtin.ret v181; }; - private builtin.function @__rustc::__rust_realloc(v456: i32, v457: i32, v458: i32, v459: i32) -> i32 { - ^block40(v456: i32, v457: i32, v458: i32, v459: i32): - v461 = arith.constant 1048604 : i32; - v462 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v461, v458, v459) : i32 - v1631 = arith.constant 0 : i32; - v463 = arith.constant 0 : i32; - v464 = arith.eq v462, v463 : i1; - v465 = arith.zext v464 : u32; - v466 = hir.bitcast v465 : i32; - v468 = arith.neq v466, v1631 : i1; - scf.if v468{ - ^block42: + private builtin.function @__rustc::__rust_realloc(v182: i32, v183: i32, v184: i32, v185: i32) -> i32 { + ^block16(v182: i32, v183: i32, v184: i32, v185: i32): + v187 = arith.constant 1048604 : i32; + v188 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v187, v184, v185) : i32 + v786 = arith.constant 0 : i32; + v189 = arith.constant 0 : i32; + v190 = arith.eq v188, v189 : i1; + v191 = arith.zext v190 : u32; + v192 = hir.bitcast v191 : i32; + v194 = arith.neq v192, v786 : i1; + scf.if v194{ + ^block18: scf.yield ; } else { - ^block43: - v1630 = arith.constant 0 : i32; - v470 = hir.bitcast v457 : u32; - v469 = hir.bitcast v459 : u32; - v471 = arith.lt v469, v470 : i1; - v472 = arith.zext v471 : u32; - v473 = hir.bitcast v472 : i32; - v475 = arith.neq v473, v1630 : i1; - v476 = cf.select v475, v459, v457 : i32; - v1628 = arith.constant 0 : i32; - v1629 = arith.constant 0 : i32; - v478 = arith.eq v476, v1629 : i1; - v479 = arith.zext v478 : u32; - v480 = hir.bitcast v479 : i32; - v482 = arith.neq v480, v1628 : i1; - scf.if v482{ - ^block151: + ^block19: + v785 = arith.constant 0 : i32; + v196 = hir.bitcast v183 : u32; + v195 = hir.bitcast v185 : u32; + v197 = arith.lt v195, v196 : i1; + v198 = arith.zext v197 : u32; + v199 = hir.bitcast v198 : i32; + v201 = arith.neq v199, v785 : i1; + v202 = cf.select v201, v185, v183 : i32; + v783 = arith.constant 0 : i32; + v784 = arith.constant 0 : i32; + v204 = arith.eq v202, v784 : i1; + v205 = arith.zext v204 : u32; + v206 = hir.bitcast v205 : i32; + v208 = arith.neq v206, v783 : i1; + scf.if v208{ + ^block82: scf.yield ; } else { - ^block44: - v483 = hir.bitcast v476 : u32; - v484 = hir.bitcast v462 : u32; - v485 = hir.int_to_ptr v484 : ptr; - v486 = hir.bitcast v456 : u32; - v487 = hir.int_to_ptr v486 : ptr; - hir.mem_cpy v487, v485, v483; + ^block20: + v209 = hir.bitcast v202 : u32; + v210 = hir.bitcast v188 : u32; + v211 = hir.int_to_ptr v210 : ptr; + v212 = hir.bitcast v182 : u32; + v213 = hir.int_to_ptr v212 : ptr; + hir.mem_cpy v213, v211, v209; scf.yield ; }; scf.yield ; }; - builtin.ret v462; + builtin.ret v188; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v489: i32, v490: i32) -> i32 { - ^block45(v489: i32, v490: i32): - v492 = arith.constant 1048604 : i32; - v493 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v492, v490, v489) : i32 - v1640 = arith.constant 0 : i32; - v494 = arith.constant 0 : i32; - v495 = arith.eq v493, v494 : i1; - v496 = arith.zext v495 : u32; - v497 = hir.bitcast v496 : i32; - v499 = arith.neq v497, v1640 : i1; - scf.if v499{ - ^block47: + private builtin.function @__rustc::__rust_alloc_zeroed(v215: i32, v216: i32) -> i32 { + ^block21(v215: i32, v216: i32): + v218 = arith.constant 1048604 : i32; + v219 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v218, v216, v215) : i32 + v795 = arith.constant 0 : i32; + v220 = arith.constant 0 : i32; + v221 = arith.eq v219, v220 : i1; + v222 = arith.zext v221 : u32; + v223 = hir.bitcast v222 : i32; + v225 = arith.neq v223, v795 : i1; + scf.if v225{ + ^block23: scf.yield ; } else { - ^block48: - v1638 = arith.constant 0 : i32; - v1639 = arith.constant 0 : i32; - v501 = arith.eq v489, v1639 : i1; - v502 = arith.zext v501 : u32; - v503 = hir.bitcast v502 : i32; - v505 = arith.neq v503, v1638 : i1; - scf.if v505{ - ^block154: + ^block24: + v793 = arith.constant 0 : i32; + v794 = arith.constant 0 : i32; + v227 = arith.eq v215, v794 : i1; + v228 = arith.zext v227 : u32; + v229 = hir.bitcast v228 : i32; + v231 = arith.neq v229, v793 : i1; + scf.if v231{ + ^block85: scf.yield ; } else { - ^block49: - v1632 = arith.constant 0 : u8; - v508 = hir.bitcast v489 : u32; - v509 = hir.bitcast v493 : u32; - v510 = hir.int_to_ptr v509 : ptr; - hir.mem_set v510, v508, v1632; + ^block25: + v787 = arith.constant 0 : u8; + v234 = hir.bitcast v215 : u32; + v235 = hir.bitcast v219 : u32; + v236 = hir.int_to_ptr v235 : ptr; + hir.mem_set v236, v234, v787; scf.yield ; }; scf.yield ; }; - builtin.ret v493; + builtin.ret v219; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block50: + ^block26: builtin.ret ; }; - private builtin.function @::alloc(v512: i32, v513: i32, v514: i32) -> i32 { - ^block52(v512: i32, v513: i32, v514: i32): - v517 = arith.constant 16 : i32; - v516 = arith.constant 0 : i32; - v1642 = arith.constant 16 : u32; - v519 = hir.bitcast v513 : u32; - v521 = arith.gt v519, v1642 : i1; - v522 = arith.zext v521 : u32; - v523 = hir.bitcast v522 : i32; - v525 = arith.neq v523, v516 : i1; - v526 = cf.select v525, v513, v517 : i32; - v1682 = arith.constant 0 : i32; - v527 = arith.constant -1 : i32; - v528 = arith.add v526, v527 : i32 #[overflow = wrapping]; - v529 = arith.band v526, v528 : i32; - v531 = arith.neq v529, v1682 : i1; - v1651, v1652 = scf.if v531 : i32, u32 { - ^block159: - v1643 = arith.constant 0 : u32; - v1647 = ub.poison i32 : i32; - scf.yield v1647, v1643; + private builtin.function @::alloc(v238: i32, v239: i32, v240: i32) -> i32 { + ^block28(v238: i32, v239: i32, v240: i32): + v243 = arith.constant 16 : i32; + v242 = arith.constant 0 : i32; + v797 = arith.constant 16 : u32; + v245 = hir.bitcast v239 : u32; + v247 = arith.gt v245, v797 : i1; + v248 = arith.zext v247 : u32; + v249 = hir.bitcast v248 : i32; + v251 = arith.neq v249, v242 : i1; + v252 = cf.select v251, v239, v243 : i32; + v837 = arith.constant 0 : i32; + v253 = arith.constant -1 : i32; + v254 = arith.add v252, v253 : i32 #[overflow = wrapping]; + v255 = arith.band v252, v254 : i32; + v257 = arith.neq v255, v837 : i1; + v806, v807 = scf.if v257 : i32, u32 { + ^block90: + v798 = arith.constant 0 : u32; + v802 = ub.poison i32 : i32; + scf.yield v802, v798; } else { - ^block55: - v533 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::alignment::Alignment::max(v513, v526) : i32 - v1681 = arith.constant 0 : i32; - v532 = arith.constant -2147483648 : i32; - v534 = arith.sub v532, v533 : i32 #[overflow = wrapping]; - v536 = hir.bitcast v534 : u32; - v535 = hir.bitcast v514 : u32; - v537 = arith.gt v535, v536 : i1; - v538 = arith.zext v537 : u32; - v539 = hir.bitcast v538 : i32; - v541 = arith.neq v539, v1681 : i1; - v1666 = scf.if v541 : i32 { - ^block158: - v1680 = ub.poison i32 : i32; - scf.yield v1680; + ^block31: + v259 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::alignment::Alignment::max(v239, v252) : i32 + v836 = arith.constant 0 : i32; + v258 = arith.constant -2147483648 : i32; + v260 = arith.sub v258, v259 : i32 #[overflow = wrapping]; + v262 = hir.bitcast v260 : u32; + v261 = hir.bitcast v240 : u32; + v263 = arith.gt v261, v262 : i1; + v264 = arith.zext v263 : u32; + v265 = hir.bitcast v264 : i32; + v267 = arith.neq v265, v836 : i1; + v821 = scf.if v267 : i32 { + ^block89: + v835 = ub.poison i32 : i32; + scf.yield v835; } else { - ^block56: - v1678 = arith.constant 0 : i32; - v547 = arith.sub v1678, v533 : i32 #[overflow = wrapping]; - v1679 = arith.constant -1 : i32; - v543 = arith.add v514, v533 : i32 #[overflow = wrapping]; - v545 = arith.add v543, v1679 : i32 #[overflow = wrapping]; - v548 = arith.band v545, v547 : i32; - v549 = hir.bitcast v512 : u32; - v550 = arith.constant 4 : u32; - v551 = arith.mod v549, v550 : u32; - hir.assertz v551 #[code = 250]; - v552 = hir.int_to_ptr v549 : ptr; - v553 = hir.load v552 : i32; - v1677 = arith.constant 0 : i32; - v555 = arith.neq v553, v1677 : i1; - scf.if v555{ - ^block157: + ^block32: + v833 = arith.constant 0 : i32; + v273 = arith.sub v833, v259 : i32 #[overflow = wrapping]; + v834 = arith.constant -1 : i32; + v269 = arith.add v240, v259 : i32 #[overflow = wrapping]; + v271 = arith.add v269, v834 : i32 #[overflow = wrapping]; + v274 = arith.band v271, v273 : i32; + v275 = hir.bitcast v238 : u32; + v276 = arith.constant 4 : u32; + v277 = arith.mod v275, v276 : u32; + hir.assertz v277 #[code = 250]; + v278 = hir.int_to_ptr v275 : ptr; + v279 = hir.load v278 : i32; + v832 = arith.constant 0 : i32; + v281 = arith.neq v279, v832 : i1; + scf.if v281{ + ^block88: scf.yield ; } else { - ^block58: - v556 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/intrinsics::mem::heap_base() : i32 - v557 = hir.mem_size : u32; - v563 = hir.bitcast v512 : u32; - v1676 = arith.constant 4 : u32; - v565 = arith.mod v563, v1676 : u32; - hir.assertz v565 #[code = 250]; - v1675 = arith.constant 16 : u32; - v558 = hir.bitcast v557 : i32; - v561 = arith.shl v558, v1675 : i32; - v562 = arith.add v556, v561 : i32 #[overflow = wrapping]; - v566 = hir.int_to_ptr v563 : ptr; - hir.store v566, v562; + ^block34: + v282 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/intrinsics::mem::heap_base() : i32 + v283 = hir.mem_size : u32; + v289 = hir.bitcast v238 : u32; + v831 = arith.constant 4 : u32; + v291 = arith.mod v289, v831 : u32; + hir.assertz v291 #[code = 250]; + v830 = arith.constant 16 : u32; + v284 = hir.bitcast v283 : i32; + v287 = arith.shl v284, v830 : i32; + v288 = arith.add v282, v287 : i32 #[overflow = wrapping]; + v292 = hir.int_to_ptr v289 : ptr; + hir.store v292, v288; scf.yield ; }; - v569 = hir.bitcast v512 : u32; - v1674 = arith.constant 4 : u32; - v571 = arith.mod v569, v1674 : u32; - hir.assertz v571 #[code = 250]; - v572 = hir.int_to_ptr v569 : ptr; - v573 = hir.load v572 : i32; - v1672 = arith.constant 0 : i32; - v1673 = arith.constant -1 : i32; - v575 = arith.bxor v573, v1673 : i32; - v577 = hir.bitcast v575 : u32; - v576 = hir.bitcast v548 : u32; - v578 = arith.gt v576, v577 : i1; - v579 = arith.zext v578 : u32; - v580 = hir.bitcast v579 : i32; - v582 = arith.neq v580, v1672 : i1; - v1665 = scf.if v582 : i32 { - ^block59: - v1671 = arith.constant 0 : i32; - scf.yield v1671; + v295 = hir.bitcast v238 : u32; + v829 = arith.constant 4 : u32; + v297 = arith.mod v295, v829 : u32; + hir.assertz v297 #[code = 250]; + v298 = hir.int_to_ptr v295 : ptr; + v299 = hir.load v298 : i32; + v827 = arith.constant 0 : i32; + v828 = arith.constant -1 : i32; + v301 = arith.bxor v299, v828 : i32; + v303 = hir.bitcast v301 : u32; + v302 = hir.bitcast v274 : u32; + v304 = arith.gt v302, v303 : i1; + v305 = arith.zext v304 : u32; + v306 = hir.bitcast v305 : i32; + v308 = arith.neq v306, v827 : i1; + v820 = scf.if v308 : i32 { + ^block35: + v826 = arith.constant 0 : i32; + scf.yield v826; } else { - ^block60: - v584 = hir.bitcast v512 : u32; - v1670 = arith.constant 4 : u32; - v586 = arith.mod v584, v1670 : u32; - hir.assertz v586 #[code = 250]; - v583 = arith.add v573, v548 : i32 #[overflow = wrapping]; - v587 = hir.int_to_ptr v584 : ptr; - hir.store v587, v583; - v589 = arith.add v573, v533 : i32 #[overflow = wrapping]; - scf.yield v589; + ^block36: + v310 = hir.bitcast v238 : u32; + v825 = arith.constant 4 : u32; + v312 = arith.mod v310, v825 : u32; + hir.assertz v312 #[code = 250]; + v309 = arith.add v299, v274 : i32 #[overflow = wrapping]; + v313 = hir.int_to_ptr v310 : ptr; + hir.store v313, v309; + v315 = arith.add v299, v259 : i32 #[overflow = wrapping]; + scf.yield v315; }; - scf.yield v1665; + scf.yield v820; }; - v1648 = arith.constant 1 : u32; - v1669 = arith.constant 0 : u32; - v1667 = cf.select v541, v1669, v1648 : u32; - scf.yield v1666, v1667; + v803 = arith.constant 1 : u32; + v824 = arith.constant 0 : u32; + v822 = cf.select v267, v824, v803 : u32; + scf.yield v821, v822; }; - v1668 = arith.constant 0 : u32; - v1664 = arith.eq v1652, v1668 : i1; - cf.cond_br v1664 ^block54, ^block161(v1651); - ^block54: + v823 = arith.constant 0 : u32; + v819 = arith.eq v807, v823 : i1; + cf.cond_br v819 ^block30, ^block92(v806); + ^block30: ub.unreachable ; - ^block161(v1644: i32): - builtin.ret v1644; + ^block92(v799: i32): + builtin.ret v799; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block61: - v592 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v592; + ^block37: + v318 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v318; }; - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v594: i32, v595: i32, v596: i32, v597: i32, v598: i32, v599: i32) { - ^block65(v594: i32, v595: i32, v596: i32, v597: i32, v598: i32, v599: i32): - v602 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v603 = hir.bitcast v602 : ptr; - v604 = hir.load v603 : i32; - v605 = arith.constant 32 : i32; - v606 = arith.sub v604, v605 : i32 #[overflow = wrapping]; - v607 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v608 = hir.bitcast v607 : ptr; - hir.store v608, v606; - v1759 = arith.constant 0 : i32; - v600 = arith.constant 0 : i32; - v611 = arith.eq v599, v600 : i1; - v612 = arith.zext v611 : u32; - v613 = hir.bitcast v612 : i32; - v615 = arith.neq v613, v1759 : i1; - v1730, v1731 = scf.if v615 : i32, i32 { - ^block68: - v1758 = arith.constant 0 : i32; - scf.yield v1758, v1758; + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v320: i32, v321: i32, v322: i32, v323: i32, v324: i32, v325: i32) { + ^block41(v320: i32, v321: i32, v322: i32, v323: i32, v324: i32, v325: i32): + v328 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v329 = hir.bitcast v328 : ptr; + v330 = hir.load v329 : i32; + v331 = arith.constant 32 : i32; + v332 = arith.sub v330, v331 : i32 #[overflow = wrapping]; + v333 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v334 = hir.bitcast v333 : ptr; + hir.store v334, v332; + v914 = arith.constant 0 : i32; + v326 = arith.constant 0 : i32; + v337 = arith.eq v325, v326 : i1; + v338 = arith.zext v337 : u32; + v339 = hir.bitcast v338 : i32; + v341 = arith.neq v339, v914 : i1; + v885, v886 = scf.if v341 : i32, i32 { + ^block44: + v913 = arith.constant 0 : i32; + scf.yield v913, v913; } else { - ^block69: - v616 = arith.add v596, v597 : i32 #[overflow = wrapping]; - v1757 = arith.constant 0 : i32; - v618 = hir.bitcast v596 : u32; - v617 = hir.bitcast v616 : u32; - v619 = arith.lt v617, v618 : i1; - v620 = arith.zext v619 : u32; - v621 = hir.bitcast v620 : i32; - v623 = arith.neq v621, v1757 : i1; - v1728, v1729 = scf.if v623 : i32, i32 { - ^block167: - v1756 = arith.constant 0 : i32; - scf.yield v1756, v1756; + ^block45: + v342 = arith.add v322, v323 : i32 #[overflow = wrapping]; + v912 = arith.constant 0 : i32; + v344 = hir.bitcast v322 : u32; + v343 = hir.bitcast v342 : u32; + v345 = arith.lt v343, v344 : i1; + v346 = arith.zext v345 : u32; + v347 = hir.bitcast v346 : i32; + v349 = arith.neq v347, v912 : i1; + v883, v884 = scf.if v349 : i32, i32 { + ^block98: + v911 = arith.constant 0 : i32; + scf.yield v911, v911; } else { - ^block70: - v634 = hir.bitcast v595 : u32; - v748 = arith.constant 4 : u32; - v636 = arith.mod v634, v748 : u32; - hir.assertz v636 #[code = 250]; - v637 = hir.int_to_ptr v634 : ptr; - v638 = hir.load v637 : i32; - v1684 = arith.constant 1 : u32; - v641 = arith.shl v638, v1684 : i32; - v1755 = arith.constant 0 : i32; - v643 = hir.bitcast v641 : u32; - v642 = hir.bitcast v616 : u32; - v644 = arith.gt v642, v643 : i1; - v645 = arith.zext v644 : u32; - v646 = hir.bitcast v645 : i32; - v648 = arith.neq v646, v1755 : i1; - v649 = cf.select v648, v616, v641 : i32; - v1752 = arith.constant 1 : i32; - v651 = arith.constant 4 : i32; - v1753 = arith.constant 0 : i32; - v1683 = arith.constant 1025 : u32; - v654 = hir.bitcast v599 : u32; - v656 = arith.lt v654, v1683 : i1; - v657 = arith.zext v656 : u32; - v658 = hir.bitcast v657 : i32; - v660 = arith.neq v658, v1753 : i1; - v661 = cf.select v660, v651, v1752 : i32; - v650 = arith.constant 8 : i32; - v1754 = arith.constant 0 : i32; - v639 = arith.constant 1 : i32; - v663 = arith.eq v599, v639 : i1; - v664 = arith.zext v663 : u32; - v665 = hir.bitcast v664 : i32; - v667 = arith.neq v665, v1754 : i1; - v668 = cf.select v667, v650, v661 : i32; - v1751 = arith.constant 0 : i32; - v670 = hir.bitcast v668 : u32; - v669 = hir.bitcast v649 : u32; - v671 = arith.gt v669, v670 : i1; - v672 = arith.zext v671 : u32; - v673 = hir.bitcast v672 : i32; - v675 = arith.neq v673, v1751 : i1; - v676 = cf.select v675, v649, v668 : i32; - v677 = hir.bitcast v676 : u32; - v678 = arith.zext v677 : u64; - v679 = hir.bitcast v678 : i64; - v1750 = arith.constant 0 : i32; - v629 = arith.sub v1750, v598 : i32 #[overflow = wrapping]; - v626 = arith.constant -1 : i32; - v625 = arith.add v598, v599 : i32 #[overflow = wrapping]; - v627 = arith.add v625, v626 : i32 #[overflow = wrapping]; - v630 = arith.band v627, v629 : i32; - v631 = hir.bitcast v630 : u32; - v632 = arith.zext v631 : u64; - v633 = hir.bitcast v632 : i64; - v680 = arith.mul v633, v679 : i64 #[overflow = wrapping]; - v1749 = arith.constant 0 : i32; - v681 = arith.constant 32 : i64; - v683 = hir.cast v681 : u32; - v682 = hir.bitcast v680 : u64; - v684 = arith.shr v682, v683 : u64; - v685 = hir.bitcast v684 : i64; - v686 = arith.trunc v685 : i32; - v688 = arith.neq v686, v1749 : i1; - v1726, v1727 = scf.if v688 : i32, i32 { - ^block166: - v1748 = arith.constant 0 : i32; - scf.yield v649, v1748; + ^block46: + v360 = hir.bitcast v321 : u32; + v474 = arith.constant 4 : u32; + v362 = arith.mod v360, v474 : u32; + hir.assertz v362 #[code = 250]; + v363 = hir.int_to_ptr v360 : ptr; + v364 = hir.load v363 : i32; + v839 = arith.constant 1 : u32; + v367 = arith.shl v364, v839 : i32; + v910 = arith.constant 0 : i32; + v369 = hir.bitcast v367 : u32; + v368 = hir.bitcast v342 : u32; + v370 = arith.gt v368, v369 : i1; + v371 = arith.zext v370 : u32; + v372 = hir.bitcast v371 : i32; + v374 = arith.neq v372, v910 : i1; + v375 = cf.select v374, v342, v367 : i32; + v907 = arith.constant 1 : i32; + v377 = arith.constant 4 : i32; + v908 = arith.constant 0 : i32; + v838 = arith.constant 1025 : u32; + v380 = hir.bitcast v325 : u32; + v382 = arith.lt v380, v838 : i1; + v383 = arith.zext v382 : u32; + v384 = hir.bitcast v383 : i32; + v386 = arith.neq v384, v908 : i1; + v387 = cf.select v386, v377, v907 : i32; + v376 = arith.constant 8 : i32; + v909 = arith.constant 0 : i32; + v365 = arith.constant 1 : i32; + v389 = arith.eq v325, v365 : i1; + v390 = arith.zext v389 : u32; + v391 = hir.bitcast v390 : i32; + v393 = arith.neq v391, v909 : i1; + v394 = cf.select v393, v376, v387 : i32; + v906 = arith.constant 0 : i32; + v396 = hir.bitcast v394 : u32; + v395 = hir.bitcast v375 : u32; + v397 = arith.gt v395, v396 : i1; + v398 = arith.zext v397 : u32; + v399 = hir.bitcast v398 : i32; + v401 = arith.neq v399, v906 : i1; + v402 = cf.select v401, v375, v394 : i32; + v403 = hir.bitcast v402 : u32; + v404 = arith.zext v403 : u64; + v405 = hir.bitcast v404 : i64; + v905 = arith.constant 0 : i32; + v355 = arith.sub v905, v324 : i32 #[overflow = wrapping]; + v352 = arith.constant -1 : i32; + v351 = arith.add v324, v325 : i32 #[overflow = wrapping]; + v353 = arith.add v351, v352 : i32 #[overflow = wrapping]; + v356 = arith.band v353, v355 : i32; + v357 = hir.bitcast v356 : u32; + v358 = arith.zext v357 : u64; + v359 = hir.bitcast v358 : i64; + v406 = arith.mul v359, v405 : i64 #[overflow = wrapping]; + v904 = arith.constant 0 : i32; + v407 = arith.constant 32 : i64; + v409 = hir.cast v407 : u32; + v408 = hir.bitcast v406 : u64; + v410 = arith.shr v408, v409 : u64; + v411 = hir.bitcast v410 : i64; + v412 = arith.trunc v411 : i32; + v414 = arith.neq v412, v904 : i1; + v881, v882 = scf.if v414 : i32, i32 { + ^block97: + v903 = arith.constant 0 : i32; + scf.yield v375, v903; } else { - ^block71: - v689 = arith.trunc v680 : i32; - v1747 = arith.constant 0 : i32; - v690 = arith.constant -2147483648 : i32; - v691 = arith.sub v690, v598 : i32 #[overflow = wrapping]; - v693 = hir.bitcast v691 : u32; - v692 = hir.bitcast v689 : u32; - v694 = arith.gt v692, v693 : i1; - v695 = arith.zext v694 : u32; - v696 = hir.bitcast v695 : i32; - v698 = arith.neq v696, v1747 : i1; - v1724, v1725 = scf.if v698 : i32, i32 { - ^block165: - v1746 = arith.constant 0 : i32; - scf.yield v649, v1746; + ^block47: + v415 = arith.trunc v406 : i32; + v902 = arith.constant 0 : i32; + v416 = arith.constant -2147483648 : i32; + v417 = arith.sub v416, v324 : i32 #[overflow = wrapping]; + v419 = hir.bitcast v417 : u32; + v418 = hir.bitcast v415 : u32; + v420 = arith.gt v418, v419 : i1; + v421 = arith.zext v420 : u32; + v422 = hir.bitcast v421 : i32; + v424 = arith.neq v422, v902 : i1; + v879, v880 = scf.if v424 : i32, i32 { + ^block96: + v901 = arith.constant 0 : i32; + scf.yield v375, v901; } else { - ^block72: - v699 = arith.constant 20 : i32; - v700 = arith.add v606, v699 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v700, v595, v598, v599) - v1744 = arith.constant 20 : i32; - v704 = arith.add v606, v1744 : i32 #[overflow = wrapping]; - v1745 = arith.constant 8 : i32; - v702 = arith.add v606, v1745 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::finish_grow(v702, v598, v689, v704, v594) - v706 = arith.constant 12 : u32; - v705 = hir.bitcast v606 : u32; - v707 = arith.add v705, v706 : u32 #[overflow = checked]; - v1743 = arith.constant 4 : u32; - v709 = arith.mod v707, v1743 : u32; - hir.assertz v709 #[code = 250]; - v710 = hir.int_to_ptr v707 : ptr; - v711 = hir.load v710 : i32; - v713 = arith.constant 8 : u32; - v712 = hir.bitcast v606 : u32; - v714 = arith.add v712, v713 : u32 #[overflow = checked]; - v1742 = arith.constant 4 : u32; - v716 = arith.mod v714, v1742 : u32; - hir.assertz v716 #[code = 250]; - v717 = hir.int_to_ptr v714 : ptr; - v718 = hir.load v717 : i32; - v1740 = arith.constant 0 : i32; - v1741 = arith.constant 0 : i32; - v720 = arith.eq v718, v1741 : i1; - v721 = arith.zext v720 : u32; - v722 = hir.bitcast v721 : i32; - v724 = arith.neq v722, v1740 : i1; - v1722 = scf.if v724 : i32 { - ^block73: - v732 = hir.bitcast v595 : u32; - v1739 = arith.constant 4 : u32; - v734 = arith.mod v732, v1739 : u32; - hir.assertz v734 #[code = 250]; - v735 = hir.int_to_ptr v732 : ptr; - hir.store v735, v676; - v1738 = arith.constant 4 : u32; - v736 = hir.bitcast v595 : u32; - v738 = arith.add v736, v1738 : u32 #[overflow = checked]; - v1737 = arith.constant 4 : u32; - v740 = arith.mod v738, v1737 : u32; - hir.assertz v740 #[code = 250]; - v741 = hir.int_to_ptr v738 : ptr; - hir.store v741, v711; - scf.yield v649; + ^block48: + v425 = arith.constant 20 : i32; + v426 = arith.add v332, v425 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v426, v321, v324, v325) + v899 = arith.constant 20 : i32; + v430 = arith.add v332, v899 : i32 #[overflow = wrapping]; + v900 = arith.constant 8 : i32; + v428 = arith.add v332, v900 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::finish_grow(v428, v324, v415, v430, v320) + v432 = arith.constant 12 : u32; + v431 = hir.bitcast v332 : u32; + v433 = arith.add v431, v432 : u32 #[overflow = checked]; + v898 = arith.constant 4 : u32; + v435 = arith.mod v433, v898 : u32; + hir.assertz v435 #[code = 250]; + v436 = hir.int_to_ptr v433 : ptr; + v437 = hir.load v436 : i32; + v439 = arith.constant 8 : u32; + v438 = hir.bitcast v332 : u32; + v440 = arith.add v438, v439 : u32 #[overflow = checked]; + v897 = arith.constant 4 : u32; + v442 = arith.mod v440, v897 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + v444 = hir.load v443 : i32; + v895 = arith.constant 0 : i32; + v896 = arith.constant 0 : i32; + v446 = arith.eq v444, v896 : i1; + v447 = arith.zext v446 : u32; + v448 = hir.bitcast v447 : i32; + v450 = arith.neq v448, v895 : i1; + v877 = scf.if v450 : i32 { + ^block49: + v458 = hir.bitcast v321 : u32; + v894 = arith.constant 4 : u32; + v460 = arith.mod v458, v894 : u32; + hir.assertz v460 #[code = 250]; + v461 = hir.int_to_ptr v458 : ptr; + hir.store v461, v402; + v893 = arith.constant 4 : u32; + v462 = hir.bitcast v321 : u32; + v464 = arith.add v462, v893 : u32 #[overflow = checked]; + v892 = arith.constant 4 : u32; + v466 = arith.mod v464, v892 : u32; + hir.assertz v466 #[code = 250]; + v467 = hir.int_to_ptr v464 : ptr; + hir.store v467, v437; + scf.yield v375; } else { - ^block74: - v726 = arith.constant 16 : u32; - v725 = hir.bitcast v606 : u32; - v727 = arith.add v725, v726 : u32 #[overflow = checked]; - v1736 = arith.constant 4 : u32; - v729 = arith.mod v727, v1736 : u32; - hir.assertz v729 #[code = 250]; - v730 = hir.int_to_ptr v727 : ptr; - v731 = hir.load v730 : i32; - scf.yield v731; + ^block50: + v452 = arith.constant 16 : u32; + v451 = hir.bitcast v332 : u32; + v453 = arith.add v451, v452 : u32 #[overflow = checked]; + v891 = arith.constant 4 : u32; + v455 = arith.mod v453, v891 : u32; + hir.assertz v455 #[code = 250]; + v456 = hir.int_to_ptr v453 : ptr; + v457 = hir.load v456 : i32; + scf.yield v457; }; - v742 = arith.constant -2147483647 : i32; - v1723 = cf.select v724, v742, v711 : i32; - scf.yield v1722, v1723; + v468 = arith.constant -2147483647 : i32; + v878 = cf.select v450, v468, v437 : i32; + scf.yield v877, v878; }; - scf.yield v1724, v1725; + scf.yield v879, v880; }; - scf.yield v1726, v1727; + scf.yield v881, v882; }; - scf.yield v1728, v1729; - }; - v1735 = arith.constant 4 : u32; - v747 = hir.bitcast v594 : u32; - v749 = arith.add v747, v1735 : u32 #[overflow = checked]; - v1734 = arith.constant 4 : u32; - v751 = arith.mod v749, v1734 : u32; - hir.assertz v751 #[code = 250]; - v752 = hir.int_to_ptr v749 : ptr; - hir.store v752, v1730; - v755 = hir.bitcast v594 : u32; - v1733 = arith.constant 4 : u32; - v757 = arith.mod v755, v1733 : u32; - hir.assertz v757 #[code = 250]; - v758 = hir.int_to_ptr v755 : ptr; - hir.store v758, v1731; - v1732 = arith.constant 32 : i32; - v762 = arith.add v606, v1732 : i32 #[overflow = wrapping]; - v763 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v764 = hir.bitcast v763 : ptr; - hir.store v764, v762; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v765: i32, v766: i32, v767: i32) { - ^block75(v765: i32, v766: i32, v767: i32): - v769 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v770 = hir.bitcast v769 : ptr; - v771 = hir.load v770 : i32; - v772 = arith.constant 16 : i32; - v773 = arith.sub v771, v772 : i32 #[overflow = wrapping]; - v774 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v775 = hir.bitcast v774 : ptr; - hir.store v775, v773; - v776 = arith.constant 4 : i32; - v777 = arith.add v773, v776 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v777, v765, v766, v767) - v779 = arith.constant 8 : u32; - v778 = hir.bitcast v773 : u32; - v780 = arith.add v778, v779 : u32 #[overflow = checked]; - v781 = arith.constant 4 : u32; - v782 = arith.mod v780, v781 : u32; - hir.assertz v782 #[code = 250]; - v783 = hir.int_to_ptr v780 : ptr; - v784 = hir.load v783 : i32; - v1766 = arith.constant 0 : i32; - v768 = arith.constant 0 : i32; - v786 = arith.eq v784, v768 : i1; - v787 = arith.zext v786 : u32; - v788 = hir.bitcast v787 : i32; - v790 = arith.neq v788, v1766 : i1; - scf.if v790{ - ^block173: - scf.yield ; - } else { - ^block78: - v1765 = arith.constant 4 : u32; - v791 = hir.bitcast v773 : u32; - v793 = arith.add v791, v1765 : u32 #[overflow = checked]; - v1764 = arith.constant 4 : u32; - v795 = arith.mod v793, v1764 : u32; - hir.assertz v795 #[code = 250]; - v796 = hir.int_to_ptr v793 : ptr; - v797 = hir.load v796 : i32; - v799 = arith.constant 12 : u32; - v798 = hir.bitcast v773 : u32; - v800 = arith.add v798, v799 : u32 #[overflow = checked]; - v1763 = arith.constant 4 : u32; - v802 = arith.mod v800, v1763 : u32; - hir.assertz v802 #[code = 250]; - v803 = hir.int_to_ptr v800 : ptr; - v804 = hir.load v803 : i32; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::deallocate(v797, v784, v804) - scf.yield ; + scf.yield v883, v884; }; - v1762 = arith.constant 16 : i32; - v807 = arith.add v773, v1762 : i32 #[overflow = wrapping]; - v808 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v809 = hir.bitcast v808 : ptr; - hir.store v809, v807; + v890 = arith.constant 4 : u32; + v473 = hir.bitcast v320 : u32; + v475 = arith.add v473, v890 : u32 #[overflow = checked]; + v889 = arith.constant 4 : u32; + v477 = arith.mod v475, v889 : u32; + hir.assertz v477 #[code = 250]; + v478 = hir.int_to_ptr v475 : ptr; + hir.store v478, v885; + v481 = hir.bitcast v320 : u32; + v888 = arith.constant 4 : u32; + v483 = arith.mod v481, v888 : u32; + hir.assertz v483 #[code = 250]; + v484 = hir.int_to_ptr v481 : ptr; + hir.store v484, v886; + v887 = arith.constant 32 : i32; + v488 = arith.add v332, v887 : i32 #[overflow = wrapping]; + v489 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v490 = hir.bitcast v489 : ptr; + hir.store v490, v488; builtin.ret ; }; - private builtin.function @::allocate(v810: i32, v811: i32, v812: i32) { - ^block79(v810: i32, v811: i32, v812: i32): - v814 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v815 = hir.bitcast v814 : ptr; - v816 = hir.load v815 : i32; - v817 = arith.constant 16 : i32; - v818 = arith.sub v816, v817 : i32 #[overflow = wrapping]; - v819 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v820 = hir.bitcast v819 : ptr; - hir.store v820, v818; - v813 = arith.constant 0 : i32; - v821 = arith.constant 8 : i32; - v822 = arith.add v818, v821 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v822, v811, v812, v813) - v825 = arith.constant 12 : u32; - v824 = hir.bitcast v818 : u32; - v826 = arith.add v824, v825 : u32 #[overflow = checked]; - v827 = arith.constant 4 : u32; - v828 = arith.mod v826, v827 : u32; - hir.assertz v828 #[code = 250]; - v829 = hir.int_to_ptr v826 : ptr; - v830 = hir.load v829 : i32; - v832 = arith.constant 8 : u32; - v831 = hir.bitcast v818 : u32; - v833 = arith.add v831, v832 : u32 #[overflow = checked]; - v1771 = arith.constant 4 : u32; - v835 = arith.mod v833, v1771 : u32; - hir.assertz v835 #[code = 250]; - v836 = hir.int_to_ptr v833 : ptr; - v837 = hir.load v836 : i32; - v838 = hir.bitcast v810 : u32; - v1770 = arith.constant 4 : u32; - v840 = arith.mod v838, v1770 : u32; - hir.assertz v840 #[code = 250]; - v841 = hir.int_to_ptr v838 : ptr; - hir.store v841, v837; - v1769 = arith.constant 4 : u32; - v842 = hir.bitcast v810 : u32; - v844 = arith.add v842, v1769 : u32 #[overflow = checked]; - v1768 = arith.constant 4 : u32; - v846 = arith.mod v844, v1768 : u32; - hir.assertz v846 #[code = 250]; - v847 = hir.int_to_ptr v844 : ptr; - hir.store v847, v830; - v1767 = arith.constant 16 : i32; - v849 = arith.add v818, v1767 : i32 #[overflow = wrapping]; - v850 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v851 = hir.bitcast v850 : ptr; - hir.store v851, v849; + private builtin.function @::allocate(v491: i32, v492: i32, v493: i32) { + ^block51(v491: i32, v492: i32, v493: i32): + v495 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v496 = hir.bitcast v495 : ptr; + v497 = hir.load v496 : i32; + v498 = arith.constant 16 : i32; + v499 = arith.sub v497, v498 : i32 #[overflow = wrapping]; + v500 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v501 = hir.bitcast v500 : ptr; + hir.store v501, v499; + v494 = arith.constant 0 : i32; + v502 = arith.constant 8 : i32; + v503 = arith.add v499, v502 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v503, v492, v493, v494) + v506 = arith.constant 12 : u32; + v505 = hir.bitcast v499 : u32; + v507 = arith.add v505, v506 : u32 #[overflow = checked]; + v508 = arith.constant 4 : u32; + v509 = arith.mod v507, v508 : u32; + hir.assertz v509 #[code = 250]; + v510 = hir.int_to_ptr v507 : ptr; + v511 = hir.load v510 : i32; + v513 = arith.constant 8 : u32; + v512 = hir.bitcast v499 : u32; + v514 = arith.add v512, v513 : u32 #[overflow = checked]; + v919 = arith.constant 4 : u32; + v516 = arith.mod v514, v919 : u32; + hir.assertz v516 #[code = 250]; + v517 = hir.int_to_ptr v514 : ptr; + v518 = hir.load v517 : i32; + v519 = hir.bitcast v491 : u32; + v918 = arith.constant 4 : u32; + v521 = arith.mod v519, v918 : u32; + hir.assertz v521 #[code = 250]; + v522 = hir.int_to_ptr v519 : ptr; + hir.store v522, v518; + v917 = arith.constant 4 : u32; + v523 = hir.bitcast v491 : u32; + v525 = arith.add v523, v917 : u32 #[overflow = checked]; + v916 = arith.constant 4 : u32; + v527 = arith.mod v525, v916 : u32; + hir.assertz v527 #[code = 250]; + v528 = hir.int_to_ptr v525 : ptr; + hir.store v528, v511; + v915 = arith.constant 16 : i32; + v530 = arith.add v499, v915 : i32 #[overflow = wrapping]; + v531 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v532 = hir.bitcast v531 : ptr; + hir.store v532, v530; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v852: i32, v853: i32, v854: i32, v855: i32) { - ^block81(v852: i32, v853: i32, v854: i32, v855: i32): - v1787 = arith.constant 0 : i32; - v856 = arith.constant 0 : i32; - v857 = arith.eq v854, v856 : i1; - v858 = arith.zext v857 : u32; - v859 = hir.bitcast v858 : i32; - v861 = arith.neq v859, v1787 : i1; - v1783 = scf.if v861 : i32 { - ^block175: - scf.yield v853; + private builtin.function @alloc::alloc::Global::alloc_impl(v533: i32, v534: i32, v535: i32, v536: i32) { + ^block53(v533: i32, v534: i32, v535: i32, v536: i32): + v935 = arith.constant 0 : i32; + v537 = arith.constant 0 : i32; + v538 = arith.eq v535, v537 : i1; + v539 = arith.zext v538 : u32; + v540 = hir.bitcast v539 : i32; + v542 = arith.neq v540, v935 : i1; + v931 = scf.if v542 : i32 { + ^block104: + scf.yield v534; } else { - ^block84: + ^block56: hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1786 = arith.constant 0 : i32; - v863 = arith.neq v855, v1786 : i1; - v1782 = scf.if v863 : i32 { - ^block85: - v865 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc_zeroed(v854, v853) : i32 - scf.yield v865; + v934 = arith.constant 0 : i32; + v544 = arith.neq v536, v934 : i1; + v930 = scf.if v544 : i32 { + ^block57: + v546 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc_zeroed(v535, v534) : i32 + scf.yield v546; } else { - ^block86: - v864 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc(v854, v853) : i32 - scf.yield v864; + ^block58: + v545 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc(v535, v534) : i32 + scf.yield v545; }; - scf.yield v1782; + scf.yield v930; }; - v869 = arith.constant 4 : u32; - v868 = hir.bitcast v852 : u32; - v870 = arith.add v868, v869 : u32 #[overflow = checked]; - v1785 = arith.constant 4 : u32; - v872 = arith.mod v870, v1785 : u32; - hir.assertz v872 #[code = 250]; - v873 = hir.int_to_ptr v870 : ptr; - hir.store v873, v854; - v875 = hir.bitcast v852 : u32; - v1784 = arith.constant 4 : u32; - v877 = arith.mod v875, v1784 : u32; - hir.assertz v877 #[code = 250]; - v878 = hir.int_to_ptr v875 : ptr; - hir.store v878, v1783; + v550 = arith.constant 4 : u32; + v549 = hir.bitcast v533 : u32; + v551 = arith.add v549, v550 : u32 #[overflow = checked]; + v933 = arith.constant 4 : u32; + v553 = arith.mod v551, v933 : u32; + hir.assertz v553 #[code = 250]; + v554 = hir.int_to_ptr v551 : ptr; + hir.store v554, v535; + v556 = hir.bitcast v533 : u32; + v932 = arith.constant 4 : u32; + v558 = arith.mod v556, v932 : u32; + hir.assertz v558 #[code = 250]; + v559 = hir.int_to_ptr v556 : ptr; + hir.store v559, v931; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v879: i32, v880: i32, v881: i32, v882: i32) { - ^block87(v879: i32, v880: i32, v881: i32, v882: i32): - v1813 = arith.constant 0 : i32; - v883 = arith.constant 0 : i32; - v887 = arith.eq v882, v883 : i1; - v888 = arith.zext v887 : u32; - v889 = hir.bitcast v888 : i32; - v891 = arith.neq v889, v1813 : i1; - v1800, v1801 = scf.if v891 : i32, i32 { - ^block179: - v1812 = arith.constant 0 : i32; - v885 = arith.constant 4 : i32; - scf.yield v885, v1812; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v560: i32, v561: i32, v562: i32, v563: i32) { + ^block59(v560: i32, v561: i32, v562: i32, v563: i32): + v961 = arith.constant 0 : i32; + v564 = arith.constant 0 : i32; + v568 = arith.eq v563, v564 : i1; + v569 = arith.zext v568 : u32; + v570 = hir.bitcast v569 : i32; + v572 = arith.neq v570, v961 : i1; + v948, v949 = scf.if v572 : i32, i32 { + ^block108: + v960 = arith.constant 0 : i32; + v566 = arith.constant 4 : i32; + scf.yield v566, v960; } else { - ^block90: - v892 = hir.bitcast v880 : u32; - v927 = arith.constant 4 : u32; - v894 = arith.mod v892, v927 : u32; - hir.assertz v894 #[code = 250]; - v895 = hir.int_to_ptr v892 : ptr; - v896 = hir.load v895 : i32; - v1810 = arith.constant 0 : i32; - v1811 = arith.constant 0 : i32; - v898 = arith.eq v896, v1811 : i1; - v899 = arith.zext v898 : u32; - v900 = hir.bitcast v899 : i32; - v902 = arith.neq v900, v1810 : i1; - v1798 = scf.if v902 : i32 { - ^block178: - v1809 = arith.constant 0 : i32; - scf.yield v1809; + ^block62: + v573 = hir.bitcast v561 : u32; + v608 = arith.constant 4 : u32; + v575 = arith.mod v573, v608 : u32; + hir.assertz v575 #[code = 250]; + v576 = hir.int_to_ptr v573 : ptr; + v577 = hir.load v576 : i32; + v958 = arith.constant 0 : i32; + v959 = arith.constant 0 : i32; + v579 = arith.eq v577, v959 : i1; + v580 = arith.zext v579 : u32; + v581 = hir.bitcast v580 : i32; + v583 = arith.neq v581, v958 : i1; + v946 = scf.if v583 : i32 { + ^block107: + v957 = arith.constant 0 : i32; + scf.yield v957; } else { - ^block91: - v1808 = arith.constant 4 : u32; - v903 = hir.bitcast v879 : u32; - v905 = arith.add v903, v1808 : u32 #[overflow = checked]; - v1807 = arith.constant 4 : u32; - v907 = arith.mod v905, v1807 : u32; - hir.assertz v907 #[code = 250]; - v908 = hir.int_to_ptr v905 : ptr; - hir.store v908, v881; - v1806 = arith.constant 4 : u32; - v909 = hir.bitcast v880 : u32; - v911 = arith.add v909, v1806 : u32 #[overflow = checked]; - v1805 = arith.constant 4 : u32; - v913 = arith.mod v911, v1805 : u32; - hir.assertz v913 #[code = 250]; - v914 = hir.int_to_ptr v911 : ptr; - v915 = hir.load v914 : i32; - v916 = hir.bitcast v879 : u32; - v1804 = arith.constant 4 : u32; - v918 = arith.mod v916, v1804 : u32; - hir.assertz v918 #[code = 250]; - v919 = hir.int_to_ptr v916 : ptr; - hir.store v919, v915; - v920 = arith.mul v896, v882 : i32 #[overflow = wrapping]; - scf.yield v920; + ^block63: + v956 = arith.constant 4 : u32; + v584 = hir.bitcast v560 : u32; + v586 = arith.add v584, v956 : u32 #[overflow = checked]; + v955 = arith.constant 4 : u32; + v588 = arith.mod v586, v955 : u32; + hir.assertz v588 #[code = 250]; + v589 = hir.int_to_ptr v586 : ptr; + hir.store v589, v562; + v954 = arith.constant 4 : u32; + v590 = hir.bitcast v561 : u32; + v592 = arith.add v590, v954 : u32 #[overflow = checked]; + v953 = arith.constant 4 : u32; + v594 = arith.mod v592, v953 : u32; + hir.assertz v594 #[code = 250]; + v595 = hir.int_to_ptr v592 : ptr; + v596 = hir.load v595 : i32; + v597 = hir.bitcast v560 : u32; + v952 = arith.constant 4 : u32; + v599 = arith.mod v597, v952 : u32; + hir.assertz v599 #[code = 250]; + v600 = hir.int_to_ptr v597 : ptr; + hir.store v600, v596; + v601 = arith.mul v577, v563 : i32 #[overflow = wrapping]; + scf.yield v601; }; - v921 = arith.constant 8 : i32; - v1803 = arith.constant 4 : i32; - v1799 = cf.select v902, v1803, v921 : i32; - scf.yield v1799, v1798; + v602 = arith.constant 8 : i32; + v951 = arith.constant 4 : i32; + v947 = cf.select v583, v951, v602 : i32; + scf.yield v947, v946; }; - v924 = arith.add v879, v1800 : i32 #[overflow = wrapping]; - v926 = hir.bitcast v924 : u32; - v1802 = arith.constant 4 : u32; - v928 = arith.mod v926, v1802 : u32; - hir.assertz v928 #[code = 250]; - v929 = hir.int_to_ptr v926 : ptr; - hir.store v929, v1801; + v605 = arith.add v560, v948 : i32 #[overflow = wrapping]; + v607 = hir.bitcast v605 : u32; + v950 = arith.constant 4 : u32; + v609 = arith.mod v607, v950 : u32; + hir.assertz v609 #[code = 250]; + v610 = hir.int_to_ptr v607 : ptr; + hir.store v610, v949; builtin.ret ; }; - private builtin.function @alloc::raw_vec::finish_grow(v930: i32, v931: i32, v932: i32, v933: i32, v934: i32) { - ^block92(v930: i32, v931: i32, v932: i32, v933: i32, v934: i32): - v936 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v937 = hir.bitcast v936 : ptr; - v938 = hir.load v937 : i32; - v939 = arith.constant 16 : i32; - v940 = arith.sub v938, v939 : i32 #[overflow = wrapping]; - v941 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v942 = hir.bitcast v941 : ptr; - hir.store v942, v940; - v1868 = arith.constant 0 : i32; - v935 = arith.constant 0 : i32; - v945 = arith.gte v932, v935 : i1; - v946 = arith.zext v945 : u32; - v947 = hir.bitcast v946 : i32; - v949 = arith.neq v947, v1868 : i1; - v1842, v1843 = scf.if v949 : i32, i32 { - ^block95: - v1036 = arith.constant 4 : u32; - v952 = hir.bitcast v933 : u32; - v954 = arith.add v952, v1036 : u32 #[overflow = checked]; - v1867 = arith.constant 4 : u32; - v956 = arith.mod v954, v1867 : u32; - hir.assertz v956 #[code = 250]; - v957 = hir.int_to_ptr v954 : ptr; - v958 = hir.load v957 : i32; - v1865 = arith.constant 0 : i32; - v1866 = arith.constant 0 : i32; - v960 = arith.eq v958, v1866 : i1; - v961 = arith.zext v960 : u32; - v962 = hir.bitcast v961 : i32; - v964 = arith.neq v962, v1865 : i1; - v1840, v1841 = scf.if v964 : i32, i32 { - ^block98: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::allocate(v940, v931, v932) - v1864 = arith.constant 4 : u32; - v997 = hir.bitcast v940 : u32; - v999 = arith.add v997, v1864 : u32 #[overflow = checked]; - v1863 = arith.constant 4 : u32; - v1001 = arith.mod v999, v1863 : u32; - hir.assertz v1001 #[code = 250]; - v1002 = hir.int_to_ptr v999 : ptr; - v1003 = hir.load v1002 : i32; - v1004 = hir.bitcast v940 : u32; - v1862 = arith.constant 4 : u32; - v1006 = arith.mod v1004, v1862 : u32; - hir.assertz v1006 #[code = 250]; - v1007 = hir.int_to_ptr v1004 : ptr; - v1008 = hir.load v1007 : i32; - scf.yield v1008, v1003; + private builtin.function @alloc::raw_vec::finish_grow(v611: i32, v612: i32, v613: i32, v614: i32, v615: i32) { + ^block64(v611: i32, v612: i32, v613: i32, v614: i32, v615: i32): + v617 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v618 = hir.bitcast v617 : ptr; + v619 = hir.load v618 : i32; + v620 = arith.constant 16 : i32; + v621 = arith.sub v619, v620 : i32 #[overflow = wrapping]; + v622 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v623 = hir.bitcast v622 : ptr; + hir.store v623, v621; + v1016 = arith.constant 0 : i32; + v616 = arith.constant 0 : i32; + v626 = arith.gte v613, v616 : i1; + v627 = arith.zext v626 : u32; + v628 = hir.bitcast v627 : i32; + v630 = arith.neq v628, v1016 : i1; + v990, v991 = scf.if v630 : i32, i32 { + ^block67: + v717 = arith.constant 4 : u32; + v633 = hir.bitcast v614 : u32; + v635 = arith.add v633, v717 : u32 #[overflow = checked]; + v1015 = arith.constant 4 : u32; + v637 = arith.mod v635, v1015 : u32; + hir.assertz v637 #[code = 250]; + v638 = hir.int_to_ptr v635 : ptr; + v639 = hir.load v638 : i32; + v1013 = arith.constant 0 : i32; + v1014 = arith.constant 0 : i32; + v641 = arith.eq v639, v1014 : i1; + v642 = arith.zext v641 : u32; + v643 = hir.bitcast v642 : i32; + v645 = arith.neq v643, v1013 : i1; + v988, v989 = scf.if v645 : i32, i32 { + ^block70: + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::allocate(v621, v612, v613) + v1012 = arith.constant 4 : u32; + v678 = hir.bitcast v621 : u32; + v680 = arith.add v678, v1012 : u32 #[overflow = checked]; + v1011 = arith.constant 4 : u32; + v682 = arith.mod v680, v1011 : u32; + hir.assertz v682 #[code = 250]; + v683 = hir.int_to_ptr v680 : ptr; + v684 = hir.load v683 : i32; + v685 = hir.bitcast v621 : u32; + v1010 = arith.constant 4 : u32; + v687 = arith.mod v685, v1010 : u32; + hir.assertz v687 #[code = 250]; + v688 = hir.int_to_ptr v685 : ptr; + v689 = hir.load v688 : i32; + scf.yield v689, v684; } else { - ^block99: - v966 = arith.constant 8 : u32; - v965 = hir.bitcast v933 : u32; - v967 = arith.add v965, v966 : u32 #[overflow = checked]; - v1861 = arith.constant 4 : u32; - v969 = arith.mod v967, v1861 : u32; - hir.assertz v969 #[code = 250]; - v970 = hir.int_to_ptr v967 : ptr; - v971 = hir.load v970 : i32; - v1860 = arith.constant 0 : i32; - v973 = arith.neq v971, v1860 : i1; - v1838, v1839 = scf.if v973 : i32, i32 { - ^block100: - v991 = hir.bitcast v933 : u32; - v1859 = arith.constant 4 : u32; - v993 = arith.mod v991, v1859 : u32; - hir.assertz v993 #[code = 250]; - v994 = hir.int_to_ptr v991 : ptr; - v995 = hir.load v994 : i32; - v996 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_realloc(v995, v971, v931, v932) : i32 - scf.yield v996, v932; + ^block71: + v647 = arith.constant 8 : u32; + v646 = hir.bitcast v614 : u32; + v648 = arith.add v646, v647 : u32 #[overflow = checked]; + v1009 = arith.constant 4 : u32; + v650 = arith.mod v648, v1009 : u32; + hir.assertz v650 #[code = 250]; + v651 = hir.int_to_ptr v648 : ptr; + v652 = hir.load v651 : i32; + v1008 = arith.constant 0 : i32; + v654 = arith.neq v652, v1008 : i1; + v986, v987 = scf.if v654 : i32, i32 { + ^block72: + v672 = hir.bitcast v614 : u32; + v1007 = arith.constant 4 : u32; + v674 = arith.mod v672, v1007 : u32; + hir.assertz v674 #[code = 250]; + v675 = hir.int_to_ptr v672 : ptr; + v676 = hir.load v675 : i32; + v677 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_realloc(v676, v652, v612, v613) : i32 + scf.yield v677, v613; } else { - ^block101: - v1858 = arith.constant 0 : i32; - v1030 = arith.constant 8 : i32; - v975 = arith.add v940, v1030 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v975, v931, v932, v1858) - v978 = arith.constant 12 : u32; - v977 = hir.bitcast v940 : u32; - v979 = arith.add v977, v978 : u32 #[overflow = checked]; - v1857 = arith.constant 4 : u32; - v981 = arith.mod v979, v1857 : u32; - hir.assertz v981 #[code = 250]; - v982 = hir.int_to_ptr v979 : ptr; - v983 = hir.load v982 : i32; - v1856 = arith.constant 8 : u32; - v984 = hir.bitcast v940 : u32; - v986 = arith.add v984, v1856 : u32 #[overflow = checked]; - v1855 = arith.constant 4 : u32; - v988 = arith.mod v986, v1855 : u32; - hir.assertz v988 #[code = 250]; - v989 = hir.int_to_ptr v986 : ptr; - v990 = hir.load v989 : i32; - scf.yield v990, v983; + ^block73: + v1006 = arith.constant 0 : i32; + v711 = arith.constant 8 : i32; + v656 = arith.add v621, v711 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v656, v612, v613, v1006) + v659 = arith.constant 12 : u32; + v658 = hir.bitcast v621 : u32; + v660 = arith.add v658, v659 : u32 #[overflow = checked]; + v1005 = arith.constant 4 : u32; + v662 = arith.mod v660, v1005 : u32; + hir.assertz v662 #[code = 250]; + v663 = hir.int_to_ptr v660 : ptr; + v664 = hir.load v663 : i32; + v1004 = arith.constant 8 : u32; + v665 = hir.bitcast v621 : u32; + v667 = arith.add v665, v1004 : u32 #[overflow = checked]; + v1003 = arith.constant 4 : u32; + v669 = arith.mod v667, v1003 : u32; + hir.assertz v669 #[code = 250]; + v670 = hir.int_to_ptr v667 : ptr; + v671 = hir.load v670 : i32; + scf.yield v671, v664; }; - scf.yield v1838, v1839; + scf.yield v986, v987; }; - v1854 = arith.constant 4 : u32; - v1015 = hir.bitcast v930 : u32; - v1017 = arith.add v1015, v1854 : u32 #[overflow = checked]; - v1853 = arith.constant 4 : u32; - v1019 = arith.mod v1017, v1853 : u32; - hir.assertz v1019 #[code = 250]; - v1852 = arith.constant 0 : i32; - v1013 = arith.neq v1840, v1852 : i1; - v1014 = cf.select v1013, v1840, v931 : i32; - v1020 = hir.int_to_ptr v1017 : ptr; - hir.store v1020, v1014; - v1850 = arith.constant 0 : i32; - v1027 = arith.eq v1840, v1850 : i1; - v1028 = arith.zext v1027 : u32; - v1029 = hir.bitcast v1028 : i32; - v1851 = arith.constant 0 : i32; - v1024 = arith.neq v1840, v1851 : i1; - v1025 = cf.select v1024, v1841, v932 : i32; - scf.yield v1025, v1029; - } else { - ^block96: - v950 = arith.constant 1 : i32; - v1849 = arith.constant 0 : i32; - scf.yield v1849, v950; - }; - v951 = arith.constant 4 : i32; - v1848 = arith.constant 8 : i32; - v1844 = cf.select v949, v1848, v951 : i32; - v1033 = arith.add v930, v1844 : i32 #[overflow = wrapping]; - v1035 = hir.bitcast v1033 : u32; - v1847 = arith.constant 4 : u32; - v1037 = arith.mod v1035, v1847 : u32; - hir.assertz v1037 #[code = 250]; - v1038 = hir.int_to_ptr v1035 : ptr; - hir.store v1038, v1842; - v1040 = hir.bitcast v930 : u32; - v1846 = arith.constant 4 : u32; - v1042 = arith.mod v1040, v1846 : u32; - hir.assertz v1042 #[code = 250]; - v1043 = hir.int_to_ptr v1040 : ptr; - hir.store v1043, v1843; - v1845 = arith.constant 16 : i32; - v1047 = arith.add v940, v1845 : i32 #[overflow = wrapping]; - v1048 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v1049 = hir.bitcast v1048 : ptr; - hir.store v1049, v1047; - builtin.ret ; - }; - - private builtin.function @::deallocate(v1050: i32, v1051: i32, v1052: i32) { - ^block102(v1050: i32, v1051: i32, v1052: i32): - v1870 = arith.constant 0 : i32; - v1053 = arith.constant 0 : i32; - v1054 = arith.eq v1052, v1053 : i1; - v1055 = arith.zext v1054 : u32; - v1056 = hir.bitcast v1055 : i32; - v1058 = arith.neq v1056, v1870 : i1; - scf.if v1058{ - ^block104: - scf.yield ; + v1002 = arith.constant 4 : u32; + v696 = hir.bitcast v611 : u32; + v698 = arith.add v696, v1002 : u32 #[overflow = checked]; + v1001 = arith.constant 4 : u32; + v700 = arith.mod v698, v1001 : u32; + hir.assertz v700 #[code = 250]; + v1000 = arith.constant 0 : i32; + v694 = arith.neq v988, v1000 : i1; + v695 = cf.select v694, v988, v612 : i32; + v701 = hir.int_to_ptr v698 : ptr; + hir.store v701, v695; + v998 = arith.constant 0 : i32; + v708 = arith.eq v988, v998 : i1; + v709 = arith.zext v708 : u32; + v710 = hir.bitcast v709 : i32; + v999 = arith.constant 0 : i32; + v705 = arith.neq v988, v999 : i1; + v706 = cf.select v705, v989, v613 : i32; + scf.yield v706, v710; } else { - ^block105: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_dealloc(v1050, v1052, v1051) - scf.yield ; + ^block68: + v631 = arith.constant 1 : i32; + v997 = arith.constant 0 : i32; + scf.yield v997, v631; }; + v632 = arith.constant 4 : i32; + v996 = arith.constant 8 : i32; + v992 = cf.select v630, v996, v632 : i32; + v714 = arith.add v611, v992 : i32 #[overflow = wrapping]; + v716 = hir.bitcast v714 : u32; + v995 = arith.constant 4 : u32; + v718 = arith.mod v716, v995 : u32; + hir.assertz v718 #[code = 250]; + v719 = hir.int_to_ptr v716 : ptr; + hir.store v719, v990; + v721 = hir.bitcast v611 : u32; + v994 = arith.constant 4 : u32; + v723 = arith.mod v721, v994 : u32; + hir.assertz v723 #[code = 250]; + v724 = hir.int_to_ptr v721 : ptr; + hir.store v724, v991; + v993 = arith.constant 16 : i32; + v728 = arith.add v621, v993 : i32 #[overflow = wrapping]; + v729 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr + v730 = hir.bitcast v729 : ptr; + hir.store v730, v728; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v1059: i32, v1060: i32, v1061: i32) { - ^block106(v1059: i32, v1060: i32, v1061: i32): - ub.unreachable ; - }; - - private builtin.function @alloc::alloc::handle_alloc_error(v1062: i32, v1063: i32) { - ^block108(v1062: i32, v1063: i32): + private builtin.function @alloc::raw_vec::handle_error(v731: i32, v732: i32, v733: i32) { + ^block74(v731: i32, v732: i32, v733: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v1064: i32, v1065: i32) -> i32 { - ^block110(v1064: i32, v1065: i32): - v1072 = arith.constant 0 : i32; - v1068 = hir.bitcast v1065 : u32; - v1067 = hir.bitcast v1064 : u32; - v1069 = arith.gt v1067, v1068 : i1; - v1070 = arith.zext v1069 : u32; - v1071 = hir.bitcast v1070 : i32; - v1073 = arith.neq v1071, v1072 : i1; - v1074 = cf.select v1073, v1064, v1065 : i32; - builtin.ret v1074; + private builtin.function @core::ptr::alignment::Alignment::max(v734: i32, v735: i32) -> i32 { + ^block76(v734: i32, v735: i32): + v742 = arith.constant 0 : i32; + v738 = hir.bitcast v735 : u32; + v737 = hir.bitcast v734 : u32; + v739 = arith.gt v737, v738 : i1; + v740 = arith.zext v739 : u32; + v741 = hir.bitcast v740 : i32; + v743 = arith.neq v741, v742 : i1; + v744 = cf.select v743, v734, v735 : i32; + builtin.ret v744; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.masm b/felt-repr/tests/expected/onchain_four_felts_struct.masm index 252c04591..1223b88cf 100644 --- a/felt-repr/tests/expected/onchain_four_felts_struct.masm +++ b/felt-repr/tests/expected/onchain_four_felts_struct.masm @@ -20,119 +20,6 @@ end # mod root_ns:root@1.0.0::onchain_four_felts_struct -@callconv("C") -proc core::ptr::drop_in_place>( - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - push.8 - dup.2 - u32wrapping_add - dup.1 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::deallocate - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - @callconv("C") proc alloc::vec::Vec::push(i32, felt) push.8 @@ -359,53 +246,6 @@ proc alloc::raw_vec::RawVec::grow_one(i32) end end -@callconv("C") -proc alloc::alloc::exchange_malloc( - -) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.4 - dup.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_alloc - trace.252 - nop - push.0 - dup.1 - neq - if.true - nop - else - drop - push.4 - dup.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::handle_alloc_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc - trace.252 - nop -end - @callconv("C") pub proc entrypoint(i32, i32) push.1114144 @@ -416,7 +256,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub push.1114144 dup.1 @@ -448,930 +288,22 @@ pub proc entrypoint(i32, i32) push.8 dup.4 add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.12 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - push.4 - movup.2 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.4 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - movup.2 - swap.3 - swap.4 - swap.5 - movdn.2 - swap.1 - push.1 - while.true - dup.0 - dup.2 - u32wrapping_add - push.0 - push.4 - dup.4 - eq - neq - dup.0 - if.true - movup.3 - drop - push.3735929054 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - end - push.3735929054 - dup.2 - dup.10 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.10 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.10 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.5 - dup.10 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.6 - dup.10 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.7 - movup.2 - swap.10 - movdn.2 - cdrop - push.1 - push.0 - movup.8 - cdrop - push.1 - u32and - movup.3 - swap.5 - swap.7 - swap.13 - swap.12 - swap.11 - swap.10 - swap.9 - swap.8 - movdn.3 - movup.2 - swap.4 - swap.6 - movdn.2 - if.true - movup.7 - drop - movup.7 - drop - movup.7 - drop - movup.7 - drop - movup.7 - drop - movup.7 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - drop - drop - drop - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.6 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.4 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - push.1 - while.true - dup.0 - dup.2 - u32wrapping_add - push.0 - push.4 - dup.4 - eq - neq - dup.0 - if.true - movup.3 - drop - push.3735929054 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - end - push.3735929054 - dup.2 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.5 - dup.9 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.6 - movup.2 - swap.9 - movdn.2 - cdrop - push.1 - push.0 - movup.7 - cdrop - push.1 - u32and - movup.2 - swap.4 - swap.6 - swap.11 - swap.10 - swap.9 - swap.8 - swap.7 - swap.3 - swap.5 - movdn.2 - if.true - movup.6 - drop - movup.6 - drop - movup.6 - drop - movup.6 - drop - movup.6 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - drop - drop - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.4 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - push.1 - while.true - dup.0 - dup.2 - u32wrapping_add - push.0 - push.4 - dup.4 - eq - neq - dup.0 - if.true - movup.3 - drop - push.3735929054 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - end - push.3735929054 - dup.2 - dup.8 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.8 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.8 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.8 - movdn.2 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - movup.3 - swap.5 - swap.9 - swap.8 - swap.7 - swap.6 - movdn.3 - movup.2 - swap.4 - movdn.2 - if.true - movup.5 - drop - movup.5 - drop - movup.5 - drop - movup.5 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - drop - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::exchange_malloc - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.4 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - push.1 - while.true - dup.0 - dup.2 - u32wrapping_add - push.0 - push.4 - dup.4 - eq - neq - dup.0 - if.true - movup.3 - drop - push.3735929054 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - end - push.3735929054 - dup.2 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - movup.2 - swap.7 - movdn.2 - cdrop - push.1 - push.0 - movup.5 - cdrop - push.1 - u32and - movup.2 - swap.4 - swap.7 - swap.6 - swap.5 - swap.3 - movdn.2 - if.true - movup.4 - drop - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - push.20 + u32assert + push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.4 + dup.5 add u32assert push.4 @@ -1380,7 +312,40 @@ pub proc entrypoint(i32, i32) u32mod u32assert assertz - movup.3 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + movup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + push.4 + dup.6 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 swap.1 u32divmod.4 swap.1 @@ -1389,19 +354,66 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.16 + push.4 + dup.6 + add + u32assert + push.4 dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + push.4 + movup.2 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.4 + dup.6 u32wrapping_add + movup.2 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::drop_in_place> + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push trace.252 nop - push.8 push.4 - dup.2 + dup.5 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.4 u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.3 u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push + trace.252 + nop push.4 dup.1 swap.1 @@ -1462,7 +474,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.32 + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -1475,10 +487,15 @@ pub proc entrypoint(i32, i32) end @callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc + trace.252 + nop end @callconv("C") @@ -2247,123 +1264,6 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( nop end -@callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - u32wrapping_add - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - else - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movdn.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::deallocate - trace.252 - nop - end - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - @callconv("C") proc ::allocate( i32, @@ -2993,32 +1893,6 @@ proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) nop end -@callconv("C") -proc ::deallocate( - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - drop - drop - drop - else - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_dealloc - trace.252 - nop - end -end - @callconv("C") proc alloc::raw_vec::handle_error(i32, i32, i32) drop @@ -3028,14 +1902,6 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) assert end -@callconv("C") -proc alloc::alloc::handle_alloc_error(i32, i32) - drop - drop - push.0 - assert -end - @callconv("C") proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.wat b/felt-repr/tests/expected/onchain_four_felts_struct.wat index 696968c2e..c66b2d4e9 100644 --- a/felt-repr/tests/expected/onchain_four_felts_struct.wat +++ b/felt-repr/tests/expected/onchain_four_felts_struct.wat @@ -1,14 +1,14 @@ (module $onchain_four_felts_struct.wasm - (type (;0;) (func (param i32))) - (type (;1;) (func (param i32 f32))) - (type (;2;) (func (result i32))) + (type (;0;) (func (param i32 f32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32))) (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32))) - (type (;5;) (func (param i32 i32 i32))) - (type (;6;) (func (param i32 i32 i32 i32) (result i32))) - (type (;7;) (func)) - (type (;8;) (func (param i32 i32 i32) (result i32))) - (type (;9;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func)) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (result i32))) + (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32))) (type (;10;) (func (param i32 i32 i32 i32))) (type (;11;) (func (param i32 i32 i32 i32 i32))) (table (;0;) 1 1 funcref) @@ -16,33 +16,7 @@ (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $core::ptr::drop_in_place> (;0;) (type 0) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - local.get 0 - i32.load - i32.store offset=12 - local.get 1 - local.get 0 - i32.load offset=8 - i32.store offset=8 - local.get 1 - i32.const 8 - i32.add - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::vec::Vec::push (;1;) (type 1) (param i32 f32) + (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) (local i32) block ;; label = @1 local.get 0 @@ -69,7 +43,7 @@ i32.add i32.store offset=8 ) - (func $alloc::raw_vec::RawVec::grow_one (;2;) (type 0) (param i32) + (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -105,32 +79,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::exchange_malloc (;3;) (type 2) (result i32) - (local i32) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @1 - i32.const 4 - i32.const 4 - call $__rustc::__rust_alloc - local.tee 0 - br_if 0 (;@1;) - i32.const 4 - i32.const 4 - call $alloc::alloc::handle_alloc_error - unreachable - end - local.get 0 - ) - (func $__rustc::__rust_alloc (;4;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $entrypoint (;5;) (type 4) (param i32 i32) - (local i32 f32 f32 f32 f32 i32 i32) + (func $entrypoint (;2;) (type 2) (param i32 i32) + (local i32 f32 f32 f32 f32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer @@ -146,208 +98,41 @@ local.get 1 f32.load local.set 6 - i32.const 0 - local.set 1 local.get 2 + i32.const 4 + i32.add + i32.const 8 + i32.add + local.tee 1 i32.const 0 - i32.store offset=12 + i32.store local.get 2 i64.const 17179869184 i64.store offset=4 align=4 - call $alloc::alloc::exchange_malloc - local.tee 7 - local.get 6 - f32.store local.get 2 - local.get 7 i32.const 4 i32.add - i32.store offset=28 - local.get 2 - i32.const 1 - i32.store offset=24 - local.get 2 - local.get 7 - i32.store offset=16 - block ;; label = @1 - loop ;; label = @2 - local.get 7 - local.get 1 - i32.add - local.set 8 - local.get 1 - i32.const 4 - i32.eq - br_if 1 (;@1;) - local.get 2 - i32.const 4 - i32.add - local.get 8 - f32.load - call $alloc::vec::Vec::push - local.get 1 - i32.const 4 - i32.add - local.set 1 - br 0 (;@2;) - end - end - local.get 2 - local.get 8 - i32.store offset=20 + local.get 6 + call $alloc::vec::Vec::push local.get 2 - i32.const 16 + i32.const 4 i32.add - call $core::ptr::drop_in_place> - call $alloc::alloc::exchange_malloc - local.tee 7 local.get 5 - f32.store + call $alloc::vec::Vec::push local.get 2 - local.get 7 i32.const 4 i32.add - i32.store offset=28 - local.get 2 - i32.const 1 - i32.store offset=24 - local.get 2 - local.get 7 - i32.store offset=16 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 7 - local.get 1 - i32.add - local.set 8 - local.get 1 - i32.const 4 - i32.eq - br_if 1 (;@1;) - local.get 2 - i32.const 4 - i32.add - local.get 8 - f32.load - call $alloc::vec::Vec::push - local.get 1 - i32.const 4 - i32.add - local.set 1 - br 0 (;@2;) - end - end - local.get 2 - local.get 8 - i32.store offset=20 - local.get 2 - i32.const 16 - i32.add - call $core::ptr::drop_in_place> - call $alloc::alloc::exchange_malloc - local.tee 7 local.get 4 - f32.store + call $alloc::vec::Vec::push local.get 2 - local.get 7 i32.const 4 i32.add - i32.store offset=28 - local.get 2 - i32.const 1 - i32.store offset=24 - local.get 2 - local.get 7 - i32.store offset=16 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 7 - local.get 1 - i32.add - local.set 8 - local.get 1 - i32.const 4 - i32.eq - br_if 1 (;@1;) - local.get 2 - i32.const 4 - i32.add - local.get 8 - f32.load - call $alloc::vec::Vec::push - local.get 1 - i32.const 4 - i32.add - local.set 1 - br 0 (;@2;) - end - end - local.get 2 - local.get 8 - i32.store offset=20 - local.get 2 - i32.const 16 - i32.add - call $core::ptr::drop_in_place> - call $alloc::alloc::exchange_malloc - local.tee 7 local.get 3 - f32.store - local.get 2 - local.get 7 - i32.const 4 - i32.add - i32.store offset=28 - local.get 2 - i32.const 1 - i32.store offset=24 - local.get 2 - local.get 7 - i32.store offset=16 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 7 - local.get 1 - i32.add - local.set 8 - local.get 1 - i32.const 4 - i32.eq - br_if 1 (;@1;) - local.get 2 - i32.const 4 - i32.add - local.get 8 - f32.load - call $alloc::vec::Vec::push - local.get 1 - i32.const 4 - i32.add - local.set 1 - br 0 (;@2;) - end - end - local.get 2 - local.get 8 - i32.store offset=20 - local.get 2 - i32.const 16 - i32.add - call $core::ptr::drop_in_place> + call $alloc::vec::Vec::push local.get 0 i32.const 8 i32.add - local.get 2 - i32.const 4 - i32.add - i32.const 8 - i32.add + local.get 1 i32.load i32.store local.get 0 @@ -355,12 +140,17 @@ i64.load offset=4 align=4 i64.store align=4 local.get 2 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) - (func $__rustc::__rust_dealloc (;6;) (type 5) (param i32 i32 i32)) - (func $__rustc::__rust_realloc (;7;) (type 6) (param i32 i32 i32 i32) (result i32) + (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) block ;; label = @1 i32.const 1048604 local.get 2 @@ -385,7 +175,7 @@ end local.get 2 ) - (func $__rustc::__rust_alloc_zeroed (;8;) (type 3) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) block ;; label = @1 i32.const 1048604 local.get 1 @@ -404,10 +194,10 @@ end local.get 1 ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;9;) (type 7) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) return ) - (func $::alloc (;10;) (type 8) (param i32 i32 i32) (result i32) + (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -479,10 +269,10 @@ end unreachable ) - (func $intrinsics::mem::heap_base (;11;) (type 2) (result i32) + (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;12;) (type 9) (param i32 i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) (local i32 i32 i32 i64) global.get $__stack_pointer i32.const 32 @@ -610,39 +400,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 5) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 4 - i32.add - local.get 0 - local.get 1 - local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory - block ;; label = @1 - local.get 3 - i32.load offset=8 - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - i32.load offset=4 - local.get 2 - local.get 3 - i32.load offset=12 - call $::deallocate - end - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;14;) (type 5) (param i32 i32 i32) + (func $::allocate (;10;) (type 9) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -671,7 +429,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;15;) (type 10) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;11;) (type 10) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -698,7 +456,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;16;) (type 10) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;12;) (type 10) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -733,7 +491,7 @@ local.get 4 i32.store ) - (func $alloc::raw_vec::finish_grow (;17;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::finish_grow (;13;) (type 11) (param i32 i32 i32 i32 i32) (local i32 i32) global.get $__stack_pointer i32.const 16 @@ -832,24 +590,10 @@ i32.add global.set $__stack_pointer ) - (func $::deallocate (;18;) (type 5) (param i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - local.get 1 - call $__rustc::__rust_dealloc - end - ) - (func $alloc::raw_vec::handle_error (;19;) (type 5) (param i32 i32 i32) - unreachable - ) - (func $alloc::alloc::handle_alloc_error (;20;) (type 4) (param i32 i32) + (func $alloc::raw_vec::handle_error (;14;) (type 9) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;21;) (type 3) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;15;) (type 3) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.hir b/felt-repr/tests/expected/onchain_two_felts_struct.hir index 52a2cd528..3451b7a36 100644 --- a/felt-repr/tests/expected/onchain_two_felts_struct.hir +++ b/felt-repr/tests/expected/onchain_two_felts_struct.hir @@ -1,1305 +1,973 @@ builtin.component root_ns:root@1.0.0 { builtin.module public @onchain_two_felts_struct { - private builtin.function @core::ptr::drop_in_place>(v0: i32) { - ^block4(v0: i32): - v2 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__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/onchain_two_felts_struct/__stack_pointer : ptr - v8 = hir.bitcast v7 : ptr; - hir.store v8, v6; - v9 = hir.bitcast v0 : u32; - v10 = arith.constant 4 : u32; - v11 = arith.mod v9, v10 : u32; - hir.assertz v11 #[code = 250]; - v12 = hir.int_to_ptr v9 : ptr; - v13 = hir.load v12 : i32; - v15 = arith.constant 12 : u32; - v14 = hir.bitcast v6 : u32; - v16 = arith.add v14, v15 : u32 #[overflow = checked]; - v950 = arith.constant 4 : u32; - v18 = arith.mod v16, v950 : u32; - hir.assertz v18 #[code = 250]; - v19 = hir.int_to_ptr v16 : ptr; - hir.store v19, v13; - v21 = arith.constant 8 : u32; - v20 = hir.bitcast v0 : u32; - v22 = arith.add v20, v21 : u32 #[overflow = checked]; - v949 = arith.constant 4 : u32; - v24 = arith.mod v22, v949 : u32; - hir.assertz v24 #[code = 250]; - v25 = hir.int_to_ptr v22 : ptr; - v26 = hir.load v25 : i32; - v948 = arith.constant 8 : u32; - v27 = hir.bitcast v6 : u32; - v29 = arith.add v27, v948 : u32 #[overflow = checked]; - v947 = arith.constant 4 : u32; - v31 = arith.mod v29, v947 : u32; - hir.assertz v31 #[code = 250]; - v32 = hir.int_to_ptr v29 : ptr; - hir.store v32, v26; - v35 = arith.constant 4 : i32; - v33 = arith.constant 8 : i32; - v34 = arith.add v6, v33 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::deallocate(v34, v35, v35) - v946 = arith.constant 16 : i32; - v38 = arith.add v6, v946 : i32 #[overflow = wrapping]; - v39 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v40 = hir.bitcast v39 : ptr; - hir.store v40, v38; - builtin.ret ; - }; - - private builtin.function @alloc::vec::Vec::push(v41: i32, v42: felt) { - ^block6(v41: i32, v42: felt): - v45 = arith.constant 8 : u32; - v44 = hir.bitcast v41 : u32; - v46 = arith.add v44, v45 : u32 #[overflow = checked]; - v47 = arith.constant 4 : u32; - v48 = arith.mod v46, v47 : u32; - hir.assertz v48 #[code = 250]; - v49 = hir.int_to_ptr v46 : ptr; - v50 = hir.load v49 : i32; - v51 = hir.bitcast v41 : u32; - v961 = arith.constant 4 : u32; - v53 = arith.mod v51, v961 : u32; - hir.assertz v53 #[code = 250]; - v54 = hir.int_to_ptr v51 : ptr; - v55 = hir.load v54 : i32; - v43 = arith.constant 0 : i32; - v56 = arith.neq v50, v55 : i1; - v57 = arith.zext v56 : u32; - v58 = hir.bitcast v57 : i32; - v60 = arith.neq v58, v43 : i1; - scf.if v60{ - ^block104: + private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { + ^block4(v0: i32, v1: felt): + v4 = arith.constant 8 : u32; + v3 = hir.bitcast v0 : u32; + v5 = arith.add v3, v4 : u32 #[overflow = checked]; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : i32; + v10 = hir.bitcast v0 : u32; + v737 = arith.constant 4 : u32; + v12 = arith.mod v10, v737 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v2 = arith.constant 0 : i32; + v15 = arith.neq v9, v14 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v2 : i1; + scf.if v19{ + ^block78: scf.yield ; } else { - ^block9: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVec::grow_one(v41) + ^block7: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) scf.yield ; }; - v960 = arith.constant 4 : u32; - v62 = hir.bitcast v41 : u32; - v64 = arith.add v62, v960 : u32 #[overflow = checked]; - v959 = arith.constant 4 : u32; - v66 = arith.mod v64, v959 : u32; - hir.assertz v66 #[code = 250]; - v67 = hir.int_to_ptr v64 : ptr; - v68 = hir.load v67 : i32; - v951 = arith.constant 2 : u32; - v72 = arith.shl v50, v951 : i32; - v73 = arith.add v68, v72 : i32 #[overflow = wrapping]; - v75 = hir.bitcast v73 : u32; - v958 = arith.constant 4 : u32; - v77 = arith.mod v75, v958 : u32; - hir.assertz v77 #[code = 250]; - v78 = hir.int_to_ptr v75 : ptr; - hir.store v78, v42; - v957 = arith.constant 8 : u32; - v81 = hir.bitcast v41 : u32; - v83 = arith.add v81, v957 : u32 #[overflow = checked]; - v956 = arith.constant 4 : u32; - v85 = arith.mod v83, v956 : u32; - hir.assertz v85 #[code = 250]; - v79 = arith.constant 1 : i32; - v80 = arith.add v50, v79 : i32 #[overflow = wrapping]; - v86 = hir.int_to_ptr v83 : ptr; - hir.store v86, v80; + v736 = arith.constant 4 : u32; + v21 = hir.bitcast v0 : u32; + v23 = arith.add v21, v736 : u32 #[overflow = checked]; + v735 = arith.constant 4 : u32; + v25 = arith.mod v23, v735 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; + v727 = arith.constant 2 : u32; + v31 = arith.shl v9, v727 : i32; + v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; + v34 = hir.bitcast v32 : u32; + v734 = arith.constant 4 : u32; + v36 = arith.mod v34, v734 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v1; + v733 = arith.constant 8 : u32; + v40 = hir.bitcast v0 : u32; + v42 = arith.add v40, v733 : u32 #[overflow = checked]; + v732 = arith.constant 4 : u32; + v44 = arith.mod v42, v732 : u32; + hir.assertz v44 #[code = 250]; + v38 = arith.constant 1 : i32; + v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVec::grow_one(v87: i32) { - ^block10(v87: i32): - v89 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v90 = hir.bitcast v89 : ptr; - v91 = hir.load v90 : i32; - v92 = arith.constant 16 : i32; - v93 = arith.sub v91, v92 : i32 #[overflow = wrapping]; - v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - hir.store v95, v93; - v98 = hir.bitcast v87 : u32; - v99 = arith.constant 4 : u32; - v100 = arith.mod v98, v99 : u32; - hir.assertz v100 #[code = 250]; - v101 = hir.int_to_ptr v98 : ptr; - v102 = hir.load v101 : i32; - v104 = arith.constant 4 : i32; - v103 = arith.constant 1 : i32; - v96 = arith.constant 8 : i32; - v97 = arith.add v93, v96 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v97, v87, v102, v103, v104, v104) - v107 = arith.constant 8 : u32; - v106 = hir.bitcast v93 : u32; - v108 = arith.add v106, v107 : u32 #[overflow = checked]; - v965 = arith.constant 4 : u32; - v110 = arith.mod v108, v965 : u32; - hir.assertz v110 #[code = 250]; - v111 = hir.int_to_ptr v108 : ptr; - v112 = hir.load v111 : i32; - v88 = arith.constant 0 : i32; - v113 = arith.constant -2147483647 : i32; - v114 = arith.eq v112, v113 : i1; - v115 = arith.zext v114 : u32; - v116 = hir.bitcast v115 : i32; - v118 = arith.neq v116, v88 : i1; - cf.cond_br v118 ^block12, ^block13; - ^block12: - v964 = arith.constant 16 : i32; - v128 = arith.add v93, v964 : i32 #[overflow = wrapping]; - v129 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v130 = hir.bitcast v129 : ptr; - hir.store v130, v128; + private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { + ^block8(v46: i32): + v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 16 : i32; + v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v54 = hir.bitcast v53 : ptr; + hir.store v54, v52; + v57 = hir.bitcast v46 : u32; + v58 = arith.constant 4 : u32; + v59 = arith.mod v57, v58 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i32; + v63 = arith.constant 4 : i32; + v62 = arith.constant 1 : i32; + v55 = arith.constant 8 : i32; + v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) + v66 = arith.constant 8 : u32; + v65 = hir.bitcast v52 : u32; + v67 = arith.add v65, v66 : u32 #[overflow = checked]; + v741 = arith.constant 4 : u32; + v69 = arith.mod v67, v741 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v47 = arith.constant 0 : i32; + v72 = arith.constant -2147483647 : i32; + v73 = arith.eq v71, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v47 : i1; + cf.cond_br v77 ^block10, ^block11; + ^block10: + v740 = arith.constant 16 : i32; + v87 = arith.add v52, v740 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; builtin.ret ; - ^block13: - v120 = arith.constant 12 : u32; - v119 = hir.bitcast v93 : u32; - v121 = arith.add v119, v120 : u32 #[overflow = checked]; - v963 = arith.constant 4 : u32; - v123 = arith.mod v121, v963 : u32; - hir.assertz v123 #[code = 250]; - v124 = hir.int_to_ptr v121 : ptr; - v125 = hir.load v124 : i32; - v126 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::handle_error(v112, v125, v126) - ub.unreachable ; - }; - - private builtin.function @alloc::alloc::exchange_malloc() -> i32 { - ^block14: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v133 = arith.constant 4 : i32; - v135 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v133, v133) : i32 - v132 = arith.constant 0 : i32; - v137 = arith.neq v135, v132 : i1; - cf.cond_br v137 ^block16, ^block17; - ^block16: - builtin.ret v135; - ^block17: - v968 = arith.constant 4 : i32; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::handle_alloc_error(v968, v968) + ^block11: + v79 = arith.constant 12 : u32; + v78 = hir.bitcast v52 : u32; + v80 = arith.add v78, v79 : u32 #[overflow = checked]; + v739 = arith.constant 4 : u32; + v82 = arith.mod v80, v739 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::handle_error(v71, v84, v85) ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v140: i32, v141: i32) -> i32 { - ^block18(v140: i32, v141: i32): - v143 = arith.constant 1048604 : i32; - v144 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v143, v141, v140) : i32 - builtin.ret v144; - }; - - public builtin.function @entrypoint(v145: i32, v146: i32) { - ^block20(v145: i32, v146: i32): - v150 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v151 = hir.bitcast v150 : ptr; - v152 = hir.load v151 : i32; - v153 = arith.constant 32 : i32; - v154 = arith.sub v152, v153 : i32 #[overflow = wrapping]; - v155 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v156 = hir.bitcast v155 : ptr; - hir.store v156, v154; - v158 = arith.constant 4 : u32; - v157 = hir.bitcast v146 : u32; - v159 = arith.add v157, v158 : u32 #[overflow = checked]; - v1192 = arith.constant 4 : u32; - v161 = arith.mod v159, v1192 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : felt; - v164 = hir.bitcast v146 : u32; - v1191 = arith.constant 4 : u32; - v166 = arith.mod v164, v1191 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : felt; - v172 = arith.constant 12 : u32; - v171 = hir.bitcast v154 : u32; - v173 = arith.add v171, v172 : u32 #[overflow = checked]; - v1190 = arith.constant 4 : u32; - v175 = arith.mod v173, v1190 : u32; - hir.assertz v175 #[code = 250]; - v147 = arith.constant 0 : i32; - v176 = hir.int_to_ptr v173 : ptr; - hir.store v176, v147; - v1189 = arith.constant 4 : u32; - v178 = hir.bitcast v154 : u32; - v180 = arith.add v178, v1189 : u32 #[overflow = checked]; - v1188 = arith.constant 4 : u32; - v182 = arith.mod v180, v1188 : u32; - hir.assertz v182 #[code = 250]; - v177 = arith.constant 17179869184 : i64; - v183 = hir.int_to_ptr v180 : ptr; - hir.store v183, v177; - v184 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::exchange_malloc() : i32 - v185 = hir.bitcast v184 : u32; - v1187 = arith.constant 4 : u32; - v187 = arith.mod v185, v1187 : u32; - hir.assertz v187 #[code = 250]; - v188 = hir.int_to_ptr v185 : ptr; - hir.store v188, v168; - v192 = arith.constant 28 : u32; - v191 = hir.bitcast v154 : u32; - v193 = arith.add v191, v192 : u32 #[overflow = checked]; - v1186 = arith.constant 4 : u32; - v195 = arith.mod v193, v1186 : u32; - hir.assertz v195 #[code = 250]; - v189 = arith.constant 4 : i32; - v190 = arith.add v184, v189 : i32 #[overflow = wrapping]; - v196 = hir.int_to_ptr v193 : ptr; - hir.store v196, v190; - v199 = arith.constant 24 : u32; - v198 = hir.bitcast v154 : u32; - v200 = arith.add v198, v199 : u32 #[overflow = checked]; - v1185 = arith.constant 4 : u32; - v202 = arith.mod v200, v1185 : u32; - hir.assertz v202 #[code = 250]; - v197 = arith.constant 1 : i32; - v203 = hir.int_to_ptr v200 : ptr; - hir.store v203, v197; - v205 = arith.constant 16 : u32; - v204 = hir.bitcast v154 : u32; - v206 = arith.add v204, v205 : u32 #[overflow = checked]; - v1184 = arith.constant 4 : u32; - v208 = arith.mod v206, v1184 : u32; - hir.assertz v208 #[code = 250]; - v209 = hir.int_to_ptr v206 : ptr; - hir.store v209, v184; - v1183 = arith.constant 0 : i32; - v1119, v1120, v1121, v1122, v1123, v1124, v1125, v1126, v1127 = scf.while v184, v1183, v154, v163, v145 : i32, i32, i32, felt, i32, i32, felt, i32, i32 { - ^block125(v1128: i32, v1129: i32, v1130: i32, v1131: felt, v1132: i32): - v212 = arith.add v1128, v1129 : i32 #[overflow = wrapping]; - v1181 = arith.constant 0 : i32; - v1182 = arith.constant 4 : i32; - v214 = arith.eq v1129, v1182 : i1; - v215 = arith.zext v214 : u32; - v216 = hir.bitcast v215 : i32; - v218 = arith.neq v216, v1181 : i1; - v1112 = scf.if v218 : i32 { - ^block121: - v977 = ub.poison i32 : i32; - scf.yield v977; - } else { - ^block25: - v222 = hir.bitcast v212 : u32; - v1180 = arith.constant 4 : u32; - v224 = arith.mod v222, v1180 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : felt; - v1179 = arith.constant 4 : i32; - v221 = arith.add v1130, v1179 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v221, v226) - v1178 = arith.constant 4 : i32; - v228 = arith.add v1129, v1178 : i32 #[overflow = wrapping]; - scf.yield v228; - }; - v1175 = ub.poison i32 : i32; - v1116 = cf.select v218, v1175, v1132 : i32; - v1024 = ub.poison felt : felt; - v1115 = cf.select v218, v1024, v1131 : felt; - v1176 = ub.poison i32 : i32; - v1114 = cf.select v218, v1176, v1130 : i32; - v1177 = ub.poison i32 : i32; - v1113 = cf.select v218, v1177, v1128 : i32; - v976 = arith.constant 1 : u32; - v969 = arith.constant 0 : u32; - v1118 = cf.select v218, v969, v976 : u32; - v1074 = arith.trunc v1118 : i1; - scf.condition v1074, v1113, v1112, v1114, v1115, v1116, v1130, v1131, v1132, v212; - } do { - ^block126(v1133: i32, v1134: i32, v1135: i32, v1136: felt, v1137: i32, v1138: i32, v1139: felt, v1140: i32, v1141: i32): - scf.yield v1133, v1134, v1135, v1136, v1137; - }; - v230 = arith.constant 20 : u32; - v229 = hir.bitcast v1124 : u32; - v231 = arith.add v229, v230 : u32 #[overflow = checked]; - v1174 = arith.constant 4 : u32; - v233 = arith.mod v231, v1174 : u32; - hir.assertz v233 #[code = 250]; - v234 = hir.int_to_ptr v231 : ptr; - hir.store v234, v1127; - v235 = arith.constant 16 : i32; - v236 = arith.add v1124, v235 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::drop_in_place>(v236) - v237 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::exchange_malloc() : i32 - v239 = hir.bitcast v237 : u32; - v1173 = arith.constant 4 : u32; - v241 = arith.mod v239, v1173 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - hir.store v242, v1125; - v1172 = arith.constant 28 : u32; - v245 = hir.bitcast v1124 : u32; - v247 = arith.add v245, v1172 : u32 #[overflow = checked]; - v1171 = arith.constant 4 : u32; - v249 = arith.mod v247, v1171 : u32; - hir.assertz v249 #[code = 250]; - v1170 = arith.constant 4 : i32; - v244 = arith.add v237, v1170 : i32 #[overflow = wrapping]; - v250 = hir.int_to_ptr v247 : ptr; - hir.store v250, v244; - v1169 = arith.constant 24 : u32; - v252 = hir.bitcast v1124 : u32; - v254 = arith.add v252, v1169 : u32 #[overflow = checked]; - v1168 = arith.constant 4 : u32; - v256 = arith.mod v254, v1168 : u32; - hir.assertz v256 #[code = 250]; - v1167 = arith.constant 1 : i32; - v257 = hir.int_to_ptr v254 : ptr; - hir.store v257, v1167; - v1166 = arith.constant 16 : u32; - v258 = hir.bitcast v1124 : u32; - v260 = arith.add v258, v1166 : u32 #[overflow = checked]; - v1165 = arith.constant 4 : u32; - v262 = arith.mod v260, v1165 : u32; - hir.assertz v262 #[code = 250]; - v263 = hir.int_to_ptr v260 : ptr; - hir.store v263, v237; - v1164 = arith.constant 0 : i32; - v1094, v1095, v1096, v1097, v1098, v1099, v1100 = scf.while v237, v1164, v1124, v1126 : i32, i32, i32, i32, i32, i32, i32 { - ^block123(v1101: i32, v1102: i32, v1103: i32, v1104: i32): - v267 = arith.add v1101, v1102 : i32 #[overflow = wrapping]; - v1162 = arith.constant 0 : i32; - v1163 = arith.constant 4 : i32; - v269 = arith.eq v1102, v1163 : i1; - v270 = arith.zext v269 : u32; - v271 = hir.bitcast v270 : i32; - v273 = arith.neq v271, v1162 : i1; - v1088 = scf.if v273 : i32 { - ^block122: - v1161 = ub.poison i32 : i32; - scf.yield v1161; - } else { - ^block29: - v277 = hir.bitcast v267 : u32; - v1160 = arith.constant 4 : u32; - v279 = arith.mod v277, v1160 : u32; - hir.assertz v279 #[code = 250]; - v280 = hir.int_to_ptr v277 : ptr; - v281 = hir.load v280 : felt; - v1159 = arith.constant 4 : i32; - v276 = arith.add v1103, v1159 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v276, v281) - v1158 = arith.constant 4 : i32; - v283 = arith.add v1102, v1158 : i32 #[overflow = wrapping]; - scf.yield v283; - }; - v1153 = ub.poison i32 : i32; - v1091 = cf.select v273, v1153, v1104 : i32; - v1154 = ub.poison i32 : i32; - v1090 = cf.select v273, v1154, v1103 : i32; - v1155 = ub.poison i32 : i32; - v1089 = cf.select v273, v1155, v1101 : i32; - v1156 = arith.constant 1 : u32; - v1157 = arith.constant 0 : u32; - v1093 = cf.select v273, v1157, v1156 : u32; - v1016 = arith.trunc v1093 : i1; - scf.condition v1016, v1089, v1088, v1090, v1091, v1103, v1104, v267; - } do { - ^block124(v1105: i32, v1106: i32, v1107: i32, v1108: i32, v1109: i32, v1110: i32, v1111: i32): - scf.yield v1105, v1106, v1107, v1108; - }; - v1152 = arith.constant 20 : u32; - v284 = hir.bitcast v1098 : u32; - v286 = arith.add v284, v1152 : u32 #[overflow = checked]; - v1151 = arith.constant 4 : u32; - v288 = arith.mod v286, v1151 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - hir.store v289, v1100; - v1150 = arith.constant 16 : i32; - v291 = arith.add v1098, v1150 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::drop_in_place>(v291) - v294 = arith.constant 8 : i32; - v1149 = arith.constant 4 : i32; - v297 = arith.add v1098, v1149 : i32 #[overflow = wrapping]; - v299 = arith.add v297, v294 : i32 #[overflow = wrapping]; - v300 = hir.bitcast v299 : u32; - v1148 = arith.constant 4 : u32; - v302 = arith.mod v300, v1148 : u32; - hir.assertz v302 #[code = 250]; - v303 = hir.int_to_ptr v300 : ptr; - v304 = hir.load v303 : i32; - v1147 = arith.constant 8 : i32; - v295 = arith.add v1099, v1147 : i32 #[overflow = wrapping]; - v305 = hir.bitcast v295 : u32; - v1146 = arith.constant 4 : u32; - v307 = arith.mod v305, v1146 : u32; - hir.assertz v307 #[code = 250]; - v308 = hir.int_to_ptr v305 : ptr; - hir.store v308, v304; - v1145 = arith.constant 4 : u32; - v309 = hir.bitcast v1098 : u32; - v311 = arith.add v309, v1145 : u32 #[overflow = checked]; - v1144 = arith.constant 4 : u32; - v313 = arith.mod v311, v1144 : u32; - hir.assertz v313 #[code = 250]; - v314 = hir.int_to_ptr v311 : ptr; - v315 = hir.load v314 : i64; - v316 = hir.bitcast v1099 : u32; - v1143 = arith.constant 4 : u32; - v318 = arith.mod v316, v1143 : u32; - hir.assertz v318 #[code = 250]; - v319 = hir.int_to_ptr v316 : ptr; - hir.store v319, v315; - v1142 = arith.constant 32 : i32; - v321 = arith.add v1098, v1142 : i32 #[overflow = wrapping]; - v322 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v323 = hir.bitcast v322 : ptr; - hir.store v323, v321; + public builtin.function @entrypoint(v90: i32, v91: i32) { + ^block12(v90: i32, v91: i32): + v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v95 = hir.bitcast v94 : ptr; + v96 = hir.load v95 : i32; + v97 = arith.constant 16 : i32; + v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; + v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v100 = hir.bitcast v99 : ptr; + hir.store v100, v98; + v102 = arith.constant 4 : u32; + v101 = hir.bitcast v91 : u32; + v103 = arith.add v101, v102 : u32 #[overflow = checked]; + v755 = arith.constant 4 : u32; + v105 = arith.mod v103, v755 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + v107 = hir.load v106 : felt; + v108 = hir.bitcast v91 : u32; + v754 = arith.constant 4 : u32; + v110 = arith.mod v108, v754 : u32; + hir.assertz v110 #[code = 250]; + v111 = hir.int_to_ptr v108 : ptr; + v112 = hir.load v111 : felt; + v115 = arith.constant 8 : i32; + v113 = arith.constant 4 : i32; + v114 = arith.add v98, v113 : i32 #[overflow = wrapping]; + v116 = arith.add v114, v115 : i32 #[overflow = wrapping]; + v118 = hir.bitcast v116 : u32; + v753 = arith.constant 4 : u32; + v120 = arith.mod v118, v753 : u32; + hir.assertz v120 #[code = 250]; + v92 = arith.constant 0 : i32; + v121 = hir.int_to_ptr v118 : ptr; + hir.store v121, v92; + v752 = arith.constant 4 : u32; + v123 = hir.bitcast v98 : u32; + v125 = arith.add v123, v752 : u32 #[overflow = checked]; + v751 = arith.constant 4 : u32; + v127 = arith.mod v125, v751 : u32; + hir.assertz v127 #[code = 250]; + v122 = arith.constant 17179869184 : i64; + v128 = hir.int_to_ptr v125 : ptr; + hir.store v128, v122; + v750 = arith.constant 4 : i32; + v130 = arith.add v98, v750 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v130, v112) + v749 = arith.constant 4 : i32; + v132 = arith.add v98, v749 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v132, v107) + v135 = hir.bitcast v116 : u32; + v748 = arith.constant 4 : u32; + v137 = arith.mod v135, v748 : u32; + hir.assertz v137 #[code = 250]; + v138 = hir.int_to_ptr v135 : ptr; + v139 = hir.load v138 : i32; + v747 = arith.constant 8 : i32; + v134 = arith.add v90, v747 : i32 #[overflow = wrapping]; + v140 = hir.bitcast v134 : u32; + v746 = arith.constant 4 : u32; + v142 = arith.mod v140, v746 : u32; + hir.assertz v142 #[code = 250]; + v143 = hir.int_to_ptr v140 : ptr; + hir.store v143, v139; + v745 = arith.constant 4 : u32; + v144 = hir.bitcast v98 : u32; + v146 = arith.add v144, v745 : u32 #[overflow = checked]; + v744 = arith.constant 4 : u32; + v148 = arith.mod v146, v744 : u32; + hir.assertz v148 #[code = 250]; + v149 = hir.int_to_ptr v146 : ptr; + v150 = hir.load v149 : i64; + v151 = hir.bitcast v90 : u32; + v743 = arith.constant 4 : u32; + v153 = arith.mod v151, v743 : u32; + hir.assertz v153 #[code = 250]; + v154 = hir.int_to_ptr v151 : ptr; + hir.store v154, v150; + v742 = arith.constant 16 : i32; + v156 = arith.add v98, v742 : i32 #[overflow = wrapping]; + v157 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v158 = hir.bitcast v157 : ptr; + hir.store v158, v156; builtin.ret ; }; - private builtin.function @__rustc::__rust_dealloc(v324: i32, v325: i32, v326: i32) { - ^block30(v324: i32, v325: i32, v326: i32): - builtin.ret ; + private builtin.function @__rustc::__rust_alloc(v159: i32, v160: i32) -> i32 { + ^block14(v159: i32, v160: i32): + v162 = arith.constant 1048604 : i32; + v163 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v162, v160, v159) : i32 + builtin.ret v163; }; - private builtin.function @__rustc::__rust_realloc(v327: i32, v328: i32, v329: i32, v330: i32) -> i32 { - ^block32(v327: i32, v328: i32, v329: i32, v330: i32): - v332 = arith.constant 1048604 : i32; - v333 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v332, v329, v330) : i32 - v1201 = arith.constant 0 : i32; - v334 = arith.constant 0 : i32; - v335 = arith.eq v333, v334 : i1; - v336 = arith.zext v335 : u32; - v337 = hir.bitcast v336 : i32; - v339 = arith.neq v337, v1201 : i1; - scf.if v339{ - ^block34: + private builtin.function @__rustc::__rust_realloc(v164: i32, v165: i32, v166: i32, v167: i32) -> i32 { + ^block16(v164: i32, v165: i32, v166: i32, v167: i32): + v169 = arith.constant 1048604 : i32; + v170 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v169, v166, v167) : i32 + v764 = arith.constant 0 : i32; + v171 = arith.constant 0 : i32; + v172 = arith.eq v170, v171 : i1; + v173 = arith.zext v172 : u32; + v174 = hir.bitcast v173 : i32; + v176 = arith.neq v174, v764 : i1; + scf.if v176{ + ^block18: scf.yield ; } else { - ^block35: - v1200 = arith.constant 0 : i32; - v341 = hir.bitcast v328 : u32; - v340 = hir.bitcast v330 : u32; - v342 = arith.lt v340, v341 : i1; - v343 = arith.zext v342 : u32; - v344 = hir.bitcast v343 : i32; - v346 = arith.neq v344, v1200 : i1; - v347 = cf.select v346, v330, v328 : i32; - v1198 = arith.constant 0 : i32; - v1199 = arith.constant 0 : i32; - v349 = arith.eq v347, v1199 : i1; - v350 = arith.zext v349 : u32; - v351 = hir.bitcast v350 : i32; - v353 = arith.neq v351, v1198 : i1; - scf.if v353{ - ^block127: + ^block19: + v763 = arith.constant 0 : i32; + v178 = hir.bitcast v165 : u32; + v177 = hir.bitcast v167 : u32; + v179 = arith.lt v177, v178 : i1; + v180 = arith.zext v179 : u32; + v181 = hir.bitcast v180 : i32; + v183 = arith.neq v181, v763 : i1; + v184 = cf.select v183, v167, v165 : i32; + v761 = arith.constant 0 : i32; + v762 = arith.constant 0 : i32; + v186 = arith.eq v184, v762 : i1; + v187 = arith.zext v186 : u32; + v188 = hir.bitcast v187 : i32; + v190 = arith.neq v188, v761 : i1; + scf.if v190{ + ^block82: scf.yield ; } else { - ^block36: - v354 = hir.bitcast v347 : u32; - v355 = hir.bitcast v333 : u32; - v356 = hir.int_to_ptr v355 : ptr; - v357 = hir.bitcast v327 : u32; - v358 = hir.int_to_ptr v357 : ptr; - hir.mem_cpy v358, v356, v354; + ^block20: + v191 = hir.bitcast v184 : u32; + v192 = hir.bitcast v170 : u32; + v193 = hir.int_to_ptr v192 : ptr; + v194 = hir.bitcast v164 : u32; + v195 = hir.int_to_ptr v194 : ptr; + hir.mem_cpy v195, v193, v191; scf.yield ; }; scf.yield ; }; - builtin.ret v333; + builtin.ret v170; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v360: i32, v361: i32) -> i32 { - ^block37(v360: i32, v361: i32): - v363 = arith.constant 1048604 : i32; - v364 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v363, v361, v360) : i32 - v1210 = arith.constant 0 : i32; - v365 = arith.constant 0 : i32; - v366 = arith.eq v364, v365 : i1; - v367 = arith.zext v366 : u32; - v368 = hir.bitcast v367 : i32; - v370 = arith.neq v368, v1210 : i1; - scf.if v370{ - ^block39: + private builtin.function @__rustc::__rust_alloc_zeroed(v197: i32, v198: i32) -> i32 { + ^block21(v197: i32, v198: i32): + v200 = arith.constant 1048604 : i32; + v201 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v200, v198, v197) : i32 + v773 = arith.constant 0 : i32; + v202 = arith.constant 0 : i32; + v203 = arith.eq v201, v202 : i1; + v204 = arith.zext v203 : u32; + v205 = hir.bitcast v204 : i32; + v207 = arith.neq v205, v773 : i1; + scf.if v207{ + ^block23: scf.yield ; } else { - ^block40: - v1208 = arith.constant 0 : i32; - v1209 = arith.constant 0 : i32; - v372 = arith.eq v360, v1209 : i1; - v373 = arith.zext v372 : u32; - v374 = hir.bitcast v373 : i32; - v376 = arith.neq v374, v1208 : i1; - scf.if v376{ - ^block130: + ^block24: + v771 = arith.constant 0 : i32; + v772 = arith.constant 0 : i32; + v209 = arith.eq v197, v772 : i1; + v210 = arith.zext v209 : u32; + v211 = hir.bitcast v210 : i32; + v213 = arith.neq v211, v771 : i1; + scf.if v213{ + ^block85: scf.yield ; } else { - ^block41: - v1202 = arith.constant 0 : u8; - v379 = hir.bitcast v360 : u32; - v380 = hir.bitcast v364 : u32; - v381 = hir.int_to_ptr v380 : ptr; - hir.mem_set v381, v379, v1202; + ^block25: + v765 = arith.constant 0 : u8; + v216 = hir.bitcast v197 : u32; + v217 = hir.bitcast v201 : u32; + v218 = hir.int_to_ptr v217 : ptr; + hir.mem_set v218, v216, v765; scf.yield ; }; scf.yield ; }; - builtin.ret v364; + builtin.ret v201; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block42: + ^block26: builtin.ret ; }; - private builtin.function @::alloc(v383: i32, v384: i32, v385: i32) -> i32 { - ^block44(v383: i32, v384: i32, v385: i32): - v388 = arith.constant 16 : i32; - v387 = arith.constant 0 : i32; - v1212 = arith.constant 16 : u32; - v390 = hir.bitcast v384 : u32; - v392 = arith.gt v390, v1212 : i1; - v393 = arith.zext v392 : u32; - v394 = hir.bitcast v393 : i32; - v396 = arith.neq v394, v387 : i1; - v397 = cf.select v396, v384, v388 : i32; - v1252 = arith.constant 0 : i32; - v398 = arith.constant -1 : i32; - v399 = arith.add v397, v398 : i32 #[overflow = wrapping]; - v400 = arith.band v397, v399 : i32; - v402 = arith.neq v400, v1252 : i1; - v1221, v1222 = scf.if v402 : i32, u32 { - ^block135: - v1213 = arith.constant 0 : u32; - v1217 = ub.poison i32 : i32; - scf.yield v1217, v1213; + private builtin.function @::alloc(v220: i32, v221: i32, v222: i32) -> i32 { + ^block28(v220: i32, v221: i32, v222: i32): + v225 = arith.constant 16 : i32; + v224 = arith.constant 0 : i32; + v775 = arith.constant 16 : u32; + v227 = hir.bitcast v221 : u32; + v229 = arith.gt v227, v775 : i1; + v230 = arith.zext v229 : u32; + v231 = hir.bitcast v230 : i32; + v233 = arith.neq v231, v224 : i1; + v234 = cf.select v233, v221, v225 : i32; + v815 = arith.constant 0 : i32; + v235 = arith.constant -1 : i32; + v236 = arith.add v234, v235 : i32 #[overflow = wrapping]; + v237 = arith.band v234, v236 : i32; + v239 = arith.neq v237, v815 : i1; + v784, v785 = scf.if v239 : i32, u32 { + ^block90: + v776 = arith.constant 0 : u32; + v780 = ub.poison i32 : i32; + scf.yield v780, v776; } else { - ^block47: - v404 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::alignment::Alignment::max(v384, v397) : i32 - v1251 = arith.constant 0 : i32; - v403 = arith.constant -2147483648 : i32; - v405 = arith.sub v403, v404 : i32 #[overflow = wrapping]; - v407 = hir.bitcast v405 : u32; - v406 = hir.bitcast v385 : u32; - v408 = arith.gt v406, v407 : i1; - v409 = arith.zext v408 : u32; - v410 = hir.bitcast v409 : i32; - v412 = arith.neq v410, v1251 : i1; - v1236 = scf.if v412 : i32 { - ^block134: - v1250 = ub.poison i32 : i32; - scf.yield v1250; + ^block31: + v241 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::alignment::Alignment::max(v221, v234) : i32 + v814 = arith.constant 0 : i32; + v240 = arith.constant -2147483648 : i32; + v242 = arith.sub v240, v241 : i32 #[overflow = wrapping]; + v244 = hir.bitcast v242 : u32; + v243 = hir.bitcast v222 : u32; + v245 = arith.gt v243, v244 : i1; + v246 = arith.zext v245 : u32; + v247 = hir.bitcast v246 : i32; + v249 = arith.neq v247, v814 : i1; + v799 = scf.if v249 : i32 { + ^block89: + v813 = ub.poison i32 : i32; + scf.yield v813; } else { - ^block48: - v1248 = arith.constant 0 : i32; - v418 = arith.sub v1248, v404 : i32 #[overflow = wrapping]; - v1249 = arith.constant -1 : i32; - v414 = arith.add v385, v404 : i32 #[overflow = wrapping]; - v416 = arith.add v414, v1249 : i32 #[overflow = wrapping]; - v419 = arith.band v416, v418 : i32; - v420 = hir.bitcast v383 : u32; - v421 = arith.constant 4 : u32; - v422 = arith.mod v420, v421 : u32; - hir.assertz v422 #[code = 250]; - v423 = hir.int_to_ptr v420 : ptr; - v424 = hir.load v423 : i32; - v1247 = arith.constant 0 : i32; - v426 = arith.neq v424, v1247 : i1; - scf.if v426{ - ^block133: + ^block32: + v811 = arith.constant 0 : i32; + v255 = arith.sub v811, v241 : i32 #[overflow = wrapping]; + v812 = arith.constant -1 : i32; + v251 = arith.add v222, v241 : i32 #[overflow = wrapping]; + v253 = arith.add v251, v812 : i32 #[overflow = wrapping]; + v256 = arith.band v253, v255 : i32; + v257 = hir.bitcast v220 : u32; + v258 = arith.constant 4 : u32; + v259 = arith.mod v257, v258 : u32; + hir.assertz v259 #[code = 250]; + v260 = hir.int_to_ptr v257 : ptr; + v261 = hir.load v260 : i32; + v810 = arith.constant 0 : i32; + v263 = arith.neq v261, v810 : i1; + scf.if v263{ + ^block88: scf.yield ; } else { - ^block50: - v427 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/intrinsics::mem::heap_base() : i32 - v428 = hir.mem_size : u32; - v434 = hir.bitcast v383 : u32; - v1246 = arith.constant 4 : u32; - v436 = arith.mod v434, v1246 : u32; - hir.assertz v436 #[code = 250]; - v1245 = arith.constant 16 : u32; - v429 = hir.bitcast v428 : i32; - v432 = arith.shl v429, v1245 : i32; - v433 = arith.add v427, v432 : i32 #[overflow = wrapping]; - v437 = hir.int_to_ptr v434 : ptr; - hir.store v437, v433; + ^block34: + v264 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/intrinsics::mem::heap_base() : i32 + v265 = hir.mem_size : u32; + v271 = hir.bitcast v220 : u32; + v809 = arith.constant 4 : u32; + v273 = arith.mod v271, v809 : u32; + hir.assertz v273 #[code = 250]; + v808 = arith.constant 16 : u32; + v266 = hir.bitcast v265 : i32; + v269 = arith.shl v266, v808 : i32; + v270 = arith.add v264, v269 : i32 #[overflow = wrapping]; + v274 = hir.int_to_ptr v271 : ptr; + hir.store v274, v270; scf.yield ; }; - v440 = hir.bitcast v383 : u32; - v1244 = arith.constant 4 : u32; - v442 = arith.mod v440, v1244 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - v444 = hir.load v443 : i32; - v1242 = arith.constant 0 : i32; - v1243 = arith.constant -1 : i32; - v446 = arith.bxor v444, v1243 : i32; - v448 = hir.bitcast v446 : u32; - v447 = hir.bitcast v419 : u32; - v449 = arith.gt v447, v448 : i1; - v450 = arith.zext v449 : u32; - v451 = hir.bitcast v450 : i32; - v453 = arith.neq v451, v1242 : i1; - v1235 = scf.if v453 : i32 { - ^block51: - v1241 = arith.constant 0 : i32; - scf.yield v1241; + v277 = hir.bitcast v220 : u32; + v807 = arith.constant 4 : u32; + v279 = arith.mod v277, v807 : u32; + hir.assertz v279 #[code = 250]; + v280 = hir.int_to_ptr v277 : ptr; + v281 = hir.load v280 : i32; + v805 = arith.constant 0 : i32; + v806 = arith.constant -1 : i32; + v283 = arith.bxor v281, v806 : i32; + v285 = hir.bitcast v283 : u32; + v284 = hir.bitcast v256 : u32; + v286 = arith.gt v284, v285 : i1; + v287 = arith.zext v286 : u32; + v288 = hir.bitcast v287 : i32; + v290 = arith.neq v288, v805 : i1; + v798 = scf.if v290 : i32 { + ^block35: + v804 = arith.constant 0 : i32; + scf.yield v804; } else { - ^block52: - v455 = hir.bitcast v383 : u32; - v1240 = arith.constant 4 : u32; - v457 = arith.mod v455, v1240 : u32; - hir.assertz v457 #[code = 250]; - v454 = arith.add v444, v419 : i32 #[overflow = wrapping]; - v458 = hir.int_to_ptr v455 : ptr; - hir.store v458, v454; - v460 = arith.add v444, v404 : i32 #[overflow = wrapping]; - scf.yield v460; + ^block36: + v292 = hir.bitcast v220 : u32; + v803 = arith.constant 4 : u32; + v294 = arith.mod v292, v803 : u32; + hir.assertz v294 #[code = 250]; + v291 = arith.add v281, v256 : i32 #[overflow = wrapping]; + v295 = hir.int_to_ptr v292 : ptr; + hir.store v295, v291; + v297 = arith.add v281, v241 : i32 #[overflow = wrapping]; + scf.yield v297; }; - scf.yield v1235; + scf.yield v798; }; - v1218 = arith.constant 1 : u32; - v1239 = arith.constant 0 : u32; - v1237 = cf.select v412, v1239, v1218 : u32; - scf.yield v1236, v1237; + v781 = arith.constant 1 : u32; + v802 = arith.constant 0 : u32; + v800 = cf.select v249, v802, v781 : u32; + scf.yield v799, v800; }; - v1238 = arith.constant 0 : u32; - v1234 = arith.eq v1222, v1238 : i1; - cf.cond_br v1234 ^block46, ^block137(v1221); - ^block46: + v801 = arith.constant 0 : u32; + v797 = arith.eq v785, v801 : i1; + cf.cond_br v797 ^block30, ^block92(v784); + ^block30: ub.unreachable ; - ^block137(v1214: i32): - builtin.ret v1214; + ^block92(v777: i32): + builtin.ret v777; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block53: - v463 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v463; + ^block37: + v300 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v300; }; - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v465: i32, v466: i32, v467: i32, v468: i32, v469: i32, v470: i32) { - ^block57(v465: i32, v466: i32, v467: i32, v468: i32, v469: i32, v470: i32): - v473 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v474 = hir.bitcast v473 : ptr; - v475 = hir.load v474 : i32; - v476 = arith.constant 32 : i32; - v477 = arith.sub v475, v476 : i32 #[overflow = wrapping]; - v478 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v479 = hir.bitcast v478 : ptr; - hir.store v479, v477; - v1329 = arith.constant 0 : i32; - v471 = arith.constant 0 : i32; - v482 = arith.eq v470, v471 : i1; - v483 = arith.zext v482 : u32; - v484 = hir.bitcast v483 : i32; - v486 = arith.neq v484, v1329 : i1; - v1300, v1301 = scf.if v486 : i32, i32 { - ^block60: - v1328 = arith.constant 0 : i32; - scf.yield v1328, v1328; + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v302: i32, v303: i32, v304: i32, v305: i32, v306: i32, v307: i32) { + ^block41(v302: i32, v303: i32, v304: i32, v305: i32, v306: i32, v307: i32): + v310 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v311 = hir.bitcast v310 : ptr; + v312 = hir.load v311 : i32; + v313 = arith.constant 32 : i32; + v314 = arith.sub v312, v313 : i32 #[overflow = wrapping]; + v315 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v316 = hir.bitcast v315 : ptr; + hir.store v316, v314; + v892 = arith.constant 0 : i32; + v308 = arith.constant 0 : i32; + v319 = arith.eq v307, v308 : i1; + v320 = arith.zext v319 : u32; + v321 = hir.bitcast v320 : i32; + v323 = arith.neq v321, v892 : i1; + v863, v864 = scf.if v323 : i32, i32 { + ^block44: + v891 = arith.constant 0 : i32; + scf.yield v891, v891; } else { - ^block61: - v487 = arith.add v467, v468 : i32 #[overflow = wrapping]; - v1327 = arith.constant 0 : i32; - v489 = hir.bitcast v467 : u32; - v488 = hir.bitcast v487 : u32; - v490 = arith.lt v488, v489 : i1; - v491 = arith.zext v490 : u32; - v492 = hir.bitcast v491 : i32; - v494 = arith.neq v492, v1327 : i1; - v1298, v1299 = scf.if v494 : i32, i32 { - ^block143: - v1326 = arith.constant 0 : i32; - scf.yield v1326, v1326; + ^block45: + v324 = arith.add v304, v305 : i32 #[overflow = wrapping]; + v890 = arith.constant 0 : i32; + v326 = hir.bitcast v304 : u32; + v325 = hir.bitcast v324 : u32; + v327 = arith.lt v325, v326 : i1; + v328 = arith.zext v327 : u32; + v329 = hir.bitcast v328 : i32; + v331 = arith.neq v329, v890 : i1; + v861, v862 = scf.if v331 : i32, i32 { + ^block98: + v889 = arith.constant 0 : i32; + scf.yield v889, v889; } else { - ^block62: - v505 = hir.bitcast v466 : u32; - v619 = arith.constant 4 : u32; - v507 = arith.mod v505, v619 : u32; - hir.assertz v507 #[code = 250]; - v508 = hir.int_to_ptr v505 : ptr; - v509 = hir.load v508 : i32; - v1254 = arith.constant 1 : u32; - v512 = arith.shl v509, v1254 : i32; - v1325 = arith.constant 0 : i32; - v514 = hir.bitcast v512 : u32; - v513 = hir.bitcast v487 : u32; - v515 = arith.gt v513, v514 : i1; - v516 = arith.zext v515 : u32; - v517 = hir.bitcast v516 : i32; - v519 = arith.neq v517, v1325 : i1; - v520 = cf.select v519, v487, v512 : i32; - v1322 = arith.constant 1 : i32; - v522 = arith.constant 4 : i32; - v1323 = arith.constant 0 : i32; - v1253 = arith.constant 1025 : u32; - v525 = hir.bitcast v470 : u32; - v527 = arith.lt v525, v1253 : i1; - v528 = arith.zext v527 : u32; - v529 = hir.bitcast v528 : i32; - v531 = arith.neq v529, v1323 : i1; - v532 = cf.select v531, v522, v1322 : i32; - v521 = arith.constant 8 : i32; - v1324 = arith.constant 0 : i32; - v510 = arith.constant 1 : i32; - v534 = arith.eq v470, v510 : i1; - v535 = arith.zext v534 : u32; - v536 = hir.bitcast v535 : i32; - v538 = arith.neq v536, v1324 : i1; - v539 = cf.select v538, v521, v532 : i32; - v1321 = arith.constant 0 : i32; - v541 = hir.bitcast v539 : u32; - v540 = hir.bitcast v520 : u32; - v542 = arith.gt v540, v541 : i1; - v543 = arith.zext v542 : u32; - v544 = hir.bitcast v543 : i32; - v546 = arith.neq v544, v1321 : i1; - v547 = cf.select v546, v520, v539 : i32; - v548 = hir.bitcast v547 : u32; - v549 = arith.zext v548 : u64; - v550 = hir.bitcast v549 : i64; - v1320 = arith.constant 0 : i32; - v500 = arith.sub v1320, v469 : i32 #[overflow = wrapping]; - v497 = arith.constant -1 : i32; - v496 = arith.add v469, v470 : i32 #[overflow = wrapping]; - v498 = arith.add v496, v497 : i32 #[overflow = wrapping]; - v501 = arith.band v498, v500 : i32; - v502 = hir.bitcast v501 : u32; - v503 = arith.zext v502 : u64; - v504 = hir.bitcast v503 : i64; - v551 = arith.mul v504, v550 : i64 #[overflow = wrapping]; - v1319 = arith.constant 0 : i32; - v552 = arith.constant 32 : i64; - v554 = hir.cast v552 : u32; - v553 = hir.bitcast v551 : u64; - v555 = arith.shr v553, v554 : u64; - v556 = hir.bitcast v555 : i64; - v557 = arith.trunc v556 : i32; - v559 = arith.neq v557, v1319 : i1; - v1296, v1297 = scf.if v559 : i32, i32 { - ^block142: - v1318 = arith.constant 0 : i32; - scf.yield v520, v1318; + ^block46: + v342 = hir.bitcast v303 : u32; + v456 = arith.constant 4 : u32; + v344 = arith.mod v342, v456 : u32; + hir.assertz v344 #[code = 250]; + v345 = hir.int_to_ptr v342 : ptr; + v346 = hir.load v345 : i32; + v817 = arith.constant 1 : u32; + v349 = arith.shl v346, v817 : i32; + v888 = arith.constant 0 : i32; + v351 = hir.bitcast v349 : u32; + v350 = hir.bitcast v324 : u32; + v352 = arith.gt v350, v351 : i1; + v353 = arith.zext v352 : u32; + v354 = hir.bitcast v353 : i32; + v356 = arith.neq v354, v888 : i1; + v357 = cf.select v356, v324, v349 : i32; + v885 = arith.constant 1 : i32; + v359 = arith.constant 4 : i32; + v886 = arith.constant 0 : i32; + v816 = arith.constant 1025 : u32; + v362 = hir.bitcast v307 : u32; + v364 = arith.lt v362, v816 : i1; + v365 = arith.zext v364 : u32; + v366 = hir.bitcast v365 : i32; + v368 = arith.neq v366, v886 : i1; + v369 = cf.select v368, v359, v885 : i32; + v358 = arith.constant 8 : i32; + v887 = arith.constant 0 : i32; + v347 = arith.constant 1 : i32; + v371 = arith.eq v307, v347 : i1; + v372 = arith.zext v371 : u32; + v373 = hir.bitcast v372 : i32; + v375 = arith.neq v373, v887 : i1; + v376 = cf.select v375, v358, v369 : i32; + v884 = arith.constant 0 : i32; + v378 = hir.bitcast v376 : u32; + v377 = hir.bitcast v357 : u32; + v379 = arith.gt v377, v378 : i1; + v380 = arith.zext v379 : u32; + v381 = hir.bitcast v380 : i32; + v383 = arith.neq v381, v884 : i1; + v384 = cf.select v383, v357, v376 : i32; + v385 = hir.bitcast v384 : u32; + v386 = arith.zext v385 : u64; + v387 = hir.bitcast v386 : i64; + v883 = arith.constant 0 : i32; + v337 = arith.sub v883, v306 : i32 #[overflow = wrapping]; + v334 = arith.constant -1 : i32; + v333 = arith.add v306, v307 : i32 #[overflow = wrapping]; + v335 = arith.add v333, v334 : i32 #[overflow = wrapping]; + v338 = arith.band v335, v337 : i32; + v339 = hir.bitcast v338 : u32; + v340 = arith.zext v339 : u64; + v341 = hir.bitcast v340 : i64; + v388 = arith.mul v341, v387 : i64 #[overflow = wrapping]; + v882 = arith.constant 0 : i32; + v389 = arith.constant 32 : i64; + v391 = hir.cast v389 : u32; + v390 = hir.bitcast v388 : u64; + v392 = arith.shr v390, v391 : u64; + v393 = hir.bitcast v392 : i64; + v394 = arith.trunc v393 : i32; + v396 = arith.neq v394, v882 : i1; + v859, v860 = scf.if v396 : i32, i32 { + ^block97: + v881 = arith.constant 0 : i32; + scf.yield v357, v881; } else { - ^block63: - v560 = arith.trunc v551 : i32; - v1317 = arith.constant 0 : i32; - v561 = arith.constant -2147483648 : i32; - v562 = arith.sub v561, v469 : i32 #[overflow = wrapping]; - v564 = hir.bitcast v562 : u32; - v563 = hir.bitcast v560 : u32; - v565 = arith.gt v563, v564 : i1; - v566 = arith.zext v565 : u32; - v567 = hir.bitcast v566 : i32; - v569 = arith.neq v567, v1317 : i1; - v1294, v1295 = scf.if v569 : i32, i32 { - ^block141: - v1316 = arith.constant 0 : i32; - scf.yield v520, v1316; + ^block47: + v397 = arith.trunc v388 : i32; + v880 = arith.constant 0 : i32; + v398 = arith.constant -2147483648 : i32; + v399 = arith.sub v398, v306 : i32 #[overflow = wrapping]; + v401 = hir.bitcast v399 : u32; + v400 = hir.bitcast v397 : u32; + v402 = arith.gt v400, v401 : i1; + v403 = arith.zext v402 : u32; + v404 = hir.bitcast v403 : i32; + v406 = arith.neq v404, v880 : i1; + v857, v858 = scf.if v406 : i32, i32 { + ^block96: + v879 = arith.constant 0 : i32; + scf.yield v357, v879; } else { - ^block64: - v570 = arith.constant 20 : i32; - v571 = arith.add v477, v570 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v571, v466, v469, v470) - v1314 = arith.constant 20 : i32; - v575 = arith.add v477, v1314 : i32 #[overflow = wrapping]; - v1315 = arith.constant 8 : i32; - v573 = arith.add v477, v1315 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::finish_grow(v573, v469, v560, v575, v465) - v577 = arith.constant 12 : u32; - v576 = hir.bitcast v477 : u32; - v578 = arith.add v576, v577 : u32 #[overflow = checked]; - v1313 = arith.constant 4 : u32; - v580 = arith.mod v578, v1313 : u32; - hir.assertz v580 #[code = 250]; - v581 = hir.int_to_ptr v578 : ptr; - v582 = hir.load v581 : i32; - v584 = arith.constant 8 : u32; - v583 = hir.bitcast v477 : u32; - v585 = arith.add v583, v584 : u32 #[overflow = checked]; - v1312 = arith.constant 4 : u32; - v587 = arith.mod v585, v1312 : u32; - hir.assertz v587 #[code = 250]; - v588 = hir.int_to_ptr v585 : ptr; - v589 = hir.load v588 : i32; - v1310 = arith.constant 0 : i32; - v1311 = arith.constant 0 : i32; - v591 = arith.eq v589, v1311 : i1; - v592 = arith.zext v591 : u32; - v593 = hir.bitcast v592 : i32; - v595 = arith.neq v593, v1310 : i1; - v1292 = scf.if v595 : i32 { - ^block65: - v603 = hir.bitcast v466 : u32; - v1309 = arith.constant 4 : u32; - v605 = arith.mod v603, v1309 : u32; - hir.assertz v605 #[code = 250]; - v606 = hir.int_to_ptr v603 : ptr; - hir.store v606, v547; - v1308 = arith.constant 4 : u32; - v607 = hir.bitcast v466 : u32; - v609 = arith.add v607, v1308 : u32 #[overflow = checked]; - v1307 = arith.constant 4 : u32; - v611 = arith.mod v609, v1307 : u32; - hir.assertz v611 #[code = 250]; - v612 = hir.int_to_ptr v609 : ptr; - hir.store v612, v582; - scf.yield v520; + ^block48: + v407 = arith.constant 20 : i32; + v408 = arith.add v314, v407 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v408, v303, v306, v307) + v877 = arith.constant 20 : i32; + v412 = arith.add v314, v877 : i32 #[overflow = wrapping]; + v878 = arith.constant 8 : i32; + v410 = arith.add v314, v878 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::finish_grow(v410, v306, v397, v412, v302) + v414 = arith.constant 12 : u32; + v413 = hir.bitcast v314 : u32; + v415 = arith.add v413, v414 : u32 #[overflow = checked]; + v876 = arith.constant 4 : u32; + v417 = arith.mod v415, v876 : u32; + hir.assertz v417 #[code = 250]; + v418 = hir.int_to_ptr v415 : ptr; + v419 = hir.load v418 : i32; + v421 = arith.constant 8 : u32; + v420 = hir.bitcast v314 : u32; + v422 = arith.add v420, v421 : u32 #[overflow = checked]; + v875 = arith.constant 4 : u32; + v424 = arith.mod v422, v875 : u32; + hir.assertz v424 #[code = 250]; + v425 = hir.int_to_ptr v422 : ptr; + v426 = hir.load v425 : i32; + v873 = arith.constant 0 : i32; + v874 = arith.constant 0 : i32; + v428 = arith.eq v426, v874 : i1; + v429 = arith.zext v428 : u32; + v430 = hir.bitcast v429 : i32; + v432 = arith.neq v430, v873 : i1; + v855 = scf.if v432 : i32 { + ^block49: + v440 = hir.bitcast v303 : u32; + v872 = arith.constant 4 : u32; + v442 = arith.mod v440, v872 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + hir.store v443, v384; + v871 = arith.constant 4 : u32; + v444 = hir.bitcast v303 : u32; + v446 = arith.add v444, v871 : u32 #[overflow = checked]; + v870 = arith.constant 4 : u32; + v448 = arith.mod v446, v870 : u32; + hir.assertz v448 #[code = 250]; + v449 = hir.int_to_ptr v446 : ptr; + hir.store v449, v419; + scf.yield v357; } else { - ^block66: - v597 = arith.constant 16 : u32; - v596 = hir.bitcast v477 : u32; - v598 = arith.add v596, v597 : u32 #[overflow = checked]; - v1306 = arith.constant 4 : u32; - v600 = arith.mod v598, v1306 : u32; - hir.assertz v600 #[code = 250]; - v601 = hir.int_to_ptr v598 : ptr; - v602 = hir.load v601 : i32; - scf.yield v602; + ^block50: + v434 = arith.constant 16 : u32; + v433 = hir.bitcast v314 : u32; + v435 = arith.add v433, v434 : u32 #[overflow = checked]; + v869 = arith.constant 4 : u32; + v437 = arith.mod v435, v869 : u32; + hir.assertz v437 #[code = 250]; + v438 = hir.int_to_ptr v435 : ptr; + v439 = hir.load v438 : i32; + scf.yield v439; }; - v613 = arith.constant -2147483647 : i32; - v1293 = cf.select v595, v613, v582 : i32; - scf.yield v1292, v1293; + v450 = arith.constant -2147483647 : i32; + v856 = cf.select v432, v450, v419 : i32; + scf.yield v855, v856; }; - scf.yield v1294, v1295; + scf.yield v857, v858; }; - scf.yield v1296, v1297; + scf.yield v859, v860; }; - scf.yield v1298, v1299; - }; - v1305 = arith.constant 4 : u32; - v618 = hir.bitcast v465 : u32; - v620 = arith.add v618, v1305 : u32 #[overflow = checked]; - v1304 = arith.constant 4 : u32; - v622 = arith.mod v620, v1304 : u32; - hir.assertz v622 #[code = 250]; - v623 = hir.int_to_ptr v620 : ptr; - hir.store v623, v1300; - v626 = hir.bitcast v465 : u32; - v1303 = arith.constant 4 : u32; - v628 = arith.mod v626, v1303 : u32; - hir.assertz v628 #[code = 250]; - v629 = hir.int_to_ptr v626 : ptr; - hir.store v629, v1301; - v1302 = arith.constant 32 : i32; - v633 = arith.add v477, v1302 : i32 #[overflow = wrapping]; - v634 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v635 = hir.bitcast v634 : ptr; - hir.store v635, v633; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::deallocate(v636: i32, v637: i32, v638: i32) { - ^block67(v636: i32, v637: i32, v638: i32): - v640 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v641 = hir.bitcast v640 : ptr; - v642 = hir.load v641 : i32; - v643 = arith.constant 16 : i32; - v644 = arith.sub v642, v643 : i32 #[overflow = wrapping]; - v645 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v646 = hir.bitcast v645 : ptr; - hir.store v646, v644; - v647 = arith.constant 4 : i32; - v648 = arith.add v644, v647 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v648, v636, v637, v638) - v650 = arith.constant 8 : u32; - v649 = hir.bitcast v644 : u32; - v651 = arith.add v649, v650 : u32 #[overflow = checked]; - v652 = arith.constant 4 : u32; - v653 = arith.mod v651, v652 : u32; - hir.assertz v653 #[code = 250]; - v654 = hir.int_to_ptr v651 : ptr; - v655 = hir.load v654 : i32; - v1336 = arith.constant 0 : i32; - v639 = arith.constant 0 : i32; - v657 = arith.eq v655, v639 : i1; - v658 = arith.zext v657 : u32; - v659 = hir.bitcast v658 : i32; - v661 = arith.neq v659, v1336 : i1; - scf.if v661{ - ^block149: - scf.yield ; - } else { - ^block70: - v1335 = arith.constant 4 : u32; - v662 = hir.bitcast v644 : u32; - v664 = arith.add v662, v1335 : u32 #[overflow = checked]; - v1334 = arith.constant 4 : u32; - v666 = arith.mod v664, v1334 : u32; - hir.assertz v666 #[code = 250]; - v667 = hir.int_to_ptr v664 : ptr; - v668 = hir.load v667 : i32; - v670 = arith.constant 12 : u32; - v669 = hir.bitcast v644 : u32; - v671 = arith.add v669, v670 : u32 #[overflow = checked]; - v1333 = arith.constant 4 : u32; - v673 = arith.mod v671, v1333 : u32; - hir.assertz v673 #[code = 250]; - v674 = hir.int_to_ptr v671 : ptr; - v675 = hir.load v674 : i32; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::deallocate(v668, v655, v675) - scf.yield ; + scf.yield v861, v862; }; - v1332 = arith.constant 16 : i32; - v678 = arith.add v644, v1332 : i32 #[overflow = wrapping]; - v679 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v680 = hir.bitcast v679 : ptr; - hir.store v680, v678; + v868 = arith.constant 4 : u32; + v455 = hir.bitcast v302 : u32; + v457 = arith.add v455, v868 : u32 #[overflow = checked]; + v867 = arith.constant 4 : u32; + v459 = arith.mod v457, v867 : u32; + hir.assertz v459 #[code = 250]; + v460 = hir.int_to_ptr v457 : ptr; + hir.store v460, v863; + v463 = hir.bitcast v302 : u32; + v866 = arith.constant 4 : u32; + v465 = arith.mod v463, v866 : u32; + hir.assertz v465 #[code = 250]; + v466 = hir.int_to_ptr v463 : ptr; + hir.store v466, v864; + v865 = arith.constant 32 : i32; + v470 = arith.add v314, v865 : i32 #[overflow = wrapping]; + v471 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v472 = hir.bitcast v471 : ptr; + hir.store v472, v470; builtin.ret ; }; - private builtin.function @::allocate(v681: i32, v682: i32, v683: i32) { - ^block71(v681: i32, v682: i32, v683: i32): - v685 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v686 = hir.bitcast v685 : ptr; - v687 = hir.load v686 : i32; - v688 = arith.constant 16 : i32; - v689 = arith.sub v687, v688 : i32 #[overflow = wrapping]; - v690 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v691 = hir.bitcast v690 : ptr; - hir.store v691, v689; - v684 = arith.constant 0 : i32; - v692 = arith.constant 8 : i32; - v693 = arith.add v689, v692 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v693, v682, v683, v684) - v696 = arith.constant 12 : u32; - v695 = hir.bitcast v689 : u32; - v697 = arith.add v695, v696 : u32 #[overflow = checked]; - v698 = arith.constant 4 : u32; - v699 = arith.mod v697, v698 : u32; - hir.assertz v699 #[code = 250]; - v700 = hir.int_to_ptr v697 : ptr; - v701 = hir.load v700 : i32; - v703 = arith.constant 8 : u32; - v702 = hir.bitcast v689 : u32; - v704 = arith.add v702, v703 : u32 #[overflow = checked]; - v1341 = arith.constant 4 : u32; - v706 = arith.mod v704, v1341 : u32; - hir.assertz v706 #[code = 250]; - v707 = hir.int_to_ptr v704 : ptr; - v708 = hir.load v707 : i32; - v709 = hir.bitcast v681 : u32; - v1340 = arith.constant 4 : u32; - v711 = arith.mod v709, v1340 : u32; - hir.assertz v711 #[code = 250]; - v712 = hir.int_to_ptr v709 : ptr; - hir.store v712, v708; - v1339 = arith.constant 4 : u32; - v713 = hir.bitcast v681 : u32; - v715 = arith.add v713, v1339 : u32 #[overflow = checked]; - v1338 = arith.constant 4 : u32; - v717 = arith.mod v715, v1338 : u32; - hir.assertz v717 #[code = 250]; - v718 = hir.int_to_ptr v715 : ptr; - hir.store v718, v701; - v1337 = arith.constant 16 : i32; - v720 = arith.add v689, v1337 : i32 #[overflow = wrapping]; - v721 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v722 = hir.bitcast v721 : ptr; - hir.store v722, v720; + private builtin.function @::allocate(v473: i32, v474: i32, v475: i32) { + ^block51(v473: i32, v474: i32, v475: i32): + v477 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v478 = hir.bitcast v477 : ptr; + v479 = hir.load v478 : i32; + v480 = arith.constant 16 : i32; + v481 = arith.sub v479, v480 : i32 #[overflow = wrapping]; + v482 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v483 = hir.bitcast v482 : ptr; + hir.store v483, v481; + v476 = arith.constant 0 : i32; + v484 = arith.constant 8 : i32; + v485 = arith.add v481, v484 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v485, v474, v475, v476) + v488 = arith.constant 12 : u32; + v487 = hir.bitcast v481 : u32; + v489 = arith.add v487, v488 : u32 #[overflow = checked]; + v490 = arith.constant 4 : u32; + v491 = arith.mod v489, v490 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + v493 = hir.load v492 : i32; + v495 = arith.constant 8 : u32; + v494 = hir.bitcast v481 : u32; + v496 = arith.add v494, v495 : u32 #[overflow = checked]; + v897 = arith.constant 4 : u32; + v498 = arith.mod v496, v897 : u32; + hir.assertz v498 #[code = 250]; + v499 = hir.int_to_ptr v496 : ptr; + v500 = hir.load v499 : i32; + v501 = hir.bitcast v473 : u32; + v896 = arith.constant 4 : u32; + v503 = arith.mod v501, v896 : u32; + hir.assertz v503 #[code = 250]; + v504 = hir.int_to_ptr v501 : ptr; + hir.store v504, v500; + v895 = arith.constant 4 : u32; + v505 = hir.bitcast v473 : u32; + v507 = arith.add v505, v895 : u32 #[overflow = checked]; + v894 = arith.constant 4 : u32; + v509 = arith.mod v507, v894 : u32; + hir.assertz v509 #[code = 250]; + v510 = hir.int_to_ptr v507 : ptr; + hir.store v510, v493; + v893 = arith.constant 16 : i32; + v512 = arith.add v481, v893 : i32 #[overflow = wrapping]; + v513 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v514 = hir.bitcast v513 : ptr; + hir.store v514, v512; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v723: i32, v724: i32, v725: i32, v726: i32) { - ^block73(v723: i32, v724: i32, v725: i32, v726: i32): - v1357 = arith.constant 0 : i32; - v727 = arith.constant 0 : i32; - v728 = arith.eq v725, v727 : i1; - v729 = arith.zext v728 : u32; - v730 = hir.bitcast v729 : i32; - v732 = arith.neq v730, v1357 : i1; - v1353 = scf.if v732 : i32 { - ^block151: - scf.yield v724; + private builtin.function @alloc::alloc::Global::alloc_impl(v515: i32, v516: i32, v517: i32, v518: i32) { + ^block53(v515: i32, v516: i32, v517: i32, v518: i32): + v913 = arith.constant 0 : i32; + v519 = arith.constant 0 : i32; + v520 = arith.eq v517, v519 : i1; + v521 = arith.zext v520 : u32; + v522 = hir.bitcast v521 : i32; + v524 = arith.neq v522, v913 : i1; + v909 = scf.if v524 : i32 { + ^block104: + scf.yield v516; } else { - ^block76: + ^block56: hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1356 = arith.constant 0 : i32; - v734 = arith.neq v726, v1356 : i1; - v1352 = scf.if v734 : i32 { - ^block77: - v736 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc_zeroed(v725, v724) : i32 - scf.yield v736; + v912 = arith.constant 0 : i32; + v526 = arith.neq v518, v912 : i1; + v908 = scf.if v526 : i32 { + ^block57: + v528 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc_zeroed(v517, v516) : i32 + scf.yield v528; } else { - ^block78: - v735 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v725, v724) : i32 - scf.yield v735; + ^block58: + v527 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v517, v516) : i32 + scf.yield v527; }; - scf.yield v1352; + scf.yield v908; }; - v740 = arith.constant 4 : u32; - v739 = hir.bitcast v723 : u32; - v741 = arith.add v739, v740 : u32 #[overflow = checked]; - v1355 = arith.constant 4 : u32; - v743 = arith.mod v741, v1355 : u32; - hir.assertz v743 #[code = 250]; - v744 = hir.int_to_ptr v741 : ptr; - hir.store v744, v725; - v746 = hir.bitcast v723 : u32; - v1354 = arith.constant 4 : u32; - v748 = arith.mod v746, v1354 : u32; - hir.assertz v748 #[code = 250]; - v749 = hir.int_to_ptr v746 : ptr; - hir.store v749, v1353; + v532 = arith.constant 4 : u32; + v531 = hir.bitcast v515 : u32; + v533 = arith.add v531, v532 : u32 #[overflow = checked]; + v911 = arith.constant 4 : u32; + v535 = arith.mod v533, v911 : u32; + hir.assertz v535 #[code = 250]; + v536 = hir.int_to_ptr v533 : ptr; + hir.store v536, v517; + v538 = hir.bitcast v515 : u32; + v910 = arith.constant 4 : u32; + v540 = arith.mod v538, v910 : u32; + hir.assertz v540 #[code = 250]; + v541 = hir.int_to_ptr v538 : ptr; + hir.store v541, v909; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v750: i32, v751: i32, v752: i32, v753: i32) { - ^block79(v750: i32, v751: i32, v752: i32, v753: i32): - v1383 = arith.constant 0 : i32; - v754 = arith.constant 0 : i32; - v758 = arith.eq v753, v754 : i1; - v759 = arith.zext v758 : u32; - v760 = hir.bitcast v759 : i32; - v762 = arith.neq v760, v1383 : i1; - v1370, v1371 = scf.if v762 : i32, i32 { - ^block155: - v1382 = arith.constant 0 : i32; - v756 = arith.constant 4 : i32; - scf.yield v756, v1382; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v542: i32, v543: i32, v544: i32, v545: i32) { + ^block59(v542: i32, v543: i32, v544: i32, v545: i32): + v939 = arith.constant 0 : i32; + v546 = arith.constant 0 : i32; + v550 = arith.eq v545, v546 : i1; + v551 = arith.zext v550 : u32; + v552 = hir.bitcast v551 : i32; + v554 = arith.neq v552, v939 : i1; + v926, v927 = scf.if v554 : i32, i32 { + ^block108: + v938 = arith.constant 0 : i32; + v548 = arith.constant 4 : i32; + scf.yield v548, v938; } else { - ^block82: - v763 = hir.bitcast v751 : u32; - v798 = arith.constant 4 : u32; - v765 = arith.mod v763, v798 : u32; - hir.assertz v765 #[code = 250]; - v766 = hir.int_to_ptr v763 : ptr; - v767 = hir.load v766 : i32; - v1380 = arith.constant 0 : i32; - v1381 = arith.constant 0 : i32; - v769 = arith.eq v767, v1381 : i1; - v770 = arith.zext v769 : u32; - v771 = hir.bitcast v770 : i32; - v773 = arith.neq v771, v1380 : i1; - v1368 = scf.if v773 : i32 { - ^block154: - v1379 = arith.constant 0 : i32; - scf.yield v1379; + ^block62: + v555 = hir.bitcast v543 : u32; + v590 = arith.constant 4 : u32; + v557 = arith.mod v555, v590 : u32; + hir.assertz v557 #[code = 250]; + v558 = hir.int_to_ptr v555 : ptr; + v559 = hir.load v558 : i32; + v936 = arith.constant 0 : i32; + v937 = arith.constant 0 : i32; + v561 = arith.eq v559, v937 : i1; + v562 = arith.zext v561 : u32; + v563 = hir.bitcast v562 : i32; + v565 = arith.neq v563, v936 : i1; + v924 = scf.if v565 : i32 { + ^block107: + v935 = arith.constant 0 : i32; + scf.yield v935; } else { - ^block83: - v1378 = arith.constant 4 : u32; - v774 = hir.bitcast v750 : u32; - v776 = arith.add v774, v1378 : u32 #[overflow = checked]; - v1377 = arith.constant 4 : u32; - v778 = arith.mod v776, v1377 : u32; - hir.assertz v778 #[code = 250]; - v779 = hir.int_to_ptr v776 : ptr; - hir.store v779, v752; - v1376 = arith.constant 4 : u32; - v780 = hir.bitcast v751 : u32; - v782 = arith.add v780, v1376 : u32 #[overflow = checked]; - v1375 = arith.constant 4 : u32; - v784 = arith.mod v782, v1375 : u32; - hir.assertz v784 #[code = 250]; - v785 = hir.int_to_ptr v782 : ptr; - v786 = hir.load v785 : i32; - v787 = hir.bitcast v750 : u32; - v1374 = arith.constant 4 : u32; - v789 = arith.mod v787, v1374 : u32; - hir.assertz v789 #[code = 250]; - v790 = hir.int_to_ptr v787 : ptr; - hir.store v790, v786; - v791 = arith.mul v767, v753 : i32 #[overflow = wrapping]; - scf.yield v791; + ^block63: + v934 = arith.constant 4 : u32; + v566 = hir.bitcast v542 : u32; + v568 = arith.add v566, v934 : u32 #[overflow = checked]; + v933 = arith.constant 4 : u32; + v570 = arith.mod v568, v933 : u32; + hir.assertz v570 #[code = 250]; + v571 = hir.int_to_ptr v568 : ptr; + hir.store v571, v544; + v932 = arith.constant 4 : u32; + v572 = hir.bitcast v543 : u32; + v574 = arith.add v572, v932 : u32 #[overflow = checked]; + v931 = arith.constant 4 : u32; + v576 = arith.mod v574, v931 : u32; + hir.assertz v576 #[code = 250]; + v577 = hir.int_to_ptr v574 : ptr; + v578 = hir.load v577 : i32; + v579 = hir.bitcast v542 : u32; + v930 = arith.constant 4 : u32; + v581 = arith.mod v579, v930 : u32; + hir.assertz v581 #[code = 250]; + v582 = hir.int_to_ptr v579 : ptr; + hir.store v582, v578; + v583 = arith.mul v559, v545 : i32 #[overflow = wrapping]; + scf.yield v583; }; - v792 = arith.constant 8 : i32; - v1373 = arith.constant 4 : i32; - v1369 = cf.select v773, v1373, v792 : i32; - scf.yield v1369, v1368; + v584 = arith.constant 8 : i32; + v929 = arith.constant 4 : i32; + v925 = cf.select v565, v929, v584 : i32; + scf.yield v925, v924; }; - v795 = arith.add v750, v1370 : i32 #[overflow = wrapping]; - v797 = hir.bitcast v795 : u32; - v1372 = arith.constant 4 : u32; - v799 = arith.mod v797, v1372 : u32; - hir.assertz v799 #[code = 250]; - v800 = hir.int_to_ptr v797 : ptr; - hir.store v800, v1371; + v587 = arith.add v542, v926 : i32 #[overflow = wrapping]; + v589 = hir.bitcast v587 : u32; + v928 = arith.constant 4 : u32; + v591 = arith.mod v589, v928 : u32; + hir.assertz v591 #[code = 250]; + v592 = hir.int_to_ptr v589 : ptr; + hir.store v592, v927; builtin.ret ; }; - private builtin.function @alloc::raw_vec::finish_grow(v801: i32, v802: i32, v803: i32, v804: i32, v805: i32) { - ^block84(v801: i32, v802: i32, v803: i32, v804: i32, v805: i32): - v807 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v808 = hir.bitcast v807 : ptr; - v809 = hir.load v808 : i32; - v810 = arith.constant 16 : i32; - v811 = arith.sub v809, v810 : i32 #[overflow = wrapping]; - v812 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v813 = hir.bitcast v812 : ptr; - hir.store v813, v811; - v1438 = arith.constant 0 : i32; - v806 = arith.constant 0 : i32; - v816 = arith.gte v803, v806 : i1; - v817 = arith.zext v816 : u32; - v818 = hir.bitcast v817 : i32; - v820 = arith.neq v818, v1438 : i1; - v1412, v1413 = scf.if v820 : i32, i32 { - ^block87: - v907 = arith.constant 4 : u32; - v823 = hir.bitcast v804 : u32; - v825 = arith.add v823, v907 : u32 #[overflow = checked]; - v1437 = arith.constant 4 : u32; - v827 = arith.mod v825, v1437 : u32; - hir.assertz v827 #[code = 250]; - v828 = hir.int_to_ptr v825 : ptr; - v829 = hir.load v828 : i32; - v1435 = arith.constant 0 : i32; - v1436 = arith.constant 0 : i32; - v831 = arith.eq v829, v1436 : i1; - v832 = arith.zext v831 : u32; - v833 = hir.bitcast v832 : i32; - v835 = arith.neq v833, v1435 : i1; - v1410, v1411 = scf.if v835 : i32, i32 { - ^block90: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v811, v802, v803) - v1434 = arith.constant 4 : u32; - v868 = hir.bitcast v811 : u32; - v870 = arith.add v868, v1434 : u32 #[overflow = checked]; - v1433 = arith.constant 4 : u32; - v872 = arith.mod v870, v1433 : u32; - hir.assertz v872 #[code = 250]; - v873 = hir.int_to_ptr v870 : ptr; - v874 = hir.load v873 : i32; - v875 = hir.bitcast v811 : u32; - v1432 = arith.constant 4 : u32; - v877 = arith.mod v875, v1432 : u32; - hir.assertz v877 #[code = 250]; - v878 = hir.int_to_ptr v875 : ptr; - v879 = hir.load v878 : i32; - scf.yield v879, v874; + private builtin.function @alloc::raw_vec::finish_grow(v593: i32, v594: i32, v595: i32, v596: i32, v597: i32) { + ^block64(v593: i32, v594: i32, v595: i32, v596: i32, v597: i32): + v599 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v600 = hir.bitcast v599 : ptr; + v601 = hir.load v600 : i32; + v602 = arith.constant 16 : i32; + v603 = arith.sub v601, v602 : i32 #[overflow = wrapping]; + v604 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v605 = hir.bitcast v604 : ptr; + hir.store v605, v603; + v994 = arith.constant 0 : i32; + v598 = arith.constant 0 : i32; + v608 = arith.gte v595, v598 : i1; + v609 = arith.zext v608 : u32; + v610 = hir.bitcast v609 : i32; + v612 = arith.neq v610, v994 : i1; + v968, v969 = scf.if v612 : i32, i32 { + ^block67: + v699 = arith.constant 4 : u32; + v615 = hir.bitcast v596 : u32; + v617 = arith.add v615, v699 : u32 #[overflow = checked]; + v993 = arith.constant 4 : u32; + v619 = arith.mod v617, v993 : u32; + hir.assertz v619 #[code = 250]; + v620 = hir.int_to_ptr v617 : ptr; + v621 = hir.load v620 : i32; + v991 = arith.constant 0 : i32; + v992 = arith.constant 0 : i32; + v623 = arith.eq v621, v992 : i1; + v624 = arith.zext v623 : u32; + v625 = hir.bitcast v624 : i32; + v627 = arith.neq v625, v991 : i1; + v966, v967 = scf.if v627 : i32, i32 { + ^block70: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v603, v594, v595) + v990 = arith.constant 4 : u32; + v660 = hir.bitcast v603 : u32; + v662 = arith.add v660, v990 : u32 #[overflow = checked]; + v989 = arith.constant 4 : u32; + v664 = arith.mod v662, v989 : u32; + hir.assertz v664 #[code = 250]; + v665 = hir.int_to_ptr v662 : ptr; + v666 = hir.load v665 : i32; + v667 = hir.bitcast v603 : u32; + v988 = arith.constant 4 : u32; + v669 = arith.mod v667, v988 : u32; + hir.assertz v669 #[code = 250]; + v670 = hir.int_to_ptr v667 : ptr; + v671 = hir.load v670 : i32; + scf.yield v671, v666; } else { - ^block91: - v837 = arith.constant 8 : u32; - v836 = hir.bitcast v804 : u32; - v838 = arith.add v836, v837 : u32 #[overflow = checked]; - v1431 = arith.constant 4 : u32; - v840 = arith.mod v838, v1431 : u32; - hir.assertz v840 #[code = 250]; - v841 = hir.int_to_ptr v838 : ptr; - v842 = hir.load v841 : i32; - v1430 = arith.constant 0 : i32; - v844 = arith.neq v842, v1430 : i1; - v1408, v1409 = scf.if v844 : i32, i32 { - ^block92: - v862 = hir.bitcast v804 : u32; - v1429 = arith.constant 4 : u32; - v864 = arith.mod v862, v1429 : u32; - hir.assertz v864 #[code = 250]; - v865 = hir.int_to_ptr v862 : ptr; - v866 = hir.load v865 : i32; - v867 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_realloc(v866, v842, v802, v803) : i32 - scf.yield v867, v803; + ^block71: + v629 = arith.constant 8 : u32; + v628 = hir.bitcast v596 : u32; + v630 = arith.add v628, v629 : u32 #[overflow = checked]; + v987 = arith.constant 4 : u32; + v632 = arith.mod v630, v987 : u32; + hir.assertz v632 #[code = 250]; + v633 = hir.int_to_ptr v630 : ptr; + v634 = hir.load v633 : i32; + v986 = arith.constant 0 : i32; + v636 = arith.neq v634, v986 : i1; + v964, v965 = scf.if v636 : i32, i32 { + ^block72: + v654 = hir.bitcast v596 : u32; + v985 = arith.constant 4 : u32; + v656 = arith.mod v654, v985 : u32; + hir.assertz v656 #[code = 250]; + v657 = hir.int_to_ptr v654 : ptr; + v658 = hir.load v657 : i32; + v659 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_realloc(v658, v634, v594, v595) : i32 + scf.yield v659, v595; } else { - ^block93: - v1428 = arith.constant 0 : i32; - v901 = arith.constant 8 : i32; - v846 = arith.add v811, v901 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v846, v802, v803, v1428) - v849 = arith.constant 12 : u32; - v848 = hir.bitcast v811 : u32; - v850 = arith.add v848, v849 : u32 #[overflow = checked]; - v1427 = arith.constant 4 : u32; - v852 = arith.mod v850, v1427 : u32; - hir.assertz v852 #[code = 250]; - v853 = hir.int_to_ptr v850 : ptr; - v854 = hir.load v853 : i32; - v1426 = arith.constant 8 : u32; - v855 = hir.bitcast v811 : u32; - v857 = arith.add v855, v1426 : u32 #[overflow = checked]; - v1425 = arith.constant 4 : u32; - v859 = arith.mod v857, v1425 : u32; - hir.assertz v859 #[code = 250]; - v860 = hir.int_to_ptr v857 : ptr; - v861 = hir.load v860 : i32; - scf.yield v861, v854; + ^block73: + v984 = arith.constant 0 : i32; + v693 = arith.constant 8 : i32; + v638 = arith.add v603, v693 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v638, v594, v595, v984) + v641 = arith.constant 12 : u32; + v640 = hir.bitcast v603 : u32; + v642 = arith.add v640, v641 : u32 #[overflow = checked]; + v983 = arith.constant 4 : u32; + v644 = arith.mod v642, v983 : u32; + hir.assertz v644 #[code = 250]; + v645 = hir.int_to_ptr v642 : ptr; + v646 = hir.load v645 : i32; + v982 = arith.constant 8 : u32; + v647 = hir.bitcast v603 : u32; + v649 = arith.add v647, v982 : u32 #[overflow = checked]; + v981 = arith.constant 4 : u32; + v651 = arith.mod v649, v981 : u32; + hir.assertz v651 #[code = 250]; + v652 = hir.int_to_ptr v649 : ptr; + v653 = hir.load v652 : i32; + scf.yield v653, v646; }; - scf.yield v1408, v1409; + scf.yield v964, v965; }; - v1424 = arith.constant 4 : u32; - v886 = hir.bitcast v801 : u32; - v888 = arith.add v886, v1424 : u32 #[overflow = checked]; - v1423 = arith.constant 4 : u32; - v890 = arith.mod v888, v1423 : u32; - hir.assertz v890 #[code = 250]; - v1422 = arith.constant 0 : i32; - v884 = arith.neq v1410, v1422 : i1; - v885 = cf.select v884, v1410, v802 : i32; - v891 = hir.int_to_ptr v888 : ptr; - hir.store v891, v885; - v1420 = arith.constant 0 : i32; - v898 = arith.eq v1410, v1420 : i1; - v899 = arith.zext v898 : u32; - v900 = hir.bitcast v899 : i32; - v1421 = arith.constant 0 : i32; - v895 = arith.neq v1410, v1421 : i1; - v896 = cf.select v895, v1411, v803 : i32; - scf.yield v896, v900; + v980 = arith.constant 4 : u32; + v678 = hir.bitcast v593 : u32; + v680 = arith.add v678, v980 : u32 #[overflow = checked]; + v979 = arith.constant 4 : u32; + v682 = arith.mod v680, v979 : u32; + hir.assertz v682 #[code = 250]; + v978 = arith.constant 0 : i32; + v676 = arith.neq v966, v978 : i1; + v677 = cf.select v676, v966, v594 : i32; + v683 = hir.int_to_ptr v680 : ptr; + hir.store v683, v677; + v976 = arith.constant 0 : i32; + v690 = arith.eq v966, v976 : i1; + v691 = arith.zext v690 : u32; + v692 = hir.bitcast v691 : i32; + v977 = arith.constant 0 : i32; + v687 = arith.neq v966, v977 : i1; + v688 = cf.select v687, v967, v595 : i32; + scf.yield v688, v692; } else { - ^block88: - v821 = arith.constant 1 : i32; - v1419 = arith.constant 0 : i32; - scf.yield v1419, v821; + ^block68: + v613 = arith.constant 1 : i32; + v975 = arith.constant 0 : i32; + scf.yield v975, v613; }; - v822 = arith.constant 4 : i32; - v1418 = arith.constant 8 : i32; - v1414 = cf.select v820, v1418, v822 : i32; - v904 = arith.add v801, v1414 : i32 #[overflow = wrapping]; - v906 = hir.bitcast v904 : u32; - v1417 = arith.constant 4 : u32; - v908 = arith.mod v906, v1417 : u32; - hir.assertz v908 #[code = 250]; - v909 = hir.int_to_ptr v906 : ptr; - hir.store v909, v1412; - v911 = hir.bitcast v801 : u32; - v1416 = arith.constant 4 : u32; - v913 = arith.mod v911, v1416 : u32; - hir.assertz v913 #[code = 250]; - v914 = hir.int_to_ptr v911 : ptr; - hir.store v914, v1413; - v1415 = arith.constant 16 : i32; - v918 = arith.add v811, v1415 : i32 #[overflow = wrapping]; - v919 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v920 = hir.bitcast v919 : ptr; - hir.store v920, v918; + v614 = arith.constant 4 : i32; + v974 = arith.constant 8 : i32; + v970 = cf.select v612, v974, v614 : i32; + v696 = arith.add v593, v970 : i32 #[overflow = wrapping]; + v698 = hir.bitcast v696 : u32; + v973 = arith.constant 4 : u32; + v700 = arith.mod v698, v973 : u32; + hir.assertz v700 #[code = 250]; + v701 = hir.int_to_ptr v698 : ptr; + hir.store v701, v968; + v703 = hir.bitcast v593 : u32; + v972 = arith.constant 4 : u32; + v705 = arith.mod v703, v972 : u32; + hir.assertz v705 #[code = 250]; + v706 = hir.int_to_ptr v703 : ptr; + hir.store v706, v969; + v971 = arith.constant 16 : i32; + v710 = arith.add v603, v971 : i32 #[overflow = wrapping]; + v711 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v712 = hir.bitcast v711 : ptr; + hir.store v712, v710; builtin.ret ; }; - private builtin.function @::deallocate(v921: i32, v922: i32, v923: i32) { - ^block94(v921: i32, v922: i32, v923: i32): - v1440 = arith.constant 0 : i32; - v924 = arith.constant 0 : i32; - v925 = arith.eq v923, v924 : i1; - v926 = arith.zext v925 : u32; - v927 = hir.bitcast v926 : i32; - v929 = arith.neq v927, v1440 : i1; - scf.if v929{ - ^block96: - scf.yield ; - } else { - ^block97: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_dealloc(v921, v923, v922) - scf.yield ; - }; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v930: i32, v931: i32, v932: i32) { - ^block98(v930: i32, v931: i32, v932: i32): - ub.unreachable ; - }; - - private builtin.function @alloc::alloc::handle_alloc_error(v933: i32, v934: i32) { - ^block100(v933: i32, v934: i32): + private builtin.function @alloc::raw_vec::handle_error(v713: i32, v714: i32, v715: i32) { + ^block74(v713: i32, v714: i32, v715: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v935: i32, v936: i32) -> i32 { - ^block102(v935: i32, v936: i32): - v943 = arith.constant 0 : i32; - v939 = hir.bitcast v936 : u32; - v938 = hir.bitcast v935 : u32; - v940 = arith.gt v938, v939 : i1; - v941 = arith.zext v940 : u32; - v942 = hir.bitcast v941 : i32; - v944 = arith.neq v942, v943 : i1; - v945 = cf.select v944, v935, v936 : i32; - builtin.ret v945; + private builtin.function @core::ptr::alignment::Alignment::max(v716: i32, v717: i32) -> i32 { + ^block76(v716: i32, v717: i32): + v724 = arith.constant 0 : i32; + v720 = hir.bitcast v717 : u32; + v719 = hir.bitcast v716 : u32; + v721 = arith.gt v719, v720 : i1; + v722 = arith.zext v721 : u32; + v723 = hir.bitcast v722 : i32; + v725 = arith.neq v723, v724 : i1; + v726 = cf.select v725, v716, v717 : i32; + builtin.ret v726; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.masm b/felt-repr/tests/expected/onchain_two_felts_struct.masm index e20a43583..102a7fbf7 100644 --- a/felt-repr/tests/expected/onchain_two_felts_struct.masm +++ b/felt-repr/tests/expected/onchain_two_felts_struct.masm @@ -20,119 +20,6 @@ end # mod root_ns:root@1.0.0::onchain_two_felts_struct -@callconv("C") -proc core::ptr::drop_in_place>( - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - push.8 - dup.2 - u32wrapping_add - dup.1 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::deallocate - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - @callconv("C") proc alloc::vec::Vec::push(i32, felt) push.8 @@ -355,535 +242,34 @@ proc alloc::raw_vec::RawVec::grow_one(i32) trace.252 nop push.0 - assert - end -end - -@callconv("C") -proc alloc::alloc::exchange_malloc( - -) -> i32 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.4 - dup.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_alloc - trace.252 - nop - push.0 - dup.1 - neq - if.true - nop - else - drop - push.4 - dup.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::handle_alloc_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc - trace.252 - nop -end - -@callconv("C") -pub proc entrypoint(i32, i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - push.4 - movup.2 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::exchange_malloc - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.4 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - movup.2 - swap.3 - movdn.2 - swap.1 - push.1 - while.true - dup.0 - dup.2 - u32wrapping_add - push.0 - push.4 - dup.4 - eq - neq - dup.0 - if.true - movup.3 - drop - push.3735929054 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - end - push.3735929054 - dup.2 - dup.8 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.8 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.8 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.8 - movdn.2 - cdrop - push.1 - push.0 - movup.6 - cdrop - push.1 - u32and - movup.3 - swap.5 - swap.9 - swap.8 - swap.7 - swap.6 - movdn.3 - movup.2 - swap.4 - movdn.2 - if.true - movup.5 - drop - movup.5 - drop - movup.5 - drop - movup.5 - drop - push.1 - else - push.0 - end - end - drop - drop - drop - drop - drop - push.20 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.1 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::core::ptr::drop_in_place> - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::exchange_malloc - trace.252 - nop - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.28 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.4 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.24 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - push.1 - while.true - dup.0 - dup.2 - u32wrapping_add - push.0 - push.4 - dup.4 - eq - neq - dup.0 - if.true - movup.3 - drop - push.3735929054 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - movup.4 - u32wrapping_add - end - push.3735929054 - dup.2 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.3 - dup.7 - swap.2 - swap.1 - cdrop - push.3735929054 - dup.4 - movup.2 - swap.7 - movdn.2 - cdrop - push.1 - push.0 - movup.5 - cdrop - push.1 - u32and - movup.2 - swap.4 - swap.7 - swap.6 - swap.5 - swap.3 - movdn.2 - if.true - movup.4 - drop - movup.4 - drop - movup.4 - drop - push.1 - else - push.0 - end + assert end - drop - drop - drop - drop - push.20 +end + +@callconv("C") +pub proc entrypoint(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.3 add u32assert push.4 @@ -892,7 +278,40 @@ pub proc entrypoint(i32, i32) u32mod u32assert assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + push.4 + dup.4 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 swap.1 u32divmod.4 swap.1 @@ -901,19 +320,46 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.16 + push.4 + dup.4 + add + u32assert + push.4 dup.1 - u32wrapping_add + swap.1 + u32mod + u32assert + assertz + push.0 + push.4 + movup.2 + u32divmod.4 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::core::ptr::drop_in_place> + exec.::intrinsics::mem::store_dw trace.252 nop - push.8 push.4 - dup.2 + dup.4 u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.3 u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push + trace.252 + nop push.4 dup.1 swap.1 @@ -974,7 +420,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_dw trace.252 nop - push.32 + push.16 u32wrapping_add push.1114144 u32divmod.4 @@ -987,10 +433,15 @@ pub proc entrypoint(i32, i32) end @callconv("C") -proc __rustc::__rust_dealloc(i32, i32, i32) - drop - drop - drop +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop end @callconv("C") @@ -1759,123 +1210,6 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( nop end -@callconv("C") -proc alloc::raw_vec::RawVecInner::deallocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - u32wrapping_add - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - else - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - movdn.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::deallocate - trace.252 - nop - end - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - @callconv("C") proc ::allocate( i32, @@ -2505,32 +1839,6 @@ proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) nop end -@callconv("C") -proc ::deallocate( - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - drop - drop - drop - else - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_dealloc - trace.252 - nop - end -end - @callconv("C") proc alloc::raw_vec::handle_error(i32, i32, i32) drop @@ -2540,14 +1848,6 @@ proc alloc::raw_vec::handle_error(i32, i32, i32) assert end -@callconv("C") -proc alloc::alloc::handle_alloc_error(i32, i32) - drop - drop - push.0 - assert -end - @callconv("C") proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 push.0 diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.wat b/felt-repr/tests/expected/onchain_two_felts_struct.wat index e67e1e1d1..d1884b2ba 100644 --- a/felt-repr/tests/expected/onchain_two_felts_struct.wat +++ b/felt-repr/tests/expected/onchain_two_felts_struct.wat @@ -1,14 +1,14 @@ (module $onchain_two_felts_struct.wasm - (type (;0;) (func (param i32))) - (type (;1;) (func (param i32 f32))) - (type (;2;) (func (result i32))) + (type (;0;) (func (param i32 f32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32))) (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32))) - (type (;5;) (func (param i32 i32 i32))) - (type (;6;) (func (param i32 i32 i32 i32) (result i32))) - (type (;7;) (func)) - (type (;8;) (func (param i32 i32 i32) (result i32))) - (type (;9;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func)) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (result i32))) + (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32))) (type (;10;) (func (param i32 i32 i32 i32))) (type (;11;) (func (param i32 i32 i32 i32 i32))) (table (;0;) 1 1 funcref) @@ -16,33 +16,7 @@ (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) (export "memory" (memory 0)) (export "entrypoint" (func $entrypoint)) - (func $core::ptr::drop_in_place> (;0;) (type 0) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - local.get 0 - i32.load - i32.store offset=12 - local.get 1 - local.get 0 - i32.load offset=8 - i32.store offset=8 - local.get 1 - i32.const 8 - i32.add - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::deallocate - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::vec::Vec::push (;1;) (type 1) (param i32 f32) + (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) (local i32) block ;; label = @1 local.get 0 @@ -69,7 +43,7 @@ i32.add i32.store offset=8 ) - (func $alloc::raw_vec::RawVec::grow_one (;2;) (type 0) (param i32) + (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -105,32 +79,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::exchange_malloc (;3;) (type 2) (result i32) - (local i32) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @1 - i32.const 4 - i32.const 4 - call $__rustc::__rust_alloc - local.tee 0 - br_if 0 (;@1;) - i32.const 4 - i32.const 4 - call $alloc::alloc::handle_alloc_error - unreachable - end - local.get 0 - ) - (func $__rustc::__rust_alloc (;4;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $entrypoint (;5;) (type 4) (param i32 i32) - (local i32 f32 f32 i32 i32) + (func $entrypoint (;2;) (type 2) (param i32 i32) + (local i32 f32 f32) global.get $__stack_pointer - i32.const 32 + i32.const 16 i32.sub local.tee 2 global.set $__stack_pointer @@ -140,114 +92,31 @@ local.get 1 f32.load local.set 4 - i32.const 0 - local.set 1 local.get 2 + i32.const 4 + i32.add + i32.const 8 + i32.add + local.tee 1 i32.const 0 - i32.store offset=12 + i32.store local.get 2 i64.const 17179869184 i64.store offset=4 align=4 - call $alloc::alloc::exchange_malloc - local.tee 5 - local.get 4 - f32.store local.get 2 - local.get 5 i32.const 4 i32.add - i32.store offset=28 - local.get 2 - i32.const 1 - i32.store offset=24 - local.get 2 - local.get 5 - i32.store offset=16 - block ;; label = @1 - loop ;; label = @2 - local.get 5 - local.get 1 - i32.add - local.set 6 - local.get 1 - i32.const 4 - i32.eq - br_if 1 (;@1;) - local.get 2 - i32.const 4 - i32.add - local.get 6 - f32.load - call $alloc::vec::Vec::push - local.get 1 - i32.const 4 - i32.add - local.set 1 - br 0 (;@2;) - end - end - local.get 2 - local.get 6 - i32.store offset=20 - local.get 2 - i32.const 16 - i32.add - call $core::ptr::drop_in_place> - call $alloc::alloc::exchange_malloc - local.tee 5 - local.get 3 - f32.store + local.get 4 + call $alloc::vec::Vec::push local.get 2 - local.get 5 i32.const 4 i32.add - i32.store offset=28 - local.get 2 - i32.const 1 - i32.store offset=24 - local.get 2 - local.get 5 - i32.store offset=16 - i32.const 0 - local.set 1 - block ;; label = @1 - loop ;; label = @2 - local.get 5 - local.get 1 - i32.add - local.set 6 - local.get 1 - i32.const 4 - i32.eq - br_if 1 (;@1;) - local.get 2 - i32.const 4 - i32.add - local.get 6 - f32.load - call $alloc::vec::Vec::push - local.get 1 - i32.const 4 - i32.add - local.set 1 - br 0 (;@2;) - end - end - local.get 2 - local.get 6 - i32.store offset=20 - local.get 2 - i32.const 16 - i32.add - call $core::ptr::drop_in_place> + local.get 3 + call $alloc::vec::Vec::push local.get 0 i32.const 8 i32.add - local.get 2 - i32.const 4 - i32.add - i32.const 8 - i32.add + local.get 1 i32.load i32.store local.get 0 @@ -255,12 +124,17 @@ i64.load offset=4 align=4 i64.store align=4 local.get 2 - i32.const 32 + i32.const 16 i32.add global.set $__stack_pointer ) - (func $__rustc::__rust_dealloc (;6;) (type 5) (param i32 i32 i32)) - (func $__rustc::__rust_realloc (;7;) (type 6) (param i32 i32 i32 i32) (result i32) + (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) block ;; label = @1 i32.const 1048604 local.get 2 @@ -285,7 +159,7 @@ end local.get 2 ) - (func $__rustc::__rust_alloc_zeroed (;8;) (type 3) (param i32 i32) (result i32) + (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) block ;; label = @1 i32.const 1048604 local.get 1 @@ -304,10 +178,10 @@ end local.get 1 ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;9;) (type 7) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) return ) - (func $::alloc (;10;) (type 8) (param i32 i32 i32) (result i32) + (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) (local i32 i32) block ;; label = @1 local.get 1 @@ -379,10 +253,10 @@ end unreachable ) - (func $intrinsics::mem::heap_base (;11;) (type 2) (result i32) + (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;12;) (type 9) (param i32 i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) (local i32 i32 i32 i64) global.get $__stack_pointer i32.const 32 @@ -510,39 +384,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::deallocate (;13;) (type 5) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 4 - i32.add - local.get 0 - local.get 1 - local.get 2 - call $alloc::raw_vec::RawVecInner::current_memory - block ;; label = @1 - local.get 3 - i32.load offset=8 - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - i32.load offset=4 - local.get 2 - local.get 3 - i32.load offset=12 - call $::deallocate - end - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;14;) (type 5) (param i32 i32 i32) + (func $::allocate (;10;) (type 9) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -571,7 +413,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;15;) (type 10) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;11;) (type 10) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -598,7 +440,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;16;) (type 10) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;12;) (type 10) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -633,7 +475,7 @@ local.get 4 i32.store ) - (func $alloc::raw_vec::finish_grow (;17;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::finish_grow (;13;) (type 11) (param i32 i32 i32 i32 i32) (local i32 i32) global.get $__stack_pointer i32.const 16 @@ -732,24 +574,10 @@ i32.add global.set $__stack_pointer ) - (func $::deallocate (;18;) (type 5) (param i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - local.get 1 - call $__rustc::__rust_dealloc - end - ) - (func $alloc::raw_vec::handle_error (;19;) (type 5) (param i32 i32 i32) - unreachable - ) - (func $alloc::alloc::handle_alloc_error (;20;) (type 4) (param i32 i32) + (func $alloc::raw_vec::handle_error (;14;) (type 9) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;21;) (type 3) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;15;) (type 3) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index 6755c7b40..fda404a9a 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -191,9 +191,8 @@ fn four_felts_struct_round_trip() { let _package = test.compiled_package(); } -/// Test struct serialization with 5 Felt fields - triggers spills issue. +/// Test struct serialization with 5 Felt fields. #[test] -#[should_panic(expected = "not yet implemented")] fn five_felts_struct_round_trip() { let onchain_code = r#"(input: [Felt; 5]) -> Vec { use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; @@ -214,8 +213,12 @@ fn five_felts_struct_round_trip() { }"#; let config = WasmTranslationConfig::default(); - let mut test = build_felt_repr_test("onchain_five_felts_struct", onchain_code, config); + let artifact_name = "onchain_five_felts_struct"; + let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + + test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); - // This will panic with "not yet implemented" due to spills issue let _package = test.compiled_package(); } From ba60fd685477b9893e6af073cd47dcd85b8060f0 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 9 Dec 2025 10:00:05 +0200 Subject: [PATCH 09/15] test: add failing test for 5-felt struct felt-rept super roundtrip --- .../expected/onchain_five_felts_struct.hir | 1527 ++++++------- .../expected/onchain_five_felts_struct.masm | 46 +- .../expected/onchain_five_felts_struct.wat | 55 +- .../expected/onchain_four_felts_struct.hir | 1001 --------- .../expected/onchain_four_felts_struct.masm | 1915 ----------------- .../expected/onchain_four_felts_struct.wat | 605 ------ felt-repr/tests/src/onchain.rs | 124 +- 7 files changed, 932 insertions(+), 4341 deletions(-) delete mode 100644 felt-repr/tests/expected/onchain_four_felts_struct.hir delete mode 100644 felt-repr/tests/expected/onchain_four_felts_struct.masm delete mode 100644 felt-repr/tests/expected/onchain_four_felts_struct.wat diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.hir b/felt-repr/tests/expected/onchain_five_felts_struct.hir index 1dcd2dd8e..90b2cb556 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.hir +++ b/felt-repr/tests/expected/onchain_five_felts_struct.hir @@ -11,8 +11,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : i32; v10 = hir.bitcast v0 : u32; - v764 = arith.constant 4 : u32; - v12 = arith.mod v10, v764 : u32; + v771 = arith.constant 4 : u32; + v12 = arith.mod v10, v771 : u32; hir.assertz v12 #[code = 250]; v13 = hir.int_to_ptr v10 : ptr; v14 = hir.load v13 : i32; @@ -22,35 +22,35 @@ builtin.component root_ns:root@1.0.0 { v17 = hir.bitcast v16 : i32; v19 = arith.neq v17, v2 : i1; scf.if v19{ - ^block78: + ^block82: scf.yield ; } else { ^block7: hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) scf.yield ; }; - v763 = arith.constant 4 : u32; + v770 = arith.constant 4 : u32; v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v763 : u32 #[overflow = checked]; - v762 = arith.constant 4 : u32; - v25 = arith.mod v23, v762 : u32; + v23 = arith.add v21, v770 : u32 #[overflow = checked]; + v769 = arith.constant 4 : u32; + v25 = arith.mod v23, v769 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v754 = arith.constant 2 : u32; - v31 = arith.shl v9, v754 : i32; + v761 = arith.constant 2 : u32; + v31 = arith.shl v9, v761 : i32; v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; v34 = hir.bitcast v32 : u32; - v761 = arith.constant 4 : u32; - v36 = arith.mod v34, v761 : u32; + v768 = arith.constant 4 : u32; + v36 = arith.mod v34, v768 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v1; - v760 = arith.constant 8 : u32; + v767 = arith.constant 8 : u32; v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v760 : u32 #[overflow = checked]; - v759 = arith.constant 4 : u32; - v44 = arith.mod v42, v759 : u32; + v42 = arith.add v40, v767 : u32 #[overflow = checked]; + v766 = arith.constant 4 : u32; + v44 = arith.mod v42, v766 : u32; hir.assertz v44 #[code = 250]; v38 = arith.constant 1 : i32; v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; @@ -83,8 +83,8 @@ builtin.component root_ns:root@1.0.0 { v66 = arith.constant 8 : u32; v65 = hir.bitcast v52 : u32; v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v768 = arith.constant 4 : u32; - v69 = arith.mod v67, v768 : u32; + v775 = arith.constant 4 : u32; + v69 = arith.mod v67, v775 : u32; hir.assertz v69 #[code = 250]; v70 = hir.int_to_ptr v67 : ptr; v71 = hir.load v70 : i32; @@ -96,8 +96,8 @@ builtin.component root_ns:root@1.0.0 { v77 = arith.neq v75, v47 : i1; cf.cond_br v77 ^block10, ^block11; ^block10: - v767 = arith.constant 16 : i32; - v87 = arith.add v52, v767 : i32 #[overflow = wrapping]; + v774 = arith.constant 16 : i32; + v87 = arith.add v52, v774 : i32 #[overflow = wrapping]; v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr v89 = hir.bitcast v88 : ptr; hir.store v89, v87; @@ -106,8 +106,8 @@ builtin.component root_ns:root@1.0.0 { v79 = arith.constant 12 : u32; v78 = hir.bitcast v52 : u32; v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v766 = arith.constant 4 : u32; - v82 = arith.mod v80, v766 : u32; + v773 = arith.constant 4 : u32; + v82 = arith.mod v80, v773 : u32; hir.assertz v82 #[code = 250]; v83 = hir.int_to_ptr v80 : ptr; v84 = hir.load v83 : i32; @@ -126,7 +126,7 @@ builtin.component root_ns:root@1.0.0 { v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr v100 = hir.bitcast v99 : ptr; hir.store v100, v98; - v102 = arith.constant 16 : u32; + v102 = arith.constant 12 : u32; v101 = hir.bitcast v91 : u32; v103 = arith.add v101, v102 : u32 #[overflow = checked]; v104 = arith.constant 4 : u32; @@ -134,197 +134,200 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v105 #[code = 250]; v106 = hir.int_to_ptr v103 : ptr; v107 = hir.load v106 : felt; - v109 = arith.constant 12 : u32; + v109 = arith.constant 8 : u32; v108 = hir.bitcast v91 : u32; v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v788 = arith.constant 4 : u32; - v112 = arith.mod v110, v788 : u32; + v795 = arith.constant 4 : u32; + v112 = arith.mod v110, v795 : u32; hir.assertz v112 #[code = 250]; v113 = hir.int_to_ptr v110 : ptr; v114 = hir.load v113 : felt; - v116 = arith.constant 8 : u32; + v794 = arith.constant 4 : u32; v115 = hir.bitcast v91 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v787 = arith.constant 4 : u32; - v119 = arith.mod v117, v787 : u32; + v117 = arith.add v115, v794 : u32 #[overflow = checked]; + v793 = arith.constant 4 : u32; + v119 = arith.mod v117, v793 : u32; hir.assertz v119 #[code = 250]; v120 = hir.int_to_ptr v117 : ptr; v121 = hir.load v120 : felt; - v786 = arith.constant 4 : u32; v122 = hir.bitcast v91 : u32; - v124 = arith.add v122, v786 : u32 #[overflow = checked]; - v785 = arith.constant 4 : u32; - v126 = arith.mod v124, v785 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - v128 = hir.load v127 : felt; - v129 = hir.bitcast v91 : u32; - v784 = arith.constant 4 : u32; - v131 = arith.mod v129, v784 : u32; + v792 = arith.constant 4 : u32; + v124 = arith.mod v122, v792 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + v128 = arith.constant 16 : u32; + v127 = hir.bitcast v91 : u32; + v129 = arith.add v127, v128 : u32 #[overflow = checked]; + v791 = arith.constant 4 : u32; + v131 = arith.mod v129, v791 : u32; hir.assertz v131 #[code = 250]; v132 = hir.int_to_ptr v129 : ptr; v133 = hir.load v132 : felt; - v136 = arith.constant 8 : i32; - v134 = arith.constant 4 : i32; - v135 = arith.add v98, v134 : i32 #[overflow = wrapping]; - v137 = arith.add v135, v136 : i32 #[overflow = wrapping]; - v139 = hir.bitcast v137 : u32; - v783 = arith.constant 4 : u32; - v141 = arith.mod v139, v783 : u32; - hir.assertz v141 #[code = 250]; + v134 = arith.constant 55555 : i32; + v135 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::from_u32(v134) : felt + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::assert_eq(v133, v135) + v138 = arith.constant 8 : i32; + v136 = arith.constant 4 : i32; + v137 = arith.add v98, v136 : i32 #[overflow = wrapping]; + v139 = arith.add v137, v138 : i32 #[overflow = wrapping]; + v141 = hir.bitcast v139 : u32; + v790 = arith.constant 4 : u32; + v143 = arith.mod v141, v790 : u32; + hir.assertz v143 #[code = 250]; v92 = arith.constant 0 : i32; - v142 = hir.int_to_ptr v139 : ptr; - hir.store v142, v92; - v782 = arith.constant 4 : u32; - v144 = hir.bitcast v98 : u32; - v146 = arith.add v144, v782 : u32 #[overflow = checked]; - v781 = arith.constant 4 : u32; - v148 = arith.mod v146, v781 : u32; - hir.assertz v148 #[code = 250]; - v143 = arith.constant 17179869184 : i64; - v149 = hir.int_to_ptr v146 : ptr; - hir.store v149, v143; - v780 = arith.constant 4 : i32; - v151 = arith.add v98, v780 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v151, v133) - v779 = arith.constant 4 : i32; - v153 = arith.add v98, v779 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v153, v128) - v778 = arith.constant 4 : i32; - v155 = arith.add v98, v778 : i32 #[overflow = wrapping]; + v144 = hir.int_to_ptr v141 : ptr; + hir.store v144, v92; + v789 = arith.constant 4 : u32; + v146 = hir.bitcast v98 : u32; + v148 = arith.add v146, v789 : u32 #[overflow = checked]; + v788 = arith.constant 4 : u32; + v150 = arith.mod v148, v788 : u32; + hir.assertz v150 #[code = 250]; + v145 = arith.constant 17179869184 : i64; + v151 = hir.int_to_ptr v148 : ptr; + hir.store v151, v145; + v787 = arith.constant 4 : i32; + v153 = arith.add v98, v787 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v153, v126) + v786 = arith.constant 4 : i32; + v155 = arith.add v98, v786 : i32 #[overflow = wrapping]; hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v155, v121) - v777 = arith.constant 4 : i32; - v157 = arith.add v98, v777 : i32 #[overflow = wrapping]; + v785 = arith.constant 4 : i32; + v157 = arith.add v98, v785 : i32 #[overflow = wrapping]; hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v157, v114) - v776 = arith.constant 4 : i32; - v159 = arith.add v98, v776 : i32 #[overflow = wrapping]; + v784 = arith.constant 4 : i32; + v159 = arith.add v98, v784 : i32 #[overflow = wrapping]; hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v159, v107) - v162 = hir.bitcast v137 : u32; - v775 = arith.constant 4 : u32; - v164 = arith.mod v162, v775 : u32; - hir.assertz v164 #[code = 250]; - v165 = hir.int_to_ptr v162 : ptr; - v166 = hir.load v165 : i32; - v774 = arith.constant 8 : i32; - v161 = arith.add v90, v774 : i32 #[overflow = wrapping]; - v167 = hir.bitcast v161 : u32; - v773 = arith.constant 4 : u32; - v169 = arith.mod v167, v773 : u32; - hir.assertz v169 #[code = 250]; - v170 = hir.int_to_ptr v167 : ptr; - hir.store v170, v166; - v772 = arith.constant 4 : u32; - v171 = hir.bitcast v98 : u32; - v173 = arith.add v171, v772 : u32 #[overflow = checked]; - v771 = arith.constant 4 : u32; - v175 = arith.mod v173, v771 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i64; - v178 = hir.bitcast v90 : u32; - v770 = arith.constant 4 : u32; - v180 = arith.mod v178, v770 : u32; - hir.assertz v180 #[code = 250]; - v181 = hir.int_to_ptr v178 : ptr; - hir.store v181, v177; - v769 = arith.constant 16 : i32; - v183 = arith.add v98, v769 : i32 #[overflow = wrapping]; - v184 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v185 = hir.bitcast v184 : ptr; - hir.store v185, v183; + v783 = arith.constant 4 : i32; + v161 = arith.add v98, v783 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v161, v133) + v164 = hir.bitcast v139 : u32; + v782 = arith.constant 4 : u32; + v166 = arith.mod v164, v782 : u32; + hir.assertz v166 #[code = 250]; + v167 = hir.int_to_ptr v164 : ptr; + v168 = hir.load v167 : i32; + v781 = arith.constant 8 : i32; + v163 = arith.add v90, v781 : i32 #[overflow = wrapping]; + v169 = hir.bitcast v163 : u32; + v780 = arith.constant 4 : u32; + v171 = arith.mod v169, v780 : u32; + hir.assertz v171 #[code = 250]; + v172 = hir.int_to_ptr v169 : ptr; + hir.store v172, v168; + v779 = arith.constant 4 : u32; + v173 = hir.bitcast v98 : u32; + v175 = arith.add v173, v779 : u32 #[overflow = checked]; + v778 = arith.constant 4 : u32; + v177 = arith.mod v175, v778 : u32; + hir.assertz v177 #[code = 250]; + v178 = hir.int_to_ptr v175 : ptr; + v179 = hir.load v178 : i64; + v180 = hir.bitcast v90 : u32; + v777 = arith.constant 4 : u32; + v182 = arith.mod v180, v777 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + hir.store v183, v179; + v776 = arith.constant 16 : i32; + v185 = arith.add v98, v776 : i32 #[overflow = wrapping]; + v186 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v187 = hir.bitcast v186 : ptr; + hir.store v187, v185; builtin.ret ; }; - private builtin.function @__rustc::__rust_alloc(v186: i32, v187: i32) -> i32 { - ^block14(v186: i32, v187: i32): - v189 = arith.constant 1048604 : i32; - v190 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v189, v187, v186) : i32 - builtin.ret v190; + private builtin.function @__rustc::__rust_alloc(v188: i32, v189: i32) -> i32 { + ^block14(v188: i32, v189: i32): + v191 = arith.constant 1048604 : i32; + v192 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v191, v189, v188) : i32 + builtin.ret v192; }; - private builtin.function @__rustc::__rust_realloc(v191: i32, v192: i32, v193: i32, v194: i32) -> i32 { - ^block16(v191: i32, v192: i32, v193: i32, v194: i32): - v196 = arith.constant 1048604 : i32; - v197 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v196, v193, v194) : i32 - v797 = arith.constant 0 : i32; - v198 = arith.constant 0 : i32; - v199 = arith.eq v197, v198 : i1; - v200 = arith.zext v199 : u32; - v201 = hir.bitcast v200 : i32; - v203 = arith.neq v201, v797 : i1; - scf.if v203{ + private builtin.function @__rustc::__rust_realloc(v193: i32, v194: i32, v195: i32, v196: i32) -> i32 { + ^block16(v193: i32, v194: i32, v195: i32, v196: i32): + v198 = arith.constant 1048604 : i32; + v199 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v198, v195, v196) : i32 + v804 = arith.constant 0 : i32; + v200 = arith.constant 0 : i32; + v201 = arith.eq v199, v200 : i1; + v202 = arith.zext v201 : u32; + v203 = hir.bitcast v202 : i32; + v205 = arith.neq v203, v804 : i1; + scf.if v205{ ^block18: scf.yield ; } else { ^block19: - v796 = arith.constant 0 : i32; - v205 = hir.bitcast v192 : u32; - v204 = hir.bitcast v194 : u32; - v206 = arith.lt v204, v205 : i1; - v207 = arith.zext v206 : u32; - v208 = hir.bitcast v207 : i32; - v210 = arith.neq v208, v796 : i1; - v211 = cf.select v210, v194, v192 : i32; - v794 = arith.constant 0 : i32; - v795 = arith.constant 0 : i32; - v213 = arith.eq v211, v795 : i1; - v214 = arith.zext v213 : u32; - v215 = hir.bitcast v214 : i32; - v217 = arith.neq v215, v794 : i1; - scf.if v217{ - ^block82: + v803 = arith.constant 0 : i32; + v207 = hir.bitcast v194 : u32; + v206 = hir.bitcast v196 : u32; + v208 = arith.lt v206, v207 : i1; + v209 = arith.zext v208 : u32; + v210 = hir.bitcast v209 : i32; + v212 = arith.neq v210, v803 : i1; + v213 = cf.select v212, v196, v194 : i32; + v801 = arith.constant 0 : i32; + v802 = arith.constant 0 : i32; + v215 = arith.eq v213, v802 : i1; + v216 = arith.zext v215 : u32; + v217 = hir.bitcast v216 : i32; + v219 = arith.neq v217, v801 : i1; + scf.if v219{ + ^block86: scf.yield ; } else { ^block20: - v218 = hir.bitcast v211 : u32; - v219 = hir.bitcast v197 : u32; - v220 = hir.int_to_ptr v219 : ptr; - v221 = hir.bitcast v191 : u32; + v220 = hir.bitcast v213 : u32; + v221 = hir.bitcast v199 : u32; v222 = hir.int_to_ptr v221 : ptr; - hir.mem_cpy v222, v220, v218; + v223 = hir.bitcast v193 : u32; + v224 = hir.int_to_ptr v223 : ptr; + hir.mem_cpy v224, v222, v220; scf.yield ; }; scf.yield ; }; - builtin.ret v197; + builtin.ret v199; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v224: i32, v225: i32) -> i32 { - ^block21(v224: i32, v225: i32): - v227 = arith.constant 1048604 : i32; - v228 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v227, v225, v224) : i32 - v806 = arith.constant 0 : i32; - v229 = arith.constant 0 : i32; - v230 = arith.eq v228, v229 : i1; - v231 = arith.zext v230 : u32; - v232 = hir.bitcast v231 : i32; - v234 = arith.neq v232, v806 : i1; - scf.if v234{ + private builtin.function @__rustc::__rust_alloc_zeroed(v226: i32, v227: i32) -> i32 { + ^block21(v226: i32, v227: i32): + v229 = arith.constant 1048604 : i32; + v230 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v229, v227, v226) : i32 + v813 = arith.constant 0 : i32; + v231 = arith.constant 0 : i32; + v232 = arith.eq v230, v231 : i1; + v233 = arith.zext v232 : u32; + v234 = hir.bitcast v233 : i32; + v236 = arith.neq v234, v813 : i1; + scf.if v236{ ^block23: scf.yield ; } else { ^block24: - v804 = arith.constant 0 : i32; - v805 = arith.constant 0 : i32; - v236 = arith.eq v224, v805 : i1; - v237 = arith.zext v236 : u32; - v238 = hir.bitcast v237 : i32; - v240 = arith.neq v238, v804 : i1; - scf.if v240{ - ^block85: + v811 = arith.constant 0 : i32; + v812 = arith.constant 0 : i32; + v238 = arith.eq v226, v812 : i1; + v239 = arith.zext v238 : u32; + v240 = hir.bitcast v239 : i32; + v242 = arith.neq v240, v811 : i1; + scf.if v242{ + ^block89: scf.yield ; } else { ^block25: - v798 = arith.constant 0 : u8; - v243 = hir.bitcast v224 : u32; - v244 = hir.bitcast v228 : u32; - v245 = hir.int_to_ptr v244 : ptr; - hir.mem_set v245, v243, v798; + v805 = arith.constant 0 : u8; + v245 = hir.bitcast v226 : u32; + v246 = hir.bitcast v230 : u32; + v247 = hir.int_to_ptr v246 : ptr; + hir.mem_set v247, v245, v805; scf.yield ; }; scf.yield ; }; - builtin.ret v228; + builtin.ret v230; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -332,675 +335,687 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v247: i32, v248: i32, v249: i32) -> i32 { - ^block28(v247: i32, v248: i32, v249: i32): - v252 = arith.constant 16 : i32; - v251 = arith.constant 0 : i32; - v808 = arith.constant 16 : u32; - v254 = hir.bitcast v248 : u32; - v256 = arith.gt v254, v808 : i1; - v257 = arith.zext v256 : u32; - v258 = hir.bitcast v257 : i32; - v260 = arith.neq v258, v251 : i1; - v261 = cf.select v260, v248, v252 : i32; - v848 = arith.constant 0 : i32; - v262 = arith.constant -1 : i32; - v263 = arith.add v261, v262 : i32 #[overflow = wrapping]; - v264 = arith.band v261, v263 : i32; - v266 = arith.neq v264, v848 : i1; - v817, v818 = scf.if v266 : i32, u32 { - ^block90: - v809 = arith.constant 0 : u32; - v813 = ub.poison i32 : i32; - scf.yield v813, v809; + private builtin.function @::alloc(v249: i32, v250: i32, v251: i32) -> i32 { + ^block28(v249: i32, v250: i32, v251: i32): + v254 = arith.constant 16 : i32; + v253 = arith.constant 0 : i32; + v815 = arith.constant 16 : u32; + v256 = hir.bitcast v250 : u32; + v258 = arith.gt v256, v815 : i1; + v259 = arith.zext v258 : u32; + v260 = hir.bitcast v259 : i32; + v262 = arith.neq v260, v253 : i1; + v263 = cf.select v262, v250, v254 : i32; + v855 = arith.constant 0 : i32; + v264 = arith.constant -1 : i32; + v265 = arith.add v263, v264 : i32 #[overflow = wrapping]; + v266 = arith.band v263, v265 : i32; + v268 = arith.neq v266, v855 : i1; + v824, v825 = scf.if v268 : i32, u32 { + ^block94: + v816 = arith.constant 0 : u32; + v820 = ub.poison i32 : i32; + scf.yield v820, v816; } else { ^block31: - v268 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v248, v261) : i32 - v847 = arith.constant 0 : i32; - v267 = arith.constant -2147483648 : i32; - v269 = arith.sub v267, v268 : i32 #[overflow = wrapping]; - v271 = hir.bitcast v269 : u32; - v270 = hir.bitcast v249 : u32; - v272 = arith.gt v270, v271 : i1; - v273 = arith.zext v272 : u32; - v274 = hir.bitcast v273 : i32; - v276 = arith.neq v274, v847 : i1; - v832 = scf.if v276 : i32 { - ^block89: - v846 = ub.poison i32 : i32; - scf.yield v846; + v270 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v250, v263) : i32 + v854 = arith.constant 0 : i32; + v269 = arith.constant -2147483648 : i32; + v271 = arith.sub v269, v270 : i32 #[overflow = wrapping]; + v273 = hir.bitcast v271 : u32; + v272 = hir.bitcast v251 : u32; + v274 = arith.gt v272, v273 : i1; + v275 = arith.zext v274 : u32; + v276 = hir.bitcast v275 : i32; + v278 = arith.neq v276, v854 : i1; + v839 = scf.if v278 : i32 { + ^block93: + v853 = ub.poison i32 : i32; + scf.yield v853; } else { ^block32: - v844 = arith.constant 0 : i32; - v282 = arith.sub v844, v268 : i32 #[overflow = wrapping]; - v845 = arith.constant -1 : i32; - v278 = arith.add v249, v268 : i32 #[overflow = wrapping]; - v280 = arith.add v278, v845 : i32 #[overflow = wrapping]; - v283 = arith.band v280, v282 : i32; - v284 = hir.bitcast v247 : u32; - v285 = arith.constant 4 : u32; - v286 = arith.mod v284, v285 : u32; - hir.assertz v286 #[code = 250]; - v287 = hir.int_to_ptr v284 : ptr; - v288 = hir.load v287 : i32; - v843 = arith.constant 0 : i32; - v290 = arith.neq v288, v843 : i1; - scf.if v290{ - ^block88: + v851 = arith.constant 0 : i32; + v284 = arith.sub v851, v270 : i32 #[overflow = wrapping]; + v852 = arith.constant -1 : i32; + v280 = arith.add v251, v270 : i32 #[overflow = wrapping]; + v282 = arith.add v280, v852 : i32 #[overflow = wrapping]; + v285 = arith.band v282, v284 : i32; + v286 = hir.bitcast v249 : u32; + v287 = arith.constant 4 : u32; + v288 = arith.mod v286, v287 : u32; + hir.assertz v288 #[code = 250]; + v289 = hir.int_to_ptr v286 : ptr; + v290 = hir.load v289 : i32; + v850 = arith.constant 0 : i32; + v292 = arith.neq v290, v850 : i1; + scf.if v292{ + ^block92: scf.yield ; } else { ^block34: - v291 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 - v292 = hir.mem_size : u32; - v298 = hir.bitcast v247 : u32; - v842 = arith.constant 4 : u32; - v300 = arith.mod v298, v842 : u32; - hir.assertz v300 #[code = 250]; - v841 = arith.constant 16 : u32; - v293 = hir.bitcast v292 : i32; - v296 = arith.shl v293, v841 : i32; - v297 = arith.add v291, v296 : i32 #[overflow = wrapping]; - v301 = hir.int_to_ptr v298 : ptr; - hir.store v301, v297; + v293 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 + v294 = hir.mem_size : u32; + v300 = hir.bitcast v249 : u32; + v849 = arith.constant 4 : u32; + v302 = arith.mod v300, v849 : u32; + hir.assertz v302 #[code = 250]; + v848 = arith.constant 16 : u32; + v295 = hir.bitcast v294 : i32; + v298 = arith.shl v295, v848 : i32; + v299 = arith.add v293, v298 : i32 #[overflow = wrapping]; + v303 = hir.int_to_ptr v300 : ptr; + hir.store v303, v299; scf.yield ; }; - v304 = hir.bitcast v247 : u32; - v840 = arith.constant 4 : u32; - v306 = arith.mod v304, v840 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - v308 = hir.load v307 : i32; - v838 = arith.constant 0 : i32; - v839 = arith.constant -1 : i32; - v310 = arith.bxor v308, v839 : i32; - v312 = hir.bitcast v310 : u32; - v311 = hir.bitcast v283 : u32; - v313 = arith.gt v311, v312 : i1; - v314 = arith.zext v313 : u32; - v315 = hir.bitcast v314 : i32; - v317 = arith.neq v315, v838 : i1; - v831 = scf.if v317 : i32 { + v306 = hir.bitcast v249 : u32; + v847 = arith.constant 4 : u32; + v308 = arith.mod v306, v847 : u32; + hir.assertz v308 #[code = 250]; + v309 = hir.int_to_ptr v306 : ptr; + v310 = hir.load v309 : i32; + v845 = arith.constant 0 : i32; + v846 = arith.constant -1 : i32; + v312 = arith.bxor v310, v846 : i32; + v314 = hir.bitcast v312 : u32; + v313 = hir.bitcast v285 : u32; + v315 = arith.gt v313, v314 : i1; + v316 = arith.zext v315 : u32; + v317 = hir.bitcast v316 : i32; + v319 = arith.neq v317, v845 : i1; + v838 = scf.if v319 : i32 { ^block35: - v837 = arith.constant 0 : i32; - scf.yield v837; + v844 = arith.constant 0 : i32; + scf.yield v844; } else { ^block36: - v319 = hir.bitcast v247 : u32; - v836 = arith.constant 4 : u32; - v321 = arith.mod v319, v836 : u32; - hir.assertz v321 #[code = 250]; - v318 = arith.add v308, v283 : i32 #[overflow = wrapping]; - v322 = hir.int_to_ptr v319 : ptr; - hir.store v322, v318; - v324 = arith.add v308, v268 : i32 #[overflow = wrapping]; - scf.yield v324; + v321 = hir.bitcast v249 : u32; + v843 = arith.constant 4 : u32; + v323 = arith.mod v321, v843 : u32; + hir.assertz v323 #[code = 250]; + v320 = arith.add v310, v285 : i32 #[overflow = wrapping]; + v324 = hir.int_to_ptr v321 : ptr; + hir.store v324, v320; + v326 = arith.add v310, v270 : i32 #[overflow = wrapping]; + scf.yield v326; }; - scf.yield v831; + scf.yield v838; }; - v814 = arith.constant 1 : u32; - v835 = arith.constant 0 : u32; - v833 = cf.select v276, v835, v814 : u32; - scf.yield v832, v833; + v821 = arith.constant 1 : u32; + v842 = arith.constant 0 : u32; + v840 = cf.select v278, v842, v821 : u32; + scf.yield v839, v840; }; - v834 = arith.constant 0 : u32; - v830 = arith.eq v818, v834 : i1; - cf.cond_br v830 ^block30, ^block92(v817); + v841 = arith.constant 0 : u32; + v837 = arith.eq v825, v841 : i1; + cf.cond_br v837 ^block30, ^block96(v824); ^block30: ub.unreachable ; - ^block92(v810: i32): - builtin.ret v810; + ^block96(v817: i32): + builtin.ret v817; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block37: - v327 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v327; + v329 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v329; }; - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v329: i32, v330: i32, v331: i32, v332: i32, v333: i32, v334: i32) { - ^block41(v329: i32, v330: i32, v331: i32, v332: i32, v333: i32, v334: i32): - v337 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v338 = hir.bitcast v337 : ptr; - v339 = hir.load v338 : i32; - v340 = arith.constant 32 : i32; - v341 = arith.sub v339, v340 : i32 #[overflow = wrapping]; - v342 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v343 = hir.bitcast v342 : ptr; - hir.store v343, v341; - v925 = arith.constant 0 : i32; - v335 = arith.constant 0 : i32; - v346 = arith.eq v334, v335 : i1; - v347 = arith.zext v346 : u32; - v348 = hir.bitcast v347 : i32; - v350 = arith.neq v348, v925 : i1; - v896, v897 = scf.if v350 : i32, i32 { - ^block44: - v924 = arith.constant 0 : i32; - scf.yield v924, v924; + private builtin.function @intrinsics::felt::from_u32(v331: i32) -> felt { + ^block41(v331: i32): + v332 = hir.bitcast v331 : felt; + builtin.ret v332; + }; + + private builtin.function @intrinsics::felt::assert_eq(v334: felt, v335: felt) { + ^block43(v334: felt, v335: felt): + hir.assert_eq v334, v335; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v336: i32, v337: i32, v338: i32, v339: i32, v340: i32, v341: i32) { + ^block45(v336: i32, v337: i32, v338: i32, v339: i32, v340: i32, v341: i32): + v344 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v345 = hir.bitcast v344 : ptr; + v346 = hir.load v345 : i32; + v347 = arith.constant 32 : i32; + v348 = arith.sub v346, v347 : i32 #[overflow = wrapping]; + v349 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v350 = hir.bitcast v349 : ptr; + hir.store v350, v348; + v932 = arith.constant 0 : i32; + v342 = arith.constant 0 : i32; + v353 = arith.eq v341, v342 : i1; + v354 = arith.zext v353 : u32; + v355 = hir.bitcast v354 : i32; + v357 = arith.neq v355, v932 : i1; + v903, v904 = scf.if v357 : i32, i32 { + ^block48: + v931 = arith.constant 0 : i32; + scf.yield v931, v931; } else { - ^block45: - v351 = arith.add v331, v332 : i32 #[overflow = wrapping]; - v923 = arith.constant 0 : i32; - v353 = hir.bitcast v331 : u32; - v352 = hir.bitcast v351 : u32; - v354 = arith.lt v352, v353 : i1; - v355 = arith.zext v354 : u32; - v356 = hir.bitcast v355 : i32; - v358 = arith.neq v356, v923 : i1; - v894, v895 = scf.if v358 : i32, i32 { - ^block98: - v922 = arith.constant 0 : i32; - scf.yield v922, v922; + ^block49: + v358 = arith.add v338, v339 : i32 #[overflow = wrapping]; + v930 = arith.constant 0 : i32; + v360 = hir.bitcast v338 : u32; + v359 = hir.bitcast v358 : u32; + v361 = arith.lt v359, v360 : i1; + v362 = arith.zext v361 : u32; + v363 = hir.bitcast v362 : i32; + v365 = arith.neq v363, v930 : i1; + v901, v902 = scf.if v365 : i32, i32 { + ^block102: + v929 = arith.constant 0 : i32; + scf.yield v929, v929; } else { - ^block46: - v369 = hir.bitcast v330 : u32; - v483 = arith.constant 4 : u32; - v371 = arith.mod v369, v483 : u32; - hir.assertz v371 #[code = 250]; - v372 = hir.int_to_ptr v369 : ptr; - v373 = hir.load v372 : i32; - v850 = arith.constant 1 : u32; - v376 = arith.shl v373, v850 : i32; - v921 = arith.constant 0 : i32; - v378 = hir.bitcast v376 : u32; - v377 = hir.bitcast v351 : u32; - v379 = arith.gt v377, v378 : i1; - v380 = arith.zext v379 : u32; - v381 = hir.bitcast v380 : i32; - v383 = arith.neq v381, v921 : i1; - v384 = cf.select v383, v351, v376 : i32; - v918 = arith.constant 1 : i32; - v386 = arith.constant 4 : i32; - v919 = arith.constant 0 : i32; - v849 = arith.constant 1025 : u32; - v389 = hir.bitcast v334 : u32; - v391 = arith.lt v389, v849 : i1; - v392 = arith.zext v391 : u32; - v393 = hir.bitcast v392 : i32; - v395 = arith.neq v393, v919 : i1; - v396 = cf.select v395, v386, v918 : i32; - v385 = arith.constant 8 : i32; - v920 = arith.constant 0 : i32; - v374 = arith.constant 1 : i32; - v398 = arith.eq v334, v374 : i1; + ^block50: + v376 = hir.bitcast v337 : u32; + v490 = arith.constant 4 : u32; + v378 = arith.mod v376, v490 : u32; + hir.assertz v378 #[code = 250]; + v379 = hir.int_to_ptr v376 : ptr; + v380 = hir.load v379 : i32; + v857 = arith.constant 1 : u32; + v383 = arith.shl v380, v857 : i32; + v928 = arith.constant 0 : i32; + v385 = hir.bitcast v383 : u32; + v384 = hir.bitcast v358 : u32; + v386 = arith.gt v384, v385 : i1; + v387 = arith.zext v386 : u32; + v388 = hir.bitcast v387 : i32; + v390 = arith.neq v388, v928 : i1; + v391 = cf.select v390, v358, v383 : i32; + v925 = arith.constant 1 : i32; + v393 = arith.constant 4 : i32; + v926 = arith.constant 0 : i32; + v856 = arith.constant 1025 : u32; + v396 = hir.bitcast v341 : u32; + v398 = arith.lt v396, v856 : i1; v399 = arith.zext v398 : u32; v400 = hir.bitcast v399 : i32; - v402 = arith.neq v400, v920 : i1; - v403 = cf.select v402, v385, v396 : i32; - v917 = arith.constant 0 : i32; - v405 = hir.bitcast v403 : u32; - v404 = hir.bitcast v384 : u32; - v406 = arith.gt v404, v405 : i1; - v407 = arith.zext v406 : u32; - v408 = hir.bitcast v407 : i32; - v410 = arith.neq v408, v917 : i1; - v411 = cf.select v410, v384, v403 : i32; - v412 = hir.bitcast v411 : u32; - v413 = arith.zext v412 : u64; - v414 = hir.bitcast v413 : i64; - v916 = arith.constant 0 : i32; - v364 = arith.sub v916, v333 : i32 #[overflow = wrapping]; - v361 = arith.constant -1 : i32; - v360 = arith.add v333, v334 : i32 #[overflow = wrapping]; - v362 = arith.add v360, v361 : i32 #[overflow = wrapping]; - v365 = arith.band v362, v364 : i32; - v366 = hir.bitcast v365 : u32; - v367 = arith.zext v366 : u64; - v368 = hir.bitcast v367 : i64; - v415 = arith.mul v368, v414 : i64 #[overflow = wrapping]; - v915 = arith.constant 0 : i32; - v416 = arith.constant 32 : i64; - v418 = hir.cast v416 : u32; - v417 = hir.bitcast v415 : u64; - v419 = arith.shr v417, v418 : u64; - v420 = hir.bitcast v419 : i64; - v421 = arith.trunc v420 : i32; - v423 = arith.neq v421, v915 : i1; - v892, v893 = scf.if v423 : i32, i32 { - ^block97: - v914 = arith.constant 0 : i32; - scf.yield v384, v914; + v402 = arith.neq v400, v926 : i1; + v403 = cf.select v402, v393, v925 : i32; + v392 = arith.constant 8 : i32; + v927 = arith.constant 0 : i32; + v381 = arith.constant 1 : i32; + v405 = arith.eq v341, v381 : i1; + v406 = arith.zext v405 : u32; + v407 = hir.bitcast v406 : i32; + v409 = arith.neq v407, v927 : i1; + v410 = cf.select v409, v392, v403 : i32; + v924 = arith.constant 0 : i32; + v412 = hir.bitcast v410 : u32; + v411 = hir.bitcast v391 : u32; + v413 = arith.gt v411, v412 : i1; + v414 = arith.zext v413 : u32; + v415 = hir.bitcast v414 : i32; + v417 = arith.neq v415, v924 : i1; + v418 = cf.select v417, v391, v410 : i32; + v419 = hir.bitcast v418 : u32; + v420 = arith.zext v419 : u64; + v421 = hir.bitcast v420 : i64; + v923 = arith.constant 0 : i32; + v371 = arith.sub v923, v340 : i32 #[overflow = wrapping]; + v368 = arith.constant -1 : i32; + v367 = arith.add v340, v341 : i32 #[overflow = wrapping]; + v369 = arith.add v367, v368 : i32 #[overflow = wrapping]; + v372 = arith.band v369, v371 : i32; + v373 = hir.bitcast v372 : u32; + v374 = arith.zext v373 : u64; + v375 = hir.bitcast v374 : i64; + v422 = arith.mul v375, v421 : i64 #[overflow = wrapping]; + v922 = arith.constant 0 : i32; + v423 = arith.constant 32 : i64; + v425 = hir.cast v423 : u32; + v424 = hir.bitcast v422 : u64; + v426 = arith.shr v424, v425 : u64; + v427 = hir.bitcast v426 : i64; + v428 = arith.trunc v427 : i32; + v430 = arith.neq v428, v922 : i1; + v899, v900 = scf.if v430 : i32, i32 { + ^block101: + v921 = arith.constant 0 : i32; + scf.yield v391, v921; } else { - ^block47: - v424 = arith.trunc v415 : i32; - v913 = arith.constant 0 : i32; - v425 = arith.constant -2147483648 : i32; - v426 = arith.sub v425, v333 : i32 #[overflow = wrapping]; - v428 = hir.bitcast v426 : u32; - v427 = hir.bitcast v424 : u32; - v429 = arith.gt v427, v428 : i1; - v430 = arith.zext v429 : u32; - v431 = hir.bitcast v430 : i32; - v433 = arith.neq v431, v913 : i1; - v890, v891 = scf.if v433 : i32, i32 { - ^block96: - v912 = arith.constant 0 : i32; - scf.yield v384, v912; + ^block51: + v431 = arith.trunc v422 : i32; + v920 = arith.constant 0 : i32; + v432 = arith.constant -2147483648 : i32; + v433 = arith.sub v432, v340 : i32 #[overflow = wrapping]; + v435 = hir.bitcast v433 : u32; + v434 = hir.bitcast v431 : u32; + v436 = arith.gt v434, v435 : i1; + v437 = arith.zext v436 : u32; + v438 = hir.bitcast v437 : i32; + v440 = arith.neq v438, v920 : i1; + v897, v898 = scf.if v440 : i32, i32 { + ^block100: + v919 = arith.constant 0 : i32; + scf.yield v391, v919; } else { - ^block48: - v434 = arith.constant 20 : i32; - v435 = arith.add v341, v434 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v435, v330, v333, v334) - v910 = arith.constant 20 : i32; - v439 = arith.add v341, v910 : i32 #[overflow = wrapping]; - v911 = arith.constant 8 : i32; - v437 = arith.add v341, v911 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v437, v333, v424, v439, v329) - v441 = arith.constant 12 : u32; - v440 = hir.bitcast v341 : u32; - v442 = arith.add v440, v441 : u32 #[overflow = checked]; - v909 = arith.constant 4 : u32; - v444 = arith.mod v442, v909 : u32; - hir.assertz v444 #[code = 250]; - v445 = hir.int_to_ptr v442 : ptr; - v446 = hir.load v445 : i32; - v448 = arith.constant 8 : u32; - v447 = hir.bitcast v341 : u32; + ^block52: + v441 = arith.constant 20 : i32; + v442 = arith.add v348, v441 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v442, v337, v340, v341) + v917 = arith.constant 20 : i32; + v446 = arith.add v348, v917 : i32 #[overflow = wrapping]; + v918 = arith.constant 8 : i32; + v444 = arith.add v348, v918 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v444, v340, v431, v446, v336) + v448 = arith.constant 12 : u32; + v447 = hir.bitcast v348 : u32; v449 = arith.add v447, v448 : u32 #[overflow = checked]; - v908 = arith.constant 4 : u32; - v451 = arith.mod v449, v908 : u32; + v916 = arith.constant 4 : u32; + v451 = arith.mod v449, v916 : u32; hir.assertz v451 #[code = 250]; v452 = hir.int_to_ptr v449 : ptr; v453 = hir.load v452 : i32; - v906 = arith.constant 0 : i32; - v907 = arith.constant 0 : i32; - v455 = arith.eq v453, v907 : i1; - v456 = arith.zext v455 : u32; - v457 = hir.bitcast v456 : i32; - v459 = arith.neq v457, v906 : i1; - v888 = scf.if v459 : i32 { - ^block49: - v467 = hir.bitcast v330 : u32; - v905 = arith.constant 4 : u32; - v469 = arith.mod v467, v905 : u32; - hir.assertz v469 #[code = 250]; - v470 = hir.int_to_ptr v467 : ptr; - hir.store v470, v411; - v904 = arith.constant 4 : u32; - v471 = hir.bitcast v330 : u32; - v473 = arith.add v471, v904 : u32 #[overflow = checked]; - v903 = arith.constant 4 : u32; - v475 = arith.mod v473, v903 : u32; - hir.assertz v475 #[code = 250]; - v476 = hir.int_to_ptr v473 : ptr; - hir.store v476, v446; - scf.yield v384; + v455 = arith.constant 8 : u32; + v454 = hir.bitcast v348 : u32; + v456 = arith.add v454, v455 : u32 #[overflow = checked]; + v915 = arith.constant 4 : u32; + v458 = arith.mod v456, v915 : u32; + hir.assertz v458 #[code = 250]; + v459 = hir.int_to_ptr v456 : ptr; + v460 = hir.load v459 : i32; + v913 = arith.constant 0 : i32; + v914 = arith.constant 0 : i32; + v462 = arith.eq v460, v914 : i1; + v463 = arith.zext v462 : u32; + v464 = hir.bitcast v463 : i32; + v466 = arith.neq v464, v913 : i1; + v895 = scf.if v466 : i32 { + ^block53: + v474 = hir.bitcast v337 : u32; + v912 = arith.constant 4 : u32; + v476 = arith.mod v474, v912 : u32; + hir.assertz v476 #[code = 250]; + v477 = hir.int_to_ptr v474 : ptr; + hir.store v477, v418; + v911 = arith.constant 4 : u32; + v478 = hir.bitcast v337 : u32; + v480 = arith.add v478, v911 : u32 #[overflow = checked]; + v910 = arith.constant 4 : u32; + v482 = arith.mod v480, v910 : u32; + hir.assertz v482 #[code = 250]; + v483 = hir.int_to_ptr v480 : ptr; + hir.store v483, v453; + scf.yield v391; } else { - ^block50: - v461 = arith.constant 16 : u32; - v460 = hir.bitcast v341 : u32; - v462 = arith.add v460, v461 : u32 #[overflow = checked]; - v902 = arith.constant 4 : u32; - v464 = arith.mod v462, v902 : u32; - hir.assertz v464 #[code = 250]; - v465 = hir.int_to_ptr v462 : ptr; - v466 = hir.load v465 : i32; - scf.yield v466; + ^block54: + v468 = arith.constant 16 : u32; + v467 = hir.bitcast v348 : u32; + v469 = arith.add v467, v468 : u32 #[overflow = checked]; + v909 = arith.constant 4 : u32; + v471 = arith.mod v469, v909 : u32; + hir.assertz v471 #[code = 250]; + v472 = hir.int_to_ptr v469 : ptr; + v473 = hir.load v472 : i32; + scf.yield v473; }; - v477 = arith.constant -2147483647 : i32; - v889 = cf.select v459, v477, v446 : i32; - scf.yield v888, v889; + v484 = arith.constant -2147483647 : i32; + v896 = cf.select v466, v484, v453 : i32; + scf.yield v895, v896; }; - scf.yield v890, v891; + scf.yield v897, v898; }; - scf.yield v892, v893; + scf.yield v899, v900; }; - scf.yield v894, v895; + scf.yield v901, v902; }; - v901 = arith.constant 4 : u32; - v482 = hir.bitcast v329 : u32; - v484 = arith.add v482, v901 : u32 #[overflow = checked]; - v900 = arith.constant 4 : u32; - v486 = arith.mod v484, v900 : u32; - hir.assertz v486 #[code = 250]; - v487 = hir.int_to_ptr v484 : ptr; - hir.store v487, v896; - v490 = hir.bitcast v329 : u32; - v899 = arith.constant 4 : u32; - v492 = arith.mod v490, v899 : u32; - hir.assertz v492 #[code = 250]; - v493 = hir.int_to_ptr v490 : ptr; - hir.store v493, v897; - v898 = arith.constant 32 : i32; - v497 = arith.add v341, v898 : i32 #[overflow = wrapping]; - v498 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v499 = hir.bitcast v498 : ptr; - hir.store v499, v497; + v908 = arith.constant 4 : u32; + v489 = hir.bitcast v336 : u32; + v491 = arith.add v489, v908 : u32 #[overflow = checked]; + v907 = arith.constant 4 : u32; + v493 = arith.mod v491, v907 : u32; + hir.assertz v493 #[code = 250]; + v494 = hir.int_to_ptr v491 : ptr; + hir.store v494, v903; + v497 = hir.bitcast v336 : u32; + v906 = arith.constant 4 : u32; + v499 = arith.mod v497, v906 : u32; + hir.assertz v499 #[code = 250]; + v500 = hir.int_to_ptr v497 : ptr; + hir.store v500, v904; + v905 = arith.constant 32 : i32; + v504 = arith.add v348, v905 : i32 #[overflow = wrapping]; + v505 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v506 = hir.bitcast v505 : ptr; + hir.store v506, v504; builtin.ret ; }; - private builtin.function @::allocate(v500: i32, v501: i32, v502: i32) { - ^block51(v500: i32, v501: i32, v502: i32): - v504 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v505 = hir.bitcast v504 : ptr; - v506 = hir.load v505 : i32; - v507 = arith.constant 16 : i32; - v508 = arith.sub v506, v507 : i32 #[overflow = wrapping]; - v509 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v510 = hir.bitcast v509 : ptr; - hir.store v510, v508; - v503 = arith.constant 0 : i32; - v511 = arith.constant 8 : i32; - v512 = arith.add v508, v511 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v512, v501, v502, v503) - v515 = arith.constant 12 : u32; - v514 = hir.bitcast v508 : u32; - v516 = arith.add v514, v515 : u32 #[overflow = checked]; - v517 = arith.constant 4 : u32; - v518 = arith.mod v516, v517 : u32; - hir.assertz v518 #[code = 250]; - v519 = hir.int_to_ptr v516 : ptr; - v520 = hir.load v519 : i32; - v522 = arith.constant 8 : u32; - v521 = hir.bitcast v508 : u32; + private builtin.function @::allocate(v507: i32, v508: i32, v509: i32) { + ^block55(v507: i32, v508: i32, v509: i32): + v511 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v512 = hir.bitcast v511 : ptr; + v513 = hir.load v512 : i32; + v514 = arith.constant 16 : i32; + v515 = arith.sub v513, v514 : i32 #[overflow = wrapping]; + v516 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v517 = hir.bitcast v516 : ptr; + hir.store v517, v515; + v510 = arith.constant 0 : i32; + v518 = arith.constant 8 : i32; + v519 = arith.add v515, v518 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v519, v508, v509, v510) + v522 = arith.constant 12 : u32; + v521 = hir.bitcast v515 : u32; v523 = arith.add v521, v522 : u32 #[overflow = checked]; - v930 = arith.constant 4 : u32; - v525 = arith.mod v523, v930 : u32; + v524 = arith.constant 4 : u32; + v525 = arith.mod v523, v524 : u32; hir.assertz v525 #[code = 250]; v526 = hir.int_to_ptr v523 : ptr; v527 = hir.load v526 : i32; - v528 = hir.bitcast v500 : u32; - v929 = arith.constant 4 : u32; - v530 = arith.mod v528, v929 : u32; - hir.assertz v530 #[code = 250]; - v531 = hir.int_to_ptr v528 : ptr; - hir.store v531, v527; - v928 = arith.constant 4 : u32; - v532 = hir.bitcast v500 : u32; - v534 = arith.add v532, v928 : u32 #[overflow = checked]; - v927 = arith.constant 4 : u32; - v536 = arith.mod v534, v927 : u32; - hir.assertz v536 #[code = 250]; - v537 = hir.int_to_ptr v534 : ptr; - hir.store v537, v520; - v926 = arith.constant 16 : i32; - v539 = arith.add v508, v926 : i32 #[overflow = wrapping]; - v540 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v541 = hir.bitcast v540 : ptr; - hir.store v541, v539; + v529 = arith.constant 8 : u32; + v528 = hir.bitcast v515 : u32; + v530 = arith.add v528, v529 : u32 #[overflow = checked]; + v937 = arith.constant 4 : u32; + v532 = arith.mod v530, v937 : u32; + hir.assertz v532 #[code = 250]; + v533 = hir.int_to_ptr v530 : ptr; + v534 = hir.load v533 : i32; + v535 = hir.bitcast v507 : u32; + v936 = arith.constant 4 : u32; + v537 = arith.mod v535, v936 : u32; + hir.assertz v537 #[code = 250]; + v538 = hir.int_to_ptr v535 : ptr; + hir.store v538, v534; + v935 = arith.constant 4 : u32; + v539 = hir.bitcast v507 : u32; + v541 = arith.add v539, v935 : u32 #[overflow = checked]; + v934 = arith.constant 4 : u32; + v543 = arith.mod v541, v934 : u32; + hir.assertz v543 #[code = 250]; + v544 = hir.int_to_ptr v541 : ptr; + hir.store v544, v527; + v933 = arith.constant 16 : i32; + v546 = arith.add v515, v933 : i32 #[overflow = wrapping]; + v547 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v548 = hir.bitcast v547 : ptr; + hir.store v548, v546; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v542: i32, v543: i32, v544: i32, v545: i32) { - ^block53(v542: i32, v543: i32, v544: i32, v545: i32): - v946 = arith.constant 0 : i32; - v546 = arith.constant 0 : i32; - v547 = arith.eq v544, v546 : i1; - v548 = arith.zext v547 : u32; - v549 = hir.bitcast v548 : i32; - v551 = arith.neq v549, v946 : i1; - v942 = scf.if v551 : i32 { - ^block104: - scf.yield v543; + private builtin.function @alloc::alloc::Global::alloc_impl(v549: i32, v550: i32, v551: i32, v552: i32) { + ^block57(v549: i32, v550: i32, v551: i32, v552: i32): + v953 = arith.constant 0 : i32; + v553 = arith.constant 0 : i32; + v554 = arith.eq v551, v553 : i1; + v555 = arith.zext v554 : u32; + v556 = hir.bitcast v555 : i32; + v558 = arith.neq v556, v953 : i1; + v949 = scf.if v558 : i32 { + ^block108: + scf.yield v550; } else { - ^block56: + ^block60: hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v945 = arith.constant 0 : i32; - v553 = arith.neq v545, v945 : i1; - v941 = scf.if v553 : i32 { - ^block57: - v555 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v544, v543) : i32 - scf.yield v555; + v952 = arith.constant 0 : i32; + v560 = arith.neq v552, v952 : i1; + v948 = scf.if v560 : i32 { + ^block61: + v562 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v551, v550) : i32 + scf.yield v562; } else { - ^block58: - v554 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v544, v543) : i32 - scf.yield v554; + ^block62: + v561 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v551, v550) : i32 + scf.yield v561; }; - scf.yield v941; + scf.yield v948; }; - v559 = arith.constant 4 : u32; - v558 = hir.bitcast v542 : u32; - v560 = arith.add v558, v559 : u32 #[overflow = checked]; - v944 = arith.constant 4 : u32; - v562 = arith.mod v560, v944 : u32; - hir.assertz v562 #[code = 250]; - v563 = hir.int_to_ptr v560 : ptr; - hir.store v563, v544; - v565 = hir.bitcast v542 : u32; - v943 = arith.constant 4 : u32; - v567 = arith.mod v565, v943 : u32; - hir.assertz v567 #[code = 250]; - v568 = hir.int_to_ptr v565 : ptr; - hir.store v568, v942; + v566 = arith.constant 4 : u32; + v565 = hir.bitcast v549 : u32; + v567 = arith.add v565, v566 : u32 #[overflow = checked]; + v951 = arith.constant 4 : u32; + v569 = arith.mod v567, v951 : u32; + hir.assertz v569 #[code = 250]; + v570 = hir.int_to_ptr v567 : ptr; + hir.store v570, v551; + v572 = hir.bitcast v549 : u32; + v950 = arith.constant 4 : u32; + v574 = arith.mod v572, v950 : u32; + hir.assertz v574 #[code = 250]; + v575 = hir.int_to_ptr v572 : ptr; + hir.store v575, v949; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v569: i32, v570: i32, v571: i32, v572: i32) { - ^block59(v569: i32, v570: i32, v571: i32, v572: i32): - v972 = arith.constant 0 : i32; - v573 = arith.constant 0 : i32; - v577 = arith.eq v572, v573 : i1; - v578 = arith.zext v577 : u32; - v579 = hir.bitcast v578 : i32; - v581 = arith.neq v579, v972 : i1; - v959, v960 = scf.if v581 : i32, i32 { - ^block108: - v971 = arith.constant 0 : i32; - v575 = arith.constant 4 : i32; - scf.yield v575, v971; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v576: i32, v577: i32, v578: i32, v579: i32) { + ^block63(v576: i32, v577: i32, v578: i32, v579: i32): + v979 = arith.constant 0 : i32; + v580 = arith.constant 0 : i32; + v584 = arith.eq v579, v580 : i1; + v585 = arith.zext v584 : u32; + v586 = hir.bitcast v585 : i32; + v588 = arith.neq v586, v979 : i1; + v966, v967 = scf.if v588 : i32, i32 { + ^block112: + v978 = arith.constant 0 : i32; + v582 = arith.constant 4 : i32; + scf.yield v582, v978; } else { - ^block62: - v582 = hir.bitcast v570 : u32; - v617 = arith.constant 4 : u32; - v584 = arith.mod v582, v617 : u32; - hir.assertz v584 #[code = 250]; - v585 = hir.int_to_ptr v582 : ptr; - v586 = hir.load v585 : i32; - v969 = arith.constant 0 : i32; - v970 = arith.constant 0 : i32; - v588 = arith.eq v586, v970 : i1; - v589 = arith.zext v588 : u32; - v590 = hir.bitcast v589 : i32; - v592 = arith.neq v590, v969 : i1; - v957 = scf.if v592 : i32 { - ^block107: - v968 = arith.constant 0 : i32; - scf.yield v968; + ^block66: + v589 = hir.bitcast v577 : u32; + v624 = arith.constant 4 : u32; + v591 = arith.mod v589, v624 : u32; + hir.assertz v591 #[code = 250]; + v592 = hir.int_to_ptr v589 : ptr; + v593 = hir.load v592 : i32; + v976 = arith.constant 0 : i32; + v977 = arith.constant 0 : i32; + v595 = arith.eq v593, v977 : i1; + v596 = arith.zext v595 : u32; + v597 = hir.bitcast v596 : i32; + v599 = arith.neq v597, v976 : i1; + v964 = scf.if v599 : i32 { + ^block111: + v975 = arith.constant 0 : i32; + scf.yield v975; } else { - ^block63: - v967 = arith.constant 4 : u32; - v593 = hir.bitcast v569 : u32; - v595 = arith.add v593, v967 : u32 #[overflow = checked]; - v966 = arith.constant 4 : u32; - v597 = arith.mod v595, v966 : u32; - hir.assertz v597 #[code = 250]; - v598 = hir.int_to_ptr v595 : ptr; - hir.store v598, v571; - v965 = arith.constant 4 : u32; - v599 = hir.bitcast v570 : u32; - v601 = arith.add v599, v965 : u32 #[overflow = checked]; - v964 = arith.constant 4 : u32; - v603 = arith.mod v601, v964 : u32; - hir.assertz v603 #[code = 250]; - v604 = hir.int_to_ptr v601 : ptr; - v605 = hir.load v604 : i32; - v606 = hir.bitcast v569 : u32; - v963 = arith.constant 4 : u32; - v608 = arith.mod v606, v963 : u32; - hir.assertz v608 #[code = 250]; - v609 = hir.int_to_ptr v606 : ptr; - hir.store v609, v605; - v610 = arith.mul v586, v572 : i32 #[overflow = wrapping]; - scf.yield v610; + ^block67: + v974 = arith.constant 4 : u32; + v600 = hir.bitcast v576 : u32; + v602 = arith.add v600, v974 : u32 #[overflow = checked]; + v973 = arith.constant 4 : u32; + v604 = arith.mod v602, v973 : u32; + hir.assertz v604 #[code = 250]; + v605 = hir.int_to_ptr v602 : ptr; + hir.store v605, v578; + v972 = arith.constant 4 : u32; + v606 = hir.bitcast v577 : u32; + v608 = arith.add v606, v972 : u32 #[overflow = checked]; + v971 = arith.constant 4 : u32; + v610 = arith.mod v608, v971 : u32; + hir.assertz v610 #[code = 250]; + v611 = hir.int_to_ptr v608 : ptr; + v612 = hir.load v611 : i32; + v613 = hir.bitcast v576 : u32; + v970 = arith.constant 4 : u32; + v615 = arith.mod v613, v970 : u32; + hir.assertz v615 #[code = 250]; + v616 = hir.int_to_ptr v613 : ptr; + hir.store v616, v612; + v617 = arith.mul v593, v579 : i32 #[overflow = wrapping]; + scf.yield v617; }; - v611 = arith.constant 8 : i32; - v962 = arith.constant 4 : i32; - v958 = cf.select v592, v962, v611 : i32; - scf.yield v958, v957; + v618 = arith.constant 8 : i32; + v969 = arith.constant 4 : i32; + v965 = cf.select v599, v969, v618 : i32; + scf.yield v965, v964; }; - v614 = arith.add v569, v959 : i32 #[overflow = wrapping]; - v616 = hir.bitcast v614 : u32; - v961 = arith.constant 4 : u32; - v618 = arith.mod v616, v961 : u32; - hir.assertz v618 #[code = 250]; - v619 = hir.int_to_ptr v616 : ptr; - hir.store v619, v960; + v621 = arith.add v576, v966 : i32 #[overflow = wrapping]; + v623 = hir.bitcast v621 : u32; + v968 = arith.constant 4 : u32; + v625 = arith.mod v623, v968 : u32; + hir.assertz v625 #[code = 250]; + v626 = hir.int_to_ptr v623 : ptr; + hir.store v626, v967; builtin.ret ; }; - private builtin.function @alloc::raw_vec::finish_grow(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32) { - ^block64(v620: i32, v621: i32, v622: i32, v623: i32, v624: i32): - v626 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v627 = hir.bitcast v626 : ptr; - v628 = hir.load v627 : i32; - v629 = arith.constant 16 : i32; - v630 = arith.sub v628, v629 : i32 #[overflow = wrapping]; - v631 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v632 = hir.bitcast v631 : ptr; - hir.store v632, v630; - v1027 = arith.constant 0 : i32; - v625 = arith.constant 0 : i32; - v635 = arith.gte v622, v625 : i1; - v636 = arith.zext v635 : u32; - v637 = hir.bitcast v636 : i32; - v639 = arith.neq v637, v1027 : i1; - v1001, v1002 = scf.if v639 : i32, i32 { - ^block67: - v726 = arith.constant 4 : u32; - v642 = hir.bitcast v623 : u32; - v644 = arith.add v642, v726 : u32 #[overflow = checked]; - v1026 = arith.constant 4 : u32; - v646 = arith.mod v644, v1026 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - v648 = hir.load v647 : i32; - v1024 = arith.constant 0 : i32; - v1025 = arith.constant 0 : i32; - v650 = arith.eq v648, v1025 : i1; - v651 = arith.zext v650 : u32; - v652 = hir.bitcast v651 : i32; - v654 = arith.neq v652, v1024 : i1; - v999, v1000 = scf.if v654 : i32, i32 { - ^block70: - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v630, v621, v622) - v1023 = arith.constant 4 : u32; - v687 = hir.bitcast v630 : u32; - v689 = arith.add v687, v1023 : u32 #[overflow = checked]; - v1022 = arith.constant 4 : u32; - v691 = arith.mod v689, v1022 : u32; - hir.assertz v691 #[code = 250]; - v692 = hir.int_to_ptr v689 : ptr; - v693 = hir.load v692 : i32; - v694 = hir.bitcast v630 : u32; - v1021 = arith.constant 4 : u32; - v696 = arith.mod v694, v1021 : u32; - hir.assertz v696 #[code = 250]; - v697 = hir.int_to_ptr v694 : ptr; - v698 = hir.load v697 : i32; - scf.yield v698, v693; + private builtin.function @alloc::raw_vec::finish_grow(v627: i32, v628: i32, v629: i32, v630: i32, v631: i32) { + ^block68(v627: i32, v628: i32, v629: i32, v630: i32, v631: i32): + v633 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v634 = hir.bitcast v633 : ptr; + v635 = hir.load v634 : i32; + v636 = arith.constant 16 : i32; + v637 = arith.sub v635, v636 : i32 #[overflow = wrapping]; + v638 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v639 = hir.bitcast v638 : ptr; + hir.store v639, v637; + v1034 = arith.constant 0 : i32; + v632 = arith.constant 0 : i32; + v642 = arith.gte v629, v632 : i1; + v643 = arith.zext v642 : u32; + v644 = hir.bitcast v643 : i32; + v646 = arith.neq v644, v1034 : i1; + v1008, v1009 = scf.if v646 : i32, i32 { + ^block71: + v733 = arith.constant 4 : u32; + v649 = hir.bitcast v630 : u32; + v651 = arith.add v649, v733 : u32 #[overflow = checked]; + v1033 = arith.constant 4 : u32; + v653 = arith.mod v651, v1033 : u32; + hir.assertz v653 #[code = 250]; + v654 = hir.int_to_ptr v651 : ptr; + v655 = hir.load v654 : i32; + v1031 = arith.constant 0 : i32; + v1032 = arith.constant 0 : i32; + v657 = arith.eq v655, v1032 : i1; + v658 = arith.zext v657 : u32; + v659 = hir.bitcast v658 : i32; + v661 = arith.neq v659, v1031 : i1; + v1006, v1007 = scf.if v661 : i32, i32 { + ^block74: + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v637, v628, v629) + v1030 = arith.constant 4 : u32; + v694 = hir.bitcast v637 : u32; + v696 = arith.add v694, v1030 : u32 #[overflow = checked]; + v1029 = arith.constant 4 : u32; + v698 = arith.mod v696, v1029 : u32; + hir.assertz v698 #[code = 250]; + v699 = hir.int_to_ptr v696 : ptr; + v700 = hir.load v699 : i32; + v701 = hir.bitcast v637 : u32; + v1028 = arith.constant 4 : u32; + v703 = arith.mod v701, v1028 : u32; + hir.assertz v703 #[code = 250]; + v704 = hir.int_to_ptr v701 : ptr; + v705 = hir.load v704 : i32; + scf.yield v705, v700; } else { - ^block71: - v656 = arith.constant 8 : u32; - v655 = hir.bitcast v623 : u32; - v657 = arith.add v655, v656 : u32 #[overflow = checked]; - v1020 = arith.constant 4 : u32; - v659 = arith.mod v657, v1020 : u32; - hir.assertz v659 #[code = 250]; - v660 = hir.int_to_ptr v657 : ptr; - v661 = hir.load v660 : i32; - v1019 = arith.constant 0 : i32; - v663 = arith.neq v661, v1019 : i1; - v997, v998 = scf.if v663 : i32, i32 { - ^block72: - v681 = hir.bitcast v623 : u32; - v1018 = arith.constant 4 : u32; - v683 = arith.mod v681, v1018 : u32; - hir.assertz v683 #[code = 250]; - v684 = hir.int_to_ptr v681 : ptr; - v685 = hir.load v684 : i32; - v686 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v685, v661, v621, v622) : i32 - scf.yield v686, v622; + ^block75: + v663 = arith.constant 8 : u32; + v662 = hir.bitcast v630 : u32; + v664 = arith.add v662, v663 : u32 #[overflow = checked]; + v1027 = arith.constant 4 : u32; + v666 = arith.mod v664, v1027 : u32; + hir.assertz v666 #[code = 250]; + v667 = hir.int_to_ptr v664 : ptr; + v668 = hir.load v667 : i32; + v1026 = arith.constant 0 : i32; + v670 = arith.neq v668, v1026 : i1; + v1004, v1005 = scf.if v670 : i32, i32 { + ^block76: + v688 = hir.bitcast v630 : u32; + v1025 = arith.constant 4 : u32; + v690 = arith.mod v688, v1025 : u32; + hir.assertz v690 #[code = 250]; + v691 = hir.int_to_ptr v688 : ptr; + v692 = hir.load v691 : i32; + v693 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v692, v668, v628, v629) : i32 + scf.yield v693, v629; } else { - ^block73: - v1017 = arith.constant 0 : i32; - v720 = arith.constant 8 : i32; - v665 = arith.add v630, v720 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v665, v621, v622, v1017) - v668 = arith.constant 12 : u32; - v667 = hir.bitcast v630 : u32; - v669 = arith.add v667, v668 : u32 #[overflow = checked]; - v1016 = arith.constant 4 : u32; - v671 = arith.mod v669, v1016 : u32; - hir.assertz v671 #[code = 250]; - v672 = hir.int_to_ptr v669 : ptr; - v673 = hir.load v672 : i32; - v1015 = arith.constant 8 : u32; - v674 = hir.bitcast v630 : u32; - v676 = arith.add v674, v1015 : u32 #[overflow = checked]; - v1014 = arith.constant 4 : u32; - v678 = arith.mod v676, v1014 : u32; + ^block77: + v1024 = arith.constant 0 : i32; + v727 = arith.constant 8 : i32; + v672 = arith.add v637, v727 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v672, v628, v629, v1024) + v675 = arith.constant 12 : u32; + v674 = hir.bitcast v637 : u32; + v676 = arith.add v674, v675 : u32 #[overflow = checked]; + v1023 = arith.constant 4 : u32; + v678 = arith.mod v676, v1023 : u32; hir.assertz v678 #[code = 250]; v679 = hir.int_to_ptr v676 : ptr; v680 = hir.load v679 : i32; - scf.yield v680, v673; + v1022 = arith.constant 8 : u32; + v681 = hir.bitcast v637 : u32; + v683 = arith.add v681, v1022 : u32 #[overflow = checked]; + v1021 = arith.constant 4 : u32; + v685 = arith.mod v683, v1021 : u32; + hir.assertz v685 #[code = 250]; + v686 = hir.int_to_ptr v683 : ptr; + v687 = hir.load v686 : i32; + scf.yield v687, v680; }; - scf.yield v997, v998; + scf.yield v1004, v1005; }; - v1013 = arith.constant 4 : u32; - v705 = hir.bitcast v620 : u32; - v707 = arith.add v705, v1013 : u32 #[overflow = checked]; - v1012 = arith.constant 4 : u32; - v709 = arith.mod v707, v1012 : u32; - hir.assertz v709 #[code = 250]; - v1011 = arith.constant 0 : i32; - v703 = arith.neq v999, v1011 : i1; - v704 = cf.select v703, v999, v621 : i32; - v710 = hir.int_to_ptr v707 : ptr; - hir.store v710, v704; - v1009 = arith.constant 0 : i32; - v717 = arith.eq v999, v1009 : i1; - v718 = arith.zext v717 : u32; - v719 = hir.bitcast v718 : i32; - v1010 = arith.constant 0 : i32; - v714 = arith.neq v999, v1010 : i1; - v715 = cf.select v714, v1000, v622 : i32; - scf.yield v715, v719; + v1020 = arith.constant 4 : u32; + v712 = hir.bitcast v627 : u32; + v714 = arith.add v712, v1020 : u32 #[overflow = checked]; + v1019 = arith.constant 4 : u32; + v716 = arith.mod v714, v1019 : u32; + hir.assertz v716 #[code = 250]; + v1018 = arith.constant 0 : i32; + v710 = arith.neq v1006, v1018 : i1; + v711 = cf.select v710, v1006, v628 : i32; + v717 = hir.int_to_ptr v714 : ptr; + hir.store v717, v711; + v1016 = arith.constant 0 : i32; + v724 = arith.eq v1006, v1016 : i1; + v725 = arith.zext v724 : u32; + v726 = hir.bitcast v725 : i32; + v1017 = arith.constant 0 : i32; + v721 = arith.neq v1006, v1017 : i1; + v722 = cf.select v721, v1007, v629 : i32; + scf.yield v722, v726; } else { - ^block68: - v640 = arith.constant 1 : i32; - v1008 = arith.constant 0 : i32; - scf.yield v1008, v640; + ^block72: + v647 = arith.constant 1 : i32; + v1015 = arith.constant 0 : i32; + scf.yield v1015, v647; }; - v641 = arith.constant 4 : i32; - v1007 = arith.constant 8 : i32; - v1003 = cf.select v639, v1007, v641 : i32; - v723 = arith.add v620, v1003 : i32 #[overflow = wrapping]; - v725 = hir.bitcast v723 : u32; - v1006 = arith.constant 4 : u32; - v727 = arith.mod v725, v1006 : u32; - hir.assertz v727 #[code = 250]; - v728 = hir.int_to_ptr v725 : ptr; - hir.store v728, v1001; - v730 = hir.bitcast v620 : u32; - v1005 = arith.constant 4 : u32; - v732 = arith.mod v730, v1005 : u32; - hir.assertz v732 #[code = 250]; - v733 = hir.int_to_ptr v730 : ptr; - hir.store v733, v1002; - v1004 = arith.constant 16 : i32; - v737 = arith.add v630, v1004 : i32 #[overflow = wrapping]; - v738 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v739 = hir.bitcast v738 : ptr; - hir.store v739, v737; + v648 = arith.constant 4 : i32; + v1014 = arith.constant 8 : i32; + v1010 = cf.select v646, v1014, v648 : i32; + v730 = arith.add v627, v1010 : i32 #[overflow = wrapping]; + v732 = hir.bitcast v730 : u32; + v1013 = arith.constant 4 : u32; + v734 = arith.mod v732, v1013 : u32; + hir.assertz v734 #[code = 250]; + v735 = hir.int_to_ptr v732 : ptr; + hir.store v735, v1008; + v737 = hir.bitcast v627 : u32; + v1012 = arith.constant 4 : u32; + v739 = arith.mod v737, v1012 : u32; + hir.assertz v739 #[code = 250]; + v740 = hir.int_to_ptr v737 : ptr; + hir.store v740, v1009; + v1011 = arith.constant 16 : i32; + v744 = arith.add v637, v1011 : i32 #[overflow = wrapping]; + v745 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v746 = hir.bitcast v745 : ptr; + hir.store v746, v744; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v740: i32, v741: i32, v742: i32) { - ^block74(v740: i32, v741: i32, v742: i32): + private builtin.function @alloc::raw_vec::handle_error(v747: i32, v748: i32, v749: i32) { + ^block78(v747: i32, v748: i32, v749: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v743: i32, v744: i32) -> i32 { - ^block76(v743: i32, v744: i32): - v751 = arith.constant 0 : i32; - v747 = hir.bitcast v744 : u32; - v746 = hir.bitcast v743 : u32; - v748 = arith.gt v746, v747 : i1; - v749 = arith.zext v748 : u32; - v750 = hir.bitcast v749 : i32; - v752 = arith.neq v750, v751 : i1; - v753 = cf.select v752, v743, v744 : i32; - builtin.ret v753; + private builtin.function @core::ptr::alignment::Alignment::max(v750: i32, v751: i32) -> i32 { + ^block80(v750: i32, v751: i32): + v758 = arith.constant 0 : i32; + v754 = hir.bitcast v751 : u32; + v753 = hir.bitcast v750 : u32; + v755 = arith.gt v753, v754 : i1; + v756 = arith.zext v755 : u32; + v757 = hir.bitcast v756 : i32; + v759 = arith.neq v757, v758 : i1; + v760 = cf.select v759, v750, v751 : i32; + builtin.ret v760; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.masm b/felt-repr/tests/expected/onchain_five_felts_struct.masm index a29cdcc9e..cdcbc0f77 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.masm +++ b/felt-repr/tests/expected/onchain_five_felts_struct.masm @@ -268,7 +268,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.16 + push.12 dup.3 add u32assert @@ -285,7 +285,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.12 + push.8 dup.4 add u32assert @@ -302,7 +302,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.4 dup.5 add u32assert @@ -319,10 +319,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.4 - dup.6 - add - u32assert + dup.5 push.4 dup.1 swap.1 @@ -336,7 +333,10 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - movup.6 + push.16 + movup.7 + add + u32assert push.4 dup.1 swap.1 @@ -350,6 +350,18 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop + push.55555 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::felt::assert_eq + trace.252 + nop push.8 push.4 dup.7 @@ -394,7 +406,7 @@ pub proc entrypoint(i32, i32) push.4 dup.7 u32wrapping_add - movup.2 + movup.3 swap.1 trace.240 nop @@ -404,7 +416,7 @@ pub proc entrypoint(i32, i32) push.4 dup.6 u32wrapping_add - movup.2 + movup.3 swap.1 trace.240 nop @@ -414,7 +426,7 @@ pub proc entrypoint(i32, i32) push.4 dup.5 u32wrapping_add - movup.2 + movup.3 swap.1 trace.240 nop @@ -424,7 +436,7 @@ pub proc entrypoint(i32, i32) push.4 dup.4 u32wrapping_add - movup.2 + movup.3 swap.1 trace.240 nop @@ -903,6 +915,16 @@ proc intrinsics::mem::heap_base( nop end +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq +end + @callconv("C") proc alloc::raw_vec::RawVecInner::grow_amortized( i32, diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.wat b/felt-repr/tests/expected/onchain_five_felts_struct.wat index 0ae2f6aee..b2846309e 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.wat +++ b/felt-repr/tests/expected/onchain_five_felts_struct.wat @@ -7,10 +7,12 @@ (type (;5;) (func)) (type (;6;) (func (param i32 i32 i32) (result i32))) (type (;7;) (func (result i32))) - (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;9;) (func (param i32 i32 i32))) - (type (;10;) (func (param i32 i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32 i32))) + (type (;8;) (func (param i32) (result f32))) + (type (;9;) (func (param f32 f32))) + (type (;10;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32))) + (type (;12;) (func (param i32 i32 i32 i32))) + (type (;13;) (func (param i32 i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -87,20 +89,23 @@ local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=16 + f32.load offset=12 local.set 3 local.get 1 - f32.load offset=12 + f32.load offset=8 local.set 4 local.get 1 - f32.load offset=8 + f32.load offset=4 local.set 5 local.get 1 - f32.load offset=4 + f32.load local.set 6 local.get 1 - f32.load - local.set 7 + f32.load offset=16 + local.tee 7 + i32.const 55555 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 2 i32.const 4 i32.add @@ -115,11 +120,6 @@ local.get 2 i32.const 4 i32.add - local.get 7 - call $alloc::vec::Vec::push - local.get 2 - i32.const 4 - i32.add local.get 6 call $alloc::vec::Vec::push local.get 2 @@ -137,6 +137,11 @@ i32.add local.get 3 call $alloc::vec::Vec::push + local.get 2 + i32.const 4 + i32.add + local.get 7 + call $alloc::vec::Vec::push local.get 0 i32.const 8 i32.add @@ -280,7 +285,13 @@ (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) unreachable ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) + (func $intrinsics::felt::from_u32 (;9;) (type 8) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::assert_eq (;10;) (type 9) (param f32 f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;11;) (type 10) (param i32 i32 i32 i32 i32 i32) (local i32 i32 i32 i64) global.get $__stack_pointer i32.const 32 @@ -408,7 +419,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;10;) (type 9) (param i32 i32 i32) + (func $::allocate (;12;) (type 11) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -437,7 +448,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;11;) (type 10) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;13;) (type 12) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -464,7 +475,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;12;) (type 10) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;14;) (type 12) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -499,7 +510,7 @@ local.get 4 i32.store ) - (func $alloc::raw_vec::finish_grow (;13;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::finish_grow (;15;) (type 13) (param i32 i32 i32 i32 i32) (local i32 i32) global.get $__stack_pointer i32.const 16 @@ -598,10 +609,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;14;) (type 9) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;16;) (type 11) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;15;) (type 3) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;17;) (type 3) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.hir b/felt-repr/tests/expected/onchain_four_felts_struct.hir deleted file mode 100644 index c8e4af66c..000000000 --- a/felt-repr/tests/expected/onchain_four_felts_struct.hir +++ /dev/null @@ -1,1001 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @onchain_four_felts_struct { - private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { - ^block4(v0: i32, v1: felt): - v4 = arith.constant 8 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.add v3, v4 : u32 #[overflow = checked]; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; - hir.assertz v7 #[code = 250]; - v8 = hir.int_to_ptr v5 : ptr; - v9 = hir.load v8 : i32; - v10 = hir.bitcast v0 : u32; - v755 = arith.constant 4 : u32; - v12 = arith.mod v10, v755 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : i32; - v2 = arith.constant 0 : i32; - v15 = arith.neq v9, v14 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v2 : i1; - scf.if v19{ - ^block78: - scf.yield ; - } else { - ^block7: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) - scf.yield ; - }; - v754 = arith.constant 4 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v754 : u32 #[overflow = checked]; - v753 = arith.constant 4 : u32; - v25 = arith.mod v23, v753 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - v27 = hir.load v26 : i32; - v745 = arith.constant 2 : u32; - v31 = arith.shl v9, v745 : i32; - v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v32 : u32; - v752 = arith.constant 4 : u32; - v36 = arith.mod v34, v752 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v1; - v751 = arith.constant 8 : u32; - v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v751 : u32 #[overflow = checked]; - v750 = arith.constant 4 : u32; - v44 = arith.mod v42, v750 : u32; - hir.assertz v44 #[code = 250]; - v38 = arith.constant 1 : i32; - v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v39; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { - ^block8(v46: i32): - v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 16 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; - v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v54 = hir.bitcast v53 : ptr; - hir.store v54, v52; - v57 = hir.bitcast v46 : u32; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v63 = arith.constant 4 : i32; - v62 = arith.constant 1 : i32; - v55 = arith.constant 8 : i32; - v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) - v66 = arith.constant 8 : u32; - v65 = hir.bitcast v52 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v759 = arith.constant 4 : u32; - v69 = arith.mod v67, v759 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i32; - v47 = arith.constant 0 : i32; - v72 = arith.constant -2147483647 : i32; - v73 = arith.eq v71, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v47 : i1; - cf.cond_br v77 ^block10, ^block11; - ^block10: - v758 = arith.constant 16 : i32; - v87 = arith.add v52, v758 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret ; - ^block11: - v79 = arith.constant 12 : u32; - v78 = hir.bitcast v52 : u32; - v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v757 = arith.constant 4 : u32; - v82 = arith.mod v80, v757 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::handle_error(v71, v84, v85) - ub.unreachable ; - }; - - public builtin.function @entrypoint(v90: i32, v91: i32) { - ^block12(v90: i32, v91: i32): - v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - v96 = hir.load v95 : i32; - v97 = arith.constant 16 : i32; - v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; - v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - hir.store v100, v98; - v102 = arith.constant 12 : u32; - v101 = hir.bitcast v91 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v91 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v777 = arith.constant 4 : u32; - v112 = arith.mod v110, v777 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v776 = arith.constant 4 : u32; - v115 = hir.bitcast v91 : u32; - v117 = arith.add v115, v776 : u32 #[overflow = checked]; - v775 = arith.constant 4 : u32; - v119 = arith.mod v117, v775 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.bitcast v91 : u32; - v774 = arith.constant 4 : u32; - v124 = arith.mod v122, v774 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : felt; - v129 = arith.constant 8 : i32; - v127 = arith.constant 4 : i32; - v128 = arith.add v98, v127 : i32 #[overflow = wrapping]; - v130 = arith.add v128, v129 : i32 #[overflow = wrapping]; - v132 = hir.bitcast v130 : u32; - v773 = arith.constant 4 : u32; - v134 = arith.mod v132, v773 : u32; - hir.assertz v134 #[code = 250]; - v92 = arith.constant 0 : i32; - v135 = hir.int_to_ptr v132 : ptr; - hir.store v135, v92; - v772 = arith.constant 4 : u32; - v137 = hir.bitcast v98 : u32; - v139 = arith.add v137, v772 : u32 #[overflow = checked]; - v771 = arith.constant 4 : u32; - v141 = arith.mod v139, v771 : u32; - hir.assertz v141 #[code = 250]; - v136 = arith.constant 17179869184 : i64; - v142 = hir.int_to_ptr v139 : ptr; - hir.store v142, v136; - v770 = arith.constant 4 : i32; - v144 = arith.add v98, v770 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v144, v126) - v769 = arith.constant 4 : i32; - v146 = arith.add v98, v769 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v146, v121) - v768 = arith.constant 4 : i32; - v148 = arith.add v98, v768 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v148, v114) - v767 = arith.constant 4 : i32; - v150 = arith.add v98, v767 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::vec::Vec::push(v150, v107) - v153 = hir.bitcast v130 : u32; - v766 = arith.constant 4 : u32; - v155 = arith.mod v153, v766 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - v157 = hir.load v156 : i32; - v765 = arith.constant 8 : i32; - v152 = arith.add v90, v765 : i32 #[overflow = wrapping]; - v158 = hir.bitcast v152 : u32; - v764 = arith.constant 4 : u32; - v160 = arith.mod v158, v764 : u32; - hir.assertz v160 #[code = 250]; - v161 = hir.int_to_ptr v158 : ptr; - hir.store v161, v157; - v763 = arith.constant 4 : u32; - v162 = hir.bitcast v98 : u32; - v164 = arith.add v162, v763 : u32 #[overflow = checked]; - v762 = arith.constant 4 : u32; - v166 = arith.mod v164, v762 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : i64; - v169 = hir.bitcast v90 : u32; - v761 = arith.constant 4 : u32; - v171 = arith.mod v169, v761 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v168; - v760 = arith.constant 16 : i32; - v174 = arith.add v98, v760 : i32 #[overflow = wrapping]; - v175 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v176 = hir.bitcast v175 : ptr; - hir.store v176, v174; - builtin.ret ; - }; - - private builtin.function @__rustc::__rust_alloc(v177: i32, v178: i32) -> i32 { - ^block14(v177: i32, v178: i32): - v180 = arith.constant 1048604 : i32; - v181 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v180, v178, v177) : i32 - builtin.ret v181; - }; - - private builtin.function @__rustc::__rust_realloc(v182: i32, v183: i32, v184: i32, v185: i32) -> i32 { - ^block16(v182: i32, v183: i32, v184: i32, v185: i32): - v187 = arith.constant 1048604 : i32; - v188 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v187, v184, v185) : i32 - v786 = arith.constant 0 : i32; - v189 = arith.constant 0 : i32; - v190 = arith.eq v188, v189 : i1; - v191 = arith.zext v190 : u32; - v192 = hir.bitcast v191 : i32; - v194 = arith.neq v192, v786 : i1; - scf.if v194{ - ^block18: - scf.yield ; - } else { - ^block19: - v785 = arith.constant 0 : i32; - v196 = hir.bitcast v183 : u32; - v195 = hir.bitcast v185 : u32; - v197 = arith.lt v195, v196 : i1; - v198 = arith.zext v197 : u32; - v199 = hir.bitcast v198 : i32; - v201 = arith.neq v199, v785 : i1; - v202 = cf.select v201, v185, v183 : i32; - v783 = arith.constant 0 : i32; - v784 = arith.constant 0 : i32; - v204 = arith.eq v202, v784 : i1; - v205 = arith.zext v204 : u32; - v206 = hir.bitcast v205 : i32; - v208 = arith.neq v206, v783 : i1; - scf.if v208{ - ^block82: - scf.yield ; - } else { - ^block20: - v209 = hir.bitcast v202 : u32; - v210 = hir.bitcast v188 : u32; - v211 = hir.int_to_ptr v210 : ptr; - v212 = hir.bitcast v182 : u32; - v213 = hir.int_to_ptr v212 : ptr; - hir.mem_cpy v213, v211, v209; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v188; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v215: i32, v216: i32) -> i32 { - ^block21(v215: i32, v216: i32): - v218 = arith.constant 1048604 : i32; - v219 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::alloc(v218, v216, v215) : i32 - v795 = arith.constant 0 : i32; - v220 = arith.constant 0 : i32; - v221 = arith.eq v219, v220 : i1; - v222 = arith.zext v221 : u32; - v223 = hir.bitcast v222 : i32; - v225 = arith.neq v223, v795 : i1; - scf.if v225{ - ^block23: - scf.yield ; - } else { - ^block24: - v793 = arith.constant 0 : i32; - v794 = arith.constant 0 : i32; - v227 = arith.eq v215, v794 : i1; - v228 = arith.zext v227 : u32; - v229 = hir.bitcast v228 : i32; - v231 = arith.neq v229, v793 : i1; - scf.if v231{ - ^block85: - scf.yield ; - } else { - ^block25: - v787 = arith.constant 0 : u8; - v234 = hir.bitcast v215 : u32; - v235 = hir.bitcast v219 : u32; - v236 = hir.int_to_ptr v235 : ptr; - hir.mem_set v236, v234, v787; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v219; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block26: - builtin.ret ; - }; - - private builtin.function @::alloc(v238: i32, v239: i32, v240: i32) -> i32 { - ^block28(v238: i32, v239: i32, v240: i32): - v243 = arith.constant 16 : i32; - v242 = arith.constant 0 : i32; - v797 = arith.constant 16 : u32; - v245 = hir.bitcast v239 : u32; - v247 = arith.gt v245, v797 : i1; - v248 = arith.zext v247 : u32; - v249 = hir.bitcast v248 : i32; - v251 = arith.neq v249, v242 : i1; - v252 = cf.select v251, v239, v243 : i32; - v837 = arith.constant 0 : i32; - v253 = arith.constant -1 : i32; - v254 = arith.add v252, v253 : i32 #[overflow = wrapping]; - v255 = arith.band v252, v254 : i32; - v257 = arith.neq v255, v837 : i1; - v806, v807 = scf.if v257 : i32, u32 { - ^block90: - v798 = arith.constant 0 : u32; - v802 = ub.poison i32 : i32; - scf.yield v802, v798; - } else { - ^block31: - v259 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/core::ptr::alignment::Alignment::max(v239, v252) : i32 - v836 = arith.constant 0 : i32; - v258 = arith.constant -2147483648 : i32; - v260 = arith.sub v258, v259 : i32 #[overflow = wrapping]; - v262 = hir.bitcast v260 : u32; - v261 = hir.bitcast v240 : u32; - v263 = arith.gt v261, v262 : i1; - v264 = arith.zext v263 : u32; - v265 = hir.bitcast v264 : i32; - v267 = arith.neq v265, v836 : i1; - v821 = scf.if v267 : i32 { - ^block89: - v835 = ub.poison i32 : i32; - scf.yield v835; - } else { - ^block32: - v833 = arith.constant 0 : i32; - v273 = arith.sub v833, v259 : i32 #[overflow = wrapping]; - v834 = arith.constant -1 : i32; - v269 = arith.add v240, v259 : i32 #[overflow = wrapping]; - v271 = arith.add v269, v834 : i32 #[overflow = wrapping]; - v274 = arith.band v271, v273 : i32; - v275 = hir.bitcast v238 : u32; - v276 = arith.constant 4 : u32; - v277 = arith.mod v275, v276 : u32; - hir.assertz v277 #[code = 250]; - v278 = hir.int_to_ptr v275 : ptr; - v279 = hir.load v278 : i32; - v832 = arith.constant 0 : i32; - v281 = arith.neq v279, v832 : i1; - scf.if v281{ - ^block88: - scf.yield ; - } else { - ^block34: - v282 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/intrinsics::mem::heap_base() : i32 - v283 = hir.mem_size : u32; - v289 = hir.bitcast v238 : u32; - v831 = arith.constant 4 : u32; - v291 = arith.mod v289, v831 : u32; - hir.assertz v291 #[code = 250]; - v830 = arith.constant 16 : u32; - v284 = hir.bitcast v283 : i32; - v287 = arith.shl v284, v830 : i32; - v288 = arith.add v282, v287 : i32 #[overflow = wrapping]; - v292 = hir.int_to_ptr v289 : ptr; - hir.store v292, v288; - scf.yield ; - }; - v295 = hir.bitcast v238 : u32; - v829 = arith.constant 4 : u32; - v297 = arith.mod v295, v829 : u32; - hir.assertz v297 #[code = 250]; - v298 = hir.int_to_ptr v295 : ptr; - v299 = hir.load v298 : i32; - v827 = arith.constant 0 : i32; - v828 = arith.constant -1 : i32; - v301 = arith.bxor v299, v828 : i32; - v303 = hir.bitcast v301 : u32; - v302 = hir.bitcast v274 : u32; - v304 = arith.gt v302, v303 : i1; - v305 = arith.zext v304 : u32; - v306 = hir.bitcast v305 : i32; - v308 = arith.neq v306, v827 : i1; - v820 = scf.if v308 : i32 { - ^block35: - v826 = arith.constant 0 : i32; - scf.yield v826; - } else { - ^block36: - v310 = hir.bitcast v238 : u32; - v825 = arith.constant 4 : u32; - v312 = arith.mod v310, v825 : u32; - hir.assertz v312 #[code = 250]; - v309 = arith.add v299, v274 : i32 #[overflow = wrapping]; - v313 = hir.int_to_ptr v310 : ptr; - hir.store v313, v309; - v315 = arith.add v299, v259 : i32 #[overflow = wrapping]; - scf.yield v315; - }; - scf.yield v820; - }; - v803 = arith.constant 1 : u32; - v824 = arith.constant 0 : u32; - v822 = cf.select v267, v824, v803 : u32; - scf.yield v821, v822; - }; - v823 = arith.constant 0 : u32; - v819 = arith.eq v807, v823 : i1; - cf.cond_br v819 ^block30, ^block92(v806); - ^block30: - ub.unreachable ; - ^block92(v799: i32): - builtin.ret v799; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block37: - v318 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v318; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v320: i32, v321: i32, v322: i32, v323: i32, v324: i32, v325: i32) { - ^block41(v320: i32, v321: i32, v322: i32, v323: i32, v324: i32, v325: i32): - v328 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v329 = hir.bitcast v328 : ptr; - v330 = hir.load v329 : i32; - v331 = arith.constant 32 : i32; - v332 = arith.sub v330, v331 : i32 #[overflow = wrapping]; - v333 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v334 = hir.bitcast v333 : ptr; - hir.store v334, v332; - v914 = arith.constant 0 : i32; - v326 = arith.constant 0 : i32; - v337 = arith.eq v325, v326 : i1; - v338 = arith.zext v337 : u32; - v339 = hir.bitcast v338 : i32; - v341 = arith.neq v339, v914 : i1; - v885, v886 = scf.if v341 : i32, i32 { - ^block44: - v913 = arith.constant 0 : i32; - scf.yield v913, v913; - } else { - ^block45: - v342 = arith.add v322, v323 : i32 #[overflow = wrapping]; - v912 = arith.constant 0 : i32; - v344 = hir.bitcast v322 : u32; - v343 = hir.bitcast v342 : u32; - v345 = arith.lt v343, v344 : i1; - v346 = arith.zext v345 : u32; - v347 = hir.bitcast v346 : i32; - v349 = arith.neq v347, v912 : i1; - v883, v884 = scf.if v349 : i32, i32 { - ^block98: - v911 = arith.constant 0 : i32; - scf.yield v911, v911; - } else { - ^block46: - v360 = hir.bitcast v321 : u32; - v474 = arith.constant 4 : u32; - v362 = arith.mod v360, v474 : u32; - hir.assertz v362 #[code = 250]; - v363 = hir.int_to_ptr v360 : ptr; - v364 = hir.load v363 : i32; - v839 = arith.constant 1 : u32; - v367 = arith.shl v364, v839 : i32; - v910 = arith.constant 0 : i32; - v369 = hir.bitcast v367 : u32; - v368 = hir.bitcast v342 : u32; - v370 = arith.gt v368, v369 : i1; - v371 = arith.zext v370 : u32; - v372 = hir.bitcast v371 : i32; - v374 = arith.neq v372, v910 : i1; - v375 = cf.select v374, v342, v367 : i32; - v907 = arith.constant 1 : i32; - v377 = arith.constant 4 : i32; - v908 = arith.constant 0 : i32; - v838 = arith.constant 1025 : u32; - v380 = hir.bitcast v325 : u32; - v382 = arith.lt v380, v838 : i1; - v383 = arith.zext v382 : u32; - v384 = hir.bitcast v383 : i32; - v386 = arith.neq v384, v908 : i1; - v387 = cf.select v386, v377, v907 : i32; - v376 = arith.constant 8 : i32; - v909 = arith.constant 0 : i32; - v365 = arith.constant 1 : i32; - v389 = arith.eq v325, v365 : i1; - v390 = arith.zext v389 : u32; - v391 = hir.bitcast v390 : i32; - v393 = arith.neq v391, v909 : i1; - v394 = cf.select v393, v376, v387 : i32; - v906 = arith.constant 0 : i32; - v396 = hir.bitcast v394 : u32; - v395 = hir.bitcast v375 : u32; - v397 = arith.gt v395, v396 : i1; - v398 = arith.zext v397 : u32; - v399 = hir.bitcast v398 : i32; - v401 = arith.neq v399, v906 : i1; - v402 = cf.select v401, v375, v394 : i32; - v403 = hir.bitcast v402 : u32; - v404 = arith.zext v403 : u64; - v405 = hir.bitcast v404 : i64; - v905 = arith.constant 0 : i32; - v355 = arith.sub v905, v324 : i32 #[overflow = wrapping]; - v352 = arith.constant -1 : i32; - v351 = arith.add v324, v325 : i32 #[overflow = wrapping]; - v353 = arith.add v351, v352 : i32 #[overflow = wrapping]; - v356 = arith.band v353, v355 : i32; - v357 = hir.bitcast v356 : u32; - v358 = arith.zext v357 : u64; - v359 = hir.bitcast v358 : i64; - v406 = arith.mul v359, v405 : i64 #[overflow = wrapping]; - v904 = arith.constant 0 : i32; - v407 = arith.constant 32 : i64; - v409 = hir.cast v407 : u32; - v408 = hir.bitcast v406 : u64; - v410 = arith.shr v408, v409 : u64; - v411 = hir.bitcast v410 : i64; - v412 = arith.trunc v411 : i32; - v414 = arith.neq v412, v904 : i1; - v881, v882 = scf.if v414 : i32, i32 { - ^block97: - v903 = arith.constant 0 : i32; - scf.yield v375, v903; - } else { - ^block47: - v415 = arith.trunc v406 : i32; - v902 = arith.constant 0 : i32; - v416 = arith.constant -2147483648 : i32; - v417 = arith.sub v416, v324 : i32 #[overflow = wrapping]; - v419 = hir.bitcast v417 : u32; - v418 = hir.bitcast v415 : u32; - v420 = arith.gt v418, v419 : i1; - v421 = arith.zext v420 : u32; - v422 = hir.bitcast v421 : i32; - v424 = arith.neq v422, v902 : i1; - v879, v880 = scf.if v424 : i32, i32 { - ^block96: - v901 = arith.constant 0 : i32; - scf.yield v375, v901; - } else { - ^block48: - v425 = arith.constant 20 : i32; - v426 = arith.add v332, v425 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v426, v321, v324, v325) - v899 = arith.constant 20 : i32; - v430 = arith.add v332, v899 : i32 #[overflow = wrapping]; - v900 = arith.constant 8 : i32; - v428 = arith.add v332, v900 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::raw_vec::finish_grow(v428, v324, v415, v430, v320) - v432 = arith.constant 12 : u32; - v431 = hir.bitcast v332 : u32; - v433 = arith.add v431, v432 : u32 #[overflow = checked]; - v898 = arith.constant 4 : u32; - v435 = arith.mod v433, v898 : u32; - hir.assertz v435 #[code = 250]; - v436 = hir.int_to_ptr v433 : ptr; - v437 = hir.load v436 : i32; - v439 = arith.constant 8 : u32; - v438 = hir.bitcast v332 : u32; - v440 = arith.add v438, v439 : u32 #[overflow = checked]; - v897 = arith.constant 4 : u32; - v442 = arith.mod v440, v897 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - v444 = hir.load v443 : i32; - v895 = arith.constant 0 : i32; - v896 = arith.constant 0 : i32; - v446 = arith.eq v444, v896 : i1; - v447 = arith.zext v446 : u32; - v448 = hir.bitcast v447 : i32; - v450 = arith.neq v448, v895 : i1; - v877 = scf.if v450 : i32 { - ^block49: - v458 = hir.bitcast v321 : u32; - v894 = arith.constant 4 : u32; - v460 = arith.mod v458, v894 : u32; - hir.assertz v460 #[code = 250]; - v461 = hir.int_to_ptr v458 : ptr; - hir.store v461, v402; - v893 = arith.constant 4 : u32; - v462 = hir.bitcast v321 : u32; - v464 = arith.add v462, v893 : u32 #[overflow = checked]; - v892 = arith.constant 4 : u32; - v466 = arith.mod v464, v892 : u32; - hir.assertz v466 #[code = 250]; - v467 = hir.int_to_ptr v464 : ptr; - hir.store v467, v437; - scf.yield v375; - } else { - ^block50: - v452 = arith.constant 16 : u32; - v451 = hir.bitcast v332 : u32; - v453 = arith.add v451, v452 : u32 #[overflow = checked]; - v891 = arith.constant 4 : u32; - v455 = arith.mod v453, v891 : u32; - hir.assertz v455 #[code = 250]; - v456 = hir.int_to_ptr v453 : ptr; - v457 = hir.load v456 : i32; - scf.yield v457; - }; - v468 = arith.constant -2147483647 : i32; - v878 = cf.select v450, v468, v437 : i32; - scf.yield v877, v878; - }; - scf.yield v879, v880; - }; - scf.yield v881, v882; - }; - scf.yield v883, v884; - }; - v890 = arith.constant 4 : u32; - v473 = hir.bitcast v320 : u32; - v475 = arith.add v473, v890 : u32 #[overflow = checked]; - v889 = arith.constant 4 : u32; - v477 = arith.mod v475, v889 : u32; - hir.assertz v477 #[code = 250]; - v478 = hir.int_to_ptr v475 : ptr; - hir.store v478, v885; - v481 = hir.bitcast v320 : u32; - v888 = arith.constant 4 : u32; - v483 = arith.mod v481, v888 : u32; - hir.assertz v483 #[code = 250]; - v484 = hir.int_to_ptr v481 : ptr; - hir.store v484, v886; - v887 = arith.constant 32 : i32; - v488 = arith.add v332, v887 : i32 #[overflow = wrapping]; - v489 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v490 = hir.bitcast v489 : ptr; - hir.store v490, v488; - builtin.ret ; - }; - - private builtin.function @::allocate(v491: i32, v492: i32, v493: i32) { - ^block51(v491: i32, v492: i32, v493: i32): - v495 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v496 = hir.bitcast v495 : ptr; - v497 = hir.load v496 : i32; - v498 = arith.constant 16 : i32; - v499 = arith.sub v497, v498 : i32 #[overflow = wrapping]; - v500 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v501 = hir.bitcast v500 : ptr; - hir.store v501, v499; - v494 = arith.constant 0 : i32; - v502 = arith.constant 8 : i32; - v503 = arith.add v499, v502 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v503, v492, v493, v494) - v506 = arith.constant 12 : u32; - v505 = hir.bitcast v499 : u32; - v507 = arith.add v505, v506 : u32 #[overflow = checked]; - v508 = arith.constant 4 : u32; - v509 = arith.mod v507, v508 : u32; - hir.assertz v509 #[code = 250]; - v510 = hir.int_to_ptr v507 : ptr; - v511 = hir.load v510 : i32; - v513 = arith.constant 8 : u32; - v512 = hir.bitcast v499 : u32; - v514 = arith.add v512, v513 : u32 #[overflow = checked]; - v919 = arith.constant 4 : u32; - v516 = arith.mod v514, v919 : u32; - hir.assertz v516 #[code = 250]; - v517 = hir.int_to_ptr v514 : ptr; - v518 = hir.load v517 : i32; - v519 = hir.bitcast v491 : u32; - v918 = arith.constant 4 : u32; - v521 = arith.mod v519, v918 : u32; - hir.assertz v521 #[code = 250]; - v522 = hir.int_to_ptr v519 : ptr; - hir.store v522, v518; - v917 = arith.constant 4 : u32; - v523 = hir.bitcast v491 : u32; - v525 = arith.add v523, v917 : u32 #[overflow = checked]; - v916 = arith.constant 4 : u32; - v527 = arith.mod v525, v916 : u32; - hir.assertz v527 #[code = 250]; - v528 = hir.int_to_ptr v525 : ptr; - hir.store v528, v511; - v915 = arith.constant 16 : i32; - v530 = arith.add v499, v915 : i32 #[overflow = wrapping]; - v531 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v532 = hir.bitcast v531 : ptr; - hir.store v532, v530; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v533: i32, v534: i32, v535: i32, v536: i32) { - ^block53(v533: i32, v534: i32, v535: i32, v536: i32): - v935 = arith.constant 0 : i32; - v537 = arith.constant 0 : i32; - v538 = arith.eq v535, v537 : i1; - v539 = arith.zext v538 : u32; - v540 = hir.bitcast v539 : i32; - v542 = arith.neq v540, v935 : i1; - v931 = scf.if v542 : i32 { - ^block104: - scf.yield v534; - } else { - ^block56: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v934 = arith.constant 0 : i32; - v544 = arith.neq v536, v934 : i1; - v930 = scf.if v544 : i32 { - ^block57: - v546 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc_zeroed(v535, v534) : i32 - scf.yield v546; - } else { - ^block58: - v545 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_alloc(v535, v534) : i32 - scf.yield v545; - }; - scf.yield v930; - }; - v550 = arith.constant 4 : u32; - v549 = hir.bitcast v533 : u32; - v551 = arith.add v549, v550 : u32 #[overflow = checked]; - v933 = arith.constant 4 : u32; - v553 = arith.mod v551, v933 : u32; - hir.assertz v553 #[code = 250]; - v554 = hir.int_to_ptr v551 : ptr; - hir.store v554, v535; - v556 = hir.bitcast v533 : u32; - v932 = arith.constant 4 : u32; - v558 = arith.mod v556, v932 : u32; - hir.assertz v558 #[code = 250]; - v559 = hir.int_to_ptr v556 : ptr; - hir.store v559, v931; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v560: i32, v561: i32, v562: i32, v563: i32) { - ^block59(v560: i32, v561: i32, v562: i32, v563: i32): - v961 = arith.constant 0 : i32; - v564 = arith.constant 0 : i32; - v568 = arith.eq v563, v564 : i1; - v569 = arith.zext v568 : u32; - v570 = hir.bitcast v569 : i32; - v572 = arith.neq v570, v961 : i1; - v948, v949 = scf.if v572 : i32, i32 { - ^block108: - v960 = arith.constant 0 : i32; - v566 = arith.constant 4 : i32; - scf.yield v566, v960; - } else { - ^block62: - v573 = hir.bitcast v561 : u32; - v608 = arith.constant 4 : u32; - v575 = arith.mod v573, v608 : u32; - hir.assertz v575 #[code = 250]; - v576 = hir.int_to_ptr v573 : ptr; - v577 = hir.load v576 : i32; - v958 = arith.constant 0 : i32; - v959 = arith.constant 0 : i32; - v579 = arith.eq v577, v959 : i1; - v580 = arith.zext v579 : u32; - v581 = hir.bitcast v580 : i32; - v583 = arith.neq v581, v958 : i1; - v946 = scf.if v583 : i32 { - ^block107: - v957 = arith.constant 0 : i32; - scf.yield v957; - } else { - ^block63: - v956 = arith.constant 4 : u32; - v584 = hir.bitcast v560 : u32; - v586 = arith.add v584, v956 : u32 #[overflow = checked]; - v955 = arith.constant 4 : u32; - v588 = arith.mod v586, v955 : u32; - hir.assertz v588 #[code = 250]; - v589 = hir.int_to_ptr v586 : ptr; - hir.store v589, v562; - v954 = arith.constant 4 : u32; - v590 = hir.bitcast v561 : u32; - v592 = arith.add v590, v954 : u32 #[overflow = checked]; - v953 = arith.constant 4 : u32; - v594 = arith.mod v592, v953 : u32; - hir.assertz v594 #[code = 250]; - v595 = hir.int_to_ptr v592 : ptr; - v596 = hir.load v595 : i32; - v597 = hir.bitcast v560 : u32; - v952 = arith.constant 4 : u32; - v599 = arith.mod v597, v952 : u32; - hir.assertz v599 #[code = 250]; - v600 = hir.int_to_ptr v597 : ptr; - hir.store v600, v596; - v601 = arith.mul v577, v563 : i32 #[overflow = wrapping]; - scf.yield v601; - }; - v602 = arith.constant 8 : i32; - v951 = arith.constant 4 : i32; - v947 = cf.select v583, v951, v602 : i32; - scf.yield v947, v946; - }; - v605 = arith.add v560, v948 : i32 #[overflow = wrapping]; - v607 = hir.bitcast v605 : u32; - v950 = arith.constant 4 : u32; - v609 = arith.mod v607, v950 : u32; - hir.assertz v609 #[code = 250]; - v610 = hir.int_to_ptr v607 : ptr; - hir.store v610, v949; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::finish_grow(v611: i32, v612: i32, v613: i32, v614: i32, v615: i32) { - ^block64(v611: i32, v612: i32, v613: i32, v614: i32, v615: i32): - v617 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v618 = hir.bitcast v617 : ptr; - v619 = hir.load v618 : i32; - v620 = arith.constant 16 : i32; - v621 = arith.sub v619, v620 : i32 #[overflow = wrapping]; - v622 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v623 = hir.bitcast v622 : ptr; - hir.store v623, v621; - v1016 = arith.constant 0 : i32; - v616 = arith.constant 0 : i32; - v626 = arith.gte v613, v616 : i1; - v627 = arith.zext v626 : u32; - v628 = hir.bitcast v627 : i32; - v630 = arith.neq v628, v1016 : i1; - v990, v991 = scf.if v630 : i32, i32 { - ^block67: - v717 = arith.constant 4 : u32; - v633 = hir.bitcast v614 : u32; - v635 = arith.add v633, v717 : u32 #[overflow = checked]; - v1015 = arith.constant 4 : u32; - v637 = arith.mod v635, v1015 : u32; - hir.assertz v637 #[code = 250]; - v638 = hir.int_to_ptr v635 : ptr; - v639 = hir.load v638 : i32; - v1013 = arith.constant 0 : i32; - v1014 = arith.constant 0 : i32; - v641 = arith.eq v639, v1014 : i1; - v642 = arith.zext v641 : u32; - v643 = hir.bitcast v642 : i32; - v645 = arith.neq v643, v1013 : i1; - v988, v989 = scf.if v645 : i32, i32 { - ^block70: - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/::allocate(v621, v612, v613) - v1012 = arith.constant 4 : u32; - v678 = hir.bitcast v621 : u32; - v680 = arith.add v678, v1012 : u32 #[overflow = checked]; - v1011 = arith.constant 4 : u32; - v682 = arith.mod v680, v1011 : u32; - hir.assertz v682 #[code = 250]; - v683 = hir.int_to_ptr v680 : ptr; - v684 = hir.load v683 : i32; - v685 = hir.bitcast v621 : u32; - v1010 = arith.constant 4 : u32; - v687 = arith.mod v685, v1010 : u32; - hir.assertz v687 #[code = 250]; - v688 = hir.int_to_ptr v685 : ptr; - v689 = hir.load v688 : i32; - scf.yield v689, v684; - } else { - ^block71: - v647 = arith.constant 8 : u32; - v646 = hir.bitcast v614 : u32; - v648 = arith.add v646, v647 : u32 #[overflow = checked]; - v1009 = arith.constant 4 : u32; - v650 = arith.mod v648, v1009 : u32; - hir.assertz v650 #[code = 250]; - v651 = hir.int_to_ptr v648 : ptr; - v652 = hir.load v651 : i32; - v1008 = arith.constant 0 : i32; - v654 = arith.neq v652, v1008 : i1; - v986, v987 = scf.if v654 : i32, i32 { - ^block72: - v672 = hir.bitcast v614 : u32; - v1007 = arith.constant 4 : u32; - v674 = arith.mod v672, v1007 : u32; - hir.assertz v674 #[code = 250]; - v675 = hir.int_to_ptr v672 : ptr; - v676 = hir.load v675 : i32; - v677 = hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/__rustc::__rust_realloc(v676, v652, v612, v613) : i32 - scf.yield v677, v613; - } else { - ^block73: - v1006 = arith.constant 0 : i32; - v711 = arith.constant 8 : i32; - v656 = arith.add v621, v711 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_four_felts_struct/alloc::alloc::Global::alloc_impl(v656, v612, v613, v1006) - v659 = arith.constant 12 : u32; - v658 = hir.bitcast v621 : u32; - v660 = arith.add v658, v659 : u32 #[overflow = checked]; - v1005 = arith.constant 4 : u32; - v662 = arith.mod v660, v1005 : u32; - hir.assertz v662 #[code = 250]; - v663 = hir.int_to_ptr v660 : ptr; - v664 = hir.load v663 : i32; - v1004 = arith.constant 8 : u32; - v665 = hir.bitcast v621 : u32; - v667 = arith.add v665, v1004 : u32 #[overflow = checked]; - v1003 = arith.constant 4 : u32; - v669 = arith.mod v667, v1003 : u32; - hir.assertz v669 #[code = 250]; - v670 = hir.int_to_ptr v667 : ptr; - v671 = hir.load v670 : i32; - scf.yield v671, v664; - }; - scf.yield v986, v987; - }; - v1002 = arith.constant 4 : u32; - v696 = hir.bitcast v611 : u32; - v698 = arith.add v696, v1002 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v700 = arith.mod v698, v1001 : u32; - hir.assertz v700 #[code = 250]; - v1000 = arith.constant 0 : i32; - v694 = arith.neq v988, v1000 : i1; - v695 = cf.select v694, v988, v612 : i32; - v701 = hir.int_to_ptr v698 : ptr; - hir.store v701, v695; - v998 = arith.constant 0 : i32; - v708 = arith.eq v988, v998 : i1; - v709 = arith.zext v708 : u32; - v710 = hir.bitcast v709 : i32; - v999 = arith.constant 0 : i32; - v705 = arith.neq v988, v999 : i1; - v706 = cf.select v705, v989, v613 : i32; - scf.yield v706, v710; - } else { - ^block68: - v631 = arith.constant 1 : i32; - v997 = arith.constant 0 : i32; - scf.yield v997, v631; - }; - v632 = arith.constant 4 : i32; - v996 = arith.constant 8 : i32; - v992 = cf.select v630, v996, v632 : i32; - v714 = arith.add v611, v992 : i32 #[overflow = wrapping]; - v716 = hir.bitcast v714 : u32; - v995 = arith.constant 4 : u32; - v718 = arith.mod v716, v995 : u32; - hir.assertz v718 #[code = 250]; - v719 = hir.int_to_ptr v716 : ptr; - hir.store v719, v990; - v721 = hir.bitcast v611 : u32; - v994 = arith.constant 4 : u32; - v723 = arith.mod v721, v994 : u32; - hir.assertz v723 #[code = 250]; - v724 = hir.int_to_ptr v721 : ptr; - hir.store v724, v991; - v993 = arith.constant 16 : i32; - v728 = arith.add v621, v993 : i32 #[overflow = wrapping]; - v729 = builtin.global_symbol @root_ns:root@1.0.0/onchain_four_felts_struct/__stack_pointer : ptr - v730 = hir.bitcast v729 : ptr; - hir.store v730, v728; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v731: i32, v732: i32, v733: i32) { - ^block74(v731: i32, v732: i32, v733: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v734: i32, v735: i32) -> i32 { - ^block76(v734: i32, v735: i32): - v742 = arith.constant 0 : i32; - v738 = hir.bitcast v735 : u32; - v737 = hir.bitcast v734 : u32; - v739 = arith.gt v737, v738 : i1; - v740 = arith.zext v739 : u32; - v741 = hir.bitcast v740 : i32; - v743 = arith.neq v741, v742 : i1; - v744 = cf.select v743, v734, v735 : i32; - builtin.ret v744; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; - }; -}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.masm b/felt-repr/tests/expected/onchain_four_felts_struct.masm deleted file mode 100644 index 1223b88cf..000000000 --- a/felt-repr/tests/expected/onchain_four_felts_struct.masm +++ /dev/null @@ -1,1915 +0,0 @@ -# mod root_ns:root@1.0.0 - -proc init - push.1179648 - trace.240 - exec.::intrinsics::mem::heap_init - trace.252 - push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] - adv.push_mapval - push.262144 - push.2 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop - push.1048576 - u32assert - mem_store.278536 -end - -# mod root_ns:root@1.0.0::onchain_four_felts_struct - -@callconv("C") -proc alloc::vec::Vec::push(i32, felt) - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - swap.1 - dup.2 - neq - neq - if.true - nop - else - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVec::grow_one - trace.252 - nop - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.2 - swap.1 - u32shl - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVec::grow_one(i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - push.1 - push.8 - dup.4 - u32wrapping_add - dup.2 - movup.2 - swap.3 - swap.4 - movdn.2 - swap.5 - swap.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::grow_amortized - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.2147483649 - dup.2 - eq - neq - if.true - drop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -pub proc entrypoint(i32, i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - push.4 - dup.6 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - push.4 - movup.2 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.5 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.4 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.3 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 - dup.5 - swap.1 - u32lt - neq - swap.1 - swap.4 - swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - swap.1 - drop - else - push.0 - push.0 - dup.3 - eq - neq - if.true - swap.1 - drop - else - push.0 - movup.2 - dup.2 - push.0 - dup.2 - push.0 - gte - while.true - dup.1 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.4 - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.3 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop -end - -@callconv("C") -proc ::alloc( - i32, - i32, - i32 -) -> i32 - push.16 - push.0 - push.16 - dup.4 - swap.1 - u32gt - neq - dup.3 - swap.1 - cdrop - push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 - else - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::core::ptr::alignment::Alignment::max - trace.252 - nop - push.0 - push.2147483648 - dup.2 - u32wrapping_sub - dup.4 - swap.1 - u32gt - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - else - push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop - exec.::intrinsics::mem::memory_size - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.16 - movup.2 - swap.1 - u32shl - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.4294967295 - dup.2 - u32xor - dup.3 - swap.1 - u32gt - neq - if.true - drop - drop - movdn.2 - drop - drop - push.0 - else - movup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - u32wrapping_add - end - end - push.1 - push.0 - movup.3 - cdrop - swap.1 - end - push.0 - movup.2 - eq - if.true - drop - push.0 - assert - else - nop - end -end - -@callconv("C") -proc intrinsics::mem::heap_base( - -) -> i32 - trace.240 - nop - exec.::intrinsics::mem::heap_base - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::grow_amortized( - i32, - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.8 - eq - neq - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - movup.4 - dup.4 - u32wrapping_add - push.0 - movup.5 - dup.2 - swap.1 - u32lt - neq - if.true - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1 - u32shl - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - movup.2 - swap.1 - cdrop - push.1 - push.4 - push.0 - push.1025 - dup.9 - swap.1 - u32lt - neq - cdrop - push.8 - push.0 - push.1 - dup.9 - eq - neq - cdrop - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - dup.2 - swap.1 - cdrop - dup.0 - push.0 - push.0 - dup.8 - u32wrapping_sub - push.4294967295 - dup.9 - dup.11 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - drop - push.0 - push.2147483648 - dup.8 - u32wrapping_sub - dup.2 - swap.1 - u32gt - neq - if.true - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - push.20 - dup.4 - u32wrapping_add - dup.6 - dup.8 - movup.3 - swap.10 - movdn.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.20 - dup.3 - u32wrapping_add - push.8 - dup.4 - u32wrapping_add - dup.5 - movup.2 - swap.3 - swap.9 - movdn.2 - swap.4 - swap.8 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::raw_vec::finish_grow - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.7 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.4 - else - movup.2 - swap.6 - movdn.2 - swap.1 - swap.5 - swap.1 - swap.4 - drop - drop - drop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - end - push.2147483649 - movdn.2 - movdn.3 - cdrop - swap.1 - end - end - end - end - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.8 - dup.2 - u32wrapping_add - movup.2 - swap.5 - movdn.2 - swap.1 - swap.3 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - movup.3 - drop - swap.1 - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.0 - movup.4 - neq - if.true - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_alloc - trace.252 - nop - end - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq - if.true - movdn.3 - drop - drop - drop - push.0 - push.4 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - else - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.3 - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - movup.2 - swap.1 - end - push.8 - push.4 - movup.3 - cdrop - end - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) - movup.4 - drop - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.5 - swap.1 - trace.240 - nop - exec.::intrinsics::i32::is_gte - trace.252 - nop - neq - dup.0 - if.true - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - if.true - movup.5 - drop - dup.4 - dup.4 - dup.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::::allocate - trace.252 - nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - dup.1 - neq - if.true - movup.6 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.5 - dup.7 - swap.3 - swap.1 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::__rustc::__rust_realloc - trace.252 - nop - dup.5 - swap.1 - else - movup.6 - swap.1 - drop - drop - push.0 - push.8 - dup.3 - u32wrapping_add - dup.5 - dup.7 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_four_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - end - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - dup.2 - neq - dup.2 - movup.2 - swap.8 - movdn.2 - swap.1 - cdrop - movup.6 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - dup.1 - eq - push.0 - movup.2 - neq - swap.1 - swap.6 - swap.2 - swap.1 - cdrop - movup.4 - swap.1 - else - movup.2 - swap.5 - movdn.2 - swap.1 - swap.4 - swap.1 - swap.3 - drop - drop - drop - push.1 - push.0 - end - push.4 - push.8 - movup.4 - cdrop - dup.4 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop - drop - drop - push.0 - assert -end - -@callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 - push.0 - dup.2 - dup.2 - swap.1 - u32gt - neq - cdrop -end - diff --git a/felt-repr/tests/expected/onchain_four_felts_struct.wat b/felt-repr/tests/expected/onchain_four_felts_struct.wat deleted file mode 100644 index c66b2d4e9..000000000 --- a/felt-repr/tests/expected/onchain_four_felts_struct.wat +++ /dev/null @@ -1,605 +0,0 @@ -(module $onchain_four_felts_struct.wasm - (type (;0;) (func (param i32 f32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32 i32 i32) (result i32))) - (type (;5;) (func)) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func (result i32))) - (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;9;) (func (param i32 i32 i32))) - (type (;10;) (func (param i32 i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32 i32))) - (table (;0;) 1 1 funcref) - (memory (;0;) 17) - (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) - (export "memory" (memory 0)) - (export "entrypoint" (func $entrypoint)) - (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) - (local i32) - block ;; label = @1 - local.get 0 - i32.load offset=8 - local.tee 2 - local.get 0 - i32.load - i32.ne - br_if 0 (;@1;) - local.get 0 - call $alloc::raw_vec::RawVec::grow_one - end - local.get 0 - i32.load offset=4 - local.get 2 - i32.const 2 - i32.shl - i32.add - local.get 1 - f32.store - local.get 0 - local.get 2 - i32.const 1 - i32.add - i32.store offset=8 - ) - (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - i32.const 8 - i32.add - local.get 0 - local.get 0 - i32.load - i32.const 1 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::grow_amortized - block ;; label = @1 - local.get 1 - i32.load offset=8 - local.tee 0 - i32.const -2147483647 - i32.eq - br_if 0 (;@1;) - local.get 0 - local.get 1 - i32.load offset=12 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 f32 f32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 2 - global.set $__stack_pointer - local.get 1 - f32.load offset=12 - local.set 3 - local.get 1 - f32.load offset=8 - local.set 4 - local.get 1 - f32.load offset=4 - local.set 5 - local.get 1 - f32.load - local.set 6 - local.get 2 - i32.const 4 - i32.add - i32.const 8 - i32.add - local.tee 1 - i32.const 0 - i32.store - local.get 2 - i64.const 17179869184 - i64.store offset=4 align=4 - local.get 2 - i32.const 4 - i32.add - local.get 6 - call $alloc::vec::Vec::push - local.get 2 - i32.const 4 - i32.add - local.get 5 - call $alloc::vec::Vec::push - local.get 2 - i32.const 4 - i32.add - local.get 4 - call $alloc::vec::Vec::push - local.get 2 - i32.const 4 - i32.add - local.get 3 - call $alloc::vec::Vec::push - local.get 0 - i32.const 8 - i32.add - local.get 1 - i32.load - i32.store - local.get 0 - local.get 2 - i64.load offset=4 align=4 - i64.store align=4 - local.get 2 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 2 - local.get 3 - call $::alloc - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - local.get 1 - local.get 3 - local.get 1 - i32.lt_u - select - local.tee 3 - i32.eqz - br_if 0 (;@1;) - local.get 2 - local.get 0 - local.get 3 - memory.copy - end - local.get 2 - ) - (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - local.tee 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.const 0 - local.get 0 - memory.fill - end - local.get 1 - ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) - return - ) - (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) - (local i32 i32) - block ;; label = @1 - local.get 1 - i32.const 16 - local.get 1 - i32.const 16 - i32.gt_u - select - local.tee 3 - local.get 3 - i32.const -1 - i32.add - i32.and - br_if 0 (;@1;) - local.get 2 - i32.const -2147483648 - local.get 1 - local.get 3 - call $core::ptr::alignment::Alignment::max - local.tee 1 - i32.sub - i32.gt_u - br_if 0 (;@1;) - i32.const 0 - local.set 3 - local.get 2 - local.get 1 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 1 - i32.sub - i32.and - local.set 2 - block ;; label = @2 - local.get 0 - i32.load - br_if 0 (;@2;) - local.get 0 - call $intrinsics::mem::heap_base - memory.size - i32.const 16 - i32.shl - i32.add - i32.store - end - block ;; label = @2 - local.get 2 - local.get 0 - i32.load - local.tee 4 - i32.const -1 - i32.xor - i32.gt_u - br_if 0 (;@2;) - local.get 0 - local.get 4 - local.get 2 - i32.add - i32.store - local.get 4 - local.get 1 - i32.add - local.set 3 - end - local.get 3 - return - end - unreachable - ) - (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) - unreachable - ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) - (local i32 i32 i32 i64) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 6 - global.set $__stack_pointer - i32.const 0 - local.set 7 - block ;; label = @1 - block ;; label = @2 - local.get 5 - i32.eqz - br_if 0 (;@2;) - local.get 2 - local.get 3 - i32.add - local.tee 3 - local.get 2 - i32.lt_u - br_if 1 (;@1;) - i32.const 0 - local.set 7 - local.get 4 - local.get 5 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 4 - i32.sub - i32.and - i64.extend_i32_u - local.get 3 - local.get 1 - i32.load - i32.const 1 - i32.shl - local.tee 8 - local.get 3 - local.get 8 - i32.gt_u - select - local.tee 8 - i32.const 8 - i32.const 4 - i32.const 1 - local.get 5 - i32.const 1025 - i32.lt_u - select - local.get 5 - i32.const 1 - i32.eq - select - local.tee 2 - local.get 8 - local.get 2 - i32.gt_u - select - local.tee 2 - i64.extend_i32_u - i64.mul - local.tee 9 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@2;) - local.get 9 - i32.wrap_i64 - local.tee 3 - i32.const -2147483648 - local.get 4 - i32.sub - i32.gt_u - br_if 1 (;@1;) - local.get 6 - i32.const 20 - i32.add - local.get 1 - local.get 4 - local.get 5 - call $alloc::raw_vec::RawVecInner::current_memory - local.get 6 - i32.const 8 - i32.add - local.get 4 - local.get 3 - local.get 6 - i32.const 20 - i32.add - local.get 0 - call $alloc::raw_vec::finish_grow - local.get 6 - i32.load offset=12 - local.set 7 - block ;; label = @3 - local.get 6 - i32.load offset=8 - i32.eqz - br_if 0 (;@3;) - local.get 6 - i32.load offset=16 - local.set 8 - br 2 (;@1;) - end - local.get 1 - local.get 2 - i32.store - local.get 1 - local.get 7 - i32.store offset=4 - i32.const -2147483647 - local.set 7 - br 1 (;@1;) - end - end - local.get 0 - local.get 8 - i32.store offset=4 - local.get 0 - local.get 7 - i32.store - local.get 6 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;10;) (type 9) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 3 - i32.load offset=12 - local.set 2 - local.get 0 - local.get 3 - i32.load offset=8 - i32.store - local.get 0 - local.get 2 - i32.store offset=4 - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::alloc::Global::alloc_impl (;11;) (type 10) (param i32 i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @2 - local.get 3 - br_if 0 (;@2;) - local.get 2 - local.get 1 - call $__rustc::__rust_alloc - local.set 1 - br 1 (;@1;) - end - local.get 2 - local.get 1 - call $__rustc::__rust_alloc_zeroed - local.set 1 - end - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.store - ) - (func $alloc::raw_vec::RawVecInner::current_memory (;12;) (type 10) (param i32 i32 i32 i32) - (local i32 i32 i32) - i32.const 0 - local.set 4 - i32.const 4 - local.set 5 - block ;; label = @1 - local.get 3 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.load - local.tee 6 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.load offset=4 - i32.store - local.get 6 - local.get 3 - i32.mul - local.set 4 - i32.const 8 - local.set 5 - end - local.get 0 - local.get 5 - i32.add - local.get 4 - i32.store - ) - (func $alloc::raw_vec::finish_grow (;13;) (type 11) (param i32 i32 i32 i32 i32) - (local i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - i32.const 0 - local.set 6 - block ;; label = @1 - block ;; label = @2 - local.get 2 - i32.const 0 - i32.ge_s - br_if 0 (;@2;) - i32.const 1 - local.set 2 - i32.const 4 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 3 - i32.load offset=4 - i32.eqz - br_if 0 (;@3;) - block ;; label = @4 - local.get 3 - i32.load offset=8 - local.tee 6 - br_if 0 (;@4;) - local.get 5 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load offset=12 - local.set 6 - local.get 5 - i32.load offset=8 - local.set 3 - br 2 (;@2;) - end - local.get 3 - i32.load - local.get 6 - local.get 1 - local.get 2 - call $__rustc::__rust_realloc - local.set 3 - local.get 2 - local.set 6 - br 1 (;@2;) - end - local.get 5 - local.get 1 - local.get 2 - call $::allocate - local.get 5 - i32.load offset=4 - local.set 6 - local.get 5 - i32.load - local.set 3 - end - local.get 0 - local.get 3 - local.get 1 - local.get 3 - select - i32.store offset=4 - local.get 6 - local.get 2 - local.get 3 - select - local.set 6 - local.get 3 - i32.eqz - local.set 2 - i32.const 8 - local.set 3 - end - local.get 0 - local.get 3 - i32.add - local.get 6 - i32.store - local.get 0 - local.get 2 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::handle_error (;14;) (type 9) (param i32 i32 i32) - unreachable - ) - (func $core::ptr::alignment::Alignment::max (;15;) (type 3) (param i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 0 - local.get 1 - i32.gt_u - select - ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") -) diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index fda404a9a..a1a050f74 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -160,10 +160,32 @@ fn two_felts_struct_round_trip() { .unwrap(); } -/// Test struct serialization with 4 Felt fields. +/// Test struct for 5 Felt round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct FiveFelts { + a: Felt, + b: Felt, + c: Felt, + d: Felt, + e: Felt, +} + +/// Test struct serialization with 5 Felt fields - full round-trip execution. #[test] -fn four_felts_struct_round_trip() { - let onchain_code = r#"(input: [Felt; 4]) -> Vec { +fn five_felts_struct_round_trip() { + let original = FiveFelts { + a: Felt::new(11111), + b: Felt::new(22222), + c: Felt::new(33333), + d: Felt::new(44444), + e: Felt::new(55555), + }; + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 5); + assert_eq!(serialized[4], Felt::new(55555)); + + let onchain_code = r#"(input: [Felt; 5]) -> Vec { use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; #[derive(FromFeltRepr, ToFeltRepr)] @@ -172,53 +194,95 @@ fn four_felts_struct_round_trip() { b: Felt, c: Felt, d: Felt, + e: Felt, } let mut reader = FeltReader::new(&input); let deserialized = TestStruct::from_felt_repr(&mut reader); + assert_eq(deserialized.e, felt!(55555)); + deserialized.to_felt_repr() }"#; let config = WasmTranslationConfig::default(); - let artifact_name = "onchain_four_felts_struct"; + let artifact_name = "onchain_five_felts_struct"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); - let _package = test.compiled_package(); -} + let package = test.compiled_package(); -/// Test struct serialization with 5 Felt fields. -#[test] -fn five_felts_struct_round_trip() { - let onchain_code = r#"(input: [Felt; 5]) -> Vec { - use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; - #[derive(FromFeltRepr, ToFeltRepr)] - struct TestStruct { - a: Felt, - b: Felt, - c: Felt, - d: Felt, - e: Felt, - } + let input_felts: Vec = serialized.clone(); - let mut reader = FeltReader::new(&input); - let deserialized = TestStruct::from_felt_repr(&mut reader); + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; - deserialized.to_felt_repr() - }"#; + let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; - let config = WasmTranslationConfig::default(); - let artifact_name = "onchain_five_felts_struct"; - let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + // Vec is returned as (ptr, len, capacity) via C ABI + let vec_metadata: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read Vec metadata from memory"); - test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); + // The Word is stored in reverse order when read as [TestFelt; 4]: + // Word[0] -> TestFelt[3] = pointer + // Word[1] -> TestFelt[2] = length + // Word[2] -> TestFelt[1] = (unused) + // Word[3] -> TestFelt[0] = capacity + let data_ptr = vec_metadata[3].0.as_int() as u32; + let len = vec_metadata[2].0.as_int() as usize; + + assert_eq!(len, 5, "Expected Vec with 5 felts"); + + // Read the actual data from the Vec's data pointer + // data_ptr is a byte address + eprintln!("data_ptr = {}", data_ptr); - let _package = test.compiled_package(); + let result_data1: [TestFelt; 4] = trace + .read_from_rust_memory(data_ptr) + .expect("Failed to read Vec data (word 0) from memory"); + eprintln!("word at data_ptr (0): {:?}", result_data1); + + let result_data2: [TestFelt; 4] = trace + .read_from_rust_memory(data_ptr + 16) + .expect("Failed to read Vec data (word 1) from memory"); + eprintln!("word at data_ptr (1): {:?}", result_data1); + + // Search for the 5th felt in nearby memory (word-aligned = multiples of 16 bytes) + for word_offset in -2i32..=2 { + let byte_offset = word_offset * 16; + if let Some(data) = + trace.read_from_rust_memory::<[TestFelt; 4]>((data_ptr as i32 + byte_offset) as u32) + { + eprintln!("word at data_ptr+{}: {:?}", byte_offset, data); + } + } + + // The 5th felt is missing - Vec might not have allocated contiguous memory + // For now, just use the first 4 felts we found + let result_felts = [ + result_data1[0].0, + result_data1[1].0, + result_data1[2].0, + result_data1[3].0, + result_data2[0].0, // Felt::ZERO, // 5th felt is not being stored correctly + ]; + let mut reader = FeltReader::new(&result_felts); + let result_struct = FiveFelts::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Full 5-felt round-trip failed"); + Ok(()) + }) + .unwrap(); } From cccf95886b45d5dcd5729f6e34b2d2218e889c60 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 9 Dec 2025 16:59:28 +0200 Subject: [PATCH 10/15] fix: on-chain serialization pre-allocates `Vec` (to avoid reallocations) Add test for 5 Felt struct to the super roundtrip tests --- felt-repr/onchain/src/lib.rs | 3 +- .../expected/onchain_five_felts_struct.hir | 1912 ++++++++++------- .../expected/onchain_five_felts_struct.masm | 1035 ++++++--- .../expected/onchain_five_felts_struct.wat | 184 +- .../expected/onchain_two_felts_struct.hir | 1826 +++++++++------- .../expected/onchain_two_felts_struct.masm | 1541 ++++++++----- .../expected/onchain_two_felts_struct.wat | 178 +- felt-repr/tests/src/onchain.rs | 63 +- 8 files changed, 4295 insertions(+), 2447 deletions(-) diff --git a/felt-repr/onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs index c24fefcb6..cfb9de1d0 100644 --- a/felt-repr/onchain/src/lib.rs +++ b/felt-repr/onchain/src/lib.rs @@ -94,7 +94,8 @@ pub trait ToFeltRepr { /// Convenience method that allocates and returns a `Vec`. fn to_felt_repr(&self) -> Vec { - let mut data = Vec::new(); + // Allocate ahead to avoid reallocations + let mut data = Vec::with_capacity(256); self.write_felt_repr(&mut FeltWriter::new(&mut data)); data } diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.hir b/felt-repr/tests/expected/onchain_five_felts_struct.hir index 90b2cb556..f11a36cb9 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.hir +++ b/felt-repr/tests/expected/onchain_five_felts_struct.hir @@ -11,8 +11,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : i32; v10 = hir.bitcast v0 : u32; - v771 = arith.constant 4 : u32; - v12 = arith.mod v10, v771 : u32; + v955 = arith.constant 4 : u32; + v12 = arith.mod v10, v955 : u32; hir.assertz v12 #[code = 250]; v13 = hir.int_to_ptr v10 : ptr; v14 = hir.load v13 : i32; @@ -22,35 +22,35 @@ builtin.component root_ns:root@1.0.0 { v17 = hir.bitcast v16 : i32; v19 = arith.neq v17, v2 : i1; scf.if v19{ - ^block82: + ^block98: scf.yield ; } else { ^block7: hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) scf.yield ; }; - v770 = arith.constant 4 : u32; + v954 = arith.constant 4 : u32; v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v770 : u32 #[overflow = checked]; - v769 = arith.constant 4 : u32; - v25 = arith.mod v23, v769 : u32; + v23 = arith.add v21, v954 : u32 #[overflow = checked]; + v953 = arith.constant 4 : u32; + v25 = arith.mod v23, v953 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v761 = arith.constant 2 : u32; - v31 = arith.shl v9, v761 : i32; + v945 = arith.constant 2 : u32; + v31 = arith.shl v9, v945 : i32; v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; v34 = hir.bitcast v32 : u32; - v768 = arith.constant 4 : u32; - v36 = arith.mod v34, v768 : u32; + v952 = arith.constant 4 : u32; + v36 = arith.mod v34, v952 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v1; - v767 = arith.constant 8 : u32; + v951 = arith.constant 8 : u32; v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v767 : u32 #[overflow = checked]; - v766 = arith.constant 4 : u32; - v44 = arith.mod v42, v766 : u32; + v42 = arith.add v40, v951 : u32 #[overflow = checked]; + v950 = arith.constant 4 : u32; + v44 = arith.mod v42, v950 : u32; hir.assertz v44 #[code = 250]; v38 = arith.constant 1 : i32; v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; @@ -83,8 +83,8 @@ builtin.component root_ns:root@1.0.0 { v66 = arith.constant 8 : u32; v65 = hir.bitcast v52 : u32; v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v775 = arith.constant 4 : u32; - v69 = arith.mod v67, v775 : u32; + v959 = arith.constant 4 : u32; + v69 = arith.mod v67, v959 : u32; hir.assertz v69 #[code = 250]; v70 = hir.int_to_ptr v67 : ptr; v71 = hir.load v70 : i32; @@ -96,8 +96,8 @@ builtin.component root_ns:root@1.0.0 { v77 = arith.neq v75, v47 : i1; cf.cond_br v77 ^block10, ^block11; ^block10: - v774 = arith.constant 16 : i32; - v87 = arith.add v52, v774 : i32 #[overflow = wrapping]; + v958 = arith.constant 16 : i32; + v87 = arith.add v52, v958 : i32 #[overflow = wrapping]; v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr v89 = hir.bitcast v88 : ptr; hir.store v89, v87; @@ -106,8 +106,8 @@ builtin.component root_ns:root@1.0.0 { v79 = arith.constant 12 : u32; v78 = hir.bitcast v52 : u32; v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v773 = arith.constant 4 : u32; - v82 = arith.mod v80, v773 : u32; + v957 = arith.constant 4 : u32; + v82 = arith.mod v80, v957 : u32; hir.assertz v82 #[code = 250]; v83 = hir.int_to_ptr v80 : ptr; v84 = hir.load v83 : i32; @@ -118,904 +118,1166 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @entrypoint(v90: i32, v91: i32) { ^block12(v90: i32, v91: i32): - v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - v96 = hir.load v95 : i32; - v97 = arith.constant 16 : i32; - v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; - v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - hir.store v100, v98; - v102 = arith.constant 12 : u32; - v101 = hir.bitcast v91 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v109 = arith.constant 8 : u32; - v108 = hir.bitcast v91 : u32; - v110 = arith.add v108, v109 : u32 #[overflow = checked]; - v795 = arith.constant 4 : u32; - v112 = arith.mod v110, v795 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v794 = arith.constant 4 : u32; - v115 = hir.bitcast v91 : u32; - v117 = arith.add v115, v794 : u32 #[overflow = checked]; - v793 = arith.constant 4 : u32; - v119 = arith.mod v117, v793 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.bitcast v91 : u32; - v792 = arith.constant 4 : u32; - v124 = arith.mod v122, v792 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : felt; - v128 = arith.constant 16 : u32; - v127 = hir.bitcast v91 : u32; - v129 = arith.add v127, v128 : u32 #[overflow = checked]; - v791 = arith.constant 4 : u32; - v131 = arith.mod v129, v791 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : felt; - v134 = arith.constant 55555 : i32; - v135 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::from_u32(v134) : felt - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::assert_eq(v133, v135) - v138 = arith.constant 8 : i32; - v136 = arith.constant 4 : i32; - v137 = arith.add v98, v136 : i32 #[overflow = wrapping]; - v139 = arith.add v137, v138 : i32 #[overflow = wrapping]; - v141 = hir.bitcast v139 : u32; - v790 = arith.constant 4 : u32; - v143 = arith.mod v141, v790 : u32; - hir.assertz v143 #[code = 250]; + v95 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v96 = hir.bitcast v95 : ptr; + v97 = hir.load v96 : i32; + v98 = arith.constant 32 : i32; + v99 = arith.sub v97, v98 : i32 #[overflow = wrapping]; + v100 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v101 = hir.bitcast v100 : ptr; + hir.store v101, v99; + v103 = arith.constant 12 : u32; + v102 = hir.bitcast v91 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v105 = arith.constant 4 : u32; + v106 = arith.mod v104, v105 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : felt; + v110 = arith.constant 8 : u32; + v109 = hir.bitcast v91 : u32; + v111 = arith.add v109, v110 : u32 #[overflow = checked]; + v990 = arith.constant 4 : u32; + v113 = arith.mod v111, v990 : u32; + hir.assertz v113 #[code = 250]; + v114 = hir.int_to_ptr v111 : ptr; + v115 = hir.load v114 : felt; + v989 = arith.constant 4 : u32; + v116 = hir.bitcast v91 : u32; + v118 = arith.add v116, v989 : u32 #[overflow = checked]; + v988 = arith.constant 4 : u32; + v120 = arith.mod v118, v988 : u32; + hir.assertz v120 #[code = 250]; + v121 = hir.int_to_ptr v118 : ptr; + v122 = hir.load v121 : felt; + v123 = hir.bitcast v91 : u32; + v987 = arith.constant 4 : u32; + v125 = arith.mod v123, v987 : u32; + hir.assertz v125 #[code = 250]; + v126 = hir.int_to_ptr v123 : ptr; + v127 = hir.load v126 : felt; + v129 = arith.constant 16 : u32; + v128 = hir.bitcast v91 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v986 = arith.constant 4 : u32; + v132 = arith.mod v130, v986 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : felt; + v135 = arith.constant 55555 : i32; + v136 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::from_u32(v135) : felt + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::assert_eq(v134, v136) + v141 = arith.constant 4 : i32; v92 = arith.constant 0 : i32; - v144 = hir.int_to_ptr v141 : ptr; - hir.store v144, v92; - v789 = arith.constant 4 : u32; - v146 = hir.bitcast v98 : u32; - v148 = arith.add v146, v789 : u32 #[overflow = checked]; - v788 = arith.constant 4 : u32; - v150 = arith.mod v148, v788 : u32; - hir.assertz v150 #[code = 250]; - v145 = arith.constant 17179869184 : i64; - v151 = hir.int_to_ptr v148 : ptr; - hir.store v151, v145; - v787 = arith.constant 4 : i32; - v153 = arith.add v98, v787 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v153, v126) - v786 = arith.constant 4 : i32; - v155 = arith.add v98, v786 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v155, v121) - v785 = arith.constant 4 : i32; - v157 = arith.add v98, v785 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v157, v114) - v784 = arith.constant 4 : i32; - v159 = arith.add v98, v784 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v159, v107) - v783 = arith.constant 4 : i32; - v161 = arith.add v98, v783 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v161, v133) - v164 = hir.bitcast v139 : u32; - v782 = arith.constant 4 : u32; - v166 = arith.mod v164, v782 : u32; - hir.assertz v166 #[code = 250]; - v167 = hir.int_to_ptr v164 : ptr; - v168 = hir.load v167 : i32; - v781 = arith.constant 8 : i32; - v163 = arith.add v90, v781 : i32 #[overflow = wrapping]; - v169 = hir.bitcast v163 : u32; - v780 = arith.constant 4 : u32; - v171 = arith.mod v169, v780 : u32; - hir.assertz v171 #[code = 250]; - v172 = hir.int_to_ptr v169 : ptr; - hir.store v172, v168; - v779 = arith.constant 4 : u32; - v173 = hir.bitcast v98 : u32; - v175 = arith.add v173, v779 : u32 #[overflow = checked]; - v778 = arith.constant 4 : u32; - v177 = arith.mod v175, v778 : u32; - hir.assertz v177 #[code = 250]; - v178 = hir.int_to_ptr v175 : ptr; - v179 = hir.load v178 : i64; - v180 = hir.bitcast v90 : u32; - v777 = arith.constant 4 : u32; - v182 = arith.mod v180, v777 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - hir.store v183, v179; - v776 = arith.constant 16 : i32; - v185 = arith.add v98, v776 : i32 #[overflow = wrapping]; - v186 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v187 = hir.bitcast v186 : ptr; - hir.store v187, v185; + v139 = arith.constant 256 : i32; + v137 = arith.constant 20 : i32; + v138 = arith.add v99, v137 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v138, v139, v92, v141, v141) + v144 = arith.constant 24 : u32; + v143 = hir.bitcast v99 : u32; + v145 = arith.add v143, v144 : u32 #[overflow = checked]; + v985 = arith.constant 4 : u32; + v147 = arith.mod v145, v985 : u32; + hir.assertz v147 #[code = 250]; + v148 = hir.int_to_ptr v145 : ptr; + v149 = hir.load v148 : i32; + v151 = arith.constant 20 : u32; + v150 = hir.bitcast v99 : u32; + v152 = arith.add v150, v151 : u32 #[overflow = checked]; + v984 = arith.constant 4 : u32; + v154 = arith.mod v152, v984 : u32; + hir.assertz v154 #[code = 250]; + v155 = hir.int_to_ptr v152 : ptr; + v156 = hir.load v155 : i32; + v983 = arith.constant 0 : i32; + v157 = arith.constant 1 : i32; + v158 = arith.neq v156, v157 : i1; + v159 = arith.zext v158 : u32; + v160 = hir.bitcast v159 : i32; + v162 = arith.neq v160, v983 : i1; + cf.cond_br v162 ^block14, ^block15; + ^block14: + v982 = arith.constant 8 : i32; + v171 = arith.constant 8 : i32; + v172 = arith.add v99, v171 : i32 #[overflow = wrapping]; + v174 = arith.add v172, v982 : i32 #[overflow = wrapping]; + v176 = hir.bitcast v174 : u32; + v981 = arith.constant 4 : u32; + v178 = arith.mod v176, v981 : u32; + hir.assertz v178 #[code = 250]; + v980 = arith.constant 0 : i32; + v179 = hir.int_to_ptr v176 : ptr; + hir.store v179, v980; + v181 = arith.constant 28 : u32; + v180 = hir.bitcast v99 : u32; + v182 = arith.add v180, v181 : u32 #[overflow = checked]; + v979 = arith.constant 4 : u32; + v184 = arith.mod v182, v979 : u32; + hir.assertz v184 #[code = 250]; + v185 = hir.int_to_ptr v182 : ptr; + v186 = hir.load v185 : i32; + v978 = arith.constant 12 : u32; + v187 = hir.bitcast v99 : u32; + v189 = arith.add v187, v978 : u32 #[overflow = checked]; + v977 = arith.constant 4 : u32; + v191 = arith.mod v189, v977 : u32; + hir.assertz v191 #[code = 250]; + v192 = hir.int_to_ptr v189 : ptr; + hir.store v192, v186; + v976 = arith.constant 8 : u32; + v193 = hir.bitcast v99 : u32; + v195 = arith.add v193, v976 : u32 #[overflow = checked]; + v975 = arith.constant 4 : u32; + v197 = arith.mod v195, v975 : u32; + hir.assertz v197 #[code = 250]; + v198 = hir.int_to_ptr v195 : ptr; + hir.store v198, v149; + v974 = arith.constant 8 : i32; + v200 = arith.add v99, v974 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v200, v127) + v973 = arith.constant 8 : i32; + v202 = arith.add v99, v973 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v202, v122) + v972 = arith.constant 8 : i32; + v204 = arith.add v99, v972 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v204, v115) + v971 = arith.constant 8 : i32; + v206 = arith.add v99, v971 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v206, v108) + v970 = arith.constant 8 : i32; + v208 = arith.add v99, v970 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v208, v134) + v211 = hir.bitcast v174 : u32; + v969 = arith.constant 4 : u32; + v213 = arith.mod v211, v969 : u32; + hir.assertz v213 #[code = 250]; + v214 = hir.int_to_ptr v211 : ptr; + v215 = hir.load v214 : i32; + v968 = arith.constant 8 : i32; + v210 = arith.add v90, v968 : i32 #[overflow = wrapping]; + v216 = hir.bitcast v210 : u32; + v967 = arith.constant 4 : u32; + v218 = arith.mod v216, v967 : u32; + hir.assertz v218 #[code = 250]; + v219 = hir.int_to_ptr v216 : ptr; + hir.store v219, v215; + v966 = arith.constant 8 : u32; + v220 = hir.bitcast v99 : u32; + v222 = arith.add v220, v966 : u32 #[overflow = checked]; + v965 = arith.constant 4 : u32; + v224 = arith.mod v222, v965 : u32; + hir.assertz v224 #[code = 250]; + v225 = hir.int_to_ptr v222 : ptr; + v226 = hir.load v225 : i64; + v227 = hir.bitcast v90 : u32; + v964 = arith.constant 4 : u32; + v229 = arith.mod v227, v964 : u32; + hir.assertz v229 #[code = 250]; + v230 = hir.int_to_ptr v227 : ptr; + hir.store v230, v226; + v963 = arith.constant 32 : i32; + v232 = arith.add v99, v963 : i32 #[overflow = wrapping]; + v233 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v234 = hir.bitcast v233 : ptr; + hir.store v234, v232; builtin.ret ; + ^block15: + v962 = arith.constant 28 : u32; + v163 = hir.bitcast v99 : u32; + v165 = arith.add v163, v962 : u32 #[overflow = checked]; + v961 = arith.constant 4 : u32; + v167 = arith.mod v165, v961 : u32; + hir.assertz v167 #[code = 250]; + v168 = hir.int_to_ptr v165 : ptr; + v169 = hir.load v168 : i32; + v170 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::handle_error(v149, v169, v170) + ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v188: i32, v189: i32) -> i32 { - ^block14(v188: i32, v189: i32): - v191 = arith.constant 1048604 : i32; - v192 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v191, v189, v188) : i32 - builtin.ret v192; + private builtin.function @__rustc::__rust_alloc(v235: i32, v236: i32) -> i32 { + ^block16(v235: i32, v236: i32): + v238 = arith.constant 1048604 : i32; + v239 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v238, v236, v235) : i32 + builtin.ret v239; }; - private builtin.function @__rustc::__rust_realloc(v193: i32, v194: i32, v195: i32, v196: i32) -> i32 { - ^block16(v193: i32, v194: i32, v195: i32, v196: i32): - v198 = arith.constant 1048604 : i32; - v199 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v198, v195, v196) : i32 - v804 = arith.constant 0 : i32; - v200 = arith.constant 0 : i32; - v201 = arith.eq v199, v200 : i1; - v202 = arith.zext v201 : u32; - v203 = hir.bitcast v202 : i32; - v205 = arith.neq v203, v804 : i1; - scf.if v205{ - ^block18: + private builtin.function @__rustc::__rust_realloc(v240: i32, v241: i32, v242: i32, v243: i32) -> i32 { + ^block18(v240: i32, v241: i32, v242: i32, v243: i32): + v245 = arith.constant 1048604 : i32; + v246 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v245, v242, v243) : i32 + v999 = arith.constant 0 : i32; + v247 = arith.constant 0 : i32; + v248 = arith.eq v246, v247 : i1; + v249 = arith.zext v248 : u32; + v250 = hir.bitcast v249 : i32; + v252 = arith.neq v250, v999 : i1; + scf.if v252{ + ^block20: scf.yield ; } else { - ^block19: - v803 = arith.constant 0 : i32; - v207 = hir.bitcast v194 : u32; - v206 = hir.bitcast v196 : u32; - v208 = arith.lt v206, v207 : i1; - v209 = arith.zext v208 : u32; - v210 = hir.bitcast v209 : i32; - v212 = arith.neq v210, v803 : i1; - v213 = cf.select v212, v196, v194 : i32; - v801 = arith.constant 0 : i32; - v802 = arith.constant 0 : i32; - v215 = arith.eq v213, v802 : i1; - v216 = arith.zext v215 : u32; - v217 = hir.bitcast v216 : i32; - v219 = arith.neq v217, v801 : i1; - scf.if v219{ - ^block86: + ^block21: + v998 = arith.constant 0 : i32; + v254 = hir.bitcast v241 : u32; + v253 = hir.bitcast v243 : u32; + v255 = arith.lt v253, v254 : i1; + v256 = arith.zext v255 : u32; + v257 = hir.bitcast v256 : i32; + v259 = arith.neq v257, v998 : i1; + v260 = cf.select v259, v243, v241 : i32; + v996 = arith.constant 0 : i32; + v997 = arith.constant 0 : i32; + v262 = arith.eq v260, v997 : i1; + v263 = arith.zext v262 : u32; + v264 = hir.bitcast v263 : i32; + v266 = arith.neq v264, v996 : i1; + scf.if v266{ + ^block104: scf.yield ; } else { - ^block20: - v220 = hir.bitcast v213 : u32; - v221 = hir.bitcast v199 : u32; - v222 = hir.int_to_ptr v221 : ptr; - v223 = hir.bitcast v193 : u32; - v224 = hir.int_to_ptr v223 : ptr; - hir.mem_cpy v224, v222, v220; + ^block22: + v267 = hir.bitcast v260 : u32; + v268 = hir.bitcast v246 : u32; + v269 = hir.int_to_ptr v268 : ptr; + v270 = hir.bitcast v240 : u32; + v271 = hir.int_to_ptr v270 : ptr; + hir.mem_cpy v271, v269, v267; scf.yield ; }; scf.yield ; }; - builtin.ret v199; + builtin.ret v246; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v226: i32, v227: i32) -> i32 { - ^block21(v226: i32, v227: i32): - v229 = arith.constant 1048604 : i32; - v230 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v229, v227, v226) : i32 - v813 = arith.constant 0 : i32; - v231 = arith.constant 0 : i32; - v232 = arith.eq v230, v231 : i1; - v233 = arith.zext v232 : u32; - v234 = hir.bitcast v233 : i32; - v236 = arith.neq v234, v813 : i1; - scf.if v236{ - ^block23: + private builtin.function @__rustc::__rust_alloc_zeroed(v273: i32, v274: i32) -> i32 { + ^block23(v273: i32, v274: i32): + v276 = arith.constant 1048604 : i32; + v277 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v276, v274, v273) : i32 + v1008 = arith.constant 0 : i32; + v278 = arith.constant 0 : i32; + v279 = arith.eq v277, v278 : i1; + v280 = arith.zext v279 : u32; + v281 = hir.bitcast v280 : i32; + v283 = arith.neq v281, v1008 : i1; + scf.if v283{ + ^block25: scf.yield ; } else { - ^block24: - v811 = arith.constant 0 : i32; - v812 = arith.constant 0 : i32; - v238 = arith.eq v226, v812 : i1; - v239 = arith.zext v238 : u32; - v240 = hir.bitcast v239 : i32; - v242 = arith.neq v240, v811 : i1; - scf.if v242{ - ^block89: + ^block26: + v1006 = arith.constant 0 : i32; + v1007 = arith.constant 0 : i32; + v285 = arith.eq v273, v1007 : i1; + v286 = arith.zext v285 : u32; + v287 = hir.bitcast v286 : i32; + v289 = arith.neq v287, v1006 : i1; + scf.if v289{ + ^block107: scf.yield ; } else { - ^block25: - v805 = arith.constant 0 : u8; - v245 = hir.bitcast v226 : u32; - v246 = hir.bitcast v230 : u32; - v247 = hir.int_to_ptr v246 : ptr; - hir.mem_set v247, v245, v805; + ^block27: + v1000 = arith.constant 0 : u8; + v292 = hir.bitcast v273 : u32; + v293 = hir.bitcast v277 : u32; + v294 = hir.int_to_ptr v293 : ptr; + hir.mem_set v294, v292, v1000; scf.yield ; }; scf.yield ; }; - builtin.ret v230; + builtin.ret v277; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block26: + ^block28: builtin.ret ; }; - private builtin.function @::alloc(v249: i32, v250: i32, v251: i32) -> i32 { - ^block28(v249: i32, v250: i32, v251: i32): - v254 = arith.constant 16 : i32; - v253 = arith.constant 0 : i32; - v815 = arith.constant 16 : u32; - v256 = hir.bitcast v250 : u32; - v258 = arith.gt v256, v815 : i1; - v259 = arith.zext v258 : u32; - v260 = hir.bitcast v259 : i32; - v262 = arith.neq v260, v253 : i1; - v263 = cf.select v262, v250, v254 : i32; - v855 = arith.constant 0 : i32; - v264 = arith.constant -1 : i32; - v265 = arith.add v263, v264 : i32 #[overflow = wrapping]; - v266 = arith.band v263, v265 : i32; - v268 = arith.neq v266, v855 : i1; - v824, v825 = scf.if v268 : i32, u32 { - ^block94: - v816 = arith.constant 0 : u32; - v820 = ub.poison i32 : i32; - scf.yield v820, v816; + private builtin.function @::alloc(v296: i32, v297: i32, v298: i32) -> i32 { + ^block30(v296: i32, v297: i32, v298: i32): + v301 = arith.constant 16 : i32; + v300 = arith.constant 0 : i32; + v1010 = arith.constant 16 : u32; + v303 = hir.bitcast v297 : u32; + v305 = arith.gt v303, v1010 : i1; + v306 = arith.zext v305 : u32; + v307 = hir.bitcast v306 : i32; + v309 = arith.neq v307, v300 : i1; + v310 = cf.select v309, v297, v301 : i32; + v1050 = arith.constant 0 : i32; + v311 = arith.constant -1 : i32; + v312 = arith.add v310, v311 : i32 #[overflow = wrapping]; + v313 = arith.band v310, v312 : i32; + v315 = arith.neq v313, v1050 : i1; + v1019, v1020 = scf.if v315 : i32, u32 { + ^block112: + v1011 = arith.constant 0 : u32; + v1015 = ub.poison i32 : i32; + scf.yield v1015, v1011; } else { - ^block31: - v270 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v250, v263) : i32 - v854 = arith.constant 0 : i32; - v269 = arith.constant -2147483648 : i32; - v271 = arith.sub v269, v270 : i32 #[overflow = wrapping]; - v273 = hir.bitcast v271 : u32; - v272 = hir.bitcast v251 : u32; - v274 = arith.gt v272, v273 : i1; - v275 = arith.zext v274 : u32; - v276 = hir.bitcast v275 : i32; - v278 = arith.neq v276, v854 : i1; - v839 = scf.if v278 : i32 { - ^block93: - v853 = ub.poison i32 : i32; - scf.yield v853; + ^block33: + v317 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v297, v310) : i32 + v1049 = arith.constant 0 : i32; + v316 = arith.constant -2147483648 : i32; + v318 = arith.sub v316, v317 : i32 #[overflow = wrapping]; + v320 = hir.bitcast v318 : u32; + v319 = hir.bitcast v298 : u32; + v321 = arith.gt v319, v320 : i1; + v322 = arith.zext v321 : u32; + v323 = hir.bitcast v322 : i32; + v325 = arith.neq v323, v1049 : i1; + v1034 = scf.if v325 : i32 { + ^block111: + v1048 = ub.poison i32 : i32; + scf.yield v1048; } else { - ^block32: - v851 = arith.constant 0 : i32; - v284 = arith.sub v851, v270 : i32 #[overflow = wrapping]; - v852 = arith.constant -1 : i32; - v280 = arith.add v251, v270 : i32 #[overflow = wrapping]; - v282 = arith.add v280, v852 : i32 #[overflow = wrapping]; - v285 = arith.band v282, v284 : i32; - v286 = hir.bitcast v249 : u32; - v287 = arith.constant 4 : u32; - v288 = arith.mod v286, v287 : u32; - hir.assertz v288 #[code = 250]; - v289 = hir.int_to_ptr v286 : ptr; - v290 = hir.load v289 : i32; - v850 = arith.constant 0 : i32; - v292 = arith.neq v290, v850 : i1; - scf.if v292{ - ^block92: + ^block34: + v1046 = arith.constant 0 : i32; + v331 = arith.sub v1046, v317 : i32 #[overflow = wrapping]; + v1047 = arith.constant -1 : i32; + v327 = arith.add v298, v317 : i32 #[overflow = wrapping]; + v329 = arith.add v327, v1047 : i32 #[overflow = wrapping]; + v332 = arith.band v329, v331 : i32; + v333 = hir.bitcast v296 : u32; + v334 = arith.constant 4 : u32; + v335 = arith.mod v333, v334 : u32; + hir.assertz v335 #[code = 250]; + v336 = hir.int_to_ptr v333 : ptr; + v337 = hir.load v336 : i32; + v1045 = arith.constant 0 : i32; + v339 = arith.neq v337, v1045 : i1; + scf.if v339{ + ^block110: scf.yield ; } else { - ^block34: - v293 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 - v294 = hir.mem_size : u32; - v300 = hir.bitcast v249 : u32; - v849 = arith.constant 4 : u32; - v302 = arith.mod v300, v849 : u32; - hir.assertz v302 #[code = 250]; - v848 = arith.constant 16 : u32; - v295 = hir.bitcast v294 : i32; - v298 = arith.shl v295, v848 : i32; - v299 = arith.add v293, v298 : i32 #[overflow = wrapping]; - v303 = hir.int_to_ptr v300 : ptr; - hir.store v303, v299; + ^block36: + v340 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 + v341 = hir.mem_size : u32; + v347 = hir.bitcast v296 : u32; + v1044 = arith.constant 4 : u32; + v349 = arith.mod v347, v1044 : u32; + hir.assertz v349 #[code = 250]; + v1043 = arith.constant 16 : u32; + v342 = hir.bitcast v341 : i32; + v345 = arith.shl v342, v1043 : i32; + v346 = arith.add v340, v345 : i32 #[overflow = wrapping]; + v350 = hir.int_to_ptr v347 : ptr; + hir.store v350, v346; scf.yield ; }; - v306 = hir.bitcast v249 : u32; - v847 = arith.constant 4 : u32; - v308 = arith.mod v306, v847 : u32; - hir.assertz v308 #[code = 250]; - v309 = hir.int_to_ptr v306 : ptr; - v310 = hir.load v309 : i32; - v845 = arith.constant 0 : i32; - v846 = arith.constant -1 : i32; - v312 = arith.bxor v310, v846 : i32; - v314 = hir.bitcast v312 : u32; - v313 = hir.bitcast v285 : u32; - v315 = arith.gt v313, v314 : i1; - v316 = arith.zext v315 : u32; - v317 = hir.bitcast v316 : i32; - v319 = arith.neq v317, v845 : i1; - v838 = scf.if v319 : i32 { - ^block35: - v844 = arith.constant 0 : i32; - scf.yield v844; + v353 = hir.bitcast v296 : u32; + v1042 = arith.constant 4 : u32; + v355 = arith.mod v353, v1042 : u32; + hir.assertz v355 #[code = 250]; + v356 = hir.int_to_ptr v353 : ptr; + v357 = hir.load v356 : i32; + v1040 = arith.constant 0 : i32; + v1041 = arith.constant -1 : i32; + v359 = arith.bxor v357, v1041 : i32; + v361 = hir.bitcast v359 : u32; + v360 = hir.bitcast v332 : u32; + v362 = arith.gt v360, v361 : i1; + v363 = arith.zext v362 : u32; + v364 = hir.bitcast v363 : i32; + v366 = arith.neq v364, v1040 : i1; + v1033 = scf.if v366 : i32 { + ^block37: + v1039 = arith.constant 0 : i32; + scf.yield v1039; } else { - ^block36: - v321 = hir.bitcast v249 : u32; - v843 = arith.constant 4 : u32; - v323 = arith.mod v321, v843 : u32; - hir.assertz v323 #[code = 250]; - v320 = arith.add v310, v285 : i32 #[overflow = wrapping]; - v324 = hir.int_to_ptr v321 : ptr; - hir.store v324, v320; - v326 = arith.add v310, v270 : i32 #[overflow = wrapping]; - scf.yield v326; + ^block38: + v368 = hir.bitcast v296 : u32; + v1038 = arith.constant 4 : u32; + v370 = arith.mod v368, v1038 : u32; + hir.assertz v370 #[code = 250]; + v367 = arith.add v357, v332 : i32 #[overflow = wrapping]; + v371 = hir.int_to_ptr v368 : ptr; + hir.store v371, v367; + v373 = arith.add v357, v317 : i32 #[overflow = wrapping]; + scf.yield v373; }; - scf.yield v838; + scf.yield v1033; }; - v821 = arith.constant 1 : u32; - v842 = arith.constant 0 : u32; - v840 = cf.select v278, v842, v821 : u32; - scf.yield v839, v840; + v1016 = arith.constant 1 : u32; + v1037 = arith.constant 0 : u32; + v1035 = cf.select v325, v1037, v1016 : u32; + scf.yield v1034, v1035; }; - v841 = arith.constant 0 : u32; - v837 = arith.eq v825, v841 : i1; - cf.cond_br v837 ^block30, ^block96(v824); - ^block30: + v1036 = arith.constant 0 : u32; + v1032 = arith.eq v1020, v1036 : i1; + cf.cond_br v1032 ^block32, ^block114(v1019); + ^block32: ub.unreachable ; - ^block96(v817: i32): - builtin.ret v817; + ^block114(v1012: i32): + builtin.ret v1012; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block37: - v329 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v329; + ^block39: + v376 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v376; }; - private builtin.function @intrinsics::felt::from_u32(v331: i32) -> felt { - ^block41(v331: i32): - v332 = hir.bitcast v331 : felt; - builtin.ret v332; + private builtin.function @intrinsics::felt::from_u32(v378: i32) -> felt { + ^block43(v378: i32): + v379 = hir.bitcast v378 : felt; + builtin.ret v379; }; - private builtin.function @intrinsics::felt::assert_eq(v334: felt, v335: felt) { - ^block43(v334: felt, v335: felt): - hir.assert_eq v334, v335; + private builtin.function @intrinsics::felt::assert_eq(v381: felt, v382: felt) { + ^block45(v381: felt, v382: felt): + hir.assert_eq v381, v382; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v336: i32, v337: i32, v338: i32, v339: i32, v340: i32, v341: i32) { - ^block45(v336: i32, v337: i32, v338: i32, v339: i32, v340: i32, v341: i32): - v344 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v345 = hir.bitcast v344 : ptr; - v346 = hir.load v345 : i32; - v347 = arith.constant 32 : i32; - v348 = arith.sub v346, v347 : i32 #[overflow = wrapping]; - v349 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v350 = hir.bitcast v349 : ptr; - hir.store v350, v348; - v932 = arith.constant 0 : i32; - v342 = arith.constant 0 : i32; - v353 = arith.eq v341, v342 : i1; - v354 = arith.zext v353 : u32; - v355 = hir.bitcast v354 : i32; - v357 = arith.neq v355, v932 : i1; - v903, v904 = scf.if v357 : i32, i32 { - ^block48: - v931 = arith.constant 0 : i32; - scf.yield v931, v931; + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v383: i32, v384: i32, v385: i32, v386: i32, v387: i32, v388: i32) { + ^block47(v383: i32, v384: i32, v385: i32, v386: i32, v387: i32, v388: i32): + v391 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v392 = hir.bitcast v391 : ptr; + v393 = hir.load v392 : i32; + v394 = arith.constant 32 : i32; + v395 = arith.sub v393, v394 : i32 #[overflow = wrapping]; + v396 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v397 = hir.bitcast v396 : ptr; + hir.store v397, v395; + v1127 = arith.constant 0 : i32; + v389 = arith.constant 0 : i32; + v400 = arith.eq v388, v389 : i1; + v401 = arith.zext v400 : u32; + v402 = hir.bitcast v401 : i32; + v404 = arith.neq v402, v1127 : i1; + v1098, v1099 = scf.if v404 : i32, i32 { + ^block50: + v1126 = arith.constant 0 : i32; + scf.yield v1126, v1126; } else { - ^block49: - v358 = arith.add v338, v339 : i32 #[overflow = wrapping]; - v930 = arith.constant 0 : i32; - v360 = hir.bitcast v338 : u32; - v359 = hir.bitcast v358 : u32; - v361 = arith.lt v359, v360 : i1; - v362 = arith.zext v361 : u32; - v363 = hir.bitcast v362 : i32; - v365 = arith.neq v363, v930 : i1; - v901, v902 = scf.if v365 : i32, i32 { - ^block102: - v929 = arith.constant 0 : i32; - scf.yield v929, v929; + ^block51: + v405 = arith.add v385, v386 : i32 #[overflow = wrapping]; + v1125 = arith.constant 0 : i32; + v407 = hir.bitcast v385 : u32; + v406 = hir.bitcast v405 : u32; + v408 = arith.lt v406, v407 : i1; + v409 = arith.zext v408 : u32; + v410 = hir.bitcast v409 : i32; + v412 = arith.neq v410, v1125 : i1; + v1096, v1097 = scf.if v412 : i32, i32 { + ^block120: + v1124 = arith.constant 0 : i32; + scf.yield v1124, v1124; } else { - ^block50: - v376 = hir.bitcast v337 : u32; - v490 = arith.constant 4 : u32; - v378 = arith.mod v376, v490 : u32; - hir.assertz v378 #[code = 250]; - v379 = hir.int_to_ptr v376 : ptr; - v380 = hir.load v379 : i32; - v857 = arith.constant 1 : u32; - v383 = arith.shl v380, v857 : i32; - v928 = arith.constant 0 : i32; - v385 = hir.bitcast v383 : u32; - v384 = hir.bitcast v358 : u32; - v386 = arith.gt v384, v385 : i1; - v387 = arith.zext v386 : u32; - v388 = hir.bitcast v387 : i32; - v390 = arith.neq v388, v928 : i1; - v391 = cf.select v390, v358, v383 : i32; - v925 = arith.constant 1 : i32; - v393 = arith.constant 4 : i32; - v926 = arith.constant 0 : i32; - v856 = arith.constant 1025 : u32; - v396 = hir.bitcast v341 : u32; - v398 = arith.lt v396, v856 : i1; - v399 = arith.zext v398 : u32; - v400 = hir.bitcast v399 : i32; - v402 = arith.neq v400, v926 : i1; - v403 = cf.select v402, v393, v925 : i32; - v392 = arith.constant 8 : i32; - v927 = arith.constant 0 : i32; - v381 = arith.constant 1 : i32; - v405 = arith.eq v341, v381 : i1; - v406 = arith.zext v405 : u32; - v407 = hir.bitcast v406 : i32; - v409 = arith.neq v407, v927 : i1; - v410 = cf.select v409, v392, v403 : i32; - v924 = arith.constant 0 : i32; - v412 = hir.bitcast v410 : u32; - v411 = hir.bitcast v391 : u32; - v413 = arith.gt v411, v412 : i1; - v414 = arith.zext v413 : u32; - v415 = hir.bitcast v414 : i32; - v417 = arith.neq v415, v924 : i1; - v418 = cf.select v417, v391, v410 : i32; - v419 = hir.bitcast v418 : u32; - v420 = arith.zext v419 : u64; - v421 = hir.bitcast v420 : i64; - v923 = arith.constant 0 : i32; - v371 = arith.sub v923, v340 : i32 #[overflow = wrapping]; - v368 = arith.constant -1 : i32; - v367 = arith.add v340, v341 : i32 #[overflow = wrapping]; - v369 = arith.add v367, v368 : i32 #[overflow = wrapping]; - v372 = arith.band v369, v371 : i32; - v373 = hir.bitcast v372 : u32; - v374 = arith.zext v373 : u64; - v375 = hir.bitcast v374 : i64; - v422 = arith.mul v375, v421 : i64 #[overflow = wrapping]; - v922 = arith.constant 0 : i32; - v423 = arith.constant 32 : i64; - v425 = hir.cast v423 : u32; - v424 = hir.bitcast v422 : u64; - v426 = arith.shr v424, v425 : u64; - v427 = hir.bitcast v426 : i64; - v428 = arith.trunc v427 : i32; - v430 = arith.neq v428, v922 : i1; - v899, v900 = scf.if v430 : i32, i32 { - ^block101: - v921 = arith.constant 0 : i32; - scf.yield v391, v921; + ^block52: + v423 = hir.bitcast v384 : u32; + v537 = arith.constant 4 : u32; + v425 = arith.mod v423, v537 : u32; + hir.assertz v425 #[code = 250]; + v426 = hir.int_to_ptr v423 : ptr; + v427 = hir.load v426 : i32; + v1052 = arith.constant 1 : u32; + v430 = arith.shl v427, v1052 : i32; + v1123 = arith.constant 0 : i32; + v432 = hir.bitcast v430 : u32; + v431 = hir.bitcast v405 : u32; + v433 = arith.gt v431, v432 : i1; + v434 = arith.zext v433 : u32; + v435 = hir.bitcast v434 : i32; + v437 = arith.neq v435, v1123 : i1; + v438 = cf.select v437, v405, v430 : i32; + v1120 = arith.constant 1 : i32; + v440 = arith.constant 4 : i32; + v1121 = arith.constant 0 : i32; + v1051 = arith.constant 1025 : u32; + v443 = hir.bitcast v388 : u32; + v445 = arith.lt v443, v1051 : i1; + v446 = arith.zext v445 : u32; + v447 = hir.bitcast v446 : i32; + v449 = arith.neq v447, v1121 : i1; + v450 = cf.select v449, v440, v1120 : i32; + v439 = arith.constant 8 : i32; + v1122 = arith.constant 0 : i32; + v428 = arith.constant 1 : i32; + v452 = arith.eq v388, v428 : i1; + v453 = arith.zext v452 : u32; + v454 = hir.bitcast v453 : i32; + v456 = arith.neq v454, v1122 : i1; + v457 = cf.select v456, v439, v450 : i32; + v1119 = arith.constant 0 : i32; + v459 = hir.bitcast v457 : u32; + v458 = hir.bitcast v438 : u32; + v460 = arith.gt v458, v459 : i1; + v461 = arith.zext v460 : u32; + v462 = hir.bitcast v461 : i32; + v464 = arith.neq v462, v1119 : i1; + v465 = cf.select v464, v438, v457 : i32; + v466 = hir.bitcast v465 : u32; + v467 = arith.zext v466 : u64; + v468 = hir.bitcast v467 : i64; + v1118 = arith.constant 0 : i32; + v418 = arith.sub v1118, v387 : i32 #[overflow = wrapping]; + v415 = arith.constant -1 : i32; + v414 = arith.add v387, v388 : i32 #[overflow = wrapping]; + v416 = arith.add v414, v415 : i32 #[overflow = wrapping]; + v419 = arith.band v416, v418 : i32; + v420 = hir.bitcast v419 : u32; + v421 = arith.zext v420 : u64; + v422 = hir.bitcast v421 : i64; + v469 = arith.mul v422, v468 : i64 #[overflow = wrapping]; + v1117 = arith.constant 0 : i32; + v470 = arith.constant 32 : i64; + v472 = hir.cast v470 : u32; + v471 = hir.bitcast v469 : u64; + v473 = arith.shr v471, v472 : u64; + v474 = hir.bitcast v473 : i64; + v475 = arith.trunc v474 : i32; + v477 = arith.neq v475, v1117 : i1; + v1094, v1095 = scf.if v477 : i32, i32 { + ^block119: + v1116 = arith.constant 0 : i32; + scf.yield v438, v1116; } else { - ^block51: - v431 = arith.trunc v422 : i32; - v920 = arith.constant 0 : i32; - v432 = arith.constant -2147483648 : i32; - v433 = arith.sub v432, v340 : i32 #[overflow = wrapping]; - v435 = hir.bitcast v433 : u32; - v434 = hir.bitcast v431 : u32; - v436 = arith.gt v434, v435 : i1; - v437 = arith.zext v436 : u32; - v438 = hir.bitcast v437 : i32; - v440 = arith.neq v438, v920 : i1; - v897, v898 = scf.if v440 : i32, i32 { - ^block100: - v919 = arith.constant 0 : i32; - scf.yield v391, v919; + ^block53: + v478 = arith.trunc v469 : i32; + v1115 = arith.constant 0 : i32; + v479 = arith.constant -2147483648 : i32; + v480 = arith.sub v479, v387 : i32 #[overflow = wrapping]; + v482 = hir.bitcast v480 : u32; + v481 = hir.bitcast v478 : u32; + v483 = arith.gt v481, v482 : i1; + v484 = arith.zext v483 : u32; + v485 = hir.bitcast v484 : i32; + v487 = arith.neq v485, v1115 : i1; + v1092, v1093 = scf.if v487 : i32, i32 { + ^block118: + v1114 = arith.constant 0 : i32; + scf.yield v438, v1114; } else { - ^block52: - v441 = arith.constant 20 : i32; - v442 = arith.add v348, v441 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v442, v337, v340, v341) - v917 = arith.constant 20 : i32; - v446 = arith.add v348, v917 : i32 #[overflow = wrapping]; - v918 = arith.constant 8 : i32; - v444 = arith.add v348, v918 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v444, v340, v431, v446, v336) - v448 = arith.constant 12 : u32; - v447 = hir.bitcast v348 : u32; - v449 = arith.add v447, v448 : u32 #[overflow = checked]; - v916 = arith.constant 4 : u32; - v451 = arith.mod v449, v916 : u32; - hir.assertz v451 #[code = 250]; - v452 = hir.int_to_ptr v449 : ptr; - v453 = hir.load v452 : i32; - v455 = arith.constant 8 : u32; - v454 = hir.bitcast v348 : u32; - v456 = arith.add v454, v455 : u32 #[overflow = checked]; - v915 = arith.constant 4 : u32; - v458 = arith.mod v456, v915 : u32; - hir.assertz v458 #[code = 250]; - v459 = hir.int_to_ptr v456 : ptr; - v460 = hir.load v459 : i32; - v913 = arith.constant 0 : i32; - v914 = arith.constant 0 : i32; - v462 = arith.eq v460, v914 : i1; - v463 = arith.zext v462 : u32; - v464 = hir.bitcast v463 : i32; - v466 = arith.neq v464, v913 : i1; - v895 = scf.if v466 : i32 { - ^block53: - v474 = hir.bitcast v337 : u32; - v912 = arith.constant 4 : u32; - v476 = arith.mod v474, v912 : u32; - hir.assertz v476 #[code = 250]; - v477 = hir.int_to_ptr v474 : ptr; - hir.store v477, v418; - v911 = arith.constant 4 : u32; - v478 = hir.bitcast v337 : u32; - v480 = arith.add v478, v911 : u32 #[overflow = checked]; - v910 = arith.constant 4 : u32; - v482 = arith.mod v480, v910 : u32; - hir.assertz v482 #[code = 250]; - v483 = hir.int_to_ptr v480 : ptr; - hir.store v483, v453; - scf.yield v391; + ^block54: + v488 = arith.constant 20 : i32; + v489 = arith.add v395, v488 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v489, v384, v387, v388) + v1112 = arith.constant 20 : i32; + v493 = arith.add v395, v1112 : i32 #[overflow = wrapping]; + v1113 = arith.constant 8 : i32; + v491 = arith.add v395, v1113 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v491, v387, v478, v493, v383) + v495 = arith.constant 12 : u32; + v494 = hir.bitcast v395 : u32; + v496 = arith.add v494, v495 : u32 #[overflow = checked]; + v1111 = arith.constant 4 : u32; + v498 = arith.mod v496, v1111 : u32; + hir.assertz v498 #[code = 250]; + v499 = hir.int_to_ptr v496 : ptr; + v500 = hir.load v499 : i32; + v502 = arith.constant 8 : u32; + v501 = hir.bitcast v395 : u32; + v503 = arith.add v501, v502 : u32 #[overflow = checked]; + v1110 = arith.constant 4 : u32; + v505 = arith.mod v503, v1110 : u32; + hir.assertz v505 #[code = 250]; + v506 = hir.int_to_ptr v503 : ptr; + v507 = hir.load v506 : i32; + v1108 = arith.constant 0 : i32; + v1109 = arith.constant 0 : i32; + v509 = arith.eq v507, v1109 : i1; + v510 = arith.zext v509 : u32; + v511 = hir.bitcast v510 : i32; + v513 = arith.neq v511, v1108 : i1; + v1090 = scf.if v513 : i32 { + ^block55: + v521 = hir.bitcast v384 : u32; + v1107 = arith.constant 4 : u32; + v523 = arith.mod v521, v1107 : u32; + hir.assertz v523 #[code = 250]; + v524 = hir.int_to_ptr v521 : ptr; + hir.store v524, v465; + v1106 = arith.constant 4 : u32; + v525 = hir.bitcast v384 : u32; + v527 = arith.add v525, v1106 : u32 #[overflow = checked]; + v1105 = arith.constant 4 : u32; + v529 = arith.mod v527, v1105 : u32; + hir.assertz v529 #[code = 250]; + v530 = hir.int_to_ptr v527 : ptr; + hir.store v530, v500; + scf.yield v438; } else { - ^block54: - v468 = arith.constant 16 : u32; - v467 = hir.bitcast v348 : u32; - v469 = arith.add v467, v468 : u32 #[overflow = checked]; - v909 = arith.constant 4 : u32; - v471 = arith.mod v469, v909 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - v473 = hir.load v472 : i32; - scf.yield v473; + ^block56: + v515 = arith.constant 16 : u32; + v514 = hir.bitcast v395 : u32; + v516 = arith.add v514, v515 : u32 #[overflow = checked]; + v1104 = arith.constant 4 : u32; + v518 = arith.mod v516, v1104 : u32; + hir.assertz v518 #[code = 250]; + v519 = hir.int_to_ptr v516 : ptr; + v520 = hir.load v519 : i32; + scf.yield v520; }; - v484 = arith.constant -2147483647 : i32; - v896 = cf.select v466, v484, v453 : i32; - scf.yield v895, v896; + v531 = arith.constant -2147483647 : i32; + v1091 = cf.select v513, v531, v500 : i32; + scf.yield v1090, v1091; }; - scf.yield v897, v898; + scf.yield v1092, v1093; }; - scf.yield v899, v900; + scf.yield v1094, v1095; }; - scf.yield v901, v902; + scf.yield v1096, v1097; }; - v908 = arith.constant 4 : u32; - v489 = hir.bitcast v336 : u32; - v491 = arith.add v489, v908 : u32 #[overflow = checked]; - v907 = arith.constant 4 : u32; - v493 = arith.mod v491, v907 : u32; - hir.assertz v493 #[code = 250]; - v494 = hir.int_to_ptr v491 : ptr; - hir.store v494, v903; - v497 = hir.bitcast v336 : u32; - v906 = arith.constant 4 : u32; - v499 = arith.mod v497, v906 : u32; - hir.assertz v499 #[code = 250]; - v500 = hir.int_to_ptr v497 : ptr; - hir.store v500, v904; - v905 = arith.constant 32 : i32; - v504 = arith.add v348, v905 : i32 #[overflow = wrapping]; - v505 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v506 = hir.bitcast v505 : ptr; - hir.store v506, v504; + v1103 = arith.constant 4 : u32; + v536 = hir.bitcast v383 : u32; + v538 = arith.add v536, v1103 : u32 #[overflow = checked]; + v1102 = arith.constant 4 : u32; + v540 = arith.mod v538, v1102 : u32; + hir.assertz v540 #[code = 250]; + v541 = hir.int_to_ptr v538 : ptr; + hir.store v541, v1098; + v544 = hir.bitcast v383 : u32; + v1101 = arith.constant 4 : u32; + v546 = arith.mod v544, v1101 : u32; + hir.assertz v546 #[code = 250]; + v547 = hir.int_to_ptr v544 : ptr; + hir.store v547, v1099; + v1100 = arith.constant 32 : i32; + v551 = arith.add v395, v1100 : i32 #[overflow = wrapping]; + v552 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v553 = hir.bitcast v552 : ptr; + hir.store v553, v551; builtin.ret ; }; - private builtin.function @::allocate(v507: i32, v508: i32, v509: i32) { - ^block55(v507: i32, v508: i32, v509: i32): - v511 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v512 = hir.bitcast v511 : ptr; - v513 = hir.load v512 : i32; - v514 = arith.constant 16 : i32; - v515 = arith.sub v513, v514 : i32 #[overflow = wrapping]; - v516 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v517 = hir.bitcast v516 : ptr; - hir.store v517, v515; - v510 = arith.constant 0 : i32; - v518 = arith.constant 8 : i32; - v519 = arith.add v515, v518 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v519, v508, v509, v510) - v522 = arith.constant 12 : u32; - v521 = hir.bitcast v515 : u32; - v523 = arith.add v521, v522 : u32 #[overflow = checked]; - v524 = arith.constant 4 : u32; - v525 = arith.mod v523, v524 : u32; - hir.assertz v525 #[code = 250]; - v526 = hir.int_to_ptr v523 : ptr; - v527 = hir.load v526 : i32; - v529 = arith.constant 8 : u32; - v528 = hir.bitcast v515 : u32; - v530 = arith.add v528, v529 : u32 #[overflow = checked]; - v937 = arith.constant 4 : u32; - v532 = arith.mod v530, v937 : u32; - hir.assertz v532 #[code = 250]; - v533 = hir.int_to_ptr v530 : ptr; - v534 = hir.load v533 : i32; - v535 = hir.bitcast v507 : u32; - v936 = arith.constant 4 : u32; - v537 = arith.mod v535, v936 : u32; - hir.assertz v537 #[code = 250]; - v538 = hir.int_to_ptr v535 : ptr; - hir.store v538, v534; - v935 = arith.constant 4 : u32; - v539 = hir.bitcast v507 : u32; - v541 = arith.add v539, v935 : u32 #[overflow = checked]; - v934 = arith.constant 4 : u32; - v543 = arith.mod v541, v934 : u32; - hir.assertz v543 #[code = 250]; - v544 = hir.int_to_ptr v541 : ptr; - hir.store v544, v527; - v933 = arith.constant 16 : i32; - v546 = arith.add v515, v933 : i32 #[overflow = wrapping]; - v547 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v548 = hir.bitcast v547 : ptr; - hir.store v548, v546; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v554: i32, v555: i32, v556: i32, v557: i32, v558: i32) { + ^block57(v554: i32, v555: i32, v556: i32, v557: i32, v558: i32): + v561 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v562 = hir.bitcast v561 : ptr; + v563 = hir.load v562 : i32; + v564 = arith.constant 16 : i32; + v565 = arith.sub v563, v564 : i32 #[overflow = wrapping]; + v566 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v567 = hir.bitcast v566 : ptr; + hir.store v567, v565; + v577 = hir.bitcast v555 : u32; + v578 = arith.zext v577 : u64; + v579 = hir.bitcast v578 : i64; + v559 = arith.constant 0 : i32; + v572 = arith.sub v559, v557 : i32 #[overflow = wrapping]; + v569 = arith.constant -1 : i32; + v568 = arith.add v557, v558 : i32 #[overflow = wrapping]; + v570 = arith.add v568, v569 : i32 #[overflow = wrapping]; + v573 = arith.band v570, v572 : i32; + v574 = hir.bitcast v573 : u32; + v575 = arith.zext v574 : u64; + v576 = hir.bitcast v575 : i64; + v580 = arith.mul v576, v579 : i64 #[overflow = wrapping]; + v1231 = arith.constant 0 : i32; + v581 = arith.constant 32 : i64; + v583 = hir.cast v581 : u32; + v582 = hir.bitcast v580 : u64; + v584 = arith.shr v582, v583 : u64; + v585 = hir.bitcast v584 : i64; + v586 = arith.trunc v585 : i32; + v588 = arith.neq v586, v1231 : i1; + v1143, v1144, v1145, v1146, v1147, v1148 = scf.if v588 : i32, i32, i32, i32, i32, u32 { + ^block126: + v1128 = arith.constant 0 : u32; + v1135 = ub.poison i32 : i32; + scf.yield v554, v565, v1135, v1135, v1135, v1128; + } else { + ^block62: + v589 = arith.trunc v580 : i32; + v1230 = arith.constant 0 : i32; + v590 = arith.constant -2147483648 : i32; + v591 = arith.sub v590, v557 : i32 #[overflow = wrapping]; + v593 = hir.bitcast v591 : u32; + v592 = hir.bitcast v589 : u32; + v594 = arith.lte v592, v593 : i1; + v595 = arith.zext v594 : u32; + v596 = hir.bitcast v595 : i32; + v598 = arith.neq v596, v1230 : i1; + v1191 = scf.if v598 : i32 { + ^block60: + v1229 = arith.constant 0 : i32; + v609 = arith.neq v589, v1229 : i1; + v1190 = scf.if v609 : i32 { + ^block64: + v1228 = arith.constant 0 : i32; + v625 = arith.neq v556, v1228 : i1; + v1189 = scf.if v625 : i32 { + ^block67: + v607 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v565, v557, v589, v607) + v636 = hir.bitcast v565 : u32; + v681 = arith.constant 4 : u32; + v638 = arith.mod v636, v681 : u32; + hir.assertz v638 #[code = 250]; + v639 = hir.int_to_ptr v636 : ptr; + v640 = hir.load v639 : i32; + scf.yield v640; + } else { + ^block68: + v626 = arith.constant 8 : i32; + v627 = arith.add v565, v626 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v627, v557, v589) + v611 = arith.constant 8 : u32; + v628 = hir.bitcast v565 : u32; + v630 = arith.add v628, v611 : u32 #[overflow = checked]; + v1227 = arith.constant 4 : u32; + v632 = arith.mod v630, v1227 : u32; + hir.assertz v632 #[code = 250]; + v633 = hir.int_to_ptr v630 : ptr; + v634 = hir.load v633 : i32; + scf.yield v634; + }; + v1225 = arith.constant 0 : i32; + v1226 = arith.constant 0 : i32; + v643 = arith.eq v1189, v1226 : i1; + v644 = arith.zext v643 : u32; + v645 = hir.bitcast v644 : i32; + v647 = arith.neq v645, v1225 : i1; + scf.if v647{ + ^block69: + v1224 = arith.constant 8 : u32; + v664 = hir.bitcast v554 : u32; + v666 = arith.add v664, v1224 : u32 #[overflow = checked]; + v1223 = arith.constant 4 : u32; + v668 = arith.mod v666, v1223 : u32; + hir.assertz v668 #[code = 250]; + v669 = hir.int_to_ptr v666 : ptr; + hir.store v669, v589; + v1222 = arith.constant 4 : u32; + v671 = hir.bitcast v554 : u32; + v673 = arith.add v671, v1222 : u32 #[overflow = checked]; + v1221 = arith.constant 4 : u32; + v675 = arith.mod v673, v1221 : u32; + hir.assertz v675 #[code = 250]; + v676 = hir.int_to_ptr v673 : ptr; + hir.store v676, v557; + scf.yield ; + } else { + ^block70: + v1220 = arith.constant 8 : u32; + v649 = hir.bitcast v554 : u32; + v651 = arith.add v649, v1220 : u32 #[overflow = checked]; + v1219 = arith.constant 4 : u32; + v653 = arith.mod v651, v1219 : u32; + hir.assertz v653 #[code = 250]; + v654 = hir.int_to_ptr v651 : ptr; + hir.store v654, v1189; + v1218 = arith.constant 4 : u32; + v656 = hir.bitcast v554 : u32; + v658 = arith.add v656, v1218 : u32 #[overflow = checked]; + v1217 = arith.constant 4 : u32; + v660 = arith.mod v658, v1217 : u32; + hir.assertz v660 #[code = 250]; + v661 = hir.int_to_ptr v658 : ptr; + hir.store v661, v555; + scf.yield ; + }; + v1215 = arith.constant 0 : i32; + v1216 = arith.constant 1 : i32; + v1188 = cf.select v647, v1216, v1215 : i32; + scf.yield v1188; + } else { + ^block65: + v1214 = arith.constant 8 : u32; + v610 = hir.bitcast v554 : u32; + v612 = arith.add v610, v1214 : u32 #[overflow = checked]; + v1213 = arith.constant 4 : u32; + v614 = arith.mod v612, v1213 : u32; + hir.assertz v614 #[code = 250]; + v615 = hir.int_to_ptr v612 : ptr; + hir.store v615, v557; + v1212 = arith.constant 4 : u32; + v618 = hir.bitcast v554 : u32; + v620 = arith.add v618, v1212 : u32 #[overflow = checked]; + v1211 = arith.constant 4 : u32; + v622 = arith.mod v620, v1211 : u32; + hir.assertz v622 #[code = 250]; + v1210 = arith.constant 0 : i32; + v623 = hir.int_to_ptr v620 : ptr; + hir.store v623, v1210; + v1209 = arith.constant 0 : i32; + scf.yield v1209; + }; + scf.yield v1190; + } else { + ^block63: + v1208 = ub.poison i32 : i32; + scf.yield v1208; + }; + v1203 = arith.constant 0 : u32; + v1136 = arith.constant 1 : u32; + v1196 = cf.select v598, v1136, v1203 : u32; + v1204 = ub.poison i32 : i32; + v1195 = cf.select v598, v565, v1204 : i32; + v1205 = ub.poison i32 : i32; + v1194 = cf.select v598, v554, v1205 : i32; + v1206 = ub.poison i32 : i32; + v1193 = cf.select v598, v1206, v565 : i32; + v1207 = ub.poison i32 : i32; + v1192 = cf.select v598, v1207, v554 : i32; + scf.yield v1192, v1193, v1194, v1191, v1195, v1196; + }; + v1149, v1150, v1151 = scf.index_switch v1148 : i32, i32, i32 + case 0 { + ^block61: + v1202 = arith.constant 4 : u32; + v601 = hir.bitcast v1143 : u32; + v603 = arith.add v601, v1202 : u32 #[overflow = checked]; + v1201 = arith.constant 4 : u32; + v605 = arith.mod v603, v1201 : u32; + hir.assertz v605 #[code = 250]; + v1200 = arith.constant 0 : i32; + v606 = hir.int_to_ptr v603 : ptr; + hir.store v606, v1200; + v1199 = arith.constant 1 : i32; + scf.yield v1143, v1199, v1144; + } + default { + ^block130: + scf.yield v1145, v1146, v1147; + }; + v680 = hir.bitcast v1149 : u32; + v1198 = arith.constant 4 : u32; + v682 = arith.mod v680, v1198 : u32; + hir.assertz v682 #[code = 250]; + v683 = hir.int_to_ptr v680 : ptr; + hir.store v683, v1150; + v1197 = arith.constant 16 : i32; + v688 = arith.add v1151, v1197 : i32 #[overflow = wrapping]; + v689 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v690 = hir.bitcast v689 : ptr; + hir.store v690, v688; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v549: i32, v550: i32, v551: i32, v552: i32) { - ^block57(v549: i32, v550: i32, v551: i32, v552: i32): - v953 = arith.constant 0 : i32; - v553 = arith.constant 0 : i32; - v554 = arith.eq v551, v553 : i1; - v555 = arith.zext v554 : u32; - v556 = hir.bitcast v555 : i32; - v558 = arith.neq v556, v953 : i1; - v949 = scf.if v558 : i32 { - ^block108: - scf.yield v550; + private builtin.function @::allocate(v691: i32, v692: i32, v693: i32) { + ^block71(v691: i32, v692: i32, v693: i32): + v695 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v696 = hir.bitcast v695 : ptr; + v697 = hir.load v696 : i32; + v698 = arith.constant 16 : i32; + v699 = arith.sub v697, v698 : i32 #[overflow = wrapping]; + v700 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v701 = hir.bitcast v700 : ptr; + hir.store v701, v699; + v694 = arith.constant 0 : i32; + v702 = arith.constant 8 : i32; + v703 = arith.add v699, v702 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v703, v692, v693, v694) + v706 = arith.constant 12 : u32; + v705 = hir.bitcast v699 : u32; + v707 = arith.add v705, v706 : u32 #[overflow = checked]; + v708 = arith.constant 4 : u32; + v709 = arith.mod v707, v708 : u32; + hir.assertz v709 #[code = 250]; + v710 = hir.int_to_ptr v707 : ptr; + v711 = hir.load v710 : i32; + v713 = arith.constant 8 : u32; + v712 = hir.bitcast v699 : u32; + v714 = arith.add v712, v713 : u32 #[overflow = checked]; + v1236 = arith.constant 4 : u32; + v716 = arith.mod v714, v1236 : u32; + hir.assertz v716 #[code = 250]; + v717 = hir.int_to_ptr v714 : ptr; + v718 = hir.load v717 : i32; + v719 = hir.bitcast v691 : u32; + v1235 = arith.constant 4 : u32; + v721 = arith.mod v719, v1235 : u32; + hir.assertz v721 #[code = 250]; + v722 = hir.int_to_ptr v719 : ptr; + hir.store v722, v718; + v1234 = arith.constant 4 : u32; + v723 = hir.bitcast v691 : u32; + v725 = arith.add v723, v1234 : u32 #[overflow = checked]; + v1233 = arith.constant 4 : u32; + v727 = arith.mod v725, v1233 : u32; + hir.assertz v727 #[code = 250]; + v728 = hir.int_to_ptr v725 : ptr; + hir.store v728, v711; + v1232 = arith.constant 16 : i32; + v730 = arith.add v699, v1232 : i32 #[overflow = wrapping]; + v731 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v732 = hir.bitcast v731 : ptr; + hir.store v732, v730; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v733: i32, v734: i32, v735: i32, v736: i32) { + ^block73(v733: i32, v734: i32, v735: i32, v736: i32): + v1252 = arith.constant 0 : i32; + v737 = arith.constant 0 : i32; + v738 = arith.eq v735, v737 : i1; + v739 = arith.zext v738 : u32; + v740 = hir.bitcast v739 : i32; + v742 = arith.neq v740, v1252 : i1; + v1248 = scf.if v742 : i32 { + ^block133: + scf.yield v734; } else { - ^block60: + ^block76: hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v952 = arith.constant 0 : i32; - v560 = arith.neq v552, v952 : i1; - v948 = scf.if v560 : i32 { - ^block61: - v562 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v551, v550) : i32 - scf.yield v562; + v1251 = arith.constant 0 : i32; + v744 = arith.neq v736, v1251 : i1; + v1247 = scf.if v744 : i32 { + ^block77: + v746 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v735, v734) : i32 + scf.yield v746; } else { - ^block62: - v561 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v551, v550) : i32 - scf.yield v561; + ^block78: + v745 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v735, v734) : i32 + scf.yield v745; }; - scf.yield v948; + scf.yield v1247; }; - v566 = arith.constant 4 : u32; - v565 = hir.bitcast v549 : u32; - v567 = arith.add v565, v566 : u32 #[overflow = checked]; - v951 = arith.constant 4 : u32; - v569 = arith.mod v567, v951 : u32; - hir.assertz v569 #[code = 250]; - v570 = hir.int_to_ptr v567 : ptr; - hir.store v570, v551; - v572 = hir.bitcast v549 : u32; - v950 = arith.constant 4 : u32; - v574 = arith.mod v572, v950 : u32; - hir.assertz v574 #[code = 250]; - v575 = hir.int_to_ptr v572 : ptr; - hir.store v575, v949; + v750 = arith.constant 4 : u32; + v749 = hir.bitcast v733 : u32; + v751 = arith.add v749, v750 : u32 #[overflow = checked]; + v1250 = arith.constant 4 : u32; + v753 = arith.mod v751, v1250 : u32; + hir.assertz v753 #[code = 250]; + v754 = hir.int_to_ptr v751 : ptr; + hir.store v754, v735; + v756 = hir.bitcast v733 : u32; + v1249 = arith.constant 4 : u32; + v758 = arith.mod v756, v1249 : u32; + hir.assertz v758 #[code = 250]; + v759 = hir.int_to_ptr v756 : ptr; + hir.store v759, v1248; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v576: i32, v577: i32, v578: i32, v579: i32) { - ^block63(v576: i32, v577: i32, v578: i32, v579: i32): - v979 = arith.constant 0 : i32; - v580 = arith.constant 0 : i32; - v584 = arith.eq v579, v580 : i1; - v585 = arith.zext v584 : u32; - v586 = hir.bitcast v585 : i32; - v588 = arith.neq v586, v979 : i1; - v966, v967 = scf.if v588 : i32, i32 { - ^block112: - v978 = arith.constant 0 : i32; - v582 = arith.constant 4 : i32; - scf.yield v582, v978; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v760: i32, v761: i32, v762: i32, v763: i32) { + ^block79(v760: i32, v761: i32, v762: i32, v763: i32): + v1278 = arith.constant 0 : i32; + v764 = arith.constant 0 : i32; + v768 = arith.eq v763, v764 : i1; + v769 = arith.zext v768 : u32; + v770 = hir.bitcast v769 : i32; + v772 = arith.neq v770, v1278 : i1; + v1265, v1266 = scf.if v772 : i32, i32 { + ^block137: + v1277 = arith.constant 0 : i32; + v766 = arith.constant 4 : i32; + scf.yield v766, v1277; } else { - ^block66: - v589 = hir.bitcast v577 : u32; - v624 = arith.constant 4 : u32; - v591 = arith.mod v589, v624 : u32; - hir.assertz v591 #[code = 250]; - v592 = hir.int_to_ptr v589 : ptr; - v593 = hir.load v592 : i32; - v976 = arith.constant 0 : i32; - v977 = arith.constant 0 : i32; - v595 = arith.eq v593, v977 : i1; - v596 = arith.zext v595 : u32; - v597 = hir.bitcast v596 : i32; - v599 = arith.neq v597, v976 : i1; - v964 = scf.if v599 : i32 { - ^block111: - v975 = arith.constant 0 : i32; - scf.yield v975; + ^block82: + v773 = hir.bitcast v761 : u32; + v808 = arith.constant 4 : u32; + v775 = arith.mod v773, v808 : u32; + hir.assertz v775 #[code = 250]; + v776 = hir.int_to_ptr v773 : ptr; + v777 = hir.load v776 : i32; + v1275 = arith.constant 0 : i32; + v1276 = arith.constant 0 : i32; + v779 = arith.eq v777, v1276 : i1; + v780 = arith.zext v779 : u32; + v781 = hir.bitcast v780 : i32; + v783 = arith.neq v781, v1275 : i1; + v1263 = scf.if v783 : i32 { + ^block136: + v1274 = arith.constant 0 : i32; + scf.yield v1274; } else { - ^block67: - v974 = arith.constant 4 : u32; - v600 = hir.bitcast v576 : u32; - v602 = arith.add v600, v974 : u32 #[overflow = checked]; - v973 = arith.constant 4 : u32; - v604 = arith.mod v602, v973 : u32; - hir.assertz v604 #[code = 250]; - v605 = hir.int_to_ptr v602 : ptr; - hir.store v605, v578; - v972 = arith.constant 4 : u32; - v606 = hir.bitcast v577 : u32; - v608 = arith.add v606, v972 : u32 #[overflow = checked]; - v971 = arith.constant 4 : u32; - v610 = arith.mod v608, v971 : u32; - hir.assertz v610 #[code = 250]; - v611 = hir.int_to_ptr v608 : ptr; - v612 = hir.load v611 : i32; - v613 = hir.bitcast v576 : u32; - v970 = arith.constant 4 : u32; - v615 = arith.mod v613, v970 : u32; - hir.assertz v615 #[code = 250]; - v616 = hir.int_to_ptr v613 : ptr; - hir.store v616, v612; - v617 = arith.mul v593, v579 : i32 #[overflow = wrapping]; - scf.yield v617; + ^block83: + v1273 = arith.constant 4 : u32; + v784 = hir.bitcast v760 : u32; + v786 = arith.add v784, v1273 : u32 #[overflow = checked]; + v1272 = arith.constant 4 : u32; + v788 = arith.mod v786, v1272 : u32; + hir.assertz v788 #[code = 250]; + v789 = hir.int_to_ptr v786 : ptr; + hir.store v789, v762; + v1271 = arith.constant 4 : u32; + v790 = hir.bitcast v761 : u32; + v792 = arith.add v790, v1271 : u32 #[overflow = checked]; + v1270 = arith.constant 4 : u32; + v794 = arith.mod v792, v1270 : u32; + hir.assertz v794 #[code = 250]; + v795 = hir.int_to_ptr v792 : ptr; + v796 = hir.load v795 : i32; + v797 = hir.bitcast v760 : u32; + v1269 = arith.constant 4 : u32; + v799 = arith.mod v797, v1269 : u32; + hir.assertz v799 #[code = 250]; + v800 = hir.int_to_ptr v797 : ptr; + hir.store v800, v796; + v801 = arith.mul v777, v763 : i32 #[overflow = wrapping]; + scf.yield v801; }; - v618 = arith.constant 8 : i32; - v969 = arith.constant 4 : i32; - v965 = cf.select v599, v969, v618 : i32; - scf.yield v965, v964; + v802 = arith.constant 8 : i32; + v1268 = arith.constant 4 : i32; + v1264 = cf.select v783, v1268, v802 : i32; + scf.yield v1264, v1263; }; - v621 = arith.add v576, v966 : i32 #[overflow = wrapping]; - v623 = hir.bitcast v621 : u32; - v968 = arith.constant 4 : u32; - v625 = arith.mod v623, v968 : u32; - hir.assertz v625 #[code = 250]; - v626 = hir.int_to_ptr v623 : ptr; - hir.store v626, v967; + v805 = arith.add v760, v1265 : i32 #[overflow = wrapping]; + v807 = hir.bitcast v805 : u32; + v1267 = arith.constant 4 : u32; + v809 = arith.mod v807, v1267 : u32; + hir.assertz v809 #[code = 250]; + v810 = hir.int_to_ptr v807 : ptr; + hir.store v810, v1266; builtin.ret ; }; - private builtin.function @alloc::raw_vec::finish_grow(v627: i32, v628: i32, v629: i32, v630: i32, v631: i32) { - ^block68(v627: i32, v628: i32, v629: i32, v630: i32, v631: i32): - v633 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v634 = hir.bitcast v633 : ptr; - v635 = hir.load v634 : i32; - v636 = arith.constant 16 : i32; - v637 = arith.sub v635, v636 : i32 #[overflow = wrapping]; - v638 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v639 = hir.bitcast v638 : ptr; - hir.store v639, v637; - v1034 = arith.constant 0 : i32; - v632 = arith.constant 0 : i32; - v642 = arith.gte v629, v632 : i1; - v643 = arith.zext v642 : u32; - v644 = hir.bitcast v643 : i32; - v646 = arith.neq v644, v1034 : i1; - v1008, v1009 = scf.if v646 : i32, i32 { - ^block71: - v733 = arith.constant 4 : u32; - v649 = hir.bitcast v630 : u32; - v651 = arith.add v649, v733 : u32 #[overflow = checked]; - v1033 = arith.constant 4 : u32; - v653 = arith.mod v651, v1033 : u32; - hir.assertz v653 #[code = 250]; - v654 = hir.int_to_ptr v651 : ptr; - v655 = hir.load v654 : i32; - v1031 = arith.constant 0 : i32; - v1032 = arith.constant 0 : i32; - v657 = arith.eq v655, v1032 : i1; - v658 = arith.zext v657 : u32; - v659 = hir.bitcast v658 : i32; - v661 = arith.neq v659, v1031 : i1; - v1006, v1007 = scf.if v661 : i32, i32 { - ^block74: - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v637, v628, v629) - v1030 = arith.constant 4 : u32; - v694 = hir.bitcast v637 : u32; - v696 = arith.add v694, v1030 : u32 #[overflow = checked]; - v1029 = arith.constant 4 : u32; - v698 = arith.mod v696, v1029 : u32; - hir.assertz v698 #[code = 250]; - v699 = hir.int_to_ptr v696 : ptr; - v700 = hir.load v699 : i32; - v701 = hir.bitcast v637 : u32; - v1028 = arith.constant 4 : u32; - v703 = arith.mod v701, v1028 : u32; - hir.assertz v703 #[code = 250]; - v704 = hir.int_to_ptr v701 : ptr; - v705 = hir.load v704 : i32; - scf.yield v705, v700; + private builtin.function @alloc::raw_vec::finish_grow(v811: i32, v812: i32, v813: i32, v814: i32, v815: i32) { + ^block84(v811: i32, v812: i32, v813: i32, v814: i32, v815: i32): + v817 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v818 = hir.bitcast v817 : ptr; + v819 = hir.load v818 : i32; + v820 = arith.constant 16 : i32; + v821 = arith.sub v819, v820 : i32 #[overflow = wrapping]; + v822 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v823 = hir.bitcast v822 : ptr; + hir.store v823, v821; + v1333 = arith.constant 0 : i32; + v816 = arith.constant 0 : i32; + v826 = arith.gte v813, v816 : i1; + v827 = arith.zext v826 : u32; + v828 = hir.bitcast v827 : i32; + v830 = arith.neq v828, v1333 : i1; + v1307, v1308 = scf.if v830 : i32, i32 { + ^block87: + v917 = arith.constant 4 : u32; + v833 = hir.bitcast v814 : u32; + v835 = arith.add v833, v917 : u32 #[overflow = checked]; + v1332 = arith.constant 4 : u32; + v837 = arith.mod v835, v1332 : u32; + hir.assertz v837 #[code = 250]; + v838 = hir.int_to_ptr v835 : ptr; + v839 = hir.load v838 : i32; + v1330 = arith.constant 0 : i32; + v1331 = arith.constant 0 : i32; + v841 = arith.eq v839, v1331 : i1; + v842 = arith.zext v841 : u32; + v843 = hir.bitcast v842 : i32; + v845 = arith.neq v843, v1330 : i1; + v1305, v1306 = scf.if v845 : i32, i32 { + ^block90: + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v821, v812, v813) + v1329 = arith.constant 4 : u32; + v878 = hir.bitcast v821 : u32; + v880 = arith.add v878, v1329 : u32 #[overflow = checked]; + v1328 = arith.constant 4 : u32; + v882 = arith.mod v880, v1328 : u32; + hir.assertz v882 #[code = 250]; + v883 = hir.int_to_ptr v880 : ptr; + v884 = hir.load v883 : i32; + v885 = hir.bitcast v821 : u32; + v1327 = arith.constant 4 : u32; + v887 = arith.mod v885, v1327 : u32; + hir.assertz v887 #[code = 250]; + v888 = hir.int_to_ptr v885 : ptr; + v889 = hir.load v888 : i32; + scf.yield v889, v884; } else { - ^block75: - v663 = arith.constant 8 : u32; - v662 = hir.bitcast v630 : u32; - v664 = arith.add v662, v663 : u32 #[overflow = checked]; - v1027 = arith.constant 4 : u32; - v666 = arith.mod v664, v1027 : u32; - hir.assertz v666 #[code = 250]; - v667 = hir.int_to_ptr v664 : ptr; - v668 = hir.load v667 : i32; - v1026 = arith.constant 0 : i32; - v670 = arith.neq v668, v1026 : i1; - v1004, v1005 = scf.if v670 : i32, i32 { - ^block76: - v688 = hir.bitcast v630 : u32; - v1025 = arith.constant 4 : u32; - v690 = arith.mod v688, v1025 : u32; - hir.assertz v690 #[code = 250]; - v691 = hir.int_to_ptr v688 : ptr; - v692 = hir.load v691 : i32; - v693 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v692, v668, v628, v629) : i32 - scf.yield v693, v629; + ^block91: + v847 = arith.constant 8 : u32; + v846 = hir.bitcast v814 : u32; + v848 = arith.add v846, v847 : u32 #[overflow = checked]; + v1326 = arith.constant 4 : u32; + v850 = arith.mod v848, v1326 : u32; + hir.assertz v850 #[code = 250]; + v851 = hir.int_to_ptr v848 : ptr; + v852 = hir.load v851 : i32; + v1325 = arith.constant 0 : i32; + v854 = arith.neq v852, v1325 : i1; + v1303, v1304 = scf.if v854 : i32, i32 { + ^block92: + v872 = hir.bitcast v814 : u32; + v1324 = arith.constant 4 : u32; + v874 = arith.mod v872, v1324 : u32; + hir.assertz v874 #[code = 250]; + v875 = hir.int_to_ptr v872 : ptr; + v876 = hir.load v875 : i32; + v877 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v876, v852, v812, v813) : i32 + scf.yield v877, v813; } else { - ^block77: - v1024 = arith.constant 0 : i32; - v727 = arith.constant 8 : i32; - v672 = arith.add v637, v727 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v672, v628, v629, v1024) - v675 = arith.constant 12 : u32; - v674 = hir.bitcast v637 : u32; - v676 = arith.add v674, v675 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v678 = arith.mod v676, v1023 : u32; - hir.assertz v678 #[code = 250]; - v679 = hir.int_to_ptr v676 : ptr; - v680 = hir.load v679 : i32; - v1022 = arith.constant 8 : u32; - v681 = hir.bitcast v637 : u32; - v683 = arith.add v681, v1022 : u32 #[overflow = checked]; - v1021 = arith.constant 4 : u32; - v685 = arith.mod v683, v1021 : u32; - hir.assertz v685 #[code = 250]; - v686 = hir.int_to_ptr v683 : ptr; - v687 = hir.load v686 : i32; - scf.yield v687, v680; + ^block93: + v1323 = arith.constant 0 : i32; + v911 = arith.constant 8 : i32; + v856 = arith.add v821, v911 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v856, v812, v813, v1323) + v859 = arith.constant 12 : u32; + v858 = hir.bitcast v821 : u32; + v860 = arith.add v858, v859 : u32 #[overflow = checked]; + v1322 = arith.constant 4 : u32; + v862 = arith.mod v860, v1322 : u32; + hir.assertz v862 #[code = 250]; + v863 = hir.int_to_ptr v860 : ptr; + v864 = hir.load v863 : i32; + v1321 = arith.constant 8 : u32; + v865 = hir.bitcast v821 : u32; + v867 = arith.add v865, v1321 : u32 #[overflow = checked]; + v1320 = arith.constant 4 : u32; + v869 = arith.mod v867, v1320 : u32; + hir.assertz v869 #[code = 250]; + v870 = hir.int_to_ptr v867 : ptr; + v871 = hir.load v870 : i32; + scf.yield v871, v864; }; - scf.yield v1004, v1005; + scf.yield v1303, v1304; }; - v1020 = arith.constant 4 : u32; - v712 = hir.bitcast v627 : u32; - v714 = arith.add v712, v1020 : u32 #[overflow = checked]; - v1019 = arith.constant 4 : u32; - v716 = arith.mod v714, v1019 : u32; - hir.assertz v716 #[code = 250]; - v1018 = arith.constant 0 : i32; - v710 = arith.neq v1006, v1018 : i1; - v711 = cf.select v710, v1006, v628 : i32; - v717 = hir.int_to_ptr v714 : ptr; - hir.store v717, v711; - v1016 = arith.constant 0 : i32; - v724 = arith.eq v1006, v1016 : i1; - v725 = arith.zext v724 : u32; - v726 = hir.bitcast v725 : i32; - v1017 = arith.constant 0 : i32; - v721 = arith.neq v1006, v1017 : i1; - v722 = cf.select v721, v1007, v629 : i32; - scf.yield v722, v726; + v1319 = arith.constant 4 : u32; + v896 = hir.bitcast v811 : u32; + v898 = arith.add v896, v1319 : u32 #[overflow = checked]; + v1318 = arith.constant 4 : u32; + v900 = arith.mod v898, v1318 : u32; + hir.assertz v900 #[code = 250]; + v1317 = arith.constant 0 : i32; + v894 = arith.neq v1305, v1317 : i1; + v895 = cf.select v894, v1305, v812 : i32; + v901 = hir.int_to_ptr v898 : ptr; + hir.store v901, v895; + v1315 = arith.constant 0 : i32; + v908 = arith.eq v1305, v1315 : i1; + v909 = arith.zext v908 : u32; + v910 = hir.bitcast v909 : i32; + v1316 = arith.constant 0 : i32; + v905 = arith.neq v1305, v1316 : i1; + v906 = cf.select v905, v1306, v813 : i32; + scf.yield v906, v910; } else { - ^block72: - v647 = arith.constant 1 : i32; - v1015 = arith.constant 0 : i32; - scf.yield v1015, v647; + ^block88: + v831 = arith.constant 1 : i32; + v1314 = arith.constant 0 : i32; + scf.yield v1314, v831; }; - v648 = arith.constant 4 : i32; - v1014 = arith.constant 8 : i32; - v1010 = cf.select v646, v1014, v648 : i32; - v730 = arith.add v627, v1010 : i32 #[overflow = wrapping]; - v732 = hir.bitcast v730 : u32; - v1013 = arith.constant 4 : u32; - v734 = arith.mod v732, v1013 : u32; - hir.assertz v734 #[code = 250]; - v735 = hir.int_to_ptr v732 : ptr; - hir.store v735, v1008; - v737 = hir.bitcast v627 : u32; - v1012 = arith.constant 4 : u32; - v739 = arith.mod v737, v1012 : u32; - hir.assertz v739 #[code = 250]; - v740 = hir.int_to_ptr v737 : ptr; - hir.store v740, v1009; - v1011 = arith.constant 16 : i32; - v744 = arith.add v637, v1011 : i32 #[overflow = wrapping]; - v745 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v746 = hir.bitcast v745 : ptr; - hir.store v746, v744; + v832 = arith.constant 4 : i32; + v1313 = arith.constant 8 : i32; + v1309 = cf.select v830, v1313, v832 : i32; + v914 = arith.add v811, v1309 : i32 #[overflow = wrapping]; + v916 = hir.bitcast v914 : u32; + v1312 = arith.constant 4 : u32; + v918 = arith.mod v916, v1312 : u32; + hir.assertz v918 #[code = 250]; + v919 = hir.int_to_ptr v916 : ptr; + hir.store v919, v1307; + v921 = hir.bitcast v811 : u32; + v1311 = arith.constant 4 : u32; + v923 = arith.mod v921, v1311 : u32; + hir.assertz v923 #[code = 250]; + v924 = hir.int_to_ptr v921 : ptr; + hir.store v924, v1308; + v1310 = arith.constant 16 : i32; + v928 = arith.add v821, v1310 : i32 #[overflow = wrapping]; + v929 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v930 = hir.bitcast v929 : ptr; + hir.store v930, v928; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v747: i32, v748: i32, v749: i32) { - ^block78(v747: i32, v748: i32, v749: i32): + private builtin.function @alloc::raw_vec::handle_error(v931: i32, v932: i32, v933: i32) { + ^block94(v931: i32, v932: i32, v933: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v750: i32, v751: i32) -> i32 { - ^block80(v750: i32, v751: i32): - v758 = arith.constant 0 : i32; - v754 = hir.bitcast v751 : u32; - v753 = hir.bitcast v750 : u32; - v755 = arith.gt v753, v754 : i1; - v756 = arith.zext v755 : u32; - v757 = hir.bitcast v756 : i32; - v759 = arith.neq v757, v758 : i1; - v760 = cf.select v759, v750, v751 : i32; - builtin.ret v760; + private builtin.function @core::ptr::alignment::Alignment::max(v934: i32, v935: i32) -> i32 { + ^block96(v934: i32, v935: i32): + v942 = arith.constant 0 : i32; + v938 = hir.bitcast v935 : u32; + v937 = hir.bitcast v934 : u32; + v939 = arith.gt v937, v938 : i1; + v940 = arith.zext v939 : u32; + v941 = hir.bitcast v940 : i32; + v943 = arith.neq v941, v942 : i1; + v944 = cf.select v943, v934, v935 : i32; + builtin.ret v944; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.masm b/felt-repr/tests/expected/onchain_five_felts_struct.masm index cdcbc0f77..58373b742 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.masm +++ b/felt-repr/tests/expected/onchain_five_felts_struct.masm @@ -256,7 +256,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub push.1114144 dup.1 @@ -362,113 +362,26 @@ pub proc entrypoint(i32, i32) exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::felt::assert_eq trace.252 nop - push.8 - push.4 - dup.7 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.7 - add - u32assert push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz push.0 - push.4 - movup.2 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.7 - u32wrapping_add - movup.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.6 - u32wrapping_add - movup.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.5 - u32wrapping_add - movup.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.4 + push.256 + push.20 + dup.9 u32wrapping_add - movup.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 dup.3 - u32wrapping_add - movup.2 + swap.4 + swap.3 + swap.2 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVecInner::try_allocate_in trace.252 nop - push.4 - dup.1 - swap.1 - u32mod + push.24 + dup.6 + add u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - u32wrapping_add push.4 dup.1 swap.1 @@ -479,11 +392,11 @@ pub proc entrypoint(i32, i32) swap.1 trace.240 nop - exec.::intrinsics::mem::store_sw + exec.::intrinsics::mem::load_sw trace.252 nop - push.4 - dup.1 + push.20 + dup.7 add u32assert push.4 @@ -496,157 +409,262 @@ pub proc entrypoint(i32, i32) swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc + exec.::intrinsics::mem::load_sw trace.252 nop push.0 - push.0 - dup.2 - eq + push.1 + movup.2 + neq neq if.true - movdn.3 - drop - drop - drop - else + push.8 + push.8 + dup.8 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz push.0 - dup.2 - dup.5 swap.1 - u32lt - neq + u32divmod.4 swap.1 - swap.4 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + dup.8 + add + u32assert + push.4 + dup.1 swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.9 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.8 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.7 + u32wrapping_add + movup.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.8 + dup.6 + u32wrapping_add + movup.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.8 + dup.5 + u32wrapping_add + movup.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.8 + dup.4 + u32wrapping_add + movup.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movdn.5 + dropw + drop + movup.2 + drop + push.28 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert end end @callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 +proc __rustc::__rust_alloc(i32, i32) -> i32 push.1048604 - dup.1 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 swap.2 - swap.3 + swap.4 swap.1 trace.240 nop @@ -659,32 +677,60 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 eq neq if.true - swap.1 + movdn.3 + drop + drop drop else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop push.0 push.0 - dup.3 + dup.2 eq neq if.true - swap.1 + drop drop else - push.0 - movup.2 dup.2 + movup.2 push.0 - dup.2 + dup.3 push.0 gte while.true - dup.1 + dup.2 dup.1 push.1 u32overflowing_madd assertz - dup.4 + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and swap.1 u32divmod.4 swap.1 @@ -709,7 +755,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 mem_store u32wrapping_add.1 dup.0 - dup.3 + dup.4 u32gte end dropw @@ -718,10 +764,86 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 end @callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop end @callconv("C") @@ -1313,6 +1435,419 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( nop end +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.2 + push.0 + push.0 + dup.7 + u32wrapping_sub + push.4294967295 + movup.9 + dup.9 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + push.3735929054 + dup.0 + dup.1 + swap.4 + swap.1 + swap.3 + swap.5 + else + drop + push.0 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte + neq + dup.0 + if.true + push.0 + dup.2 + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.3 + u32wrapping_add + dup.6 + dup.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::allocate + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + movup.6 + movup.2 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.7 + movup.4 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.0 + push.1 + movup.2 + cdrop + else + movup.2 + swap.5 + movdn.2 + swap.4 + swap.1 + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + swap.3 + swap.2 + swap.1 + end + else + swap.1 + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.3735929054 + end + push.0 + push.1 + dup.3 + cdrop + push.3735929054 + dup.3 + dup.5 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.7 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + movup.2 + swap.7 + movdn.2 + swap.1 + swap.5 + cdrop + swap.1 + swap.5 + swap.4 + swap.2 + swap.3 + swap.1 + end + movup.5 + eq.0 + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + swap.1 + else + drop + drop + end + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + @callconv("C") proc ::allocate( i32, diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.wat b/felt-repr/tests/expected/onchain_five_felts_struct.wat index b2846309e..4485b22da 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.wat +++ b/felt-repr/tests/expected/onchain_five_felts_struct.wat @@ -10,9 +10,9 @@ (type (;8;) (func (param i32) (result f32))) (type (;9;) (func (param f32 f32))) (type (;10;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32))) - (type (;12;) (func (param i32 i32 i32 i32))) - (type (;13;) (func (param i32 i32 i32 i32 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))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -82,9 +82,9 @@ global.set $__stack_pointer ) (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 f32 f32 f32) + (local i32 f32 f32 f32 f32 f32 i32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 2 global.set $__stack_pointer @@ -107,53 +107,81 @@ call $intrinsics::felt::from_u32 call $intrinsics::felt::assert_eq local.get 2 + i32.const 20 + i32.add + i32.const 256 + i32.const 0 i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::try_allocate_in + local.get 2 + i32.load offset=24 + local.set 1 + block ;; label = @1 + local.get 2 + i32.load offset=20 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 1 + local.get 2 + i32.load offset=28 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 2 + i32.const 8 i32.add i32.const 8 i32.add - local.tee 1 + local.tee 8 i32.const 0 i32.store local.get 2 - i64.const 17179869184 - i64.store offset=4 align=4 local.get 2 - i32.const 4 + i32.load offset=28 + i32.store offset=12 + local.get 2 + local.get 1 + i32.store offset=8 + local.get 2 + i32.const 8 i32.add local.get 6 call $alloc::vec::Vec::push local.get 2 - i32.const 4 + i32.const 8 i32.add local.get 5 call $alloc::vec::Vec::push local.get 2 - i32.const 4 + i32.const 8 i32.add local.get 4 call $alloc::vec::Vec::push local.get 2 - i32.const 4 + i32.const 8 i32.add local.get 3 call $alloc::vec::Vec::push local.get 2 - i32.const 4 + i32.const 8 i32.add local.get 7 call $alloc::vec::Vec::push local.get 0 i32.const 8 i32.add - local.get 1 + local.get 8 i32.load i32.store local.get 0 local.get 2 - i64.load offset=4 align=4 + i64.load offset=8 align=4 i64.store align=4 local.get 2 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer ) @@ -419,7 +447,119 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;12;) (type 11) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;12;) (type 11) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;13;) (type 12) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -448,7 +588,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;13;) (type 12) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;14;) (type 13) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -475,7 +615,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;14;) (type 12) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;15;) (type 13) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -510,7 +650,7 @@ local.get 4 i32.store ) - (func $alloc::raw_vec::finish_grow (;15;) (type 13) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::finish_grow (;16;) (type 11) (param i32 i32 i32 i32 i32) (local i32 i32) global.get $__stack_pointer i32.const 16 @@ -609,10 +749,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;16;) (type 11) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;17;) (type 12) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;17;) (type 3) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;18;) (type 3) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.hir b/felt-repr/tests/expected/onchain_two_felts_struct.hir index 3451b7a36..a1d21fade 100644 --- a/felt-repr/tests/expected/onchain_two_felts_struct.hir +++ b/felt-repr/tests/expected/onchain_two_felts_struct.hir @@ -11,8 +11,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : i32; v10 = hir.bitcast v0 : u32; - v737 = arith.constant 4 : u32; - v12 = arith.mod v10, v737 : u32; + v921 = arith.constant 4 : u32; + v12 = arith.mod v10, v921 : u32; hir.assertz v12 #[code = 250]; v13 = hir.int_to_ptr v10 : ptr; v14 = hir.load v13 : i32; @@ -22,35 +22,35 @@ builtin.component root_ns:root@1.0.0 { v17 = hir.bitcast v16 : i32; v19 = arith.neq v17, v2 : i1; scf.if v19{ - ^block78: + ^block94: scf.yield ; } else { ^block7: hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) scf.yield ; }; - v736 = arith.constant 4 : u32; + v920 = arith.constant 4 : u32; v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v736 : u32 #[overflow = checked]; - v735 = arith.constant 4 : u32; - v25 = arith.mod v23, v735 : u32; + v23 = arith.add v21, v920 : u32 #[overflow = checked]; + v919 = arith.constant 4 : u32; + v25 = arith.mod v23, v919 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v727 = arith.constant 2 : u32; - v31 = arith.shl v9, v727 : i32; + v911 = arith.constant 2 : u32; + v31 = arith.shl v9, v911 : i32; v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; v34 = hir.bitcast v32 : u32; - v734 = arith.constant 4 : u32; - v36 = arith.mod v34, v734 : u32; + v918 = arith.constant 4 : u32; + v36 = arith.mod v34, v918 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v1; - v733 = arith.constant 8 : u32; + v917 = arith.constant 8 : u32; v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v733 : u32 #[overflow = checked]; - v732 = arith.constant 4 : u32; - v44 = arith.mod v42, v732 : u32; + v42 = arith.add v40, v917 : u32 #[overflow = checked]; + v916 = arith.constant 4 : u32; + v44 = arith.mod v42, v916 : u32; hir.assertz v44 #[code = 250]; v38 = arith.constant 1 : i32; v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; @@ -83,8 +83,8 @@ builtin.component root_ns:root@1.0.0 { v66 = arith.constant 8 : u32; v65 = hir.bitcast v52 : u32; v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v741 = arith.constant 4 : u32; - v69 = arith.mod v67, v741 : u32; + v925 = arith.constant 4 : u32; + v69 = arith.mod v67, v925 : u32; hir.assertz v69 #[code = 250]; v70 = hir.int_to_ptr v67 : ptr; v71 = hir.load v70 : i32; @@ -96,8 +96,8 @@ builtin.component root_ns:root@1.0.0 { v77 = arith.neq v75, v47 : i1; cf.cond_br v77 ^block10, ^block11; ^block10: - v740 = arith.constant 16 : i32; - v87 = arith.add v52, v740 : i32 #[overflow = wrapping]; + v924 = arith.constant 16 : i32; + v87 = arith.add v52, v924 : i32 #[overflow = wrapping]; v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr v89 = hir.bitcast v88 : ptr; hir.store v89, v87; @@ -106,8 +106,8 @@ builtin.component root_ns:root@1.0.0 { v79 = arith.constant 12 : u32; v78 = hir.bitcast v52 : u32; v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v739 = arith.constant 4 : u32; - v82 = arith.mod v80, v739 : u32; + v923 = arith.constant 4 : u32; + v82 = arith.mod v80, v923 : u32; hir.assertz v82 #[code = 250]; v83 = hir.int_to_ptr v80 : ptr; v84 = hir.load v83 : i32; @@ -118,856 +118,1118 @@ builtin.component root_ns:root@1.0.0 { public builtin.function @entrypoint(v90: i32, v91: i32) { ^block12(v90: i32, v91: i32): - v94 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v95 = hir.bitcast v94 : ptr; - v96 = hir.load v95 : i32; - v97 = arith.constant 16 : i32; - v98 = arith.sub v96, v97 : i32 #[overflow = wrapping]; - v99 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v100 = hir.bitcast v99 : ptr; - hir.store v100, v98; - v102 = arith.constant 4 : u32; - v101 = hir.bitcast v91 : u32; - v103 = arith.add v101, v102 : u32 #[overflow = checked]; - v755 = arith.constant 4 : u32; - v105 = arith.mod v103, v755 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v108 = hir.bitcast v91 : u32; - v754 = arith.constant 4 : u32; - v110 = arith.mod v108, v754 : u32; - hir.assertz v110 #[code = 250]; - v111 = hir.int_to_ptr v108 : ptr; - v112 = hir.load v111 : felt; - v115 = arith.constant 8 : i32; - v113 = arith.constant 4 : i32; - v114 = arith.add v98, v113 : i32 #[overflow = wrapping]; - v116 = arith.add v114, v115 : i32 #[overflow = wrapping]; - v118 = hir.bitcast v116 : u32; - v753 = arith.constant 4 : u32; - v120 = arith.mod v118, v753 : u32; - hir.assertz v120 #[code = 250]; + v95 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v96 = hir.bitcast v95 : ptr; + v97 = hir.load v96 : i32; + v98 = arith.constant 32 : i32; + v99 = arith.sub v97, v98 : i32 #[overflow = wrapping]; + v100 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v101 = hir.bitcast v100 : ptr; + hir.store v101, v99; + v103 = arith.constant 4 : u32; + v102 = hir.bitcast v91 : u32; + v104 = arith.add v102, v103 : u32 #[overflow = checked]; + v948 = arith.constant 4 : u32; + v106 = arith.mod v104, v948 : u32; + hir.assertz v106 #[code = 250]; + v107 = hir.int_to_ptr v104 : ptr; + v108 = hir.load v107 : felt; + v109 = hir.bitcast v91 : u32; + v947 = arith.constant 4 : u32; + v111 = arith.mod v109, v947 : u32; + hir.assertz v111 #[code = 250]; + v112 = hir.int_to_ptr v109 : ptr; + v113 = hir.load v112 : felt; + v118 = arith.constant 4 : i32; v92 = arith.constant 0 : i32; - v121 = hir.int_to_ptr v118 : ptr; - hir.store v121, v92; - v752 = arith.constant 4 : u32; - v123 = hir.bitcast v98 : u32; - v125 = arith.add v123, v752 : u32 #[overflow = checked]; - v751 = arith.constant 4 : u32; - v127 = arith.mod v125, v751 : u32; - hir.assertz v127 #[code = 250]; - v122 = arith.constant 17179869184 : i64; - v128 = hir.int_to_ptr v125 : ptr; - hir.store v128, v122; - v750 = arith.constant 4 : i32; - v130 = arith.add v98, v750 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v130, v112) - v749 = arith.constant 4 : i32; - v132 = arith.add v98, v749 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v132, v107) - v135 = hir.bitcast v116 : u32; - v748 = arith.constant 4 : u32; - v137 = arith.mod v135, v748 : u32; - hir.assertz v137 #[code = 250]; - v138 = hir.int_to_ptr v135 : ptr; - v139 = hir.load v138 : i32; - v747 = arith.constant 8 : i32; - v134 = arith.add v90, v747 : i32 #[overflow = wrapping]; - v140 = hir.bitcast v134 : u32; - v746 = arith.constant 4 : u32; - v142 = arith.mod v140, v746 : u32; - hir.assertz v142 #[code = 250]; - v143 = hir.int_to_ptr v140 : ptr; - hir.store v143, v139; - v745 = arith.constant 4 : u32; - v144 = hir.bitcast v98 : u32; - v146 = arith.add v144, v745 : u32 #[overflow = checked]; - v744 = arith.constant 4 : u32; - v148 = arith.mod v146, v744 : u32; - hir.assertz v148 #[code = 250]; - v149 = hir.int_to_ptr v146 : ptr; - v150 = hir.load v149 : i64; - v151 = hir.bitcast v90 : u32; - v743 = arith.constant 4 : u32; - v153 = arith.mod v151, v743 : u32; - hir.assertz v153 #[code = 250]; - v154 = hir.int_to_ptr v151 : ptr; - hir.store v154, v150; - v742 = arith.constant 16 : i32; - v156 = arith.add v98, v742 : i32 #[overflow = wrapping]; - v157 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v158 = hir.bitcast v157 : ptr; - hir.store v158, v156; + v116 = arith.constant 256 : i32; + v114 = arith.constant 20 : i32; + v115 = arith.add v99, v114 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v115, v116, v92, v118, v118) + v121 = arith.constant 24 : u32; + v120 = hir.bitcast v99 : u32; + v122 = arith.add v120, v121 : u32 #[overflow = checked]; + v946 = arith.constant 4 : u32; + v124 = arith.mod v122, v946 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : i32; + v128 = arith.constant 20 : u32; + v127 = hir.bitcast v99 : u32; + v129 = arith.add v127, v128 : u32 #[overflow = checked]; + v945 = arith.constant 4 : u32; + v131 = arith.mod v129, v945 : u32; + hir.assertz v131 #[code = 250]; + v132 = hir.int_to_ptr v129 : ptr; + v133 = hir.load v132 : i32; + v944 = arith.constant 0 : i32; + v134 = arith.constant 1 : i32; + v135 = arith.neq v133, v134 : i1; + v136 = arith.zext v135 : u32; + v137 = hir.bitcast v136 : i32; + v139 = arith.neq v137, v944 : i1; + cf.cond_br v139 ^block14, ^block15; + ^block14: + v943 = arith.constant 8 : i32; + v148 = arith.constant 8 : i32; + v149 = arith.add v99, v148 : i32 #[overflow = wrapping]; + v151 = arith.add v149, v943 : i32 #[overflow = wrapping]; + v153 = hir.bitcast v151 : u32; + v942 = arith.constant 4 : u32; + v155 = arith.mod v153, v942 : u32; + hir.assertz v155 #[code = 250]; + v941 = arith.constant 0 : i32; + v156 = hir.int_to_ptr v153 : ptr; + hir.store v156, v941; + v158 = arith.constant 28 : u32; + v157 = hir.bitcast v99 : u32; + v159 = arith.add v157, v158 : u32 #[overflow = checked]; + v940 = arith.constant 4 : u32; + v161 = arith.mod v159, v940 : u32; + hir.assertz v161 #[code = 250]; + v162 = hir.int_to_ptr v159 : ptr; + v163 = hir.load v162 : i32; + v165 = arith.constant 12 : u32; + v164 = hir.bitcast v99 : u32; + v166 = arith.add v164, v165 : u32 #[overflow = checked]; + v939 = arith.constant 4 : u32; + v168 = arith.mod v166, v939 : u32; + hir.assertz v168 #[code = 250]; + v169 = hir.int_to_ptr v166 : ptr; + hir.store v169, v163; + v171 = arith.constant 8 : u32; + v170 = hir.bitcast v99 : u32; + v172 = arith.add v170, v171 : u32 #[overflow = checked]; + v938 = arith.constant 4 : u32; + v174 = arith.mod v172, v938 : u32; + hir.assertz v174 #[code = 250]; + v175 = hir.int_to_ptr v172 : ptr; + hir.store v175, v126; + v937 = arith.constant 8 : i32; + v177 = arith.add v99, v937 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v177, v113) + v936 = arith.constant 8 : i32; + v179 = arith.add v99, v936 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v179, v108) + v182 = hir.bitcast v151 : u32; + v935 = arith.constant 4 : u32; + v184 = arith.mod v182, v935 : u32; + hir.assertz v184 #[code = 250]; + v185 = hir.int_to_ptr v182 : ptr; + v186 = hir.load v185 : i32; + v934 = arith.constant 8 : i32; + v181 = arith.add v90, v934 : i32 #[overflow = wrapping]; + v187 = hir.bitcast v181 : u32; + v933 = arith.constant 4 : u32; + v189 = arith.mod v187, v933 : u32; + hir.assertz v189 #[code = 250]; + v190 = hir.int_to_ptr v187 : ptr; + hir.store v190, v186; + v932 = arith.constant 8 : u32; + v191 = hir.bitcast v99 : u32; + v193 = arith.add v191, v932 : u32 #[overflow = checked]; + v931 = arith.constant 4 : u32; + v195 = arith.mod v193, v931 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + v197 = hir.load v196 : i64; + v198 = hir.bitcast v90 : u32; + v930 = arith.constant 4 : u32; + v200 = arith.mod v198, v930 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + hir.store v201, v197; + v929 = arith.constant 32 : i32; + v203 = arith.add v99, v929 : i32 #[overflow = wrapping]; + v204 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v205 = hir.bitcast v204 : ptr; + hir.store v205, v203; builtin.ret ; + ^block15: + v928 = arith.constant 28 : u32; + v140 = hir.bitcast v99 : u32; + v142 = arith.add v140, v928 : u32 #[overflow = checked]; + v927 = arith.constant 4 : u32; + v144 = arith.mod v142, v927 : u32; + hir.assertz v144 #[code = 250]; + v145 = hir.int_to_ptr v142 : ptr; + v146 = hir.load v145 : i32; + v147 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::handle_error(v126, v146, v147) + ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v159: i32, v160: i32) -> i32 { - ^block14(v159: i32, v160: i32): - v162 = arith.constant 1048604 : i32; - v163 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v162, v160, v159) : i32 - builtin.ret v163; + private builtin.function @__rustc::__rust_alloc(v206: i32, v207: i32) -> i32 { + ^block16(v206: i32, v207: i32): + v209 = arith.constant 1048604 : i32; + v210 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v209, v207, v206) : i32 + builtin.ret v210; }; - private builtin.function @__rustc::__rust_realloc(v164: i32, v165: i32, v166: i32, v167: i32) -> i32 { - ^block16(v164: i32, v165: i32, v166: i32, v167: i32): - v169 = arith.constant 1048604 : i32; - v170 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v169, v166, v167) : i32 - v764 = arith.constant 0 : i32; - v171 = arith.constant 0 : i32; - v172 = arith.eq v170, v171 : i1; - v173 = arith.zext v172 : u32; - v174 = hir.bitcast v173 : i32; - v176 = arith.neq v174, v764 : i1; - scf.if v176{ - ^block18: + private builtin.function @__rustc::__rust_realloc(v211: i32, v212: i32, v213: i32, v214: i32) -> i32 { + ^block18(v211: i32, v212: i32, v213: i32, v214: i32): + v216 = arith.constant 1048604 : i32; + v217 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v216, v213, v214) : i32 + v957 = arith.constant 0 : i32; + v218 = arith.constant 0 : i32; + v219 = arith.eq v217, v218 : i1; + v220 = arith.zext v219 : u32; + v221 = hir.bitcast v220 : i32; + v223 = arith.neq v221, v957 : i1; + scf.if v223{ + ^block20: scf.yield ; } else { - ^block19: - v763 = arith.constant 0 : i32; - v178 = hir.bitcast v165 : u32; - v177 = hir.bitcast v167 : u32; - v179 = arith.lt v177, v178 : i1; - v180 = arith.zext v179 : u32; - v181 = hir.bitcast v180 : i32; - v183 = arith.neq v181, v763 : i1; - v184 = cf.select v183, v167, v165 : i32; - v761 = arith.constant 0 : i32; - v762 = arith.constant 0 : i32; - v186 = arith.eq v184, v762 : i1; - v187 = arith.zext v186 : u32; - v188 = hir.bitcast v187 : i32; - v190 = arith.neq v188, v761 : i1; - scf.if v190{ - ^block82: + ^block21: + v956 = arith.constant 0 : i32; + v225 = hir.bitcast v212 : u32; + v224 = hir.bitcast v214 : u32; + v226 = arith.lt v224, v225 : i1; + v227 = arith.zext v226 : u32; + v228 = hir.bitcast v227 : i32; + v230 = arith.neq v228, v956 : i1; + v231 = cf.select v230, v214, v212 : i32; + v954 = arith.constant 0 : i32; + v955 = arith.constant 0 : i32; + v233 = arith.eq v231, v955 : i1; + v234 = arith.zext v233 : u32; + v235 = hir.bitcast v234 : i32; + v237 = arith.neq v235, v954 : i1; + scf.if v237{ + ^block100: scf.yield ; } else { - ^block20: - v191 = hir.bitcast v184 : u32; - v192 = hir.bitcast v170 : u32; - v193 = hir.int_to_ptr v192 : ptr; - v194 = hir.bitcast v164 : u32; - v195 = hir.int_to_ptr v194 : ptr; - hir.mem_cpy v195, v193, v191; + ^block22: + v238 = hir.bitcast v231 : u32; + v239 = hir.bitcast v217 : u32; + v240 = hir.int_to_ptr v239 : ptr; + v241 = hir.bitcast v211 : u32; + v242 = hir.int_to_ptr v241 : ptr; + hir.mem_cpy v242, v240, v238; scf.yield ; }; scf.yield ; }; - builtin.ret v170; + builtin.ret v217; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v197: i32, v198: i32) -> i32 { - ^block21(v197: i32, v198: i32): - v200 = arith.constant 1048604 : i32; - v201 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v200, v198, v197) : i32 - v773 = arith.constant 0 : i32; - v202 = arith.constant 0 : i32; - v203 = arith.eq v201, v202 : i1; - v204 = arith.zext v203 : u32; - v205 = hir.bitcast v204 : i32; - v207 = arith.neq v205, v773 : i1; - scf.if v207{ - ^block23: + private builtin.function @__rustc::__rust_alloc_zeroed(v244: i32, v245: i32) -> i32 { + ^block23(v244: i32, v245: i32): + v247 = arith.constant 1048604 : i32; + v248 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v247, v245, v244) : i32 + v966 = arith.constant 0 : i32; + v249 = arith.constant 0 : i32; + v250 = arith.eq v248, v249 : i1; + v251 = arith.zext v250 : u32; + v252 = hir.bitcast v251 : i32; + v254 = arith.neq v252, v966 : i1; + scf.if v254{ + ^block25: scf.yield ; } else { - ^block24: - v771 = arith.constant 0 : i32; - v772 = arith.constant 0 : i32; - v209 = arith.eq v197, v772 : i1; - v210 = arith.zext v209 : u32; - v211 = hir.bitcast v210 : i32; - v213 = arith.neq v211, v771 : i1; - scf.if v213{ - ^block85: + ^block26: + v964 = arith.constant 0 : i32; + v965 = arith.constant 0 : i32; + v256 = arith.eq v244, v965 : i1; + v257 = arith.zext v256 : u32; + v258 = hir.bitcast v257 : i32; + v260 = arith.neq v258, v964 : i1; + scf.if v260{ + ^block103: scf.yield ; } else { - ^block25: - v765 = arith.constant 0 : u8; - v216 = hir.bitcast v197 : u32; - v217 = hir.bitcast v201 : u32; - v218 = hir.int_to_ptr v217 : ptr; - hir.mem_set v218, v216, v765; + ^block27: + v958 = arith.constant 0 : u8; + v263 = hir.bitcast v244 : u32; + v264 = hir.bitcast v248 : u32; + v265 = hir.int_to_ptr v264 : ptr; + hir.mem_set v265, v263, v958; scf.yield ; }; scf.yield ; }; - builtin.ret v201; + builtin.ret v248; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block26: + ^block28: builtin.ret ; }; - private builtin.function @::alloc(v220: i32, v221: i32, v222: i32) -> i32 { - ^block28(v220: i32, v221: i32, v222: i32): - v225 = arith.constant 16 : i32; - v224 = arith.constant 0 : i32; - v775 = arith.constant 16 : u32; - v227 = hir.bitcast v221 : u32; - v229 = arith.gt v227, v775 : i1; - v230 = arith.zext v229 : u32; - v231 = hir.bitcast v230 : i32; - v233 = arith.neq v231, v224 : i1; - v234 = cf.select v233, v221, v225 : i32; - v815 = arith.constant 0 : i32; - v235 = arith.constant -1 : i32; - v236 = arith.add v234, v235 : i32 #[overflow = wrapping]; - v237 = arith.band v234, v236 : i32; - v239 = arith.neq v237, v815 : i1; - v784, v785 = scf.if v239 : i32, u32 { - ^block90: - v776 = arith.constant 0 : u32; - v780 = ub.poison i32 : i32; - scf.yield v780, v776; + private builtin.function @::alloc(v267: i32, v268: i32, v269: i32) -> i32 { + ^block30(v267: i32, v268: i32, v269: i32): + v272 = arith.constant 16 : i32; + v271 = arith.constant 0 : i32; + v968 = arith.constant 16 : u32; + v274 = hir.bitcast v268 : u32; + v276 = arith.gt v274, v968 : i1; + v277 = arith.zext v276 : u32; + v278 = hir.bitcast v277 : i32; + v280 = arith.neq v278, v271 : i1; + v281 = cf.select v280, v268, v272 : i32; + v1008 = arith.constant 0 : i32; + v282 = arith.constant -1 : i32; + v283 = arith.add v281, v282 : i32 #[overflow = wrapping]; + v284 = arith.band v281, v283 : i32; + v286 = arith.neq v284, v1008 : i1; + v977, v978 = scf.if v286 : i32, u32 { + ^block108: + v969 = arith.constant 0 : u32; + v973 = ub.poison i32 : i32; + scf.yield v973, v969; } else { - ^block31: - v241 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::alignment::Alignment::max(v221, v234) : i32 - v814 = arith.constant 0 : i32; - v240 = arith.constant -2147483648 : i32; - v242 = arith.sub v240, v241 : i32 #[overflow = wrapping]; - v244 = hir.bitcast v242 : u32; - v243 = hir.bitcast v222 : u32; - v245 = arith.gt v243, v244 : i1; - v246 = arith.zext v245 : u32; - v247 = hir.bitcast v246 : i32; - v249 = arith.neq v247, v814 : i1; - v799 = scf.if v249 : i32 { - ^block89: - v813 = ub.poison i32 : i32; - scf.yield v813; + ^block33: + v288 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::alignment::Alignment::max(v268, v281) : i32 + v1007 = arith.constant 0 : i32; + v287 = arith.constant -2147483648 : i32; + v289 = arith.sub v287, v288 : i32 #[overflow = wrapping]; + v291 = hir.bitcast v289 : u32; + v290 = hir.bitcast v269 : u32; + v292 = arith.gt v290, v291 : i1; + v293 = arith.zext v292 : u32; + v294 = hir.bitcast v293 : i32; + v296 = arith.neq v294, v1007 : i1; + v992 = scf.if v296 : i32 { + ^block107: + v1006 = ub.poison i32 : i32; + scf.yield v1006; } else { - ^block32: - v811 = arith.constant 0 : i32; - v255 = arith.sub v811, v241 : i32 #[overflow = wrapping]; - v812 = arith.constant -1 : i32; - v251 = arith.add v222, v241 : i32 #[overflow = wrapping]; - v253 = arith.add v251, v812 : i32 #[overflow = wrapping]; - v256 = arith.band v253, v255 : i32; - v257 = hir.bitcast v220 : u32; - v258 = arith.constant 4 : u32; - v259 = arith.mod v257, v258 : u32; - hir.assertz v259 #[code = 250]; - v260 = hir.int_to_ptr v257 : ptr; - v261 = hir.load v260 : i32; - v810 = arith.constant 0 : i32; - v263 = arith.neq v261, v810 : i1; - scf.if v263{ - ^block88: + ^block34: + v1004 = arith.constant 0 : i32; + v302 = arith.sub v1004, v288 : i32 #[overflow = wrapping]; + v1005 = arith.constant -1 : i32; + v298 = arith.add v269, v288 : i32 #[overflow = wrapping]; + v300 = arith.add v298, v1005 : i32 #[overflow = wrapping]; + v303 = arith.band v300, v302 : i32; + v304 = hir.bitcast v267 : u32; + v305 = arith.constant 4 : u32; + v306 = arith.mod v304, v305 : u32; + hir.assertz v306 #[code = 250]; + v307 = hir.int_to_ptr v304 : ptr; + v308 = hir.load v307 : i32; + v1003 = arith.constant 0 : i32; + v310 = arith.neq v308, v1003 : i1; + scf.if v310{ + ^block106: scf.yield ; } else { - ^block34: - v264 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/intrinsics::mem::heap_base() : i32 - v265 = hir.mem_size : u32; - v271 = hir.bitcast v220 : u32; - v809 = arith.constant 4 : u32; - v273 = arith.mod v271, v809 : u32; - hir.assertz v273 #[code = 250]; - v808 = arith.constant 16 : u32; - v266 = hir.bitcast v265 : i32; - v269 = arith.shl v266, v808 : i32; - v270 = arith.add v264, v269 : i32 #[overflow = wrapping]; - v274 = hir.int_to_ptr v271 : ptr; - hir.store v274, v270; + ^block36: + v311 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/intrinsics::mem::heap_base() : i32 + v312 = hir.mem_size : u32; + v318 = hir.bitcast v267 : u32; + v1002 = arith.constant 4 : u32; + v320 = arith.mod v318, v1002 : u32; + hir.assertz v320 #[code = 250]; + v1001 = arith.constant 16 : u32; + v313 = hir.bitcast v312 : i32; + v316 = arith.shl v313, v1001 : i32; + v317 = arith.add v311, v316 : i32 #[overflow = wrapping]; + v321 = hir.int_to_ptr v318 : ptr; + hir.store v321, v317; scf.yield ; }; - v277 = hir.bitcast v220 : u32; - v807 = arith.constant 4 : u32; - v279 = arith.mod v277, v807 : u32; - hir.assertz v279 #[code = 250]; - v280 = hir.int_to_ptr v277 : ptr; - v281 = hir.load v280 : i32; - v805 = arith.constant 0 : i32; - v806 = arith.constant -1 : i32; - v283 = arith.bxor v281, v806 : i32; - v285 = hir.bitcast v283 : u32; - v284 = hir.bitcast v256 : u32; - v286 = arith.gt v284, v285 : i1; - v287 = arith.zext v286 : u32; - v288 = hir.bitcast v287 : i32; - v290 = arith.neq v288, v805 : i1; - v798 = scf.if v290 : i32 { - ^block35: - v804 = arith.constant 0 : i32; - scf.yield v804; + v324 = hir.bitcast v267 : u32; + v1000 = arith.constant 4 : u32; + v326 = arith.mod v324, v1000 : u32; + hir.assertz v326 #[code = 250]; + v327 = hir.int_to_ptr v324 : ptr; + v328 = hir.load v327 : i32; + v998 = arith.constant 0 : i32; + v999 = arith.constant -1 : i32; + v330 = arith.bxor v328, v999 : i32; + v332 = hir.bitcast v330 : u32; + v331 = hir.bitcast v303 : u32; + v333 = arith.gt v331, v332 : i1; + v334 = arith.zext v333 : u32; + v335 = hir.bitcast v334 : i32; + v337 = arith.neq v335, v998 : i1; + v991 = scf.if v337 : i32 { + ^block37: + v997 = arith.constant 0 : i32; + scf.yield v997; } else { - ^block36: - v292 = hir.bitcast v220 : u32; - v803 = arith.constant 4 : u32; - v294 = arith.mod v292, v803 : u32; - hir.assertz v294 #[code = 250]; - v291 = arith.add v281, v256 : i32 #[overflow = wrapping]; - v295 = hir.int_to_ptr v292 : ptr; - hir.store v295, v291; - v297 = arith.add v281, v241 : i32 #[overflow = wrapping]; - scf.yield v297; + ^block38: + v339 = hir.bitcast v267 : u32; + v996 = arith.constant 4 : u32; + v341 = arith.mod v339, v996 : u32; + hir.assertz v341 #[code = 250]; + v338 = arith.add v328, v303 : i32 #[overflow = wrapping]; + v342 = hir.int_to_ptr v339 : ptr; + hir.store v342, v338; + v344 = arith.add v328, v288 : i32 #[overflow = wrapping]; + scf.yield v344; }; - scf.yield v798; + scf.yield v991; }; - v781 = arith.constant 1 : u32; - v802 = arith.constant 0 : u32; - v800 = cf.select v249, v802, v781 : u32; - scf.yield v799, v800; + v974 = arith.constant 1 : u32; + v995 = arith.constant 0 : u32; + v993 = cf.select v296, v995, v974 : u32; + scf.yield v992, v993; }; - v801 = arith.constant 0 : u32; - v797 = arith.eq v785, v801 : i1; - cf.cond_br v797 ^block30, ^block92(v784); - ^block30: + v994 = arith.constant 0 : u32; + v990 = arith.eq v978, v994 : i1; + cf.cond_br v990 ^block32, ^block110(v977); + ^block32: ub.unreachable ; - ^block92(v777: i32): - builtin.ret v777; + ^block110(v970: i32): + builtin.ret v970; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block37: - v300 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v300; + ^block39: + v347 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v347; }; - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v302: i32, v303: i32, v304: i32, v305: i32, v306: i32, v307: i32) { - ^block41(v302: i32, v303: i32, v304: i32, v305: i32, v306: i32, v307: i32): - v310 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v311 = hir.bitcast v310 : ptr; - v312 = hir.load v311 : i32; - v313 = arith.constant 32 : i32; - v314 = arith.sub v312, v313 : i32 #[overflow = wrapping]; - v315 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v316 = hir.bitcast v315 : ptr; - hir.store v316, v314; - v892 = arith.constant 0 : i32; - v308 = arith.constant 0 : i32; - v319 = arith.eq v307, v308 : i1; - v320 = arith.zext v319 : u32; - v321 = hir.bitcast v320 : i32; - v323 = arith.neq v321, v892 : i1; - v863, v864 = scf.if v323 : i32, i32 { - ^block44: - v891 = arith.constant 0 : i32; - scf.yield v891, v891; + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v349: i32, v350: i32, v351: i32, v352: i32, v353: i32, v354: i32) { + ^block43(v349: i32, v350: i32, v351: i32, v352: i32, v353: i32, v354: i32): + v357 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v358 = hir.bitcast v357 : ptr; + v359 = hir.load v358 : i32; + v360 = arith.constant 32 : i32; + v361 = arith.sub v359, v360 : i32 #[overflow = wrapping]; + v362 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v363 = hir.bitcast v362 : ptr; + hir.store v363, v361; + v1085 = arith.constant 0 : i32; + v355 = arith.constant 0 : i32; + v366 = arith.eq v354, v355 : i1; + v367 = arith.zext v366 : u32; + v368 = hir.bitcast v367 : i32; + v370 = arith.neq v368, v1085 : i1; + v1056, v1057 = scf.if v370 : i32, i32 { + ^block46: + v1084 = arith.constant 0 : i32; + scf.yield v1084, v1084; } else { - ^block45: - v324 = arith.add v304, v305 : i32 #[overflow = wrapping]; - v890 = arith.constant 0 : i32; - v326 = hir.bitcast v304 : u32; - v325 = hir.bitcast v324 : u32; - v327 = arith.lt v325, v326 : i1; - v328 = arith.zext v327 : u32; - v329 = hir.bitcast v328 : i32; - v331 = arith.neq v329, v890 : i1; - v861, v862 = scf.if v331 : i32, i32 { - ^block98: - v889 = arith.constant 0 : i32; - scf.yield v889, v889; + ^block47: + v371 = arith.add v351, v352 : i32 #[overflow = wrapping]; + v1083 = arith.constant 0 : i32; + v373 = hir.bitcast v351 : u32; + v372 = hir.bitcast v371 : u32; + v374 = arith.lt v372, v373 : i1; + v375 = arith.zext v374 : u32; + v376 = hir.bitcast v375 : i32; + v378 = arith.neq v376, v1083 : i1; + v1054, v1055 = scf.if v378 : i32, i32 { + ^block116: + v1082 = arith.constant 0 : i32; + scf.yield v1082, v1082; } else { - ^block46: - v342 = hir.bitcast v303 : u32; - v456 = arith.constant 4 : u32; - v344 = arith.mod v342, v456 : u32; - hir.assertz v344 #[code = 250]; - v345 = hir.int_to_ptr v342 : ptr; - v346 = hir.load v345 : i32; - v817 = arith.constant 1 : u32; - v349 = arith.shl v346, v817 : i32; - v888 = arith.constant 0 : i32; - v351 = hir.bitcast v349 : u32; - v350 = hir.bitcast v324 : u32; - v352 = arith.gt v350, v351 : i1; - v353 = arith.zext v352 : u32; - v354 = hir.bitcast v353 : i32; - v356 = arith.neq v354, v888 : i1; - v357 = cf.select v356, v324, v349 : i32; - v885 = arith.constant 1 : i32; - v359 = arith.constant 4 : i32; - v886 = arith.constant 0 : i32; - v816 = arith.constant 1025 : u32; - v362 = hir.bitcast v307 : u32; - v364 = arith.lt v362, v816 : i1; - v365 = arith.zext v364 : u32; - v366 = hir.bitcast v365 : i32; - v368 = arith.neq v366, v886 : i1; - v369 = cf.select v368, v359, v885 : i32; - v358 = arith.constant 8 : i32; - v887 = arith.constant 0 : i32; - v347 = arith.constant 1 : i32; - v371 = arith.eq v307, v347 : i1; - v372 = arith.zext v371 : u32; - v373 = hir.bitcast v372 : i32; - v375 = arith.neq v373, v887 : i1; - v376 = cf.select v375, v358, v369 : i32; - v884 = arith.constant 0 : i32; - v378 = hir.bitcast v376 : u32; - v377 = hir.bitcast v357 : u32; - v379 = arith.gt v377, v378 : i1; - v380 = arith.zext v379 : u32; - v381 = hir.bitcast v380 : i32; - v383 = arith.neq v381, v884 : i1; - v384 = cf.select v383, v357, v376 : i32; - v385 = hir.bitcast v384 : u32; - v386 = arith.zext v385 : u64; - v387 = hir.bitcast v386 : i64; - v883 = arith.constant 0 : i32; - v337 = arith.sub v883, v306 : i32 #[overflow = wrapping]; - v334 = arith.constant -1 : i32; - v333 = arith.add v306, v307 : i32 #[overflow = wrapping]; - v335 = arith.add v333, v334 : i32 #[overflow = wrapping]; - v338 = arith.band v335, v337 : i32; - v339 = hir.bitcast v338 : u32; - v340 = arith.zext v339 : u64; - v341 = hir.bitcast v340 : i64; - v388 = arith.mul v341, v387 : i64 #[overflow = wrapping]; - v882 = arith.constant 0 : i32; - v389 = arith.constant 32 : i64; - v391 = hir.cast v389 : u32; - v390 = hir.bitcast v388 : u64; - v392 = arith.shr v390, v391 : u64; - v393 = hir.bitcast v392 : i64; - v394 = arith.trunc v393 : i32; - v396 = arith.neq v394, v882 : i1; - v859, v860 = scf.if v396 : i32, i32 { - ^block97: - v881 = arith.constant 0 : i32; - scf.yield v357, v881; + ^block48: + v389 = hir.bitcast v350 : u32; + v503 = arith.constant 4 : u32; + v391 = arith.mod v389, v503 : u32; + hir.assertz v391 #[code = 250]; + v392 = hir.int_to_ptr v389 : ptr; + v393 = hir.load v392 : i32; + v1010 = arith.constant 1 : u32; + v396 = arith.shl v393, v1010 : i32; + v1081 = arith.constant 0 : i32; + v398 = hir.bitcast v396 : u32; + v397 = hir.bitcast v371 : u32; + v399 = arith.gt v397, v398 : i1; + v400 = arith.zext v399 : u32; + v401 = hir.bitcast v400 : i32; + v403 = arith.neq v401, v1081 : i1; + v404 = cf.select v403, v371, v396 : i32; + v1078 = arith.constant 1 : i32; + v406 = arith.constant 4 : i32; + v1079 = arith.constant 0 : i32; + v1009 = arith.constant 1025 : u32; + v409 = hir.bitcast v354 : u32; + v411 = arith.lt v409, v1009 : i1; + v412 = arith.zext v411 : u32; + v413 = hir.bitcast v412 : i32; + v415 = arith.neq v413, v1079 : i1; + v416 = cf.select v415, v406, v1078 : i32; + v405 = arith.constant 8 : i32; + v1080 = arith.constant 0 : i32; + v394 = arith.constant 1 : i32; + v418 = arith.eq v354, v394 : i1; + v419 = arith.zext v418 : u32; + v420 = hir.bitcast v419 : i32; + v422 = arith.neq v420, v1080 : i1; + v423 = cf.select v422, v405, v416 : i32; + v1077 = arith.constant 0 : i32; + v425 = hir.bitcast v423 : u32; + v424 = hir.bitcast v404 : u32; + v426 = arith.gt v424, v425 : i1; + v427 = arith.zext v426 : u32; + v428 = hir.bitcast v427 : i32; + v430 = arith.neq v428, v1077 : i1; + v431 = cf.select v430, v404, v423 : i32; + v432 = hir.bitcast v431 : u32; + v433 = arith.zext v432 : u64; + v434 = hir.bitcast v433 : i64; + v1076 = arith.constant 0 : i32; + v384 = arith.sub v1076, v353 : i32 #[overflow = wrapping]; + v381 = arith.constant -1 : i32; + v380 = arith.add v353, v354 : i32 #[overflow = wrapping]; + v382 = arith.add v380, v381 : i32 #[overflow = wrapping]; + v385 = arith.band v382, v384 : i32; + v386 = hir.bitcast v385 : u32; + v387 = arith.zext v386 : u64; + v388 = hir.bitcast v387 : i64; + v435 = arith.mul v388, v434 : i64 #[overflow = wrapping]; + v1075 = arith.constant 0 : i32; + v436 = arith.constant 32 : i64; + v438 = hir.cast v436 : u32; + v437 = hir.bitcast v435 : u64; + v439 = arith.shr v437, v438 : u64; + v440 = hir.bitcast v439 : i64; + v441 = arith.trunc v440 : i32; + v443 = arith.neq v441, v1075 : i1; + v1052, v1053 = scf.if v443 : i32, i32 { + ^block115: + v1074 = arith.constant 0 : i32; + scf.yield v404, v1074; } else { - ^block47: - v397 = arith.trunc v388 : i32; - v880 = arith.constant 0 : i32; - v398 = arith.constant -2147483648 : i32; - v399 = arith.sub v398, v306 : i32 #[overflow = wrapping]; - v401 = hir.bitcast v399 : u32; - v400 = hir.bitcast v397 : u32; - v402 = arith.gt v400, v401 : i1; - v403 = arith.zext v402 : u32; - v404 = hir.bitcast v403 : i32; - v406 = arith.neq v404, v880 : i1; - v857, v858 = scf.if v406 : i32, i32 { - ^block96: - v879 = arith.constant 0 : i32; - scf.yield v357, v879; + ^block49: + v444 = arith.trunc v435 : i32; + v1073 = arith.constant 0 : i32; + v445 = arith.constant -2147483648 : i32; + v446 = arith.sub v445, v353 : i32 #[overflow = wrapping]; + v448 = hir.bitcast v446 : u32; + v447 = hir.bitcast v444 : u32; + v449 = arith.gt v447, v448 : i1; + v450 = arith.zext v449 : u32; + v451 = hir.bitcast v450 : i32; + v453 = arith.neq v451, v1073 : i1; + v1050, v1051 = scf.if v453 : i32, i32 { + ^block114: + v1072 = arith.constant 0 : i32; + scf.yield v404, v1072; } else { - ^block48: - v407 = arith.constant 20 : i32; - v408 = arith.add v314, v407 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v408, v303, v306, v307) - v877 = arith.constant 20 : i32; - v412 = arith.add v314, v877 : i32 #[overflow = wrapping]; - v878 = arith.constant 8 : i32; - v410 = arith.add v314, v878 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::finish_grow(v410, v306, v397, v412, v302) - v414 = arith.constant 12 : u32; - v413 = hir.bitcast v314 : u32; - v415 = arith.add v413, v414 : u32 #[overflow = checked]; - v876 = arith.constant 4 : u32; - v417 = arith.mod v415, v876 : u32; - hir.assertz v417 #[code = 250]; - v418 = hir.int_to_ptr v415 : ptr; - v419 = hir.load v418 : i32; - v421 = arith.constant 8 : u32; - v420 = hir.bitcast v314 : u32; - v422 = arith.add v420, v421 : u32 #[overflow = checked]; - v875 = arith.constant 4 : u32; - v424 = arith.mod v422, v875 : u32; - hir.assertz v424 #[code = 250]; - v425 = hir.int_to_ptr v422 : ptr; - v426 = hir.load v425 : i32; - v873 = arith.constant 0 : i32; - v874 = arith.constant 0 : i32; - v428 = arith.eq v426, v874 : i1; - v429 = arith.zext v428 : u32; - v430 = hir.bitcast v429 : i32; - v432 = arith.neq v430, v873 : i1; - v855 = scf.if v432 : i32 { - ^block49: - v440 = hir.bitcast v303 : u32; - v872 = arith.constant 4 : u32; - v442 = arith.mod v440, v872 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - hir.store v443, v384; - v871 = arith.constant 4 : u32; - v444 = hir.bitcast v303 : u32; - v446 = arith.add v444, v871 : u32 #[overflow = checked]; - v870 = arith.constant 4 : u32; - v448 = arith.mod v446, v870 : u32; - hir.assertz v448 #[code = 250]; - v449 = hir.int_to_ptr v446 : ptr; - hir.store v449, v419; - scf.yield v357; + ^block50: + v454 = arith.constant 20 : i32; + v455 = arith.add v361, v454 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v455, v350, v353, v354) + v1070 = arith.constant 20 : i32; + v459 = arith.add v361, v1070 : i32 #[overflow = wrapping]; + v1071 = arith.constant 8 : i32; + v457 = arith.add v361, v1071 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::finish_grow(v457, v353, v444, v459, v349) + v461 = arith.constant 12 : u32; + v460 = hir.bitcast v361 : u32; + v462 = arith.add v460, v461 : u32 #[overflow = checked]; + v1069 = arith.constant 4 : u32; + v464 = arith.mod v462, v1069 : u32; + hir.assertz v464 #[code = 250]; + v465 = hir.int_to_ptr v462 : ptr; + v466 = hir.load v465 : i32; + v468 = arith.constant 8 : u32; + v467 = hir.bitcast v361 : u32; + v469 = arith.add v467, v468 : u32 #[overflow = checked]; + v1068 = arith.constant 4 : u32; + v471 = arith.mod v469, v1068 : u32; + hir.assertz v471 #[code = 250]; + v472 = hir.int_to_ptr v469 : ptr; + v473 = hir.load v472 : i32; + v1066 = arith.constant 0 : i32; + v1067 = arith.constant 0 : i32; + v475 = arith.eq v473, v1067 : i1; + v476 = arith.zext v475 : u32; + v477 = hir.bitcast v476 : i32; + v479 = arith.neq v477, v1066 : i1; + v1048 = scf.if v479 : i32 { + ^block51: + v487 = hir.bitcast v350 : u32; + v1065 = arith.constant 4 : u32; + v489 = arith.mod v487, v1065 : u32; + hir.assertz v489 #[code = 250]; + v490 = hir.int_to_ptr v487 : ptr; + hir.store v490, v431; + v1064 = arith.constant 4 : u32; + v491 = hir.bitcast v350 : u32; + v493 = arith.add v491, v1064 : u32 #[overflow = checked]; + v1063 = arith.constant 4 : u32; + v495 = arith.mod v493, v1063 : u32; + hir.assertz v495 #[code = 250]; + v496 = hir.int_to_ptr v493 : ptr; + hir.store v496, v466; + scf.yield v404; } else { - ^block50: - v434 = arith.constant 16 : u32; - v433 = hir.bitcast v314 : u32; - v435 = arith.add v433, v434 : u32 #[overflow = checked]; - v869 = arith.constant 4 : u32; - v437 = arith.mod v435, v869 : u32; - hir.assertz v437 #[code = 250]; - v438 = hir.int_to_ptr v435 : ptr; - v439 = hir.load v438 : i32; - scf.yield v439; + ^block52: + v481 = arith.constant 16 : u32; + v480 = hir.bitcast v361 : u32; + v482 = arith.add v480, v481 : u32 #[overflow = checked]; + v1062 = arith.constant 4 : u32; + v484 = arith.mod v482, v1062 : u32; + hir.assertz v484 #[code = 250]; + v485 = hir.int_to_ptr v482 : ptr; + v486 = hir.load v485 : i32; + scf.yield v486; }; - v450 = arith.constant -2147483647 : i32; - v856 = cf.select v432, v450, v419 : i32; - scf.yield v855, v856; + v497 = arith.constant -2147483647 : i32; + v1049 = cf.select v479, v497, v466 : i32; + scf.yield v1048, v1049; }; - scf.yield v857, v858; + scf.yield v1050, v1051; }; - scf.yield v859, v860; + scf.yield v1052, v1053; }; - scf.yield v861, v862; + scf.yield v1054, v1055; }; - v868 = arith.constant 4 : u32; - v455 = hir.bitcast v302 : u32; - v457 = arith.add v455, v868 : u32 #[overflow = checked]; - v867 = arith.constant 4 : u32; - v459 = arith.mod v457, v867 : u32; - hir.assertz v459 #[code = 250]; - v460 = hir.int_to_ptr v457 : ptr; - hir.store v460, v863; - v463 = hir.bitcast v302 : u32; - v866 = arith.constant 4 : u32; - v465 = arith.mod v463, v866 : u32; - hir.assertz v465 #[code = 250]; - v466 = hir.int_to_ptr v463 : ptr; - hir.store v466, v864; - v865 = arith.constant 32 : i32; - v470 = arith.add v314, v865 : i32 #[overflow = wrapping]; - v471 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v472 = hir.bitcast v471 : ptr; - hir.store v472, v470; + v1061 = arith.constant 4 : u32; + v502 = hir.bitcast v349 : u32; + v504 = arith.add v502, v1061 : u32 #[overflow = checked]; + v1060 = arith.constant 4 : u32; + v506 = arith.mod v504, v1060 : u32; + hir.assertz v506 #[code = 250]; + v507 = hir.int_to_ptr v504 : ptr; + hir.store v507, v1056; + v510 = hir.bitcast v349 : u32; + v1059 = arith.constant 4 : u32; + v512 = arith.mod v510, v1059 : u32; + hir.assertz v512 #[code = 250]; + v513 = hir.int_to_ptr v510 : ptr; + hir.store v513, v1057; + v1058 = arith.constant 32 : i32; + v517 = arith.add v361, v1058 : i32 #[overflow = wrapping]; + v518 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v519 = hir.bitcast v518 : ptr; + hir.store v519, v517; builtin.ret ; }; - private builtin.function @::allocate(v473: i32, v474: i32, v475: i32) { - ^block51(v473: i32, v474: i32, v475: i32): - v477 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v478 = hir.bitcast v477 : ptr; - v479 = hir.load v478 : i32; - v480 = arith.constant 16 : i32; - v481 = arith.sub v479, v480 : i32 #[overflow = wrapping]; - v482 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v483 = hir.bitcast v482 : ptr; - hir.store v483, v481; - v476 = arith.constant 0 : i32; - v484 = arith.constant 8 : i32; - v485 = arith.add v481, v484 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v485, v474, v475, v476) - v488 = arith.constant 12 : u32; - v487 = hir.bitcast v481 : u32; - v489 = arith.add v487, v488 : u32 #[overflow = checked]; - v490 = arith.constant 4 : u32; - v491 = arith.mod v489, v490 : u32; - hir.assertz v491 #[code = 250]; - v492 = hir.int_to_ptr v489 : ptr; - v493 = hir.load v492 : i32; - v495 = arith.constant 8 : u32; - v494 = hir.bitcast v481 : u32; - v496 = arith.add v494, v495 : u32 #[overflow = checked]; - v897 = arith.constant 4 : u32; - v498 = arith.mod v496, v897 : u32; - hir.assertz v498 #[code = 250]; - v499 = hir.int_to_ptr v496 : ptr; - v500 = hir.load v499 : i32; - v501 = hir.bitcast v473 : u32; - v896 = arith.constant 4 : u32; - v503 = arith.mod v501, v896 : u32; - hir.assertz v503 #[code = 250]; - v504 = hir.int_to_ptr v501 : ptr; - hir.store v504, v500; - v895 = arith.constant 4 : u32; - v505 = hir.bitcast v473 : u32; - v507 = arith.add v505, v895 : u32 #[overflow = checked]; - v894 = arith.constant 4 : u32; - v509 = arith.mod v507, v894 : u32; - hir.assertz v509 #[code = 250]; - v510 = hir.int_to_ptr v507 : ptr; - hir.store v510, v493; - v893 = arith.constant 16 : i32; - v512 = arith.add v481, v893 : i32 #[overflow = wrapping]; - v513 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v514 = hir.bitcast v513 : ptr; - hir.store v514, v512; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v520: i32, v521: i32, v522: i32, v523: i32, v524: i32) { + ^block53(v520: i32, v521: i32, v522: i32, v523: i32, v524: i32): + v527 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v528 = hir.bitcast v527 : ptr; + v529 = hir.load v528 : i32; + v530 = arith.constant 16 : i32; + v531 = arith.sub v529, v530 : i32 #[overflow = wrapping]; + v532 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v533 = hir.bitcast v532 : ptr; + hir.store v533, v531; + v543 = hir.bitcast v521 : u32; + v544 = arith.zext v543 : u64; + v545 = hir.bitcast v544 : i64; + v525 = arith.constant 0 : i32; + v538 = arith.sub v525, v523 : i32 #[overflow = wrapping]; + v535 = arith.constant -1 : i32; + v534 = arith.add v523, v524 : i32 #[overflow = wrapping]; + v536 = arith.add v534, v535 : i32 #[overflow = wrapping]; + v539 = arith.band v536, v538 : i32; + v540 = hir.bitcast v539 : u32; + v541 = arith.zext v540 : u64; + v542 = hir.bitcast v541 : i64; + v546 = arith.mul v542, v545 : i64 #[overflow = wrapping]; + v1189 = arith.constant 0 : i32; + v547 = arith.constant 32 : i64; + v549 = hir.cast v547 : u32; + v548 = hir.bitcast v546 : u64; + v550 = arith.shr v548, v549 : u64; + v551 = hir.bitcast v550 : i64; + v552 = arith.trunc v551 : i32; + v554 = arith.neq v552, v1189 : i1; + v1101, v1102, v1103, v1104, v1105, v1106 = scf.if v554 : i32, i32, i32, i32, i32, u32 { + ^block122: + v1086 = arith.constant 0 : u32; + v1093 = ub.poison i32 : i32; + scf.yield v520, v531, v1093, v1093, v1093, v1086; + } else { + ^block58: + v555 = arith.trunc v546 : i32; + v1188 = arith.constant 0 : i32; + v556 = arith.constant -2147483648 : i32; + v557 = arith.sub v556, v523 : i32 #[overflow = wrapping]; + v559 = hir.bitcast v557 : u32; + v558 = hir.bitcast v555 : u32; + v560 = arith.lte v558, v559 : i1; + v561 = arith.zext v560 : u32; + v562 = hir.bitcast v561 : i32; + v564 = arith.neq v562, v1188 : i1; + v1149 = scf.if v564 : i32 { + ^block56: + v1187 = arith.constant 0 : i32; + v575 = arith.neq v555, v1187 : i1; + v1148 = scf.if v575 : i32 { + ^block60: + v1186 = arith.constant 0 : i32; + v591 = arith.neq v522, v1186 : i1; + v1147 = scf.if v591 : i32 { + ^block63: + v573 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v531, v523, v555, v573) + v602 = hir.bitcast v531 : u32; + v647 = arith.constant 4 : u32; + v604 = arith.mod v602, v647 : u32; + hir.assertz v604 #[code = 250]; + v605 = hir.int_to_ptr v602 : ptr; + v606 = hir.load v605 : i32; + scf.yield v606; + } else { + ^block64: + v592 = arith.constant 8 : i32; + v593 = arith.add v531, v592 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v593, v523, v555) + v577 = arith.constant 8 : u32; + v594 = hir.bitcast v531 : u32; + v596 = arith.add v594, v577 : u32 #[overflow = checked]; + v1185 = arith.constant 4 : u32; + v598 = arith.mod v596, v1185 : u32; + hir.assertz v598 #[code = 250]; + v599 = hir.int_to_ptr v596 : ptr; + v600 = hir.load v599 : i32; + scf.yield v600; + }; + v1183 = arith.constant 0 : i32; + v1184 = arith.constant 0 : i32; + v609 = arith.eq v1147, v1184 : i1; + v610 = arith.zext v609 : u32; + v611 = hir.bitcast v610 : i32; + v613 = arith.neq v611, v1183 : i1; + scf.if v613{ + ^block65: + v1182 = arith.constant 8 : u32; + v630 = hir.bitcast v520 : u32; + v632 = arith.add v630, v1182 : u32 #[overflow = checked]; + v1181 = arith.constant 4 : u32; + v634 = arith.mod v632, v1181 : u32; + hir.assertz v634 #[code = 250]; + v635 = hir.int_to_ptr v632 : ptr; + hir.store v635, v555; + v1180 = arith.constant 4 : u32; + v637 = hir.bitcast v520 : u32; + v639 = arith.add v637, v1180 : u32 #[overflow = checked]; + v1179 = arith.constant 4 : u32; + v641 = arith.mod v639, v1179 : u32; + hir.assertz v641 #[code = 250]; + v642 = hir.int_to_ptr v639 : ptr; + hir.store v642, v523; + scf.yield ; + } else { + ^block66: + v1178 = arith.constant 8 : u32; + v615 = hir.bitcast v520 : u32; + v617 = arith.add v615, v1178 : u32 #[overflow = checked]; + v1177 = arith.constant 4 : u32; + v619 = arith.mod v617, v1177 : u32; + hir.assertz v619 #[code = 250]; + v620 = hir.int_to_ptr v617 : ptr; + hir.store v620, v1147; + v1176 = arith.constant 4 : u32; + v622 = hir.bitcast v520 : u32; + v624 = arith.add v622, v1176 : u32 #[overflow = checked]; + v1175 = arith.constant 4 : u32; + v626 = arith.mod v624, v1175 : u32; + hir.assertz v626 #[code = 250]; + v627 = hir.int_to_ptr v624 : ptr; + hir.store v627, v521; + scf.yield ; + }; + v1173 = arith.constant 0 : i32; + v1174 = arith.constant 1 : i32; + v1146 = cf.select v613, v1174, v1173 : i32; + scf.yield v1146; + } else { + ^block61: + v1172 = arith.constant 8 : u32; + v576 = hir.bitcast v520 : u32; + v578 = arith.add v576, v1172 : u32 #[overflow = checked]; + v1171 = arith.constant 4 : u32; + v580 = arith.mod v578, v1171 : u32; + hir.assertz v580 #[code = 250]; + v581 = hir.int_to_ptr v578 : ptr; + hir.store v581, v523; + v1170 = arith.constant 4 : u32; + v584 = hir.bitcast v520 : u32; + v586 = arith.add v584, v1170 : u32 #[overflow = checked]; + v1169 = arith.constant 4 : u32; + v588 = arith.mod v586, v1169 : u32; + hir.assertz v588 #[code = 250]; + v1168 = arith.constant 0 : i32; + v589 = hir.int_to_ptr v586 : ptr; + hir.store v589, v1168; + v1167 = arith.constant 0 : i32; + scf.yield v1167; + }; + scf.yield v1148; + } else { + ^block59: + v1166 = ub.poison i32 : i32; + scf.yield v1166; + }; + v1161 = arith.constant 0 : u32; + v1094 = arith.constant 1 : u32; + v1154 = cf.select v564, v1094, v1161 : u32; + v1162 = ub.poison i32 : i32; + v1153 = cf.select v564, v531, v1162 : i32; + v1163 = ub.poison i32 : i32; + v1152 = cf.select v564, v520, v1163 : i32; + v1164 = ub.poison i32 : i32; + v1151 = cf.select v564, v1164, v531 : i32; + v1165 = ub.poison i32 : i32; + v1150 = cf.select v564, v1165, v520 : i32; + scf.yield v1150, v1151, v1152, v1149, v1153, v1154; + }; + v1107, v1108, v1109 = scf.index_switch v1106 : i32, i32, i32 + case 0 { + ^block57: + v1160 = arith.constant 4 : u32; + v567 = hir.bitcast v1101 : u32; + v569 = arith.add v567, v1160 : u32 #[overflow = checked]; + v1159 = arith.constant 4 : u32; + v571 = arith.mod v569, v1159 : u32; + hir.assertz v571 #[code = 250]; + v1158 = arith.constant 0 : i32; + v572 = hir.int_to_ptr v569 : ptr; + hir.store v572, v1158; + v1157 = arith.constant 1 : i32; + scf.yield v1101, v1157, v1102; + } + default { + ^block126: + scf.yield v1103, v1104, v1105; + }; + v646 = hir.bitcast v1107 : u32; + v1156 = arith.constant 4 : u32; + v648 = arith.mod v646, v1156 : u32; + hir.assertz v648 #[code = 250]; + v649 = hir.int_to_ptr v646 : ptr; + hir.store v649, v1108; + v1155 = arith.constant 16 : i32; + v654 = arith.add v1109, v1155 : i32 #[overflow = wrapping]; + v655 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v656 = hir.bitcast v655 : ptr; + hir.store v656, v654; + builtin.ret ; + }; + + private builtin.function @::allocate(v657: i32, v658: i32, v659: i32) { + ^block67(v657: i32, v658: i32, v659: i32): + v661 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v662 = hir.bitcast v661 : ptr; + v663 = hir.load v662 : i32; + v664 = arith.constant 16 : i32; + v665 = arith.sub v663, v664 : i32 #[overflow = wrapping]; + v666 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v667 = hir.bitcast v666 : ptr; + hir.store v667, v665; + v660 = arith.constant 0 : i32; + v668 = arith.constant 8 : i32; + v669 = arith.add v665, v668 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v669, v658, v659, v660) + v672 = arith.constant 12 : u32; + v671 = hir.bitcast v665 : u32; + v673 = arith.add v671, v672 : u32 #[overflow = checked]; + v674 = arith.constant 4 : u32; + v675 = arith.mod v673, v674 : u32; + hir.assertz v675 #[code = 250]; + v676 = hir.int_to_ptr v673 : ptr; + v677 = hir.load v676 : i32; + v679 = arith.constant 8 : u32; + v678 = hir.bitcast v665 : u32; + v680 = arith.add v678, v679 : u32 #[overflow = checked]; + v1194 = arith.constant 4 : u32; + v682 = arith.mod v680, v1194 : u32; + hir.assertz v682 #[code = 250]; + v683 = hir.int_to_ptr v680 : ptr; + v684 = hir.load v683 : i32; + v685 = hir.bitcast v657 : u32; + v1193 = arith.constant 4 : u32; + v687 = arith.mod v685, v1193 : u32; + hir.assertz v687 #[code = 250]; + v688 = hir.int_to_ptr v685 : ptr; + hir.store v688, v684; + v1192 = arith.constant 4 : u32; + v689 = hir.bitcast v657 : u32; + v691 = arith.add v689, v1192 : u32 #[overflow = checked]; + v1191 = arith.constant 4 : u32; + v693 = arith.mod v691, v1191 : u32; + hir.assertz v693 #[code = 250]; + v694 = hir.int_to_ptr v691 : ptr; + hir.store v694, v677; + v1190 = arith.constant 16 : i32; + v696 = arith.add v665, v1190 : i32 #[overflow = wrapping]; + v697 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v698 = hir.bitcast v697 : ptr; + hir.store v698, v696; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v515: i32, v516: i32, v517: i32, v518: i32) { - ^block53(v515: i32, v516: i32, v517: i32, v518: i32): - v913 = arith.constant 0 : i32; - v519 = arith.constant 0 : i32; - v520 = arith.eq v517, v519 : i1; - v521 = arith.zext v520 : u32; - v522 = hir.bitcast v521 : i32; - v524 = arith.neq v522, v913 : i1; - v909 = scf.if v524 : i32 { - ^block104: - scf.yield v516; + private builtin.function @alloc::alloc::Global::alloc_impl(v699: i32, v700: i32, v701: i32, v702: i32) { + ^block69(v699: i32, v700: i32, v701: i32, v702: i32): + v1210 = arith.constant 0 : i32; + v703 = arith.constant 0 : i32; + v704 = arith.eq v701, v703 : i1; + v705 = arith.zext v704 : u32; + v706 = hir.bitcast v705 : i32; + v708 = arith.neq v706, v1210 : i1; + v1206 = scf.if v708 : i32 { + ^block129: + scf.yield v700; } else { - ^block56: + ^block72: hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v912 = arith.constant 0 : i32; - v526 = arith.neq v518, v912 : i1; - v908 = scf.if v526 : i32 { - ^block57: - v528 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc_zeroed(v517, v516) : i32 - scf.yield v528; + v1209 = arith.constant 0 : i32; + v710 = arith.neq v702, v1209 : i1; + v1205 = scf.if v710 : i32 { + ^block73: + v712 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc_zeroed(v701, v700) : i32 + scf.yield v712; } else { - ^block58: - v527 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v517, v516) : i32 - scf.yield v527; + ^block74: + v711 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v701, v700) : i32 + scf.yield v711; }; - scf.yield v908; + scf.yield v1205; }; - v532 = arith.constant 4 : u32; - v531 = hir.bitcast v515 : u32; - v533 = arith.add v531, v532 : u32 #[overflow = checked]; - v911 = arith.constant 4 : u32; - v535 = arith.mod v533, v911 : u32; - hir.assertz v535 #[code = 250]; - v536 = hir.int_to_ptr v533 : ptr; - hir.store v536, v517; - v538 = hir.bitcast v515 : u32; - v910 = arith.constant 4 : u32; - v540 = arith.mod v538, v910 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - hir.store v541, v909; + v716 = arith.constant 4 : u32; + v715 = hir.bitcast v699 : u32; + v717 = arith.add v715, v716 : u32 #[overflow = checked]; + v1208 = arith.constant 4 : u32; + v719 = arith.mod v717, v1208 : u32; + hir.assertz v719 #[code = 250]; + v720 = hir.int_to_ptr v717 : ptr; + hir.store v720, v701; + v722 = hir.bitcast v699 : u32; + v1207 = arith.constant 4 : u32; + v724 = arith.mod v722, v1207 : u32; + hir.assertz v724 #[code = 250]; + v725 = hir.int_to_ptr v722 : ptr; + hir.store v725, v1206; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v542: i32, v543: i32, v544: i32, v545: i32) { - ^block59(v542: i32, v543: i32, v544: i32, v545: i32): - v939 = arith.constant 0 : i32; - v546 = arith.constant 0 : i32; - v550 = arith.eq v545, v546 : i1; - v551 = arith.zext v550 : u32; - v552 = hir.bitcast v551 : i32; - v554 = arith.neq v552, v939 : i1; - v926, v927 = scf.if v554 : i32, i32 { - ^block108: - v938 = arith.constant 0 : i32; - v548 = arith.constant 4 : i32; - scf.yield v548, v938; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v726: i32, v727: i32, v728: i32, v729: i32) { + ^block75(v726: i32, v727: i32, v728: i32, v729: i32): + v1236 = arith.constant 0 : i32; + v730 = arith.constant 0 : i32; + v734 = arith.eq v729, v730 : i1; + v735 = arith.zext v734 : u32; + v736 = hir.bitcast v735 : i32; + v738 = arith.neq v736, v1236 : i1; + v1223, v1224 = scf.if v738 : i32, i32 { + ^block133: + v1235 = arith.constant 0 : i32; + v732 = arith.constant 4 : i32; + scf.yield v732, v1235; } else { - ^block62: - v555 = hir.bitcast v543 : u32; - v590 = arith.constant 4 : u32; - v557 = arith.mod v555, v590 : u32; - hir.assertz v557 #[code = 250]; - v558 = hir.int_to_ptr v555 : ptr; - v559 = hir.load v558 : i32; - v936 = arith.constant 0 : i32; - v937 = arith.constant 0 : i32; - v561 = arith.eq v559, v937 : i1; - v562 = arith.zext v561 : u32; - v563 = hir.bitcast v562 : i32; - v565 = arith.neq v563, v936 : i1; - v924 = scf.if v565 : i32 { - ^block107: - v935 = arith.constant 0 : i32; - scf.yield v935; + ^block78: + v739 = hir.bitcast v727 : u32; + v774 = arith.constant 4 : u32; + v741 = arith.mod v739, v774 : u32; + hir.assertz v741 #[code = 250]; + v742 = hir.int_to_ptr v739 : ptr; + v743 = hir.load v742 : i32; + v1233 = arith.constant 0 : i32; + v1234 = arith.constant 0 : i32; + v745 = arith.eq v743, v1234 : i1; + v746 = arith.zext v745 : u32; + v747 = hir.bitcast v746 : i32; + v749 = arith.neq v747, v1233 : i1; + v1221 = scf.if v749 : i32 { + ^block132: + v1232 = arith.constant 0 : i32; + scf.yield v1232; } else { - ^block63: - v934 = arith.constant 4 : u32; - v566 = hir.bitcast v542 : u32; - v568 = arith.add v566, v934 : u32 #[overflow = checked]; - v933 = arith.constant 4 : u32; - v570 = arith.mod v568, v933 : u32; - hir.assertz v570 #[code = 250]; - v571 = hir.int_to_ptr v568 : ptr; - hir.store v571, v544; - v932 = arith.constant 4 : u32; - v572 = hir.bitcast v543 : u32; - v574 = arith.add v572, v932 : u32 #[overflow = checked]; - v931 = arith.constant 4 : u32; - v576 = arith.mod v574, v931 : u32; - hir.assertz v576 #[code = 250]; - v577 = hir.int_to_ptr v574 : ptr; - v578 = hir.load v577 : i32; - v579 = hir.bitcast v542 : u32; - v930 = arith.constant 4 : u32; - v581 = arith.mod v579, v930 : u32; - hir.assertz v581 #[code = 250]; - v582 = hir.int_to_ptr v579 : ptr; - hir.store v582, v578; - v583 = arith.mul v559, v545 : i32 #[overflow = wrapping]; - scf.yield v583; + ^block79: + v1231 = arith.constant 4 : u32; + v750 = hir.bitcast v726 : u32; + v752 = arith.add v750, v1231 : u32 #[overflow = checked]; + v1230 = arith.constant 4 : u32; + v754 = arith.mod v752, v1230 : u32; + hir.assertz v754 #[code = 250]; + v755 = hir.int_to_ptr v752 : ptr; + hir.store v755, v728; + v1229 = arith.constant 4 : u32; + v756 = hir.bitcast v727 : u32; + v758 = arith.add v756, v1229 : u32 #[overflow = checked]; + v1228 = arith.constant 4 : u32; + v760 = arith.mod v758, v1228 : u32; + hir.assertz v760 #[code = 250]; + v761 = hir.int_to_ptr v758 : ptr; + v762 = hir.load v761 : i32; + v763 = hir.bitcast v726 : u32; + v1227 = arith.constant 4 : u32; + v765 = arith.mod v763, v1227 : u32; + hir.assertz v765 #[code = 250]; + v766 = hir.int_to_ptr v763 : ptr; + hir.store v766, v762; + v767 = arith.mul v743, v729 : i32 #[overflow = wrapping]; + scf.yield v767; }; - v584 = arith.constant 8 : i32; - v929 = arith.constant 4 : i32; - v925 = cf.select v565, v929, v584 : i32; - scf.yield v925, v924; + v768 = arith.constant 8 : i32; + v1226 = arith.constant 4 : i32; + v1222 = cf.select v749, v1226, v768 : i32; + scf.yield v1222, v1221; }; - v587 = arith.add v542, v926 : i32 #[overflow = wrapping]; - v589 = hir.bitcast v587 : u32; - v928 = arith.constant 4 : u32; - v591 = arith.mod v589, v928 : u32; - hir.assertz v591 #[code = 250]; - v592 = hir.int_to_ptr v589 : ptr; - hir.store v592, v927; + v771 = arith.add v726, v1223 : i32 #[overflow = wrapping]; + v773 = hir.bitcast v771 : u32; + v1225 = arith.constant 4 : u32; + v775 = arith.mod v773, v1225 : u32; + hir.assertz v775 #[code = 250]; + v776 = hir.int_to_ptr v773 : ptr; + hir.store v776, v1224; builtin.ret ; }; - private builtin.function @alloc::raw_vec::finish_grow(v593: i32, v594: i32, v595: i32, v596: i32, v597: i32) { - ^block64(v593: i32, v594: i32, v595: i32, v596: i32, v597: i32): - v599 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v600 = hir.bitcast v599 : ptr; - v601 = hir.load v600 : i32; - v602 = arith.constant 16 : i32; - v603 = arith.sub v601, v602 : i32 #[overflow = wrapping]; - v604 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v605 = hir.bitcast v604 : ptr; - hir.store v605, v603; - v994 = arith.constant 0 : i32; - v598 = arith.constant 0 : i32; - v608 = arith.gte v595, v598 : i1; - v609 = arith.zext v608 : u32; - v610 = hir.bitcast v609 : i32; - v612 = arith.neq v610, v994 : i1; - v968, v969 = scf.if v612 : i32, i32 { - ^block67: - v699 = arith.constant 4 : u32; - v615 = hir.bitcast v596 : u32; - v617 = arith.add v615, v699 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v619 = arith.mod v617, v993 : u32; - hir.assertz v619 #[code = 250]; - v620 = hir.int_to_ptr v617 : ptr; - v621 = hir.load v620 : i32; - v991 = arith.constant 0 : i32; - v992 = arith.constant 0 : i32; - v623 = arith.eq v621, v992 : i1; - v624 = arith.zext v623 : u32; - v625 = hir.bitcast v624 : i32; - v627 = arith.neq v625, v991 : i1; - v966, v967 = scf.if v627 : i32, i32 { - ^block70: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v603, v594, v595) - v990 = arith.constant 4 : u32; - v660 = hir.bitcast v603 : u32; - v662 = arith.add v660, v990 : u32 #[overflow = checked]; - v989 = arith.constant 4 : u32; - v664 = arith.mod v662, v989 : u32; - hir.assertz v664 #[code = 250]; - v665 = hir.int_to_ptr v662 : ptr; - v666 = hir.load v665 : i32; - v667 = hir.bitcast v603 : u32; - v988 = arith.constant 4 : u32; - v669 = arith.mod v667, v988 : u32; - hir.assertz v669 #[code = 250]; - v670 = hir.int_to_ptr v667 : ptr; - v671 = hir.load v670 : i32; - scf.yield v671, v666; + private builtin.function @alloc::raw_vec::finish_grow(v777: i32, v778: i32, v779: i32, v780: i32, v781: i32) { + ^block80(v777: i32, v778: i32, v779: i32, v780: i32, v781: i32): + v783 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v784 = hir.bitcast v783 : ptr; + v785 = hir.load v784 : i32; + v786 = arith.constant 16 : i32; + v787 = arith.sub v785, v786 : i32 #[overflow = wrapping]; + v788 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v789 = hir.bitcast v788 : ptr; + hir.store v789, v787; + v1291 = arith.constant 0 : i32; + v782 = arith.constant 0 : i32; + v792 = arith.gte v779, v782 : i1; + v793 = arith.zext v792 : u32; + v794 = hir.bitcast v793 : i32; + v796 = arith.neq v794, v1291 : i1; + v1265, v1266 = scf.if v796 : i32, i32 { + ^block83: + v883 = arith.constant 4 : u32; + v799 = hir.bitcast v780 : u32; + v801 = arith.add v799, v883 : u32 #[overflow = checked]; + v1290 = arith.constant 4 : u32; + v803 = arith.mod v801, v1290 : u32; + hir.assertz v803 #[code = 250]; + v804 = hir.int_to_ptr v801 : ptr; + v805 = hir.load v804 : i32; + v1288 = arith.constant 0 : i32; + v1289 = arith.constant 0 : i32; + v807 = arith.eq v805, v1289 : i1; + v808 = arith.zext v807 : u32; + v809 = hir.bitcast v808 : i32; + v811 = arith.neq v809, v1288 : i1; + v1263, v1264 = scf.if v811 : i32, i32 { + ^block86: + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v787, v778, v779) + v1287 = arith.constant 4 : u32; + v844 = hir.bitcast v787 : u32; + v846 = arith.add v844, v1287 : u32 #[overflow = checked]; + v1286 = arith.constant 4 : u32; + v848 = arith.mod v846, v1286 : u32; + hir.assertz v848 #[code = 250]; + v849 = hir.int_to_ptr v846 : ptr; + v850 = hir.load v849 : i32; + v851 = hir.bitcast v787 : u32; + v1285 = arith.constant 4 : u32; + v853 = arith.mod v851, v1285 : u32; + hir.assertz v853 #[code = 250]; + v854 = hir.int_to_ptr v851 : ptr; + v855 = hir.load v854 : i32; + scf.yield v855, v850; } else { - ^block71: - v629 = arith.constant 8 : u32; - v628 = hir.bitcast v596 : u32; - v630 = arith.add v628, v629 : u32 #[overflow = checked]; - v987 = arith.constant 4 : u32; - v632 = arith.mod v630, v987 : u32; - hir.assertz v632 #[code = 250]; - v633 = hir.int_to_ptr v630 : ptr; - v634 = hir.load v633 : i32; - v986 = arith.constant 0 : i32; - v636 = arith.neq v634, v986 : i1; - v964, v965 = scf.if v636 : i32, i32 { - ^block72: - v654 = hir.bitcast v596 : u32; - v985 = arith.constant 4 : u32; - v656 = arith.mod v654, v985 : u32; - hir.assertz v656 #[code = 250]; - v657 = hir.int_to_ptr v654 : ptr; - v658 = hir.load v657 : i32; - v659 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_realloc(v658, v634, v594, v595) : i32 - scf.yield v659, v595; + ^block87: + v813 = arith.constant 8 : u32; + v812 = hir.bitcast v780 : u32; + v814 = arith.add v812, v813 : u32 #[overflow = checked]; + v1284 = arith.constant 4 : u32; + v816 = arith.mod v814, v1284 : u32; + hir.assertz v816 #[code = 250]; + v817 = hir.int_to_ptr v814 : ptr; + v818 = hir.load v817 : i32; + v1283 = arith.constant 0 : i32; + v820 = arith.neq v818, v1283 : i1; + v1261, v1262 = scf.if v820 : i32, i32 { + ^block88: + v838 = hir.bitcast v780 : u32; + v1282 = arith.constant 4 : u32; + v840 = arith.mod v838, v1282 : u32; + hir.assertz v840 #[code = 250]; + v841 = hir.int_to_ptr v838 : ptr; + v842 = hir.load v841 : i32; + v843 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_realloc(v842, v818, v778, v779) : i32 + scf.yield v843, v779; } else { - ^block73: - v984 = arith.constant 0 : i32; - v693 = arith.constant 8 : i32; - v638 = arith.add v603, v693 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v638, v594, v595, v984) - v641 = arith.constant 12 : u32; - v640 = hir.bitcast v603 : u32; - v642 = arith.add v640, v641 : u32 #[overflow = checked]; - v983 = arith.constant 4 : u32; - v644 = arith.mod v642, v983 : u32; - hir.assertz v644 #[code = 250]; - v645 = hir.int_to_ptr v642 : ptr; - v646 = hir.load v645 : i32; - v982 = arith.constant 8 : u32; - v647 = hir.bitcast v603 : u32; - v649 = arith.add v647, v982 : u32 #[overflow = checked]; - v981 = arith.constant 4 : u32; - v651 = arith.mod v649, v981 : u32; - hir.assertz v651 #[code = 250]; - v652 = hir.int_to_ptr v649 : ptr; - v653 = hir.load v652 : i32; - scf.yield v653, v646; + ^block89: + v1281 = arith.constant 0 : i32; + v877 = arith.constant 8 : i32; + v822 = arith.add v787, v877 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v822, v778, v779, v1281) + v825 = arith.constant 12 : u32; + v824 = hir.bitcast v787 : u32; + v826 = arith.add v824, v825 : u32 #[overflow = checked]; + v1280 = arith.constant 4 : u32; + v828 = arith.mod v826, v1280 : u32; + hir.assertz v828 #[code = 250]; + v829 = hir.int_to_ptr v826 : ptr; + v830 = hir.load v829 : i32; + v1279 = arith.constant 8 : u32; + v831 = hir.bitcast v787 : u32; + v833 = arith.add v831, v1279 : u32 #[overflow = checked]; + v1278 = arith.constant 4 : u32; + v835 = arith.mod v833, v1278 : u32; + hir.assertz v835 #[code = 250]; + v836 = hir.int_to_ptr v833 : ptr; + v837 = hir.load v836 : i32; + scf.yield v837, v830; }; - scf.yield v964, v965; + scf.yield v1261, v1262; }; - v980 = arith.constant 4 : u32; - v678 = hir.bitcast v593 : u32; - v680 = arith.add v678, v980 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v682 = arith.mod v680, v979 : u32; - hir.assertz v682 #[code = 250]; - v978 = arith.constant 0 : i32; - v676 = arith.neq v966, v978 : i1; - v677 = cf.select v676, v966, v594 : i32; - v683 = hir.int_to_ptr v680 : ptr; - hir.store v683, v677; - v976 = arith.constant 0 : i32; - v690 = arith.eq v966, v976 : i1; - v691 = arith.zext v690 : u32; - v692 = hir.bitcast v691 : i32; - v977 = arith.constant 0 : i32; - v687 = arith.neq v966, v977 : i1; - v688 = cf.select v687, v967, v595 : i32; - scf.yield v688, v692; + v1277 = arith.constant 4 : u32; + v862 = hir.bitcast v777 : u32; + v864 = arith.add v862, v1277 : u32 #[overflow = checked]; + v1276 = arith.constant 4 : u32; + v866 = arith.mod v864, v1276 : u32; + hir.assertz v866 #[code = 250]; + v1275 = arith.constant 0 : i32; + v860 = arith.neq v1263, v1275 : i1; + v861 = cf.select v860, v1263, v778 : i32; + v867 = hir.int_to_ptr v864 : ptr; + hir.store v867, v861; + v1273 = arith.constant 0 : i32; + v874 = arith.eq v1263, v1273 : i1; + v875 = arith.zext v874 : u32; + v876 = hir.bitcast v875 : i32; + v1274 = arith.constant 0 : i32; + v871 = arith.neq v1263, v1274 : i1; + v872 = cf.select v871, v1264, v779 : i32; + scf.yield v872, v876; } else { - ^block68: - v613 = arith.constant 1 : i32; - v975 = arith.constant 0 : i32; - scf.yield v975, v613; + ^block84: + v797 = arith.constant 1 : i32; + v1272 = arith.constant 0 : i32; + scf.yield v1272, v797; }; - v614 = arith.constant 4 : i32; - v974 = arith.constant 8 : i32; - v970 = cf.select v612, v974, v614 : i32; - v696 = arith.add v593, v970 : i32 #[overflow = wrapping]; - v698 = hir.bitcast v696 : u32; - v973 = arith.constant 4 : u32; - v700 = arith.mod v698, v973 : u32; - hir.assertz v700 #[code = 250]; - v701 = hir.int_to_ptr v698 : ptr; - hir.store v701, v968; - v703 = hir.bitcast v593 : u32; - v972 = arith.constant 4 : u32; - v705 = arith.mod v703, v972 : u32; - hir.assertz v705 #[code = 250]; - v706 = hir.int_to_ptr v703 : ptr; - hir.store v706, v969; - v971 = arith.constant 16 : i32; - v710 = arith.add v603, v971 : i32 #[overflow = wrapping]; - v711 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v712 = hir.bitcast v711 : ptr; - hir.store v712, v710; + v798 = arith.constant 4 : i32; + v1271 = arith.constant 8 : i32; + v1267 = cf.select v796, v1271, v798 : i32; + v880 = arith.add v777, v1267 : i32 #[overflow = wrapping]; + v882 = hir.bitcast v880 : u32; + v1270 = arith.constant 4 : u32; + v884 = arith.mod v882, v1270 : u32; + hir.assertz v884 #[code = 250]; + v885 = hir.int_to_ptr v882 : ptr; + hir.store v885, v1265; + v887 = hir.bitcast v777 : u32; + v1269 = arith.constant 4 : u32; + v889 = arith.mod v887, v1269 : u32; + hir.assertz v889 #[code = 250]; + v890 = hir.int_to_ptr v887 : ptr; + hir.store v890, v1266; + v1268 = arith.constant 16 : i32; + v894 = arith.add v787, v1268 : i32 #[overflow = wrapping]; + v895 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr + v896 = hir.bitcast v895 : ptr; + hir.store v896, v894; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v713: i32, v714: i32, v715: i32) { - ^block74(v713: i32, v714: i32, v715: i32): + private builtin.function @alloc::raw_vec::handle_error(v897: i32, v898: i32, v899: i32) { + ^block90(v897: i32, v898: i32, v899: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v716: i32, v717: i32) -> i32 { - ^block76(v716: i32, v717: i32): - v724 = arith.constant 0 : i32; - v720 = hir.bitcast v717 : u32; - v719 = hir.bitcast v716 : u32; - v721 = arith.gt v719, v720 : i1; - v722 = arith.zext v721 : u32; - v723 = hir.bitcast v722 : i32; - v725 = arith.neq v723, v724 : i1; - v726 = cf.select v725, v716, v717 : i32; - builtin.ret v726; + private builtin.function @core::ptr::alignment::Alignment::max(v900: i32, v901: i32) -> i32 { + ^block92(v900: i32, v901: i32): + v908 = arith.constant 0 : i32; + v904 = hir.bitcast v901 : u32; + v903 = hir.bitcast v900 : u32; + v905 = arith.gt v903, v904 : i1; + v906 = arith.zext v905 : u32; + v907 = hir.bitcast v906 : i32; + v909 = arith.neq v907, v908 : i1; + v910 = cf.select v909, v900, v901 : i32; + builtin.ret v910; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.masm b/felt-repr/tests/expected/onchain_two_felts_struct.masm index 102a7fbf7..c64ea6675 100644 --- a/felt-repr/tests/expected/onchain_two_felts_struct.masm +++ b/felt-repr/tests/expected/onchain_two_felts_struct.masm @@ -256,7 +256,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_sw trace.252 nop - push.16 + push.32 u32wrapping_sub push.1114144 dup.1 @@ -299,98 +299,24 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 - push.4 - dup.4 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz push.0 - push.4 - movup.2 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.4 - dup.4 + push.256 + push.20 + dup.6 u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 dup.3 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 + swap.4 + swap.3 + swap.2 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::try_allocate_in trace.252 nop - push.8 + push.24 dup.3 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 add u32assert push.4 @@ -403,10 +329,13 @@ pub proc entrypoint(i32, i32) swap.1 trace.240 nop - exec.::intrinsics::mem::load_dw + exec.::intrinsics::mem::load_sw trace.252 nop - movup.3 + push.20 + dup.4 + add + u32assert push.4 dup.1 swap.1 @@ -417,181 +346,298 @@ pub proc entrypoint(i32, i32) swap.1 trace.240 nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + exec.::intrinsics::mem::load_sw trace.252 nop push.0 - push.0 - dup.2 - eq + push.1 + movup.2 + neq neq if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 + push.8 + push.8 dup.5 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 swap.1 - u32lt - neq + u32mod + u32assert + assertz + push.0 swap.1 - swap.4 + u32divmod.4 swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + dup.5 + add + u32assert + push.4 + dup.1 swap.1 - drop - else + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.4 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movdn.2 + drop + drop + movup.2 + drop + push.28 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 + swap.2 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + movdn.3 + drop + drop + drop + else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop push.0 push.0 - dup.3 + dup.2 eq neq if.true - swap.1 + drop drop else - push.0 - movup.2 dup.2 + movup.2 push.0 - dup.2 + dup.3 push.0 gte while.true - dup.1 + dup.2 dup.1 push.1 u32overflowing_madd assertz - dup.4 + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and swap.1 u32divmod.4 swap.1 @@ -616,7 +662,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 mem_store u32wrapping_add.1 dup.0 - dup.3 + dup.4 u32gte end dropw @@ -625,14 +671,90 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 end @callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 nop -end - -@callconv("C") -proc ::alloc( + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc ::alloc( i32, i32, i32 @@ -817,14 +939,401 @@ proc intrinsics::mem::heap_base( ) -> i32 trace.240 nop - exec.::intrinsics::mem::heap_base + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::grow_amortized( + i32, + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.8 + eq + neq + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + movup.4 + dup.4 + u32wrapping_add + push.0 + movup.5 + dup.2 + swap.1 + u32lt + neq + if.true + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32shl + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + push.1 + push.4 + push.0 + push.1025 + dup.9 + swap.1 + u32lt + neq + cdrop + push.8 + push.0 + push.1 + dup.9 + eq + neq + cdrop + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + dup.2 + swap.1 + cdrop + dup.0 + push.0 + push.0 + dup.8 + u32wrapping_sub + push.4294967295 + dup.9 + dup.11 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + drop + push.0 + push.2147483648 + dup.8 + u32wrapping_sub + dup.2 + swap.1 + u32gt + neq + if.true + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + push.20 + dup.4 + u32wrapping_add + dup.6 + dup.8 + movup.3 + swap.10 + movdn.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.20 + dup.3 + u32wrapping_add + push.8 + dup.4 + u32wrapping_add + dup.5 + movup.2 + swap.3 + swap.9 + movdn.2 + swap.4 + swap.8 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::finish_grow + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.4 + else + movup.2 + swap.6 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.4 + drop + drop + drop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + end + push.2147483649 + movdn.2 + movdn.3 + cdrop + swap.1 + end + end + end + end + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw trace.252 nop end @callconv("C") -proc alloc::raw_vec::RawVecInner::grow_amortized( - i32, +proc alloc::raw_vec::RawVecInner::try_allocate_in( i32, i32, i32, @@ -839,7 +1348,7 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( exec.::intrinsics::mem::load_sw trace.252 nop - push.32 + push.16 u32wrapping_sub push.1114144 dup.1 @@ -851,15 +1360,48 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( exec.::intrinsics::mem::store_sw trace.252 nop + dup.2 push.0 push.0 - dup.8 - eq + dup.7 + u32wrapping_sub + push.4294967295 + movup.9 + dup.9 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop neq if.true - movup.2 drop - movup.2 drop movup.2 drop @@ -868,187 +1410,119 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( movup.2 drop push.0 + push.3735929054 dup.0 + dup.1 + swap.4 + swap.1 + swap.3 + swap.5 else - movup.4 - dup.4 - u32wrapping_add + drop push.0 - movup.5 + push.2147483648 + dup.7 + u32wrapping_sub dup.2 swap.1 - u32lt + u32lte neq + dup.0 if.true - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1 - u32shl - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - movup.2 - swap.1 - cdrop - push.1 - push.4 - push.0 - push.1025 - dup.9 - swap.1 - u32lt - neq - cdrop - push.8 - push.0 - push.1 - dup.9 - eq - neq - cdrop push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq dup.2 - swap.1 - cdrop - dup.0 - push.0 - push.0 - dup.8 - u32wrapping_sub - push.4294967295 - dup.9 - dup.11 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop neq if.true - drop - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - drop push.0 - push.2147483648 - dup.8 - u32wrapping_sub - dup.2 - swap.1 - u32gt + movup.6 neq if.true - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop else - push.20 - dup.4 + push.8 + dup.3 u32wrapping_add dup.6 - dup.8 - movup.3 - swap.10 - movdn.3 + dup.3 swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::current_memory + exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::allocate trace.252 nop - push.20 + push.8 dup.3 - u32wrapping_add + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + movup.6 + movup.2 + drop + drop push.8 - dup.4 - u32wrapping_add dup.5 - movup.2 - swap.3 - swap.9 - movdn.2 - swap.4 - swap.8 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::finish_grow + exec.::intrinsics::mem::store_sw trace.252 nop - push.12 - dup.1 + push.4 + dup.4 add u32assert push.4 @@ -1057,15 +1531,22 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( u32mod u32assert assertz + movup.5 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop + else + movup.7 + movup.4 + drop + drop push.8 - dup.2 + dup.5 add u32assert push.4 @@ -1074,117 +1555,171 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( u32mod u32assert assertz + movup.2 + swap.1 u32divmod.4 swap.1 trace.240 nop - exec.::intrinsics::mem::load_sw + exec.::intrinsics::mem::store_sw trace.252 nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.7 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.4 - else - movup.2 - swap.6 - movdn.2 - swap.1 - swap.5 - swap.1 - swap.4 - drop - drop - drop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - end - push.2147483649 - movdn.2 - movdn.3 - cdrop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop end + push.0 + push.1 + movup.2 + cdrop + else + movup.2 + swap.5 + movdn.2 + swap.4 + swap.1 + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + swap.3 + swap.2 + swap.1 end + else + swap.1 + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.3735929054 end + push.0 + push.1 + dup.3 + cdrop + push.3735929054 + dup.3 + dup.5 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.7 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + movup.2 + swap.7 + movdn.2 + swap.1 + swap.5 + cdrop + swap.1 + swap.5 + swap.4 + swap.2 + swap.3 + swap.1 + end + movup.5 + eq.0 + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + swap.1 + else + drop + drop end - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 push.4 dup.1 swap.1 @@ -1198,7 +1733,7 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( exec.::intrinsics::mem::store_sw trace.252 nop - push.32 + push.16 u32wrapping_add push.1114144 u32divmod.4 diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.wat b/felt-repr/tests/expected/onchain_two_felts_struct.wat index d1884b2ba..05c5adfa4 100644 --- a/felt-repr/tests/expected/onchain_two_felts_struct.wat +++ b/felt-repr/tests/expected/onchain_two_felts_struct.wat @@ -8,9 +8,9 @@ (type (;6;) (func (param i32 i32 i32) (result i32))) (type (;7;) (func (result i32))) (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;9;) (func (param i32 i32 i32))) - (type (;10;) (func (param i32 i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -80,9 +80,9 @@ global.set $__stack_pointer ) (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32) + (local i32 f32 f32 i32) global.get $__stack_pointer - i32.const 16 + i32.const 32 i32.sub local.tee 2 global.set $__stack_pointer @@ -93,38 +93,66 @@ f32.load local.set 4 local.get 2 + i32.const 20 + i32.add + i32.const 256 + i32.const 0 i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::try_allocate_in + local.get 2 + i32.load offset=24 + local.set 1 + block ;; label = @1 + local.get 2 + i32.load offset=20 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 1 + local.get 2 + i32.load offset=28 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 2 + i32.const 8 i32.add i32.const 8 i32.add - local.tee 1 + local.tee 5 i32.const 0 i32.store local.get 2 - i64.const 17179869184 - i64.store offset=4 align=4 local.get 2 - i32.const 4 + i32.load offset=28 + i32.store offset=12 + local.get 2 + local.get 1 + i32.store offset=8 + local.get 2 + i32.const 8 i32.add local.get 4 call $alloc::vec::Vec::push local.get 2 - i32.const 4 + i32.const 8 i32.add local.get 3 call $alloc::vec::Vec::push local.get 0 i32.const 8 i32.add - local.get 1 + local.get 5 i32.load i32.store local.get 0 local.get 2 - i64.load offset=4 align=4 + i64.load offset=8 align=4 i64.store align=4 local.get 2 - i32.const 16 + i32.const 32 i32.add global.set $__stack_pointer ) @@ -384,7 +412,119 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;10;) (type 9) (param i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;10;) (type 9) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;11;) (type 10) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -413,7 +553,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;11;) (type 10) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;12;) (type 11) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -440,7 +580,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;12;) (type 10) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;13;) (type 11) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -475,7 +615,7 @@ local.get 4 i32.store ) - (func $alloc::raw_vec::finish_grow (;13;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::finish_grow (;14;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i32) global.get $__stack_pointer i32.const 16 @@ -574,10 +714,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;14;) (type 9) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;15;) (type 10) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;15;) (type 3) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;16;) (type 3) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index a1a050f74..fd2b5cb43 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -134,13 +134,8 @@ fn two_felts_struct_round_trip() { let vec_metadata: [TestFelt; 4] = trace .read_from_rust_memory(out_byte_addr) .expect("Failed to read Vec metadata from memory"); - - // The Word is stored in reverse order when read as [TestFelt; 4]: - // Word[0] -> TestFelt[3] = pointer - // Word[1] -> TestFelt[2] = length - // Word[2] -> TestFelt[1] = (unused) - // Word[3] -> TestFelt[0] = capacity - let data_ptr = vec_metadata[3].0.as_int() as u32; + // Vec metadata layout is: [capacity, ptr, len, ?] + let data_ptr = vec_metadata[1].0.as_int() as u32; let len = vec_metadata[2].0.as_int() as usize; assert_eq!(len, 2, "Expected Vec with 2 felts"); @@ -151,6 +146,7 @@ fn two_felts_struct_round_trip() { .expect("Failed to read Vec data from memory"); let result_felts = [result_data[0].0, result_data[1].0]; + dbg!(&result_data); let mut reader = FeltReader::new(&result_felts); let result_struct = TwoFelts::from_felt_repr(&mut reader); @@ -230,54 +226,31 @@ fn five_felts_struct_round_trip() { let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { - // Vec is returned as (ptr, len, capacity) via C ABI let vec_metadata: [TestFelt; 4] = trace .read_from_rust_memory(out_byte_addr) .expect("Failed to read Vec metadata from memory"); - - // The Word is stored in reverse order when read as [TestFelt; 4]: - // Word[0] -> TestFelt[3] = pointer - // Word[1] -> TestFelt[2] = length - // Word[2] -> TestFelt[1] = (unused) - // Word[3] -> TestFelt[0] = capacity - let data_ptr = vec_metadata[3].0.as_int() as u32; + // Vec metadata layout is: [capacity, ptr, len, ?] + // where ptr is a byte address. + let data_ptr = vec_metadata[1].0.as_int() as u32; let len = vec_metadata[2].0.as_int() as usize; assert_eq!(len, 5, "Expected Vec with 5 felts"); - // Read the actual data from the Vec's data pointer - // data_ptr is a byte address - eprintln!("data_ptr = {}", data_ptr); - - let result_data1: [TestFelt; 4] = trace - .read_from_rust_memory(data_ptr) - .expect("Failed to read Vec data (word 0) from memory"); - eprintln!("word at data_ptr (0): {:?}", result_data1); - - let result_data2: [TestFelt; 4] = trace - .read_from_rust_memory(data_ptr + 16) - .expect("Failed to read Vec data (word 1) from memory"); - eprintln!("word at data_ptr (1): {:?}", result_data1); - - // Search for the 5th felt in nearby memory (word-aligned = multiples of 16 bytes) - for word_offset in -2i32..=2 { - let byte_offset = word_offset * 16; - if let Some(data) = - trace.read_from_rust_memory::<[TestFelt; 4]>((data_ptr as i32 + byte_offset) as u32) - { - eprintln!("word at data_ptr+{}: {:?}", byte_offset, data); + // Convert byte address to element address + let elem_addr = data_ptr / 4; + + // Read all 5 elements individually + let mut result_felts = [Felt::ZERO; 5]; + #[allow(clippy::needless_range_loop)] + for i in 0..5 { + let byte_addr = (elem_addr + i as u32) * 4; + let word_addr = (byte_addr / 16) * 16; + if let Some(data) = trace.read_from_rust_memory::<[TestFelt; 4]>(word_addr) { + let elem_in_word = ((byte_addr % 16) / 4) as usize; + result_felts[i] = data[elem_in_word].0; } } - // The 5th felt is missing - Vec might not have allocated contiguous memory - // For now, just use the first 4 felts we found - let result_felts = [ - result_data1[0].0, - result_data1[1].0, - result_data1[2].0, - result_data1[3].0, - result_data2[0].0, // Felt::ZERO, // 5th felt is not being stored correctly - ]; let mut reader = FeltReader::new(&result_felts); let result_struct = FiveFelts::from_felt_repr(&mut reader); From 65ad30c7d659af226e6f68ab3581db1b54f4a85b Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 9 Dec 2025 17:15:01 +0200 Subject: [PATCH 11/15] test: add a super roundtrip test with non-Felt fields --- felt-repr/tests/src/onchain.rs | 107 +++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index fd2b5cb43..b48704309 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -259,3 +259,110 @@ fn five_felts_struct_round_trip() { }) .unwrap(); } + +/// Test struct with mixed field types for round-trip tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct MixedTypes { + f1: Felt, + f2: Felt, + n1: u64, + n2: u64, + x: u32, + y: u8, +} + +/// Test struct serialization with mixed field types - full round-trip execution. +/// +/// Tests a struct with 2 Felt, 2 u64, 1 u32, and 1 u8 fields. +/// Each field is serialized as one Felt, so total is 6 Felts. +#[test] +fn mixed_types_struct_round_trip() { + let original = MixedTypes { + f1: Felt::new(111111), + f2: Felt::new(222222), + n1: 333333, + n2: 444444, + x: 55555, + y: 66, + }; + let serialized = original.to_felt_repr(); + + // Each field serializes to one Felt + assert_eq!(serialized.len(), 6); + + let onchain_code = r#"(input: [Felt; 6]) -> Vec { + use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + f1: Felt, + f2: Felt, + n1: u64, + n2: u64, + x: u32, + y: u8, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + // Verify some fields were deserialized correctly + assert_eq(deserialized.f1, felt!(111111)); + assert_eq(Felt::from(deserialized.y as u32), felt!(66)); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let artifact_name = "onchain_mixed_types_struct"; + let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = serialized.clone(); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; + + let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let vec_metadata: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read Vec metadata from memory"); + // Vec metadata layout is: [capacity, ptr, len, ?] + let data_ptr = vec_metadata[1].0.as_int() as u32; + let len = vec_metadata[2].0.as_int() as usize; + + assert_eq!(len, 6, "Expected Vec with 6 felts"); + + // Convert byte address to element address + let elem_addr = data_ptr / 4; + + // Read all 6 elements individually + let mut result_felts = [Felt::ZERO; 6]; + #[allow(clippy::needless_range_loop)] + for i in 0..6 { + let byte_addr = (elem_addr + i as u32) * 4; + let word_addr = (byte_addr / 16) * 16; + if let Some(data) = trace.read_from_rust_memory::<[TestFelt; 4]>(word_addr) { + let elem_in_word = ((byte_addr % 16) / 4) as usize; + result_felts[i] = data[elem_in_word].0; + } + } + + let mut reader = FeltReader::new(&result_felts); + let result_struct = MixedTypes::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Mixed types round-trip failed"); + Ok(()) + }) + .unwrap(); +} From 5edf4c7d720291842db2b587c05f188c9e472849 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Tue, 9 Dec 2025 17:54:07 +0200 Subject: [PATCH 12/15] test: add a super roundtrip test for nested structs --- felt-repr/offchain/src/lib.rs | 15 +- felt-repr/onchain/src/lib.rs | 14 + .../expected/onchain_five_felts_struct.hir | 1999 +++++++------ .../expected/onchain_five_felts_struct.masm | 46 +- .../expected/onchain_five_felts_struct.wat | 57 +- .../expected/onchain_mixed_types_struct.hir | 1331 +++++++++ .../expected/onchain_mixed_types_struct.masm | 2605 +++++++++++++++++ .../expected/onchain_mixed_types_struct.wat | 797 +++++ felt-repr/tests/src/onchain.rs | 131 +- 9 files changed, 5916 insertions(+), 1079 deletions(-) create mode 100644 felt-repr/tests/expected/onchain_mixed_types_struct.hir create mode 100644 felt-repr/tests/expected/onchain_mixed_types_struct.masm create mode 100644 felt-repr/tests/expected/onchain_mixed_types_struct.wat diff --git a/felt-repr/offchain/src/lib.rs b/felt-repr/offchain/src/lib.rs index d14783fa3..bc4038670 100644 --- a/felt-repr/offchain/src/lib.rs +++ b/felt-repr/offchain/src/lib.rs @@ -82,6 +82,12 @@ impl FromFeltRepr for u8 { } } +impl FromFeltRepr for bool { + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_int() != 0 + } +} + /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { /// Writes this value's felt representation to the writer. @@ -89,7 +95,8 @@ pub trait ToFeltRepr { /// Convenience method that allocates and returns a `Vec`. fn to_felt_repr(&self) -> Vec { - let mut data = Vec::new(); + // Allocate ahead to avoid reallocations + let mut data = Vec::with_capacity(256); self.write_felt_repr(&mut FeltWriter::new(&mut data)); data } @@ -118,3 +125,9 @@ impl ToFeltRepr for u8 { writer.write(Felt::new(*self as u64)); } } + +impl ToFeltRepr for bool { + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::new(*self as u64)); + } +} diff --git a/felt-repr/onchain/src/lib.rs b/felt-repr/onchain/src/lib.rs index cfb9de1d0..b4a0991c1 100644 --- a/felt-repr/onchain/src/lib.rs +++ b/felt-repr/onchain/src/lib.rs @@ -87,6 +87,13 @@ impl FromFeltRepr for u8 { } } +impl FromFeltRepr for bool { + #[inline(always)] + fn from_felt_repr(reader: &mut FeltReader<'_>) -> Self { + reader.read().as_u64() != 0 + } +} + /// Trait for serializing a type into its felt memory representation. pub trait ToFeltRepr { /// Writes this value's felt representation to the writer. @@ -128,3 +135,10 @@ impl ToFeltRepr for u8 { writer.write(Felt::from(*self as u32)); } } + +impl ToFeltRepr for bool { + #[inline(always)] + fn write_felt_repr(&self, writer: &mut FeltWriter<'_>) { + writer.write(Felt::from(*self as u32)); + } +} diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.hir b/felt-repr/tests/expected/onchain_five_felts_struct.hir index f11a36cb9..f4b18e3ac 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.hir +++ b/felt-repr/tests/expected/onchain_five_felts_struct.hir @@ -11,8 +11,8 @@ builtin.component root_ns:root@1.0.0 { v8 = hir.int_to_ptr v5 : ptr; v9 = hir.load v8 : i32; v10 = hir.bitcast v0 : u32; - v955 = arith.constant 4 : u32; - v12 = arith.mod v10, v955 : u32; + v948 = arith.constant 4 : u32; + v12 = arith.mod v10, v948 : u32; hir.assertz v12 #[code = 250]; v13 = hir.int_to_ptr v10 : ptr; v14 = hir.load v13 : i32; @@ -22,35 +22,35 @@ builtin.component root_ns:root@1.0.0 { v17 = hir.bitcast v16 : i32; v19 = arith.neq v17, v2 : i1; scf.if v19{ - ^block98: + ^block94: scf.yield ; } else { ^block7: hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) scf.yield ; }; - v954 = arith.constant 4 : u32; + v947 = arith.constant 4 : u32; v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v954 : u32 #[overflow = checked]; - v953 = arith.constant 4 : u32; - v25 = arith.mod v23, v953 : u32; + v23 = arith.add v21, v947 : u32 #[overflow = checked]; + v946 = arith.constant 4 : u32; + v25 = arith.mod v23, v946 : u32; hir.assertz v25 #[code = 250]; v26 = hir.int_to_ptr v23 : ptr; v27 = hir.load v26 : i32; - v945 = arith.constant 2 : u32; - v31 = arith.shl v9, v945 : i32; + v938 = arith.constant 2 : u32; + v31 = arith.shl v9, v938 : i32; v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; v34 = hir.bitcast v32 : u32; - v952 = arith.constant 4 : u32; - v36 = arith.mod v34, v952 : u32; + v945 = arith.constant 4 : u32; + v36 = arith.mod v34, v945 : u32; hir.assertz v36 #[code = 250]; v37 = hir.int_to_ptr v34 : ptr; hir.store v37, v1; - v951 = arith.constant 8 : u32; + v944 = arith.constant 8 : u32; v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v951 : u32 #[overflow = checked]; - v950 = arith.constant 4 : u32; - v44 = arith.mod v42, v950 : u32; + v42 = arith.add v40, v944 : u32 #[overflow = checked]; + v943 = arith.constant 4 : u32; + v44 = arith.mod v42, v943 : u32; hir.assertz v44 #[code = 250]; v38 = arith.constant 1 : i32; v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; @@ -83,8 +83,8 @@ builtin.component root_ns:root@1.0.0 { v66 = arith.constant 8 : u32; v65 = hir.bitcast v52 : u32; v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v959 = arith.constant 4 : u32; - v69 = arith.mod v67, v959 : u32; + v952 = arith.constant 4 : u32; + v69 = arith.mod v67, v952 : u32; hir.assertz v69 #[code = 250]; v70 = hir.int_to_ptr v67 : ptr; v71 = hir.load v70 : i32; @@ -96,8 +96,8 @@ builtin.component root_ns:root@1.0.0 { v77 = arith.neq v75, v47 : i1; cf.cond_br v77 ^block10, ^block11; ^block10: - v958 = arith.constant 16 : i32; - v87 = arith.add v52, v958 : i32 #[overflow = wrapping]; + v951 = arith.constant 16 : i32; + v87 = arith.add v52, v951 : i32 #[overflow = wrapping]; v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr v89 = hir.bitcast v88 : ptr; hir.store v89, v87; @@ -106,8 +106,8 @@ builtin.component root_ns:root@1.0.0 { v79 = arith.constant 12 : u32; v78 = hir.bitcast v52 : u32; v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v957 = arith.constant 4 : u32; - v82 = arith.mod v80, v957 : u32; + v950 = arith.constant 4 : u32; + v82 = arith.mod v80, v950 : u32; hir.assertz v82 #[code = 250]; v83 = hir.int_to_ptr v80 : ptr; v84 = hir.load v83 : i32; @@ -126,7 +126,7 @@ builtin.component root_ns:root@1.0.0 { v100 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr v101 = hir.bitcast v100 : ptr; hir.store v101, v99; - v103 = arith.constant 12 : u32; + v103 = arith.constant 16 : u32; v102 = hir.bitcast v91 : u32; v104 = arith.add v102, v103 : u32 #[overflow = checked]; v105 = arith.constant 4 : u32; @@ -134,257 +134,254 @@ builtin.component root_ns:root@1.0.0 { hir.assertz v106 #[code = 250]; v107 = hir.int_to_ptr v104 : ptr; v108 = hir.load v107 : felt; - v110 = arith.constant 8 : u32; + v110 = arith.constant 12 : u32; v109 = hir.bitcast v91 : u32; v111 = arith.add v109, v110 : u32 #[overflow = checked]; - v990 = arith.constant 4 : u32; - v113 = arith.mod v111, v990 : u32; + v983 = arith.constant 4 : u32; + v113 = arith.mod v111, v983 : u32; hir.assertz v113 #[code = 250]; v114 = hir.int_to_ptr v111 : ptr; v115 = hir.load v114 : felt; - v989 = arith.constant 4 : u32; + v117 = arith.constant 8 : u32; v116 = hir.bitcast v91 : u32; - v118 = arith.add v116, v989 : u32 #[overflow = checked]; - v988 = arith.constant 4 : u32; - v120 = arith.mod v118, v988 : u32; + v118 = arith.add v116, v117 : u32 #[overflow = checked]; + v982 = arith.constant 4 : u32; + v120 = arith.mod v118, v982 : u32; hir.assertz v120 #[code = 250]; v121 = hir.int_to_ptr v118 : ptr; v122 = hir.load v121 : felt; + v981 = arith.constant 4 : u32; v123 = hir.bitcast v91 : u32; - v987 = arith.constant 4 : u32; - v125 = arith.mod v123, v987 : u32; - hir.assertz v125 #[code = 250]; - v126 = hir.int_to_ptr v123 : ptr; - v127 = hir.load v126 : felt; - v129 = arith.constant 16 : u32; - v128 = hir.bitcast v91 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v986 = arith.constant 4 : u32; - v132 = arith.mod v130, v986 : u32; + v125 = arith.add v123, v981 : u32 #[overflow = checked]; + v980 = arith.constant 4 : u32; + v127 = arith.mod v125, v980 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + v129 = hir.load v128 : felt; + v130 = hir.bitcast v91 : u32; + v979 = arith.constant 4 : u32; + v132 = arith.mod v130, v979 : u32; hir.assertz v132 #[code = 250]; v133 = hir.int_to_ptr v130 : ptr; v134 = hir.load v133 : felt; - v135 = arith.constant 55555 : i32; - v136 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::from_u32(v135) : felt - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::felt::assert_eq(v134, v136) - v141 = arith.constant 4 : i32; + v139 = arith.constant 4 : i32; v92 = arith.constant 0 : i32; - v139 = arith.constant 256 : i32; - v137 = arith.constant 20 : i32; - v138 = arith.add v99, v137 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v138, v139, v92, v141, v141) - v144 = arith.constant 24 : u32; - v143 = hir.bitcast v99 : u32; - v145 = arith.add v143, v144 : u32 #[overflow = checked]; - v985 = arith.constant 4 : u32; - v147 = arith.mod v145, v985 : u32; - hir.assertz v147 #[code = 250]; - v148 = hir.int_to_ptr v145 : ptr; - v149 = hir.load v148 : i32; - v151 = arith.constant 20 : u32; - v150 = hir.bitcast v99 : u32; - v152 = arith.add v150, v151 : u32 #[overflow = checked]; - v984 = arith.constant 4 : u32; - v154 = arith.mod v152, v984 : u32; - hir.assertz v154 #[code = 250]; - v155 = hir.int_to_ptr v152 : ptr; - v156 = hir.load v155 : i32; - v983 = arith.constant 0 : i32; - v157 = arith.constant 1 : i32; - v158 = arith.neq v156, v157 : i1; - v159 = arith.zext v158 : u32; - v160 = hir.bitcast v159 : i32; - v162 = arith.neq v160, v983 : i1; - cf.cond_br v162 ^block14, ^block15; - ^block14: - v982 = arith.constant 8 : i32; - v171 = arith.constant 8 : i32; - v172 = arith.add v99, v171 : i32 #[overflow = wrapping]; - v174 = arith.add v172, v982 : i32 #[overflow = wrapping]; - v176 = hir.bitcast v174 : u32; - v981 = arith.constant 4 : u32; - v178 = arith.mod v176, v981 : u32; - hir.assertz v178 #[code = 250]; - v980 = arith.constant 0 : i32; - v179 = hir.int_to_ptr v176 : ptr; - hir.store v179, v980; - v181 = arith.constant 28 : u32; - v180 = hir.bitcast v99 : u32; - v182 = arith.add v180, v181 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v184 = arith.mod v182, v979 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - v186 = hir.load v185 : i32; - v978 = arith.constant 12 : u32; - v187 = hir.bitcast v99 : u32; - v189 = arith.add v187, v978 : u32 #[overflow = checked]; + v137 = arith.constant 256 : i32; + v135 = arith.constant 20 : i32; + v136 = arith.add v99, v135 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v136, v137, v92, v139, v139) + v142 = arith.constant 24 : u32; + v141 = hir.bitcast v99 : u32; + v143 = arith.add v141, v142 : u32 #[overflow = checked]; + v978 = arith.constant 4 : u32; + v145 = arith.mod v143, v978 : u32; + hir.assertz v145 #[code = 250]; + v146 = hir.int_to_ptr v143 : ptr; + v147 = hir.load v146 : i32; + v149 = arith.constant 20 : u32; + v148 = hir.bitcast v99 : u32; + v150 = arith.add v148, v149 : u32 #[overflow = checked]; v977 = arith.constant 4 : u32; - v191 = arith.mod v189, v977 : u32; - hir.assertz v191 #[code = 250]; - v192 = hir.int_to_ptr v189 : ptr; - hir.store v192, v186; - v976 = arith.constant 8 : u32; - v193 = hir.bitcast v99 : u32; - v195 = arith.add v193, v976 : u32 #[overflow = checked]; - v975 = arith.constant 4 : u32; - v197 = arith.mod v195, v975 : u32; - hir.assertz v197 #[code = 250]; - v198 = hir.int_to_ptr v195 : ptr; - hir.store v198, v149; - v974 = arith.constant 8 : i32; - v200 = arith.add v99, v974 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v200, v127) - v973 = arith.constant 8 : i32; - v202 = arith.add v99, v973 : i32 #[overflow = wrapping]; + v152 = arith.mod v150, v977 : u32; + hir.assertz v152 #[code = 250]; + v153 = hir.int_to_ptr v150 : ptr; + v154 = hir.load v153 : i32; + v976 = arith.constant 0 : i32; + v155 = arith.constant 1 : i32; + v156 = arith.neq v154, v155 : i1; + v157 = arith.zext v156 : u32; + v158 = hir.bitcast v157 : i32; + v160 = arith.neq v158, v976 : i1; + cf.cond_br v160 ^block14, ^block15; + ^block14: + v975 = arith.constant 8 : i32; + v169 = arith.constant 8 : i32; + v170 = arith.add v99, v169 : i32 #[overflow = wrapping]; + v172 = arith.add v170, v975 : i32 #[overflow = wrapping]; + v174 = hir.bitcast v172 : u32; + v974 = arith.constant 4 : u32; + v176 = arith.mod v174, v974 : u32; + hir.assertz v176 #[code = 250]; + v973 = arith.constant 0 : i32; + v177 = hir.int_to_ptr v174 : ptr; + hir.store v177, v973; + v179 = arith.constant 28 : u32; + v178 = hir.bitcast v99 : u32; + v180 = arith.add v178, v179 : u32 #[overflow = checked]; + v972 = arith.constant 4 : u32; + v182 = arith.mod v180, v972 : u32; + hir.assertz v182 #[code = 250]; + v183 = hir.int_to_ptr v180 : ptr; + v184 = hir.load v183 : i32; + v971 = arith.constant 12 : u32; + v185 = hir.bitcast v99 : u32; + v187 = arith.add v185, v971 : u32 #[overflow = checked]; + v970 = arith.constant 4 : u32; + v189 = arith.mod v187, v970 : u32; + hir.assertz v189 #[code = 250]; + v190 = hir.int_to_ptr v187 : ptr; + hir.store v190, v184; + v969 = arith.constant 8 : u32; + v191 = hir.bitcast v99 : u32; + v193 = arith.add v191, v969 : u32 #[overflow = checked]; + v968 = arith.constant 4 : u32; + v195 = arith.mod v193, v968 : u32; + hir.assertz v195 #[code = 250]; + v196 = hir.int_to_ptr v193 : ptr; + hir.store v196, v147; + v967 = arith.constant 8 : i32; + v198 = arith.add v99, v967 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v198, v134) + v966 = arith.constant 8 : i32; + v200 = arith.add v99, v966 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v200, v129) + v965 = arith.constant 8 : i32; + v202 = arith.add v99, v965 : i32 #[overflow = wrapping]; hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v202, v122) - v972 = arith.constant 8 : i32; - v204 = arith.add v99, v972 : i32 #[overflow = wrapping]; + v964 = arith.constant 8 : i32; + v204 = arith.add v99, v964 : i32 #[overflow = wrapping]; hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v204, v115) - v971 = arith.constant 8 : i32; - v206 = arith.add v99, v971 : i32 #[overflow = wrapping]; + v963 = arith.constant 8 : i32; + v206 = arith.add v99, v963 : i32 #[overflow = wrapping]; hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v206, v108) - v970 = arith.constant 8 : i32; - v208 = arith.add v99, v970 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v208, v134) - v211 = hir.bitcast v174 : u32; - v969 = arith.constant 4 : u32; - v213 = arith.mod v211, v969 : u32; - hir.assertz v213 #[code = 250]; - v214 = hir.int_to_ptr v211 : ptr; - v215 = hir.load v214 : i32; - v968 = arith.constant 8 : i32; - v210 = arith.add v90, v968 : i32 #[overflow = wrapping]; - v216 = hir.bitcast v210 : u32; - v967 = arith.constant 4 : u32; - v218 = arith.mod v216, v967 : u32; - hir.assertz v218 #[code = 250]; - v219 = hir.int_to_ptr v216 : ptr; - hir.store v219, v215; - v966 = arith.constant 8 : u32; - v220 = hir.bitcast v99 : u32; - v222 = arith.add v220, v966 : u32 #[overflow = checked]; - v965 = arith.constant 4 : u32; - v224 = arith.mod v222, v965 : u32; - hir.assertz v224 #[code = 250]; - v225 = hir.int_to_ptr v222 : ptr; - v226 = hir.load v225 : i64; - v227 = hir.bitcast v90 : u32; - v964 = arith.constant 4 : u32; - v229 = arith.mod v227, v964 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - hir.store v230, v226; - v963 = arith.constant 32 : i32; - v232 = arith.add v99, v963 : i32 #[overflow = wrapping]; - v233 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v234 = hir.bitcast v233 : ptr; - hir.store v234, v232; + v209 = hir.bitcast v172 : u32; + v962 = arith.constant 4 : u32; + v211 = arith.mod v209, v962 : u32; + hir.assertz v211 #[code = 250]; + v212 = hir.int_to_ptr v209 : ptr; + v213 = hir.load v212 : i32; + v961 = arith.constant 8 : i32; + v208 = arith.add v90, v961 : i32 #[overflow = wrapping]; + v214 = hir.bitcast v208 : u32; + v960 = arith.constant 4 : u32; + v216 = arith.mod v214, v960 : u32; + hir.assertz v216 #[code = 250]; + v217 = hir.int_to_ptr v214 : ptr; + hir.store v217, v213; + v959 = arith.constant 8 : u32; + v218 = hir.bitcast v99 : u32; + v220 = arith.add v218, v959 : u32 #[overflow = checked]; + v958 = arith.constant 4 : u32; + v222 = arith.mod v220, v958 : u32; + hir.assertz v222 #[code = 250]; + v223 = hir.int_to_ptr v220 : ptr; + v224 = hir.load v223 : i64; + v225 = hir.bitcast v90 : u32; + v957 = arith.constant 4 : u32; + v227 = arith.mod v225, v957 : u32; + hir.assertz v227 #[code = 250]; + v228 = hir.int_to_ptr v225 : ptr; + hir.store v228, v224; + v956 = arith.constant 32 : i32; + v230 = arith.add v99, v956 : i32 #[overflow = wrapping]; + v231 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v232 = hir.bitcast v231 : ptr; + hir.store v232, v230; builtin.ret ; ^block15: - v962 = arith.constant 28 : u32; - v163 = hir.bitcast v99 : u32; - v165 = arith.add v163, v962 : u32 #[overflow = checked]; - v961 = arith.constant 4 : u32; - v167 = arith.mod v165, v961 : u32; - hir.assertz v167 #[code = 250]; - v168 = hir.int_to_ptr v165 : ptr; - v169 = hir.load v168 : i32; - v170 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::handle_error(v149, v169, v170) + v955 = arith.constant 28 : u32; + v161 = hir.bitcast v99 : u32; + v163 = arith.add v161, v955 : u32 #[overflow = checked]; + v954 = arith.constant 4 : u32; + v165 = arith.mod v163, v954 : u32; + hir.assertz v165 #[code = 250]; + v166 = hir.int_to_ptr v163 : ptr; + v167 = hir.load v166 : i32; + v168 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::handle_error(v147, v167, v168) ub.unreachable ; }; - private builtin.function @__rustc::__rust_alloc(v235: i32, v236: i32) -> i32 { - ^block16(v235: i32, v236: i32): - v238 = arith.constant 1048604 : i32; - v239 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v238, v236, v235) : i32 - builtin.ret v239; + private builtin.function @__rustc::__rust_alloc(v233: i32, v234: i32) -> i32 { + ^block16(v233: i32, v234: i32): + v236 = arith.constant 1048604 : i32; + v237 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v236, v234, v233) : i32 + builtin.ret v237; }; - private builtin.function @__rustc::__rust_realloc(v240: i32, v241: i32, v242: i32, v243: i32) -> i32 { - ^block18(v240: i32, v241: i32, v242: i32, v243: i32): - v245 = arith.constant 1048604 : i32; - v246 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v245, v242, v243) : i32 - v999 = arith.constant 0 : i32; - v247 = arith.constant 0 : i32; - v248 = arith.eq v246, v247 : i1; - v249 = arith.zext v248 : u32; - v250 = hir.bitcast v249 : i32; - v252 = arith.neq v250, v999 : i1; - scf.if v252{ + private builtin.function @__rustc::__rust_realloc(v238: i32, v239: i32, v240: i32, v241: i32) -> i32 { + ^block18(v238: i32, v239: i32, v240: i32, v241: i32): + v243 = arith.constant 1048604 : i32; + v244 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v243, v240, v241) : i32 + v992 = arith.constant 0 : i32; + v245 = arith.constant 0 : i32; + v246 = arith.eq v244, v245 : i1; + v247 = arith.zext v246 : u32; + v248 = hir.bitcast v247 : i32; + v250 = arith.neq v248, v992 : i1; + scf.if v250{ ^block20: scf.yield ; } else { ^block21: - v998 = arith.constant 0 : i32; - v254 = hir.bitcast v241 : u32; - v253 = hir.bitcast v243 : u32; - v255 = arith.lt v253, v254 : i1; - v256 = arith.zext v255 : u32; - v257 = hir.bitcast v256 : i32; - v259 = arith.neq v257, v998 : i1; - v260 = cf.select v259, v243, v241 : i32; - v996 = arith.constant 0 : i32; - v997 = arith.constant 0 : i32; - v262 = arith.eq v260, v997 : i1; - v263 = arith.zext v262 : u32; - v264 = hir.bitcast v263 : i32; - v266 = arith.neq v264, v996 : i1; - scf.if v266{ - ^block104: + v991 = arith.constant 0 : i32; + v252 = hir.bitcast v239 : u32; + v251 = hir.bitcast v241 : u32; + v253 = arith.lt v251, v252 : i1; + v254 = arith.zext v253 : u32; + v255 = hir.bitcast v254 : i32; + v257 = arith.neq v255, v991 : i1; + v258 = cf.select v257, v241, v239 : i32; + v989 = arith.constant 0 : i32; + v990 = arith.constant 0 : i32; + v260 = arith.eq v258, v990 : i1; + v261 = arith.zext v260 : u32; + v262 = hir.bitcast v261 : i32; + v264 = arith.neq v262, v989 : i1; + scf.if v264{ + ^block100: scf.yield ; } else { ^block22: - v267 = hir.bitcast v260 : u32; - v268 = hir.bitcast v246 : u32; + v265 = hir.bitcast v258 : u32; + v266 = hir.bitcast v244 : u32; + v267 = hir.int_to_ptr v266 : ptr; + v268 = hir.bitcast v238 : u32; v269 = hir.int_to_ptr v268 : ptr; - v270 = hir.bitcast v240 : u32; - v271 = hir.int_to_ptr v270 : ptr; - hir.mem_cpy v271, v269, v267; + hir.mem_cpy v269, v267, v265; scf.yield ; }; scf.yield ; }; - builtin.ret v246; + builtin.ret v244; }; - private builtin.function @__rustc::__rust_alloc_zeroed(v273: i32, v274: i32) -> i32 { - ^block23(v273: i32, v274: i32): - v276 = arith.constant 1048604 : i32; - v277 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v276, v274, v273) : i32 - v1008 = arith.constant 0 : i32; - v278 = arith.constant 0 : i32; - v279 = arith.eq v277, v278 : i1; - v280 = arith.zext v279 : u32; - v281 = hir.bitcast v280 : i32; - v283 = arith.neq v281, v1008 : i1; - scf.if v283{ + private builtin.function @__rustc::__rust_alloc_zeroed(v271: i32, v272: i32) -> i32 { + ^block23(v271: i32, v272: i32): + v274 = arith.constant 1048604 : i32; + v275 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v274, v272, v271) : i32 + v1001 = 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, v1001 : i1; + scf.if v281{ ^block25: scf.yield ; } else { ^block26: - v1006 = arith.constant 0 : i32; - v1007 = arith.constant 0 : i32; - v285 = arith.eq v273, v1007 : i1; - v286 = arith.zext v285 : u32; - v287 = hir.bitcast v286 : i32; - v289 = arith.neq v287, v1006 : i1; - scf.if v289{ - ^block107: + v999 = arith.constant 0 : i32; + v1000 = arith.constant 0 : i32; + v283 = arith.eq v271, v1000 : i1; + v284 = arith.zext v283 : u32; + v285 = hir.bitcast v284 : i32; + v287 = arith.neq v285, v999 : i1; + scf.if v287{ + ^block103: scf.yield ; } else { ^block27: - v1000 = arith.constant 0 : u8; - v292 = hir.bitcast v273 : u32; - v293 = hir.bitcast v277 : u32; - v294 = hir.int_to_ptr v293 : ptr; - hir.mem_set v294, v292, v1000; + v993 = arith.constant 0 : u8; + v290 = hir.bitcast v271 : u32; + v291 = hir.bitcast v275 : u32; + v292 = hir.int_to_ptr v291 : ptr; + hir.mem_set v292, v290, v993; scf.yield ; }; scf.yield ; }; - builtin.ret v277; + builtin.ret v275; }; private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { @@ -392,892 +389,880 @@ builtin.component root_ns:root@1.0.0 { builtin.ret ; }; - private builtin.function @::alloc(v296: i32, v297: i32, v298: i32) -> i32 { - ^block30(v296: i32, v297: i32, v298: i32): - v301 = arith.constant 16 : i32; - v300 = arith.constant 0 : i32; - v1010 = arith.constant 16 : u32; - v303 = hir.bitcast v297 : u32; - v305 = arith.gt v303, v1010 : i1; - v306 = arith.zext v305 : u32; - v307 = hir.bitcast v306 : i32; - v309 = arith.neq v307, v300 : i1; - v310 = cf.select v309, v297, v301 : i32; - v1050 = arith.constant 0 : i32; - v311 = arith.constant -1 : i32; - v312 = arith.add v310, v311 : i32 #[overflow = wrapping]; - v313 = arith.band v310, v312 : i32; - v315 = arith.neq v313, v1050 : i1; - v1019, v1020 = scf.if v315 : i32, u32 { - ^block112: - v1011 = arith.constant 0 : u32; - v1015 = ub.poison i32 : i32; - scf.yield v1015, v1011; + private builtin.function @::alloc(v294: i32, v295: i32, v296: i32) -> i32 { + ^block30(v294: i32, v295: i32, v296: i32): + v299 = arith.constant 16 : i32; + v298 = arith.constant 0 : i32; + v1003 = arith.constant 16 : u32; + v301 = hir.bitcast v295 : u32; + v303 = arith.gt v301, v1003 : i1; + v304 = arith.zext v303 : u32; + v305 = hir.bitcast v304 : i32; + v307 = arith.neq v305, v298 : i1; + v308 = cf.select v307, v295, v299 : i32; + v1043 = arith.constant 0 : i32; + v309 = arith.constant -1 : i32; + v310 = arith.add v308, v309 : i32 #[overflow = wrapping]; + v311 = arith.band v308, v310 : i32; + v313 = arith.neq v311, v1043 : i1; + v1012, v1013 = scf.if v313 : i32, u32 { + ^block108: + v1004 = arith.constant 0 : u32; + v1008 = ub.poison i32 : i32; + scf.yield v1008, v1004; } else { ^block33: - v317 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v297, v310) : i32 - v1049 = arith.constant 0 : i32; - v316 = arith.constant -2147483648 : i32; - v318 = arith.sub v316, v317 : i32 #[overflow = wrapping]; - v320 = hir.bitcast v318 : u32; - v319 = hir.bitcast v298 : u32; - v321 = arith.gt v319, v320 : i1; - v322 = arith.zext v321 : u32; - v323 = hir.bitcast v322 : i32; - v325 = arith.neq v323, v1049 : i1; - v1034 = scf.if v325 : i32 { - ^block111: - v1048 = ub.poison i32 : i32; - scf.yield v1048; + v315 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v295, v308) : i32 + v1042 = arith.constant 0 : i32; + v314 = arith.constant -2147483648 : i32; + v316 = arith.sub v314, v315 : i32 #[overflow = wrapping]; + v318 = hir.bitcast v316 : u32; + v317 = hir.bitcast v296 : u32; + v319 = arith.gt v317, v318 : i1; + v320 = arith.zext v319 : u32; + v321 = hir.bitcast v320 : i32; + v323 = arith.neq v321, v1042 : i1; + v1027 = scf.if v323 : i32 { + ^block107: + v1041 = ub.poison i32 : i32; + scf.yield v1041; } else { ^block34: - v1046 = arith.constant 0 : i32; - v331 = arith.sub v1046, v317 : i32 #[overflow = wrapping]; - v1047 = arith.constant -1 : i32; - v327 = arith.add v298, v317 : i32 #[overflow = wrapping]; - v329 = arith.add v327, v1047 : i32 #[overflow = wrapping]; - v332 = arith.band v329, v331 : i32; - v333 = hir.bitcast v296 : u32; - v334 = arith.constant 4 : u32; - v335 = arith.mod v333, v334 : u32; - hir.assertz v335 #[code = 250]; - v336 = hir.int_to_ptr v333 : ptr; - v337 = hir.load v336 : i32; - v1045 = arith.constant 0 : i32; - v339 = arith.neq v337, v1045 : i1; - scf.if v339{ - ^block110: + v1039 = arith.constant 0 : i32; + v329 = arith.sub v1039, v315 : i32 #[overflow = wrapping]; + v1040 = arith.constant -1 : i32; + v325 = arith.add v296, v315 : i32 #[overflow = wrapping]; + v327 = arith.add v325, v1040 : i32 #[overflow = wrapping]; + v330 = arith.band v327, v329 : i32; + v331 = hir.bitcast v294 : u32; + 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 : i32; + v1038 = arith.constant 0 : i32; + v337 = arith.neq v335, v1038 : i1; + scf.if v337{ + ^block106: scf.yield ; } else { ^block36: - v340 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 - v341 = hir.mem_size : u32; - v347 = hir.bitcast v296 : u32; - v1044 = arith.constant 4 : u32; - v349 = arith.mod v347, v1044 : u32; - hir.assertz v349 #[code = 250]; - v1043 = arith.constant 16 : u32; - v342 = hir.bitcast v341 : i32; - v345 = arith.shl v342, v1043 : i32; - v346 = arith.add v340, v345 : i32 #[overflow = wrapping]; - v350 = hir.int_to_ptr v347 : ptr; - hir.store v350, v346; + v338 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 + v339 = hir.mem_size : u32; + v345 = hir.bitcast v294 : u32; + v1037 = arith.constant 4 : u32; + v347 = arith.mod v345, v1037 : u32; + hir.assertz v347 #[code = 250]; + v1036 = arith.constant 16 : u32; + v340 = hir.bitcast v339 : i32; + v343 = arith.shl v340, v1036 : i32; + v344 = arith.add v338, v343 : i32 #[overflow = wrapping]; + v348 = hir.int_to_ptr v345 : ptr; + hir.store v348, v344; scf.yield ; }; - v353 = hir.bitcast v296 : u32; - v1042 = arith.constant 4 : u32; - v355 = arith.mod v353, v1042 : u32; - hir.assertz v355 #[code = 250]; - v356 = hir.int_to_ptr v353 : ptr; - v357 = hir.load v356 : i32; - v1040 = arith.constant 0 : i32; - v1041 = arith.constant -1 : i32; - v359 = arith.bxor v357, v1041 : i32; - v361 = hir.bitcast v359 : u32; - v360 = hir.bitcast v332 : u32; - v362 = arith.gt v360, v361 : i1; - v363 = arith.zext v362 : u32; - v364 = hir.bitcast v363 : i32; - v366 = arith.neq v364, v1040 : i1; - v1033 = scf.if v366 : i32 { + v351 = hir.bitcast v294 : u32; + v1035 = arith.constant 4 : u32; + v353 = arith.mod v351, v1035 : u32; + hir.assertz v353 #[code = 250]; + v354 = hir.int_to_ptr v351 : ptr; + v355 = hir.load v354 : i32; + v1033 = arith.constant 0 : i32; + v1034 = arith.constant -1 : i32; + v357 = arith.bxor v355, v1034 : i32; + v359 = hir.bitcast v357 : u32; + v358 = hir.bitcast v330 : u32; + v360 = arith.gt v358, v359 : i1; + v361 = arith.zext v360 : u32; + v362 = hir.bitcast v361 : i32; + v364 = arith.neq v362, v1033 : i1; + v1026 = scf.if v364 : i32 { ^block37: - v1039 = arith.constant 0 : i32; - scf.yield v1039; + v1032 = arith.constant 0 : i32; + scf.yield v1032; } else { ^block38: - v368 = hir.bitcast v296 : u32; - v1038 = arith.constant 4 : u32; - v370 = arith.mod v368, v1038 : u32; - hir.assertz v370 #[code = 250]; - v367 = arith.add v357, v332 : i32 #[overflow = wrapping]; - v371 = hir.int_to_ptr v368 : ptr; - hir.store v371, v367; - v373 = arith.add v357, v317 : i32 #[overflow = wrapping]; - scf.yield v373; + v366 = hir.bitcast v294 : u32; + v1031 = arith.constant 4 : u32; + v368 = arith.mod v366, v1031 : u32; + hir.assertz v368 #[code = 250]; + v365 = arith.add v355, v330 : i32 #[overflow = wrapping]; + v369 = hir.int_to_ptr v366 : ptr; + hir.store v369, v365; + v371 = arith.add v355, v315 : i32 #[overflow = wrapping]; + scf.yield v371; }; - scf.yield v1033; + scf.yield v1026; }; - v1016 = arith.constant 1 : u32; - v1037 = arith.constant 0 : u32; - v1035 = cf.select v325, v1037, v1016 : u32; - scf.yield v1034, v1035; + v1009 = arith.constant 1 : u32; + v1030 = arith.constant 0 : u32; + v1028 = cf.select v323, v1030, v1009 : u32; + scf.yield v1027, v1028; }; - v1036 = arith.constant 0 : u32; - v1032 = arith.eq v1020, v1036 : i1; - cf.cond_br v1032 ^block32, ^block114(v1019); + v1029 = arith.constant 0 : u32; + v1025 = arith.eq v1013, v1029 : i1; + cf.cond_br v1025 ^block32, ^block110(v1012); ^block32: ub.unreachable ; - ^block114(v1012: i32): - builtin.ret v1012; + ^block110(v1005: i32): + builtin.ret v1005; }; private builtin.function @intrinsics::mem::heap_base() -> i32 { ^block39: - v376 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v376; - }; - - private builtin.function @intrinsics::felt::from_u32(v378: i32) -> felt { - ^block43(v378: i32): - v379 = hir.bitcast v378 : felt; - builtin.ret v379; - }; - - private builtin.function @intrinsics::felt::assert_eq(v381: felt, v382: felt) { - ^block45(v381: felt, v382: felt): - hir.assert_eq v381, v382; - builtin.ret ; + v374 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v374; }; - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v383: i32, v384: i32, v385: i32, v386: i32, v387: i32, v388: i32) { - ^block47(v383: i32, v384: i32, v385: i32, v386: i32, v387: i32, v388: i32): - v391 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v392 = hir.bitcast v391 : ptr; - v393 = hir.load v392 : i32; - v394 = arith.constant 32 : i32; - v395 = arith.sub v393, v394 : i32 #[overflow = wrapping]; - v396 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v397 = hir.bitcast v396 : ptr; - hir.store v397, v395; - v1127 = arith.constant 0 : i32; - v389 = arith.constant 0 : i32; - v400 = arith.eq v388, v389 : i1; - v401 = arith.zext v400 : u32; - v402 = hir.bitcast v401 : i32; - v404 = arith.neq v402, v1127 : i1; - v1098, v1099 = scf.if v404 : i32, i32 { - ^block50: - v1126 = arith.constant 0 : i32; - scf.yield v1126, v1126; + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32, v381: i32) { + ^block43(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32, v381: i32): + v384 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v385 = hir.bitcast v384 : ptr; + v386 = hir.load v385 : i32; + v387 = arith.constant 32 : i32; + v388 = arith.sub v386, v387 : i32 #[overflow = wrapping]; + v389 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v390 = hir.bitcast v389 : ptr; + hir.store v390, v388; + v1120 = arith.constant 0 : i32; + v382 = arith.constant 0 : i32; + v393 = arith.eq v381, v382 : i1; + v394 = arith.zext v393 : u32; + v395 = hir.bitcast v394 : i32; + v397 = arith.neq v395, v1120 : i1; + v1091, v1092 = scf.if v397 : i32, i32 { + ^block46: + v1119 = arith.constant 0 : i32; + scf.yield v1119, v1119; } else { - ^block51: - v405 = arith.add v385, v386 : i32 #[overflow = wrapping]; - v1125 = arith.constant 0 : i32; - v407 = hir.bitcast v385 : u32; - v406 = hir.bitcast v405 : u32; - v408 = arith.lt v406, v407 : i1; - v409 = arith.zext v408 : u32; - v410 = hir.bitcast v409 : i32; - v412 = arith.neq v410, v1125 : i1; - v1096, v1097 = scf.if v412 : i32, i32 { - ^block120: - v1124 = arith.constant 0 : i32; - scf.yield v1124, v1124; + ^block47: + v398 = arith.add v378, v379 : i32 #[overflow = wrapping]; + v1118 = arith.constant 0 : i32; + v400 = hir.bitcast v378 : u32; + v399 = hir.bitcast v398 : u32; + v401 = arith.lt v399, v400 : i1; + v402 = arith.zext v401 : u32; + v403 = hir.bitcast v402 : i32; + v405 = arith.neq v403, v1118 : i1; + v1089, v1090 = scf.if v405 : i32, i32 { + ^block116: + v1117 = arith.constant 0 : i32; + scf.yield v1117, v1117; } else { - ^block52: - v423 = hir.bitcast v384 : u32; - v537 = arith.constant 4 : u32; - v425 = arith.mod v423, v537 : u32; - hir.assertz v425 #[code = 250]; - v426 = hir.int_to_ptr v423 : ptr; - v427 = hir.load v426 : i32; - v1052 = arith.constant 1 : u32; - v430 = arith.shl v427, v1052 : i32; - v1123 = arith.constant 0 : i32; - v432 = hir.bitcast v430 : u32; - v431 = hir.bitcast v405 : u32; - v433 = arith.gt v431, v432 : i1; - v434 = arith.zext v433 : u32; - v435 = hir.bitcast v434 : i32; - v437 = arith.neq v435, v1123 : i1; - v438 = cf.select v437, v405, v430 : i32; - v1120 = arith.constant 1 : i32; - v440 = arith.constant 4 : i32; - v1121 = arith.constant 0 : i32; - v1051 = arith.constant 1025 : u32; - v443 = hir.bitcast v388 : u32; - v445 = arith.lt v443, v1051 : i1; + ^block48: + v416 = hir.bitcast v377 : u32; + v530 = arith.constant 4 : u32; + v418 = arith.mod v416, v530 : u32; + hir.assertz v418 #[code = 250]; + v419 = hir.int_to_ptr v416 : ptr; + v420 = hir.load v419 : i32; + v1045 = arith.constant 1 : u32; + v423 = arith.shl v420, v1045 : i32; + v1116 = arith.constant 0 : i32; + v425 = hir.bitcast v423 : u32; + v424 = hir.bitcast v398 : u32; + v426 = arith.gt v424, v425 : i1; + v427 = arith.zext v426 : u32; + v428 = hir.bitcast v427 : i32; + v430 = arith.neq v428, v1116 : i1; + v431 = cf.select v430, v398, v423 : i32; + v1113 = arith.constant 1 : i32; + v433 = arith.constant 4 : i32; + v1114 = arith.constant 0 : i32; + v1044 = arith.constant 1025 : u32; + v436 = hir.bitcast v381 : u32; + v438 = arith.lt v436, v1044 : i1; + v439 = arith.zext v438 : u32; + v440 = hir.bitcast v439 : i32; + v442 = arith.neq v440, v1114 : i1; + v443 = cf.select v442, v433, v1113 : i32; + v432 = arith.constant 8 : i32; + v1115 = arith.constant 0 : i32; + v421 = arith.constant 1 : i32; + v445 = arith.eq v381, v421 : i1; v446 = arith.zext v445 : u32; v447 = hir.bitcast v446 : i32; - v449 = arith.neq v447, v1121 : i1; - v450 = cf.select v449, v440, v1120 : i32; - v439 = arith.constant 8 : i32; - v1122 = arith.constant 0 : i32; - v428 = arith.constant 1 : i32; - v452 = arith.eq v388, v428 : i1; - v453 = arith.zext v452 : u32; - v454 = hir.bitcast v453 : i32; - v456 = arith.neq v454, v1122 : i1; - v457 = cf.select v456, v439, v450 : i32; - v1119 = arith.constant 0 : i32; - v459 = hir.bitcast v457 : u32; - v458 = hir.bitcast v438 : u32; - v460 = arith.gt v458, v459 : i1; - v461 = arith.zext v460 : u32; - v462 = hir.bitcast v461 : i32; - v464 = arith.neq v462, v1119 : i1; - v465 = cf.select v464, v438, v457 : i32; - v466 = hir.bitcast v465 : u32; - v467 = arith.zext v466 : u64; - v468 = hir.bitcast v467 : i64; - v1118 = arith.constant 0 : i32; - v418 = arith.sub v1118, v387 : i32 #[overflow = wrapping]; - v415 = arith.constant -1 : i32; - v414 = arith.add v387, v388 : i32 #[overflow = wrapping]; - v416 = arith.add v414, v415 : i32 #[overflow = wrapping]; - v419 = arith.band v416, v418 : i32; - v420 = hir.bitcast v419 : u32; - v421 = arith.zext v420 : u64; - v422 = hir.bitcast v421 : i64; - v469 = arith.mul v422, v468 : i64 #[overflow = wrapping]; - v1117 = arith.constant 0 : i32; - v470 = arith.constant 32 : i64; - v472 = hir.cast v470 : u32; - v471 = hir.bitcast v469 : u64; - v473 = arith.shr v471, v472 : u64; - v474 = hir.bitcast v473 : i64; - v475 = arith.trunc v474 : i32; - v477 = arith.neq v475, v1117 : i1; - v1094, v1095 = scf.if v477 : i32, i32 { - ^block119: - v1116 = arith.constant 0 : i32; - scf.yield v438, v1116; + v449 = arith.neq v447, v1115 : i1; + v450 = cf.select v449, v432, v443 : i32; + v1112 = arith.constant 0 : i32; + v452 = hir.bitcast v450 : u32; + v451 = hir.bitcast v431 : u32; + v453 = arith.gt v451, v452 : i1; + v454 = arith.zext v453 : u32; + v455 = hir.bitcast v454 : i32; + v457 = arith.neq v455, v1112 : i1; + v458 = cf.select v457, v431, v450 : i32; + v459 = hir.bitcast v458 : u32; + v460 = arith.zext v459 : u64; + v461 = hir.bitcast v460 : i64; + v1111 = arith.constant 0 : i32; + v411 = arith.sub v1111, v380 : i32 #[overflow = wrapping]; + v408 = arith.constant -1 : i32; + v407 = arith.add v380, v381 : i32 #[overflow = wrapping]; + v409 = arith.add v407, v408 : i32 #[overflow = wrapping]; + v412 = arith.band v409, v411 : i32; + v413 = hir.bitcast v412 : u32; + v414 = arith.zext v413 : u64; + v415 = hir.bitcast v414 : i64; + v462 = arith.mul v415, v461 : i64 #[overflow = wrapping]; + v1110 = arith.constant 0 : i32; + v463 = arith.constant 32 : i64; + v465 = hir.cast v463 : u32; + v464 = hir.bitcast v462 : u64; + v466 = arith.shr v464, v465 : u64; + v467 = hir.bitcast v466 : i64; + v468 = arith.trunc v467 : i32; + v470 = arith.neq v468, v1110 : i1; + v1087, v1088 = scf.if v470 : i32, i32 { + ^block115: + v1109 = arith.constant 0 : i32; + scf.yield v431, v1109; } else { - ^block53: - v478 = arith.trunc v469 : i32; - v1115 = arith.constant 0 : i32; - v479 = arith.constant -2147483648 : i32; - v480 = arith.sub v479, v387 : i32 #[overflow = wrapping]; - v482 = hir.bitcast v480 : u32; - v481 = hir.bitcast v478 : u32; - v483 = arith.gt v481, v482 : i1; - v484 = arith.zext v483 : u32; - v485 = hir.bitcast v484 : i32; - v487 = arith.neq v485, v1115 : i1; - v1092, v1093 = scf.if v487 : i32, i32 { - ^block118: - v1114 = arith.constant 0 : i32; - scf.yield v438, v1114; + ^block49: + v471 = arith.trunc v462 : i32; + v1108 = arith.constant 0 : i32; + v472 = arith.constant -2147483648 : i32; + v473 = arith.sub v472, v380 : i32 #[overflow = wrapping]; + v475 = hir.bitcast v473 : u32; + v474 = hir.bitcast v471 : u32; + v476 = arith.gt v474, v475 : i1; + v477 = arith.zext v476 : u32; + v478 = hir.bitcast v477 : i32; + v480 = arith.neq v478, v1108 : i1; + v1085, v1086 = scf.if v480 : i32, i32 { + ^block114: + v1107 = arith.constant 0 : i32; + scf.yield v431, v1107; } else { - ^block54: - v488 = arith.constant 20 : i32; - v489 = arith.add v395, v488 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v489, v384, v387, v388) - v1112 = arith.constant 20 : i32; - v493 = arith.add v395, v1112 : i32 #[overflow = wrapping]; - v1113 = arith.constant 8 : i32; - v491 = arith.add v395, v1113 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v491, v387, v478, v493, v383) - v495 = arith.constant 12 : u32; - v494 = hir.bitcast v395 : u32; + ^block50: + v481 = arith.constant 20 : i32; + v482 = arith.add v388, v481 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v482, v377, v380, v381) + v1105 = arith.constant 20 : i32; + v486 = arith.add v388, v1105 : i32 #[overflow = wrapping]; + v1106 = arith.constant 8 : i32; + v484 = arith.add v388, v1106 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v484, v380, v471, v486, v376) + v488 = arith.constant 12 : u32; + v487 = hir.bitcast v388 : u32; + v489 = arith.add v487, v488 : u32 #[overflow = checked]; + v1104 = arith.constant 4 : u32; + v491 = arith.mod v489, v1104 : u32; + hir.assertz v491 #[code = 250]; + v492 = hir.int_to_ptr v489 : ptr; + v493 = hir.load v492 : i32; + v495 = arith.constant 8 : u32; + v494 = hir.bitcast v388 : u32; v496 = arith.add v494, v495 : u32 #[overflow = checked]; - v1111 = arith.constant 4 : u32; - v498 = arith.mod v496, v1111 : u32; + v1103 = arith.constant 4 : u32; + v498 = arith.mod v496, v1103 : u32; hir.assertz v498 #[code = 250]; v499 = hir.int_to_ptr v496 : ptr; v500 = hir.load v499 : i32; - v502 = arith.constant 8 : u32; - v501 = hir.bitcast v395 : u32; - v503 = arith.add v501, v502 : u32 #[overflow = checked]; - v1110 = arith.constant 4 : u32; - v505 = arith.mod v503, v1110 : u32; - hir.assertz v505 #[code = 250]; - v506 = hir.int_to_ptr v503 : ptr; - v507 = hir.load v506 : i32; - v1108 = arith.constant 0 : i32; - v1109 = arith.constant 0 : i32; - v509 = arith.eq v507, v1109 : i1; - v510 = arith.zext v509 : u32; - v511 = hir.bitcast v510 : i32; - v513 = arith.neq v511, v1108 : i1; - v1090 = scf.if v513 : i32 { - ^block55: - v521 = hir.bitcast v384 : u32; - v1107 = arith.constant 4 : u32; - v523 = arith.mod v521, v1107 : u32; - hir.assertz v523 #[code = 250]; - v524 = hir.int_to_ptr v521 : ptr; - hir.store v524, v465; - v1106 = arith.constant 4 : u32; - v525 = hir.bitcast v384 : u32; - v527 = arith.add v525, v1106 : u32 #[overflow = checked]; - v1105 = arith.constant 4 : u32; - v529 = arith.mod v527, v1105 : u32; - hir.assertz v529 #[code = 250]; - v530 = hir.int_to_ptr v527 : ptr; - hir.store v530, v500; - scf.yield v438; + v1101 = arith.constant 0 : i32; + v1102 = arith.constant 0 : i32; + v502 = arith.eq v500, v1102 : i1; + v503 = arith.zext v502 : u32; + v504 = hir.bitcast v503 : i32; + v506 = arith.neq v504, v1101 : i1; + v1083 = scf.if v506 : i32 { + ^block51: + v514 = hir.bitcast v377 : u32; + v1100 = arith.constant 4 : u32; + v516 = arith.mod v514, v1100 : u32; + hir.assertz v516 #[code = 250]; + v517 = hir.int_to_ptr v514 : ptr; + hir.store v517, v458; + v1099 = arith.constant 4 : u32; + v518 = hir.bitcast v377 : u32; + v520 = arith.add v518, v1099 : u32 #[overflow = checked]; + v1098 = arith.constant 4 : u32; + v522 = arith.mod v520, v1098 : u32; + hir.assertz v522 #[code = 250]; + v523 = hir.int_to_ptr v520 : ptr; + hir.store v523, v493; + scf.yield v431; } else { - ^block56: - v515 = arith.constant 16 : u32; - v514 = hir.bitcast v395 : u32; - v516 = arith.add v514, v515 : u32 #[overflow = checked]; - v1104 = arith.constant 4 : u32; - v518 = arith.mod v516, v1104 : u32; - hir.assertz v518 #[code = 250]; - v519 = hir.int_to_ptr v516 : ptr; - v520 = hir.load v519 : i32; - scf.yield v520; + ^block52: + v508 = arith.constant 16 : u32; + v507 = hir.bitcast v388 : u32; + v509 = arith.add v507, v508 : u32 #[overflow = checked]; + v1097 = arith.constant 4 : u32; + v511 = arith.mod v509, v1097 : u32; + hir.assertz v511 #[code = 250]; + v512 = hir.int_to_ptr v509 : ptr; + v513 = hir.load v512 : i32; + scf.yield v513; }; - v531 = arith.constant -2147483647 : i32; - v1091 = cf.select v513, v531, v500 : i32; - scf.yield v1090, v1091; + v524 = arith.constant -2147483647 : i32; + v1084 = cf.select v506, v524, v493 : i32; + scf.yield v1083, v1084; }; - scf.yield v1092, v1093; + scf.yield v1085, v1086; }; - scf.yield v1094, v1095; + scf.yield v1087, v1088; }; - scf.yield v1096, v1097; + scf.yield v1089, v1090; }; - v1103 = arith.constant 4 : u32; - v536 = hir.bitcast v383 : u32; - v538 = arith.add v536, v1103 : u32 #[overflow = checked]; - v1102 = arith.constant 4 : u32; - v540 = arith.mod v538, v1102 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - hir.store v541, v1098; - v544 = hir.bitcast v383 : u32; - v1101 = arith.constant 4 : u32; - v546 = arith.mod v544, v1101 : u32; - hir.assertz v546 #[code = 250]; - v547 = hir.int_to_ptr v544 : ptr; - hir.store v547, v1099; - v1100 = arith.constant 32 : i32; - v551 = arith.add v395, v1100 : i32 #[overflow = wrapping]; - v552 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v553 = hir.bitcast v552 : ptr; - hir.store v553, v551; + v1096 = arith.constant 4 : u32; + v529 = hir.bitcast v376 : u32; + v531 = arith.add v529, v1096 : u32 #[overflow = checked]; + v1095 = arith.constant 4 : u32; + v533 = arith.mod v531, v1095 : u32; + hir.assertz v533 #[code = 250]; + v534 = hir.int_to_ptr v531 : ptr; + hir.store v534, v1091; + v537 = hir.bitcast v376 : u32; + v1094 = arith.constant 4 : u32; + v539 = arith.mod v537, v1094 : u32; + hir.assertz v539 #[code = 250]; + v540 = hir.int_to_ptr v537 : ptr; + hir.store v540, v1092; + v1093 = arith.constant 32 : i32; + v544 = arith.add v388, v1093 : i32 #[overflow = wrapping]; + v545 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v546 = hir.bitcast v545 : ptr; + hir.store v546, v544; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v554: i32, v555: i32, v556: i32, v557: i32, v558: i32) { - ^block57(v554: i32, v555: i32, v556: i32, v557: i32, v558: i32): - v561 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v562 = hir.bitcast v561 : ptr; - v563 = hir.load v562 : i32; - v564 = arith.constant 16 : i32; - v565 = arith.sub v563, v564 : i32 #[overflow = wrapping]; - v566 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v567 = hir.bitcast v566 : ptr; - hir.store v567, v565; - v577 = hir.bitcast v555 : u32; - v578 = arith.zext v577 : u64; - v579 = hir.bitcast v578 : i64; - v559 = arith.constant 0 : i32; - v572 = arith.sub v559, v557 : i32 #[overflow = wrapping]; - v569 = arith.constant -1 : i32; - v568 = arith.add v557, v558 : i32 #[overflow = wrapping]; - v570 = arith.add v568, v569 : i32 #[overflow = wrapping]; - v573 = arith.band v570, v572 : i32; - v574 = hir.bitcast v573 : u32; - v575 = arith.zext v574 : u64; - v576 = hir.bitcast v575 : i64; - v580 = arith.mul v576, v579 : i64 #[overflow = wrapping]; - v1231 = arith.constant 0 : i32; - v581 = arith.constant 32 : i64; - v583 = hir.cast v581 : u32; - v582 = hir.bitcast v580 : u64; - v584 = arith.shr v582, v583 : u64; - v585 = hir.bitcast v584 : i64; - v586 = arith.trunc v585 : i32; - v588 = arith.neq v586, v1231 : i1; - v1143, v1144, v1145, v1146, v1147, v1148 = scf.if v588 : i32, i32, i32, i32, i32, u32 { - ^block126: - v1128 = arith.constant 0 : u32; - v1135 = ub.poison i32 : i32; - scf.yield v554, v565, v1135, v1135, v1135, v1128; + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v547: i32, v548: i32, v549: i32, v550: i32, v551: i32) { + ^block53(v547: i32, v548: i32, v549: i32, v550: i32, v551: i32): + v554 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v555 = hir.bitcast v554 : ptr; + v556 = hir.load v555 : i32; + v557 = arith.constant 16 : i32; + v558 = arith.sub v556, v557 : i32 #[overflow = wrapping]; + v559 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v560 = hir.bitcast v559 : ptr; + hir.store v560, v558; + v570 = hir.bitcast v548 : u32; + v571 = arith.zext v570 : u64; + v572 = hir.bitcast v571 : i64; + v552 = arith.constant 0 : i32; + v565 = arith.sub v552, v550 : i32 #[overflow = wrapping]; + v562 = arith.constant -1 : i32; + v561 = arith.add v550, v551 : i32 #[overflow = wrapping]; + v563 = arith.add v561, v562 : i32 #[overflow = wrapping]; + v566 = arith.band v563, v565 : i32; + v567 = hir.bitcast v566 : u32; + v568 = arith.zext v567 : u64; + v569 = hir.bitcast v568 : i64; + v573 = arith.mul v569, v572 : i64 #[overflow = wrapping]; + v1224 = arith.constant 0 : i32; + v574 = arith.constant 32 : i64; + v576 = hir.cast v574 : u32; + v575 = hir.bitcast v573 : u64; + v577 = arith.shr v575, v576 : u64; + v578 = hir.bitcast v577 : i64; + v579 = arith.trunc v578 : i32; + v581 = arith.neq v579, v1224 : i1; + v1136, v1137, v1138, v1139, v1140, v1141 = scf.if v581 : i32, i32, i32, i32, i32, u32 { + ^block122: + v1121 = arith.constant 0 : u32; + v1128 = ub.poison i32 : i32; + scf.yield v547, v558, v1128, v1128, v1128, v1121; } else { - ^block62: - v589 = arith.trunc v580 : i32; - v1230 = arith.constant 0 : i32; - v590 = arith.constant -2147483648 : i32; - v591 = arith.sub v590, v557 : i32 #[overflow = wrapping]; - v593 = hir.bitcast v591 : u32; - v592 = hir.bitcast v589 : u32; - v594 = arith.lte v592, v593 : i1; - v595 = arith.zext v594 : u32; - v596 = hir.bitcast v595 : i32; - v598 = arith.neq v596, v1230 : i1; - v1191 = scf.if v598 : i32 { - ^block60: - v1229 = arith.constant 0 : i32; - v609 = arith.neq v589, v1229 : i1; - v1190 = scf.if v609 : i32 { - ^block64: - v1228 = arith.constant 0 : i32; - v625 = arith.neq v556, v1228 : i1; - v1189 = scf.if v625 : i32 { - ^block67: - v607 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v565, v557, v589, v607) - v636 = hir.bitcast v565 : u32; - v681 = arith.constant 4 : u32; - v638 = arith.mod v636, v681 : u32; - hir.assertz v638 #[code = 250]; - v639 = hir.int_to_ptr v636 : ptr; - v640 = hir.load v639 : i32; - scf.yield v640; + ^block58: + v582 = arith.trunc v573 : i32; + v1223 = arith.constant 0 : i32; + v583 = arith.constant -2147483648 : i32; + v584 = arith.sub v583, v550 : i32 #[overflow = wrapping]; + v586 = hir.bitcast v584 : u32; + v585 = hir.bitcast v582 : u32; + v587 = arith.lte v585, v586 : i1; + v588 = arith.zext v587 : u32; + v589 = hir.bitcast v588 : i32; + v591 = arith.neq v589, v1223 : i1; + v1184 = scf.if v591 : i32 { + ^block56: + v1222 = arith.constant 0 : i32; + v602 = arith.neq v582, v1222 : i1; + v1183 = scf.if v602 : i32 { + ^block60: + v1221 = arith.constant 0 : i32; + v618 = arith.neq v549, v1221 : i1; + v1182 = scf.if v618 : i32 { + ^block63: + v600 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v558, v550, v582, v600) + v629 = hir.bitcast v558 : u32; + v674 = arith.constant 4 : u32; + v631 = arith.mod v629, v674 : u32; + hir.assertz v631 #[code = 250]; + v632 = hir.int_to_ptr v629 : ptr; + v633 = hir.load v632 : i32; + scf.yield v633; } else { - ^block68: - v626 = arith.constant 8 : i32; - v627 = arith.add v565, v626 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v627, v557, v589) - v611 = arith.constant 8 : u32; - v628 = hir.bitcast v565 : u32; - v630 = arith.add v628, v611 : u32 #[overflow = checked]; - v1227 = arith.constant 4 : u32; - v632 = arith.mod v630, v1227 : u32; - hir.assertz v632 #[code = 250]; - v633 = hir.int_to_ptr v630 : ptr; - v634 = hir.load v633 : i32; - scf.yield v634; + ^block64: + v619 = arith.constant 8 : i32; + v620 = arith.add v558, v619 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v620, v550, v582) + v604 = arith.constant 8 : u32; + v621 = hir.bitcast v558 : u32; + v623 = arith.add v621, v604 : u32 #[overflow = checked]; + v1220 = arith.constant 4 : u32; + v625 = arith.mod v623, v1220 : u32; + hir.assertz v625 #[code = 250]; + v626 = hir.int_to_ptr v623 : ptr; + v627 = hir.load v626 : i32; + scf.yield v627; }; - v1225 = arith.constant 0 : i32; - v1226 = arith.constant 0 : i32; - v643 = arith.eq v1189, v1226 : i1; - v644 = arith.zext v643 : u32; - v645 = hir.bitcast v644 : i32; - v647 = arith.neq v645, v1225 : i1; - scf.if v647{ - ^block69: - v1224 = arith.constant 8 : u32; - v664 = hir.bitcast v554 : u32; - v666 = arith.add v664, v1224 : u32 #[overflow = checked]; - v1223 = arith.constant 4 : u32; - v668 = arith.mod v666, v1223 : u32; + v1218 = arith.constant 0 : i32; + v1219 = arith.constant 0 : i32; + v636 = arith.eq v1182, v1219 : i1; + v637 = arith.zext v636 : u32; + v638 = hir.bitcast v637 : i32; + v640 = arith.neq v638, v1218 : i1; + scf.if v640{ + ^block65: + v1217 = arith.constant 8 : u32; + v657 = hir.bitcast v547 : u32; + v659 = arith.add v657, v1217 : u32 #[overflow = checked]; + v1216 = arith.constant 4 : u32; + v661 = arith.mod v659, v1216 : u32; + hir.assertz v661 #[code = 250]; + v662 = hir.int_to_ptr v659 : ptr; + hir.store v662, v582; + v1215 = arith.constant 4 : u32; + v664 = hir.bitcast v547 : u32; + v666 = arith.add v664, v1215 : u32 #[overflow = checked]; + v1214 = arith.constant 4 : u32; + v668 = arith.mod v666, v1214 : u32; hir.assertz v668 #[code = 250]; v669 = hir.int_to_ptr v666 : ptr; - hir.store v669, v589; - v1222 = arith.constant 4 : u32; - v671 = hir.bitcast v554 : u32; - v673 = arith.add v671, v1222 : u32 #[overflow = checked]; - v1221 = arith.constant 4 : u32; - v675 = arith.mod v673, v1221 : u32; - hir.assertz v675 #[code = 250]; - v676 = hir.int_to_ptr v673 : ptr; - hir.store v676, v557; + hir.store v669, v550; scf.yield ; } else { - ^block70: - v1220 = arith.constant 8 : u32; - v649 = hir.bitcast v554 : u32; - v651 = arith.add v649, v1220 : u32 #[overflow = checked]; - v1219 = arith.constant 4 : u32; - v653 = arith.mod v651, v1219 : u32; + ^block66: + v1213 = arith.constant 8 : u32; + v642 = hir.bitcast v547 : u32; + v644 = arith.add v642, v1213 : u32 #[overflow = checked]; + v1212 = arith.constant 4 : u32; + v646 = arith.mod v644, v1212 : u32; + hir.assertz v646 #[code = 250]; + v647 = hir.int_to_ptr v644 : ptr; + hir.store v647, v1182; + v1211 = arith.constant 4 : u32; + v649 = hir.bitcast v547 : u32; + v651 = arith.add v649, v1211 : u32 #[overflow = checked]; + v1210 = arith.constant 4 : u32; + v653 = arith.mod v651, v1210 : u32; hir.assertz v653 #[code = 250]; v654 = hir.int_to_ptr v651 : ptr; - hir.store v654, v1189; - v1218 = arith.constant 4 : u32; - v656 = hir.bitcast v554 : u32; - v658 = arith.add v656, v1218 : u32 #[overflow = checked]; - v1217 = arith.constant 4 : u32; - v660 = arith.mod v658, v1217 : u32; - hir.assertz v660 #[code = 250]; - v661 = hir.int_to_ptr v658 : ptr; - hir.store v661, v555; + hir.store v654, v548; scf.yield ; }; - v1215 = arith.constant 0 : i32; - v1216 = arith.constant 1 : i32; - v1188 = cf.select v647, v1216, v1215 : i32; - scf.yield v1188; + v1208 = arith.constant 0 : i32; + v1209 = arith.constant 1 : i32; + v1181 = cf.select v640, v1209, v1208 : i32; + scf.yield v1181; } else { - ^block65: - v1214 = arith.constant 8 : u32; - v610 = hir.bitcast v554 : u32; - v612 = arith.add v610, v1214 : u32 #[overflow = checked]; - v1213 = arith.constant 4 : u32; - v614 = arith.mod v612, v1213 : u32; - hir.assertz v614 #[code = 250]; - v615 = hir.int_to_ptr v612 : ptr; - hir.store v615, v557; - v1212 = arith.constant 4 : u32; - v618 = hir.bitcast v554 : u32; - v620 = arith.add v618, v1212 : u32 #[overflow = checked]; - v1211 = arith.constant 4 : u32; - v622 = arith.mod v620, v1211 : u32; - hir.assertz v622 #[code = 250]; - v1210 = arith.constant 0 : i32; - v623 = hir.int_to_ptr v620 : ptr; - hir.store v623, v1210; - v1209 = arith.constant 0 : i32; - scf.yield v1209; + ^block61: + v1207 = arith.constant 8 : u32; + v603 = hir.bitcast v547 : u32; + v605 = arith.add v603, v1207 : u32 #[overflow = checked]; + v1206 = arith.constant 4 : u32; + v607 = arith.mod v605, v1206 : u32; + hir.assertz v607 #[code = 250]; + v608 = hir.int_to_ptr v605 : ptr; + hir.store v608, v550; + v1205 = arith.constant 4 : u32; + v611 = hir.bitcast v547 : u32; + v613 = arith.add v611, v1205 : u32 #[overflow = checked]; + v1204 = arith.constant 4 : u32; + v615 = arith.mod v613, v1204 : u32; + hir.assertz v615 #[code = 250]; + v1203 = arith.constant 0 : i32; + v616 = hir.int_to_ptr v613 : ptr; + hir.store v616, v1203; + v1202 = arith.constant 0 : i32; + scf.yield v1202; }; - scf.yield v1190; + scf.yield v1183; } else { - ^block63: - v1208 = ub.poison i32 : i32; - scf.yield v1208; + ^block59: + v1201 = ub.poison i32 : i32; + scf.yield v1201; }; - v1203 = arith.constant 0 : u32; - v1136 = arith.constant 1 : u32; - v1196 = cf.select v598, v1136, v1203 : u32; - v1204 = ub.poison i32 : i32; - v1195 = cf.select v598, v565, v1204 : i32; - v1205 = ub.poison i32 : i32; - v1194 = cf.select v598, v554, v1205 : i32; - v1206 = ub.poison i32 : i32; - v1193 = cf.select v598, v1206, v565 : i32; - v1207 = ub.poison i32 : i32; - v1192 = cf.select v598, v1207, v554 : i32; - scf.yield v1192, v1193, v1194, v1191, v1195, v1196; + v1196 = arith.constant 0 : u32; + v1129 = arith.constant 1 : u32; + v1189 = cf.select v591, v1129, v1196 : u32; + v1197 = ub.poison i32 : i32; + v1188 = cf.select v591, v558, v1197 : i32; + v1198 = ub.poison i32 : i32; + v1187 = cf.select v591, v547, v1198 : i32; + v1199 = ub.poison i32 : i32; + v1186 = cf.select v591, v1199, v558 : i32; + v1200 = ub.poison i32 : i32; + v1185 = cf.select v591, v1200, v547 : i32; + scf.yield v1185, v1186, v1187, v1184, v1188, v1189; }; - v1149, v1150, v1151 = scf.index_switch v1148 : i32, i32, i32 + v1142, v1143, v1144 = scf.index_switch v1141 : i32, i32, i32 case 0 { - ^block61: - v1202 = arith.constant 4 : u32; - v601 = hir.bitcast v1143 : u32; - v603 = arith.add v601, v1202 : u32 #[overflow = checked]; - v1201 = arith.constant 4 : u32; - v605 = arith.mod v603, v1201 : u32; - hir.assertz v605 #[code = 250]; - v1200 = arith.constant 0 : i32; - v606 = hir.int_to_ptr v603 : ptr; - hir.store v606, v1200; - v1199 = arith.constant 1 : i32; - scf.yield v1143, v1199, v1144; + ^block57: + v1195 = arith.constant 4 : u32; + v594 = hir.bitcast v1136 : u32; + v596 = arith.add v594, v1195 : u32 #[overflow = checked]; + v1194 = arith.constant 4 : u32; + v598 = arith.mod v596, v1194 : u32; + hir.assertz v598 #[code = 250]; + v1193 = arith.constant 0 : i32; + v599 = hir.int_to_ptr v596 : ptr; + hir.store v599, v1193; + v1192 = arith.constant 1 : i32; + scf.yield v1136, v1192, v1137; } default { - ^block130: - scf.yield v1145, v1146, v1147; + ^block126: + scf.yield v1138, v1139, v1140; }; - v680 = hir.bitcast v1149 : u32; - v1198 = arith.constant 4 : u32; - v682 = arith.mod v680, v1198 : u32; - hir.assertz v682 #[code = 250]; - v683 = hir.int_to_ptr v680 : ptr; - hir.store v683, v1150; - v1197 = arith.constant 16 : i32; - v688 = arith.add v1151, v1197 : i32 #[overflow = wrapping]; - v689 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v690 = hir.bitcast v689 : ptr; - hir.store v690, v688; + v673 = hir.bitcast v1142 : u32; + v1191 = arith.constant 4 : u32; + v675 = arith.mod v673, v1191 : u32; + hir.assertz v675 #[code = 250]; + v676 = hir.int_to_ptr v673 : ptr; + hir.store v676, v1143; + v1190 = arith.constant 16 : i32; + v681 = arith.add v1144, v1190 : i32 #[overflow = wrapping]; + v682 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v683 = hir.bitcast v682 : ptr; + hir.store v683, v681; builtin.ret ; }; - private builtin.function @::allocate(v691: i32, v692: i32, v693: i32) { - ^block71(v691: i32, v692: i32, v693: i32): - v695 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v696 = hir.bitcast v695 : ptr; - v697 = hir.load v696 : i32; - v698 = arith.constant 16 : i32; - v699 = arith.sub v697, v698 : i32 #[overflow = wrapping]; - v700 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v701 = hir.bitcast v700 : ptr; - hir.store v701, v699; - v694 = arith.constant 0 : i32; - v702 = arith.constant 8 : i32; - v703 = arith.add v699, v702 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v703, v692, v693, v694) - v706 = arith.constant 12 : u32; - v705 = hir.bitcast v699 : u32; + private builtin.function @::allocate(v684: i32, v685: i32, v686: i32) { + ^block67(v684: i32, v685: i32, v686: i32): + v688 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v689 = hir.bitcast v688 : ptr; + v690 = hir.load v689 : i32; + v691 = arith.constant 16 : i32; + v692 = arith.sub v690, v691 : i32 #[overflow = wrapping]; + v693 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v694 = hir.bitcast v693 : ptr; + hir.store v694, v692; + v687 = arith.constant 0 : i32; + v695 = arith.constant 8 : i32; + v696 = arith.add v692, v695 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v696, v685, v686, v687) + v699 = arith.constant 12 : u32; + v698 = hir.bitcast v692 : u32; + v700 = arith.add v698, v699 : u32 #[overflow = checked]; + v701 = arith.constant 4 : u32; + v702 = arith.mod v700, v701 : u32; + hir.assertz v702 #[code = 250]; + v703 = hir.int_to_ptr v700 : ptr; + v704 = hir.load v703 : i32; + v706 = arith.constant 8 : u32; + v705 = hir.bitcast v692 : u32; v707 = arith.add v705, v706 : u32 #[overflow = checked]; - v708 = arith.constant 4 : u32; - v709 = arith.mod v707, v708 : u32; + v1229 = arith.constant 4 : u32; + v709 = arith.mod v707, v1229 : u32; hir.assertz v709 #[code = 250]; v710 = hir.int_to_ptr v707 : ptr; v711 = hir.load v710 : i32; - v713 = arith.constant 8 : u32; - v712 = hir.bitcast v699 : u32; - v714 = arith.add v712, v713 : u32 #[overflow = checked]; - v1236 = arith.constant 4 : u32; - v716 = arith.mod v714, v1236 : u32; - hir.assertz v716 #[code = 250]; - v717 = hir.int_to_ptr v714 : ptr; - v718 = hir.load v717 : i32; - v719 = hir.bitcast v691 : u32; - v1235 = arith.constant 4 : u32; - v721 = arith.mod v719, v1235 : u32; - hir.assertz v721 #[code = 250]; - v722 = hir.int_to_ptr v719 : ptr; - hir.store v722, v718; - v1234 = arith.constant 4 : u32; - v723 = hir.bitcast v691 : u32; - v725 = arith.add v723, v1234 : u32 #[overflow = checked]; - v1233 = arith.constant 4 : u32; - v727 = arith.mod v725, v1233 : u32; - hir.assertz v727 #[code = 250]; - v728 = hir.int_to_ptr v725 : ptr; - hir.store v728, v711; - v1232 = arith.constant 16 : i32; - v730 = arith.add v699, v1232 : i32 #[overflow = wrapping]; - v731 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v732 = hir.bitcast v731 : ptr; - hir.store v732, v730; + v712 = hir.bitcast v684 : u32; + v1228 = arith.constant 4 : u32; + v714 = arith.mod v712, v1228 : u32; + hir.assertz v714 #[code = 250]; + v715 = hir.int_to_ptr v712 : ptr; + hir.store v715, v711; + v1227 = arith.constant 4 : u32; + v716 = hir.bitcast v684 : u32; + v718 = arith.add v716, v1227 : u32 #[overflow = checked]; + v1226 = arith.constant 4 : u32; + v720 = arith.mod v718, v1226 : u32; + hir.assertz v720 #[code = 250]; + v721 = hir.int_to_ptr v718 : ptr; + hir.store v721, v704; + v1225 = arith.constant 16 : i32; + v723 = arith.add v692, v1225 : i32 #[overflow = wrapping]; + v724 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v725 = hir.bitcast v724 : ptr; + hir.store v725, v723; builtin.ret ; }; - private builtin.function @alloc::alloc::Global::alloc_impl(v733: i32, v734: i32, v735: i32, v736: i32) { - ^block73(v733: i32, v734: i32, v735: i32, v736: i32): - v1252 = arith.constant 0 : i32; - v737 = arith.constant 0 : i32; - v738 = arith.eq v735, v737 : i1; - v739 = arith.zext v738 : u32; - v740 = hir.bitcast v739 : i32; - v742 = arith.neq v740, v1252 : i1; - v1248 = scf.if v742 : i32 { - ^block133: - scf.yield v734; + private builtin.function @alloc::alloc::Global::alloc_impl(v726: i32, v727: i32, v728: i32, v729: i32) { + ^block69(v726: i32, v727: i32, v728: i32, v729: i32): + v1245 = arith.constant 0 : i32; + v730 = arith.constant 0 : i32; + v731 = arith.eq v728, v730 : i1; + v732 = arith.zext v731 : u32; + v733 = hir.bitcast v732 : i32; + v735 = arith.neq v733, v1245 : i1; + v1241 = scf.if v735 : i32 { + ^block129: + scf.yield v727; } else { - ^block76: + ^block72: hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1251 = arith.constant 0 : i32; - v744 = arith.neq v736, v1251 : i1; - v1247 = scf.if v744 : i32 { - ^block77: - v746 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v735, v734) : i32 - scf.yield v746; + v1244 = arith.constant 0 : i32; + v737 = arith.neq v729, v1244 : i1; + v1240 = scf.if v737 : i32 { + ^block73: + v739 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v728, v727) : i32 + scf.yield v739; } else { - ^block78: - v745 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v735, v734) : i32 - scf.yield v745; + ^block74: + v738 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v728, v727) : i32 + scf.yield v738; }; - scf.yield v1247; + scf.yield v1240; }; - v750 = arith.constant 4 : u32; - v749 = hir.bitcast v733 : u32; - v751 = arith.add v749, v750 : u32 #[overflow = checked]; - v1250 = arith.constant 4 : u32; - v753 = arith.mod v751, v1250 : u32; - hir.assertz v753 #[code = 250]; - v754 = hir.int_to_ptr v751 : ptr; - hir.store v754, v735; - v756 = hir.bitcast v733 : u32; - v1249 = arith.constant 4 : u32; - v758 = arith.mod v756, v1249 : u32; - hir.assertz v758 #[code = 250]; - v759 = hir.int_to_ptr v756 : ptr; - hir.store v759, v1248; + v743 = arith.constant 4 : u32; + v742 = hir.bitcast v726 : u32; + v744 = arith.add v742, v743 : u32 #[overflow = checked]; + v1243 = arith.constant 4 : u32; + v746 = arith.mod v744, v1243 : u32; + hir.assertz v746 #[code = 250]; + v747 = hir.int_to_ptr v744 : ptr; + hir.store v747, v728; + v749 = hir.bitcast v726 : u32; + v1242 = arith.constant 4 : u32; + v751 = arith.mod v749, v1242 : u32; + hir.assertz v751 #[code = 250]; + v752 = hir.int_to_ptr v749 : ptr; + hir.store v752, v1241; builtin.ret ; }; - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v760: i32, v761: i32, v762: i32, v763: i32) { - ^block79(v760: i32, v761: i32, v762: i32, v763: i32): - v1278 = arith.constant 0 : i32; - v764 = arith.constant 0 : i32; - v768 = arith.eq v763, v764 : i1; - v769 = arith.zext v768 : u32; - v770 = hir.bitcast v769 : i32; - v772 = arith.neq v770, v1278 : i1; - v1265, v1266 = scf.if v772 : i32, i32 { - ^block137: - v1277 = arith.constant 0 : i32; - v766 = arith.constant 4 : i32; - scf.yield v766, v1277; + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v753: i32, v754: i32, v755: i32, v756: i32) { + ^block75(v753: i32, v754: i32, v755: i32, v756: i32): + v1271 = arith.constant 0 : i32; + v757 = arith.constant 0 : i32; + v761 = arith.eq v756, v757 : i1; + v762 = arith.zext v761 : u32; + v763 = hir.bitcast v762 : i32; + v765 = arith.neq v763, v1271 : i1; + v1258, v1259 = scf.if v765 : i32, i32 { + ^block133: + v1270 = arith.constant 0 : i32; + v759 = arith.constant 4 : i32; + scf.yield v759, v1270; } else { - ^block82: - v773 = hir.bitcast v761 : u32; - v808 = arith.constant 4 : u32; - v775 = arith.mod v773, v808 : u32; - hir.assertz v775 #[code = 250]; - v776 = hir.int_to_ptr v773 : ptr; - v777 = hir.load v776 : i32; - v1275 = arith.constant 0 : i32; - v1276 = arith.constant 0 : i32; - v779 = arith.eq v777, v1276 : i1; - v780 = arith.zext v779 : u32; - v781 = hir.bitcast v780 : i32; - v783 = arith.neq v781, v1275 : i1; - v1263 = scf.if v783 : i32 { - ^block136: - v1274 = arith.constant 0 : i32; - scf.yield v1274; + ^block78: + v766 = hir.bitcast v754 : u32; + v801 = arith.constant 4 : u32; + v768 = arith.mod v766, v801 : u32; + hir.assertz v768 #[code = 250]; + v769 = hir.int_to_ptr v766 : ptr; + v770 = hir.load v769 : i32; + v1268 = arith.constant 0 : i32; + v1269 = arith.constant 0 : i32; + v772 = arith.eq v770, v1269 : i1; + v773 = arith.zext v772 : u32; + v774 = hir.bitcast v773 : i32; + v776 = arith.neq v774, v1268 : i1; + v1256 = scf.if v776 : i32 { + ^block132: + v1267 = arith.constant 0 : i32; + scf.yield v1267; } else { - ^block83: - v1273 = arith.constant 4 : u32; - v784 = hir.bitcast v760 : u32; - v786 = arith.add v784, v1273 : u32 #[overflow = checked]; - v1272 = arith.constant 4 : u32; - v788 = arith.mod v786, v1272 : u32; - hir.assertz v788 #[code = 250]; - v789 = hir.int_to_ptr v786 : ptr; - hir.store v789, v762; - v1271 = arith.constant 4 : u32; - v790 = hir.bitcast v761 : u32; - v792 = arith.add v790, v1271 : u32 #[overflow = checked]; - v1270 = arith.constant 4 : u32; - v794 = arith.mod v792, v1270 : u32; - hir.assertz v794 #[code = 250]; - v795 = hir.int_to_ptr v792 : ptr; - v796 = hir.load v795 : i32; - v797 = hir.bitcast v760 : u32; - v1269 = arith.constant 4 : u32; - v799 = arith.mod v797, v1269 : u32; - hir.assertz v799 #[code = 250]; - v800 = hir.int_to_ptr v797 : ptr; - hir.store v800, v796; - v801 = arith.mul v777, v763 : i32 #[overflow = wrapping]; - scf.yield v801; + ^block79: + v1266 = arith.constant 4 : u32; + v777 = hir.bitcast v753 : u32; + v779 = arith.add v777, v1266 : u32 #[overflow = checked]; + v1265 = arith.constant 4 : u32; + v781 = arith.mod v779, v1265 : u32; + hir.assertz v781 #[code = 250]; + v782 = hir.int_to_ptr v779 : ptr; + hir.store v782, v755; + v1264 = arith.constant 4 : u32; + v783 = hir.bitcast v754 : u32; + v785 = arith.add v783, v1264 : u32 #[overflow = checked]; + v1263 = arith.constant 4 : u32; + v787 = arith.mod v785, v1263 : u32; + hir.assertz v787 #[code = 250]; + v788 = hir.int_to_ptr v785 : ptr; + v789 = hir.load v788 : i32; + v790 = hir.bitcast v753 : u32; + v1262 = arith.constant 4 : u32; + v792 = arith.mod v790, v1262 : u32; + hir.assertz v792 #[code = 250]; + v793 = hir.int_to_ptr v790 : ptr; + hir.store v793, v789; + v794 = arith.mul v770, v756 : i32 #[overflow = wrapping]; + scf.yield v794; }; - v802 = arith.constant 8 : i32; - v1268 = arith.constant 4 : i32; - v1264 = cf.select v783, v1268, v802 : i32; - scf.yield v1264, v1263; + v795 = arith.constant 8 : i32; + v1261 = arith.constant 4 : i32; + v1257 = cf.select v776, v1261, v795 : i32; + scf.yield v1257, v1256; }; - v805 = arith.add v760, v1265 : i32 #[overflow = wrapping]; - v807 = hir.bitcast v805 : u32; - v1267 = arith.constant 4 : u32; - v809 = arith.mod v807, v1267 : u32; - hir.assertz v809 #[code = 250]; - v810 = hir.int_to_ptr v807 : ptr; - hir.store v810, v1266; + v798 = arith.add v753, v1258 : i32 #[overflow = wrapping]; + v800 = hir.bitcast v798 : u32; + v1260 = arith.constant 4 : u32; + v802 = arith.mod v800, v1260 : u32; + hir.assertz v802 #[code = 250]; + v803 = hir.int_to_ptr v800 : ptr; + hir.store v803, v1259; builtin.ret ; }; - private builtin.function @alloc::raw_vec::finish_grow(v811: i32, v812: i32, v813: i32, v814: i32, v815: i32) { - ^block84(v811: i32, v812: i32, v813: i32, v814: i32, v815: i32): - v817 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v818 = hir.bitcast v817 : ptr; - v819 = hir.load v818 : i32; - v820 = arith.constant 16 : i32; - v821 = arith.sub v819, v820 : i32 #[overflow = wrapping]; - v822 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v823 = hir.bitcast v822 : ptr; - hir.store v823, v821; - v1333 = arith.constant 0 : i32; - v816 = arith.constant 0 : i32; - v826 = arith.gte v813, v816 : i1; - v827 = arith.zext v826 : u32; - v828 = hir.bitcast v827 : i32; - v830 = arith.neq v828, v1333 : i1; - v1307, v1308 = scf.if v830 : i32, i32 { - ^block87: - v917 = arith.constant 4 : u32; - v833 = hir.bitcast v814 : u32; - v835 = arith.add v833, v917 : u32 #[overflow = checked]; - v1332 = arith.constant 4 : u32; - v837 = arith.mod v835, v1332 : u32; - hir.assertz v837 #[code = 250]; - v838 = hir.int_to_ptr v835 : ptr; - v839 = hir.load v838 : i32; - v1330 = arith.constant 0 : i32; - v1331 = arith.constant 0 : i32; - v841 = arith.eq v839, v1331 : i1; - v842 = arith.zext v841 : u32; - v843 = hir.bitcast v842 : i32; - v845 = arith.neq v843, v1330 : i1; - v1305, v1306 = scf.if v845 : i32, i32 { - ^block90: - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v821, v812, v813) - v1329 = arith.constant 4 : u32; - v878 = hir.bitcast v821 : u32; - v880 = arith.add v878, v1329 : u32 #[overflow = checked]; - v1328 = arith.constant 4 : u32; - v882 = arith.mod v880, v1328 : u32; - hir.assertz v882 #[code = 250]; - v883 = hir.int_to_ptr v880 : ptr; - v884 = hir.load v883 : i32; - v885 = hir.bitcast v821 : u32; - v1327 = arith.constant 4 : u32; - v887 = arith.mod v885, v1327 : u32; - hir.assertz v887 #[code = 250]; - v888 = hir.int_to_ptr v885 : ptr; - v889 = hir.load v888 : i32; - scf.yield v889, v884; + private builtin.function @alloc::raw_vec::finish_grow(v804: i32, v805: i32, v806: i32, v807: i32, v808: i32) { + ^block80(v804: i32, v805: i32, v806: i32, v807: i32, v808: i32): + v810 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v811 = hir.bitcast v810 : ptr; + v812 = hir.load v811 : i32; + v813 = arith.constant 16 : i32; + v814 = arith.sub v812, v813 : i32 #[overflow = wrapping]; + v815 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v816 = hir.bitcast v815 : ptr; + hir.store v816, v814; + v1326 = arith.constant 0 : i32; + v809 = arith.constant 0 : i32; + v819 = arith.gte v806, v809 : i1; + v820 = arith.zext v819 : u32; + v821 = hir.bitcast v820 : i32; + v823 = arith.neq v821, v1326 : i1; + v1300, v1301 = scf.if v823 : i32, i32 { + ^block83: + v910 = arith.constant 4 : u32; + v826 = hir.bitcast v807 : u32; + v828 = arith.add v826, v910 : u32 #[overflow = checked]; + v1325 = arith.constant 4 : u32; + v830 = arith.mod v828, v1325 : u32; + hir.assertz v830 #[code = 250]; + v831 = hir.int_to_ptr v828 : ptr; + v832 = hir.load v831 : i32; + v1323 = arith.constant 0 : i32; + v1324 = arith.constant 0 : i32; + v834 = arith.eq v832, v1324 : i1; + v835 = arith.zext v834 : u32; + v836 = hir.bitcast v835 : i32; + v838 = arith.neq v836, v1323 : i1; + v1298, v1299 = scf.if v838 : i32, i32 { + ^block86: + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v814, v805, v806) + v1322 = arith.constant 4 : u32; + v871 = hir.bitcast v814 : u32; + v873 = arith.add v871, v1322 : u32 #[overflow = checked]; + v1321 = arith.constant 4 : u32; + v875 = arith.mod v873, v1321 : u32; + hir.assertz v875 #[code = 250]; + v876 = hir.int_to_ptr v873 : ptr; + v877 = hir.load v876 : i32; + v878 = hir.bitcast v814 : u32; + v1320 = arith.constant 4 : u32; + v880 = arith.mod v878, v1320 : u32; + hir.assertz v880 #[code = 250]; + v881 = hir.int_to_ptr v878 : ptr; + v882 = hir.load v881 : i32; + scf.yield v882, v877; } else { - ^block91: - v847 = arith.constant 8 : u32; - v846 = hir.bitcast v814 : u32; - v848 = arith.add v846, v847 : u32 #[overflow = checked]; - v1326 = arith.constant 4 : u32; - v850 = arith.mod v848, v1326 : u32; - hir.assertz v850 #[code = 250]; - v851 = hir.int_to_ptr v848 : ptr; - v852 = hir.load v851 : i32; - v1325 = arith.constant 0 : i32; - v854 = arith.neq v852, v1325 : i1; - v1303, v1304 = scf.if v854 : i32, i32 { - ^block92: - v872 = hir.bitcast v814 : u32; - v1324 = arith.constant 4 : u32; - v874 = arith.mod v872, v1324 : u32; - hir.assertz v874 #[code = 250]; - v875 = hir.int_to_ptr v872 : ptr; - v876 = hir.load v875 : i32; - v877 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v876, v852, v812, v813) : i32 - scf.yield v877, v813; + ^block87: + v840 = arith.constant 8 : u32; + v839 = hir.bitcast v807 : u32; + v841 = arith.add v839, v840 : u32 #[overflow = checked]; + v1319 = arith.constant 4 : u32; + v843 = arith.mod v841, v1319 : u32; + hir.assertz v843 #[code = 250]; + v844 = hir.int_to_ptr v841 : ptr; + v845 = hir.load v844 : i32; + v1318 = arith.constant 0 : i32; + v847 = arith.neq v845, v1318 : i1; + v1296, v1297 = scf.if v847 : i32, i32 { + ^block88: + v865 = hir.bitcast v807 : u32; + v1317 = arith.constant 4 : u32; + v867 = arith.mod v865, v1317 : u32; + hir.assertz v867 #[code = 250]; + v868 = hir.int_to_ptr v865 : ptr; + v869 = hir.load v868 : i32; + v870 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v869, v845, v805, v806) : i32 + scf.yield v870, v806; } else { - ^block93: - v1323 = arith.constant 0 : i32; - v911 = arith.constant 8 : i32; - v856 = arith.add v821, v911 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v856, v812, v813, v1323) - v859 = arith.constant 12 : u32; - v858 = hir.bitcast v821 : u32; - v860 = arith.add v858, v859 : u32 #[overflow = checked]; - v1322 = arith.constant 4 : u32; - v862 = arith.mod v860, v1322 : u32; + ^block89: + v1316 = arith.constant 0 : i32; + v904 = arith.constant 8 : i32; + v849 = arith.add v814, v904 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v849, v805, v806, v1316) + v852 = arith.constant 12 : u32; + v851 = hir.bitcast v814 : u32; + v853 = arith.add v851, v852 : u32 #[overflow = checked]; + v1315 = arith.constant 4 : u32; + v855 = arith.mod v853, v1315 : u32; + hir.assertz v855 #[code = 250]; + v856 = hir.int_to_ptr v853 : ptr; + v857 = hir.load v856 : i32; + v1314 = arith.constant 8 : u32; + v858 = hir.bitcast v814 : u32; + v860 = arith.add v858, v1314 : u32 #[overflow = checked]; + v1313 = arith.constant 4 : u32; + v862 = arith.mod v860, v1313 : u32; hir.assertz v862 #[code = 250]; v863 = hir.int_to_ptr v860 : ptr; v864 = hir.load v863 : i32; - v1321 = arith.constant 8 : u32; - v865 = hir.bitcast v821 : u32; - v867 = arith.add v865, v1321 : u32 #[overflow = checked]; - v1320 = arith.constant 4 : u32; - v869 = arith.mod v867, v1320 : u32; - hir.assertz v869 #[code = 250]; - v870 = hir.int_to_ptr v867 : ptr; - v871 = hir.load v870 : i32; - scf.yield v871, v864; + scf.yield v864, v857; }; - scf.yield v1303, v1304; + scf.yield v1296, v1297; }; - v1319 = arith.constant 4 : u32; - v896 = hir.bitcast v811 : u32; - v898 = arith.add v896, v1319 : u32 #[overflow = checked]; - v1318 = arith.constant 4 : u32; - v900 = arith.mod v898, v1318 : u32; - hir.assertz v900 #[code = 250]; - v1317 = arith.constant 0 : i32; - v894 = arith.neq v1305, v1317 : i1; - v895 = cf.select v894, v1305, v812 : i32; - v901 = hir.int_to_ptr v898 : ptr; - hir.store v901, v895; - v1315 = arith.constant 0 : i32; - v908 = arith.eq v1305, v1315 : i1; - v909 = arith.zext v908 : u32; - v910 = hir.bitcast v909 : i32; - v1316 = arith.constant 0 : i32; - v905 = arith.neq v1305, v1316 : i1; - v906 = cf.select v905, v1306, v813 : i32; - scf.yield v906, v910; + v1312 = arith.constant 4 : u32; + v889 = hir.bitcast v804 : u32; + v891 = arith.add v889, v1312 : u32 #[overflow = checked]; + v1311 = arith.constant 4 : u32; + v893 = arith.mod v891, v1311 : u32; + hir.assertz v893 #[code = 250]; + v1310 = arith.constant 0 : i32; + v887 = arith.neq v1298, v1310 : i1; + v888 = cf.select v887, v1298, v805 : i32; + v894 = hir.int_to_ptr v891 : ptr; + hir.store v894, v888; + v1308 = arith.constant 0 : i32; + v901 = arith.eq v1298, v1308 : i1; + v902 = arith.zext v901 : u32; + v903 = hir.bitcast v902 : i32; + v1309 = arith.constant 0 : i32; + v898 = arith.neq v1298, v1309 : i1; + v899 = cf.select v898, v1299, v806 : i32; + scf.yield v899, v903; } else { - ^block88: - v831 = arith.constant 1 : i32; - v1314 = arith.constant 0 : i32; - scf.yield v1314, v831; + ^block84: + v824 = arith.constant 1 : i32; + v1307 = arith.constant 0 : i32; + scf.yield v1307, v824; }; - v832 = arith.constant 4 : i32; - v1313 = arith.constant 8 : i32; - v1309 = cf.select v830, v1313, v832 : i32; - v914 = arith.add v811, v1309 : i32 #[overflow = wrapping]; - v916 = hir.bitcast v914 : u32; - v1312 = arith.constant 4 : u32; - v918 = arith.mod v916, v1312 : u32; - hir.assertz v918 #[code = 250]; - v919 = hir.int_to_ptr v916 : ptr; - hir.store v919, v1307; - v921 = hir.bitcast v811 : u32; - v1311 = arith.constant 4 : u32; - v923 = arith.mod v921, v1311 : u32; - hir.assertz v923 #[code = 250]; - v924 = hir.int_to_ptr v921 : ptr; - hir.store v924, v1308; - v1310 = arith.constant 16 : i32; - v928 = arith.add v821, v1310 : i32 #[overflow = wrapping]; - v929 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v930 = hir.bitcast v929 : ptr; - hir.store v930, v928; + v825 = arith.constant 4 : i32; + v1306 = arith.constant 8 : i32; + v1302 = cf.select v823, v1306, v825 : i32; + v907 = arith.add v804, v1302 : i32 #[overflow = wrapping]; + v909 = hir.bitcast v907 : u32; + v1305 = arith.constant 4 : u32; + v911 = arith.mod v909, v1305 : u32; + hir.assertz v911 #[code = 250]; + v912 = hir.int_to_ptr v909 : ptr; + hir.store v912, v1300; + v914 = hir.bitcast v804 : u32; + v1304 = arith.constant 4 : u32; + v916 = arith.mod v914, v1304 : u32; + hir.assertz v916 #[code = 250]; + v917 = hir.int_to_ptr v914 : ptr; + hir.store v917, v1301; + v1303 = arith.constant 16 : i32; + v921 = arith.add v814, v1303 : i32 #[overflow = wrapping]; + v922 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr + v923 = hir.bitcast v922 : ptr; + hir.store v923, v921; builtin.ret ; }; - private builtin.function @alloc::raw_vec::handle_error(v931: i32, v932: i32, v933: i32) { - ^block94(v931: i32, v932: i32, v933: i32): + private builtin.function @alloc::raw_vec::handle_error(v924: i32, v925: i32, v926: i32) { + ^block90(v924: i32, v925: i32, v926: i32): ub.unreachable ; }; - private builtin.function @core::ptr::alignment::Alignment::max(v934: i32, v935: i32) -> i32 { - ^block96(v934: i32, v935: i32): - v942 = arith.constant 0 : i32; - v938 = hir.bitcast v935 : u32; - v937 = hir.bitcast v934 : u32; - v939 = arith.gt v937, v938 : i1; - v940 = arith.zext v939 : u32; - v941 = hir.bitcast v940 : i32; - v943 = arith.neq v941, v942 : i1; - v944 = cf.select v943, v934, v935 : i32; - builtin.ret v944; + private builtin.function @core::ptr::alignment::Alignment::max(v927: i32, v928: i32) -> i32 { + ^block92(v927: i32, v928: i32): + v935 = arith.constant 0 : i32; + v931 = hir.bitcast v928 : u32; + v930 = hir.bitcast v927 : u32; + v932 = arith.gt v930, v931 : i1; + v933 = arith.zext v932 : u32; + v934 = hir.bitcast v933 : i32; + v936 = arith.neq v934, v935 : i1; + v937 = cf.select v936, v927, v928 : i32; + builtin.ret v937; }; builtin.global_variable private @#__stack_pointer : i32 { diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.masm b/felt-repr/tests/expected/onchain_five_felts_struct.masm index 58373b742..a44d81ced 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.masm +++ b/felt-repr/tests/expected/onchain_five_felts_struct.masm @@ -268,7 +268,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.12 + push.16 dup.3 add u32assert @@ -285,7 +285,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.12 dup.4 add u32assert @@ -302,7 +302,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.4 + push.8 dup.5 add u32assert @@ -319,7 +319,10 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - dup.5 + push.4 + dup.6 + add + u32assert push.4 dup.1 swap.1 @@ -333,10 +336,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.16 - movup.7 - add - u32assert + movup.6 push.4 dup.1 swap.1 @@ -350,18 +350,6 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.55555 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::felt::from_u32 - trace.252 - nop - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::felt::assert_eq - trace.252 - nop push.4 push.0 push.256 @@ -495,7 +483,7 @@ pub proc entrypoint(i32, i32) push.8 dup.7 u32wrapping_add - movup.3 + movup.2 swap.1 trace.240 nop @@ -505,7 +493,7 @@ pub proc entrypoint(i32, i32) push.8 dup.6 u32wrapping_add - movup.3 + movup.2 swap.1 trace.240 nop @@ -515,7 +503,7 @@ pub proc entrypoint(i32, i32) push.8 dup.5 u32wrapping_add - movup.3 + movup.2 swap.1 trace.240 nop @@ -525,7 +513,7 @@ pub proc entrypoint(i32, i32) push.8 dup.4 u32wrapping_add - movup.3 + movup.2 swap.1 trace.240 nop @@ -1037,16 +1025,6 @@ proc intrinsics::mem::heap_base( nop end -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - @callconv("C") proc alloc::raw_vec::RawVecInner::grow_amortized( i32, diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.wat b/felt-repr/tests/expected/onchain_five_felts_struct.wat index 4485b22da..a757e1312 100644 --- a/felt-repr/tests/expected/onchain_five_felts_struct.wat +++ b/felt-repr/tests/expected/onchain_five_felts_struct.wat @@ -7,12 +7,10 @@ (type (;5;) (func)) (type (;6;) (func (param i32 i32 i32) (result i32))) (type (;7;) (func (result i32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param f32 f32))) - (type (;10;) (func (param i32 i32 i32 i32 i32 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))) + (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;9;) (func (param i32 i32 i32 i32 i32))) + (type (;10;) (func (param i32 i32 i32))) + (type (;11;) (func (param i32 i32 i32 i32))) (table (;0;) 1 1 funcref) (memory (;0;) 17) (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) @@ -89,23 +87,20 @@ local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=12 + f32.load offset=16 local.set 3 local.get 1 - f32.load offset=8 + f32.load offset=12 local.set 4 local.get 1 - f32.load offset=4 + f32.load offset=8 local.set 5 local.get 1 - f32.load + f32.load offset=4 local.set 6 local.get 1 - f32.load offset=16 - local.tee 7 - i32.const 55555 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq + f32.load + local.set 7 local.get 2 i32.const 20 i32.add @@ -148,27 +143,27 @@ local.get 2 i32.const 8 i32.add - local.get 6 + local.get 7 call $alloc::vec::Vec::push local.get 2 i32.const 8 i32.add - local.get 5 + local.get 6 call $alloc::vec::Vec::push local.get 2 i32.const 8 i32.add - local.get 4 + local.get 5 call $alloc::vec::Vec::push local.get 2 i32.const 8 i32.add - local.get 3 + local.get 4 call $alloc::vec::Vec::push local.get 2 i32.const 8 i32.add - local.get 7 + local.get 3 call $alloc::vec::Vec::push local.get 0 i32.const 8 @@ -313,13 +308,7 @@ (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) unreachable ) - (func $intrinsics::felt::from_u32 (;9;) (type 8) (param i32) (result f32) - unreachable - ) - (func $intrinsics::felt::assert_eq (;10;) (type 9) (param f32 f32) - unreachable - ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;11;) (type 10) (param i32 i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) (local i32 i32 i32 i64) global.get $__stack_pointer i32.const 32 @@ -447,7 +436,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;12;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;10;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i64) global.get $__stack_pointer i32.const 16 @@ -559,7 +548,7 @@ i32.add global.set $__stack_pointer ) - (func $::allocate (;13;) (type 12) (param i32 i32 i32) + (func $::allocate (;11;) (type 10) (param i32 i32 i32) (local i32) global.get $__stack_pointer i32.const 16 @@ -588,7 +577,7 @@ i32.add global.set $__stack_pointer ) - (func $alloc::alloc::Global::alloc_impl (;14;) (type 13) (param i32 i32 i32 i32) + (func $alloc::alloc::Global::alloc_impl (;12;) (type 11) (param i32 i32 i32 i32) block ;; label = @1 local.get 2 i32.eqz @@ -615,7 +604,7 @@ local.get 1 i32.store ) - (func $alloc::raw_vec::RawVecInner::current_memory (;15;) (type 13) (param i32 i32 i32 i32) + (func $alloc::raw_vec::RawVecInner::current_memory (;13;) (type 11) (param i32 i32 i32 i32) (local i32 i32 i32) i32.const 0 local.set 4 @@ -650,7 +639,7 @@ local.get 4 i32.store ) - (func $alloc::raw_vec::finish_grow (;16;) (type 11) (param i32 i32 i32 i32 i32) + (func $alloc::raw_vec::finish_grow (;14;) (type 9) (param i32 i32 i32 i32 i32) (local i32 i32) global.get $__stack_pointer i32.const 16 @@ -749,10 +738,10 @@ i32.add global.set $__stack_pointer ) - (func $alloc::raw_vec::handle_error (;17;) (type 12) (param i32 i32 i32) + (func $alloc::raw_vec::handle_error (;15;) (type 10) (param i32 i32 i32) unreachable ) - (func $core::ptr::alignment::Alignment::max (;18;) (type 3) (param i32 i32) (result i32) + (func $core::ptr::alignment::Alignment::max (;16;) (type 3) (param i32 i32) (result i32) local.get 0 local.get 1 local.get 0 diff --git a/felt-repr/tests/expected/onchain_mixed_types_struct.hir b/felt-repr/tests/expected/onchain_mixed_types_struct.hir new file mode 100644 index 000000000..ec4a8a2c8 --- /dev/null +++ b/felt-repr/tests/expected/onchain_mixed_types_struct.hir @@ -0,0 +1,1331 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @onchain_mixed_types_struct { + private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { + ^block4(v0: i32, v1: felt): + v4 = arith.constant 8 : u32; + v3 = hir.bitcast v0 : u32; + v5 = arith.add v3, v4 : u32 #[overflow = checked]; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : i32; + v10 = hir.bitcast v0 : u32; + v987 = arith.constant 4 : u32; + v12 = arith.mod v10, v987 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v2 = arith.constant 0 : i32; + v15 = arith.neq v9, v14 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v2 : i1; + scf.if v19{ + ^block104: + scf.yield ; + } else { + ^block7: + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVec::grow_one(v0) + scf.yield ; + }; + v986 = arith.constant 4 : u32; + v21 = hir.bitcast v0 : u32; + v23 = arith.add v21, v986 : u32 #[overflow = checked]; + v985 = arith.constant 4 : u32; + v25 = arith.mod v23, v985 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; + v977 = arith.constant 2 : u32; + v31 = arith.shl v9, v977 : i32; + v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; + v34 = hir.bitcast v32 : u32; + v984 = arith.constant 4 : u32; + v36 = arith.mod v34, v984 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v1; + v983 = arith.constant 8 : u32; + v40 = hir.bitcast v0 : u32; + v42 = arith.add v40, v983 : u32 #[overflow = checked]; + v982 = arith.constant 4 : u32; + v44 = arith.mod v42, v982 : u32; + hir.assertz v44 #[code = 250]; + v38 = arith.constant 1 : i32; + v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { + ^block8(v46: i32): + v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 16 : i32; + v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v54 = hir.bitcast v53 : ptr; + hir.store v54, v52; + v57 = hir.bitcast v46 : u32; + v58 = arith.constant 4 : u32; + v59 = arith.mod v57, v58 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i32; + v63 = arith.constant 4 : i32; + v62 = arith.constant 1 : i32; + v55 = arith.constant 8 : i32; + v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) + v66 = arith.constant 8 : u32; + v65 = hir.bitcast v52 : u32; + v67 = arith.add v65, v66 : u32 #[overflow = checked]; + v991 = arith.constant 4 : u32; + v69 = arith.mod v67, v991 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v47 = arith.constant 0 : i32; + v72 = arith.constant -2147483647 : i32; + v73 = arith.eq v71, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v47 : i1; + cf.cond_br v77 ^block10, ^block11; + ^block10: + v990 = arith.constant 16 : i32; + v87 = arith.add v52, v990 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; + builtin.ret ; + ^block11: + v79 = arith.constant 12 : u32; + v78 = hir.bitcast v52 : u32; + v80 = arith.add v78, v79 : u32 #[overflow = checked]; + v989 = arith.constant 4 : u32; + v82 = arith.mod v80, v989 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::handle_error(v71, v84, v85) + ub.unreachable ; + }; + + public builtin.function @entrypoint(v90: i32, v91: i32) { + ^block12(v90: i32, v91: i32): + v96 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; + v99 = arith.constant 32 : i32; + v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; + v101 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v102 = hir.bitcast v101 : ptr; + hir.store v102, v100; + v104 = arith.constant 4 : u32; + v103 = hir.bitcast v91 : u32; + v105 = arith.add v103, v104 : u32 #[overflow = checked]; + v1025 = arith.constant 4 : u32; + v107 = arith.mod v105, v1025 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + v109 = hir.load v108 : felt; + v110 = hir.bitcast v91 : u32; + v1024 = arith.constant 4 : u32; + v112 = arith.mod v110, v1024 : u32; + hir.assertz v112 #[code = 250]; + v113 = hir.int_to_ptr v110 : ptr; + v114 = hir.load v113 : felt; + v116 = arith.constant 8 : u32; + v115 = hir.bitcast v91 : u32; + v117 = arith.add v115, v116 : u32 #[overflow = checked]; + v1023 = arith.constant 4 : u32; + v119 = arith.mod v117, v1023 : u32; + hir.assertz v119 #[code = 250]; + v120 = hir.int_to_ptr v117 : ptr; + v121 = hir.load v120 : felt; + v122 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v121) : i64 + v124 = arith.constant 12 : u32; + v123 = hir.bitcast v91 : u32; + v125 = arith.add v123, v124 : u32 #[overflow = checked]; + v1022 = arith.constant 4 : u32; + v127 = arith.mod v125, v1022 : u32; + hir.assertz v127 #[code = 250]; + v128 = hir.int_to_ptr v125 : ptr; + v129 = hir.load v128 : felt; + v130 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v129) : i64 + v132 = arith.constant 16 : u32; + v131 = hir.bitcast v91 : u32; + v133 = arith.add v131, v132 : u32 #[overflow = checked]; + v1021 = arith.constant 4 : u32; + v135 = arith.mod v133, v1021 : u32; + hir.assertz v135 #[code = 250]; + v136 = hir.int_to_ptr v133 : ptr; + v137 = hir.load v136 : felt; + v138 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v137) : i64 + v140 = arith.constant 20 : u32; + v139 = hir.bitcast v91 : u32; + v141 = arith.add v139, v140 : u32 #[overflow = checked]; + v1020 = arith.constant 4 : u32; + v143 = arith.mod v141, v1020 : u32; + hir.assertz v143 #[code = 250]; + v144 = hir.int_to_ptr v141 : ptr; + v145 = hir.load v144 : felt; + v146 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v145) : i64 + v148 = arith.constant 255 : i32; + v147 = arith.trunc v146 : i32; + v149 = arith.band v147, v148 : i32; + v150 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/>::from(v149) : felt + v151 = arith.constant 66 : i32; + v152 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::from_u32(v151) : felt + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::assert_eq(v150, v152) + v157 = arith.constant 4 : i32; + v92 = arith.constant 0 : i32; + v155 = arith.constant 256 : i32; + v153 = arith.constant 20 : i32; + v154 = arith.add v100, v153 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v154, v155, v92, v157, v157) + v160 = arith.constant 24 : u32; + v159 = hir.bitcast v100 : u32; + v161 = arith.add v159, v160 : u32 #[overflow = checked]; + v1019 = arith.constant 4 : u32; + v163 = arith.mod v161, v1019 : u32; + hir.assertz v163 #[code = 250]; + v164 = hir.int_to_ptr v161 : ptr; + v165 = hir.load v164 : i32; + v1018 = arith.constant 20 : u32; + v166 = hir.bitcast v100 : u32; + v168 = arith.add v166, v1018 : u32 #[overflow = checked]; + v1017 = arith.constant 4 : u32; + v170 = arith.mod v168, v1017 : u32; + hir.assertz v170 #[code = 250]; + v171 = hir.int_to_ptr v168 : ptr; + v172 = hir.load v171 : i32; + v1016 = arith.constant 0 : i32; + v173 = arith.constant 1 : i32; + v174 = arith.neq v172, v173 : i1; + v175 = arith.zext v174 : u32; + v176 = hir.bitcast v175 : i32; + v178 = arith.neq v176, v1016 : i1; + cf.cond_br v178 ^block14, ^block15; + ^block14: + v1015 = arith.constant 8 : i32; + v187 = arith.constant 8 : i32; + v188 = arith.add v100, v187 : i32 #[overflow = wrapping]; + v190 = arith.add v188, v1015 : i32 #[overflow = wrapping]; + v192 = hir.bitcast v190 : u32; + v1014 = arith.constant 4 : u32; + v194 = arith.mod v192, v1014 : u32; + hir.assertz v194 #[code = 250]; + v1013 = arith.constant 0 : i32; + v195 = hir.int_to_ptr v192 : ptr; + hir.store v195, v1013; + v197 = arith.constant 28 : u32; + v196 = hir.bitcast v100 : u32; + v198 = arith.add v196, v197 : u32 #[overflow = checked]; + v1012 = arith.constant 4 : u32; + v200 = arith.mod v198, v1012 : u32; + hir.assertz v200 #[code = 250]; + v201 = hir.int_to_ptr v198 : ptr; + v202 = hir.load v201 : i32; + v1011 = arith.constant 12 : u32; + v203 = hir.bitcast v100 : u32; + v205 = arith.add v203, v1011 : u32 #[overflow = checked]; + v1010 = arith.constant 4 : u32; + v207 = arith.mod v205, v1010 : u32; + hir.assertz v207 #[code = 250]; + v208 = hir.int_to_ptr v205 : ptr; + hir.store v208, v202; + v1009 = arith.constant 8 : u32; + v209 = hir.bitcast v100 : u32; + v211 = arith.add v209, v1009 : u32 #[overflow = checked]; + v1008 = arith.constant 4 : u32; + v213 = arith.mod v211, v1008 : u32; + hir.assertz v213 #[code = 250]; + v214 = hir.int_to_ptr v211 : ptr; + hir.store v214, v165; + v1007 = arith.constant 8 : i32; + v216 = arith.add v100, v1007 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v216, v114) + v1006 = arith.constant 8 : i32; + v218 = arith.add v100, v1006 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v218, v109) + v221 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::from_u64_unchecked(v122) : felt + v1005 = arith.constant 8 : i32; + v220 = arith.add v100, v1005 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v220, v221) + v224 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::from_u64_unchecked(v130) : felt + v1004 = arith.constant 8 : i32; + v223 = arith.add v100, v1004 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v223, v224) + v227 = arith.trunc v138 : i32; + v228 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/>::from(v227) : felt + v1003 = arith.constant 8 : i32; + v226 = arith.add v100, v1003 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v226, v228) + v231 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/>::from(v149) : felt + v1002 = arith.constant 8 : i32; + v230 = arith.add v100, v1002 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v230, v231) + v234 = hir.bitcast v190 : u32; + v1001 = arith.constant 4 : u32; + v236 = arith.mod v234, v1001 : u32; + hir.assertz v236 #[code = 250]; + v237 = hir.int_to_ptr v234 : ptr; + v238 = hir.load v237 : i32; + v1000 = arith.constant 8 : i32; + v233 = arith.add v90, v1000 : i32 #[overflow = wrapping]; + v239 = hir.bitcast v233 : u32; + v999 = arith.constant 4 : u32; + v241 = arith.mod v239, v999 : u32; + hir.assertz v241 #[code = 250]; + v242 = hir.int_to_ptr v239 : ptr; + hir.store v242, v238; + v998 = arith.constant 8 : u32; + v243 = hir.bitcast v100 : u32; + v245 = arith.add v243, v998 : u32 #[overflow = checked]; + v997 = arith.constant 4 : u32; + v247 = arith.mod v245, v997 : u32; + hir.assertz v247 #[code = 250]; + v248 = hir.int_to_ptr v245 : ptr; + v249 = hir.load v248 : i64; + v250 = hir.bitcast v90 : u32; + v996 = arith.constant 4 : u32; + v252 = arith.mod v250, v996 : u32; + hir.assertz v252 #[code = 250]; + v253 = hir.int_to_ptr v250 : ptr; + hir.store v253, v249; + v995 = arith.constant 32 : i32; + v255 = arith.add v100, v995 : i32 #[overflow = wrapping]; + v256 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v257 = hir.bitcast v256 : ptr; + hir.store v257, v255; + builtin.ret ; + ^block15: + v994 = arith.constant 28 : u32; + v179 = hir.bitcast v100 : u32; + v181 = arith.add v179, v994 : u32 #[overflow = checked]; + v993 = arith.constant 4 : u32; + v183 = arith.mod v181, v993 : u32; + hir.assertz v183 #[code = 250]; + v184 = hir.int_to_ptr v181 : ptr; + v185 = hir.load v184 : i32; + v186 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::handle_error(v165, v185, v186) + ub.unreachable ; + }; + + private builtin.function @__rustc::__rust_alloc(v258: i32, v259: i32) -> i32 { + ^block16(v258: i32, v259: i32): + v261 = arith.constant 1048604 : i32; + v262 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::alloc(v261, v259, v258) : i32 + builtin.ret v262; + }; + + private builtin.function @__rustc::__rust_realloc(v263: i32, v264: i32, v265: i32, v266: i32) -> i32 { + ^block18(v263: i32, v264: i32, v265: i32, v266: i32): + v268 = arith.constant 1048604 : i32; + v269 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::alloc(v268, v265, v266) : i32 + v1034 = arith.constant 0 : i32; + v270 = arith.constant 0 : i32; + v271 = arith.eq v269, v270 : i1; + v272 = arith.zext v271 : u32; + v273 = hir.bitcast v272 : i32; + v275 = arith.neq v273, v1034 : i1; + scf.if v275{ + ^block20: + scf.yield ; + } else { + ^block21: + v1033 = arith.constant 0 : i32; + v277 = hir.bitcast v264 : u32; + v276 = hir.bitcast v266 : u32; + v278 = arith.lt v276, v277 : i1; + v279 = arith.zext v278 : u32; + v280 = hir.bitcast v279 : i32; + v282 = arith.neq v280, v1033 : i1; + v283 = cf.select v282, v266, v264 : i32; + v1031 = arith.constant 0 : i32; + v1032 = arith.constant 0 : i32; + v285 = arith.eq v283, v1032 : i1; + v286 = arith.zext v285 : u32; + v287 = hir.bitcast v286 : i32; + v289 = arith.neq v287, v1031 : i1; + scf.if v289{ + ^block110: + scf.yield ; + } else { + ^block22: + v290 = hir.bitcast v283 : u32; + v291 = hir.bitcast v269 : u32; + v292 = hir.int_to_ptr v291 : ptr; + v293 = hir.bitcast v263 : u32; + v294 = hir.int_to_ptr v293 : ptr; + hir.mem_cpy v294, v292, v290; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v269; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v296: i32, v297: i32) -> i32 { + ^block23(v296: i32, v297: i32): + v299 = arith.constant 1048604 : i32; + v300 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::alloc(v299, v297, v296) : i32 + v1043 = arith.constant 0 : i32; + v301 = arith.constant 0 : i32; + v302 = arith.eq v300, v301 : i1; + v303 = arith.zext v302 : u32; + v304 = hir.bitcast v303 : i32; + v306 = arith.neq v304, v1043 : i1; + scf.if v306{ + ^block25: + scf.yield ; + } else { + ^block26: + v1041 = arith.constant 0 : i32; + v1042 = arith.constant 0 : i32; + v308 = arith.eq v296, v1042 : i1; + v309 = arith.zext v308 : u32; + v310 = hir.bitcast v309 : i32; + v312 = arith.neq v310, v1041 : i1; + scf.if v312{ + ^block113: + scf.yield ; + } else { + ^block27: + v1035 = arith.constant 0 : u8; + v315 = hir.bitcast v296 : u32; + v316 = hir.bitcast v300 : u32; + v317 = hir.int_to_ptr v316 : ptr; + hir.mem_set v317, v315, v1035; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v300; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block28: + builtin.ret ; + }; + + private builtin.function @::alloc(v319: i32, v320: i32, v321: i32) -> i32 { + ^block30(v319: i32, v320: i32, v321: i32): + v324 = arith.constant 16 : i32; + v323 = arith.constant 0 : i32; + v1045 = arith.constant 16 : u32; + v326 = hir.bitcast v320 : u32; + v328 = arith.gt v326, v1045 : i1; + v329 = arith.zext v328 : u32; + v330 = hir.bitcast v329 : i32; + v332 = arith.neq v330, v323 : i1; + v333 = cf.select v332, v320, v324 : i32; + v1085 = arith.constant 0 : i32; + v334 = arith.constant -1 : i32; + v335 = arith.add v333, v334 : i32 #[overflow = wrapping]; + v336 = arith.band v333, v335 : i32; + v338 = arith.neq v336, v1085 : i1; + v1054, v1055 = scf.if v338 : i32, u32 { + ^block118: + v1046 = arith.constant 0 : u32; + v1050 = ub.poison i32 : i32; + scf.yield v1050, v1046; + } else { + ^block33: + v340 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/core::ptr::alignment::Alignment::max(v320, v333) : i32 + v1084 = arith.constant 0 : i32; + v339 = arith.constant -2147483648 : i32; + v341 = arith.sub v339, v340 : i32 #[overflow = wrapping]; + v343 = hir.bitcast v341 : u32; + v342 = hir.bitcast v321 : u32; + v344 = arith.gt v342, v343 : i1; + v345 = arith.zext v344 : u32; + v346 = hir.bitcast v345 : i32; + v348 = arith.neq v346, v1084 : i1; + v1069 = scf.if v348 : i32 { + ^block117: + v1083 = ub.poison i32 : i32; + scf.yield v1083; + } else { + ^block34: + v1081 = arith.constant 0 : i32; + v354 = arith.sub v1081, v340 : i32 #[overflow = wrapping]; + v1082 = arith.constant -1 : i32; + v350 = arith.add v321, v340 : i32 #[overflow = wrapping]; + v352 = arith.add v350, v1082 : i32 #[overflow = wrapping]; + v355 = arith.band v352, v354 : i32; + v356 = hir.bitcast v319 : u32; + v357 = arith.constant 4 : u32; + v358 = arith.mod v356, v357 : u32; + hir.assertz v358 #[code = 250]; + v359 = hir.int_to_ptr v356 : ptr; + v360 = hir.load v359 : i32; + v1080 = arith.constant 0 : i32; + v362 = arith.neq v360, v1080 : i1; + scf.if v362{ + ^block116: + scf.yield ; + } else { + ^block36: + v363 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::mem::heap_base() : i32 + v364 = hir.mem_size : u32; + v370 = hir.bitcast v319 : u32; + v1079 = arith.constant 4 : u32; + v372 = arith.mod v370, v1079 : u32; + hir.assertz v372 #[code = 250]; + v1078 = arith.constant 16 : u32; + v365 = hir.bitcast v364 : i32; + v368 = arith.shl v365, v1078 : i32; + v369 = arith.add v363, v368 : i32 #[overflow = wrapping]; + v373 = hir.int_to_ptr v370 : ptr; + hir.store v373, v369; + scf.yield ; + }; + v376 = hir.bitcast v319 : u32; + v1077 = arith.constant 4 : u32; + v378 = arith.mod v376, v1077 : u32; + hir.assertz v378 #[code = 250]; + v379 = hir.int_to_ptr v376 : ptr; + v380 = hir.load v379 : i32; + v1075 = arith.constant 0 : i32; + v1076 = arith.constant -1 : i32; + v382 = arith.bxor v380, v1076 : i32; + v384 = hir.bitcast v382 : u32; + v383 = hir.bitcast v355 : u32; + v385 = arith.gt v383, v384 : i1; + v386 = arith.zext v385 : u32; + v387 = hir.bitcast v386 : i32; + v389 = arith.neq v387, v1075 : i1; + v1068 = scf.if v389 : i32 { + ^block37: + v1074 = arith.constant 0 : i32; + scf.yield v1074; + } else { + ^block38: + v391 = hir.bitcast v319 : u32; + v1073 = arith.constant 4 : u32; + v393 = arith.mod v391, v1073 : u32; + hir.assertz v393 #[code = 250]; + v390 = arith.add v380, v355 : i32 #[overflow = wrapping]; + v394 = hir.int_to_ptr v391 : ptr; + hir.store v394, v390; + v396 = arith.add v380, v340 : i32 #[overflow = wrapping]; + scf.yield v396; + }; + scf.yield v1068; + }; + v1051 = arith.constant 1 : u32; + v1072 = arith.constant 0 : u32; + v1070 = cf.select v348, v1072, v1051 : u32; + scf.yield v1069, v1070; + }; + v1071 = arith.constant 0 : u32; + v1067 = arith.eq v1055, v1071 : i1; + cf.cond_br v1067 ^block32, ^block120(v1054); + ^block32: + ub.unreachable ; + ^block120(v1047: i32): + builtin.ret v1047; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block39: + v399 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v399; + }; + + private builtin.function @>::from(v401: i32) -> felt { + ^block43(v401: i32): + v403 = hir.bitcast v401 : felt; + builtin.ret v403; + }; + + private builtin.function @intrinsics::felt::from_u64_unchecked(v404: i64) -> felt { + ^block45(v404: i64): + v405 = hir.cast v404 : felt; + builtin.ret v405; + }; + + private builtin.function @intrinsics::felt::from_u32(v407: i32) -> felt { + ^block47(v407: i32): + v408 = hir.bitcast v407 : felt; + builtin.ret v408; + }; + + private builtin.function @intrinsics::felt::as_u64(v410: felt) -> i64 { + ^block49(v410: felt): + v411 = hir.cast v410 : i64; + builtin.ret v411; + }; + + private builtin.function @intrinsics::felt::assert_eq(v413: felt, v414: felt) { + ^block51(v413: felt, v414: felt): + hir.assert_eq v413, v414; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v415: i32, v416: i32, v417: i32, v418: i32, v419: i32, v420: i32) { + ^block53(v415: i32, v416: i32, v417: i32, v418: i32, v419: i32, v420: i32): + v423 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v424 = hir.bitcast v423 : ptr; + v425 = hir.load v424 : i32; + v426 = arith.constant 32 : i32; + v427 = arith.sub v425, v426 : i32 #[overflow = wrapping]; + v428 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v429 = hir.bitcast v428 : ptr; + hir.store v429, v427; + v1162 = arith.constant 0 : i32; + v421 = arith.constant 0 : i32; + v432 = arith.eq v420, v421 : i1; + v433 = arith.zext v432 : u32; + v434 = hir.bitcast v433 : i32; + v436 = arith.neq v434, v1162 : i1; + v1133, v1134 = scf.if v436 : i32, i32 { + ^block56: + v1161 = arith.constant 0 : i32; + scf.yield v1161, v1161; + } else { + ^block57: + v437 = arith.add v417, v418 : i32 #[overflow = wrapping]; + v1160 = arith.constant 0 : i32; + v439 = hir.bitcast v417 : u32; + v438 = hir.bitcast v437 : u32; + v440 = arith.lt v438, v439 : i1; + v441 = arith.zext v440 : u32; + v442 = hir.bitcast v441 : i32; + v444 = arith.neq v442, v1160 : i1; + v1131, v1132 = scf.if v444 : i32, i32 { + ^block126: + v1159 = arith.constant 0 : i32; + scf.yield v1159, v1159; + } else { + ^block58: + v455 = hir.bitcast v416 : u32; + v569 = arith.constant 4 : u32; + v457 = arith.mod v455, v569 : u32; + hir.assertz v457 #[code = 250]; + v458 = hir.int_to_ptr v455 : ptr; + v459 = hir.load v458 : i32; + v1087 = arith.constant 1 : u32; + v462 = arith.shl v459, v1087 : i32; + v1158 = arith.constant 0 : i32; + v464 = hir.bitcast v462 : u32; + v463 = hir.bitcast v437 : u32; + v465 = arith.gt v463, v464 : i1; + v466 = arith.zext v465 : u32; + v467 = hir.bitcast v466 : i32; + v469 = arith.neq v467, v1158 : i1; + v470 = cf.select v469, v437, v462 : i32; + v1155 = arith.constant 1 : i32; + v472 = arith.constant 4 : i32; + v1156 = arith.constant 0 : i32; + v1086 = arith.constant 1025 : u32; + v475 = hir.bitcast v420 : u32; + v477 = arith.lt v475, v1086 : i1; + v478 = arith.zext v477 : u32; + v479 = hir.bitcast v478 : i32; + v481 = arith.neq v479, v1156 : i1; + v482 = cf.select v481, v472, v1155 : i32; + v471 = arith.constant 8 : i32; + v1157 = arith.constant 0 : i32; + v460 = arith.constant 1 : i32; + v484 = arith.eq v420, v460 : i1; + v485 = arith.zext v484 : u32; + v486 = hir.bitcast v485 : i32; + v488 = arith.neq v486, v1157 : i1; + v489 = cf.select v488, v471, v482 : i32; + v1154 = arith.constant 0 : i32; + v491 = hir.bitcast v489 : u32; + v490 = hir.bitcast v470 : u32; + v492 = arith.gt v490, v491 : i1; + v493 = arith.zext v492 : u32; + v494 = hir.bitcast v493 : i32; + v496 = arith.neq v494, v1154 : i1; + v497 = cf.select v496, v470, v489 : i32; + v498 = hir.bitcast v497 : u32; + v499 = arith.zext v498 : u64; + v500 = hir.bitcast v499 : i64; + v1153 = arith.constant 0 : i32; + v450 = arith.sub v1153, v419 : i32 #[overflow = wrapping]; + v447 = arith.constant -1 : i32; + v446 = arith.add v419, v420 : i32 #[overflow = wrapping]; + v448 = arith.add v446, v447 : i32 #[overflow = wrapping]; + v451 = arith.band v448, v450 : i32; + v452 = hir.bitcast v451 : u32; + v453 = arith.zext v452 : u64; + v454 = hir.bitcast v453 : i64; + v501 = arith.mul v454, v500 : i64 #[overflow = wrapping]; + v1152 = arith.constant 0 : i32; + v502 = arith.constant 32 : i64; + v504 = hir.cast v502 : u32; + v503 = hir.bitcast v501 : u64; + v505 = arith.shr v503, v504 : u64; + v506 = hir.bitcast v505 : i64; + v507 = arith.trunc v506 : i32; + v509 = arith.neq v507, v1152 : i1; + v1129, v1130 = scf.if v509 : i32, i32 { + ^block125: + v1151 = arith.constant 0 : i32; + scf.yield v470, v1151; + } else { + ^block59: + v510 = arith.trunc v501 : i32; + v1150 = arith.constant 0 : i32; + v511 = arith.constant -2147483648 : i32; + v512 = arith.sub v511, v419 : i32 #[overflow = wrapping]; + v514 = hir.bitcast v512 : u32; + v513 = hir.bitcast v510 : u32; + v515 = arith.gt v513, v514 : i1; + v516 = arith.zext v515 : u32; + v517 = hir.bitcast v516 : i32; + v519 = arith.neq v517, v1150 : i1; + v1127, v1128 = scf.if v519 : i32, i32 { + ^block124: + v1149 = arith.constant 0 : i32; + scf.yield v470, v1149; + } else { + ^block60: + v520 = arith.constant 20 : i32; + v521 = arith.add v427, v520 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVecInner::current_memory(v521, v416, v419, v420) + v1147 = arith.constant 20 : i32; + v525 = arith.add v427, v1147 : i32 #[overflow = wrapping]; + v1148 = arith.constant 8 : i32; + v523 = arith.add v427, v1148 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::finish_grow(v523, v419, v510, v525, v415) + v527 = arith.constant 12 : u32; + v526 = hir.bitcast v427 : u32; + v528 = arith.add v526, v527 : u32 #[overflow = checked]; + v1146 = arith.constant 4 : u32; + v530 = arith.mod v528, v1146 : u32; + hir.assertz v530 #[code = 250]; + v531 = hir.int_to_ptr v528 : ptr; + v532 = hir.load v531 : i32; + v534 = arith.constant 8 : u32; + v533 = hir.bitcast v427 : u32; + v535 = arith.add v533, v534 : u32 #[overflow = checked]; + v1145 = arith.constant 4 : u32; + v537 = arith.mod v535, v1145 : u32; + hir.assertz v537 #[code = 250]; + v538 = hir.int_to_ptr v535 : ptr; + v539 = hir.load v538 : i32; + v1143 = arith.constant 0 : i32; + v1144 = arith.constant 0 : i32; + v541 = arith.eq v539, v1144 : i1; + v542 = arith.zext v541 : u32; + v543 = hir.bitcast v542 : i32; + v545 = arith.neq v543, v1143 : i1; + v1125 = scf.if v545 : i32 { + ^block61: + v553 = hir.bitcast v416 : u32; + v1142 = arith.constant 4 : u32; + v555 = arith.mod v553, v1142 : u32; + hir.assertz v555 #[code = 250]; + v556 = hir.int_to_ptr v553 : ptr; + hir.store v556, v497; + v1141 = arith.constant 4 : u32; + v557 = hir.bitcast v416 : u32; + v559 = arith.add v557, v1141 : u32 #[overflow = checked]; + v1140 = arith.constant 4 : u32; + v561 = arith.mod v559, v1140 : u32; + hir.assertz v561 #[code = 250]; + v562 = hir.int_to_ptr v559 : ptr; + hir.store v562, v532; + scf.yield v470; + } else { + ^block62: + v547 = arith.constant 16 : u32; + v546 = hir.bitcast v427 : u32; + v548 = arith.add v546, v547 : u32 #[overflow = checked]; + v1139 = arith.constant 4 : u32; + v550 = arith.mod v548, v1139 : u32; + hir.assertz v550 #[code = 250]; + v551 = hir.int_to_ptr v548 : ptr; + v552 = hir.load v551 : i32; + scf.yield v552; + }; + v563 = arith.constant -2147483647 : i32; + v1126 = cf.select v545, v563, v532 : i32; + scf.yield v1125, v1126; + }; + scf.yield v1127, v1128; + }; + scf.yield v1129, v1130; + }; + scf.yield v1131, v1132; + }; + v1138 = arith.constant 4 : u32; + v568 = hir.bitcast v415 : u32; + v570 = arith.add v568, v1138 : u32 #[overflow = checked]; + v1137 = arith.constant 4 : u32; + v572 = arith.mod v570, v1137 : u32; + hir.assertz v572 #[code = 250]; + v573 = hir.int_to_ptr v570 : ptr; + hir.store v573, v1133; + v576 = hir.bitcast v415 : u32; + v1136 = arith.constant 4 : u32; + v578 = arith.mod v576, v1136 : u32; + hir.assertz v578 #[code = 250]; + v579 = hir.int_to_ptr v576 : ptr; + hir.store v579, v1134; + v1135 = arith.constant 32 : i32; + v583 = arith.add v427, v1135 : i32 #[overflow = wrapping]; + v584 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v585 = hir.bitcast v584 : ptr; + hir.store v585, v583; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v586: i32, v587: i32, v588: i32, v589: i32, v590: i32) { + ^block63(v586: i32, v587: i32, v588: i32, v589: i32, v590: i32): + v593 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v594 = hir.bitcast v593 : ptr; + v595 = hir.load v594 : i32; + v596 = arith.constant 16 : i32; + v597 = arith.sub v595, v596 : i32 #[overflow = wrapping]; + v598 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v599 = hir.bitcast v598 : ptr; + hir.store v599, v597; + v609 = hir.bitcast v587 : u32; + v610 = arith.zext v609 : u64; + v611 = hir.bitcast v610 : i64; + v591 = arith.constant 0 : i32; + v604 = arith.sub v591, v589 : i32 #[overflow = wrapping]; + v601 = arith.constant -1 : i32; + v600 = arith.add v589, v590 : i32 #[overflow = wrapping]; + v602 = arith.add v600, v601 : i32 #[overflow = wrapping]; + v605 = arith.band v602, v604 : i32; + v606 = hir.bitcast v605 : u32; + v607 = arith.zext v606 : u64; + v608 = hir.bitcast v607 : i64; + v612 = arith.mul v608, v611 : i64 #[overflow = wrapping]; + v1266 = arith.constant 0 : i32; + v613 = arith.constant 32 : i64; + v615 = hir.cast v613 : u32; + v614 = hir.bitcast v612 : u64; + v616 = arith.shr v614, v615 : u64; + v617 = hir.bitcast v616 : i64; + v618 = arith.trunc v617 : i32; + v620 = arith.neq v618, v1266 : i1; + v1178, v1179, v1180, v1181, v1182, v1183 = scf.if v620 : i32, i32, i32, i32, i32, u32 { + ^block132: + v1163 = arith.constant 0 : u32; + v1170 = ub.poison i32 : i32; + scf.yield v586, v597, v1170, v1170, v1170, v1163; + } else { + ^block68: + v621 = arith.trunc v612 : i32; + v1265 = arith.constant 0 : i32; + v622 = arith.constant -2147483648 : i32; + v623 = arith.sub v622, v589 : i32 #[overflow = wrapping]; + v625 = hir.bitcast v623 : u32; + v624 = hir.bitcast v621 : u32; + v626 = arith.lte v624, v625 : i1; + v627 = arith.zext v626 : u32; + v628 = hir.bitcast v627 : i32; + v630 = arith.neq v628, v1265 : i1; + v1226 = scf.if v630 : i32 { + ^block66: + v1264 = arith.constant 0 : i32; + v641 = arith.neq v621, v1264 : i1; + v1225 = scf.if v641 : i32 { + ^block70: + v1263 = arith.constant 0 : i32; + v657 = arith.neq v588, v1263 : i1; + v1224 = scf.if v657 : i32 { + ^block73: + v639 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::alloc::Global::alloc_impl(v597, v589, v621, v639) + v668 = hir.bitcast v597 : u32; + v713 = arith.constant 4 : u32; + v670 = arith.mod v668, v713 : u32; + hir.assertz v670 #[code = 250]; + v671 = hir.int_to_ptr v668 : ptr; + v672 = hir.load v671 : i32; + scf.yield v672; + } else { + ^block74: + v658 = arith.constant 8 : i32; + v659 = arith.add v597, v658 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::allocate(v659, v589, v621) + v643 = arith.constant 8 : u32; + v660 = hir.bitcast v597 : u32; + v662 = arith.add v660, v643 : u32 #[overflow = checked]; + v1262 = arith.constant 4 : u32; + v664 = arith.mod v662, v1262 : u32; + hir.assertz v664 #[code = 250]; + v665 = hir.int_to_ptr v662 : ptr; + v666 = hir.load v665 : i32; + scf.yield v666; + }; + v1260 = arith.constant 0 : i32; + v1261 = arith.constant 0 : i32; + v675 = arith.eq v1224, v1261 : i1; + v676 = arith.zext v675 : u32; + v677 = hir.bitcast v676 : i32; + v679 = arith.neq v677, v1260 : i1; + scf.if v679{ + ^block75: + v1259 = arith.constant 8 : u32; + v696 = hir.bitcast v586 : u32; + v698 = arith.add v696, v1259 : u32 #[overflow = checked]; + v1258 = arith.constant 4 : u32; + v700 = arith.mod v698, v1258 : u32; + hir.assertz v700 #[code = 250]; + v701 = hir.int_to_ptr v698 : ptr; + hir.store v701, v621; + v1257 = arith.constant 4 : u32; + v703 = hir.bitcast v586 : u32; + v705 = arith.add v703, v1257 : u32 #[overflow = checked]; + v1256 = arith.constant 4 : u32; + v707 = arith.mod v705, v1256 : u32; + hir.assertz v707 #[code = 250]; + v708 = hir.int_to_ptr v705 : ptr; + hir.store v708, v589; + scf.yield ; + } else { + ^block76: + v1255 = arith.constant 8 : u32; + v681 = hir.bitcast v586 : u32; + v683 = arith.add v681, v1255 : u32 #[overflow = checked]; + v1254 = arith.constant 4 : u32; + v685 = arith.mod v683, v1254 : u32; + hir.assertz v685 #[code = 250]; + v686 = hir.int_to_ptr v683 : ptr; + hir.store v686, v1224; + v1253 = arith.constant 4 : u32; + v688 = hir.bitcast v586 : u32; + v690 = arith.add v688, v1253 : u32 #[overflow = checked]; + v1252 = arith.constant 4 : u32; + v692 = arith.mod v690, v1252 : u32; + hir.assertz v692 #[code = 250]; + v693 = hir.int_to_ptr v690 : ptr; + hir.store v693, v587; + scf.yield ; + }; + v1250 = arith.constant 0 : i32; + v1251 = arith.constant 1 : i32; + v1223 = cf.select v679, v1251, v1250 : i32; + scf.yield v1223; + } else { + ^block71: + v1249 = arith.constant 8 : u32; + v642 = hir.bitcast v586 : u32; + v644 = arith.add v642, v1249 : u32 #[overflow = checked]; + v1248 = arith.constant 4 : u32; + v646 = arith.mod v644, v1248 : u32; + hir.assertz v646 #[code = 250]; + v647 = hir.int_to_ptr v644 : ptr; + hir.store v647, v589; + v1247 = arith.constant 4 : u32; + v650 = hir.bitcast v586 : u32; + v652 = arith.add v650, v1247 : u32 #[overflow = checked]; + v1246 = arith.constant 4 : u32; + v654 = arith.mod v652, v1246 : u32; + hir.assertz v654 #[code = 250]; + v1245 = arith.constant 0 : i32; + v655 = hir.int_to_ptr v652 : ptr; + hir.store v655, v1245; + v1244 = arith.constant 0 : i32; + scf.yield v1244; + }; + scf.yield v1225; + } else { + ^block69: + v1243 = ub.poison i32 : i32; + scf.yield v1243; + }; + v1238 = arith.constant 0 : u32; + v1171 = arith.constant 1 : u32; + v1231 = cf.select v630, v1171, v1238 : u32; + v1239 = ub.poison i32 : i32; + v1230 = cf.select v630, v597, v1239 : i32; + v1240 = ub.poison i32 : i32; + v1229 = cf.select v630, v586, v1240 : i32; + v1241 = ub.poison i32 : i32; + v1228 = cf.select v630, v1241, v597 : i32; + v1242 = ub.poison i32 : i32; + v1227 = cf.select v630, v1242, v586 : i32; + scf.yield v1227, v1228, v1229, v1226, v1230, v1231; + }; + v1184, v1185, v1186 = scf.index_switch v1183 : i32, i32, i32 + case 0 { + ^block67: + v1237 = arith.constant 4 : u32; + v633 = hir.bitcast v1178 : u32; + v635 = arith.add v633, v1237 : u32 #[overflow = checked]; + v1236 = arith.constant 4 : u32; + v637 = arith.mod v635, v1236 : u32; + hir.assertz v637 #[code = 250]; + v1235 = arith.constant 0 : i32; + v638 = hir.int_to_ptr v635 : ptr; + hir.store v638, v1235; + v1234 = arith.constant 1 : i32; + scf.yield v1178, v1234, v1179; + } + default { + ^block136: + scf.yield v1180, v1181, v1182; + }; + v712 = hir.bitcast v1184 : u32; + v1233 = arith.constant 4 : u32; + v714 = arith.mod v712, v1233 : u32; + hir.assertz v714 #[code = 250]; + v715 = hir.int_to_ptr v712 : ptr; + hir.store v715, v1185; + v1232 = arith.constant 16 : i32; + v720 = arith.add v1186, v1232 : i32 #[overflow = wrapping]; + v721 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v722 = hir.bitcast v721 : ptr; + hir.store v722, v720; + builtin.ret ; + }; + + private builtin.function @::allocate(v723: i32, v724: i32, v725: i32) { + ^block77(v723: i32, v724: i32, v725: i32): + v727 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v728 = hir.bitcast v727 : ptr; + v729 = hir.load v728 : i32; + v730 = arith.constant 16 : i32; + v731 = arith.sub v729, v730 : i32 #[overflow = wrapping]; + v732 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v733 = hir.bitcast v732 : ptr; + hir.store v733, v731; + v726 = arith.constant 0 : i32; + v734 = arith.constant 8 : i32; + v735 = arith.add v731, v734 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::alloc::Global::alloc_impl(v735, v724, v725, v726) + v738 = arith.constant 12 : u32; + v737 = hir.bitcast v731 : u32; + v739 = arith.add v737, v738 : u32 #[overflow = checked]; + v740 = arith.constant 4 : u32; + v741 = arith.mod v739, v740 : u32; + hir.assertz v741 #[code = 250]; + v742 = hir.int_to_ptr v739 : ptr; + v743 = hir.load v742 : i32; + v745 = arith.constant 8 : u32; + v744 = hir.bitcast v731 : u32; + v746 = arith.add v744, v745 : u32 #[overflow = checked]; + v1271 = arith.constant 4 : u32; + v748 = arith.mod v746, v1271 : u32; + hir.assertz v748 #[code = 250]; + v749 = hir.int_to_ptr v746 : ptr; + v750 = hir.load v749 : i32; + v751 = hir.bitcast v723 : u32; + v1270 = arith.constant 4 : u32; + v753 = arith.mod v751, v1270 : u32; + hir.assertz v753 #[code = 250]; + v754 = hir.int_to_ptr v751 : ptr; + hir.store v754, v750; + v1269 = arith.constant 4 : u32; + v755 = hir.bitcast v723 : u32; + v757 = arith.add v755, v1269 : u32 #[overflow = checked]; + v1268 = arith.constant 4 : u32; + v759 = arith.mod v757, v1268 : u32; + hir.assertz v759 #[code = 250]; + v760 = hir.int_to_ptr v757 : ptr; + hir.store v760, v743; + v1267 = arith.constant 16 : i32; + v762 = arith.add v731, v1267 : i32 #[overflow = wrapping]; + v763 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v764 = hir.bitcast v763 : ptr; + hir.store v764, v762; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v765: i32, v766: i32, v767: i32, v768: i32) { + ^block79(v765: i32, v766: i32, v767: i32, v768: i32): + v1287 = arith.constant 0 : i32; + v769 = arith.constant 0 : i32; + v770 = arith.eq v767, v769 : i1; + v771 = arith.zext v770 : u32; + v772 = hir.bitcast v771 : i32; + v774 = arith.neq v772, v1287 : i1; + v1283 = scf.if v774 : i32 { + ^block139: + scf.yield v766; + } else { + ^block82: + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1286 = arith.constant 0 : i32; + v776 = arith.neq v768, v1286 : i1; + v1282 = scf.if v776 : i32 { + ^block83: + v778 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_alloc_zeroed(v767, v766) : i32 + scf.yield v778; + } else { + ^block84: + v777 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_alloc(v767, v766) : i32 + scf.yield v777; + }; + scf.yield v1282; + }; + v782 = arith.constant 4 : u32; + v781 = hir.bitcast v765 : u32; + v783 = arith.add v781, v782 : u32 #[overflow = checked]; + v1285 = arith.constant 4 : u32; + v785 = arith.mod v783, v1285 : u32; + hir.assertz v785 #[code = 250]; + v786 = hir.int_to_ptr v783 : ptr; + hir.store v786, v767; + v788 = hir.bitcast v765 : u32; + v1284 = arith.constant 4 : u32; + v790 = arith.mod v788, v1284 : u32; + hir.assertz v790 #[code = 250]; + v791 = hir.int_to_ptr v788 : ptr; + hir.store v791, v1283; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v792: i32, v793: i32, v794: i32, v795: i32) { + ^block85(v792: i32, v793: i32, v794: i32, v795: i32): + v1313 = arith.constant 0 : i32; + v796 = arith.constant 0 : i32; + v800 = arith.eq v795, v796 : i1; + v801 = arith.zext v800 : u32; + v802 = hir.bitcast v801 : i32; + v804 = arith.neq v802, v1313 : i1; + v1300, v1301 = scf.if v804 : i32, i32 { + ^block143: + v1312 = arith.constant 0 : i32; + v798 = arith.constant 4 : i32; + scf.yield v798, v1312; + } else { + ^block88: + v805 = hir.bitcast v793 : u32; + v840 = arith.constant 4 : u32; + v807 = arith.mod v805, v840 : u32; + hir.assertz v807 #[code = 250]; + v808 = hir.int_to_ptr v805 : ptr; + v809 = hir.load v808 : i32; + v1310 = arith.constant 0 : i32; + v1311 = arith.constant 0 : i32; + v811 = arith.eq v809, v1311 : i1; + v812 = arith.zext v811 : u32; + v813 = hir.bitcast v812 : i32; + v815 = arith.neq v813, v1310 : i1; + v1298 = scf.if v815 : i32 { + ^block142: + v1309 = arith.constant 0 : i32; + scf.yield v1309; + } else { + ^block89: + v1308 = arith.constant 4 : u32; + v816 = hir.bitcast v792 : u32; + v818 = arith.add v816, v1308 : u32 #[overflow = checked]; + v1307 = arith.constant 4 : u32; + v820 = arith.mod v818, v1307 : u32; + hir.assertz v820 #[code = 250]; + v821 = hir.int_to_ptr v818 : ptr; + hir.store v821, v794; + v1306 = arith.constant 4 : u32; + v822 = hir.bitcast v793 : u32; + v824 = arith.add v822, v1306 : u32 #[overflow = checked]; + v1305 = arith.constant 4 : u32; + v826 = arith.mod v824, v1305 : u32; + hir.assertz v826 #[code = 250]; + v827 = hir.int_to_ptr v824 : ptr; + v828 = hir.load v827 : i32; + v829 = hir.bitcast v792 : u32; + v1304 = arith.constant 4 : u32; + v831 = arith.mod v829, v1304 : u32; + hir.assertz v831 #[code = 250]; + v832 = hir.int_to_ptr v829 : ptr; + hir.store v832, v828; + v833 = arith.mul v809, v795 : i32 #[overflow = wrapping]; + scf.yield v833; + }; + v834 = arith.constant 8 : i32; + v1303 = arith.constant 4 : i32; + v1299 = cf.select v815, v1303, v834 : i32; + scf.yield v1299, v1298; + }; + v837 = arith.add v792, v1300 : i32 #[overflow = wrapping]; + v839 = hir.bitcast v837 : u32; + v1302 = arith.constant 4 : u32; + v841 = arith.mod v839, v1302 : u32; + hir.assertz v841 #[code = 250]; + v842 = hir.int_to_ptr v839 : ptr; + hir.store v842, v1301; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::finish_grow(v843: i32, v844: i32, v845: i32, v846: i32, v847: i32) { + ^block90(v843: i32, v844: i32, v845: i32, v846: i32, v847: i32): + v849 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v850 = hir.bitcast v849 : ptr; + v851 = hir.load v850 : i32; + v852 = arith.constant 16 : i32; + v853 = arith.sub v851, v852 : i32 #[overflow = wrapping]; + v854 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v855 = hir.bitcast v854 : ptr; + hir.store v855, v853; + v1368 = arith.constant 0 : i32; + v848 = arith.constant 0 : i32; + v858 = arith.gte v845, v848 : i1; + v859 = arith.zext v858 : u32; + v860 = hir.bitcast v859 : i32; + v862 = arith.neq v860, v1368 : i1; + v1342, v1343 = scf.if v862 : i32, i32 { + ^block93: + v949 = arith.constant 4 : u32; + v865 = hir.bitcast v846 : u32; + v867 = arith.add v865, v949 : u32 #[overflow = checked]; + v1367 = arith.constant 4 : u32; + v869 = arith.mod v867, v1367 : u32; + hir.assertz v869 #[code = 250]; + v870 = hir.int_to_ptr v867 : ptr; + v871 = hir.load v870 : i32; + v1365 = arith.constant 0 : i32; + v1366 = arith.constant 0 : i32; + v873 = arith.eq v871, v1366 : i1; + v874 = arith.zext v873 : u32; + v875 = hir.bitcast v874 : i32; + v877 = arith.neq v875, v1365 : i1; + v1340, v1341 = scf.if v877 : i32, i32 { + ^block96: + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::allocate(v853, v844, v845) + v1364 = arith.constant 4 : u32; + v910 = hir.bitcast v853 : u32; + v912 = arith.add v910, v1364 : u32 #[overflow = checked]; + v1363 = arith.constant 4 : u32; + v914 = arith.mod v912, v1363 : u32; + hir.assertz v914 #[code = 250]; + v915 = hir.int_to_ptr v912 : ptr; + v916 = hir.load v915 : i32; + v917 = hir.bitcast v853 : u32; + v1362 = arith.constant 4 : u32; + v919 = arith.mod v917, v1362 : u32; + hir.assertz v919 #[code = 250]; + v920 = hir.int_to_ptr v917 : ptr; + v921 = hir.load v920 : i32; + scf.yield v921, v916; + } else { + ^block97: + v879 = arith.constant 8 : u32; + v878 = hir.bitcast v846 : u32; + v880 = arith.add v878, v879 : u32 #[overflow = checked]; + v1361 = arith.constant 4 : u32; + v882 = arith.mod v880, v1361 : u32; + hir.assertz v882 #[code = 250]; + v883 = hir.int_to_ptr v880 : ptr; + v884 = hir.load v883 : i32; + v1360 = arith.constant 0 : i32; + v886 = arith.neq v884, v1360 : i1; + v1338, v1339 = scf.if v886 : i32, i32 { + ^block98: + v904 = hir.bitcast v846 : u32; + v1359 = arith.constant 4 : u32; + v906 = arith.mod v904, v1359 : u32; + hir.assertz v906 #[code = 250]; + v907 = hir.int_to_ptr v904 : ptr; + v908 = hir.load v907 : i32; + v909 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_realloc(v908, v884, v844, v845) : i32 + scf.yield v909, v845; + } else { + ^block99: + v1358 = arith.constant 0 : i32; + v943 = arith.constant 8 : i32; + v888 = arith.add v853, v943 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::alloc::Global::alloc_impl(v888, v844, v845, v1358) + v891 = arith.constant 12 : u32; + v890 = hir.bitcast v853 : u32; + v892 = arith.add v890, v891 : u32 #[overflow = checked]; + v1357 = arith.constant 4 : u32; + v894 = arith.mod v892, v1357 : u32; + hir.assertz v894 #[code = 250]; + v895 = hir.int_to_ptr v892 : ptr; + v896 = hir.load v895 : i32; + v1356 = arith.constant 8 : u32; + v897 = hir.bitcast v853 : u32; + v899 = arith.add v897, v1356 : u32 #[overflow = checked]; + v1355 = arith.constant 4 : u32; + v901 = arith.mod v899, v1355 : u32; + hir.assertz v901 #[code = 250]; + v902 = hir.int_to_ptr v899 : ptr; + v903 = hir.load v902 : i32; + scf.yield v903, v896; + }; + scf.yield v1338, v1339; + }; + v1354 = arith.constant 4 : u32; + v928 = hir.bitcast v843 : u32; + v930 = arith.add v928, v1354 : u32 #[overflow = checked]; + v1353 = arith.constant 4 : u32; + v932 = arith.mod v930, v1353 : u32; + hir.assertz v932 #[code = 250]; + v1352 = arith.constant 0 : i32; + v926 = arith.neq v1340, v1352 : i1; + v927 = cf.select v926, v1340, v844 : i32; + v933 = hir.int_to_ptr v930 : ptr; + hir.store v933, v927; + v1350 = arith.constant 0 : i32; + v940 = arith.eq v1340, v1350 : i1; + v941 = arith.zext v940 : u32; + v942 = hir.bitcast v941 : i32; + v1351 = arith.constant 0 : i32; + v937 = arith.neq v1340, v1351 : i1; + v938 = cf.select v937, v1341, v845 : i32; + scf.yield v938, v942; + } else { + ^block94: + v863 = arith.constant 1 : i32; + v1349 = arith.constant 0 : i32; + scf.yield v1349, v863; + }; + v864 = arith.constant 4 : i32; + v1348 = arith.constant 8 : i32; + v1344 = cf.select v862, v1348, v864 : i32; + v946 = arith.add v843, v1344 : i32 #[overflow = wrapping]; + v948 = hir.bitcast v946 : u32; + v1347 = arith.constant 4 : u32; + v950 = arith.mod v948, v1347 : u32; + hir.assertz v950 #[code = 250]; + v951 = hir.int_to_ptr v948 : ptr; + hir.store v951, v1342; + v953 = hir.bitcast v843 : u32; + v1346 = arith.constant 4 : u32; + v955 = arith.mod v953, v1346 : u32; + hir.assertz v955 #[code = 250]; + v956 = hir.int_to_ptr v953 : ptr; + hir.store v956, v1343; + v1345 = arith.constant 16 : i32; + v960 = arith.add v853, v1345 : i32 #[overflow = wrapping]; + v961 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr + v962 = hir.bitcast v961 : ptr; + hir.store v962, v960; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v963: i32, v964: i32, v965: i32) { + ^block100(v963: i32, v964: i32, v965: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v966: i32, v967: i32) -> i32 { + ^block102(v966: i32, v967: i32): + v974 = arith.constant 0 : i32; + v970 = hir.bitcast v967 : u32; + v969 = hir.bitcast v966 : u32; + v971 = arith.gt v969, v970 : i1; + v972 = arith.zext v971 : u32; + v973 = hir.bitcast v972 : i32; + v975 = arith.neq v973, v974 : i1; + v976 = cf.select v975, v966, v967 : i32; + builtin.ret v976; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; + }; +}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_mixed_types_struct.masm b/felt-repr/tests/expected/onchain_mixed_types_struct.masm new file mode 100644 index 000000000..4155207f0 --- /dev/null +++ b/felt-repr/tests/expected/onchain_mixed_types_struct.masm @@ -0,0 +1,2605 @@ +# mod root_ns:root@1.0.0 + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 +end + +# mod root_ns:root@1.0.0::onchain_mixed_types_struct + +@callconv("C") +proc alloc::vec::Vec::push(i32, felt) + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + dup.2 + neq + neq + if.true + nop + else + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVec::grow_one + trace.252 + nop + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + dup.2 + swap.1 + u32shl + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVec::grow_one(i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + push.1 + push.8 + dup.4 + u32wrapping_add + dup.2 + movup.2 + swap.3 + swap.4 + movdn.2 + swap.5 + swap.6 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVecInner::grow_amortized + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2147483649 + dup.2 + eq + neq + if.true + drop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +pub proc entrypoint(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 + trace.252 + nop + push.12 + dup.7 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 + trace.252 + nop + push.16 + dup.9 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 + trace.252 + nop + push.20 + movup.11 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 + trace.252 + nop + push.255 + movdn.2 + drop + u32and + dup.0 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::>::from + trace.252 + nop + push.66 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::from_u32 + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::assert_eq + trace.252 + nop + push.4 + push.0 + push.256 + push.20 + dup.13 + u32wrapping_add + dup.3 + swap.4 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVecInner::try_allocate_in + trace.252 + nop + push.24 + dup.10 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.20 + dup.11 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + push.8 + push.8 + dup.12 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + dup.12 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.13 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.12 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.11 + u32wrapping_add + movup.9 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + trace.252 + nop + push.8 + dup.10 + u32wrapping_add + movup.9 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + trace.252 + nop + movup.7 + movup.7 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.8 + dup.8 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + trace.252 + nop + movup.5 + movup.5 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.8 + dup.6 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + trace.252 + nop + movup.3 + movup.3 + drop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::>::from + trace.252 + nop + push.8 + dup.4 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::>::from + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movdn.9 + dropw + dropw + drop + movup.2 + drop + push.28 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 + swap.2 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + movdn.3 + drop + drop + drop + else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + drop + else + dup.2 + movup.2 + push.0 + dup.3 + push.0 + gte + while.true + dup.2 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.4 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32 +) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt + dup.1 + dup.1 + push.1 + push.4294967295 + trace.240 + nop + exec.::std::math::u64::lt + trace.252 + nop + assert + mul.4294967296 + add +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::as_u64(felt) -> [u32; 2] + u32split +end + +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::grow_amortized( + i32, + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.8 + eq + neq + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + movup.4 + dup.4 + u32wrapping_add + push.0 + movup.5 + dup.2 + swap.1 + u32lt + neq + if.true + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32shl + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + push.1 + push.4 + push.0 + push.1025 + dup.9 + swap.1 + u32lt + neq + cdrop + push.8 + push.0 + push.1 + dup.9 + eq + neq + cdrop + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + dup.2 + swap.1 + cdrop + dup.0 + push.0 + push.0 + dup.8 + u32wrapping_sub + push.4294967295 + dup.9 + dup.11 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + drop + push.0 + push.2147483648 + dup.8 + u32wrapping_sub + dup.2 + swap.1 + u32gt + neq + if.true + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + push.20 + dup.4 + u32wrapping_add + dup.6 + dup.8 + movup.3 + swap.10 + movdn.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.20 + dup.3 + u32wrapping_add + push.8 + dup.4 + u32wrapping_add + dup.5 + movup.2 + swap.3 + swap.9 + movdn.2 + swap.4 + swap.8 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::finish_grow + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.4 + else + movup.2 + swap.6 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.4 + drop + drop + drop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + end + push.2147483649 + movdn.2 + movdn.3 + cdrop + swap.1 + end + end + end + end + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.2 + push.0 + push.0 + dup.7 + u32wrapping_sub + push.4294967295 + movup.9 + dup.9 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + push.3735929054 + dup.0 + dup.1 + swap.4 + swap.1 + swap.3 + swap.5 + else + drop + push.0 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte + neq + dup.0 + if.true + push.0 + dup.2 + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.3 + u32wrapping_add + dup.6 + dup.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::allocate + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + movup.6 + movup.2 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.7 + movup.4 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.0 + push.1 + movup.2 + cdrop + else + movup.2 + swap.5 + movdn.2 + swap.4 + swap.1 + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + swap.3 + swap.2 + swap.1 + end + else + swap.1 + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.3735929054 + end + push.0 + push.1 + dup.3 + cdrop + push.3735929054 + dup.3 + dup.5 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.7 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + movup.2 + swap.7 + movdn.2 + swap.1 + swap.5 + cdrop + swap.1 + swap.5 + swap.4 + swap.2 + swap.3 + swap.1 + end + movup.5 + eq.0 + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + swap.1 + else + drop + drop + end + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) + movup.4 + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::i32::is_gte + trace.252 + nop + neq + dup.0 + if.true + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + movup.5 + drop + dup.4 + dup.4 + dup.3 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::allocate + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + neq + if.true + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.5 + dup.7 + swap.3 + swap.1 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_realloc + trace.252 + nop + dup.5 + swap.1 + else + movup.6 + swap.1 + drop + drop + push.0 + push.8 + dup.3 + u32wrapping_add + dup.5 + dup.7 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + end + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + dup.2 + neq + dup.2 + movup.2 + swap.8 + movdn.2 + swap.1 + cdrop + movup.6 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + dup.1 + eq + push.0 + movup.2 + neq + swap.1 + swap.6 + swap.2 + swap.1 + cdrop + movup.4 + swap.1 + else + movup.2 + swap.5 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.3 + drop + drop + drop + push.1 + push.0 + end + push.4 + push.8 + movup.4 + cdrop + dup.4 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + diff --git a/felt-repr/tests/expected/onchain_mixed_types_struct.wat b/felt-repr/tests/expected/onchain_mixed_types_struct.wat new file mode 100644 index 000000000..ef68babce --- /dev/null +++ b/felt-repr/tests/expected/onchain_mixed_types_struct.wat @@ -0,0 +1,797 @@ +(module $onchain_mixed_types_struct.wasm + (type (;0;) (func (param i32 f32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func)) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (result i32))) + (type (;8;) (func (param i32) (result f32))) + (type (;9;) (func (param i64) (result f32))) + (type (;10;) (func (param f32) (result i64))) + (type (;11;) (func (param f32 f32))) + (type (;12;) (func (param i32 i32 i32 i32 i32 i32))) + (type (;13;) (func (param i32 i32 i32 i32 i32))) + (type (;14;) (func (param i32 i32 i32))) + (type (;15;) (func (param i32 i32 i32 i32))) + (table (;0;) 1 1 funcref) + (memory (;0;) 17) + (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) + (export "memory" (memory 0)) + (export "entrypoint" (func $entrypoint)) + (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) + (local i32) + block ;; label = @1 + local.get 0 + i32.load offset=8 + local.tee 2 + local.get 0 + i32.load + i32.ne + br_if 0 (;@1;) + local.get 0 + call $alloc::raw_vec::RawVec::grow_one + end + local.get 0 + i32.load offset=4 + local.get 2 + i32.const 2 + i32.shl + i32.add + local.get 1 + f32.store + local.get 0 + local.get 2 + i32.const 1 + i32.add + i32.store offset=8 + ) + (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 8 + i32.add + local.get 0 + local.get 0 + i32.load + i32.const 1 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::grow_amortized + block ;; label = @1 + local.get 1 + i32.load offset=8 + local.tee 0 + i32.const -2147483647 + i32.eq + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.load offset=12 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $entrypoint (;2;) (type 2) (param i32 i32) + (local i32 f32 f32 i64 i64 i64 i32 i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=4 + local.set 3 + local.get 1 + f32.load + local.set 4 + local.get 1 + f32.load offset=8 + call $intrinsics::felt::as_u64 + local.set 5 + local.get 1 + f32.load offset=12 + call $intrinsics::felt::as_u64 + local.set 6 + local.get 1 + f32.load offset=16 + call $intrinsics::felt::as_u64 + local.set 7 + local.get 1 + f32.load offset=20 + call $intrinsics::felt::as_u64 + i32.wrap_i64 + i32.const 255 + i32.and + local.tee 8 + call $>::from + i32.const 66 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq + local.get 2 + i32.const 20 + i32.add + i32.const 256 + i32.const 0 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::try_allocate_in + local.get 2 + i32.load offset=24 + local.set 1 + block ;; label = @1 + local.get 2 + i32.load offset=20 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 1 + local.get 2 + i32.load offset=28 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 2 + i32.const 8 + i32.add + i32.const 8 + i32.add + local.tee 9 + i32.const 0 + i32.store + local.get 2 + local.get 2 + i32.load offset=28 + i32.store offset=12 + local.get 2 + local.get 1 + i32.store offset=8 + local.get 2 + i32.const 8 + i32.add + local.get 4 + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 3 + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 5 + call $intrinsics::felt::from_u64_unchecked + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 6 + call $intrinsics::felt::from_u64_unchecked + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 7 + i32.wrap_i64 + call $>::from + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 8 + call $>::from + call $alloc::vec::Vec::push + local.get 0 + i32.const 8 + i32.add + local.get 9 + i32.load + i32.store + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store align=4 + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 2 + local.get 3 + call $::alloc + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 1 + local.get 3 + local.get 1 + i32.lt_u + select + local.tee 3 + i32.eqz + br_if 0 (;@1;) + local.get 2 + local.get 0 + local.get 3 + memory.copy + end + local.get 2 + ) + (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) + return + ) + (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) + unreachable + ) + (func $>::from (;9;) (type 8) (param i32) (result f32) + local.get 0 + f32.reinterpret_i32 + ) + (func $intrinsics::felt::from_u64_unchecked (;10;) (type 9) (param i64) (result f32) + unreachable + ) + (func $intrinsics::felt::from_u32 (;11;) (type 8) (param i32) (result f32) + unreachable + ) + (func $intrinsics::felt::as_u64 (;12;) (type 10) (param f32) (result i64) + unreachable + ) + (func $intrinsics::felt::assert_eq (;13;) (type 11) (param f32 f32) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;14;) (type 12) (param i32 i32 i32 i32 i32 i32) + (local i32 i32 i32 i64) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 6 + global.set $__stack_pointer + i32.const 0 + local.set 7 + block ;; label = @1 + block ;; label = @2 + local.get 5 + i32.eqz + br_if 0 (;@2;) + local.get 2 + local.get 3 + i32.add + local.tee 3 + local.get 2 + i32.lt_u + br_if 1 (;@1;) + i32.const 0 + local.set 7 + local.get 4 + local.get 5 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 4 + i32.sub + i32.and + i64.extend_i32_u + local.get 3 + local.get 1 + i32.load + i32.const 1 + i32.shl + local.tee 8 + local.get 3 + local.get 8 + i32.gt_u + select + local.tee 8 + i32.const 8 + i32.const 4 + i32.const 1 + local.get 5 + i32.const 1025 + i32.lt_u + select + local.get 5 + i32.const 1 + i32.eq + select + local.tee 2 + local.get 8 + local.get 2 + i32.gt_u + select + local.tee 2 + i64.extend_i32_u + i64.mul + local.tee 9 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@2;) + local.get 9 + i32.wrap_i64 + local.tee 3 + i32.const -2147483648 + local.get 4 + i32.sub + i32.gt_u + br_if 1 (;@1;) + local.get 6 + i32.const 20 + i32.add + local.get 1 + local.get 4 + local.get 5 + call $alloc::raw_vec::RawVecInner::current_memory + local.get 6 + i32.const 8 + i32.add + local.get 4 + local.get 3 + local.get 6 + i32.const 20 + i32.add + local.get 0 + call $alloc::raw_vec::finish_grow + local.get 6 + i32.load offset=12 + local.set 7 + block ;; label = @3 + local.get 6 + i32.load offset=8 + i32.eqz + br_if 0 (;@3;) + local.get 6 + i32.load offset=16 + local.set 8 + br 2 (;@1;) + end + local.get 1 + local.get 2 + i32.store + local.get 1 + local.get 7 + i32.store offset=4 + i32.const -2147483647 + local.set 7 + br 1 (;@1;) + end + end + local.get 0 + local.get 8 + i32.store offset=4 + local.get 0 + local.get 7 + i32.store + local.get 6 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 13) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;16;) (type 14) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;17;) (type 15) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 15) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $alloc::raw_vec::finish_grow (;19;) (type 13) (param i32 i32 i32 i32 i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + i32.const 0 + local.set 6 + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.const 0 + i32.ge_s + br_if 0 (;@2;) + i32.const 1 + local.set 2 + i32.const 4 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 3 + i32.load offset=4 + i32.eqz + br_if 0 (;@3;) + block ;; label = @4 + local.get 3 + i32.load offset=8 + local.tee 6 + br_if 0 (;@4;) + local.get 5 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load offset=12 + local.set 6 + local.get 5 + i32.load offset=8 + local.set 3 + br 2 (;@2;) + end + local.get 3 + i32.load + local.get 6 + local.get 1 + local.get 2 + call $__rustc::__rust_realloc + local.set 3 + local.get 2 + local.set 6 + br 1 (;@2;) + end + local.get 5 + local.get 1 + local.get 2 + call $::allocate + local.get 5 + i32.load offset=4 + local.set 6 + local.get 5 + i32.load + local.set 3 + end + local.get 0 + local.get 3 + local.get 1 + local.get 3 + select + i32.store offset=4 + local.get 6 + local.get 2 + local.get 3 + select + local.set 6 + local.get 3 + i32.eqz + local.set 2 + i32.const 8 + local.set 3 + end + local.get 0 + local.get 3 + i32.add + local.get 6 + i32.store + local.get 0 + local.get 2 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::handle_error (;20;) (type 14) (param i32 i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;21;) (type 3) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") +) diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index b48704309..9f761c9b9 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -196,8 +196,6 @@ fn five_felts_struct_round_trip() { let mut reader = FeltReader::new(&input); let deserialized = TestStruct::from_felt_repr(&mut reader); - assert_eq(deserialized.e, felt!(55555)); - deserialized.to_felt_repr() }"#; @@ -307,7 +305,7 @@ fn mixed_types_struct_round_trip() { let deserialized = TestStruct::from_felt_repr(&mut reader); // Verify some fields were deserialized correctly - assert_eq(deserialized.f1, felt!(111111)); + // assert_eq(deserialized.f1, felt!(111111)); assert_eq(Felt::from(deserialized.y as u32), felt!(66)); deserialized.to_felt_repr() @@ -317,6 +315,10 @@ fn mixed_types_struct_round_trip() { let artifact_name = "onchain_mixed_types_struct"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); + let package = test.compiled_package(); let in_elem_addr = 21u32 * 16384; @@ -366,3 +368,126 @@ fn mixed_types_struct_round_trip() { }) .unwrap(); } + +/// Inner struct for nested struct tests. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct Inner { + x: Felt, + y: u64, +} + +/// Outer struct containing nested Inner struct. +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct Outer { + a: Felt, + inner: Inner, + b: u32, + flag1: bool, + flag2: bool, +} + +/// Test nested struct serialization - full round-trip execution. +/// +/// Tests a struct containing another struct as a field, plus bool fields. +/// Outer has: 1 Felt + Inner(1 Felt + 1 u64) + 1 u32 + 2 bool = 6 Felts total. +#[test] +fn nested_struct_round_trip() { + let original = Outer { + a: Felt::new(111111), + inner: Inner { + x: Felt::new(222222), + y: 333333, + }, + b: 44444, + flag1: true, + flag2: false, + }; + let serialized = original.to_felt_repr(); + + // Outer.a (1) + Inner.x (1) + Inner.y (1) + Outer.b (1) + flag1 (1) + flag2 (1) = 6 Felts + assert_eq!(serialized.len(), 6); + + let onchain_code = r#"(input: [Felt; 6]) -> Vec { + use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Inner { + x: Felt, + y: u64, + } + + #[derive(FromFeltRepr, ToFeltRepr)] + struct Outer { + a: Felt, + inner: Inner, + b: u32, + flag1: bool, + flag2: bool, + } + + let mut reader = FeltReader::new(&input); + let deserialized = Outer::from_felt_repr(&mut reader); + + // Verify fields were deserialized correctly + assert_eq(deserialized.a, felt!(111111)); + assert_eq(deserialized.inner.x, felt!(222222)); + assert_eq(Felt::from(deserialized.b), felt!(44444)); + assert_eq(Felt::from(deserialized.flag1 as u32), felt!(1)); + assert_eq(Felt::from(deserialized.flag2 as u32), felt!(0)); + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let artifact_name = "onchain_nested_struct"; + let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = serialized.clone(); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; + + let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let vec_metadata: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read Vec metadata from memory"); + // Vec metadata layout is: [capacity, ptr, len, ?] + let data_ptr = vec_metadata[1].0.as_int() as u32; + let len = vec_metadata[2].0.as_int() as usize; + + assert_eq!(len, 6, "Expected Vec with 6 felts"); + + // Convert byte address to element address + let elem_addr = data_ptr / 4; + + // Read all 6 elements individually + let mut result_felts = [Felt::ZERO; 6]; + #[allow(clippy::needless_range_loop)] + for i in 0..6 { + let byte_addr = (elem_addr + i as u32) * 4; + let word_addr = (byte_addr / 16) * 16; + if let Some(data) = trace.read_from_rust_memory::<[TestFelt; 4]>(word_addr) { + let elem_in_word = ((byte_addr % 16) / 4) as usize; + result_felts[i] = data[elem_in_word].0; + } + } + + let mut reader = FeltReader::new(&result_felts); + let result_struct = Outer::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Nested struct round-trip failed"); + Ok(()) + }) + .unwrap(); +} From 5d6398bfdef7e7430243bad206d05006ae0e6850 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Wed, 10 Dec 2025 17:10:18 +0200 Subject: [PATCH 13/15] test: no u64 in the mixed types struct super roundtrip test add the test for u64-related bug reproduction. --- .../expected/onchain_minimal_u64_bug.hir | 1326 +++++++++ .../expected/onchain_minimal_u64_bug.masm | 2614 +++++++++++++++++ ...struct.wat => onchain_minimal_u64_bug.wat} | 62 +- .../expected/onchain_mixed_types_no_u64.hir | 1305 ++++++++ ...t.masm => onchain_mixed_types_no_u64.masm} | 197 +- .../expected/onchain_mixed_types_no_u64.wat | 778 +++++ .../expected/onchain_mixed_types_struct.hir | 1331 --------- felt-repr/tests/src/onchain.rs | 147 +- 8 files changed, 6249 insertions(+), 1511 deletions(-) create mode 100644 felt-repr/tests/expected/onchain_minimal_u64_bug.hir create mode 100644 felt-repr/tests/expected/onchain_minimal_u64_bug.masm rename felt-repr/tests/expected/{onchain_mixed_types_struct.wat => onchain_minimal_u64_bug.wat} (97%) create mode 100644 felt-repr/tests/expected/onchain_mixed_types_no_u64.hir rename felt-repr/tests/expected/{onchain_mixed_types_struct.masm => onchain_mixed_types_no_u64.masm} (92%) create mode 100644 felt-repr/tests/expected/onchain_mixed_types_no_u64.wat delete mode 100644 felt-repr/tests/expected/onchain_mixed_types_struct.hir diff --git a/felt-repr/tests/expected/onchain_minimal_u64_bug.hir b/felt-repr/tests/expected/onchain_minimal_u64_bug.hir new file mode 100644 index 000000000..1a1c790e2 --- /dev/null +++ b/felt-repr/tests/expected/onchain_minimal_u64_bug.hir @@ -0,0 +1,1326 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @onchain_minimal_u64_bug { + private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { + ^block4(v0: i32, v1: felt): + v4 = arith.constant 8 : u32; + v3 = hir.bitcast v0 : u32; + v5 = arith.add v3, v4 : u32 #[overflow = checked]; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : i32; + v10 = hir.bitcast v0 : u32; + v981 = arith.constant 4 : u32; + v12 = arith.mod v10, v981 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v2 = arith.constant 0 : i32; + v15 = arith.neq v9, v14 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v2 : i1; + scf.if v19{ + ^block104: + scf.yield ; + } else { + ^block7: + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVec::grow_one(v0) + scf.yield ; + }; + v980 = arith.constant 4 : u32; + v21 = hir.bitcast v0 : u32; + v23 = arith.add v21, v980 : u32 #[overflow = checked]; + v979 = arith.constant 4 : u32; + v25 = arith.mod v23, v979 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; + v971 = arith.constant 2 : u32; + v31 = arith.shl v9, v971 : i32; + v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; + v34 = hir.bitcast v32 : u32; + v978 = arith.constant 4 : u32; + v36 = arith.mod v34, v978 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v1; + v977 = arith.constant 8 : u32; + v40 = hir.bitcast v0 : u32; + v42 = arith.add v40, v977 : u32 #[overflow = checked]; + v976 = arith.constant 4 : u32; + v44 = arith.mod v42, v976 : u32; + hir.assertz v44 #[code = 250]; + v38 = arith.constant 1 : i32; + v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { + ^block8(v46: i32): + v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 16 : i32; + v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v54 = hir.bitcast v53 : ptr; + hir.store v54, v52; + v57 = hir.bitcast v46 : u32; + v58 = arith.constant 4 : u32; + v59 = arith.mod v57, v58 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i32; + v63 = arith.constant 4 : i32; + v62 = arith.constant 1 : i32; + v55 = arith.constant 8 : i32; + v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) + v66 = arith.constant 8 : u32; + v65 = hir.bitcast v52 : u32; + v67 = arith.add v65, v66 : u32 #[overflow = checked]; + v985 = arith.constant 4 : u32; + v69 = arith.mod v67, v985 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v47 = arith.constant 0 : i32; + v72 = arith.constant -2147483647 : i32; + v73 = arith.eq v71, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v47 : i1; + cf.cond_br v77 ^block10, ^block11; + ^block10: + v984 = arith.constant 16 : i32; + v87 = arith.add v52, v984 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; + builtin.ret ; + ^block11: + v79 = arith.constant 12 : u32; + v78 = hir.bitcast v52 : u32; + v80 = arith.add v78, v79 : u32 #[overflow = checked]; + v983 = arith.constant 4 : u32; + v82 = arith.mod v80, v983 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::handle_error(v71, v84, v85) + ub.unreachable ; + }; + + public builtin.function @entrypoint(v90: i32, v91: i32) { + ^block12(v90: i32, v91: i32): + v96 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; + v99 = arith.constant 32 : i32; + v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; + v101 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v102 = hir.bitcast v101 : ptr; + hir.store v102, v100; + v103 = hir.bitcast v91 : u32; + v104 = arith.constant 4 : u32; + v105 = arith.mod v103, v104 : u32; + hir.assertz v105 #[code = 250]; + v106 = hir.int_to_ptr v103 : ptr; + v107 = hir.load v106 : felt; + v108 = arith.constant 111111 : i32; + v109 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::from_u32(v108) : felt + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::assert_eq(v107, v109) + v111 = arith.constant 16 : u32; + v110 = hir.bitcast v91 : u32; + v112 = arith.add v110, v111 : u32 #[overflow = checked]; + v1016 = arith.constant 4 : u32; + v114 = arith.mod v112, v1016 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + v116 = hir.load v115 : felt; + v117 = arith.constant 55 : i32; + v118 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::from_u32(v117) : felt + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::assert_eq(v116, v118) + v119 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v107) : i64 + v1015 = arith.constant 4 : u32; + v120 = hir.bitcast v91 : u32; + v122 = arith.add v120, v1015 : u32 #[overflow = checked]; + v1014 = arith.constant 4 : u32; + v124 = arith.mod v122, v1014 : u32; + hir.assertz v124 #[code = 250]; + v125 = hir.int_to_ptr v122 : ptr; + v126 = hir.load v125 : felt; + v127 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v126) : i64 + v129 = arith.constant 8 : u32; + v128 = hir.bitcast v91 : u32; + v130 = arith.add v128, v129 : u32 #[overflow = checked]; + v1013 = arith.constant 4 : u32; + v132 = arith.mod v130, v1013 : u32; + hir.assertz v132 #[code = 250]; + v133 = hir.int_to_ptr v130 : ptr; + v134 = hir.load v133 : felt; + v135 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v134) : i64 + v137 = arith.constant 12 : u32; + v136 = hir.bitcast v91 : u32; + v138 = arith.add v136, v137 : u32 #[overflow = checked]; + v1012 = arith.constant 4 : u32; + v140 = arith.mod v138, v1012 : u32; + hir.assertz v140 #[code = 250]; + v141 = hir.int_to_ptr v138 : ptr; + v142 = hir.load v141 : felt; + v143 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v142) : i64 + v144 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v116) : i64 + v149 = arith.constant 4 : i32; + v92 = arith.constant 0 : i32; + v147 = arith.constant 256 : i32; + v145 = arith.constant 20 : i32; + v146 = arith.add v100, v145 : i32 #[overflow = wrapping]; + hir.store_local v90 #[local = lv0]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVecInner::try_allocate_in(v146, v147, v92, v149, v149) + v152 = arith.constant 24 : u32; + v151 = hir.bitcast v100 : u32; + v153 = arith.add v151, v152 : u32 #[overflow = checked]; + v1011 = arith.constant 4 : u32; + v155 = arith.mod v153, v1011 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : i32; + v159 = arith.constant 20 : u32; + v158 = hir.bitcast v100 : u32; + v160 = arith.add v158, v159 : u32 #[overflow = checked]; + v1010 = arith.constant 4 : u32; + v162 = arith.mod v160, v1010 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + v164 = hir.load v163 : i32; + v1009 = arith.constant 0 : i32; + v165 = arith.constant 1 : i32; + v166 = arith.neq v164, v165 : i1; + v167 = arith.zext v166 : u32; + v168 = hir.bitcast v167 : i32; + v170 = arith.neq v168, v1009 : i1; + cf.cond_br v170 ^block14, ^block15; + ^block14: + v1008 = arith.constant 8 : i32; + v179 = arith.constant 8 : i32; + v180 = arith.add v100, v179 : i32 #[overflow = wrapping]; + v182 = arith.add v180, v1008 : i32 #[overflow = wrapping]; + v184 = hir.bitcast v182 : u32; + v1007 = arith.constant 4 : u32; + v186 = arith.mod v184, v1007 : u32; + hir.assertz v186 #[code = 250]; + v1006 = arith.constant 0 : i32; + v187 = hir.int_to_ptr v184 : ptr; + hir.store v187, v1006; + v189 = arith.constant 28 : u32; + v188 = hir.bitcast v100 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v1005 = arith.constant 4 : u32; + v192 = arith.mod v190, v1005 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : i32; + v1004 = arith.constant 12 : u32; + v195 = hir.bitcast v100 : u32; + v197 = arith.add v195, v1004 : u32 #[overflow = checked]; + v1003 = arith.constant 4 : u32; + v199 = arith.mod v197, v1003 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + hir.store v200, v194; + v1002 = arith.constant 8 : u32; + v201 = hir.bitcast v100 : u32; + v203 = arith.add v201, v1002 : u32 #[overflow = checked]; + v1001 = arith.constant 4 : u32; + v205 = arith.mod v203, v1001 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v157; + v209 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::from_u64_unchecked(v119) : felt + v1000 = arith.constant 8 : i32; + v208 = arith.add v100, v1000 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v208, v209) + v212 = arith.trunc v127 : i32; + v213 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v212) : felt + v999 = arith.constant 8 : i32; + v211 = arith.add v100, v999 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v211, v213) + v216 = arith.trunc v135 : i32; + v217 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v216) : felt + v998 = arith.constant 8 : i32; + v215 = arith.add v100, v998 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v215, v217) + v220 = arith.trunc v143 : i32; + v221 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v220) : felt + v997 = arith.constant 8 : i32; + v219 = arith.add v100, v997 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v219, v221) + v224 = arith.trunc v144 : i32; + v225 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v224) : felt + v996 = arith.constant 8 : i32; + v223 = arith.add v100, v996 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v223, v225) + v228 = hir.bitcast v182 : u32; + v995 = arith.constant 4 : u32; + v230 = arith.mod v228, v995 : u32; + hir.assertz v230 #[code = 250]; + v231 = hir.int_to_ptr v228 : ptr; + v232 = hir.load v231 : i32; + v994 = arith.constant 8 : i32; + v1018 = hir.load_local : i32 #[local = lv0]; + v227 = arith.add v1018, v994 : i32 #[overflow = wrapping]; + v233 = hir.bitcast v227 : u32; + v993 = arith.constant 4 : u32; + v235 = arith.mod v233, v993 : u32; + hir.assertz v235 #[code = 250]; + v236 = hir.int_to_ptr v233 : ptr; + hir.store v236, v232; + v992 = arith.constant 8 : u32; + v237 = hir.bitcast v100 : u32; + v239 = arith.add v237, v992 : u32 #[overflow = checked]; + v991 = arith.constant 4 : u32; + v241 = arith.mod v239, v991 : u32; + hir.assertz v241 #[code = 250]; + v242 = hir.int_to_ptr v239 : ptr; + v243 = hir.load v242 : i64; + v244 = hir.bitcast v1018 : u32; + v990 = arith.constant 4 : u32; + v246 = arith.mod v244, v990 : u32; + hir.assertz v246 #[code = 250]; + v247 = hir.int_to_ptr v244 : ptr; + hir.store v247, v243; + v989 = arith.constant 32 : i32; + v249 = arith.add v100, v989 : i32 #[overflow = wrapping]; + v250 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v251 = hir.bitcast v250 : ptr; + hir.store v251, v249; + builtin.ret ; + ^block15: + v988 = arith.constant 28 : u32; + v171 = hir.bitcast v100 : u32; + v173 = arith.add v171, v988 : u32 #[overflow = checked]; + v987 = arith.constant 4 : u32; + v175 = arith.mod v173, v987 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i32; + v178 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::handle_error(v157, v177, v178) + ub.unreachable ; + }; + + private builtin.function @__rustc::__rust_alloc(v252: i32, v253: i32) -> i32 { + ^block16(v252: i32, v253: i32): + v255 = arith.constant 1048604 : i32; + v256 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::alloc(v255, v253, v252) : i32 + builtin.ret v256; + }; + + private builtin.function @__rustc::__rust_realloc(v257: i32, v258: i32, v259: i32, v260: i32) -> i32 { + ^block18(v257: i32, v258: i32, v259: i32, v260: i32): + v262 = arith.constant 1048604 : i32; + v263 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::alloc(v262, v259, v260) : i32 + v1027 = arith.constant 0 : i32; + v264 = arith.constant 0 : i32; + v265 = arith.eq v263, v264 : i1; + v266 = arith.zext v265 : u32; + v267 = hir.bitcast v266 : i32; + v269 = arith.neq v267, v1027 : i1; + scf.if v269{ + ^block20: + scf.yield ; + } else { + ^block21: + v1026 = arith.constant 0 : i32; + v271 = hir.bitcast v258 : u32; + v270 = hir.bitcast v260 : u32; + v272 = arith.lt v270, v271 : i1; + v273 = arith.zext v272 : u32; + v274 = hir.bitcast v273 : i32; + v276 = arith.neq v274, v1026 : i1; + v277 = cf.select v276, v260, v258 : i32; + v1024 = arith.constant 0 : i32; + v1025 = arith.constant 0 : i32; + v279 = arith.eq v277, v1025 : i1; + v280 = arith.zext v279 : u32; + v281 = hir.bitcast v280 : i32; + v283 = arith.neq v281, v1024 : i1; + scf.if v283{ + ^block110: + scf.yield ; + } else { + ^block22: + v284 = hir.bitcast v277 : u32; + v285 = hir.bitcast v263 : u32; + v286 = hir.int_to_ptr v285 : ptr; + v287 = hir.bitcast v257 : u32; + v288 = hir.int_to_ptr v287 : ptr; + hir.mem_cpy v288, v286, v284; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v263; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v290: i32, v291: i32) -> i32 { + ^block23(v290: i32, v291: i32): + v293 = arith.constant 1048604 : i32; + v294 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::alloc(v293, v291, v290) : i32 + v1036 = arith.constant 0 : i32; + v295 = arith.constant 0 : i32; + v296 = arith.eq v294, v295 : i1; + v297 = arith.zext v296 : u32; + v298 = hir.bitcast v297 : i32; + v300 = arith.neq v298, v1036 : i1; + scf.if v300{ + ^block25: + scf.yield ; + } else { + ^block26: + v1034 = arith.constant 0 : i32; + v1035 = arith.constant 0 : i32; + v302 = arith.eq v290, v1035 : i1; + v303 = arith.zext v302 : u32; + v304 = hir.bitcast v303 : i32; + v306 = arith.neq v304, v1034 : i1; + scf.if v306{ + ^block113: + scf.yield ; + } else { + ^block27: + v1028 = arith.constant 0 : u8; + v309 = hir.bitcast v290 : u32; + v310 = hir.bitcast v294 : u32; + v311 = hir.int_to_ptr v310 : ptr; + hir.mem_set v311, v309, v1028; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v294; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block28: + builtin.ret ; + }; + + private builtin.function @::alloc(v313: i32, v314: i32, v315: i32) -> i32 { + ^block30(v313: i32, v314: i32, v315: i32): + v318 = arith.constant 16 : i32; + v317 = arith.constant 0 : i32; + v1038 = arith.constant 16 : u32; + v320 = hir.bitcast v314 : u32; + v322 = arith.gt v320, v1038 : i1; + v323 = arith.zext v322 : u32; + v324 = hir.bitcast v323 : i32; + v326 = arith.neq v324, v317 : i1; + v327 = cf.select v326, v314, v318 : i32; + v1078 = arith.constant 0 : i32; + v328 = arith.constant -1 : i32; + v329 = arith.add v327, v328 : i32 #[overflow = wrapping]; + v330 = arith.band v327, v329 : i32; + v332 = arith.neq v330, v1078 : i1; + v1047, v1048 = scf.if v332 : i32, u32 { + ^block118: + v1039 = arith.constant 0 : u32; + v1043 = ub.poison i32 : i32; + scf.yield v1043, v1039; + } else { + ^block33: + v334 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/core::ptr::alignment::Alignment::max(v314, v327) : i32 + v1077 = arith.constant 0 : i32; + v333 = arith.constant -2147483648 : i32; + v335 = arith.sub v333, v334 : i32 #[overflow = wrapping]; + v337 = hir.bitcast v335 : u32; + v336 = hir.bitcast v315 : u32; + v338 = arith.gt v336, v337 : i1; + v339 = arith.zext v338 : u32; + v340 = hir.bitcast v339 : i32; + v342 = arith.neq v340, v1077 : i1; + v1062 = scf.if v342 : i32 { + ^block117: + v1076 = ub.poison i32 : i32; + scf.yield v1076; + } else { + ^block34: + v1074 = arith.constant 0 : i32; + v348 = arith.sub v1074, v334 : i32 #[overflow = wrapping]; + v1075 = arith.constant -1 : i32; + v344 = arith.add v315, v334 : i32 #[overflow = wrapping]; + v346 = arith.add v344, v1075 : i32 #[overflow = wrapping]; + v349 = arith.band v346, v348 : i32; + v350 = hir.bitcast v313 : u32; + v351 = arith.constant 4 : u32; + v352 = arith.mod v350, v351 : u32; + hir.assertz v352 #[code = 250]; + v353 = hir.int_to_ptr v350 : ptr; + v354 = hir.load v353 : i32; + v1073 = arith.constant 0 : i32; + v356 = arith.neq v354, v1073 : i1; + scf.if v356{ + ^block116: + scf.yield ; + } else { + ^block36: + v357 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::mem::heap_base() : i32 + v358 = hir.mem_size : u32; + v364 = hir.bitcast v313 : u32; + v1072 = arith.constant 4 : u32; + v366 = arith.mod v364, v1072 : u32; + hir.assertz v366 #[code = 250]; + v1071 = arith.constant 16 : u32; + v359 = hir.bitcast v358 : i32; + v362 = arith.shl v359, v1071 : i32; + v363 = arith.add v357, v362 : i32 #[overflow = wrapping]; + v367 = hir.int_to_ptr v364 : ptr; + hir.store v367, v363; + scf.yield ; + }; + v370 = hir.bitcast v313 : u32; + v1070 = arith.constant 4 : u32; + v372 = arith.mod v370, v1070 : u32; + hir.assertz v372 #[code = 250]; + v373 = hir.int_to_ptr v370 : ptr; + v374 = hir.load v373 : i32; + v1068 = arith.constant 0 : i32; + v1069 = arith.constant -1 : i32; + v376 = arith.bxor v374, v1069 : i32; + v378 = hir.bitcast v376 : u32; + v377 = hir.bitcast v349 : u32; + v379 = arith.gt v377, v378 : i1; + v380 = arith.zext v379 : u32; + v381 = hir.bitcast v380 : i32; + v383 = arith.neq v381, v1068 : i1; + v1061 = scf.if v383 : i32 { + ^block37: + v1067 = arith.constant 0 : i32; + scf.yield v1067; + } else { + ^block38: + v385 = hir.bitcast v313 : u32; + v1066 = arith.constant 4 : u32; + v387 = arith.mod v385, v1066 : u32; + hir.assertz v387 #[code = 250]; + v384 = arith.add v374, v349 : i32 #[overflow = wrapping]; + v388 = hir.int_to_ptr v385 : ptr; + hir.store v388, v384; + v390 = arith.add v374, v334 : i32 #[overflow = wrapping]; + scf.yield v390; + }; + scf.yield v1061; + }; + v1044 = arith.constant 1 : u32; + v1065 = arith.constant 0 : u32; + v1063 = cf.select v342, v1065, v1044 : u32; + scf.yield v1062, v1063; + }; + v1064 = arith.constant 0 : u32; + v1060 = arith.eq v1048, v1064 : i1; + cf.cond_br v1060 ^block32, ^block120(v1047); + ^block32: + ub.unreachable ; + ^block120(v1040: i32): + builtin.ret v1040; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block39: + v393 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v393; + }; + + private builtin.function @>::from(v395: i32) -> felt { + ^block43(v395: i32): + v397 = hir.bitcast v395 : felt; + builtin.ret v397; + }; + + private builtin.function @intrinsics::felt::from_u64_unchecked(v398: i64) -> felt { + ^block45(v398: i64): + v399 = hir.cast v398 : felt; + builtin.ret v399; + }; + + private builtin.function @intrinsics::felt::from_u32(v401: i32) -> felt { + ^block47(v401: i32): + v402 = hir.bitcast v401 : felt; + builtin.ret v402; + }; + + private builtin.function @intrinsics::felt::as_u64(v404: felt) -> i64 { + ^block49(v404: felt): + v405 = hir.cast v404 : i64; + builtin.ret v405; + }; + + private builtin.function @intrinsics::felt::assert_eq(v407: felt, v408: felt) { + ^block51(v407: felt, v408: felt): + hir.assert_eq v407, v408; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v409: i32, v410: i32, v411: i32, v412: i32, v413: i32, v414: i32) { + ^block53(v409: i32, v410: i32, v411: i32, v412: i32, v413: i32, v414: i32): + v417 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v418 = hir.bitcast v417 : ptr; + v419 = hir.load v418 : i32; + v420 = arith.constant 32 : i32; + v421 = arith.sub v419, v420 : i32 #[overflow = wrapping]; + v422 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v423 = hir.bitcast v422 : ptr; + hir.store v423, v421; + v1155 = arith.constant 0 : i32; + v415 = arith.constant 0 : i32; + v426 = arith.eq v414, v415 : i1; + v427 = arith.zext v426 : u32; + v428 = hir.bitcast v427 : i32; + v430 = arith.neq v428, v1155 : i1; + v1126, v1127 = scf.if v430 : i32, i32 { + ^block56: + v1154 = arith.constant 0 : i32; + scf.yield v1154, v1154; + } else { + ^block57: + v431 = arith.add v411, v412 : i32 #[overflow = wrapping]; + v1153 = arith.constant 0 : i32; + v433 = hir.bitcast v411 : u32; + v432 = hir.bitcast v431 : u32; + v434 = arith.lt v432, v433 : i1; + v435 = arith.zext v434 : u32; + v436 = hir.bitcast v435 : i32; + v438 = arith.neq v436, v1153 : i1; + v1124, v1125 = scf.if v438 : i32, i32 { + ^block126: + v1152 = arith.constant 0 : i32; + scf.yield v1152, v1152; + } else { + ^block58: + v449 = hir.bitcast v410 : u32; + v563 = arith.constant 4 : u32; + v451 = arith.mod v449, v563 : u32; + hir.assertz v451 #[code = 250]; + v452 = hir.int_to_ptr v449 : ptr; + v453 = hir.load v452 : i32; + v1080 = arith.constant 1 : u32; + v456 = arith.shl v453, v1080 : i32; + v1151 = arith.constant 0 : i32; + v458 = hir.bitcast v456 : u32; + v457 = hir.bitcast v431 : u32; + v459 = arith.gt v457, v458 : i1; + v460 = arith.zext v459 : u32; + v461 = hir.bitcast v460 : i32; + v463 = arith.neq v461, v1151 : i1; + v464 = cf.select v463, v431, v456 : i32; + v1148 = arith.constant 1 : i32; + v466 = arith.constant 4 : i32; + v1149 = arith.constant 0 : i32; + v1079 = arith.constant 1025 : u32; + v469 = hir.bitcast v414 : u32; + v471 = arith.lt v469, v1079 : i1; + v472 = arith.zext v471 : u32; + v473 = hir.bitcast v472 : i32; + v475 = arith.neq v473, v1149 : i1; + v476 = cf.select v475, v466, v1148 : i32; + v465 = arith.constant 8 : i32; + v1150 = arith.constant 0 : i32; + v454 = arith.constant 1 : i32; + v478 = arith.eq v414, v454 : i1; + v479 = arith.zext v478 : u32; + v480 = hir.bitcast v479 : i32; + v482 = arith.neq v480, v1150 : i1; + v483 = cf.select v482, v465, v476 : i32; + v1147 = arith.constant 0 : i32; + v485 = hir.bitcast v483 : u32; + v484 = hir.bitcast v464 : u32; + v486 = arith.gt v484, v485 : i1; + v487 = arith.zext v486 : u32; + v488 = hir.bitcast v487 : i32; + v490 = arith.neq v488, v1147 : i1; + v491 = cf.select v490, v464, v483 : i32; + v492 = hir.bitcast v491 : u32; + v493 = arith.zext v492 : u64; + v494 = hir.bitcast v493 : i64; + v1146 = arith.constant 0 : i32; + v444 = arith.sub v1146, v413 : i32 #[overflow = wrapping]; + v441 = arith.constant -1 : i32; + v440 = arith.add v413, v414 : i32 #[overflow = wrapping]; + v442 = arith.add v440, v441 : i32 #[overflow = wrapping]; + v445 = arith.band v442, v444 : i32; + v446 = hir.bitcast v445 : u32; + v447 = arith.zext v446 : u64; + v448 = hir.bitcast v447 : i64; + v495 = arith.mul v448, v494 : i64 #[overflow = wrapping]; + v1145 = arith.constant 0 : i32; + v496 = arith.constant 32 : i64; + v498 = hir.cast v496 : u32; + v497 = hir.bitcast v495 : u64; + v499 = arith.shr v497, v498 : u64; + v500 = hir.bitcast v499 : i64; + v501 = arith.trunc v500 : i32; + v503 = arith.neq v501, v1145 : i1; + v1122, v1123 = scf.if v503 : i32, i32 { + ^block125: + v1144 = arith.constant 0 : i32; + scf.yield v464, v1144; + } else { + ^block59: + v504 = arith.trunc v495 : i32; + v1143 = arith.constant 0 : i32; + v505 = arith.constant -2147483648 : i32; + v506 = arith.sub v505, v413 : i32 #[overflow = wrapping]; + v508 = hir.bitcast v506 : u32; + v507 = hir.bitcast v504 : u32; + v509 = arith.gt v507, v508 : i1; + v510 = arith.zext v509 : u32; + v511 = hir.bitcast v510 : i32; + v513 = arith.neq v511, v1143 : i1; + v1120, v1121 = scf.if v513 : i32, i32 { + ^block124: + v1142 = arith.constant 0 : i32; + scf.yield v464, v1142; + } else { + ^block60: + v514 = arith.constant 20 : i32; + v515 = arith.add v421, v514 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVecInner::current_memory(v515, v410, v413, v414) + v1140 = arith.constant 20 : i32; + v519 = arith.add v421, v1140 : i32 #[overflow = wrapping]; + v1141 = arith.constant 8 : i32; + v517 = arith.add v421, v1141 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::finish_grow(v517, v413, v504, v519, v409) + v521 = arith.constant 12 : u32; + v520 = hir.bitcast v421 : u32; + v522 = arith.add v520, v521 : u32 #[overflow = checked]; + v1139 = arith.constant 4 : u32; + v524 = arith.mod v522, v1139 : u32; + hir.assertz v524 #[code = 250]; + v525 = hir.int_to_ptr v522 : ptr; + v526 = hir.load v525 : i32; + v528 = arith.constant 8 : u32; + v527 = hir.bitcast v421 : u32; + v529 = arith.add v527, v528 : u32 #[overflow = checked]; + v1138 = arith.constant 4 : u32; + v531 = arith.mod v529, v1138 : u32; + hir.assertz v531 #[code = 250]; + v532 = hir.int_to_ptr v529 : ptr; + v533 = hir.load v532 : i32; + v1136 = arith.constant 0 : i32; + v1137 = arith.constant 0 : i32; + v535 = arith.eq v533, v1137 : i1; + v536 = arith.zext v535 : u32; + v537 = hir.bitcast v536 : i32; + v539 = arith.neq v537, v1136 : i1; + v1118 = scf.if v539 : i32 { + ^block61: + v547 = hir.bitcast v410 : u32; + v1135 = arith.constant 4 : u32; + v549 = arith.mod v547, v1135 : u32; + hir.assertz v549 #[code = 250]; + v550 = hir.int_to_ptr v547 : ptr; + hir.store v550, v491; + v1134 = arith.constant 4 : u32; + v551 = hir.bitcast v410 : u32; + v553 = arith.add v551, v1134 : u32 #[overflow = checked]; + v1133 = arith.constant 4 : u32; + v555 = arith.mod v553, v1133 : u32; + hir.assertz v555 #[code = 250]; + v556 = hir.int_to_ptr v553 : ptr; + hir.store v556, v526; + scf.yield v464; + } else { + ^block62: + v541 = arith.constant 16 : u32; + v540 = hir.bitcast v421 : u32; + v542 = arith.add v540, v541 : u32 #[overflow = checked]; + v1132 = arith.constant 4 : u32; + v544 = arith.mod v542, v1132 : u32; + hir.assertz v544 #[code = 250]; + v545 = hir.int_to_ptr v542 : ptr; + v546 = hir.load v545 : i32; + scf.yield v546; + }; + v557 = arith.constant -2147483647 : i32; + v1119 = cf.select v539, v557, v526 : i32; + scf.yield v1118, v1119; + }; + scf.yield v1120, v1121; + }; + scf.yield v1122, v1123; + }; + scf.yield v1124, v1125; + }; + v1131 = arith.constant 4 : u32; + v562 = hir.bitcast v409 : u32; + v564 = arith.add v562, v1131 : u32 #[overflow = checked]; + v1130 = arith.constant 4 : u32; + v566 = arith.mod v564, v1130 : u32; + hir.assertz v566 #[code = 250]; + v567 = hir.int_to_ptr v564 : ptr; + hir.store v567, v1126; + v570 = hir.bitcast v409 : u32; + v1129 = arith.constant 4 : u32; + v572 = arith.mod v570, v1129 : u32; + hir.assertz v572 #[code = 250]; + v573 = hir.int_to_ptr v570 : ptr; + hir.store v573, v1127; + v1128 = arith.constant 32 : i32; + v577 = arith.add v421, v1128 : i32 #[overflow = wrapping]; + v578 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v579 = hir.bitcast v578 : ptr; + hir.store v579, v577; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v580: i32, v581: i32, v582: i32, v583: i32, v584: i32) { + ^block63(v580: i32, v581: i32, v582: i32, v583: i32, v584: i32): + v587 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v588 = hir.bitcast v587 : ptr; + v589 = hir.load v588 : i32; + v590 = arith.constant 16 : i32; + v591 = arith.sub v589, v590 : i32 #[overflow = wrapping]; + v592 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v593 = hir.bitcast v592 : ptr; + hir.store v593, v591; + v603 = hir.bitcast v581 : u32; + v604 = arith.zext v603 : u64; + v605 = hir.bitcast v604 : i64; + v585 = arith.constant 0 : i32; + v598 = arith.sub v585, v583 : i32 #[overflow = wrapping]; + v595 = arith.constant -1 : i32; + v594 = arith.add v583, v584 : i32 #[overflow = wrapping]; + v596 = arith.add v594, v595 : i32 #[overflow = wrapping]; + v599 = arith.band v596, v598 : i32; + v600 = hir.bitcast v599 : u32; + v601 = arith.zext v600 : u64; + v602 = hir.bitcast v601 : i64; + v606 = arith.mul v602, v605 : i64 #[overflow = wrapping]; + v1259 = arith.constant 0 : i32; + v607 = arith.constant 32 : i64; + v609 = hir.cast v607 : u32; + v608 = hir.bitcast v606 : u64; + v610 = arith.shr v608, v609 : u64; + v611 = hir.bitcast v610 : i64; + v612 = arith.trunc v611 : i32; + v614 = arith.neq v612, v1259 : i1; + v1171, v1172, v1173, v1174, v1175, v1176 = scf.if v614 : i32, i32, i32, i32, i32, u32 { + ^block132: + v1156 = arith.constant 0 : u32; + v1163 = ub.poison i32 : i32; + scf.yield v580, v591, v1163, v1163, v1163, v1156; + } else { + ^block68: + v615 = arith.trunc v606 : i32; + v1258 = arith.constant 0 : i32; + v616 = arith.constant -2147483648 : i32; + v617 = arith.sub v616, v583 : i32 #[overflow = wrapping]; + v619 = hir.bitcast v617 : u32; + v618 = hir.bitcast v615 : u32; + v620 = arith.lte v618, v619 : i1; + v621 = arith.zext v620 : u32; + v622 = hir.bitcast v621 : i32; + v624 = arith.neq v622, v1258 : i1; + v1219 = scf.if v624 : i32 { + ^block66: + v1257 = arith.constant 0 : i32; + v635 = arith.neq v615, v1257 : i1; + v1218 = scf.if v635 : i32 { + ^block70: + v1256 = arith.constant 0 : i32; + v651 = arith.neq v582, v1256 : i1; + v1217 = scf.if v651 : i32 { + ^block73: + v633 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::alloc::Global::alloc_impl(v591, v583, v615, v633) + v662 = hir.bitcast v591 : u32; + v707 = arith.constant 4 : u32; + v664 = arith.mod v662, v707 : u32; + hir.assertz v664 #[code = 250]; + v665 = hir.int_to_ptr v662 : ptr; + v666 = hir.load v665 : i32; + scf.yield v666; + } else { + ^block74: + v652 = arith.constant 8 : i32; + v653 = arith.add v591, v652 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::allocate(v653, v583, v615) + v637 = arith.constant 8 : u32; + v654 = hir.bitcast v591 : u32; + v656 = arith.add v654, v637 : u32 #[overflow = checked]; + v1255 = arith.constant 4 : u32; + v658 = arith.mod v656, v1255 : u32; + hir.assertz v658 #[code = 250]; + v659 = hir.int_to_ptr v656 : ptr; + v660 = hir.load v659 : i32; + scf.yield v660; + }; + v1253 = arith.constant 0 : i32; + v1254 = arith.constant 0 : i32; + v669 = arith.eq v1217, v1254 : i1; + v670 = arith.zext v669 : u32; + v671 = hir.bitcast v670 : i32; + v673 = arith.neq v671, v1253 : i1; + scf.if v673{ + ^block75: + v1252 = arith.constant 8 : u32; + v690 = hir.bitcast v580 : u32; + v692 = arith.add v690, v1252 : u32 #[overflow = checked]; + v1251 = arith.constant 4 : u32; + v694 = arith.mod v692, v1251 : u32; + hir.assertz v694 #[code = 250]; + v695 = hir.int_to_ptr v692 : ptr; + hir.store v695, v615; + v1250 = arith.constant 4 : u32; + v697 = hir.bitcast v580 : u32; + v699 = arith.add v697, v1250 : u32 #[overflow = checked]; + v1249 = arith.constant 4 : u32; + v701 = arith.mod v699, v1249 : u32; + hir.assertz v701 #[code = 250]; + v702 = hir.int_to_ptr v699 : ptr; + hir.store v702, v583; + scf.yield ; + } else { + ^block76: + v1248 = arith.constant 8 : u32; + v675 = hir.bitcast v580 : u32; + v677 = arith.add v675, v1248 : u32 #[overflow = checked]; + v1247 = arith.constant 4 : u32; + v679 = arith.mod v677, v1247 : u32; + hir.assertz v679 #[code = 250]; + v680 = hir.int_to_ptr v677 : ptr; + hir.store v680, v1217; + v1246 = arith.constant 4 : u32; + v682 = hir.bitcast v580 : u32; + v684 = arith.add v682, v1246 : u32 #[overflow = checked]; + v1245 = arith.constant 4 : u32; + v686 = arith.mod v684, v1245 : u32; + hir.assertz v686 #[code = 250]; + v687 = hir.int_to_ptr v684 : ptr; + hir.store v687, v581; + scf.yield ; + }; + v1243 = arith.constant 0 : i32; + v1244 = arith.constant 1 : i32; + v1216 = cf.select v673, v1244, v1243 : i32; + scf.yield v1216; + } else { + ^block71: + v1242 = arith.constant 8 : u32; + v636 = hir.bitcast v580 : u32; + v638 = arith.add v636, v1242 : u32 #[overflow = checked]; + v1241 = arith.constant 4 : u32; + v640 = arith.mod v638, v1241 : u32; + hir.assertz v640 #[code = 250]; + v641 = hir.int_to_ptr v638 : ptr; + hir.store v641, v583; + v1240 = arith.constant 4 : u32; + v644 = hir.bitcast v580 : u32; + v646 = arith.add v644, v1240 : u32 #[overflow = checked]; + v1239 = arith.constant 4 : u32; + v648 = arith.mod v646, v1239 : u32; + hir.assertz v648 #[code = 250]; + v1238 = arith.constant 0 : i32; + v649 = hir.int_to_ptr v646 : ptr; + hir.store v649, v1238; + v1237 = arith.constant 0 : i32; + scf.yield v1237; + }; + scf.yield v1218; + } else { + ^block69: + v1236 = ub.poison i32 : i32; + scf.yield v1236; + }; + v1231 = arith.constant 0 : u32; + v1164 = arith.constant 1 : u32; + v1224 = cf.select v624, v1164, v1231 : u32; + v1232 = ub.poison i32 : i32; + v1223 = cf.select v624, v591, v1232 : i32; + v1233 = ub.poison i32 : i32; + v1222 = cf.select v624, v580, v1233 : i32; + v1234 = ub.poison i32 : i32; + v1221 = cf.select v624, v1234, v591 : i32; + v1235 = ub.poison i32 : i32; + v1220 = cf.select v624, v1235, v580 : i32; + scf.yield v1220, v1221, v1222, v1219, v1223, v1224; + }; + v1177, v1178, v1179 = scf.index_switch v1176 : i32, i32, i32 + case 0 { + ^block67: + v1230 = arith.constant 4 : u32; + v627 = hir.bitcast v1171 : u32; + v629 = arith.add v627, v1230 : u32 #[overflow = checked]; + v1229 = arith.constant 4 : u32; + v631 = arith.mod v629, v1229 : u32; + hir.assertz v631 #[code = 250]; + v1228 = arith.constant 0 : i32; + v632 = hir.int_to_ptr v629 : ptr; + hir.store v632, v1228; + v1227 = arith.constant 1 : i32; + scf.yield v1171, v1227, v1172; + } + default { + ^block136: + scf.yield v1173, v1174, v1175; + }; + v706 = hir.bitcast v1177 : u32; + v1226 = arith.constant 4 : u32; + v708 = arith.mod v706, v1226 : u32; + hir.assertz v708 #[code = 250]; + v709 = hir.int_to_ptr v706 : ptr; + hir.store v709, v1178; + v1225 = arith.constant 16 : i32; + v714 = arith.add v1179, v1225 : i32 #[overflow = wrapping]; + v715 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v716 = hir.bitcast v715 : ptr; + hir.store v716, v714; + builtin.ret ; + }; + + private builtin.function @::allocate(v717: i32, v718: i32, v719: i32) { + ^block77(v717: i32, v718: i32, v719: i32): + v721 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v722 = hir.bitcast v721 : ptr; + v723 = hir.load v722 : i32; + v724 = arith.constant 16 : i32; + v725 = arith.sub v723, v724 : i32 #[overflow = wrapping]; + v726 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v727 = hir.bitcast v726 : ptr; + hir.store v727, v725; + v720 = arith.constant 0 : i32; + v728 = arith.constant 8 : i32; + v729 = arith.add v725, v728 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::alloc::Global::alloc_impl(v729, v718, v719, v720) + v732 = arith.constant 12 : u32; + v731 = hir.bitcast v725 : u32; + v733 = arith.add v731, v732 : u32 #[overflow = checked]; + v734 = arith.constant 4 : u32; + v735 = arith.mod v733, v734 : u32; + hir.assertz v735 #[code = 250]; + v736 = hir.int_to_ptr v733 : ptr; + v737 = hir.load v736 : i32; + v739 = arith.constant 8 : u32; + v738 = hir.bitcast v725 : u32; + v740 = arith.add v738, v739 : u32 #[overflow = checked]; + v1264 = arith.constant 4 : u32; + v742 = arith.mod v740, v1264 : u32; + hir.assertz v742 #[code = 250]; + v743 = hir.int_to_ptr v740 : ptr; + v744 = hir.load v743 : i32; + v745 = hir.bitcast v717 : u32; + v1263 = arith.constant 4 : u32; + v747 = arith.mod v745, v1263 : u32; + hir.assertz v747 #[code = 250]; + v748 = hir.int_to_ptr v745 : ptr; + hir.store v748, v744; + v1262 = arith.constant 4 : u32; + v749 = hir.bitcast v717 : u32; + v751 = arith.add v749, v1262 : u32 #[overflow = checked]; + v1261 = arith.constant 4 : u32; + v753 = arith.mod v751, v1261 : u32; + hir.assertz v753 #[code = 250]; + v754 = hir.int_to_ptr v751 : ptr; + hir.store v754, v737; + v1260 = arith.constant 16 : i32; + v756 = arith.add v725, v1260 : i32 #[overflow = wrapping]; + v757 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v758 = hir.bitcast v757 : ptr; + hir.store v758, v756; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v759: i32, v760: i32, v761: i32, v762: i32) { + ^block79(v759: i32, v760: i32, v761: i32, v762: i32): + v1280 = arith.constant 0 : i32; + v763 = arith.constant 0 : i32; + v764 = arith.eq v761, v763 : i1; + v765 = arith.zext v764 : u32; + v766 = hir.bitcast v765 : i32; + v768 = arith.neq v766, v1280 : i1; + v1276 = scf.if v768 : i32 { + ^block139: + scf.yield v760; + } else { + ^block82: + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1279 = arith.constant 0 : i32; + v770 = arith.neq v762, v1279 : i1; + v1275 = scf.if v770 : i32 { + ^block83: + v772 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_alloc_zeroed(v761, v760) : i32 + scf.yield v772; + } else { + ^block84: + v771 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_alloc(v761, v760) : i32 + scf.yield v771; + }; + scf.yield v1275; + }; + v776 = arith.constant 4 : u32; + v775 = hir.bitcast v759 : u32; + v777 = arith.add v775, v776 : u32 #[overflow = checked]; + v1278 = arith.constant 4 : u32; + v779 = arith.mod v777, v1278 : u32; + hir.assertz v779 #[code = 250]; + v780 = hir.int_to_ptr v777 : ptr; + hir.store v780, v761; + v782 = hir.bitcast v759 : u32; + v1277 = arith.constant 4 : u32; + v784 = arith.mod v782, v1277 : u32; + hir.assertz v784 #[code = 250]; + v785 = hir.int_to_ptr v782 : ptr; + hir.store v785, v1276; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v786: i32, v787: i32, v788: i32, v789: i32) { + ^block85(v786: i32, v787: i32, v788: i32, v789: i32): + v1306 = arith.constant 0 : i32; + v790 = arith.constant 0 : i32; + v794 = arith.eq v789, v790 : i1; + v795 = arith.zext v794 : u32; + v796 = hir.bitcast v795 : i32; + v798 = arith.neq v796, v1306 : i1; + v1293, v1294 = scf.if v798 : i32, i32 { + ^block143: + v1305 = arith.constant 0 : i32; + v792 = arith.constant 4 : i32; + scf.yield v792, v1305; + } else { + ^block88: + v799 = hir.bitcast v787 : u32; + v834 = arith.constant 4 : u32; + v801 = arith.mod v799, v834 : u32; + hir.assertz v801 #[code = 250]; + v802 = hir.int_to_ptr v799 : ptr; + v803 = hir.load v802 : i32; + v1303 = arith.constant 0 : i32; + v1304 = arith.constant 0 : i32; + v805 = arith.eq v803, v1304 : i1; + v806 = arith.zext v805 : u32; + v807 = hir.bitcast v806 : i32; + v809 = arith.neq v807, v1303 : i1; + v1291 = scf.if v809 : i32 { + ^block142: + v1302 = arith.constant 0 : i32; + scf.yield v1302; + } else { + ^block89: + v1301 = arith.constant 4 : u32; + v810 = hir.bitcast v786 : u32; + v812 = arith.add v810, v1301 : u32 #[overflow = checked]; + v1300 = arith.constant 4 : u32; + v814 = arith.mod v812, v1300 : u32; + hir.assertz v814 #[code = 250]; + v815 = hir.int_to_ptr v812 : ptr; + hir.store v815, v788; + v1299 = arith.constant 4 : u32; + v816 = hir.bitcast v787 : u32; + v818 = arith.add v816, v1299 : u32 #[overflow = checked]; + v1298 = arith.constant 4 : u32; + v820 = arith.mod v818, v1298 : u32; + hir.assertz v820 #[code = 250]; + v821 = hir.int_to_ptr v818 : ptr; + v822 = hir.load v821 : i32; + v823 = hir.bitcast v786 : u32; + v1297 = arith.constant 4 : u32; + v825 = arith.mod v823, v1297 : u32; + hir.assertz v825 #[code = 250]; + v826 = hir.int_to_ptr v823 : ptr; + hir.store v826, v822; + v827 = arith.mul v803, v789 : i32 #[overflow = wrapping]; + scf.yield v827; + }; + v828 = arith.constant 8 : i32; + v1296 = arith.constant 4 : i32; + v1292 = cf.select v809, v1296, v828 : i32; + scf.yield v1292, v1291; + }; + v831 = arith.add v786, v1293 : i32 #[overflow = wrapping]; + v833 = hir.bitcast v831 : u32; + v1295 = arith.constant 4 : u32; + v835 = arith.mod v833, v1295 : u32; + hir.assertz v835 #[code = 250]; + v836 = hir.int_to_ptr v833 : ptr; + hir.store v836, v1294; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::finish_grow(v837: i32, v838: i32, v839: i32, v840: i32, v841: i32) { + ^block90(v837: i32, v838: i32, v839: i32, v840: i32, v841: i32): + v843 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v844 = hir.bitcast v843 : ptr; + v845 = hir.load v844 : i32; + v846 = arith.constant 16 : i32; + v847 = arith.sub v845, v846 : i32 #[overflow = wrapping]; + v848 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v849 = hir.bitcast v848 : ptr; + hir.store v849, v847; + v1361 = arith.constant 0 : i32; + v842 = arith.constant 0 : i32; + v852 = arith.gte v839, v842 : i1; + v853 = arith.zext v852 : u32; + v854 = hir.bitcast v853 : i32; + v856 = arith.neq v854, v1361 : i1; + v1335, v1336 = scf.if v856 : i32, i32 { + ^block93: + v943 = arith.constant 4 : u32; + v859 = hir.bitcast v840 : u32; + v861 = arith.add v859, v943 : u32 #[overflow = checked]; + v1360 = arith.constant 4 : u32; + v863 = arith.mod v861, v1360 : u32; + hir.assertz v863 #[code = 250]; + v864 = hir.int_to_ptr v861 : ptr; + v865 = hir.load v864 : i32; + v1358 = arith.constant 0 : i32; + v1359 = arith.constant 0 : i32; + v867 = arith.eq v865, v1359 : i1; + v868 = arith.zext v867 : u32; + v869 = hir.bitcast v868 : i32; + v871 = arith.neq v869, v1358 : i1; + v1333, v1334 = scf.if v871 : i32, i32 { + ^block96: + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::allocate(v847, v838, v839) + v1357 = arith.constant 4 : u32; + v904 = hir.bitcast v847 : u32; + v906 = arith.add v904, v1357 : u32 #[overflow = checked]; + v1356 = arith.constant 4 : u32; + v908 = arith.mod v906, v1356 : u32; + hir.assertz v908 #[code = 250]; + v909 = hir.int_to_ptr v906 : ptr; + v910 = hir.load v909 : i32; + v911 = hir.bitcast v847 : u32; + v1355 = arith.constant 4 : u32; + v913 = arith.mod v911, v1355 : u32; + hir.assertz v913 #[code = 250]; + v914 = hir.int_to_ptr v911 : ptr; + v915 = hir.load v914 : i32; + scf.yield v915, v910; + } else { + ^block97: + v873 = arith.constant 8 : u32; + v872 = hir.bitcast v840 : u32; + v874 = arith.add v872, v873 : u32 #[overflow = checked]; + v1354 = arith.constant 4 : u32; + v876 = arith.mod v874, v1354 : u32; + hir.assertz v876 #[code = 250]; + v877 = hir.int_to_ptr v874 : ptr; + v878 = hir.load v877 : i32; + v1353 = arith.constant 0 : i32; + v880 = arith.neq v878, v1353 : i1; + v1331, v1332 = scf.if v880 : i32, i32 { + ^block98: + v898 = hir.bitcast v840 : u32; + v1352 = arith.constant 4 : u32; + v900 = arith.mod v898, v1352 : u32; + hir.assertz v900 #[code = 250]; + v901 = hir.int_to_ptr v898 : ptr; + v902 = hir.load v901 : i32; + v903 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_realloc(v902, v878, v838, v839) : i32 + scf.yield v903, v839; + } else { + ^block99: + v1351 = arith.constant 0 : i32; + v937 = arith.constant 8 : i32; + v882 = arith.add v847, v937 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::alloc::Global::alloc_impl(v882, v838, v839, v1351) + v885 = arith.constant 12 : u32; + v884 = hir.bitcast v847 : u32; + v886 = arith.add v884, v885 : u32 #[overflow = checked]; + v1350 = arith.constant 4 : u32; + v888 = arith.mod v886, v1350 : u32; + hir.assertz v888 #[code = 250]; + v889 = hir.int_to_ptr v886 : ptr; + v890 = hir.load v889 : i32; + v1349 = arith.constant 8 : u32; + v891 = hir.bitcast v847 : u32; + v893 = arith.add v891, v1349 : u32 #[overflow = checked]; + v1348 = arith.constant 4 : u32; + v895 = arith.mod v893, v1348 : u32; + hir.assertz v895 #[code = 250]; + v896 = hir.int_to_ptr v893 : ptr; + v897 = hir.load v896 : i32; + scf.yield v897, v890; + }; + scf.yield v1331, v1332; + }; + v1347 = arith.constant 4 : u32; + v922 = hir.bitcast v837 : u32; + v924 = arith.add v922, v1347 : u32 #[overflow = checked]; + v1346 = arith.constant 4 : u32; + v926 = arith.mod v924, v1346 : u32; + hir.assertz v926 #[code = 250]; + v1345 = arith.constant 0 : i32; + v920 = arith.neq v1333, v1345 : i1; + v921 = cf.select v920, v1333, v838 : i32; + v927 = hir.int_to_ptr v924 : ptr; + hir.store v927, v921; + v1343 = arith.constant 0 : i32; + v934 = arith.eq v1333, v1343 : i1; + v935 = arith.zext v934 : u32; + v936 = hir.bitcast v935 : i32; + v1344 = arith.constant 0 : i32; + v931 = arith.neq v1333, v1344 : i1; + v932 = cf.select v931, v1334, v839 : i32; + scf.yield v932, v936; + } else { + ^block94: + v857 = arith.constant 1 : i32; + v1342 = arith.constant 0 : i32; + scf.yield v1342, v857; + }; + v858 = arith.constant 4 : i32; + v1341 = arith.constant 8 : i32; + v1337 = cf.select v856, v1341, v858 : i32; + v940 = arith.add v837, v1337 : i32 #[overflow = wrapping]; + v942 = hir.bitcast v940 : u32; + v1340 = arith.constant 4 : u32; + v944 = arith.mod v942, v1340 : u32; + hir.assertz v944 #[code = 250]; + v945 = hir.int_to_ptr v942 : ptr; + hir.store v945, v1335; + v947 = hir.bitcast v837 : u32; + v1339 = arith.constant 4 : u32; + v949 = arith.mod v947, v1339 : u32; + hir.assertz v949 #[code = 250]; + v950 = hir.int_to_ptr v947 : ptr; + hir.store v950, v1336; + v1338 = arith.constant 16 : i32; + v954 = arith.add v847, v1338 : i32 #[overflow = wrapping]; + v955 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr + v956 = hir.bitcast v955 : ptr; + hir.store v956, v954; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v957: i32, v958: i32, v959: i32) { + ^block100(v957: i32, v958: i32, v959: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v960: i32, v961: i32) -> i32 { + ^block102(v960: i32, v961: i32): + v968 = arith.constant 0 : i32; + v964 = hir.bitcast v961 : u32; + v963 = hir.bitcast v960 : u32; + v965 = arith.gt v963, v964 : i1; + v966 = arith.zext v965 : u32; + v967 = hir.bitcast v966 : i32; + v969 = arith.neq v967, v968 : i1; + v970 = cf.select v969, v960, v961 : i32; + builtin.ret v970; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; + }; +}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_minimal_u64_bug.masm b/felt-repr/tests/expected/onchain_minimal_u64_bug.masm new file mode 100644 index 000000000..79df20aea --- /dev/null +++ b/felt-repr/tests/expected/onchain_minimal_u64_bug.masm @@ -0,0 +1,2614 @@ +# mod root_ns:root@1.0.0 + +proc init + push.1179648 + trace.240 + exec.::intrinsics::mem::heap_init + trace.252 + push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] + adv.push_mapval + push.262144 + push.2 + trace.240 + exec.::std::mem::pipe_preimage_to_memory + trace.252 + drop + push.1048576 + u32assert + mem_store.278536 +end + +# mod root_ns:root@1.0.0::onchain_minimal_u64_bug + +@callconv("C") +proc alloc::vec::Vec::push(i32, felt) + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + swap.1 + dup.2 + neq + neq + if.true + nop + else + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVec::grow_one + trace.252 + nop + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.2 + dup.2 + swap.1 + u32shl + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_felt + trace.252 + nop + push.8 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.1 + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVec::grow_one(i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.4 + push.1 + push.8 + dup.4 + u32wrapping_add + dup.2 + movup.2 + swap.3 + swap.4 + movdn.2 + swap.5 + swap.6 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVecInner::grow_amortized + trace.252 + nop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.2147483649 + dup.2 + eq + neq + if.true + drop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + push.12 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +pub proc entrypoint.1(i32, i32) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.111111 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::assert_eq + trace.252 + nop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + push.55 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::from_u32 + trace.252 + nop + dup.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::assert_eq + trace.252 + nop + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 + trace.252 + nop + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 + trace.252 + nop + push.8 + dup.8 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 + trace.252 + nop + push.12 + movup.10 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_felt + trace.252 + nop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 + trace.252 + nop + movup.8 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 + trace.252 + nop + push.4 + push.0 + push.256 + push.20 + dup.14 + u32wrapping_add + movup.15 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.3 + swap.4 + swap.3 + swap.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVecInner::try_allocate_in + trace.252 + nop + push.24 + dup.11 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.20 + dup.12 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.1 + movup.2 + neq + neq + if.true + push.8 + push.8 + dup.13 + u32wrapping_add + u32wrapping_add + dup.0 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.28 + dup.13 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.12 + dup.14 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.13 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.10 + movup.10 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::from_u64_unchecked + trace.252 + nop + push.8 + dup.11 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push + trace.252 + nop + movup.8 + movup.8 + drop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from + trace.252 + nop + push.8 + dup.9 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push + trace.252 + nop + movup.6 + movup.6 + drop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from + trace.252 + nop + push.8 + dup.7 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push + trace.252 + nop + movup.4 + movup.4 + drop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from + trace.252 + nop + push.8 + dup.5 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push + trace.252 + nop + movdn.2 + drop + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from + trace.252 + nop + push.8 + dup.3 + u32wrapping_add + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push + trace.252 + nop + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + locaddr.0 + push.0 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.0 + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_dw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_dw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movdn.10 + dropw + dropw + drop + drop + push.28 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1048588 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::handle_error + trace.252 + nop + push.0 + assert + end +end + +@callconv("C") +proc __rustc::__rust_alloc(i32, i32) -> i32 + push.1048604 + movup.2 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::alloc + trace.252 + nop +end + +@callconv("C") +proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 + push.1048604 + dup.4 + swap.2 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + movdn.3 + drop + drop + drop + else + push.0 + dup.2 + dup.5 + swap.1 + u32lt + neq + swap.1 + swap.4 + swap.1 + cdrop + push.0 + push.0 + dup.2 + eq + neq + if.true + drop + drop + else + dup.2 + movup.2 + push.0 + dup.3 + push.0 + gte + while.true + dup.2 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.2 + dup.2 + push.1 + u32overflowing_madd + assertz + u32divmod.4 + swap.1 + swap.1 + dup.1 + mem_load + swap.1 + push.8 + u32wrapping_mul + u32shr + swap.1 + drop + push.255 + u32and + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.4 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 + push.1048604 + dup.1 + swap.2 + swap.3 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::alloc + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + if.true + swap.1 + drop + else + push.0 + push.0 + dup.3 + eq + neq + if.true + swap.1 + drop + else + push.0 + movup.2 + dup.2 + push.0 + dup.2 + push.0 + gte + while.true + dup.1 + dup.1 + push.1 + u32overflowing_madd + assertz + dup.4 + swap.1 + u32divmod.4 + swap.1 + dup.0 + mem_load + dup.2 + push.8 + u32wrapping_mul + push.255 + swap.1 + u32shl + u32not + swap.1 + u32and + movup.3 + movup.3 + push.8 + u32wrapping_mul + u32shl + u32or + swap.1 + mem_store + u32wrapping_add.1 + dup.0 + dup.3 + u32gte + end + dropw + end + end +end + +@callconv("C") +proc __rustc::__rust_no_alloc_shim_is_unstable_v2( + +) + nop +end + +@callconv("C") +proc ::alloc( + i32, + i32, + i32 +) -> i32 + push.16 + push.0 + push.16 + dup.4 + swap.1 + u32gt + neq + dup.3 + swap.1 + cdrop + push.0 + push.4294967295 + dup.2 + u32wrapping_add + dup.2 + u32and + neq + if.true + dropw + push.0 + push.3735929054 + else + movup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::core::ptr::alignment::Alignment::max + trace.252 + nop + push.0 + push.2147483648 + dup.2 + u32wrapping_sub + dup.4 + swap.1 + u32gt + neq + dup.0 + if.true + movdn.3 + drop + drop + drop + push.3735929054 + else + push.0 + dup.2 + u32wrapping_sub + push.4294967295 + movup.5 + dup.4 + u32wrapping_add + u32wrapping_add + u32and + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + neq + if.true + nop + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::mem::heap_base + trace.252 + nop + trace.240 + nop + exec.::intrinsics::mem::memory_size + trace.252 + nop + dup.5 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.16 + movup.2 + swap.1 + u32shl + movup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.4294967295 + dup.2 + u32xor + dup.3 + swap.1 + u32gt + neq + if.true + drop + drop + movdn.2 + drop + drop + push.0 + else + movup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + dup.2 + u32wrapping_add + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + u32wrapping_add + end + end + push.1 + push.0 + movup.3 + cdrop + swap.1 + end + push.0 + movup.2 + eq + if.true + drop + push.0 + assert + else + nop + end +end + +@callconv("C") +proc intrinsics::mem::heap_base( + +) -> i32 + trace.240 + nop + exec.::intrinsics::mem::heap_base + trace.252 + nop +end + +@callconv("C") +proc >::from( + i32 +) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt + dup.1 + dup.1 + push.1 + push.4294967295 + trace.240 + nop + exec.::std::math::u64::lt + trace.252 + nop + assert + mul.4294967296 + add +end + +@callconv("C") +proc intrinsics::felt::from_u32(i32) -> felt + nop +end + +@callconv("C") +proc intrinsics::felt::as_u64(felt) -> [u32; 2] + u32split +end + +@callconv("C") +proc intrinsics::felt::assert_eq(felt, felt) + assert_eq +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::grow_amortized( + i32, + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.32 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.8 + eq + neq + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + movup.4 + dup.4 + u32wrapping_add + push.0 + movup.5 + dup.2 + swap.1 + u32lt + neq + if.true + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + dup.0 + else + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.1 + u32shl + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + movup.2 + swap.1 + cdrop + push.1 + push.4 + push.0 + push.1025 + dup.9 + swap.1 + u32lt + neq + cdrop + push.8 + push.0 + push.1 + dup.9 + eq + neq + cdrop + push.0 + dup.1 + dup.3 + swap.1 + u32gt + neq + dup.2 + swap.1 + cdrop + dup.0 + push.0 + push.0 + dup.8 + u32wrapping_sub + push.4294967295 + dup.9 + dup.11 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + drop + push.0 + push.2147483648 + dup.8 + u32wrapping_sub + dup.2 + swap.1 + u32gt + neq + if.true + drop + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.0 + swap.1 + else + push.20 + dup.4 + u32wrapping_add + dup.6 + dup.8 + movup.3 + swap.10 + movdn.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVecInner::current_memory + trace.252 + nop + push.20 + dup.3 + u32wrapping_add + push.8 + dup.4 + u32wrapping_add + dup.5 + movup.2 + swap.3 + swap.9 + movdn.2 + swap.4 + swap.8 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::finish_grow + trace.252 + nop + push.12 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + dup.0 + if.true + dup.4 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.7 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + dup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.4 + else + movup.2 + swap.6 + movdn.2 + swap.1 + swap.5 + swap.1 + swap.4 + drop + drop + drop + push.16 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + swap.1 + swap.4 + swap.3 + swap.2 + swap.1 + end + push.2147483649 + movdn.2 + movdn.3 + cdrop + swap.1 + end + end + end + end + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.32 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::try_allocate_in( + i32, + i32, + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + dup.2 + push.0 + push.0 + dup.7 + u32wrapping_sub + push.4294967295 + movup.9 + dup.9 + u32wrapping_add + u32wrapping_add + u32and + push.0 + trace.240 + nop + exec.::intrinsics::i64::wrapping_mul + trace.252 + nop + push.0 + push.32 + push.0 + dup.0 + push.2147483648 + u32and + eq.2147483648 + assertz + assertz + dup.0 + push.4294967295 + u32lte + assert + dup.3 + dup.3 + movup.2 + trace.240 + nop + exec.::std::math::u64::shr + trace.252 + nop + drop + neq + if.true + drop + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + push.3735929054 + dup.0 + dup.1 + swap.4 + swap.1 + swap.3 + swap.5 + else + drop + push.0 + push.2147483648 + dup.7 + u32wrapping_sub + dup.2 + swap.1 + u32lte + neq + dup.0 + if.true + push.0 + dup.2 + neq + if.true + push.0 + movup.6 + neq + if.true + push.1 + dup.3 + dup.7 + dup.4 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::alloc::Global::alloc_impl + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.3 + u32wrapping_add + dup.6 + dup.3 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::allocate + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + movup.6 + movup.2 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + else + movup.7 + movup.4 + drop + drop + push.8 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.2 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + end + push.0 + push.1 + movup.2 + cdrop + else + movup.2 + swap.5 + movdn.2 + swap.4 + swap.1 + drop + drop + drop + push.8 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.4 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + swap.1 + swap.3 + swap.2 + swap.1 + end + else + swap.1 + drop + movup.3 + drop + movup.3 + drop + movup.3 + drop + push.3735929054 + end + push.0 + push.1 + dup.3 + cdrop + push.3735929054 + dup.3 + dup.5 + swap.1 + cdrop + push.3735929054 + dup.4 + dup.7 + swap.1 + cdrop + push.3735929054 + dup.5 + movup.2 + swap.7 + movdn.2 + cdrop + push.3735929054 + movup.2 + swap.7 + movdn.2 + swap.1 + swap.5 + cdrop + swap.1 + swap.5 + swap.4 + swap.2 + swap.3 + swap.1 + end + movup.5 + eq.0 + if.true + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.4 + dup.1 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.1 + swap.1 + else + drop + drop + end + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc ::allocate( + i32, + i32, + i32 +) + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.8 + dup.2 + u32wrapping_add + movup.2 + swap.5 + movdn.2 + swap.1 + swap.3 + swap.4 + swap.1 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::alloc::Global::alloc_impl( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.4 + eq + neq + if.true + movup.3 + drop + swap.1 + else + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_no_alloc_shim_is_unstable_v2 + trace.252 + nop + push.0 + movup.4 + neq + if.true + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_alloc_zeroed + trace.252 + nop + else + swap.1 + dup.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_alloc + trace.252 + nop + end + end + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.3 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::RawVecInner::current_memory( + i32, + i32, + i32, + i32 +) + push.0 + push.0 + dup.5 + eq + neq + if.true + movdn.3 + drop + drop + drop + push.0 + push.4 + else + dup.1 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + dup.2 + eq + neq + dup.0 + if.true + swap.1 + drop + movup.2 + drop + movup.2 + drop + movup.2 + drop + push.0 + else + push.4 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + movup.5 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.4 + movup.4 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.3 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + swap.3 + trace.240 + nop + exec.::intrinsics::i32::wrapping_mul + trace.252 + nop + movup.2 + swap.1 + end + push.8 + push.4 + movup.3 + cdrop + end + movup.2 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) + movup.4 + drop + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.16 + u32wrapping_sub + push.1114144 + dup.1 + swap.1 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + push.0 + dup.5 + swap.1 + trace.240 + nop + exec.::intrinsics::i32::is_gte + trace.252 + nop + neq + dup.0 + if.true + push.4 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + push.0 + movup.2 + eq + neq + if.true + movup.5 + drop + dup.4 + dup.4 + dup.3 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::allocate + trace.252 + nop + push.4 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + else + push.8 + dup.6 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.0 + dup.1 + neq + if.true + movup.6 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + dup.5 + dup.7 + swap.3 + swap.1 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_realloc + trace.252 + nop + dup.5 + swap.1 + else + movup.6 + swap.1 + drop + drop + push.0 + push.8 + dup.3 + u32wrapping_add + dup.5 + dup.7 + swap.2 + trace.240 + nop + exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::alloc::Global::alloc_impl + trace.252 + nop + push.12 + dup.2 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + push.8 + dup.3 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::load_sw + trace.252 + nop + end + end + push.4 + dup.5 + add + u32assert + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + push.0 + dup.2 + neq + dup.2 + movup.2 + swap.8 + movdn.2 + swap.1 + cdrop + movup.6 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.0 + dup.1 + eq + push.0 + movup.2 + neq + swap.1 + swap.6 + swap.2 + swap.1 + cdrop + movup.4 + swap.1 + else + movup.2 + swap.5 + movdn.2 + swap.1 + swap.4 + swap.1 + swap.3 + drop + drop + drop + push.1 + push.0 + end + push.4 + push.8 + movup.4 + cdrop + dup.4 + u32wrapping_add + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + movup.2 + push.4 + dup.1 + swap.1 + u32mod + u32assert + assertz + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop + push.16 + u32wrapping_add + push.1114144 + u32divmod.4 + swap.1 + trace.240 + nop + exec.::intrinsics::mem::store_sw + trace.252 + nop +end + +@callconv("C") +proc alloc::raw_vec::handle_error(i32, i32, i32) + drop + drop + drop + push.0 + assert +end + +@callconv("C") +proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 + push.0 + dup.2 + dup.2 + swap.1 + u32gt + neq + cdrop +end + diff --git a/felt-repr/tests/expected/onchain_mixed_types_struct.wat b/felt-repr/tests/expected/onchain_minimal_u64_bug.wat similarity index 97% rename from felt-repr/tests/expected/onchain_mixed_types_struct.wat rename to felt-repr/tests/expected/onchain_minimal_u64_bug.wat index ef68babce..ba1afb17f 100644 --- a/felt-repr/tests/expected/onchain_mixed_types_struct.wat +++ b/felt-repr/tests/expected/onchain_minimal_u64_bug.wat @@ -1,4 +1,4 @@ -(module $onchain_mixed_types_struct.wasm +(module $onchain_minimal_u64_bug.wasm (type (;0;) (func (param i32 f32))) (type (;1;) (func (param i32))) (type (;2;) (func (param i32 i32))) @@ -84,41 +84,42 @@ global.set $__stack_pointer ) (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 i64 i64 i64 i32 i32) + (local i32 f32 f32 i64 i64 i64 i64 i64 i32) global.get $__stack_pointer i32.const 32 i32.sub local.tee 2 global.set $__stack_pointer local.get 1 - f32.load offset=4 - local.set 3 - local.get 1 f32.load - local.set 4 + local.tee 3 + i32.const 111111 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq local.get 1 - f32.load offset=8 + f32.load offset=16 + local.tee 4 + i32.const 55 + call $intrinsics::felt::from_u32 + call $intrinsics::felt::assert_eq + local.get 3 call $intrinsics::felt::as_u64 local.set 5 local.get 1 - f32.load offset=12 + f32.load offset=4 call $intrinsics::felt::as_u64 local.set 6 local.get 1 - f32.load offset=16 + f32.load offset=8 call $intrinsics::felt::as_u64 local.set 7 local.get 1 - f32.load offset=20 + f32.load offset=12 call $intrinsics::felt::as_u64 - i32.wrap_i64 - i32.const 255 - i32.and - local.tee 8 - call $>::from - i32.const 66 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq + local.set 8 + local.get 4 + call $intrinsics::felt::as_u64 + local.set 9 local.get 2 i32.const 20 i32.add @@ -148,7 +149,7 @@ i32.add i32.const 8 i32.add - local.tee 9 + local.tee 10 i32.const 0 i32.store local.get 2 @@ -161,16 +162,6 @@ local.get 2 i32.const 8 i32.add - local.get 4 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 3 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add local.get 5 call $intrinsics::felt::from_u64_unchecked call $alloc::vec::Vec::push @@ -178,7 +169,8 @@ i32.const 8 i32.add local.get 6 - call $intrinsics::felt::from_u64_unchecked + i32.wrap_i64 + call $>::from call $alloc::vec::Vec::push local.get 2 i32.const 8 @@ -191,12 +183,20 @@ i32.const 8 i32.add local.get 8 + i32.wrap_i64 call $>::from call $alloc::vec::Vec::push - local.get 0 + local.get 2 i32.const 8 i32.add local.get 9 + i32.wrap_i64 + call $>::from + call $alloc::vec::Vec::push + local.get 0 + i32.const 8 + i32.add + local.get 10 i32.load i32.store local.get 0 diff --git a/felt-repr/tests/expected/onchain_mixed_types_no_u64.hir b/felt-repr/tests/expected/onchain_mixed_types_no_u64.hir new file mode 100644 index 000000000..057dbc279 --- /dev/null +++ b/felt-repr/tests/expected/onchain_mixed_types_no_u64.hir @@ -0,0 +1,1305 @@ +builtin.component root_ns:root@1.0.0 { + builtin.module public @onchain_mixed_types_no_u64 { + private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { + ^block4(v0: i32, v1: felt): + v4 = arith.constant 8 : u32; + v3 = hir.bitcast v0 : u32; + v5 = arith.add v3, v4 : u32 #[overflow = checked]; + v6 = arith.constant 4 : u32; + v7 = arith.mod v5, v6 : u32; + hir.assertz v7 #[code = 250]; + v8 = hir.int_to_ptr v5 : ptr; + v9 = hir.load v8 : i32; + v10 = hir.bitcast v0 : u32; + v972 = arith.constant 4 : u32; + v12 = arith.mod v10, v972 : u32; + hir.assertz v12 #[code = 250]; + v13 = hir.int_to_ptr v10 : ptr; + v14 = hir.load v13 : i32; + v2 = arith.constant 0 : i32; + v15 = arith.neq v9, v14 : i1; + v16 = arith.zext v15 : u32; + v17 = hir.bitcast v16 : i32; + v19 = arith.neq v17, v2 : i1; + scf.if v19{ + ^block98: + scf.yield ; + } else { + ^block7: + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVec::grow_one(v0) + scf.yield ; + }; + v971 = arith.constant 4 : u32; + v21 = hir.bitcast v0 : u32; + v23 = arith.add v21, v971 : u32 #[overflow = checked]; + v970 = arith.constant 4 : u32; + v25 = arith.mod v23, v970 : u32; + hir.assertz v25 #[code = 250]; + v26 = hir.int_to_ptr v23 : ptr; + v27 = hir.load v26 : i32; + v962 = arith.constant 2 : u32; + v31 = arith.shl v9, v962 : i32; + v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; + v34 = hir.bitcast v32 : u32; + v969 = arith.constant 4 : u32; + v36 = arith.mod v34, v969 : u32; + hir.assertz v36 #[code = 250]; + v37 = hir.int_to_ptr v34 : ptr; + hir.store v37, v1; + v968 = arith.constant 8 : u32; + v40 = hir.bitcast v0 : u32; + v42 = arith.add v40, v968 : u32 #[overflow = checked]; + v967 = arith.constant 4 : u32; + v44 = arith.mod v42, v967 : u32; + hir.assertz v44 #[code = 250]; + v38 = arith.constant 1 : i32; + v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; + v45 = hir.int_to_ptr v42 : ptr; + hir.store v45, v39; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { + ^block8(v46: i32): + v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v49 = hir.bitcast v48 : ptr; + v50 = hir.load v49 : i32; + v51 = arith.constant 16 : i32; + v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; + v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v54 = hir.bitcast v53 : ptr; + hir.store v54, v52; + v57 = hir.bitcast v46 : u32; + v58 = arith.constant 4 : u32; + v59 = arith.mod v57, v58 : u32; + hir.assertz v59 #[code = 250]; + v60 = hir.int_to_ptr v57 : ptr; + v61 = hir.load v60 : i32; + v63 = arith.constant 4 : i32; + v62 = arith.constant 1 : i32; + v55 = arith.constant 8 : i32; + v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) + v66 = arith.constant 8 : u32; + v65 = hir.bitcast v52 : u32; + v67 = arith.add v65, v66 : u32 #[overflow = checked]; + v976 = arith.constant 4 : u32; + v69 = arith.mod v67, v976 : u32; + hir.assertz v69 #[code = 250]; + v70 = hir.int_to_ptr v67 : ptr; + v71 = hir.load v70 : i32; + v47 = arith.constant 0 : i32; + v72 = arith.constant -2147483647 : i32; + v73 = arith.eq v71, v72 : i1; + v74 = arith.zext v73 : u32; + v75 = hir.bitcast v74 : i32; + v77 = arith.neq v75, v47 : i1; + cf.cond_br v77 ^block10, ^block11; + ^block10: + v975 = arith.constant 16 : i32; + v87 = arith.add v52, v975 : i32 #[overflow = wrapping]; + v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v89 = hir.bitcast v88 : ptr; + hir.store v89, v87; + builtin.ret ; + ^block11: + v79 = arith.constant 12 : u32; + v78 = hir.bitcast v52 : u32; + v80 = arith.add v78, v79 : u32 #[overflow = checked]; + v974 = arith.constant 4 : u32; + v82 = arith.mod v80, v974 : u32; + hir.assertz v82 #[code = 250]; + v83 = hir.int_to_ptr v80 : ptr; + v84 = hir.load v83 : i32; + v85 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::handle_error(v71, v84, v85) + ub.unreachable ; + }; + + public builtin.function @entrypoint(v90: i32, v91: i32) { + ^block12(v90: i32, v91: i32): + v96 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v97 = hir.bitcast v96 : ptr; + v98 = hir.load v97 : i32; + v99 = arith.constant 32 : i32; + v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; + v101 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v102 = hir.bitcast v101 : ptr; + hir.store v102, v100; + v104 = arith.constant 12 : u32; + v103 = hir.bitcast v91 : u32; + v105 = arith.add v103, v104 : u32 #[overflow = checked]; + v106 = arith.constant 4 : u32; + v107 = arith.mod v105, v106 : u32; + hir.assertz v107 #[code = 250]; + v108 = hir.int_to_ptr v105 : ptr; + v109 = hir.load v108 : felt; + v111 = arith.constant 8 : u32; + v110 = hir.bitcast v91 : u32; + v112 = arith.add v110, v111 : u32 #[overflow = checked]; + v1010 = arith.constant 4 : u32; + v114 = arith.mod v112, v1010 : u32; + hir.assertz v114 #[code = 250]; + v115 = hir.int_to_ptr v112 : ptr; + v116 = hir.load v115 : felt; + v1009 = arith.constant 4 : u32; + v117 = hir.bitcast v91 : u32; + v119 = arith.add v117, v1009 : u32 #[overflow = checked]; + v1008 = arith.constant 4 : u32; + v121 = arith.mod v119, v1008 : u32; + hir.assertz v121 #[code = 250]; + v122 = hir.int_to_ptr v119 : ptr; + v123 = hir.load v122 : felt; + v124 = hir.bitcast v91 : u32; + v1007 = arith.constant 4 : u32; + v126 = arith.mod v124, v1007 : u32; + hir.assertz v126 #[code = 250]; + v127 = hir.int_to_ptr v124 : ptr; + v128 = hir.load v127 : felt; + v130 = arith.constant 16 : u32; + v129 = hir.bitcast v91 : u32; + v131 = arith.add v129, v130 : u32 #[overflow = checked]; + v1006 = arith.constant 4 : u32; + v133 = arith.mod v131, v1006 : u32; + hir.assertz v133 #[code = 250]; + v134 = hir.int_to_ptr v131 : ptr; + v135 = hir.load v134 : felt; + v136 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/intrinsics::felt::as_u64(v135) : i64 + v138 = arith.constant 20 : u32; + v137 = hir.bitcast v91 : u32; + v139 = arith.add v137, v138 : u32 #[overflow = checked]; + v1005 = arith.constant 4 : u32; + v141 = arith.mod v139, v1005 : u32; + hir.assertz v141 #[code = 250]; + v142 = hir.int_to_ptr v139 : ptr; + v143 = hir.load v142 : felt; + v144 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/intrinsics::felt::as_u64(v143) : i64 + v149 = arith.constant 4 : i32; + v92 = arith.constant 0 : i32; + v147 = arith.constant 256 : i32; + v145 = arith.constant 20 : i32; + v146 = arith.add v100, v145 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVecInner::try_allocate_in(v146, v147, v92, v149, v149) + v152 = arith.constant 24 : u32; + v151 = hir.bitcast v100 : u32; + v153 = arith.add v151, v152 : u32 #[overflow = checked]; + v1004 = arith.constant 4 : u32; + v155 = arith.mod v153, v1004 : u32; + hir.assertz v155 #[code = 250]; + v156 = hir.int_to_ptr v153 : ptr; + v157 = hir.load v156 : i32; + v1003 = arith.constant 20 : u32; + v158 = hir.bitcast v100 : u32; + v160 = arith.add v158, v1003 : u32 #[overflow = checked]; + v1002 = arith.constant 4 : u32; + v162 = arith.mod v160, v1002 : u32; + hir.assertz v162 #[code = 250]; + v163 = hir.int_to_ptr v160 : ptr; + v164 = hir.load v163 : i32; + v1001 = arith.constant 0 : i32; + v165 = arith.constant 1 : i32; + v166 = arith.neq v164, v165 : i1; + v167 = arith.zext v166 : u32; + v168 = hir.bitcast v167 : i32; + v170 = arith.neq v168, v1001 : i1; + cf.cond_br v170 ^block14, ^block15; + ^block14: + v1000 = arith.constant 8 : i32; + v179 = arith.constant 8 : i32; + v180 = arith.add v100, v179 : i32 #[overflow = wrapping]; + v182 = arith.add v180, v1000 : i32 #[overflow = wrapping]; + v184 = hir.bitcast v182 : u32; + v999 = arith.constant 4 : u32; + v186 = arith.mod v184, v999 : u32; + hir.assertz v186 #[code = 250]; + v998 = arith.constant 0 : i32; + v187 = hir.int_to_ptr v184 : ptr; + hir.store v187, v998; + v189 = arith.constant 28 : u32; + v188 = hir.bitcast v100 : u32; + v190 = arith.add v188, v189 : u32 #[overflow = checked]; + v997 = arith.constant 4 : u32; + v192 = arith.mod v190, v997 : u32; + hir.assertz v192 #[code = 250]; + v193 = hir.int_to_ptr v190 : ptr; + v194 = hir.load v193 : i32; + v996 = arith.constant 12 : u32; + v195 = hir.bitcast v100 : u32; + v197 = arith.add v195, v996 : u32 #[overflow = checked]; + v995 = arith.constant 4 : u32; + v199 = arith.mod v197, v995 : u32; + hir.assertz v199 #[code = 250]; + v200 = hir.int_to_ptr v197 : ptr; + hir.store v200, v194; + v994 = arith.constant 8 : u32; + v201 = hir.bitcast v100 : u32; + v203 = arith.add v201, v994 : u32 #[overflow = checked]; + v993 = arith.constant 4 : u32; + v205 = arith.mod v203, v993 : u32; + hir.assertz v205 #[code = 250]; + v206 = hir.int_to_ptr v203 : ptr; + hir.store v206, v157; + v992 = arith.constant 8 : i32; + v208 = arith.add v100, v992 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v208, v128) + v991 = arith.constant 8 : i32; + v210 = arith.add v100, v991 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v210, v123) + v990 = arith.constant 8 : i32; + v212 = arith.add v100, v990 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v212, v116) + v989 = arith.constant 8 : i32; + v214 = arith.add v100, v989 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v214, v109) + v217 = arith.trunc v136 : i32; + v218 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/>::from(v217) : felt + v988 = arith.constant 8 : i32; + v216 = arith.add v100, v988 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v216, v218) + v222 = arith.constant 255 : i32; + v221 = arith.trunc v144 : i32; + v223 = arith.band v221, v222 : i32; + v224 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/>::from(v223) : felt + v987 = arith.constant 8 : i32; + v220 = arith.add v100, v987 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v220, v224) + v227 = hir.bitcast v182 : u32; + v986 = arith.constant 4 : u32; + v229 = arith.mod v227, v986 : u32; + hir.assertz v229 #[code = 250]; + v230 = hir.int_to_ptr v227 : ptr; + v231 = hir.load v230 : i32; + v985 = arith.constant 8 : i32; + v226 = arith.add v90, v985 : i32 #[overflow = wrapping]; + v232 = hir.bitcast v226 : u32; + v984 = arith.constant 4 : u32; + v234 = arith.mod v232, v984 : u32; + hir.assertz v234 #[code = 250]; + v235 = hir.int_to_ptr v232 : ptr; + hir.store v235, v231; + v983 = arith.constant 8 : u32; + v236 = hir.bitcast v100 : u32; + v238 = arith.add v236, v983 : u32 #[overflow = checked]; + v982 = arith.constant 4 : u32; + v240 = arith.mod v238, v982 : u32; + hir.assertz v240 #[code = 250]; + v241 = hir.int_to_ptr v238 : ptr; + v242 = hir.load v241 : i64; + v243 = hir.bitcast v90 : u32; + v981 = arith.constant 4 : u32; + v245 = arith.mod v243, v981 : u32; + hir.assertz v245 #[code = 250]; + v246 = hir.int_to_ptr v243 : ptr; + hir.store v246, v242; + v980 = arith.constant 32 : i32; + v248 = arith.add v100, v980 : i32 #[overflow = wrapping]; + v249 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v250 = hir.bitcast v249 : ptr; + hir.store v250, v248; + builtin.ret ; + ^block15: + v979 = arith.constant 28 : u32; + v171 = hir.bitcast v100 : u32; + v173 = arith.add v171, v979 : u32 #[overflow = checked]; + v978 = arith.constant 4 : u32; + v175 = arith.mod v173, v978 : u32; + hir.assertz v175 #[code = 250]; + v176 = hir.int_to_ptr v173 : ptr; + v177 = hir.load v176 : i32; + v178 = arith.constant 1048588 : i32; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::handle_error(v157, v177, v178) + ub.unreachable ; + }; + + private builtin.function @__rustc::__rust_alloc(v251: i32, v252: i32) -> i32 { + ^block16(v251: i32, v252: i32): + v254 = arith.constant 1048604 : i32; + v255 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::alloc(v254, v252, v251) : i32 + builtin.ret v255; + }; + + private builtin.function @__rustc::__rust_realloc(v256: i32, v257: i32, v258: i32, v259: i32) -> i32 { + ^block18(v256: i32, v257: i32, v258: i32, v259: i32): + v261 = arith.constant 1048604 : i32; + v262 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::alloc(v261, v258, v259) : i32 + v1019 = arith.constant 0 : i32; + v263 = arith.constant 0 : i32; + v264 = arith.eq v262, v263 : i1; + v265 = arith.zext v264 : u32; + v266 = hir.bitcast v265 : i32; + v268 = arith.neq v266, v1019 : i1; + scf.if v268{ + ^block20: + scf.yield ; + } else { + ^block21: + v1018 = arith.constant 0 : i32; + v270 = hir.bitcast v257 : u32; + v269 = hir.bitcast v259 : u32; + v271 = arith.lt v269, v270 : i1; + v272 = arith.zext v271 : u32; + v273 = hir.bitcast v272 : i32; + v275 = arith.neq v273, v1018 : i1; + v276 = cf.select v275, v259, v257 : i32; + v1016 = arith.constant 0 : i32; + v1017 = arith.constant 0 : i32; + v278 = arith.eq v276, v1017 : i1; + v279 = arith.zext v278 : u32; + v280 = hir.bitcast v279 : i32; + v282 = arith.neq v280, v1016 : i1; + scf.if v282{ + ^block104: + scf.yield ; + } else { + ^block22: + v283 = hir.bitcast v276 : u32; + v284 = hir.bitcast v262 : u32; + v285 = hir.int_to_ptr v284 : ptr; + v286 = hir.bitcast v256 : u32; + v287 = hir.int_to_ptr v286 : ptr; + hir.mem_cpy v287, v285, v283; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v262; + }; + + private builtin.function @__rustc::__rust_alloc_zeroed(v289: i32, v290: i32) -> i32 { + ^block23(v289: i32, v290: i32): + v292 = arith.constant 1048604 : i32; + v293 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::alloc(v292, v290, v289) : i32 + v1028 = arith.constant 0 : i32; + v294 = arith.constant 0 : i32; + v295 = arith.eq v293, v294 : i1; + v296 = arith.zext v295 : u32; + v297 = hir.bitcast v296 : i32; + v299 = arith.neq v297, v1028 : i1; + scf.if v299{ + ^block25: + scf.yield ; + } else { + ^block26: + v1026 = arith.constant 0 : i32; + v1027 = arith.constant 0 : i32; + v301 = arith.eq v289, v1027 : i1; + v302 = arith.zext v301 : u32; + v303 = hir.bitcast v302 : i32; + v305 = arith.neq v303, v1026 : i1; + scf.if v305{ + ^block107: + scf.yield ; + } else { + ^block27: + v1020 = arith.constant 0 : u8; + v308 = hir.bitcast v289 : u32; + v309 = hir.bitcast v293 : u32; + v310 = hir.int_to_ptr v309 : ptr; + hir.mem_set v310, v308, v1020; + scf.yield ; + }; + scf.yield ; + }; + builtin.ret v293; + }; + + private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { + ^block28: + builtin.ret ; + }; + + private builtin.function @::alloc(v312: i32, v313: i32, v314: i32) -> i32 { + ^block30(v312: i32, v313: i32, v314: i32): + v317 = arith.constant 16 : i32; + v316 = arith.constant 0 : i32; + v1030 = arith.constant 16 : u32; + v319 = hir.bitcast v313 : u32; + v321 = arith.gt v319, v1030 : i1; + v322 = arith.zext v321 : u32; + v323 = hir.bitcast v322 : i32; + v325 = arith.neq v323, v316 : i1; + v326 = cf.select v325, v313, v317 : i32; + v1070 = arith.constant 0 : i32; + v327 = arith.constant -1 : i32; + v328 = arith.add v326, v327 : i32 #[overflow = wrapping]; + v329 = arith.band v326, v328 : i32; + v331 = arith.neq v329, v1070 : i1; + v1039, v1040 = scf.if v331 : i32, u32 { + ^block112: + v1031 = arith.constant 0 : u32; + v1035 = ub.poison i32 : i32; + scf.yield v1035, v1031; + } else { + ^block33: + v333 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/core::ptr::alignment::Alignment::max(v313, v326) : i32 + v1069 = arith.constant 0 : i32; + v332 = arith.constant -2147483648 : i32; + v334 = arith.sub v332, v333 : i32 #[overflow = wrapping]; + v336 = hir.bitcast v334 : u32; + v335 = hir.bitcast v314 : u32; + v337 = arith.gt v335, v336 : i1; + v338 = arith.zext v337 : u32; + v339 = hir.bitcast v338 : i32; + v341 = arith.neq v339, v1069 : i1; + v1054 = scf.if v341 : i32 { + ^block111: + v1068 = ub.poison i32 : i32; + scf.yield v1068; + } else { + ^block34: + v1066 = arith.constant 0 : i32; + v347 = arith.sub v1066, v333 : i32 #[overflow = wrapping]; + v1067 = arith.constant -1 : i32; + v343 = arith.add v314, v333 : i32 #[overflow = wrapping]; + v345 = arith.add v343, v1067 : i32 #[overflow = wrapping]; + v348 = arith.band v345, v347 : i32; + v349 = hir.bitcast v312 : u32; + v350 = arith.constant 4 : u32; + v351 = arith.mod v349, v350 : u32; + hir.assertz v351 #[code = 250]; + v352 = hir.int_to_ptr v349 : ptr; + v353 = hir.load v352 : i32; + v1065 = arith.constant 0 : i32; + v355 = arith.neq v353, v1065 : i1; + scf.if v355{ + ^block110: + scf.yield ; + } else { + ^block36: + v356 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/intrinsics::mem::heap_base() : i32 + v357 = hir.mem_size : u32; + v363 = hir.bitcast v312 : u32; + v1064 = arith.constant 4 : u32; + v365 = arith.mod v363, v1064 : u32; + hir.assertz v365 #[code = 250]; + v1063 = arith.constant 16 : u32; + v358 = hir.bitcast v357 : i32; + v361 = arith.shl v358, v1063 : i32; + v362 = arith.add v356, v361 : i32 #[overflow = wrapping]; + v366 = hir.int_to_ptr v363 : ptr; + hir.store v366, v362; + scf.yield ; + }; + v369 = hir.bitcast v312 : u32; + v1062 = arith.constant 4 : u32; + v371 = arith.mod v369, v1062 : u32; + hir.assertz v371 #[code = 250]; + v372 = hir.int_to_ptr v369 : ptr; + v373 = hir.load v372 : i32; + v1060 = arith.constant 0 : i32; + v1061 = arith.constant -1 : i32; + v375 = arith.bxor v373, v1061 : i32; + v377 = hir.bitcast v375 : u32; + v376 = hir.bitcast v348 : u32; + v378 = arith.gt v376, v377 : i1; + v379 = arith.zext v378 : u32; + v380 = hir.bitcast v379 : i32; + v382 = arith.neq v380, v1060 : i1; + v1053 = scf.if v382 : i32 { + ^block37: + v1059 = arith.constant 0 : i32; + scf.yield v1059; + } else { + ^block38: + v384 = hir.bitcast v312 : u32; + v1058 = arith.constant 4 : u32; + v386 = arith.mod v384, v1058 : u32; + hir.assertz v386 #[code = 250]; + v383 = arith.add v373, v348 : i32 #[overflow = wrapping]; + v387 = hir.int_to_ptr v384 : ptr; + hir.store v387, v383; + v389 = arith.add v373, v333 : i32 #[overflow = wrapping]; + scf.yield v389; + }; + scf.yield v1053; + }; + v1036 = arith.constant 1 : u32; + v1057 = arith.constant 0 : u32; + v1055 = cf.select v341, v1057, v1036 : u32; + scf.yield v1054, v1055; + }; + v1056 = arith.constant 0 : u32; + v1052 = arith.eq v1040, v1056 : i1; + cf.cond_br v1052 ^block32, ^block114(v1039); + ^block32: + ub.unreachable ; + ^block114(v1032: i32): + builtin.ret v1032; + }; + + private builtin.function @intrinsics::mem::heap_base() -> i32 { + ^block39: + v392 = hir.exec @intrinsics/mem/heap_base() : i32 + builtin.ret v392; + }; + + private builtin.function @>::from(v394: i32) -> felt { + ^block43(v394: i32): + v396 = hir.bitcast v394 : felt; + builtin.ret v396; + }; + + private builtin.function @intrinsics::felt::as_u64(v397: felt) -> i64 { + ^block45(v397: felt): + v398 = hir.cast v397 : i64; + builtin.ret v398; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v400: i32, v401: i32, v402: i32, v403: i32, v404: i32, v405: i32) { + ^block47(v400: i32, v401: i32, v402: i32, v403: i32, v404: i32, v405: i32): + v408 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v409 = hir.bitcast v408 : ptr; + v410 = hir.load v409 : i32; + v411 = arith.constant 32 : i32; + v412 = arith.sub v410, v411 : i32 #[overflow = wrapping]; + v413 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v414 = hir.bitcast v413 : ptr; + hir.store v414, v412; + v1147 = arith.constant 0 : i32; + v406 = arith.constant 0 : i32; + v417 = arith.eq v405, v406 : i1; + v418 = arith.zext v417 : u32; + v419 = hir.bitcast v418 : i32; + v421 = arith.neq v419, v1147 : i1; + v1118, v1119 = scf.if v421 : i32, i32 { + ^block50: + v1146 = arith.constant 0 : i32; + scf.yield v1146, v1146; + } else { + ^block51: + v422 = arith.add v402, v403 : i32 #[overflow = wrapping]; + v1145 = arith.constant 0 : i32; + v424 = hir.bitcast v402 : u32; + v423 = hir.bitcast v422 : u32; + v425 = arith.lt v423, v424 : i1; + v426 = arith.zext v425 : u32; + v427 = hir.bitcast v426 : i32; + v429 = arith.neq v427, v1145 : i1; + v1116, v1117 = scf.if v429 : i32, i32 { + ^block120: + v1144 = arith.constant 0 : i32; + scf.yield v1144, v1144; + } else { + ^block52: + v440 = hir.bitcast v401 : u32; + v554 = arith.constant 4 : u32; + v442 = arith.mod v440, v554 : u32; + hir.assertz v442 #[code = 250]; + v443 = hir.int_to_ptr v440 : ptr; + v444 = hir.load v443 : i32; + v1072 = arith.constant 1 : u32; + v447 = arith.shl v444, v1072 : i32; + v1143 = arith.constant 0 : i32; + v449 = hir.bitcast v447 : u32; + v448 = hir.bitcast v422 : u32; + v450 = arith.gt v448, v449 : i1; + v451 = arith.zext v450 : u32; + v452 = hir.bitcast v451 : i32; + v454 = arith.neq v452, v1143 : i1; + v455 = cf.select v454, v422, v447 : i32; + v1140 = arith.constant 1 : i32; + v457 = arith.constant 4 : i32; + v1141 = arith.constant 0 : i32; + v1071 = arith.constant 1025 : u32; + v460 = hir.bitcast v405 : u32; + v462 = arith.lt v460, v1071 : i1; + v463 = arith.zext v462 : u32; + v464 = hir.bitcast v463 : i32; + v466 = arith.neq v464, v1141 : i1; + v467 = cf.select v466, v457, v1140 : i32; + v456 = arith.constant 8 : i32; + v1142 = arith.constant 0 : i32; + v445 = arith.constant 1 : i32; + v469 = arith.eq v405, v445 : i1; + v470 = arith.zext v469 : u32; + v471 = hir.bitcast v470 : i32; + v473 = arith.neq v471, v1142 : i1; + v474 = cf.select v473, v456, v467 : i32; + v1139 = arith.constant 0 : i32; + v476 = hir.bitcast v474 : u32; + v475 = hir.bitcast v455 : u32; + v477 = arith.gt v475, v476 : i1; + v478 = arith.zext v477 : u32; + v479 = hir.bitcast v478 : i32; + v481 = arith.neq v479, v1139 : i1; + v482 = cf.select v481, v455, v474 : i32; + v483 = hir.bitcast v482 : u32; + v484 = arith.zext v483 : u64; + v485 = hir.bitcast v484 : i64; + v1138 = arith.constant 0 : i32; + v435 = arith.sub v1138, v404 : i32 #[overflow = wrapping]; + v432 = arith.constant -1 : i32; + v431 = arith.add v404, v405 : i32 #[overflow = wrapping]; + v433 = arith.add v431, v432 : i32 #[overflow = wrapping]; + v436 = arith.band v433, v435 : i32; + v437 = hir.bitcast v436 : u32; + v438 = arith.zext v437 : u64; + v439 = hir.bitcast v438 : i64; + v486 = arith.mul v439, v485 : i64 #[overflow = wrapping]; + v1137 = arith.constant 0 : i32; + v487 = arith.constant 32 : i64; + v489 = hir.cast v487 : u32; + v488 = hir.bitcast v486 : u64; + v490 = arith.shr v488, v489 : u64; + v491 = hir.bitcast v490 : i64; + v492 = arith.trunc v491 : i32; + v494 = arith.neq v492, v1137 : i1; + v1114, v1115 = scf.if v494 : i32, i32 { + ^block119: + v1136 = arith.constant 0 : i32; + scf.yield v455, v1136; + } else { + ^block53: + v495 = arith.trunc v486 : i32; + v1135 = arith.constant 0 : i32; + v496 = arith.constant -2147483648 : i32; + v497 = arith.sub v496, v404 : i32 #[overflow = wrapping]; + v499 = hir.bitcast v497 : u32; + v498 = hir.bitcast v495 : u32; + v500 = arith.gt v498, v499 : i1; + v501 = arith.zext v500 : u32; + v502 = hir.bitcast v501 : i32; + v504 = arith.neq v502, v1135 : i1; + v1112, v1113 = scf.if v504 : i32, i32 { + ^block118: + v1134 = arith.constant 0 : i32; + scf.yield v455, v1134; + } else { + ^block54: + v505 = arith.constant 20 : i32; + v506 = arith.add v412, v505 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVecInner::current_memory(v506, v401, v404, v405) + v1132 = arith.constant 20 : i32; + v510 = arith.add v412, v1132 : i32 #[overflow = wrapping]; + v1133 = arith.constant 8 : i32; + v508 = arith.add v412, v1133 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::finish_grow(v508, v404, v495, v510, v400) + v512 = arith.constant 12 : u32; + v511 = hir.bitcast v412 : u32; + v513 = arith.add v511, v512 : u32 #[overflow = checked]; + v1131 = arith.constant 4 : u32; + v515 = arith.mod v513, v1131 : u32; + hir.assertz v515 #[code = 250]; + v516 = hir.int_to_ptr v513 : ptr; + v517 = hir.load v516 : i32; + v519 = arith.constant 8 : u32; + v518 = hir.bitcast v412 : u32; + v520 = arith.add v518, v519 : u32 #[overflow = checked]; + v1130 = arith.constant 4 : u32; + v522 = arith.mod v520, v1130 : u32; + hir.assertz v522 #[code = 250]; + v523 = hir.int_to_ptr v520 : ptr; + v524 = hir.load v523 : i32; + v1128 = arith.constant 0 : i32; + v1129 = arith.constant 0 : i32; + v526 = arith.eq v524, v1129 : i1; + v527 = arith.zext v526 : u32; + v528 = hir.bitcast v527 : i32; + v530 = arith.neq v528, v1128 : i1; + v1110 = scf.if v530 : i32 { + ^block55: + v538 = hir.bitcast v401 : u32; + v1127 = arith.constant 4 : u32; + v540 = arith.mod v538, v1127 : u32; + hir.assertz v540 #[code = 250]; + v541 = hir.int_to_ptr v538 : ptr; + hir.store v541, v482; + v1126 = arith.constant 4 : u32; + v542 = hir.bitcast v401 : u32; + v544 = arith.add v542, v1126 : u32 #[overflow = checked]; + v1125 = arith.constant 4 : u32; + v546 = arith.mod v544, v1125 : u32; + hir.assertz v546 #[code = 250]; + v547 = hir.int_to_ptr v544 : ptr; + hir.store v547, v517; + scf.yield v455; + } else { + ^block56: + v532 = arith.constant 16 : u32; + v531 = hir.bitcast v412 : u32; + v533 = arith.add v531, v532 : u32 #[overflow = checked]; + v1124 = arith.constant 4 : u32; + v535 = arith.mod v533, v1124 : u32; + hir.assertz v535 #[code = 250]; + v536 = hir.int_to_ptr v533 : ptr; + v537 = hir.load v536 : i32; + scf.yield v537; + }; + v548 = arith.constant -2147483647 : i32; + v1111 = cf.select v530, v548, v517 : i32; + scf.yield v1110, v1111; + }; + scf.yield v1112, v1113; + }; + scf.yield v1114, v1115; + }; + scf.yield v1116, v1117; + }; + v1123 = arith.constant 4 : u32; + v553 = hir.bitcast v400 : u32; + v555 = arith.add v553, v1123 : u32 #[overflow = checked]; + v1122 = arith.constant 4 : u32; + v557 = arith.mod v555, v1122 : u32; + hir.assertz v557 #[code = 250]; + v558 = hir.int_to_ptr v555 : ptr; + hir.store v558, v1118; + v561 = hir.bitcast v400 : u32; + v1121 = arith.constant 4 : u32; + v563 = arith.mod v561, v1121 : u32; + hir.assertz v563 #[code = 250]; + v564 = hir.int_to_ptr v561 : ptr; + hir.store v564, v1119; + v1120 = arith.constant 32 : i32; + v568 = arith.add v412, v1120 : i32 #[overflow = wrapping]; + v569 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v570 = hir.bitcast v569 : ptr; + hir.store v570, v568; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v571: i32, v572: i32, v573: i32, v574: i32, v575: i32) { + ^block57(v571: i32, v572: i32, v573: i32, v574: i32, v575: i32): + v578 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v579 = hir.bitcast v578 : ptr; + v580 = hir.load v579 : i32; + v581 = arith.constant 16 : i32; + v582 = arith.sub v580, v581 : i32 #[overflow = wrapping]; + v583 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v584 = hir.bitcast v583 : ptr; + hir.store v584, v582; + v594 = hir.bitcast v572 : u32; + v595 = arith.zext v594 : u64; + v596 = hir.bitcast v595 : i64; + v576 = arith.constant 0 : i32; + v589 = arith.sub v576, v574 : i32 #[overflow = wrapping]; + v586 = arith.constant -1 : i32; + v585 = arith.add v574, v575 : i32 #[overflow = wrapping]; + v587 = arith.add v585, v586 : i32 #[overflow = wrapping]; + v590 = arith.band v587, v589 : i32; + v591 = hir.bitcast v590 : u32; + v592 = arith.zext v591 : u64; + v593 = hir.bitcast v592 : i64; + v597 = arith.mul v593, v596 : i64 #[overflow = wrapping]; + v1251 = arith.constant 0 : i32; + v598 = arith.constant 32 : i64; + v600 = hir.cast v598 : u32; + v599 = hir.bitcast v597 : u64; + v601 = arith.shr v599, v600 : u64; + v602 = hir.bitcast v601 : i64; + v603 = arith.trunc v602 : i32; + v605 = arith.neq v603, v1251 : i1; + v1163, v1164, v1165, v1166, v1167, v1168 = scf.if v605 : i32, i32, i32, i32, i32, u32 { + ^block126: + v1148 = arith.constant 0 : u32; + v1155 = ub.poison i32 : i32; + scf.yield v571, v582, v1155, v1155, v1155, v1148; + } else { + ^block62: + v606 = arith.trunc v597 : i32; + v1250 = arith.constant 0 : i32; + v607 = arith.constant -2147483648 : i32; + v608 = arith.sub v607, v574 : i32 #[overflow = wrapping]; + v610 = hir.bitcast v608 : u32; + v609 = hir.bitcast v606 : u32; + v611 = arith.lte v609, v610 : i1; + v612 = arith.zext v611 : u32; + v613 = hir.bitcast v612 : i32; + v615 = arith.neq v613, v1250 : i1; + v1211 = scf.if v615 : i32 { + ^block60: + v1249 = arith.constant 0 : i32; + v626 = arith.neq v606, v1249 : i1; + v1210 = scf.if v626 : i32 { + ^block64: + v1248 = arith.constant 0 : i32; + v642 = arith.neq v573, v1248 : i1; + v1209 = scf.if v642 : i32 { + ^block67: + v624 = arith.constant 1 : i32; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::alloc::Global::alloc_impl(v582, v574, v606, v624) + v653 = hir.bitcast v582 : u32; + v698 = arith.constant 4 : u32; + v655 = arith.mod v653, v698 : u32; + hir.assertz v655 #[code = 250]; + v656 = hir.int_to_ptr v653 : ptr; + v657 = hir.load v656 : i32; + scf.yield v657; + } else { + ^block68: + v643 = arith.constant 8 : i32; + v644 = arith.add v582, v643 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::allocate(v644, v574, v606) + v628 = arith.constant 8 : u32; + v645 = hir.bitcast v582 : u32; + v647 = arith.add v645, v628 : u32 #[overflow = checked]; + v1247 = arith.constant 4 : u32; + v649 = arith.mod v647, v1247 : u32; + hir.assertz v649 #[code = 250]; + v650 = hir.int_to_ptr v647 : ptr; + v651 = hir.load v650 : i32; + scf.yield v651; + }; + v1245 = arith.constant 0 : i32; + v1246 = arith.constant 0 : i32; + v660 = arith.eq v1209, v1246 : i1; + v661 = arith.zext v660 : u32; + v662 = hir.bitcast v661 : i32; + v664 = arith.neq v662, v1245 : i1; + scf.if v664{ + ^block69: + v1244 = arith.constant 8 : u32; + v681 = hir.bitcast v571 : u32; + v683 = arith.add v681, v1244 : u32 #[overflow = checked]; + v1243 = arith.constant 4 : u32; + v685 = arith.mod v683, v1243 : u32; + hir.assertz v685 #[code = 250]; + v686 = hir.int_to_ptr v683 : ptr; + hir.store v686, v606; + v1242 = arith.constant 4 : u32; + v688 = hir.bitcast v571 : u32; + v690 = arith.add v688, v1242 : u32 #[overflow = checked]; + v1241 = arith.constant 4 : u32; + v692 = arith.mod v690, v1241 : u32; + hir.assertz v692 #[code = 250]; + v693 = hir.int_to_ptr v690 : ptr; + hir.store v693, v574; + scf.yield ; + } else { + ^block70: + v1240 = arith.constant 8 : u32; + v666 = hir.bitcast v571 : u32; + v668 = arith.add v666, v1240 : u32 #[overflow = checked]; + v1239 = arith.constant 4 : u32; + v670 = arith.mod v668, v1239 : u32; + hir.assertz v670 #[code = 250]; + v671 = hir.int_to_ptr v668 : ptr; + hir.store v671, v1209; + v1238 = arith.constant 4 : u32; + v673 = hir.bitcast v571 : u32; + v675 = arith.add v673, v1238 : u32 #[overflow = checked]; + v1237 = arith.constant 4 : u32; + v677 = arith.mod v675, v1237 : u32; + hir.assertz v677 #[code = 250]; + v678 = hir.int_to_ptr v675 : ptr; + hir.store v678, v572; + scf.yield ; + }; + v1235 = arith.constant 0 : i32; + v1236 = arith.constant 1 : i32; + v1208 = cf.select v664, v1236, v1235 : i32; + scf.yield v1208; + } else { + ^block65: + v1234 = arith.constant 8 : u32; + v627 = hir.bitcast v571 : u32; + v629 = arith.add v627, v1234 : u32 #[overflow = checked]; + v1233 = arith.constant 4 : u32; + v631 = arith.mod v629, v1233 : u32; + hir.assertz v631 #[code = 250]; + v632 = hir.int_to_ptr v629 : ptr; + hir.store v632, v574; + v1232 = arith.constant 4 : u32; + v635 = hir.bitcast v571 : u32; + v637 = arith.add v635, v1232 : u32 #[overflow = checked]; + v1231 = arith.constant 4 : u32; + v639 = arith.mod v637, v1231 : u32; + hir.assertz v639 #[code = 250]; + v1230 = arith.constant 0 : i32; + v640 = hir.int_to_ptr v637 : ptr; + hir.store v640, v1230; + v1229 = arith.constant 0 : i32; + scf.yield v1229; + }; + scf.yield v1210; + } else { + ^block63: + v1228 = ub.poison i32 : i32; + scf.yield v1228; + }; + v1223 = arith.constant 0 : u32; + v1156 = arith.constant 1 : u32; + v1216 = cf.select v615, v1156, v1223 : u32; + v1224 = ub.poison i32 : i32; + v1215 = cf.select v615, v582, v1224 : i32; + v1225 = ub.poison i32 : i32; + v1214 = cf.select v615, v571, v1225 : i32; + v1226 = ub.poison i32 : i32; + v1213 = cf.select v615, v1226, v582 : i32; + v1227 = ub.poison i32 : i32; + v1212 = cf.select v615, v1227, v571 : i32; + scf.yield v1212, v1213, v1214, v1211, v1215, v1216; + }; + v1169, v1170, v1171 = scf.index_switch v1168 : i32, i32, i32 + case 0 { + ^block61: + v1222 = arith.constant 4 : u32; + v618 = hir.bitcast v1163 : u32; + v620 = arith.add v618, v1222 : u32 #[overflow = checked]; + v1221 = arith.constant 4 : u32; + v622 = arith.mod v620, v1221 : u32; + hir.assertz v622 #[code = 250]; + v1220 = arith.constant 0 : i32; + v623 = hir.int_to_ptr v620 : ptr; + hir.store v623, v1220; + v1219 = arith.constant 1 : i32; + scf.yield v1163, v1219, v1164; + } + default { + ^block130: + scf.yield v1165, v1166, v1167; + }; + v697 = hir.bitcast v1169 : u32; + v1218 = arith.constant 4 : u32; + v699 = arith.mod v697, v1218 : u32; + hir.assertz v699 #[code = 250]; + v700 = hir.int_to_ptr v697 : ptr; + hir.store v700, v1170; + v1217 = arith.constant 16 : i32; + v705 = arith.add v1171, v1217 : i32 #[overflow = wrapping]; + v706 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v707 = hir.bitcast v706 : ptr; + hir.store v707, v705; + builtin.ret ; + }; + + private builtin.function @::allocate(v708: i32, v709: i32, v710: i32) { + ^block71(v708: i32, v709: i32, v710: i32): + v712 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v713 = hir.bitcast v712 : ptr; + v714 = hir.load v713 : i32; + v715 = arith.constant 16 : i32; + v716 = arith.sub v714, v715 : i32 #[overflow = wrapping]; + v717 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v718 = hir.bitcast v717 : ptr; + hir.store v718, v716; + v711 = arith.constant 0 : i32; + v719 = arith.constant 8 : i32; + v720 = arith.add v716, v719 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::alloc::Global::alloc_impl(v720, v709, v710, v711) + v723 = arith.constant 12 : u32; + v722 = hir.bitcast v716 : u32; + v724 = arith.add v722, v723 : u32 #[overflow = checked]; + v725 = arith.constant 4 : u32; + v726 = arith.mod v724, v725 : u32; + hir.assertz v726 #[code = 250]; + v727 = hir.int_to_ptr v724 : ptr; + v728 = hir.load v727 : i32; + v730 = arith.constant 8 : u32; + v729 = hir.bitcast v716 : u32; + v731 = arith.add v729, v730 : u32 #[overflow = checked]; + v1256 = arith.constant 4 : u32; + v733 = arith.mod v731, v1256 : u32; + hir.assertz v733 #[code = 250]; + v734 = hir.int_to_ptr v731 : ptr; + v735 = hir.load v734 : i32; + v736 = hir.bitcast v708 : u32; + v1255 = arith.constant 4 : u32; + v738 = arith.mod v736, v1255 : u32; + hir.assertz v738 #[code = 250]; + v739 = hir.int_to_ptr v736 : ptr; + hir.store v739, v735; + v1254 = arith.constant 4 : u32; + v740 = hir.bitcast v708 : u32; + v742 = arith.add v740, v1254 : u32 #[overflow = checked]; + v1253 = arith.constant 4 : u32; + v744 = arith.mod v742, v1253 : u32; + hir.assertz v744 #[code = 250]; + v745 = hir.int_to_ptr v742 : ptr; + hir.store v745, v728; + v1252 = arith.constant 16 : i32; + v747 = arith.add v716, v1252 : i32 #[overflow = wrapping]; + v748 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v749 = hir.bitcast v748 : ptr; + hir.store v749, v747; + builtin.ret ; + }; + + private builtin.function @alloc::alloc::Global::alloc_impl(v750: i32, v751: i32, v752: i32, v753: i32) { + ^block73(v750: i32, v751: i32, v752: i32, v753: i32): + v1272 = arith.constant 0 : i32; + v754 = arith.constant 0 : i32; + v755 = arith.eq v752, v754 : i1; + v756 = arith.zext v755 : u32; + v757 = hir.bitcast v756 : i32; + v759 = arith.neq v757, v1272 : i1; + v1268 = scf.if v759 : i32 { + ^block133: + scf.yield v751; + } else { + ^block76: + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_no_alloc_shim_is_unstable_v2() + v1271 = arith.constant 0 : i32; + v761 = arith.neq v753, v1271 : i1; + v1267 = scf.if v761 : i32 { + ^block77: + v763 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_alloc_zeroed(v752, v751) : i32 + scf.yield v763; + } else { + ^block78: + v762 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_alloc(v752, v751) : i32 + scf.yield v762; + }; + scf.yield v1267; + }; + v767 = arith.constant 4 : u32; + v766 = hir.bitcast v750 : u32; + v768 = arith.add v766, v767 : u32 #[overflow = checked]; + v1270 = arith.constant 4 : u32; + v770 = arith.mod v768, v1270 : u32; + hir.assertz v770 #[code = 250]; + v771 = hir.int_to_ptr v768 : ptr; + hir.store v771, v752; + v773 = hir.bitcast v750 : u32; + v1269 = arith.constant 4 : u32; + v775 = arith.mod v773, v1269 : u32; + hir.assertz v775 #[code = 250]; + v776 = hir.int_to_ptr v773 : ptr; + hir.store v776, v1268; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v777: i32, v778: i32, v779: i32, v780: i32) { + ^block79(v777: i32, v778: i32, v779: i32, v780: i32): + v1298 = arith.constant 0 : i32; + v781 = arith.constant 0 : i32; + v785 = arith.eq v780, v781 : i1; + v786 = arith.zext v785 : u32; + v787 = hir.bitcast v786 : i32; + v789 = arith.neq v787, v1298 : i1; + v1285, v1286 = scf.if v789 : i32, i32 { + ^block137: + v1297 = arith.constant 0 : i32; + v783 = arith.constant 4 : i32; + scf.yield v783, v1297; + } else { + ^block82: + v790 = hir.bitcast v778 : u32; + v825 = arith.constant 4 : u32; + v792 = arith.mod v790, v825 : u32; + hir.assertz v792 #[code = 250]; + v793 = hir.int_to_ptr v790 : ptr; + v794 = hir.load v793 : i32; + v1295 = arith.constant 0 : i32; + v1296 = arith.constant 0 : i32; + v796 = arith.eq v794, v1296 : i1; + v797 = arith.zext v796 : u32; + v798 = hir.bitcast v797 : i32; + v800 = arith.neq v798, v1295 : i1; + v1283 = scf.if v800 : i32 { + ^block136: + v1294 = arith.constant 0 : i32; + scf.yield v1294; + } else { + ^block83: + v1293 = arith.constant 4 : u32; + v801 = hir.bitcast v777 : u32; + v803 = arith.add v801, v1293 : u32 #[overflow = checked]; + v1292 = arith.constant 4 : u32; + v805 = arith.mod v803, v1292 : u32; + hir.assertz v805 #[code = 250]; + v806 = hir.int_to_ptr v803 : ptr; + hir.store v806, v779; + v1291 = arith.constant 4 : u32; + v807 = hir.bitcast v778 : u32; + v809 = arith.add v807, v1291 : u32 #[overflow = checked]; + v1290 = arith.constant 4 : u32; + v811 = arith.mod v809, v1290 : u32; + hir.assertz v811 #[code = 250]; + v812 = hir.int_to_ptr v809 : ptr; + v813 = hir.load v812 : i32; + v814 = hir.bitcast v777 : u32; + v1289 = arith.constant 4 : u32; + v816 = arith.mod v814, v1289 : u32; + hir.assertz v816 #[code = 250]; + v817 = hir.int_to_ptr v814 : ptr; + hir.store v817, v813; + v818 = arith.mul v794, v780 : i32 #[overflow = wrapping]; + scf.yield v818; + }; + v819 = arith.constant 8 : i32; + v1288 = arith.constant 4 : i32; + v1284 = cf.select v800, v1288, v819 : i32; + scf.yield v1284, v1283; + }; + v822 = arith.add v777, v1285 : i32 #[overflow = wrapping]; + v824 = hir.bitcast v822 : u32; + v1287 = arith.constant 4 : u32; + v826 = arith.mod v824, v1287 : u32; + hir.assertz v826 #[code = 250]; + v827 = hir.int_to_ptr v824 : ptr; + hir.store v827, v1286; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::finish_grow(v828: i32, v829: i32, v830: i32, v831: i32, v832: i32) { + ^block84(v828: i32, v829: i32, v830: i32, v831: i32, v832: i32): + v834 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v835 = hir.bitcast v834 : ptr; + v836 = hir.load v835 : i32; + v837 = arith.constant 16 : i32; + v838 = arith.sub v836, v837 : i32 #[overflow = wrapping]; + v839 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v840 = hir.bitcast v839 : ptr; + hir.store v840, v838; + v1353 = arith.constant 0 : i32; + v833 = arith.constant 0 : i32; + v843 = arith.gte v830, v833 : i1; + v844 = arith.zext v843 : u32; + v845 = hir.bitcast v844 : i32; + v847 = arith.neq v845, v1353 : i1; + v1327, v1328 = scf.if v847 : i32, i32 { + ^block87: + v934 = arith.constant 4 : u32; + v850 = hir.bitcast v831 : u32; + v852 = arith.add v850, v934 : u32 #[overflow = checked]; + v1352 = arith.constant 4 : u32; + v854 = arith.mod v852, v1352 : u32; + hir.assertz v854 #[code = 250]; + v855 = hir.int_to_ptr v852 : ptr; + v856 = hir.load v855 : i32; + v1350 = arith.constant 0 : i32; + v1351 = arith.constant 0 : i32; + v858 = arith.eq v856, v1351 : i1; + v859 = arith.zext v858 : u32; + v860 = hir.bitcast v859 : i32; + v862 = arith.neq v860, v1350 : i1; + v1325, v1326 = scf.if v862 : i32, i32 { + ^block90: + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::allocate(v838, v829, v830) + v1349 = arith.constant 4 : u32; + v895 = hir.bitcast v838 : u32; + v897 = arith.add v895, v1349 : u32 #[overflow = checked]; + v1348 = arith.constant 4 : u32; + v899 = arith.mod v897, v1348 : u32; + hir.assertz v899 #[code = 250]; + v900 = hir.int_to_ptr v897 : ptr; + v901 = hir.load v900 : i32; + v902 = hir.bitcast v838 : u32; + v1347 = arith.constant 4 : u32; + v904 = arith.mod v902, v1347 : u32; + hir.assertz v904 #[code = 250]; + v905 = hir.int_to_ptr v902 : ptr; + v906 = hir.load v905 : i32; + scf.yield v906, v901; + } else { + ^block91: + v864 = arith.constant 8 : u32; + v863 = hir.bitcast v831 : u32; + v865 = arith.add v863, v864 : u32 #[overflow = checked]; + v1346 = arith.constant 4 : u32; + v867 = arith.mod v865, v1346 : u32; + hir.assertz v867 #[code = 250]; + v868 = hir.int_to_ptr v865 : ptr; + v869 = hir.load v868 : i32; + v1345 = arith.constant 0 : i32; + v871 = arith.neq v869, v1345 : i1; + v1323, v1324 = scf.if v871 : i32, i32 { + ^block92: + v889 = hir.bitcast v831 : u32; + v1344 = arith.constant 4 : u32; + v891 = arith.mod v889, v1344 : u32; + hir.assertz v891 #[code = 250]; + v892 = hir.int_to_ptr v889 : ptr; + v893 = hir.load v892 : i32; + v894 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_realloc(v893, v869, v829, v830) : i32 + scf.yield v894, v830; + } else { + ^block93: + v1343 = arith.constant 0 : i32; + v928 = arith.constant 8 : i32; + v873 = arith.add v838, v928 : i32 #[overflow = wrapping]; + hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::alloc::Global::alloc_impl(v873, v829, v830, v1343) + v876 = arith.constant 12 : u32; + v875 = hir.bitcast v838 : u32; + v877 = arith.add v875, v876 : u32 #[overflow = checked]; + v1342 = arith.constant 4 : u32; + v879 = arith.mod v877, v1342 : u32; + hir.assertz v879 #[code = 250]; + v880 = hir.int_to_ptr v877 : ptr; + v881 = hir.load v880 : i32; + v1341 = arith.constant 8 : u32; + v882 = hir.bitcast v838 : u32; + v884 = arith.add v882, v1341 : u32 #[overflow = checked]; + v1340 = arith.constant 4 : u32; + v886 = arith.mod v884, v1340 : u32; + hir.assertz v886 #[code = 250]; + v887 = hir.int_to_ptr v884 : ptr; + v888 = hir.load v887 : i32; + scf.yield v888, v881; + }; + scf.yield v1323, v1324; + }; + v1339 = arith.constant 4 : u32; + v913 = hir.bitcast v828 : u32; + v915 = arith.add v913, v1339 : u32 #[overflow = checked]; + v1338 = arith.constant 4 : u32; + v917 = arith.mod v915, v1338 : u32; + hir.assertz v917 #[code = 250]; + v1337 = arith.constant 0 : i32; + v911 = arith.neq v1325, v1337 : i1; + v912 = cf.select v911, v1325, v829 : i32; + v918 = hir.int_to_ptr v915 : ptr; + hir.store v918, v912; + v1335 = arith.constant 0 : i32; + v925 = arith.eq v1325, v1335 : i1; + v926 = arith.zext v925 : u32; + v927 = hir.bitcast v926 : i32; + v1336 = arith.constant 0 : i32; + v922 = arith.neq v1325, v1336 : i1; + v923 = cf.select v922, v1326, v830 : i32; + scf.yield v923, v927; + } else { + ^block88: + v848 = arith.constant 1 : i32; + v1334 = arith.constant 0 : i32; + scf.yield v1334, v848; + }; + v849 = arith.constant 4 : i32; + v1333 = arith.constant 8 : i32; + v1329 = cf.select v847, v1333, v849 : i32; + v931 = arith.add v828, v1329 : i32 #[overflow = wrapping]; + v933 = hir.bitcast v931 : u32; + v1332 = arith.constant 4 : u32; + v935 = arith.mod v933, v1332 : u32; + hir.assertz v935 #[code = 250]; + v936 = hir.int_to_ptr v933 : ptr; + hir.store v936, v1327; + v938 = hir.bitcast v828 : u32; + v1331 = arith.constant 4 : u32; + v940 = arith.mod v938, v1331 : u32; + hir.assertz v940 #[code = 250]; + v941 = hir.int_to_ptr v938 : ptr; + hir.store v941, v1328; + v1330 = arith.constant 16 : i32; + v945 = arith.add v838, v1330 : i32 #[overflow = wrapping]; + v946 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr + v947 = hir.bitcast v946 : ptr; + hir.store v947, v945; + builtin.ret ; + }; + + private builtin.function @alloc::raw_vec::handle_error(v948: i32, v949: i32, v950: i32) { + ^block94(v948: i32, v949: i32, v950: i32): + ub.unreachable ; + }; + + private builtin.function @core::ptr::alignment::Alignment::max(v951: i32, v952: i32) -> i32 { + ^block96(v951: i32, v952: i32): + v959 = arith.constant 0 : i32; + v955 = hir.bitcast v952 : u32; + v954 = hir.bitcast v951 : u32; + v956 = arith.gt v954, v955 : i1; + v957 = arith.zext v956 : u32; + v958 = hir.bitcast v957 : i32; + v960 = arith.neq v958, v959 : i1; + v961 = cf.select v960, v951, v952 : i32; + builtin.ret v961; + }; + + builtin.global_variable private @#__stack_pointer : i32 { + builtin.ret_imm 1048576; + }; + + builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; + }; +}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_mixed_types_struct.masm b/felt-repr/tests/expected/onchain_mixed_types_no_u64.masm similarity index 92% rename from felt-repr/tests/expected/onchain_mixed_types_struct.masm rename to felt-repr/tests/expected/onchain_mixed_types_no_u64.masm index 4155207f0..31b679b01 100644 --- a/felt-repr/tests/expected/onchain_mixed_types_struct.masm +++ b/felt-repr/tests/expected/onchain_mixed_types_no_u64.masm @@ -18,7 +18,7 @@ proc init mem_store.278536 end -# mod root_ns:root@1.0.0::onchain_mixed_types_struct +# mod root_ns:root@1.0.0::onchain_mixed_types_no_u64 @callconv("C") proc alloc::vec::Vec::push(i32, felt) @@ -64,7 +64,7 @@ proc alloc::vec::Vec::push(i32, felt) dup.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVec::grow_one + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVec::grow_one trace.252 nop end @@ -179,7 +179,7 @@ proc alloc::raw_vec::RawVec::grow_one(i32) swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVecInner::grow_amortized + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVecInner::grow_amortized trace.252 nop push.8 @@ -238,7 +238,7 @@ proc alloc::raw_vec::RawVec::grow_one(i32) swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::handle_error + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::handle_error trace.252 nop push.0 @@ -268,7 +268,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::store_sw trace.252 nop - push.4 + push.12 dup.3 add u32assert @@ -285,7 +285,10 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - dup.3 + push.8 + dup.4 + add + u32assert push.4 dup.1 swap.1 @@ -299,7 +302,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - push.8 + push.4 dup.5 add u32assert @@ -316,15 +319,7 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 - trace.252 - nop - push.12 - dup.7 - add - u32assert + dup.5 push.4 dup.1 swap.1 @@ -338,13 +333,8 @@ pub proc entrypoint(i32, i32) exec.::intrinsics::mem::load_felt trace.252 nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 - trace.252 - nop push.16 - dup.9 + dup.7 add u32assert push.4 @@ -362,11 +352,11 @@ pub proc entrypoint(i32, i32) nop trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::intrinsics::felt::as_u64 trace.252 nop push.20 - movup.11 + movup.9 add u32assert push.4 @@ -384,36 +374,14 @@ pub proc entrypoint(i32, i32) nop trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::as_u64 - trace.252 - nop - push.255 - movdn.2 - drop - u32and - dup.0 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::>::from - trace.252 - nop - push.66 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::from_u32 - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::assert_eq + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::intrinsics::felt::as_u64 trace.252 nop push.4 push.0 push.256 push.20 - dup.13 + dup.12 u32wrapping_add dup.3 swap.4 @@ -422,11 +390,11 @@ pub proc entrypoint(i32, i32) swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVecInner::try_allocate_in + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVecInner::try_allocate_in trace.252 nop push.24 - dup.10 + dup.9 add u32assert push.4 @@ -443,7 +411,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.20 - dup.11 + dup.10 add u32assert push.4 @@ -467,7 +435,7 @@ pub proc entrypoint(i32, i32) if.true push.8 push.8 - dup.12 + dup.11 u32wrapping_add u32wrapping_add dup.0 @@ -487,7 +455,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.28 - dup.12 + dup.11 add u32assert push.4 @@ -504,7 +472,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.12 - dup.13 + dup.12 add u32assert push.4 @@ -521,7 +489,7 @@ pub proc entrypoint(i32, i32) trace.252 nop push.8 - dup.12 + dup.11 add u32assert push.4 @@ -540,75 +508,69 @@ pub proc entrypoint(i32, i32) trace.252 nop push.8 - dup.11 + dup.10 u32wrapping_add - movup.9 + movup.6 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push trace.252 nop push.8 - dup.10 + dup.9 u32wrapping_add - movup.9 + movup.6 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push - trace.252 - nop - movup.7 - movup.7 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::from_u64_unchecked + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push trace.252 nop push.8 dup.8 u32wrapping_add + movup.6 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push - trace.252 - nop - movup.5 - movup.5 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::felt::from_u64_unchecked + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push trace.252 nop push.8 - dup.6 + dup.7 u32wrapping_add + movup.6 + swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push trace.252 nop - movup.3 - movup.3 + movup.4 + movup.4 drop trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::>::from + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::>::from trace.252 nop push.8 - dup.4 + dup.5 u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push trace.252 nop - swap.1 + push.255 + movup.3 + movup.3 + drop + u32and trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::>::from + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::>::from trace.252 nop push.8 @@ -616,7 +578,7 @@ pub proc entrypoint(i32, i32) u32wrapping_add trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::vec::Vec::push + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push trace.252 nop push.4 @@ -690,10 +652,9 @@ pub proc entrypoint(i32, i32) trace.252 nop else - movdn.9 + movdn.8 dropw dropw - drop movup.2 drop push.28 @@ -717,7 +678,7 @@ pub proc entrypoint(i32, i32) swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::handle_error + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::handle_error trace.252 nop push.0 @@ -732,7 +693,7 @@ proc __rustc::__rust_alloc(i32, i32) -> i32 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::alloc + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::alloc trace.252 nop end @@ -746,7 +707,7 @@ proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::alloc + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::alloc trace.252 nop push.0 @@ -850,7 +811,7 @@ proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::alloc + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::alloc trace.252 nop push.0 @@ -955,7 +916,7 @@ proc ::alloc( movup.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::core::ptr::alignment::Alignment::max + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::core::ptr::alignment::Alignment::max trace.252 nop push.0 @@ -1004,7 +965,7 @@ proc ::alloc( else trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::intrinsics::mem::heap_base + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::intrinsics::mem::heap_base trace.252 nop trace.240 @@ -1122,37 +1083,11 @@ proc >::fro nop end -@callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - @callconv("C") proc intrinsics::felt::as_u64(felt) -> [u32; 2] u32split end -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - @callconv("C") proc alloc::raw_vec::RawVecInner::grow_amortized( i32, @@ -1356,7 +1291,7 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::RawVecInner::current_memory + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVecInner::current_memory trace.252 nop push.20 @@ -1375,7 +1310,7 @@ proc alloc::raw_vec::RawVecInner::grow_amortized( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::raw_vec::finish_grow + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::finish_grow trace.252 nop push.12 @@ -1653,7 +1588,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::alloc::Global::alloc_impl + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::alloc::Global::alloc_impl trace.252 nop dup.2 @@ -1679,7 +1614,7 @@ proc alloc::raw_vec::RawVecInner::try_allocate_in( swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::allocate + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::allocate trace.252 nop push.8 @@ -1993,7 +1928,7 @@ proc ::allocate( swap.1 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::alloc::Global::alloc_impl + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::alloc::Global::alloc_impl trace.252 nop push.12 @@ -2092,7 +2027,7 @@ proc alloc::alloc::Global::alloc_impl( else trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_no_alloc_shim_is_unstable_v2 trace.252 nop push.0 @@ -2103,7 +2038,7 @@ proc alloc::alloc::Global::alloc_impl( dup.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_alloc_zeroed + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_alloc_zeroed trace.252 nop else @@ -2111,7 +2046,7 @@ proc alloc::alloc::Global::alloc_impl( dup.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_alloc + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_alloc trace.252 nop end @@ -2349,7 +2284,7 @@ proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) dup.3 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::::allocate + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::allocate trace.252 nop push.4 @@ -2426,7 +2361,7 @@ proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::__rustc::__rust_realloc + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_realloc trace.252 nop dup.5 @@ -2445,7 +2380,7 @@ proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) swap.2 trace.240 nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_struct::alloc::alloc::Global::alloc_impl + exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::alloc::Global::alloc_impl trace.252 nop push.12 diff --git a/felt-repr/tests/expected/onchain_mixed_types_no_u64.wat b/felt-repr/tests/expected/onchain_mixed_types_no_u64.wat new file mode 100644 index 000000000..d72c03adc --- /dev/null +++ b/felt-repr/tests/expected/onchain_mixed_types_no_u64.wat @@ -0,0 +1,778 @@ +(module $onchain_mixed_types_no_u64.wasm + (type (;0;) (func (param i32 f32))) + (type (;1;) (func (param i32))) + (type (;2;) (func (param i32 i32))) + (type (;3;) (func (param i32 i32) (result i32))) + (type (;4;) (func (param i32 i32 i32 i32) (result i32))) + (type (;5;) (func)) + (type (;6;) (func (param i32 i32 i32) (result i32))) + (type (;7;) (func (result i32))) + (type (;8;) (func (param i32) (result f32))) + (type (;9;) (func (param f32) (result i64))) + (type (;10;) (func (param i32 i32 i32 i32 i32 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))) + (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 $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) + (local i32) + block ;; label = @1 + local.get 0 + i32.load offset=8 + local.tee 2 + local.get 0 + i32.load + i32.ne + br_if 0 (;@1;) + local.get 0 + call $alloc::raw_vec::RawVec::grow_one + end + local.get 0 + i32.load offset=4 + local.get 2 + i32.const 2 + i32.shl + i32.add + local.get 1 + f32.store + local.get 0 + local.get 2 + i32.const 1 + i32.add + i32.store offset=8 + ) + (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 1 + global.set $__stack_pointer + local.get 1 + i32.const 8 + i32.add + local.get 0 + local.get 0 + i32.load + i32.const 1 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::grow_amortized + block ;; label = @1 + local.get 1 + i32.load offset=8 + local.tee 0 + i32.const -2147483647 + i32.eq + br_if 0 (;@1;) + local.get 0 + local.get 1 + i32.load offset=12 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 1 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $entrypoint (;2;) (type 2) (param i32 i32) + (local i32 f32 f32 f32 f32 i64 i64 i32) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 2 + global.set $__stack_pointer + local.get 1 + f32.load offset=12 + local.set 3 + local.get 1 + f32.load offset=8 + local.set 4 + local.get 1 + f32.load offset=4 + local.set 5 + local.get 1 + f32.load + local.set 6 + local.get 1 + f32.load offset=16 + call $intrinsics::felt::as_u64 + local.set 7 + local.get 1 + f32.load offset=20 + call $intrinsics::felt::as_u64 + local.set 8 + local.get 2 + i32.const 20 + i32.add + i32.const 256 + i32.const 0 + i32.const 4 + i32.const 4 + call $alloc::raw_vec::RawVecInner::try_allocate_in + local.get 2 + i32.load offset=24 + local.set 1 + block ;; label = @1 + local.get 2 + i32.load offset=20 + i32.const 1 + i32.ne + br_if 0 (;@1;) + local.get 1 + local.get 2 + i32.load offset=28 + i32.const 1048588 + call $alloc::raw_vec::handle_error + unreachable + end + local.get 2 + i32.const 8 + i32.add + i32.const 8 + i32.add + local.tee 9 + i32.const 0 + i32.store + local.get 2 + local.get 2 + i32.load offset=28 + i32.store offset=12 + local.get 2 + local.get 1 + i32.store offset=8 + local.get 2 + i32.const 8 + i32.add + local.get 6 + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 5 + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 4 + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 3 + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 7 + i32.wrap_i64 + call $>::from + call $alloc::vec::Vec::push + local.get 2 + i32.const 8 + i32.add + local.get 8 + i32.wrap_i64 + i32.const 255 + i32.and + call $>::from + call $alloc::vec::Vec::push + local.get 0 + i32.const 8 + i32.add + local.get 9 + i32.load + i32.store + local.get 0 + local.get 2 + i64.load offset=8 align=4 + i64.store align=4 + local.get 2 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + ) + (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 2 + local.get 3 + call $::alloc + local.tee 2 + i32.eqz + br_if 0 (;@1;) + local.get 3 + local.get 1 + local.get 3 + local.get 1 + i32.lt_u + select + local.tee 3 + i32.eqz + br_if 0 (;@1;) + local.get 2 + local.get 0 + local.get 3 + memory.copy + end + local.get 2 + ) + (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) + block ;; label = @1 + i32.const 1048604 + local.get 1 + local.get 0 + call $::alloc + local.tee 1 + i32.eqz + br_if 0 (;@1;) + local.get 0 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.const 0 + local.get 0 + memory.fill + end + local.get 1 + ) + (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) + return + ) + (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) + (local i32 i32) + block ;; label = @1 + local.get 1 + i32.const 16 + local.get 1 + i32.const 16 + i32.gt_u + select + local.tee 3 + local.get 3 + i32.const -1 + i32.add + i32.and + br_if 0 (;@1;) + local.get 2 + i32.const -2147483648 + local.get 1 + local.get 3 + call $core::ptr::alignment::Alignment::max + local.tee 1 + i32.sub + i32.gt_u + br_if 0 (;@1;) + i32.const 0 + local.set 3 + local.get 2 + local.get 1 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 1 + i32.sub + i32.and + local.set 2 + block ;; label = @2 + local.get 0 + i32.load + br_if 0 (;@2;) + local.get 0 + call $intrinsics::mem::heap_base + memory.size + i32.const 16 + i32.shl + i32.add + i32.store + end + block ;; label = @2 + local.get 2 + local.get 0 + i32.load + local.tee 4 + i32.const -1 + i32.xor + i32.gt_u + br_if 0 (;@2;) + local.get 0 + local.get 4 + local.get 2 + i32.add + i32.store + local.get 4 + local.get 1 + i32.add + local.set 3 + end + local.get 3 + return + end + unreachable + ) + (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) + unreachable + ) + (func $>::from (;9;) (type 8) (param i32) (result f32) + local.get 0 + f32.reinterpret_i32 + ) + (func $intrinsics::felt::as_u64 (;10;) (type 9) (param f32) (result i64) + unreachable + ) + (func $alloc::raw_vec::RawVecInner::grow_amortized (;11;) (type 10) (param i32 i32 i32 i32 i32 i32) + (local i32 i32 i32 i64) + global.get $__stack_pointer + i32.const 32 + i32.sub + local.tee 6 + global.set $__stack_pointer + i32.const 0 + local.set 7 + block ;; label = @1 + block ;; label = @2 + local.get 5 + i32.eqz + br_if 0 (;@2;) + local.get 2 + local.get 3 + i32.add + local.tee 3 + local.get 2 + i32.lt_u + br_if 1 (;@1;) + i32.const 0 + local.set 7 + local.get 4 + local.get 5 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 4 + i32.sub + i32.and + i64.extend_i32_u + local.get 3 + local.get 1 + i32.load + i32.const 1 + i32.shl + local.tee 8 + local.get 3 + local.get 8 + i32.gt_u + select + local.tee 8 + i32.const 8 + i32.const 4 + i32.const 1 + local.get 5 + i32.const 1025 + i32.lt_u + select + local.get 5 + i32.const 1 + i32.eq + select + local.tee 2 + local.get 8 + local.get 2 + i32.gt_u + select + local.tee 2 + i64.extend_i32_u + i64.mul + local.tee 9 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@2;) + local.get 9 + i32.wrap_i64 + local.tee 3 + i32.const -2147483648 + local.get 4 + i32.sub + i32.gt_u + br_if 1 (;@1;) + local.get 6 + i32.const 20 + i32.add + local.get 1 + local.get 4 + local.get 5 + call $alloc::raw_vec::RawVecInner::current_memory + local.get 6 + i32.const 8 + i32.add + local.get 4 + local.get 3 + local.get 6 + i32.const 20 + i32.add + local.get 0 + call $alloc::raw_vec::finish_grow + local.get 6 + i32.load offset=12 + local.set 7 + block ;; label = @3 + local.get 6 + i32.load offset=8 + i32.eqz + br_if 0 (;@3;) + local.get 6 + i32.load offset=16 + local.set 8 + br 2 (;@1;) + end + local.get 1 + local.get 2 + i32.store + local.get 1 + local.get 7 + i32.store offset=4 + i32.const -2147483647 + local.set 7 + br 1 (;@1;) + end + end + local.get 0 + local.get 8 + i32.store offset=4 + local.get 0 + local.get 7 + i32.store + local.get 6 + i32.const 32 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::RawVecInner::try_allocate_in (;12;) (type 11) (param i32 i32 i32 i32 i32) + (local i32 i64) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + block ;; label = @1 + block ;; label = @2 + block ;; label = @3 + local.get 3 + local.get 4 + i32.add + i32.const -1 + i32.add + i32.const 0 + local.get 3 + i32.sub + i32.and + i64.extend_i32_u + local.get 1 + i64.extend_i32_u + i64.mul + local.tee 6 + i64.const 32 + i64.shr_u + i32.wrap_i64 + br_if 0 (;@3;) + local.get 6 + i32.wrap_i64 + local.tee 4 + i32.const -2147483648 + local.get 3 + i32.sub + i32.le_u + br_if 1 (;@2;) + end + local.get 0 + i32.const 0 + i32.store offset=4 + i32.const 1 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + local.get 4 + br_if 0 (;@2;) + local.get 0 + local.get 3 + i32.store offset=8 + i32.const 0 + local.set 3 + local.get 0 + i32.const 0 + i32.store offset=4 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 2 + br_if 0 (;@3;) + local.get 5 + i32.const 8 + i32.add + local.get 3 + local.get 4 + call $::allocate + local.get 5 + i32.load offset=8 + local.set 2 + br 1 (;@2;) + end + local.get 5 + local.get 3 + local.get 4 + i32.const 1 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load + local.set 2 + end + block ;; label = @2 + local.get 2 + i32.eqz + br_if 0 (;@2;) + local.get 0 + local.get 2 + i32.store offset=8 + local.get 0 + local.get 1 + i32.store offset=4 + i32.const 0 + local.set 3 + br 1 (;@1;) + end + local.get 0 + local.get 4 + i32.store offset=8 + local.get 0 + local.get 3 + i32.store offset=4 + i32.const 1 + local.set 3 + end + local.get 0 + local.get 3 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $::allocate (;13;) (type 12) (param i32 i32 i32) + (local i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 3 + global.set $__stack_pointer + local.get 3 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 3 + i32.load offset=12 + local.set 2 + local.get 0 + local.get 3 + i32.load offset=8 + i32.store + local.get 0 + local.get 2 + i32.store offset=4 + local.get 3 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::alloc::Global::alloc_impl (;14;) (type 13) (param i32 i32 i32 i32) + block ;; label = @1 + local.get 2 + i32.eqz + br_if 0 (;@1;) + call $__rustc::__rust_no_alloc_shim_is_unstable_v2 + block ;; label = @2 + local.get 3 + br_if 0 (;@2;) + local.get 2 + local.get 1 + call $__rustc::__rust_alloc + local.set 1 + br 1 (;@1;) + end + local.get 2 + local.get 1 + call $__rustc::__rust_alloc_zeroed + local.set 1 + end + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.store + ) + (func $alloc::raw_vec::RawVecInner::current_memory (;15;) (type 13) (param i32 i32 i32 i32) + (local i32 i32 i32) + i32.const 0 + local.set 4 + i32.const 4 + local.set 5 + block ;; label = @1 + local.get 3 + i32.eqz + br_if 0 (;@1;) + local.get 1 + i32.load + local.tee 6 + i32.eqz + br_if 0 (;@1;) + local.get 0 + local.get 2 + i32.store offset=4 + local.get 0 + local.get 1 + i32.load offset=4 + i32.store + local.get 6 + local.get 3 + i32.mul + local.set 4 + i32.const 8 + local.set 5 + end + local.get 0 + local.get 5 + i32.add + local.get 4 + i32.store + ) + (func $alloc::raw_vec::finish_grow (;16;) (type 11) (param i32 i32 i32 i32 i32) + (local i32 i32) + global.get $__stack_pointer + i32.const 16 + i32.sub + local.tee 5 + global.set $__stack_pointer + i32.const 0 + local.set 6 + block ;; label = @1 + block ;; label = @2 + local.get 2 + i32.const 0 + i32.ge_s + br_if 0 (;@2;) + i32.const 1 + local.set 2 + i32.const 4 + local.set 3 + br 1 (;@1;) + end + block ;; label = @2 + block ;; label = @3 + local.get 3 + i32.load offset=4 + i32.eqz + br_if 0 (;@3;) + block ;; label = @4 + local.get 3 + i32.load offset=8 + local.tee 6 + br_if 0 (;@4;) + local.get 5 + i32.const 8 + i32.add + local.get 1 + local.get 2 + i32.const 0 + call $alloc::alloc::Global::alloc_impl + local.get 5 + i32.load offset=12 + local.set 6 + local.get 5 + i32.load offset=8 + local.set 3 + br 2 (;@2;) + end + local.get 3 + i32.load + local.get 6 + local.get 1 + local.get 2 + call $__rustc::__rust_realloc + local.set 3 + local.get 2 + local.set 6 + br 1 (;@2;) + end + local.get 5 + local.get 1 + local.get 2 + call $::allocate + local.get 5 + i32.load offset=4 + local.set 6 + local.get 5 + i32.load + local.set 3 + end + local.get 0 + local.get 3 + local.get 1 + local.get 3 + select + i32.store offset=4 + local.get 6 + local.get 2 + local.get 3 + select + local.set 6 + local.get 3 + i32.eqz + local.set 2 + i32.const 8 + local.set 3 + end + local.get 0 + local.get 3 + i32.add + local.get 6 + i32.store + local.get 0 + local.get 2 + i32.store + local.get 5 + i32.const 16 + i32.add + global.set $__stack_pointer + ) + (func $alloc::raw_vec::handle_error (;17;) (type 12) (param i32 i32 i32) + unreachable + ) + (func $core::ptr::alignment::Alignment::max (;18;) (type 3) (param i32 i32) (result i32) + local.get 0 + local.get 1 + local.get 0 + local.get 1 + i32.gt_u + select + ) + (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") +) diff --git a/felt-repr/tests/expected/onchain_mixed_types_struct.hir b/felt-repr/tests/expected/onchain_mixed_types_struct.hir deleted file mode 100644 index ec4a8a2c8..000000000 --- a/felt-repr/tests/expected/onchain_mixed_types_struct.hir +++ /dev/null @@ -1,1331 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @onchain_mixed_types_struct { - private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { - ^block4(v0: i32, v1: felt): - v4 = arith.constant 8 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.add v3, v4 : u32 #[overflow = checked]; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; - hir.assertz v7 #[code = 250]; - v8 = hir.int_to_ptr v5 : ptr; - v9 = hir.load v8 : i32; - v10 = hir.bitcast v0 : u32; - v987 = arith.constant 4 : u32; - v12 = arith.mod v10, v987 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : i32; - v2 = arith.constant 0 : i32; - v15 = arith.neq v9, v14 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v2 : i1; - scf.if v19{ - ^block104: - scf.yield ; - } else { - ^block7: - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVec::grow_one(v0) - scf.yield ; - }; - v986 = arith.constant 4 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v986 : u32 #[overflow = checked]; - v985 = arith.constant 4 : u32; - v25 = arith.mod v23, v985 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - v27 = hir.load v26 : i32; - v977 = arith.constant 2 : u32; - v31 = arith.shl v9, v977 : i32; - v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v32 : u32; - v984 = arith.constant 4 : u32; - v36 = arith.mod v34, v984 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v1; - v983 = arith.constant 8 : u32; - v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v983 : u32 #[overflow = checked]; - v982 = arith.constant 4 : u32; - v44 = arith.mod v42, v982 : u32; - hir.assertz v44 #[code = 250]; - v38 = arith.constant 1 : i32; - v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v39; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { - ^block8(v46: i32): - v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 16 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; - v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v54 = hir.bitcast v53 : ptr; - hir.store v54, v52; - v57 = hir.bitcast v46 : u32; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v63 = arith.constant 4 : i32; - v62 = arith.constant 1 : i32; - v55 = arith.constant 8 : i32; - v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) - v66 = arith.constant 8 : u32; - v65 = hir.bitcast v52 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v991 = arith.constant 4 : u32; - v69 = arith.mod v67, v991 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i32; - v47 = arith.constant 0 : i32; - v72 = arith.constant -2147483647 : i32; - v73 = arith.eq v71, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v47 : i1; - cf.cond_br v77 ^block10, ^block11; - ^block10: - v990 = arith.constant 16 : i32; - v87 = arith.add v52, v990 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret ; - ^block11: - v79 = arith.constant 12 : u32; - v78 = hir.bitcast v52 : u32; - v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v989 = arith.constant 4 : u32; - v82 = arith.mod v80, v989 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::handle_error(v71, v84, v85) - ub.unreachable ; - }; - - public builtin.function @entrypoint(v90: i32, v91: i32) { - ^block12(v90: i32, v91: i32): - v96 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v97 = hir.bitcast v96 : ptr; - v98 = hir.load v97 : i32; - v99 = arith.constant 32 : i32; - v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; - v101 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v102 = hir.bitcast v101 : ptr; - hir.store v102, v100; - v104 = arith.constant 4 : u32; - v103 = hir.bitcast v91 : u32; - v105 = arith.add v103, v104 : u32 #[overflow = checked]; - v1025 = arith.constant 4 : u32; - v107 = arith.mod v105, v1025 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - v109 = hir.load v108 : felt; - v110 = hir.bitcast v91 : u32; - v1024 = arith.constant 4 : u32; - v112 = arith.mod v110, v1024 : u32; - hir.assertz v112 #[code = 250]; - v113 = hir.int_to_ptr v110 : ptr; - v114 = hir.load v113 : felt; - v116 = arith.constant 8 : u32; - v115 = hir.bitcast v91 : u32; - v117 = arith.add v115, v116 : u32 #[overflow = checked]; - v1023 = arith.constant 4 : u32; - v119 = arith.mod v117, v1023 : u32; - hir.assertz v119 #[code = 250]; - v120 = hir.int_to_ptr v117 : ptr; - v121 = hir.load v120 : felt; - v122 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v121) : i64 - v124 = arith.constant 12 : u32; - v123 = hir.bitcast v91 : u32; - v125 = arith.add v123, v124 : u32 #[overflow = checked]; - v1022 = arith.constant 4 : u32; - v127 = arith.mod v125, v1022 : u32; - hir.assertz v127 #[code = 250]; - v128 = hir.int_to_ptr v125 : ptr; - v129 = hir.load v128 : felt; - v130 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v129) : i64 - v132 = arith.constant 16 : u32; - v131 = hir.bitcast v91 : u32; - v133 = arith.add v131, v132 : u32 #[overflow = checked]; - v1021 = arith.constant 4 : u32; - v135 = arith.mod v133, v1021 : u32; - hir.assertz v135 #[code = 250]; - v136 = hir.int_to_ptr v133 : ptr; - v137 = hir.load v136 : felt; - v138 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v137) : i64 - v140 = arith.constant 20 : u32; - v139 = hir.bitcast v91 : u32; - v141 = arith.add v139, v140 : u32 #[overflow = checked]; - v1020 = arith.constant 4 : u32; - v143 = arith.mod v141, v1020 : u32; - hir.assertz v143 #[code = 250]; - v144 = hir.int_to_ptr v141 : ptr; - v145 = hir.load v144 : felt; - v146 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::as_u64(v145) : i64 - v148 = arith.constant 255 : i32; - v147 = arith.trunc v146 : i32; - v149 = arith.band v147, v148 : i32; - v150 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/>::from(v149) : felt - v151 = arith.constant 66 : i32; - v152 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::from_u32(v151) : felt - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::assert_eq(v150, v152) - v157 = arith.constant 4 : i32; - v92 = arith.constant 0 : i32; - v155 = arith.constant 256 : i32; - v153 = arith.constant 20 : i32; - v154 = arith.add v100, v153 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v154, v155, v92, v157, v157) - v160 = arith.constant 24 : u32; - v159 = hir.bitcast v100 : u32; - v161 = arith.add v159, v160 : u32 #[overflow = checked]; - v1019 = arith.constant 4 : u32; - v163 = arith.mod v161, v1019 : u32; - hir.assertz v163 #[code = 250]; - v164 = hir.int_to_ptr v161 : ptr; - v165 = hir.load v164 : i32; - v1018 = arith.constant 20 : u32; - v166 = hir.bitcast v100 : u32; - v168 = arith.add v166, v1018 : u32 #[overflow = checked]; - v1017 = arith.constant 4 : u32; - v170 = arith.mod v168, v1017 : u32; - hir.assertz v170 #[code = 250]; - v171 = hir.int_to_ptr v168 : ptr; - v172 = hir.load v171 : i32; - v1016 = arith.constant 0 : i32; - v173 = arith.constant 1 : i32; - v174 = arith.neq v172, v173 : i1; - v175 = arith.zext v174 : u32; - v176 = hir.bitcast v175 : i32; - v178 = arith.neq v176, v1016 : i1; - cf.cond_br v178 ^block14, ^block15; - ^block14: - v1015 = arith.constant 8 : i32; - v187 = arith.constant 8 : i32; - v188 = arith.add v100, v187 : i32 #[overflow = wrapping]; - v190 = arith.add v188, v1015 : i32 #[overflow = wrapping]; - v192 = hir.bitcast v190 : u32; - v1014 = arith.constant 4 : u32; - v194 = arith.mod v192, v1014 : u32; - hir.assertz v194 #[code = 250]; - v1013 = arith.constant 0 : i32; - v195 = hir.int_to_ptr v192 : ptr; - hir.store v195, v1013; - v197 = arith.constant 28 : u32; - v196 = hir.bitcast v100 : u32; - v198 = arith.add v196, v197 : u32 #[overflow = checked]; - v1012 = arith.constant 4 : u32; - v200 = arith.mod v198, v1012 : u32; - hir.assertz v200 #[code = 250]; - v201 = hir.int_to_ptr v198 : ptr; - v202 = hir.load v201 : i32; - v1011 = arith.constant 12 : u32; - v203 = hir.bitcast v100 : u32; - v205 = arith.add v203, v1011 : u32 #[overflow = checked]; - v1010 = arith.constant 4 : u32; - v207 = arith.mod v205, v1010 : u32; - hir.assertz v207 #[code = 250]; - v208 = hir.int_to_ptr v205 : ptr; - hir.store v208, v202; - v1009 = arith.constant 8 : u32; - v209 = hir.bitcast v100 : u32; - v211 = arith.add v209, v1009 : u32 #[overflow = checked]; - v1008 = arith.constant 4 : u32; - v213 = arith.mod v211, v1008 : u32; - hir.assertz v213 #[code = 250]; - v214 = hir.int_to_ptr v211 : ptr; - hir.store v214, v165; - v1007 = arith.constant 8 : i32; - v216 = arith.add v100, v1007 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v216, v114) - v1006 = arith.constant 8 : i32; - v218 = arith.add v100, v1006 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v218, v109) - v221 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::from_u64_unchecked(v122) : felt - v1005 = arith.constant 8 : i32; - v220 = arith.add v100, v1005 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v220, v221) - v224 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::felt::from_u64_unchecked(v130) : felt - v1004 = arith.constant 8 : i32; - v223 = arith.add v100, v1004 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v223, v224) - v227 = arith.trunc v138 : i32; - v228 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/>::from(v227) : felt - v1003 = arith.constant 8 : i32; - v226 = arith.add v100, v1003 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v226, v228) - v231 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/>::from(v149) : felt - v1002 = arith.constant 8 : i32; - v230 = arith.add v100, v1002 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::vec::Vec::push(v230, v231) - v234 = hir.bitcast v190 : u32; - v1001 = arith.constant 4 : u32; - v236 = arith.mod v234, v1001 : u32; - hir.assertz v236 #[code = 250]; - v237 = hir.int_to_ptr v234 : ptr; - v238 = hir.load v237 : i32; - v1000 = arith.constant 8 : i32; - v233 = arith.add v90, v1000 : i32 #[overflow = wrapping]; - v239 = hir.bitcast v233 : u32; - v999 = arith.constant 4 : u32; - v241 = arith.mod v239, v999 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - hir.store v242, v238; - v998 = arith.constant 8 : u32; - v243 = hir.bitcast v100 : u32; - v245 = arith.add v243, v998 : u32 #[overflow = checked]; - v997 = arith.constant 4 : u32; - v247 = arith.mod v245, v997 : u32; - hir.assertz v247 #[code = 250]; - v248 = hir.int_to_ptr v245 : ptr; - v249 = hir.load v248 : i64; - v250 = hir.bitcast v90 : u32; - v996 = arith.constant 4 : u32; - v252 = arith.mod v250, v996 : u32; - hir.assertz v252 #[code = 250]; - v253 = hir.int_to_ptr v250 : ptr; - hir.store v253, v249; - v995 = arith.constant 32 : i32; - v255 = arith.add v100, v995 : i32 #[overflow = wrapping]; - v256 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v257 = hir.bitcast v256 : ptr; - hir.store v257, v255; - builtin.ret ; - ^block15: - v994 = arith.constant 28 : u32; - v179 = hir.bitcast v100 : u32; - v181 = arith.add v179, v994 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v183 = arith.mod v181, v993 : u32; - hir.assertz v183 #[code = 250]; - v184 = hir.int_to_ptr v181 : ptr; - v185 = hir.load v184 : i32; - v186 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::handle_error(v165, v185, v186) - ub.unreachable ; - }; - - private builtin.function @__rustc::__rust_alloc(v258: i32, v259: i32) -> i32 { - ^block16(v258: i32, v259: i32): - v261 = arith.constant 1048604 : i32; - v262 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::alloc(v261, v259, v258) : i32 - builtin.ret v262; - }; - - private builtin.function @__rustc::__rust_realloc(v263: i32, v264: i32, v265: i32, v266: i32) -> i32 { - ^block18(v263: i32, v264: i32, v265: i32, v266: i32): - v268 = arith.constant 1048604 : i32; - v269 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::alloc(v268, v265, v266) : i32 - v1034 = arith.constant 0 : i32; - v270 = arith.constant 0 : i32; - v271 = arith.eq v269, v270 : i1; - v272 = arith.zext v271 : u32; - v273 = hir.bitcast v272 : i32; - v275 = arith.neq v273, v1034 : i1; - scf.if v275{ - ^block20: - scf.yield ; - } else { - ^block21: - v1033 = arith.constant 0 : i32; - v277 = hir.bitcast v264 : u32; - v276 = hir.bitcast v266 : u32; - v278 = arith.lt v276, v277 : i1; - v279 = arith.zext v278 : u32; - v280 = hir.bitcast v279 : i32; - v282 = arith.neq v280, v1033 : i1; - v283 = cf.select v282, v266, v264 : i32; - v1031 = arith.constant 0 : i32; - v1032 = arith.constant 0 : i32; - v285 = arith.eq v283, v1032 : i1; - v286 = arith.zext v285 : u32; - v287 = hir.bitcast v286 : i32; - v289 = arith.neq v287, v1031 : i1; - scf.if v289{ - ^block110: - scf.yield ; - } else { - ^block22: - v290 = hir.bitcast v283 : u32; - v291 = hir.bitcast v269 : u32; - v292 = hir.int_to_ptr v291 : ptr; - v293 = hir.bitcast v263 : u32; - v294 = hir.int_to_ptr v293 : ptr; - hir.mem_cpy v294, v292, v290; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v269; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v296: i32, v297: i32) -> i32 { - ^block23(v296: i32, v297: i32): - v299 = arith.constant 1048604 : i32; - v300 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::alloc(v299, v297, v296) : i32 - v1043 = arith.constant 0 : i32; - v301 = arith.constant 0 : i32; - v302 = arith.eq v300, v301 : i1; - v303 = arith.zext v302 : u32; - v304 = hir.bitcast v303 : i32; - v306 = arith.neq v304, v1043 : i1; - scf.if v306{ - ^block25: - scf.yield ; - } else { - ^block26: - v1041 = arith.constant 0 : i32; - v1042 = arith.constant 0 : i32; - v308 = arith.eq v296, v1042 : i1; - v309 = arith.zext v308 : u32; - v310 = hir.bitcast v309 : i32; - v312 = arith.neq v310, v1041 : i1; - scf.if v312{ - ^block113: - scf.yield ; - } else { - ^block27: - v1035 = arith.constant 0 : u8; - v315 = hir.bitcast v296 : u32; - v316 = hir.bitcast v300 : u32; - v317 = hir.int_to_ptr v316 : ptr; - hir.mem_set v317, v315, v1035; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v300; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block28: - builtin.ret ; - }; - - private builtin.function @::alloc(v319: i32, v320: i32, v321: i32) -> i32 { - ^block30(v319: i32, v320: i32, v321: i32): - v324 = arith.constant 16 : i32; - v323 = arith.constant 0 : i32; - v1045 = arith.constant 16 : u32; - v326 = hir.bitcast v320 : u32; - v328 = arith.gt v326, v1045 : i1; - v329 = arith.zext v328 : u32; - v330 = hir.bitcast v329 : i32; - v332 = arith.neq v330, v323 : i1; - v333 = cf.select v332, v320, v324 : i32; - v1085 = arith.constant 0 : i32; - v334 = arith.constant -1 : i32; - v335 = arith.add v333, v334 : i32 #[overflow = wrapping]; - v336 = arith.band v333, v335 : i32; - v338 = arith.neq v336, v1085 : i1; - v1054, v1055 = scf.if v338 : i32, u32 { - ^block118: - v1046 = arith.constant 0 : u32; - v1050 = ub.poison i32 : i32; - scf.yield v1050, v1046; - } else { - ^block33: - v340 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/core::ptr::alignment::Alignment::max(v320, v333) : i32 - v1084 = arith.constant 0 : i32; - v339 = arith.constant -2147483648 : i32; - v341 = arith.sub v339, v340 : i32 #[overflow = wrapping]; - v343 = hir.bitcast v341 : u32; - v342 = hir.bitcast v321 : u32; - v344 = arith.gt v342, v343 : i1; - v345 = arith.zext v344 : u32; - v346 = hir.bitcast v345 : i32; - v348 = arith.neq v346, v1084 : i1; - v1069 = scf.if v348 : i32 { - ^block117: - v1083 = ub.poison i32 : i32; - scf.yield v1083; - } else { - ^block34: - v1081 = arith.constant 0 : i32; - v354 = arith.sub v1081, v340 : i32 #[overflow = wrapping]; - v1082 = arith.constant -1 : i32; - v350 = arith.add v321, v340 : i32 #[overflow = wrapping]; - v352 = arith.add v350, v1082 : i32 #[overflow = wrapping]; - v355 = arith.band v352, v354 : i32; - v356 = hir.bitcast v319 : u32; - v357 = arith.constant 4 : u32; - v358 = arith.mod v356, v357 : u32; - hir.assertz v358 #[code = 250]; - v359 = hir.int_to_ptr v356 : ptr; - v360 = hir.load v359 : i32; - v1080 = arith.constant 0 : i32; - v362 = arith.neq v360, v1080 : i1; - scf.if v362{ - ^block116: - scf.yield ; - } else { - ^block36: - v363 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/intrinsics::mem::heap_base() : i32 - v364 = hir.mem_size : u32; - v370 = hir.bitcast v319 : u32; - v1079 = arith.constant 4 : u32; - v372 = arith.mod v370, v1079 : u32; - hir.assertz v372 #[code = 250]; - v1078 = arith.constant 16 : u32; - v365 = hir.bitcast v364 : i32; - v368 = arith.shl v365, v1078 : i32; - v369 = arith.add v363, v368 : i32 #[overflow = wrapping]; - v373 = hir.int_to_ptr v370 : ptr; - hir.store v373, v369; - scf.yield ; - }; - v376 = hir.bitcast v319 : u32; - v1077 = arith.constant 4 : u32; - v378 = arith.mod v376, v1077 : u32; - hir.assertz v378 #[code = 250]; - v379 = hir.int_to_ptr v376 : ptr; - v380 = hir.load v379 : i32; - v1075 = arith.constant 0 : i32; - v1076 = arith.constant -1 : i32; - v382 = arith.bxor v380, v1076 : i32; - v384 = hir.bitcast v382 : u32; - v383 = hir.bitcast v355 : u32; - v385 = arith.gt v383, v384 : i1; - v386 = arith.zext v385 : u32; - v387 = hir.bitcast v386 : i32; - v389 = arith.neq v387, v1075 : i1; - v1068 = scf.if v389 : i32 { - ^block37: - v1074 = arith.constant 0 : i32; - scf.yield v1074; - } else { - ^block38: - v391 = hir.bitcast v319 : u32; - v1073 = arith.constant 4 : u32; - v393 = arith.mod v391, v1073 : u32; - hir.assertz v393 #[code = 250]; - v390 = arith.add v380, v355 : i32 #[overflow = wrapping]; - v394 = hir.int_to_ptr v391 : ptr; - hir.store v394, v390; - v396 = arith.add v380, v340 : i32 #[overflow = wrapping]; - scf.yield v396; - }; - scf.yield v1068; - }; - v1051 = arith.constant 1 : u32; - v1072 = arith.constant 0 : u32; - v1070 = cf.select v348, v1072, v1051 : u32; - scf.yield v1069, v1070; - }; - v1071 = arith.constant 0 : u32; - v1067 = arith.eq v1055, v1071 : i1; - cf.cond_br v1067 ^block32, ^block120(v1054); - ^block32: - ub.unreachable ; - ^block120(v1047: i32): - builtin.ret v1047; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block39: - v399 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v399; - }; - - private builtin.function @>::from(v401: i32) -> felt { - ^block43(v401: i32): - v403 = hir.bitcast v401 : felt; - builtin.ret v403; - }; - - private builtin.function @intrinsics::felt::from_u64_unchecked(v404: i64) -> felt { - ^block45(v404: i64): - v405 = hir.cast v404 : felt; - builtin.ret v405; - }; - - private builtin.function @intrinsics::felt::from_u32(v407: i32) -> felt { - ^block47(v407: i32): - v408 = hir.bitcast v407 : felt; - builtin.ret v408; - }; - - private builtin.function @intrinsics::felt::as_u64(v410: felt) -> i64 { - ^block49(v410: felt): - v411 = hir.cast v410 : i64; - builtin.ret v411; - }; - - private builtin.function @intrinsics::felt::assert_eq(v413: felt, v414: felt) { - ^block51(v413: felt, v414: felt): - hir.assert_eq v413, v414; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v415: i32, v416: i32, v417: i32, v418: i32, v419: i32, v420: i32) { - ^block53(v415: i32, v416: i32, v417: i32, v418: i32, v419: i32, v420: i32): - v423 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v424 = hir.bitcast v423 : ptr; - v425 = hir.load v424 : i32; - v426 = arith.constant 32 : i32; - v427 = arith.sub v425, v426 : i32 #[overflow = wrapping]; - v428 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v429 = hir.bitcast v428 : ptr; - hir.store v429, v427; - v1162 = arith.constant 0 : i32; - v421 = arith.constant 0 : i32; - v432 = arith.eq v420, v421 : i1; - v433 = arith.zext v432 : u32; - v434 = hir.bitcast v433 : i32; - v436 = arith.neq v434, v1162 : i1; - v1133, v1134 = scf.if v436 : i32, i32 { - ^block56: - v1161 = arith.constant 0 : i32; - scf.yield v1161, v1161; - } else { - ^block57: - v437 = arith.add v417, v418 : i32 #[overflow = wrapping]; - v1160 = arith.constant 0 : i32; - v439 = hir.bitcast v417 : u32; - v438 = hir.bitcast v437 : u32; - v440 = arith.lt v438, v439 : i1; - v441 = arith.zext v440 : u32; - v442 = hir.bitcast v441 : i32; - v444 = arith.neq v442, v1160 : i1; - v1131, v1132 = scf.if v444 : i32, i32 { - ^block126: - v1159 = arith.constant 0 : i32; - scf.yield v1159, v1159; - } else { - ^block58: - v455 = hir.bitcast v416 : u32; - v569 = arith.constant 4 : u32; - v457 = arith.mod v455, v569 : u32; - hir.assertz v457 #[code = 250]; - v458 = hir.int_to_ptr v455 : ptr; - v459 = hir.load v458 : i32; - v1087 = arith.constant 1 : u32; - v462 = arith.shl v459, v1087 : i32; - v1158 = arith.constant 0 : i32; - v464 = hir.bitcast v462 : u32; - v463 = hir.bitcast v437 : u32; - v465 = arith.gt v463, v464 : i1; - v466 = arith.zext v465 : u32; - v467 = hir.bitcast v466 : i32; - v469 = arith.neq v467, v1158 : i1; - v470 = cf.select v469, v437, v462 : i32; - v1155 = arith.constant 1 : i32; - v472 = arith.constant 4 : i32; - v1156 = arith.constant 0 : i32; - v1086 = arith.constant 1025 : u32; - v475 = hir.bitcast v420 : u32; - v477 = arith.lt v475, v1086 : i1; - v478 = arith.zext v477 : u32; - v479 = hir.bitcast v478 : i32; - v481 = arith.neq v479, v1156 : i1; - v482 = cf.select v481, v472, v1155 : i32; - v471 = arith.constant 8 : i32; - v1157 = arith.constant 0 : i32; - v460 = arith.constant 1 : i32; - v484 = arith.eq v420, v460 : i1; - v485 = arith.zext v484 : u32; - v486 = hir.bitcast v485 : i32; - v488 = arith.neq v486, v1157 : i1; - v489 = cf.select v488, v471, v482 : i32; - v1154 = arith.constant 0 : i32; - v491 = hir.bitcast v489 : u32; - v490 = hir.bitcast v470 : u32; - v492 = arith.gt v490, v491 : i1; - v493 = arith.zext v492 : u32; - v494 = hir.bitcast v493 : i32; - v496 = arith.neq v494, v1154 : i1; - v497 = cf.select v496, v470, v489 : i32; - v498 = hir.bitcast v497 : u32; - v499 = arith.zext v498 : u64; - v500 = hir.bitcast v499 : i64; - v1153 = arith.constant 0 : i32; - v450 = arith.sub v1153, v419 : i32 #[overflow = wrapping]; - v447 = arith.constant -1 : i32; - v446 = arith.add v419, v420 : i32 #[overflow = wrapping]; - v448 = arith.add v446, v447 : i32 #[overflow = wrapping]; - v451 = arith.band v448, v450 : i32; - v452 = hir.bitcast v451 : u32; - v453 = arith.zext v452 : u64; - v454 = hir.bitcast v453 : i64; - v501 = arith.mul v454, v500 : i64 #[overflow = wrapping]; - v1152 = arith.constant 0 : i32; - v502 = arith.constant 32 : i64; - v504 = hir.cast v502 : u32; - v503 = hir.bitcast v501 : u64; - v505 = arith.shr v503, v504 : u64; - v506 = hir.bitcast v505 : i64; - v507 = arith.trunc v506 : i32; - v509 = arith.neq v507, v1152 : i1; - v1129, v1130 = scf.if v509 : i32, i32 { - ^block125: - v1151 = arith.constant 0 : i32; - scf.yield v470, v1151; - } else { - ^block59: - v510 = arith.trunc v501 : i32; - v1150 = arith.constant 0 : i32; - v511 = arith.constant -2147483648 : i32; - v512 = arith.sub v511, v419 : i32 #[overflow = wrapping]; - v514 = hir.bitcast v512 : u32; - v513 = hir.bitcast v510 : u32; - v515 = arith.gt v513, v514 : i1; - v516 = arith.zext v515 : u32; - v517 = hir.bitcast v516 : i32; - v519 = arith.neq v517, v1150 : i1; - v1127, v1128 = scf.if v519 : i32, i32 { - ^block124: - v1149 = arith.constant 0 : i32; - scf.yield v470, v1149; - } else { - ^block60: - v520 = arith.constant 20 : i32; - v521 = arith.add v427, v520 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::RawVecInner::current_memory(v521, v416, v419, v420) - v1147 = arith.constant 20 : i32; - v525 = arith.add v427, v1147 : i32 #[overflow = wrapping]; - v1148 = arith.constant 8 : i32; - v523 = arith.add v427, v1148 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::raw_vec::finish_grow(v523, v419, v510, v525, v415) - v527 = arith.constant 12 : u32; - v526 = hir.bitcast v427 : u32; - v528 = arith.add v526, v527 : u32 #[overflow = checked]; - v1146 = arith.constant 4 : u32; - v530 = arith.mod v528, v1146 : u32; - hir.assertz v530 #[code = 250]; - v531 = hir.int_to_ptr v528 : ptr; - v532 = hir.load v531 : i32; - v534 = arith.constant 8 : u32; - v533 = hir.bitcast v427 : u32; - v535 = arith.add v533, v534 : u32 #[overflow = checked]; - v1145 = arith.constant 4 : u32; - v537 = arith.mod v535, v1145 : u32; - hir.assertz v537 #[code = 250]; - v538 = hir.int_to_ptr v535 : ptr; - v539 = hir.load v538 : i32; - v1143 = arith.constant 0 : i32; - v1144 = arith.constant 0 : i32; - v541 = arith.eq v539, v1144 : i1; - v542 = arith.zext v541 : u32; - v543 = hir.bitcast v542 : i32; - v545 = arith.neq v543, v1143 : i1; - v1125 = scf.if v545 : i32 { - ^block61: - v553 = hir.bitcast v416 : u32; - v1142 = arith.constant 4 : u32; - v555 = arith.mod v553, v1142 : u32; - hir.assertz v555 #[code = 250]; - v556 = hir.int_to_ptr v553 : ptr; - hir.store v556, v497; - v1141 = arith.constant 4 : u32; - v557 = hir.bitcast v416 : u32; - v559 = arith.add v557, v1141 : u32 #[overflow = checked]; - v1140 = arith.constant 4 : u32; - v561 = arith.mod v559, v1140 : u32; - hir.assertz v561 #[code = 250]; - v562 = hir.int_to_ptr v559 : ptr; - hir.store v562, v532; - scf.yield v470; - } else { - ^block62: - v547 = arith.constant 16 : u32; - v546 = hir.bitcast v427 : u32; - v548 = arith.add v546, v547 : u32 #[overflow = checked]; - v1139 = arith.constant 4 : u32; - v550 = arith.mod v548, v1139 : u32; - hir.assertz v550 #[code = 250]; - v551 = hir.int_to_ptr v548 : ptr; - v552 = hir.load v551 : i32; - scf.yield v552; - }; - v563 = arith.constant -2147483647 : i32; - v1126 = cf.select v545, v563, v532 : i32; - scf.yield v1125, v1126; - }; - scf.yield v1127, v1128; - }; - scf.yield v1129, v1130; - }; - scf.yield v1131, v1132; - }; - v1138 = arith.constant 4 : u32; - v568 = hir.bitcast v415 : u32; - v570 = arith.add v568, v1138 : u32 #[overflow = checked]; - v1137 = arith.constant 4 : u32; - v572 = arith.mod v570, v1137 : u32; - hir.assertz v572 #[code = 250]; - v573 = hir.int_to_ptr v570 : ptr; - hir.store v573, v1133; - v576 = hir.bitcast v415 : u32; - v1136 = arith.constant 4 : u32; - v578 = arith.mod v576, v1136 : u32; - hir.assertz v578 #[code = 250]; - v579 = hir.int_to_ptr v576 : ptr; - hir.store v579, v1134; - v1135 = arith.constant 32 : i32; - v583 = arith.add v427, v1135 : i32 #[overflow = wrapping]; - v584 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v585 = hir.bitcast v584 : ptr; - hir.store v585, v583; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v586: i32, v587: i32, v588: i32, v589: i32, v590: i32) { - ^block63(v586: i32, v587: i32, v588: i32, v589: i32, v590: i32): - v593 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v594 = hir.bitcast v593 : ptr; - v595 = hir.load v594 : i32; - v596 = arith.constant 16 : i32; - v597 = arith.sub v595, v596 : i32 #[overflow = wrapping]; - v598 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v599 = hir.bitcast v598 : ptr; - hir.store v599, v597; - v609 = hir.bitcast v587 : u32; - v610 = arith.zext v609 : u64; - v611 = hir.bitcast v610 : i64; - v591 = arith.constant 0 : i32; - v604 = arith.sub v591, v589 : i32 #[overflow = wrapping]; - v601 = arith.constant -1 : i32; - v600 = arith.add v589, v590 : i32 #[overflow = wrapping]; - v602 = arith.add v600, v601 : i32 #[overflow = wrapping]; - v605 = arith.band v602, v604 : i32; - v606 = hir.bitcast v605 : u32; - v607 = arith.zext v606 : u64; - v608 = hir.bitcast v607 : i64; - v612 = arith.mul v608, v611 : i64 #[overflow = wrapping]; - v1266 = arith.constant 0 : i32; - v613 = arith.constant 32 : i64; - v615 = hir.cast v613 : u32; - v614 = hir.bitcast v612 : u64; - v616 = arith.shr v614, v615 : u64; - v617 = hir.bitcast v616 : i64; - v618 = arith.trunc v617 : i32; - v620 = arith.neq v618, v1266 : i1; - v1178, v1179, v1180, v1181, v1182, v1183 = scf.if v620 : i32, i32, i32, i32, i32, u32 { - ^block132: - v1163 = arith.constant 0 : u32; - v1170 = ub.poison i32 : i32; - scf.yield v586, v597, v1170, v1170, v1170, v1163; - } else { - ^block68: - v621 = arith.trunc v612 : i32; - v1265 = arith.constant 0 : i32; - v622 = arith.constant -2147483648 : i32; - v623 = arith.sub v622, v589 : i32 #[overflow = wrapping]; - v625 = hir.bitcast v623 : u32; - v624 = hir.bitcast v621 : u32; - v626 = arith.lte v624, v625 : i1; - v627 = arith.zext v626 : u32; - v628 = hir.bitcast v627 : i32; - v630 = arith.neq v628, v1265 : i1; - v1226 = scf.if v630 : i32 { - ^block66: - v1264 = arith.constant 0 : i32; - v641 = arith.neq v621, v1264 : i1; - v1225 = scf.if v641 : i32 { - ^block70: - v1263 = arith.constant 0 : i32; - v657 = arith.neq v588, v1263 : i1; - v1224 = scf.if v657 : i32 { - ^block73: - v639 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::alloc::Global::alloc_impl(v597, v589, v621, v639) - v668 = hir.bitcast v597 : u32; - v713 = arith.constant 4 : u32; - v670 = arith.mod v668, v713 : u32; - hir.assertz v670 #[code = 250]; - v671 = hir.int_to_ptr v668 : ptr; - v672 = hir.load v671 : i32; - scf.yield v672; - } else { - ^block74: - v658 = arith.constant 8 : i32; - v659 = arith.add v597, v658 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::allocate(v659, v589, v621) - v643 = arith.constant 8 : u32; - v660 = hir.bitcast v597 : u32; - v662 = arith.add v660, v643 : u32 #[overflow = checked]; - v1262 = arith.constant 4 : u32; - v664 = arith.mod v662, v1262 : u32; - hir.assertz v664 #[code = 250]; - v665 = hir.int_to_ptr v662 : ptr; - v666 = hir.load v665 : i32; - scf.yield v666; - }; - v1260 = arith.constant 0 : i32; - v1261 = arith.constant 0 : i32; - v675 = arith.eq v1224, v1261 : i1; - v676 = arith.zext v675 : u32; - v677 = hir.bitcast v676 : i32; - v679 = arith.neq v677, v1260 : i1; - scf.if v679{ - ^block75: - v1259 = arith.constant 8 : u32; - v696 = hir.bitcast v586 : u32; - v698 = arith.add v696, v1259 : u32 #[overflow = checked]; - v1258 = arith.constant 4 : u32; - v700 = arith.mod v698, v1258 : u32; - hir.assertz v700 #[code = 250]; - v701 = hir.int_to_ptr v698 : ptr; - hir.store v701, v621; - v1257 = arith.constant 4 : u32; - v703 = hir.bitcast v586 : u32; - v705 = arith.add v703, v1257 : u32 #[overflow = checked]; - v1256 = arith.constant 4 : u32; - v707 = arith.mod v705, v1256 : u32; - hir.assertz v707 #[code = 250]; - v708 = hir.int_to_ptr v705 : ptr; - hir.store v708, v589; - scf.yield ; - } else { - ^block76: - v1255 = arith.constant 8 : u32; - v681 = hir.bitcast v586 : u32; - v683 = arith.add v681, v1255 : u32 #[overflow = checked]; - v1254 = arith.constant 4 : u32; - v685 = arith.mod v683, v1254 : u32; - hir.assertz v685 #[code = 250]; - v686 = hir.int_to_ptr v683 : ptr; - hir.store v686, v1224; - v1253 = arith.constant 4 : u32; - v688 = hir.bitcast v586 : u32; - v690 = arith.add v688, v1253 : u32 #[overflow = checked]; - v1252 = arith.constant 4 : u32; - v692 = arith.mod v690, v1252 : u32; - hir.assertz v692 #[code = 250]; - v693 = hir.int_to_ptr v690 : ptr; - hir.store v693, v587; - scf.yield ; - }; - v1250 = arith.constant 0 : i32; - v1251 = arith.constant 1 : i32; - v1223 = cf.select v679, v1251, v1250 : i32; - scf.yield v1223; - } else { - ^block71: - v1249 = arith.constant 8 : u32; - v642 = hir.bitcast v586 : u32; - v644 = arith.add v642, v1249 : u32 #[overflow = checked]; - v1248 = arith.constant 4 : u32; - v646 = arith.mod v644, v1248 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - hir.store v647, v589; - v1247 = arith.constant 4 : u32; - v650 = hir.bitcast v586 : u32; - v652 = arith.add v650, v1247 : u32 #[overflow = checked]; - v1246 = arith.constant 4 : u32; - v654 = arith.mod v652, v1246 : u32; - hir.assertz v654 #[code = 250]; - v1245 = arith.constant 0 : i32; - v655 = hir.int_to_ptr v652 : ptr; - hir.store v655, v1245; - v1244 = arith.constant 0 : i32; - scf.yield v1244; - }; - scf.yield v1225; - } else { - ^block69: - v1243 = ub.poison i32 : i32; - scf.yield v1243; - }; - v1238 = arith.constant 0 : u32; - v1171 = arith.constant 1 : u32; - v1231 = cf.select v630, v1171, v1238 : u32; - v1239 = ub.poison i32 : i32; - v1230 = cf.select v630, v597, v1239 : i32; - v1240 = ub.poison i32 : i32; - v1229 = cf.select v630, v586, v1240 : i32; - v1241 = ub.poison i32 : i32; - v1228 = cf.select v630, v1241, v597 : i32; - v1242 = ub.poison i32 : i32; - v1227 = cf.select v630, v1242, v586 : i32; - scf.yield v1227, v1228, v1229, v1226, v1230, v1231; - }; - v1184, v1185, v1186 = scf.index_switch v1183 : i32, i32, i32 - case 0 { - ^block67: - v1237 = arith.constant 4 : u32; - v633 = hir.bitcast v1178 : u32; - v635 = arith.add v633, v1237 : u32 #[overflow = checked]; - v1236 = arith.constant 4 : u32; - v637 = arith.mod v635, v1236 : u32; - hir.assertz v637 #[code = 250]; - v1235 = arith.constant 0 : i32; - v638 = hir.int_to_ptr v635 : ptr; - hir.store v638, v1235; - v1234 = arith.constant 1 : i32; - scf.yield v1178, v1234, v1179; - } - default { - ^block136: - scf.yield v1180, v1181, v1182; - }; - v712 = hir.bitcast v1184 : u32; - v1233 = arith.constant 4 : u32; - v714 = arith.mod v712, v1233 : u32; - hir.assertz v714 #[code = 250]; - v715 = hir.int_to_ptr v712 : ptr; - hir.store v715, v1185; - v1232 = arith.constant 16 : i32; - v720 = arith.add v1186, v1232 : i32 #[overflow = wrapping]; - v721 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v722 = hir.bitcast v721 : ptr; - hir.store v722, v720; - builtin.ret ; - }; - - private builtin.function @::allocate(v723: i32, v724: i32, v725: i32) { - ^block77(v723: i32, v724: i32, v725: i32): - v727 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v728 = hir.bitcast v727 : ptr; - v729 = hir.load v728 : i32; - v730 = arith.constant 16 : i32; - v731 = arith.sub v729, v730 : i32 #[overflow = wrapping]; - v732 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v733 = hir.bitcast v732 : ptr; - hir.store v733, v731; - v726 = arith.constant 0 : i32; - v734 = arith.constant 8 : i32; - v735 = arith.add v731, v734 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::alloc::Global::alloc_impl(v735, v724, v725, v726) - v738 = arith.constant 12 : u32; - v737 = hir.bitcast v731 : u32; - v739 = arith.add v737, v738 : u32 #[overflow = checked]; - v740 = arith.constant 4 : u32; - v741 = arith.mod v739, v740 : u32; - hir.assertz v741 #[code = 250]; - v742 = hir.int_to_ptr v739 : ptr; - v743 = hir.load v742 : i32; - v745 = arith.constant 8 : u32; - v744 = hir.bitcast v731 : u32; - v746 = arith.add v744, v745 : u32 #[overflow = checked]; - v1271 = arith.constant 4 : u32; - v748 = arith.mod v746, v1271 : u32; - hir.assertz v748 #[code = 250]; - v749 = hir.int_to_ptr v746 : ptr; - v750 = hir.load v749 : i32; - v751 = hir.bitcast v723 : u32; - v1270 = arith.constant 4 : u32; - v753 = arith.mod v751, v1270 : u32; - hir.assertz v753 #[code = 250]; - v754 = hir.int_to_ptr v751 : ptr; - hir.store v754, v750; - v1269 = arith.constant 4 : u32; - v755 = hir.bitcast v723 : u32; - v757 = arith.add v755, v1269 : u32 #[overflow = checked]; - v1268 = arith.constant 4 : u32; - v759 = arith.mod v757, v1268 : u32; - hir.assertz v759 #[code = 250]; - v760 = hir.int_to_ptr v757 : ptr; - hir.store v760, v743; - v1267 = arith.constant 16 : i32; - v762 = arith.add v731, v1267 : i32 #[overflow = wrapping]; - v763 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v764 = hir.bitcast v763 : ptr; - hir.store v764, v762; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v765: i32, v766: i32, v767: i32, v768: i32) { - ^block79(v765: i32, v766: i32, v767: i32, v768: i32): - v1287 = arith.constant 0 : i32; - v769 = arith.constant 0 : i32; - v770 = arith.eq v767, v769 : i1; - v771 = arith.zext v770 : u32; - v772 = hir.bitcast v771 : i32; - v774 = arith.neq v772, v1287 : i1; - v1283 = scf.if v774 : i32 { - ^block139: - scf.yield v766; - } else { - ^block82: - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1286 = arith.constant 0 : i32; - v776 = arith.neq v768, v1286 : i1; - v1282 = scf.if v776 : i32 { - ^block83: - v778 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_alloc_zeroed(v767, v766) : i32 - scf.yield v778; - } else { - ^block84: - v777 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_alloc(v767, v766) : i32 - scf.yield v777; - }; - scf.yield v1282; - }; - v782 = arith.constant 4 : u32; - v781 = hir.bitcast v765 : u32; - v783 = arith.add v781, v782 : u32 #[overflow = checked]; - v1285 = arith.constant 4 : u32; - v785 = arith.mod v783, v1285 : u32; - hir.assertz v785 #[code = 250]; - v786 = hir.int_to_ptr v783 : ptr; - hir.store v786, v767; - v788 = hir.bitcast v765 : u32; - v1284 = arith.constant 4 : u32; - v790 = arith.mod v788, v1284 : u32; - hir.assertz v790 #[code = 250]; - v791 = hir.int_to_ptr v788 : ptr; - hir.store v791, v1283; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v792: i32, v793: i32, v794: i32, v795: i32) { - ^block85(v792: i32, v793: i32, v794: i32, v795: i32): - v1313 = arith.constant 0 : i32; - v796 = arith.constant 0 : i32; - v800 = arith.eq v795, v796 : i1; - v801 = arith.zext v800 : u32; - v802 = hir.bitcast v801 : i32; - v804 = arith.neq v802, v1313 : i1; - v1300, v1301 = scf.if v804 : i32, i32 { - ^block143: - v1312 = arith.constant 0 : i32; - v798 = arith.constant 4 : i32; - scf.yield v798, v1312; - } else { - ^block88: - v805 = hir.bitcast v793 : u32; - v840 = arith.constant 4 : u32; - v807 = arith.mod v805, v840 : u32; - hir.assertz v807 #[code = 250]; - v808 = hir.int_to_ptr v805 : ptr; - v809 = hir.load v808 : i32; - v1310 = arith.constant 0 : i32; - v1311 = arith.constant 0 : i32; - v811 = arith.eq v809, v1311 : i1; - v812 = arith.zext v811 : u32; - v813 = hir.bitcast v812 : i32; - v815 = arith.neq v813, v1310 : i1; - v1298 = scf.if v815 : i32 { - ^block142: - v1309 = arith.constant 0 : i32; - scf.yield v1309; - } else { - ^block89: - v1308 = arith.constant 4 : u32; - v816 = hir.bitcast v792 : u32; - v818 = arith.add v816, v1308 : u32 #[overflow = checked]; - v1307 = arith.constant 4 : u32; - v820 = arith.mod v818, v1307 : u32; - hir.assertz v820 #[code = 250]; - v821 = hir.int_to_ptr v818 : ptr; - hir.store v821, v794; - v1306 = arith.constant 4 : u32; - v822 = hir.bitcast v793 : u32; - v824 = arith.add v822, v1306 : u32 #[overflow = checked]; - v1305 = arith.constant 4 : u32; - v826 = arith.mod v824, v1305 : u32; - hir.assertz v826 #[code = 250]; - v827 = hir.int_to_ptr v824 : ptr; - v828 = hir.load v827 : i32; - v829 = hir.bitcast v792 : u32; - v1304 = arith.constant 4 : u32; - v831 = arith.mod v829, v1304 : u32; - hir.assertz v831 #[code = 250]; - v832 = hir.int_to_ptr v829 : ptr; - hir.store v832, v828; - v833 = arith.mul v809, v795 : i32 #[overflow = wrapping]; - scf.yield v833; - }; - v834 = arith.constant 8 : i32; - v1303 = arith.constant 4 : i32; - v1299 = cf.select v815, v1303, v834 : i32; - scf.yield v1299, v1298; - }; - v837 = arith.add v792, v1300 : i32 #[overflow = wrapping]; - v839 = hir.bitcast v837 : u32; - v1302 = arith.constant 4 : u32; - v841 = arith.mod v839, v1302 : u32; - hir.assertz v841 #[code = 250]; - v842 = hir.int_to_ptr v839 : ptr; - hir.store v842, v1301; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::finish_grow(v843: i32, v844: i32, v845: i32, v846: i32, v847: i32) { - ^block90(v843: i32, v844: i32, v845: i32, v846: i32, v847: i32): - v849 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v850 = hir.bitcast v849 : ptr; - v851 = hir.load v850 : i32; - v852 = arith.constant 16 : i32; - v853 = arith.sub v851, v852 : i32 #[overflow = wrapping]; - v854 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v855 = hir.bitcast v854 : ptr; - hir.store v855, v853; - v1368 = arith.constant 0 : i32; - v848 = arith.constant 0 : i32; - v858 = arith.gte v845, v848 : i1; - v859 = arith.zext v858 : u32; - v860 = hir.bitcast v859 : i32; - v862 = arith.neq v860, v1368 : i1; - v1342, v1343 = scf.if v862 : i32, i32 { - ^block93: - v949 = arith.constant 4 : u32; - v865 = hir.bitcast v846 : u32; - v867 = arith.add v865, v949 : u32 #[overflow = checked]; - v1367 = arith.constant 4 : u32; - v869 = arith.mod v867, v1367 : u32; - hir.assertz v869 #[code = 250]; - v870 = hir.int_to_ptr v867 : ptr; - v871 = hir.load v870 : i32; - v1365 = arith.constant 0 : i32; - v1366 = arith.constant 0 : i32; - v873 = arith.eq v871, v1366 : i1; - v874 = arith.zext v873 : u32; - v875 = hir.bitcast v874 : i32; - v877 = arith.neq v875, v1365 : i1; - v1340, v1341 = scf.if v877 : i32, i32 { - ^block96: - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/::allocate(v853, v844, v845) - v1364 = arith.constant 4 : u32; - v910 = hir.bitcast v853 : u32; - v912 = arith.add v910, v1364 : u32 #[overflow = checked]; - v1363 = arith.constant 4 : u32; - v914 = arith.mod v912, v1363 : u32; - hir.assertz v914 #[code = 250]; - v915 = hir.int_to_ptr v912 : ptr; - v916 = hir.load v915 : i32; - v917 = hir.bitcast v853 : u32; - v1362 = arith.constant 4 : u32; - v919 = arith.mod v917, v1362 : u32; - hir.assertz v919 #[code = 250]; - v920 = hir.int_to_ptr v917 : ptr; - v921 = hir.load v920 : i32; - scf.yield v921, v916; - } else { - ^block97: - v879 = arith.constant 8 : u32; - v878 = hir.bitcast v846 : u32; - v880 = arith.add v878, v879 : u32 #[overflow = checked]; - v1361 = arith.constant 4 : u32; - v882 = arith.mod v880, v1361 : u32; - hir.assertz v882 #[code = 250]; - v883 = hir.int_to_ptr v880 : ptr; - v884 = hir.load v883 : i32; - v1360 = arith.constant 0 : i32; - v886 = arith.neq v884, v1360 : i1; - v1338, v1339 = scf.if v886 : i32, i32 { - ^block98: - v904 = hir.bitcast v846 : u32; - v1359 = arith.constant 4 : u32; - v906 = arith.mod v904, v1359 : u32; - hir.assertz v906 #[code = 250]; - v907 = hir.int_to_ptr v904 : ptr; - v908 = hir.load v907 : i32; - v909 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/__rustc::__rust_realloc(v908, v884, v844, v845) : i32 - scf.yield v909, v845; - } else { - ^block99: - v1358 = arith.constant 0 : i32; - v943 = arith.constant 8 : i32; - v888 = arith.add v853, v943 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_struct/alloc::alloc::Global::alloc_impl(v888, v844, v845, v1358) - v891 = arith.constant 12 : u32; - v890 = hir.bitcast v853 : u32; - v892 = arith.add v890, v891 : u32 #[overflow = checked]; - v1357 = arith.constant 4 : u32; - v894 = arith.mod v892, v1357 : u32; - hir.assertz v894 #[code = 250]; - v895 = hir.int_to_ptr v892 : ptr; - v896 = hir.load v895 : i32; - v1356 = arith.constant 8 : u32; - v897 = hir.bitcast v853 : u32; - v899 = arith.add v897, v1356 : u32 #[overflow = checked]; - v1355 = arith.constant 4 : u32; - v901 = arith.mod v899, v1355 : u32; - hir.assertz v901 #[code = 250]; - v902 = hir.int_to_ptr v899 : ptr; - v903 = hir.load v902 : i32; - scf.yield v903, v896; - }; - scf.yield v1338, v1339; - }; - v1354 = arith.constant 4 : u32; - v928 = hir.bitcast v843 : u32; - v930 = arith.add v928, v1354 : u32 #[overflow = checked]; - v1353 = arith.constant 4 : u32; - v932 = arith.mod v930, v1353 : u32; - hir.assertz v932 #[code = 250]; - v1352 = arith.constant 0 : i32; - v926 = arith.neq v1340, v1352 : i1; - v927 = cf.select v926, v1340, v844 : i32; - v933 = hir.int_to_ptr v930 : ptr; - hir.store v933, v927; - v1350 = arith.constant 0 : i32; - v940 = arith.eq v1340, v1350 : i1; - v941 = arith.zext v940 : u32; - v942 = hir.bitcast v941 : i32; - v1351 = arith.constant 0 : i32; - v937 = arith.neq v1340, v1351 : i1; - v938 = cf.select v937, v1341, v845 : i32; - scf.yield v938, v942; - } else { - ^block94: - v863 = arith.constant 1 : i32; - v1349 = arith.constant 0 : i32; - scf.yield v1349, v863; - }; - v864 = arith.constant 4 : i32; - v1348 = arith.constant 8 : i32; - v1344 = cf.select v862, v1348, v864 : i32; - v946 = arith.add v843, v1344 : i32 #[overflow = wrapping]; - v948 = hir.bitcast v946 : u32; - v1347 = arith.constant 4 : u32; - v950 = arith.mod v948, v1347 : u32; - hir.assertz v950 #[code = 250]; - v951 = hir.int_to_ptr v948 : ptr; - hir.store v951, v1342; - v953 = hir.bitcast v843 : u32; - v1346 = arith.constant 4 : u32; - v955 = arith.mod v953, v1346 : u32; - hir.assertz v955 #[code = 250]; - v956 = hir.int_to_ptr v953 : ptr; - hir.store v956, v1343; - v1345 = arith.constant 16 : i32; - v960 = arith.add v853, v1345 : i32 #[overflow = wrapping]; - v961 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_struct/__stack_pointer : ptr - v962 = hir.bitcast v961 : ptr; - hir.store v962, v960; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v963: i32, v964: i32, v965: i32) { - ^block100(v963: i32, v964: i32, v965: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v966: i32, v967: i32) -> i32 { - ^block102(v966: i32, v967: i32): - v974 = arith.constant 0 : i32; - v970 = hir.bitcast v967 : u32; - v969 = hir.bitcast v966 : u32; - v971 = arith.gt v969, v970 : i1; - v972 = arith.zext v971 : u32; - v973 = hir.bitcast v972 : i32; - v975 = arith.neq v973, v974 : i1; - v976 = cf.select v975, v966, v967 : i32; - builtin.ret v976; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; - }; -}; \ No newline at end of file diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index 9f761c9b9..bcb33dc6a 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -258,28 +258,140 @@ fn five_felts_struct_round_trip() { .unwrap(); } -/// Test struct with mixed field types for round-trip tests. +/// Minimal struct to reproduce u64 stack tracking bug. +/// The bug requires: 1 u64 + 4 smaller integer types (u8 or u32). +/// With Felt fields it passes; with u8/u32 fields it fails. +/// The difference is that u8/u32 use `as_u32` intrinsic after reading. #[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] -struct MixedTypes { +struct MinimalU64Bug { + n1: u64, + a: u32, + b: u32, + x: u32, + y: u32, +} + +/// Minimal test case for u64 stack tracking bug. +/// +/// The bug occurs when: +/// 1. Multiple u64 fields are read (as_u64 returns 2 felts on stack each) +/// 2. Another field (y) is NOT immediately consumed (no assert_eq) +/// 3. The value needs to be spilled to a local variable +/// +/// This causes incorrect stack position tracking, spilling the wrong value. +#[test] +fn minimal_u64_bug() { + let original = MinimalU64Bug { + n1: 111111, + a: 22, + b: 33, + x: 44, + y: 55, + }; + let serialized = original.to_felt_repr(); + + assert_eq!(serialized.len(), 5); + + let onchain_code = r#"(input: [Felt; 5]) -> Vec { + use miden_felt_repr_onchain::{FeltReader, FromFeltRepr, ToFeltRepr}; + + assert_eq(input[0], felt!(111111)); + assert_eq(input[4], felt!(55)); + + #[derive(FromFeltRepr, ToFeltRepr)] + struct TestStruct { + n1: u64, + a: u32, + b: u32, + x: u32, + y: u32, + } + + let mut reader = FeltReader::new(&input); + let deserialized = TestStruct::from_felt_repr(&mut reader); + + // NOT using assert_eq on y - this triggers the bug + // The y value needs to survive until to_felt_repr() + + deserialized.to_felt_repr() + }"#; + + let config = WasmTranslationConfig::default(); + let artifact_name = "onchain_minimal_u64_bug"; + let mut test = build_felt_repr_test(artifact_name, onchain_code, config); + + test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); + test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); + test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); + + let package = test.compiled_package(); + + let in_elem_addr = 21u32 * 16384; + let out_elem_addr = 20u32 * 16384; + let in_byte_addr = in_elem_addr * 4; + let out_byte_addr = out_elem_addr * 4; + + let input_felts: Vec = serialized.clone(); + + let initializers = [Initializer::MemoryFelts { + addr: in_elem_addr, + felts: Cow::from(input_felts), + }]; + + let args = [Felt::new(in_byte_addr as u64), Felt::new(out_byte_addr as u64)]; + + let _: Felt = eval_package(&package, initializers, &args, &test.session, |trace| { + let vec_metadata: [TestFelt; 4] = trace + .read_from_rust_memory(out_byte_addr) + .expect("Failed to read Vec metadata from memory"); + let data_ptr = vec_metadata[1].0.as_int() as u32; + let len = vec_metadata[2].0.as_int() as usize; + + assert_eq!(len, 5, "Expected Vec with 5 felts"); + + let elem_addr = data_ptr / 4; + let mut result_felts = [Felt::ZERO; 5]; + #[allow(clippy::needless_range_loop)] + for i in 0..5 { + let byte_addr = (elem_addr + i as u32) * 4; + let word_addr = (byte_addr / 16) * 16; + if let Some(data) = trace.read_from_rust_memory::<[TestFelt; 4]>(word_addr) { + let elem_in_word = ((byte_addr % 16) / 4) as usize; + result_felts[i] = data[elem_in_word].0; + } + } + + let mut reader = FeltReader::new(&result_felts); + let result_struct = MinimalU64Bug::from_felt_repr(&mut reader); + + assert_eq!(result_struct, original, "Minimal u64 bug round-trip failed"); + Ok(()) + }) + .unwrap(); +} + +/// Test struct with Felt fields instead of u64 (to test if u64 causes the stack tracking bug). +#[derive(Debug, Clone, PartialEq, Eq, FromFeltRepr, ToFeltRepr)] +struct MixedTypesNoU64 { f1: Felt, f2: Felt, - n1: u64, - n2: u64, + f3: Felt, + f4: Felt, x: u32, y: u8, } -/// Test struct serialization with mixed field types - full round-trip execution. +/// Test struct serialization with Felt fields instead of u64 - to verify u64 involvement in bug. /// -/// Tests a struct with 2 Felt, 2 u64, 1 u32, and 1 u8 fields. +/// Tests a struct with 4 Felt, 1 u32, and 1 u8 fields (no u64). /// Each field is serialized as one Felt, so total is 6 Felts. #[test] -fn mixed_types_struct_round_trip() { - let original = MixedTypes { +fn mixed_types_no_u64_round_trip() { + let original = MixedTypesNoU64 { f1: Felt::new(111111), f2: Felt::new(222222), - n1: 333333, - n2: 444444, + f3: Felt::new(333333), + f4: Felt::new(444444), x: 55555, y: 66, }; @@ -295,8 +407,8 @@ fn mixed_types_struct_round_trip() { struct TestStruct { f1: Felt, f2: Felt, - n1: u64, - n2: u64, + f3: Felt, + f4: Felt, x: u32, y: u8, } @@ -304,15 +416,14 @@ fn mixed_types_struct_round_trip() { let mut reader = FeltReader::new(&input); let deserialized = TestStruct::from_felt_repr(&mut reader); - // Verify some fields were deserialized correctly - // assert_eq(deserialized.f1, felt!(111111)); - assert_eq(Felt::from(deserialized.y as u32), felt!(66)); + // Deliberately NOT using assert_eq on y to trigger the bug (if u64 is involved) + // assert_eq(Felt::from(deserialized.y as u32), felt!(66)); deserialized.to_felt_repr() }"#; let config = WasmTranslationConfig::default(); - let artifact_name = "onchain_mixed_types_struct"; + let artifact_name = "onchain_mixed_types_no_u64"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); @@ -361,9 +472,9 @@ fn mixed_types_struct_round_trip() { } let mut reader = FeltReader::new(&result_felts); - let result_struct = MixedTypes::from_felt_repr(&mut reader); + let result_struct = MixedTypesNoU64::from_felt_repr(&mut reader); - assert_eq!(result_struct, original, "Mixed types round-trip failed"); + assert_eq!(result_struct, original, "Mixed types (no u64) round-trip failed"); Ok(()) }) .unwrap(); From b796daf424367474b737d86a69ea652c27612d35 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 11 Dec 2025 13:42:37 +0200 Subject: [PATCH 14/15] chore: ignore the `minimal_u64_bug` test and file https://github.com/0xMiden/compiler/issues/815 --- felt-repr/tests/src/onchain.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index bcb33dc6a..96e21947c 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -279,6 +279,7 @@ struct MinimalU64Bug { /// 3. The value needs to be spilled to a local variable /// /// This causes incorrect stack position tracking, spilling the wrong value. +#[ignore = "until https://github.com/0xMiden/compiler/issues/815 is resolved"] #[test] fn minimal_u64_bug() { let original = MinimalU64Bug { From 59fea0ef8e76187834d1c2da254811f3e4b1e162 Mon Sep 17 00:00:00 2001 From: Denys Zadorozhnyi Date: Thu, 11 Dec 2025 15:44:11 +0200 Subject: [PATCH 15/15] chore: remove expect files in the `felt-repr` onchain tests --- .../expected/onchain_five_felts_struct.hir | 1274 -------- .../expected/onchain_five_felts_struct.masm | 2477 ---------------- .../expected/onchain_five_felts_struct.wat | 753 ----- .../expected/onchain_minimal_u64_bug.hir | 1326 --------- .../expected/onchain_minimal_u64_bug.masm | 2614 ----------------- .../expected/onchain_minimal_u64_bug.wat | 797 ----- .../expected/onchain_mixed_types_no_u64.hir | 1305 -------- .../expected/onchain_mixed_types_no_u64.masm | 2540 ---------------- .../expected/onchain_mixed_types_no_u64.wat | 778 ----- .../expected/onchain_two_felts_struct.hir | 1241 -------- .../expected/onchain_two_felts_struct.masm | 2396 --------------- .../expected/onchain_two_felts_struct.wat | 729 ----- felt-repr/tests/src/onchain.rs | 17 - 13 files changed, 18247 deletions(-) delete mode 100644 felt-repr/tests/expected/onchain_five_felts_struct.hir delete mode 100644 felt-repr/tests/expected/onchain_five_felts_struct.masm delete mode 100644 felt-repr/tests/expected/onchain_five_felts_struct.wat delete mode 100644 felt-repr/tests/expected/onchain_minimal_u64_bug.hir delete mode 100644 felt-repr/tests/expected/onchain_minimal_u64_bug.masm delete mode 100644 felt-repr/tests/expected/onchain_minimal_u64_bug.wat delete mode 100644 felt-repr/tests/expected/onchain_mixed_types_no_u64.hir delete mode 100644 felt-repr/tests/expected/onchain_mixed_types_no_u64.masm delete mode 100644 felt-repr/tests/expected/onchain_mixed_types_no_u64.wat delete mode 100644 felt-repr/tests/expected/onchain_two_felts_struct.hir delete mode 100644 felt-repr/tests/expected/onchain_two_felts_struct.masm delete mode 100644 felt-repr/tests/expected/onchain_two_felts_struct.wat diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.hir b/felt-repr/tests/expected/onchain_five_felts_struct.hir deleted file mode 100644 index f4b18e3ac..000000000 --- a/felt-repr/tests/expected/onchain_five_felts_struct.hir +++ /dev/null @@ -1,1274 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @onchain_five_felts_struct { - private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { - ^block4(v0: i32, v1: felt): - v4 = arith.constant 8 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.add v3, v4 : u32 #[overflow = checked]; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; - hir.assertz v7 #[code = 250]; - v8 = hir.int_to_ptr v5 : ptr; - v9 = hir.load v8 : i32; - v10 = hir.bitcast v0 : u32; - v948 = arith.constant 4 : u32; - v12 = arith.mod v10, v948 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : i32; - v2 = arith.constant 0 : i32; - v15 = arith.neq v9, v14 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v2 : i1; - scf.if v19{ - ^block94: - scf.yield ; - } else { - ^block7: - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) - scf.yield ; - }; - v947 = arith.constant 4 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v947 : u32 #[overflow = checked]; - v946 = arith.constant 4 : u32; - v25 = arith.mod v23, v946 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - v27 = hir.load v26 : i32; - v938 = arith.constant 2 : u32; - v31 = arith.shl v9, v938 : i32; - v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v32 : u32; - v945 = arith.constant 4 : u32; - v36 = arith.mod v34, v945 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v1; - v944 = arith.constant 8 : u32; - v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v944 : u32 #[overflow = checked]; - v943 = arith.constant 4 : u32; - v44 = arith.mod v42, v943 : u32; - hir.assertz v44 #[code = 250]; - v38 = arith.constant 1 : i32; - v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v39; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { - ^block8(v46: i32): - v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 16 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; - v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v54 = hir.bitcast v53 : ptr; - hir.store v54, v52; - v57 = hir.bitcast v46 : u32; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v63 = arith.constant 4 : i32; - v62 = arith.constant 1 : i32; - v55 = arith.constant 8 : i32; - v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) - v66 = arith.constant 8 : u32; - v65 = hir.bitcast v52 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v952 = arith.constant 4 : u32; - v69 = arith.mod v67, v952 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i32; - v47 = arith.constant 0 : i32; - v72 = arith.constant -2147483647 : i32; - v73 = arith.eq v71, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v47 : i1; - cf.cond_br v77 ^block10, ^block11; - ^block10: - v951 = arith.constant 16 : i32; - v87 = arith.add v52, v951 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret ; - ^block11: - v79 = arith.constant 12 : u32; - v78 = hir.bitcast v52 : u32; - v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v950 = arith.constant 4 : u32; - v82 = arith.mod v80, v950 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::handle_error(v71, v84, v85) - ub.unreachable ; - }; - - public builtin.function @entrypoint(v90: i32, v91: i32) { - ^block12(v90: i32, v91: i32): - v95 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v96 = hir.bitcast v95 : ptr; - v97 = hir.load v96 : i32; - v98 = arith.constant 32 : i32; - v99 = arith.sub v97, v98 : i32 #[overflow = wrapping]; - v100 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v101 = hir.bitcast v100 : ptr; - hir.store v101, v99; - v103 = arith.constant 16 : u32; - v102 = hir.bitcast v91 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v105 = arith.constant 4 : u32; - v106 = arith.mod v104, v105 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : felt; - v110 = arith.constant 12 : u32; - v109 = hir.bitcast v91 : u32; - v111 = arith.add v109, v110 : u32 #[overflow = checked]; - v983 = arith.constant 4 : u32; - v113 = arith.mod v111, v983 : u32; - hir.assertz v113 #[code = 250]; - v114 = hir.int_to_ptr v111 : ptr; - v115 = hir.load v114 : felt; - v117 = arith.constant 8 : u32; - v116 = hir.bitcast v91 : u32; - v118 = arith.add v116, v117 : u32 #[overflow = checked]; - v982 = arith.constant 4 : u32; - v120 = arith.mod v118, v982 : u32; - hir.assertz v120 #[code = 250]; - v121 = hir.int_to_ptr v118 : ptr; - v122 = hir.load v121 : felt; - v981 = arith.constant 4 : u32; - v123 = hir.bitcast v91 : u32; - v125 = arith.add v123, v981 : u32 #[overflow = checked]; - v980 = arith.constant 4 : u32; - v127 = arith.mod v125, v980 : u32; - hir.assertz v127 #[code = 250]; - v128 = hir.int_to_ptr v125 : ptr; - v129 = hir.load v128 : felt; - v130 = hir.bitcast v91 : u32; - v979 = arith.constant 4 : u32; - v132 = arith.mod v130, v979 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : felt; - v139 = arith.constant 4 : i32; - v92 = arith.constant 0 : i32; - v137 = arith.constant 256 : i32; - v135 = arith.constant 20 : i32; - v136 = arith.add v99, v135 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v136, v137, v92, v139, v139) - v142 = arith.constant 24 : u32; - v141 = hir.bitcast v99 : u32; - v143 = arith.add v141, v142 : u32 #[overflow = checked]; - v978 = arith.constant 4 : u32; - v145 = arith.mod v143, v978 : u32; - hir.assertz v145 #[code = 250]; - v146 = hir.int_to_ptr v143 : ptr; - v147 = hir.load v146 : i32; - v149 = arith.constant 20 : u32; - v148 = hir.bitcast v99 : u32; - v150 = arith.add v148, v149 : u32 #[overflow = checked]; - v977 = arith.constant 4 : u32; - v152 = arith.mod v150, v977 : u32; - hir.assertz v152 #[code = 250]; - v153 = hir.int_to_ptr v150 : ptr; - v154 = hir.load v153 : i32; - v976 = arith.constant 0 : i32; - v155 = arith.constant 1 : i32; - v156 = arith.neq v154, v155 : i1; - v157 = arith.zext v156 : u32; - v158 = hir.bitcast v157 : i32; - v160 = arith.neq v158, v976 : i1; - cf.cond_br v160 ^block14, ^block15; - ^block14: - v975 = arith.constant 8 : i32; - v169 = arith.constant 8 : i32; - v170 = arith.add v99, v169 : i32 #[overflow = wrapping]; - v172 = arith.add v170, v975 : i32 #[overflow = wrapping]; - v174 = hir.bitcast v172 : u32; - v974 = arith.constant 4 : u32; - v176 = arith.mod v174, v974 : u32; - hir.assertz v176 #[code = 250]; - v973 = arith.constant 0 : i32; - v177 = hir.int_to_ptr v174 : ptr; - hir.store v177, v973; - v179 = arith.constant 28 : u32; - v178 = hir.bitcast v99 : u32; - v180 = arith.add v178, v179 : u32 #[overflow = checked]; - v972 = arith.constant 4 : u32; - v182 = arith.mod v180, v972 : u32; - hir.assertz v182 #[code = 250]; - v183 = hir.int_to_ptr v180 : ptr; - v184 = hir.load v183 : i32; - v971 = arith.constant 12 : u32; - v185 = hir.bitcast v99 : u32; - v187 = arith.add v185, v971 : u32 #[overflow = checked]; - v970 = arith.constant 4 : u32; - v189 = arith.mod v187, v970 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v184; - v969 = arith.constant 8 : u32; - v191 = hir.bitcast v99 : u32; - v193 = arith.add v191, v969 : u32 #[overflow = checked]; - v968 = arith.constant 4 : u32; - v195 = arith.mod v193, v968 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - hir.store v196, v147; - v967 = arith.constant 8 : i32; - v198 = arith.add v99, v967 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v198, v134) - v966 = arith.constant 8 : i32; - v200 = arith.add v99, v966 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v200, v129) - v965 = arith.constant 8 : i32; - v202 = arith.add v99, v965 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v202, v122) - v964 = arith.constant 8 : i32; - v204 = arith.add v99, v964 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v204, v115) - v963 = arith.constant 8 : i32; - v206 = arith.add v99, v963 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::vec::Vec::push(v206, v108) - v209 = hir.bitcast v172 : u32; - v962 = arith.constant 4 : u32; - v211 = arith.mod v209, v962 : u32; - hir.assertz v211 #[code = 250]; - v212 = hir.int_to_ptr v209 : ptr; - v213 = hir.load v212 : i32; - v961 = arith.constant 8 : i32; - v208 = arith.add v90, v961 : i32 #[overflow = wrapping]; - v214 = hir.bitcast v208 : u32; - v960 = arith.constant 4 : u32; - v216 = arith.mod v214, v960 : u32; - hir.assertz v216 #[code = 250]; - v217 = hir.int_to_ptr v214 : ptr; - hir.store v217, v213; - v959 = arith.constant 8 : u32; - v218 = hir.bitcast v99 : u32; - v220 = arith.add v218, v959 : u32 #[overflow = checked]; - v958 = arith.constant 4 : u32; - v222 = arith.mod v220, v958 : u32; - hir.assertz v222 #[code = 250]; - v223 = hir.int_to_ptr v220 : ptr; - v224 = hir.load v223 : i64; - v225 = hir.bitcast v90 : u32; - v957 = arith.constant 4 : u32; - v227 = arith.mod v225, v957 : u32; - hir.assertz v227 #[code = 250]; - v228 = hir.int_to_ptr v225 : ptr; - hir.store v228, v224; - v956 = arith.constant 32 : i32; - v230 = arith.add v99, v956 : i32 #[overflow = wrapping]; - v231 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v232 = hir.bitcast v231 : ptr; - hir.store v232, v230; - builtin.ret ; - ^block15: - v955 = arith.constant 28 : u32; - v161 = hir.bitcast v99 : u32; - v163 = arith.add v161, v955 : u32 #[overflow = checked]; - v954 = arith.constant 4 : u32; - v165 = arith.mod v163, v954 : u32; - hir.assertz v165 #[code = 250]; - v166 = hir.int_to_ptr v163 : ptr; - v167 = hir.load v166 : i32; - v168 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::handle_error(v147, v167, v168) - ub.unreachable ; - }; - - private builtin.function @__rustc::__rust_alloc(v233: i32, v234: i32) -> i32 { - ^block16(v233: i32, v234: i32): - v236 = arith.constant 1048604 : i32; - v237 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v236, v234, v233) : i32 - builtin.ret v237; - }; - - private builtin.function @__rustc::__rust_realloc(v238: i32, v239: i32, v240: i32, v241: i32) -> i32 { - ^block18(v238: i32, v239: i32, v240: i32, v241: i32): - v243 = arith.constant 1048604 : i32; - v244 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v243, v240, v241) : i32 - v992 = arith.constant 0 : i32; - v245 = arith.constant 0 : i32; - v246 = arith.eq v244, v245 : i1; - v247 = arith.zext v246 : u32; - v248 = hir.bitcast v247 : i32; - v250 = arith.neq v248, v992 : i1; - scf.if v250{ - ^block20: - scf.yield ; - } else { - ^block21: - v991 = arith.constant 0 : i32; - v252 = hir.bitcast v239 : u32; - v251 = hir.bitcast v241 : u32; - v253 = arith.lt v251, v252 : i1; - v254 = arith.zext v253 : u32; - v255 = hir.bitcast v254 : i32; - v257 = arith.neq v255, v991 : i1; - v258 = cf.select v257, v241, v239 : i32; - v989 = arith.constant 0 : i32; - v990 = arith.constant 0 : i32; - v260 = arith.eq v258, v990 : i1; - v261 = arith.zext v260 : u32; - v262 = hir.bitcast v261 : i32; - v264 = arith.neq v262, v989 : i1; - scf.if v264{ - ^block100: - scf.yield ; - } else { - ^block22: - v265 = hir.bitcast v258 : u32; - v266 = hir.bitcast v244 : u32; - v267 = hir.int_to_ptr v266 : ptr; - v268 = hir.bitcast v238 : u32; - v269 = hir.int_to_ptr v268 : ptr; - hir.mem_cpy v269, v267, v265; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v244; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v271: i32, v272: i32) -> i32 { - ^block23(v271: i32, v272: i32): - v274 = arith.constant 1048604 : i32; - v275 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::alloc(v274, v272, v271) : i32 - v1001 = 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, v1001 : i1; - scf.if v281{ - ^block25: - scf.yield ; - } else { - ^block26: - v999 = arith.constant 0 : i32; - v1000 = arith.constant 0 : i32; - v283 = arith.eq v271, v1000 : i1; - v284 = arith.zext v283 : u32; - v285 = hir.bitcast v284 : i32; - v287 = arith.neq v285, v999 : i1; - scf.if v287{ - ^block103: - scf.yield ; - } else { - ^block27: - v993 = arith.constant 0 : u8; - v290 = hir.bitcast v271 : u32; - v291 = hir.bitcast v275 : u32; - v292 = hir.int_to_ptr v291 : ptr; - hir.mem_set v292, v290, v993; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v275; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block28: - builtin.ret ; - }; - - private builtin.function @::alloc(v294: i32, v295: i32, v296: i32) -> i32 { - ^block30(v294: i32, v295: i32, v296: i32): - v299 = arith.constant 16 : i32; - v298 = arith.constant 0 : i32; - v1003 = arith.constant 16 : u32; - v301 = hir.bitcast v295 : u32; - v303 = arith.gt v301, v1003 : i1; - v304 = arith.zext v303 : u32; - v305 = hir.bitcast v304 : i32; - v307 = arith.neq v305, v298 : i1; - v308 = cf.select v307, v295, v299 : i32; - v1043 = arith.constant 0 : i32; - v309 = arith.constant -1 : i32; - v310 = arith.add v308, v309 : i32 #[overflow = wrapping]; - v311 = arith.band v308, v310 : i32; - v313 = arith.neq v311, v1043 : i1; - v1012, v1013 = scf.if v313 : i32, u32 { - ^block108: - v1004 = arith.constant 0 : u32; - v1008 = ub.poison i32 : i32; - scf.yield v1008, v1004; - } else { - ^block33: - v315 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/core::ptr::alignment::Alignment::max(v295, v308) : i32 - v1042 = arith.constant 0 : i32; - v314 = arith.constant -2147483648 : i32; - v316 = arith.sub v314, v315 : i32 #[overflow = wrapping]; - v318 = hir.bitcast v316 : u32; - v317 = hir.bitcast v296 : u32; - v319 = arith.gt v317, v318 : i1; - v320 = arith.zext v319 : u32; - v321 = hir.bitcast v320 : i32; - v323 = arith.neq v321, v1042 : i1; - v1027 = scf.if v323 : i32 { - ^block107: - v1041 = ub.poison i32 : i32; - scf.yield v1041; - } else { - ^block34: - v1039 = arith.constant 0 : i32; - v329 = arith.sub v1039, v315 : i32 #[overflow = wrapping]; - v1040 = arith.constant -1 : i32; - v325 = arith.add v296, v315 : i32 #[overflow = wrapping]; - v327 = arith.add v325, v1040 : i32 #[overflow = wrapping]; - v330 = arith.band v327, v329 : i32; - v331 = hir.bitcast v294 : u32; - 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 : i32; - v1038 = arith.constant 0 : i32; - v337 = arith.neq v335, v1038 : i1; - scf.if v337{ - ^block106: - scf.yield ; - } else { - ^block36: - v338 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/intrinsics::mem::heap_base() : i32 - v339 = hir.mem_size : u32; - v345 = hir.bitcast v294 : u32; - v1037 = arith.constant 4 : u32; - v347 = arith.mod v345, v1037 : u32; - hir.assertz v347 #[code = 250]; - v1036 = arith.constant 16 : u32; - v340 = hir.bitcast v339 : i32; - v343 = arith.shl v340, v1036 : i32; - v344 = arith.add v338, v343 : i32 #[overflow = wrapping]; - v348 = hir.int_to_ptr v345 : ptr; - hir.store v348, v344; - scf.yield ; - }; - v351 = hir.bitcast v294 : u32; - v1035 = arith.constant 4 : u32; - v353 = arith.mod v351, v1035 : u32; - hir.assertz v353 #[code = 250]; - v354 = hir.int_to_ptr v351 : ptr; - v355 = hir.load v354 : i32; - v1033 = arith.constant 0 : i32; - v1034 = arith.constant -1 : i32; - v357 = arith.bxor v355, v1034 : i32; - v359 = hir.bitcast v357 : u32; - v358 = hir.bitcast v330 : u32; - v360 = arith.gt v358, v359 : i1; - v361 = arith.zext v360 : u32; - v362 = hir.bitcast v361 : i32; - v364 = arith.neq v362, v1033 : i1; - v1026 = scf.if v364 : i32 { - ^block37: - v1032 = arith.constant 0 : i32; - scf.yield v1032; - } else { - ^block38: - v366 = hir.bitcast v294 : u32; - v1031 = arith.constant 4 : u32; - v368 = arith.mod v366, v1031 : u32; - hir.assertz v368 #[code = 250]; - v365 = arith.add v355, v330 : i32 #[overflow = wrapping]; - v369 = hir.int_to_ptr v366 : ptr; - hir.store v369, v365; - v371 = arith.add v355, v315 : i32 #[overflow = wrapping]; - scf.yield v371; - }; - scf.yield v1026; - }; - v1009 = arith.constant 1 : u32; - v1030 = arith.constant 0 : u32; - v1028 = cf.select v323, v1030, v1009 : u32; - scf.yield v1027, v1028; - }; - v1029 = arith.constant 0 : u32; - v1025 = arith.eq v1013, v1029 : i1; - cf.cond_br v1025 ^block32, ^block110(v1012); - ^block32: - ub.unreachable ; - ^block110(v1005: i32): - builtin.ret v1005; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block39: - v374 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v374; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32, v381: i32) { - ^block43(v376: i32, v377: i32, v378: i32, v379: i32, v380: i32, v381: i32): - v384 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v385 = hir.bitcast v384 : ptr; - v386 = hir.load v385 : i32; - v387 = arith.constant 32 : i32; - v388 = arith.sub v386, v387 : i32 #[overflow = wrapping]; - v389 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v390 = hir.bitcast v389 : ptr; - hir.store v390, v388; - v1120 = arith.constant 0 : i32; - v382 = arith.constant 0 : i32; - v393 = arith.eq v381, v382 : i1; - v394 = arith.zext v393 : u32; - v395 = hir.bitcast v394 : i32; - v397 = arith.neq v395, v1120 : i1; - v1091, v1092 = scf.if v397 : i32, i32 { - ^block46: - v1119 = arith.constant 0 : i32; - scf.yield v1119, v1119; - } else { - ^block47: - v398 = arith.add v378, v379 : i32 #[overflow = wrapping]; - v1118 = arith.constant 0 : i32; - v400 = hir.bitcast v378 : u32; - v399 = hir.bitcast v398 : u32; - v401 = arith.lt v399, v400 : i1; - v402 = arith.zext v401 : u32; - v403 = hir.bitcast v402 : i32; - v405 = arith.neq v403, v1118 : i1; - v1089, v1090 = scf.if v405 : i32, i32 { - ^block116: - v1117 = arith.constant 0 : i32; - scf.yield v1117, v1117; - } else { - ^block48: - v416 = hir.bitcast v377 : u32; - v530 = arith.constant 4 : u32; - v418 = arith.mod v416, v530 : u32; - hir.assertz v418 #[code = 250]; - v419 = hir.int_to_ptr v416 : ptr; - v420 = hir.load v419 : i32; - v1045 = arith.constant 1 : u32; - v423 = arith.shl v420, v1045 : i32; - v1116 = arith.constant 0 : i32; - v425 = hir.bitcast v423 : u32; - v424 = hir.bitcast v398 : u32; - v426 = arith.gt v424, v425 : i1; - v427 = arith.zext v426 : u32; - v428 = hir.bitcast v427 : i32; - v430 = arith.neq v428, v1116 : i1; - v431 = cf.select v430, v398, v423 : i32; - v1113 = arith.constant 1 : i32; - v433 = arith.constant 4 : i32; - v1114 = arith.constant 0 : i32; - v1044 = arith.constant 1025 : u32; - v436 = hir.bitcast v381 : u32; - v438 = arith.lt v436, v1044 : i1; - v439 = arith.zext v438 : u32; - v440 = hir.bitcast v439 : i32; - v442 = arith.neq v440, v1114 : i1; - v443 = cf.select v442, v433, v1113 : i32; - v432 = arith.constant 8 : i32; - v1115 = arith.constant 0 : i32; - v421 = arith.constant 1 : i32; - v445 = arith.eq v381, v421 : i1; - v446 = arith.zext v445 : u32; - v447 = hir.bitcast v446 : i32; - v449 = arith.neq v447, v1115 : i1; - v450 = cf.select v449, v432, v443 : i32; - v1112 = arith.constant 0 : i32; - v452 = hir.bitcast v450 : u32; - v451 = hir.bitcast v431 : u32; - v453 = arith.gt v451, v452 : i1; - v454 = arith.zext v453 : u32; - v455 = hir.bitcast v454 : i32; - v457 = arith.neq v455, v1112 : i1; - v458 = cf.select v457, v431, v450 : i32; - v459 = hir.bitcast v458 : u32; - v460 = arith.zext v459 : u64; - v461 = hir.bitcast v460 : i64; - v1111 = arith.constant 0 : i32; - v411 = arith.sub v1111, v380 : i32 #[overflow = wrapping]; - v408 = arith.constant -1 : i32; - v407 = arith.add v380, v381 : i32 #[overflow = wrapping]; - v409 = arith.add v407, v408 : i32 #[overflow = wrapping]; - v412 = arith.band v409, v411 : i32; - v413 = hir.bitcast v412 : u32; - v414 = arith.zext v413 : u64; - v415 = hir.bitcast v414 : i64; - v462 = arith.mul v415, v461 : i64 #[overflow = wrapping]; - v1110 = arith.constant 0 : i32; - v463 = arith.constant 32 : i64; - v465 = hir.cast v463 : u32; - v464 = hir.bitcast v462 : u64; - v466 = arith.shr v464, v465 : u64; - v467 = hir.bitcast v466 : i64; - v468 = arith.trunc v467 : i32; - v470 = arith.neq v468, v1110 : i1; - v1087, v1088 = scf.if v470 : i32, i32 { - ^block115: - v1109 = arith.constant 0 : i32; - scf.yield v431, v1109; - } else { - ^block49: - v471 = arith.trunc v462 : i32; - v1108 = arith.constant 0 : i32; - v472 = arith.constant -2147483648 : i32; - v473 = arith.sub v472, v380 : i32 #[overflow = wrapping]; - v475 = hir.bitcast v473 : u32; - v474 = hir.bitcast v471 : u32; - v476 = arith.gt v474, v475 : i1; - v477 = arith.zext v476 : u32; - v478 = hir.bitcast v477 : i32; - v480 = arith.neq v478, v1108 : i1; - v1085, v1086 = scf.if v480 : i32, i32 { - ^block114: - v1107 = arith.constant 0 : i32; - scf.yield v431, v1107; - } else { - ^block50: - v481 = arith.constant 20 : i32; - v482 = arith.add v388, v481 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v482, v377, v380, v381) - v1105 = arith.constant 20 : i32; - v486 = arith.add v388, v1105 : i32 #[overflow = wrapping]; - v1106 = arith.constant 8 : i32; - v484 = arith.add v388, v1106 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::raw_vec::finish_grow(v484, v380, v471, v486, v376) - v488 = arith.constant 12 : u32; - v487 = hir.bitcast v388 : u32; - v489 = arith.add v487, v488 : u32 #[overflow = checked]; - v1104 = arith.constant 4 : u32; - v491 = arith.mod v489, v1104 : u32; - hir.assertz v491 #[code = 250]; - v492 = hir.int_to_ptr v489 : ptr; - v493 = hir.load v492 : i32; - v495 = arith.constant 8 : u32; - v494 = hir.bitcast v388 : u32; - v496 = arith.add v494, v495 : u32 #[overflow = checked]; - v1103 = arith.constant 4 : u32; - v498 = arith.mod v496, v1103 : u32; - hir.assertz v498 #[code = 250]; - v499 = hir.int_to_ptr v496 : ptr; - v500 = hir.load v499 : i32; - v1101 = arith.constant 0 : i32; - v1102 = arith.constant 0 : i32; - v502 = arith.eq v500, v1102 : i1; - v503 = arith.zext v502 : u32; - v504 = hir.bitcast v503 : i32; - v506 = arith.neq v504, v1101 : i1; - v1083 = scf.if v506 : i32 { - ^block51: - v514 = hir.bitcast v377 : u32; - v1100 = arith.constant 4 : u32; - v516 = arith.mod v514, v1100 : u32; - hir.assertz v516 #[code = 250]; - v517 = hir.int_to_ptr v514 : ptr; - hir.store v517, v458; - v1099 = arith.constant 4 : u32; - v518 = hir.bitcast v377 : u32; - v520 = arith.add v518, v1099 : u32 #[overflow = checked]; - v1098 = arith.constant 4 : u32; - v522 = arith.mod v520, v1098 : u32; - hir.assertz v522 #[code = 250]; - v523 = hir.int_to_ptr v520 : ptr; - hir.store v523, v493; - scf.yield v431; - } else { - ^block52: - v508 = arith.constant 16 : u32; - v507 = hir.bitcast v388 : u32; - v509 = arith.add v507, v508 : u32 #[overflow = checked]; - v1097 = arith.constant 4 : u32; - v511 = arith.mod v509, v1097 : u32; - hir.assertz v511 #[code = 250]; - v512 = hir.int_to_ptr v509 : ptr; - v513 = hir.load v512 : i32; - scf.yield v513; - }; - v524 = arith.constant -2147483647 : i32; - v1084 = cf.select v506, v524, v493 : i32; - scf.yield v1083, v1084; - }; - scf.yield v1085, v1086; - }; - scf.yield v1087, v1088; - }; - scf.yield v1089, v1090; - }; - v1096 = arith.constant 4 : u32; - v529 = hir.bitcast v376 : u32; - v531 = arith.add v529, v1096 : u32 #[overflow = checked]; - v1095 = arith.constant 4 : u32; - v533 = arith.mod v531, v1095 : u32; - hir.assertz v533 #[code = 250]; - v534 = hir.int_to_ptr v531 : ptr; - hir.store v534, v1091; - v537 = hir.bitcast v376 : u32; - v1094 = arith.constant 4 : u32; - v539 = arith.mod v537, v1094 : u32; - hir.assertz v539 #[code = 250]; - v540 = hir.int_to_ptr v537 : ptr; - hir.store v540, v1092; - v1093 = arith.constant 32 : i32; - v544 = arith.add v388, v1093 : i32 #[overflow = wrapping]; - v545 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v546 = hir.bitcast v545 : ptr; - hir.store v546, v544; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v547: i32, v548: i32, v549: i32, v550: i32, v551: i32) { - ^block53(v547: i32, v548: i32, v549: i32, v550: i32, v551: i32): - v554 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v555 = hir.bitcast v554 : ptr; - v556 = hir.load v555 : i32; - v557 = arith.constant 16 : i32; - v558 = arith.sub v556, v557 : i32 #[overflow = wrapping]; - v559 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v560 = hir.bitcast v559 : ptr; - hir.store v560, v558; - v570 = hir.bitcast v548 : u32; - v571 = arith.zext v570 : u64; - v572 = hir.bitcast v571 : i64; - v552 = arith.constant 0 : i32; - v565 = arith.sub v552, v550 : i32 #[overflow = wrapping]; - v562 = arith.constant -1 : i32; - v561 = arith.add v550, v551 : i32 #[overflow = wrapping]; - v563 = arith.add v561, v562 : i32 #[overflow = wrapping]; - v566 = arith.band v563, v565 : i32; - v567 = hir.bitcast v566 : u32; - v568 = arith.zext v567 : u64; - v569 = hir.bitcast v568 : i64; - v573 = arith.mul v569, v572 : i64 #[overflow = wrapping]; - v1224 = arith.constant 0 : i32; - v574 = arith.constant 32 : i64; - v576 = hir.cast v574 : u32; - v575 = hir.bitcast v573 : u64; - v577 = arith.shr v575, v576 : u64; - v578 = hir.bitcast v577 : i64; - v579 = arith.trunc v578 : i32; - v581 = arith.neq v579, v1224 : i1; - v1136, v1137, v1138, v1139, v1140, v1141 = scf.if v581 : i32, i32, i32, i32, i32, u32 { - ^block122: - v1121 = arith.constant 0 : u32; - v1128 = ub.poison i32 : i32; - scf.yield v547, v558, v1128, v1128, v1128, v1121; - } else { - ^block58: - v582 = arith.trunc v573 : i32; - v1223 = arith.constant 0 : i32; - v583 = arith.constant -2147483648 : i32; - v584 = arith.sub v583, v550 : i32 #[overflow = wrapping]; - v586 = hir.bitcast v584 : u32; - v585 = hir.bitcast v582 : u32; - v587 = arith.lte v585, v586 : i1; - v588 = arith.zext v587 : u32; - v589 = hir.bitcast v588 : i32; - v591 = arith.neq v589, v1223 : i1; - v1184 = scf.if v591 : i32 { - ^block56: - v1222 = arith.constant 0 : i32; - v602 = arith.neq v582, v1222 : i1; - v1183 = scf.if v602 : i32 { - ^block60: - v1221 = arith.constant 0 : i32; - v618 = arith.neq v549, v1221 : i1; - v1182 = scf.if v618 : i32 { - ^block63: - v600 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v558, v550, v582, v600) - v629 = hir.bitcast v558 : u32; - v674 = arith.constant 4 : u32; - v631 = arith.mod v629, v674 : u32; - hir.assertz v631 #[code = 250]; - v632 = hir.int_to_ptr v629 : ptr; - v633 = hir.load v632 : i32; - scf.yield v633; - } else { - ^block64: - v619 = arith.constant 8 : i32; - v620 = arith.add v558, v619 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v620, v550, v582) - v604 = arith.constant 8 : u32; - v621 = hir.bitcast v558 : u32; - v623 = arith.add v621, v604 : u32 #[overflow = checked]; - v1220 = arith.constant 4 : u32; - v625 = arith.mod v623, v1220 : u32; - hir.assertz v625 #[code = 250]; - v626 = hir.int_to_ptr v623 : ptr; - v627 = hir.load v626 : i32; - scf.yield v627; - }; - v1218 = arith.constant 0 : i32; - v1219 = arith.constant 0 : i32; - v636 = arith.eq v1182, v1219 : i1; - v637 = arith.zext v636 : u32; - v638 = hir.bitcast v637 : i32; - v640 = arith.neq v638, v1218 : i1; - scf.if v640{ - ^block65: - v1217 = arith.constant 8 : u32; - v657 = hir.bitcast v547 : u32; - v659 = arith.add v657, v1217 : u32 #[overflow = checked]; - v1216 = arith.constant 4 : u32; - v661 = arith.mod v659, v1216 : u32; - hir.assertz v661 #[code = 250]; - v662 = hir.int_to_ptr v659 : ptr; - hir.store v662, v582; - v1215 = arith.constant 4 : u32; - v664 = hir.bitcast v547 : u32; - v666 = arith.add v664, v1215 : u32 #[overflow = checked]; - v1214 = arith.constant 4 : u32; - v668 = arith.mod v666, v1214 : u32; - hir.assertz v668 #[code = 250]; - v669 = hir.int_to_ptr v666 : ptr; - hir.store v669, v550; - scf.yield ; - } else { - ^block66: - v1213 = arith.constant 8 : u32; - v642 = hir.bitcast v547 : u32; - v644 = arith.add v642, v1213 : u32 #[overflow = checked]; - v1212 = arith.constant 4 : u32; - v646 = arith.mod v644, v1212 : u32; - hir.assertz v646 #[code = 250]; - v647 = hir.int_to_ptr v644 : ptr; - hir.store v647, v1182; - v1211 = arith.constant 4 : u32; - v649 = hir.bitcast v547 : u32; - v651 = arith.add v649, v1211 : u32 #[overflow = checked]; - v1210 = arith.constant 4 : u32; - v653 = arith.mod v651, v1210 : u32; - hir.assertz v653 #[code = 250]; - v654 = hir.int_to_ptr v651 : ptr; - hir.store v654, v548; - scf.yield ; - }; - v1208 = arith.constant 0 : i32; - v1209 = arith.constant 1 : i32; - v1181 = cf.select v640, v1209, v1208 : i32; - scf.yield v1181; - } else { - ^block61: - v1207 = arith.constant 8 : u32; - v603 = hir.bitcast v547 : u32; - v605 = arith.add v603, v1207 : u32 #[overflow = checked]; - v1206 = arith.constant 4 : u32; - v607 = arith.mod v605, v1206 : u32; - hir.assertz v607 #[code = 250]; - v608 = hir.int_to_ptr v605 : ptr; - hir.store v608, v550; - v1205 = arith.constant 4 : u32; - v611 = hir.bitcast v547 : u32; - v613 = arith.add v611, v1205 : u32 #[overflow = checked]; - v1204 = arith.constant 4 : u32; - v615 = arith.mod v613, v1204 : u32; - hir.assertz v615 #[code = 250]; - v1203 = arith.constant 0 : i32; - v616 = hir.int_to_ptr v613 : ptr; - hir.store v616, v1203; - v1202 = arith.constant 0 : i32; - scf.yield v1202; - }; - scf.yield v1183; - } else { - ^block59: - v1201 = ub.poison i32 : i32; - scf.yield v1201; - }; - v1196 = arith.constant 0 : u32; - v1129 = arith.constant 1 : u32; - v1189 = cf.select v591, v1129, v1196 : u32; - v1197 = ub.poison i32 : i32; - v1188 = cf.select v591, v558, v1197 : i32; - v1198 = ub.poison i32 : i32; - v1187 = cf.select v591, v547, v1198 : i32; - v1199 = ub.poison i32 : i32; - v1186 = cf.select v591, v1199, v558 : i32; - v1200 = ub.poison i32 : i32; - v1185 = cf.select v591, v1200, v547 : i32; - scf.yield v1185, v1186, v1187, v1184, v1188, v1189; - }; - v1142, v1143, v1144 = scf.index_switch v1141 : i32, i32, i32 - case 0 { - ^block57: - v1195 = arith.constant 4 : u32; - v594 = hir.bitcast v1136 : u32; - v596 = arith.add v594, v1195 : u32 #[overflow = checked]; - v1194 = arith.constant 4 : u32; - v598 = arith.mod v596, v1194 : u32; - hir.assertz v598 #[code = 250]; - v1193 = arith.constant 0 : i32; - v599 = hir.int_to_ptr v596 : ptr; - hir.store v599, v1193; - v1192 = arith.constant 1 : i32; - scf.yield v1136, v1192, v1137; - } - default { - ^block126: - scf.yield v1138, v1139, v1140; - }; - v673 = hir.bitcast v1142 : u32; - v1191 = arith.constant 4 : u32; - v675 = arith.mod v673, v1191 : u32; - hir.assertz v675 #[code = 250]; - v676 = hir.int_to_ptr v673 : ptr; - hir.store v676, v1143; - v1190 = arith.constant 16 : i32; - v681 = arith.add v1144, v1190 : i32 #[overflow = wrapping]; - v682 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v683 = hir.bitcast v682 : ptr; - hir.store v683, v681; - builtin.ret ; - }; - - private builtin.function @::allocate(v684: i32, v685: i32, v686: i32) { - ^block67(v684: i32, v685: i32, v686: i32): - v688 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v689 = hir.bitcast v688 : ptr; - v690 = hir.load v689 : i32; - v691 = arith.constant 16 : i32; - v692 = arith.sub v690, v691 : i32 #[overflow = wrapping]; - v693 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v694 = hir.bitcast v693 : ptr; - hir.store v694, v692; - v687 = arith.constant 0 : i32; - v695 = arith.constant 8 : i32; - v696 = arith.add v692, v695 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v696, v685, v686, v687) - v699 = arith.constant 12 : u32; - v698 = hir.bitcast v692 : u32; - v700 = arith.add v698, v699 : u32 #[overflow = checked]; - v701 = arith.constant 4 : u32; - v702 = arith.mod v700, v701 : u32; - hir.assertz v702 #[code = 250]; - v703 = hir.int_to_ptr v700 : ptr; - v704 = hir.load v703 : i32; - v706 = arith.constant 8 : u32; - v705 = hir.bitcast v692 : u32; - v707 = arith.add v705, v706 : u32 #[overflow = checked]; - v1229 = arith.constant 4 : u32; - v709 = arith.mod v707, v1229 : u32; - hir.assertz v709 #[code = 250]; - v710 = hir.int_to_ptr v707 : ptr; - v711 = hir.load v710 : i32; - v712 = hir.bitcast v684 : u32; - v1228 = arith.constant 4 : u32; - v714 = arith.mod v712, v1228 : u32; - hir.assertz v714 #[code = 250]; - v715 = hir.int_to_ptr v712 : ptr; - hir.store v715, v711; - v1227 = arith.constant 4 : u32; - v716 = hir.bitcast v684 : u32; - v718 = arith.add v716, v1227 : u32 #[overflow = checked]; - v1226 = arith.constant 4 : u32; - v720 = arith.mod v718, v1226 : u32; - hir.assertz v720 #[code = 250]; - v721 = hir.int_to_ptr v718 : ptr; - hir.store v721, v704; - v1225 = arith.constant 16 : i32; - v723 = arith.add v692, v1225 : i32 #[overflow = wrapping]; - v724 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v725 = hir.bitcast v724 : ptr; - hir.store v725, v723; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v726: i32, v727: i32, v728: i32, v729: i32) { - ^block69(v726: i32, v727: i32, v728: i32, v729: i32): - v1245 = arith.constant 0 : i32; - v730 = arith.constant 0 : i32; - v731 = arith.eq v728, v730 : i1; - v732 = arith.zext v731 : u32; - v733 = hir.bitcast v732 : i32; - v735 = arith.neq v733, v1245 : i1; - v1241 = scf.if v735 : i32 { - ^block129: - scf.yield v727; - } else { - ^block72: - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1244 = arith.constant 0 : i32; - v737 = arith.neq v729, v1244 : i1; - v1240 = scf.if v737 : i32 { - ^block73: - v739 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc_zeroed(v728, v727) : i32 - scf.yield v739; - } else { - ^block74: - v738 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_alloc(v728, v727) : i32 - scf.yield v738; - }; - scf.yield v1240; - }; - v743 = arith.constant 4 : u32; - v742 = hir.bitcast v726 : u32; - v744 = arith.add v742, v743 : u32 #[overflow = checked]; - v1243 = arith.constant 4 : u32; - v746 = arith.mod v744, v1243 : u32; - hir.assertz v746 #[code = 250]; - v747 = hir.int_to_ptr v744 : ptr; - hir.store v747, v728; - v749 = hir.bitcast v726 : u32; - v1242 = arith.constant 4 : u32; - v751 = arith.mod v749, v1242 : u32; - hir.assertz v751 #[code = 250]; - v752 = hir.int_to_ptr v749 : ptr; - hir.store v752, v1241; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v753: i32, v754: i32, v755: i32, v756: i32) { - ^block75(v753: i32, v754: i32, v755: i32, v756: i32): - v1271 = arith.constant 0 : i32; - v757 = arith.constant 0 : i32; - v761 = arith.eq v756, v757 : i1; - v762 = arith.zext v761 : u32; - v763 = hir.bitcast v762 : i32; - v765 = arith.neq v763, v1271 : i1; - v1258, v1259 = scf.if v765 : i32, i32 { - ^block133: - v1270 = arith.constant 0 : i32; - v759 = arith.constant 4 : i32; - scf.yield v759, v1270; - } else { - ^block78: - v766 = hir.bitcast v754 : u32; - v801 = arith.constant 4 : u32; - v768 = arith.mod v766, v801 : u32; - hir.assertz v768 #[code = 250]; - v769 = hir.int_to_ptr v766 : ptr; - v770 = hir.load v769 : i32; - v1268 = arith.constant 0 : i32; - v1269 = arith.constant 0 : i32; - v772 = arith.eq v770, v1269 : i1; - v773 = arith.zext v772 : u32; - v774 = hir.bitcast v773 : i32; - v776 = arith.neq v774, v1268 : i1; - v1256 = scf.if v776 : i32 { - ^block132: - v1267 = arith.constant 0 : i32; - scf.yield v1267; - } else { - ^block79: - v1266 = arith.constant 4 : u32; - v777 = hir.bitcast v753 : u32; - v779 = arith.add v777, v1266 : u32 #[overflow = checked]; - v1265 = arith.constant 4 : u32; - v781 = arith.mod v779, v1265 : u32; - hir.assertz v781 #[code = 250]; - v782 = hir.int_to_ptr v779 : ptr; - hir.store v782, v755; - v1264 = arith.constant 4 : u32; - v783 = hir.bitcast v754 : u32; - v785 = arith.add v783, v1264 : u32 #[overflow = checked]; - v1263 = arith.constant 4 : u32; - v787 = arith.mod v785, v1263 : u32; - hir.assertz v787 #[code = 250]; - v788 = hir.int_to_ptr v785 : ptr; - v789 = hir.load v788 : i32; - v790 = hir.bitcast v753 : u32; - v1262 = arith.constant 4 : u32; - v792 = arith.mod v790, v1262 : u32; - hir.assertz v792 #[code = 250]; - v793 = hir.int_to_ptr v790 : ptr; - hir.store v793, v789; - v794 = arith.mul v770, v756 : i32 #[overflow = wrapping]; - scf.yield v794; - }; - v795 = arith.constant 8 : i32; - v1261 = arith.constant 4 : i32; - v1257 = cf.select v776, v1261, v795 : i32; - scf.yield v1257, v1256; - }; - v798 = arith.add v753, v1258 : i32 #[overflow = wrapping]; - v800 = hir.bitcast v798 : u32; - v1260 = arith.constant 4 : u32; - v802 = arith.mod v800, v1260 : u32; - hir.assertz v802 #[code = 250]; - v803 = hir.int_to_ptr v800 : ptr; - hir.store v803, v1259; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::finish_grow(v804: i32, v805: i32, v806: i32, v807: i32, v808: i32) { - ^block80(v804: i32, v805: i32, v806: i32, v807: i32, v808: i32): - v810 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v811 = hir.bitcast v810 : ptr; - v812 = hir.load v811 : i32; - v813 = arith.constant 16 : i32; - v814 = arith.sub v812, v813 : i32 #[overflow = wrapping]; - v815 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v816 = hir.bitcast v815 : ptr; - hir.store v816, v814; - v1326 = arith.constant 0 : i32; - v809 = arith.constant 0 : i32; - v819 = arith.gte v806, v809 : i1; - v820 = arith.zext v819 : u32; - v821 = hir.bitcast v820 : i32; - v823 = arith.neq v821, v1326 : i1; - v1300, v1301 = scf.if v823 : i32, i32 { - ^block83: - v910 = arith.constant 4 : u32; - v826 = hir.bitcast v807 : u32; - v828 = arith.add v826, v910 : u32 #[overflow = checked]; - v1325 = arith.constant 4 : u32; - v830 = arith.mod v828, v1325 : u32; - hir.assertz v830 #[code = 250]; - v831 = hir.int_to_ptr v828 : ptr; - v832 = hir.load v831 : i32; - v1323 = arith.constant 0 : i32; - v1324 = arith.constant 0 : i32; - v834 = arith.eq v832, v1324 : i1; - v835 = arith.zext v834 : u32; - v836 = hir.bitcast v835 : i32; - v838 = arith.neq v836, v1323 : i1; - v1298, v1299 = scf.if v838 : i32, i32 { - ^block86: - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/::allocate(v814, v805, v806) - v1322 = arith.constant 4 : u32; - v871 = hir.bitcast v814 : u32; - v873 = arith.add v871, v1322 : u32 #[overflow = checked]; - v1321 = arith.constant 4 : u32; - v875 = arith.mod v873, v1321 : u32; - hir.assertz v875 #[code = 250]; - v876 = hir.int_to_ptr v873 : ptr; - v877 = hir.load v876 : i32; - v878 = hir.bitcast v814 : u32; - v1320 = arith.constant 4 : u32; - v880 = arith.mod v878, v1320 : u32; - hir.assertz v880 #[code = 250]; - v881 = hir.int_to_ptr v878 : ptr; - v882 = hir.load v881 : i32; - scf.yield v882, v877; - } else { - ^block87: - v840 = arith.constant 8 : u32; - v839 = hir.bitcast v807 : u32; - v841 = arith.add v839, v840 : u32 #[overflow = checked]; - v1319 = arith.constant 4 : u32; - v843 = arith.mod v841, v1319 : u32; - hir.assertz v843 #[code = 250]; - v844 = hir.int_to_ptr v841 : ptr; - v845 = hir.load v844 : i32; - v1318 = arith.constant 0 : i32; - v847 = arith.neq v845, v1318 : i1; - v1296, v1297 = scf.if v847 : i32, i32 { - ^block88: - v865 = hir.bitcast v807 : u32; - v1317 = arith.constant 4 : u32; - v867 = arith.mod v865, v1317 : u32; - hir.assertz v867 #[code = 250]; - v868 = hir.int_to_ptr v865 : ptr; - v869 = hir.load v868 : i32; - v870 = hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/__rustc::__rust_realloc(v869, v845, v805, v806) : i32 - scf.yield v870, v806; - } else { - ^block89: - v1316 = arith.constant 0 : i32; - v904 = arith.constant 8 : i32; - v849 = arith.add v814, v904 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_five_felts_struct/alloc::alloc::Global::alloc_impl(v849, v805, v806, v1316) - v852 = arith.constant 12 : u32; - v851 = hir.bitcast v814 : u32; - v853 = arith.add v851, v852 : u32 #[overflow = checked]; - v1315 = arith.constant 4 : u32; - v855 = arith.mod v853, v1315 : u32; - hir.assertz v855 #[code = 250]; - v856 = hir.int_to_ptr v853 : ptr; - v857 = hir.load v856 : i32; - v1314 = arith.constant 8 : u32; - v858 = hir.bitcast v814 : u32; - v860 = arith.add v858, v1314 : u32 #[overflow = checked]; - v1313 = arith.constant 4 : u32; - v862 = arith.mod v860, v1313 : u32; - hir.assertz v862 #[code = 250]; - v863 = hir.int_to_ptr v860 : ptr; - v864 = hir.load v863 : i32; - scf.yield v864, v857; - }; - scf.yield v1296, v1297; - }; - v1312 = arith.constant 4 : u32; - v889 = hir.bitcast v804 : u32; - v891 = arith.add v889, v1312 : u32 #[overflow = checked]; - v1311 = arith.constant 4 : u32; - v893 = arith.mod v891, v1311 : u32; - hir.assertz v893 #[code = 250]; - v1310 = arith.constant 0 : i32; - v887 = arith.neq v1298, v1310 : i1; - v888 = cf.select v887, v1298, v805 : i32; - v894 = hir.int_to_ptr v891 : ptr; - hir.store v894, v888; - v1308 = arith.constant 0 : i32; - v901 = arith.eq v1298, v1308 : i1; - v902 = arith.zext v901 : u32; - v903 = hir.bitcast v902 : i32; - v1309 = arith.constant 0 : i32; - v898 = arith.neq v1298, v1309 : i1; - v899 = cf.select v898, v1299, v806 : i32; - scf.yield v899, v903; - } else { - ^block84: - v824 = arith.constant 1 : i32; - v1307 = arith.constant 0 : i32; - scf.yield v1307, v824; - }; - v825 = arith.constant 4 : i32; - v1306 = arith.constant 8 : i32; - v1302 = cf.select v823, v1306, v825 : i32; - v907 = arith.add v804, v1302 : i32 #[overflow = wrapping]; - v909 = hir.bitcast v907 : u32; - v1305 = arith.constant 4 : u32; - v911 = arith.mod v909, v1305 : u32; - hir.assertz v911 #[code = 250]; - v912 = hir.int_to_ptr v909 : ptr; - hir.store v912, v1300; - v914 = hir.bitcast v804 : u32; - v1304 = arith.constant 4 : u32; - v916 = arith.mod v914, v1304 : u32; - hir.assertz v916 #[code = 250]; - v917 = hir.int_to_ptr v914 : ptr; - hir.store v917, v1301; - v1303 = arith.constant 16 : i32; - v921 = arith.add v814, v1303 : i32 #[overflow = wrapping]; - v922 = builtin.global_symbol @root_ns:root@1.0.0/onchain_five_felts_struct/__stack_pointer : ptr - v923 = hir.bitcast v922 : ptr; - hir.store v923, v921; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v924: i32, v925: i32, v926: i32) { - ^block90(v924: i32, v925: i32, v926: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v927: i32, v928: i32) -> i32 { - ^block92(v927: i32, v928: i32): - v935 = arith.constant 0 : i32; - v931 = hir.bitcast v928 : u32; - v930 = hir.bitcast v927 : u32; - v932 = arith.gt v930, v931 : i1; - v933 = arith.zext v932 : u32; - v934 = hir.bitcast v933 : i32; - v936 = arith.neq v934, v935 : i1; - v937 = cf.select v936, v927, v928 : i32; - builtin.ret v937; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; - }; -}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.masm b/felt-repr/tests/expected/onchain_five_felts_struct.masm deleted file mode 100644 index a44d81ced..000000000 --- a/felt-repr/tests/expected/onchain_five_felts_struct.masm +++ /dev/null @@ -1,2477 +0,0 @@ -# mod root_ns:root@1.0.0 - -proc init - push.1179648 - trace.240 - exec.::intrinsics::mem::heap_init - trace.252 - push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] - adv.push_mapval - push.262144 - push.2 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop - push.1048576 - u32assert - mem_store.278536 -end - -# mod root_ns:root@1.0.0::onchain_five_felts_struct - -@callconv("C") -proc alloc::vec::Vec::push(i32, felt) - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - swap.1 - dup.2 - neq - neq - if.true - nop - else - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVec::grow_one - trace.252 - nop - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.2 - swap.1 - u32shl - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVec::grow_one(i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - push.1 - push.8 - dup.4 - u32wrapping_add - dup.2 - movup.2 - swap.3 - swap.4 - movdn.2 - swap.5 - swap.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVecInner::grow_amortized - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.2147483649 - dup.2 - eq - neq - if.true - drop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -pub proc entrypoint(i32, i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.12 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.6 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - push.0 - push.256 - push.20 - dup.9 - u32wrapping_add - dup.3 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVecInner::try_allocate_in - trace.252 - nop - push.24 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.20 - dup.7 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.1 - movup.2 - neq - neq - if.true - push.8 - push.8 - dup.8 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.28 - dup.8 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.9 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.8 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.7 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.6 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.5 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.4 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movdn.5 - dropw - drop - movup.2 - drop - push.28 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 - dup.5 - swap.1 - u32lt - neq - swap.1 - swap.4 - swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - swap.1 - drop - else - push.0 - push.0 - dup.3 - eq - neq - if.true - swap.1 - drop - else - push.0 - movup.2 - dup.2 - push.0 - dup.2 - push.0 - gte - while.true - dup.1 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.4 - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.3 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop -end - -@callconv("C") -proc ::alloc( - i32, - i32, - i32 -) -> i32 - push.16 - push.0 - push.16 - dup.4 - swap.1 - u32gt - neq - dup.3 - swap.1 - cdrop - push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 - else - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::core::ptr::alignment::Alignment::max - trace.252 - nop - push.0 - push.2147483648 - dup.2 - u32wrapping_sub - dup.4 - swap.1 - u32gt - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - else - push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop - exec.::intrinsics::mem::memory_size - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.16 - movup.2 - swap.1 - u32shl - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.4294967295 - dup.2 - u32xor - dup.3 - swap.1 - u32gt - neq - if.true - drop - drop - movdn.2 - drop - drop - push.0 - else - movup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - u32wrapping_add - end - end - push.1 - push.0 - movup.3 - cdrop - swap.1 - end - push.0 - movup.2 - eq - if.true - drop - push.0 - assert - else - nop - end -end - -@callconv("C") -proc intrinsics::mem::heap_base( - -) -> i32 - trace.240 - nop - exec.::intrinsics::mem::heap_base - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::grow_amortized( - i32, - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.8 - eq - neq - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - movup.4 - dup.4 - u32wrapping_add - push.0 - movup.5 - dup.2 - swap.1 - u32lt - neq - if.true - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1 - u32shl - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - movup.2 - swap.1 - cdrop - push.1 - push.4 - push.0 - push.1025 - dup.9 - swap.1 - u32lt - neq - cdrop - push.8 - push.0 - push.1 - dup.9 - eq - neq - cdrop - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - dup.2 - swap.1 - cdrop - dup.0 - push.0 - push.0 - dup.8 - u32wrapping_sub - push.4294967295 - dup.9 - dup.11 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - drop - push.0 - push.2147483648 - dup.8 - u32wrapping_sub - dup.2 - swap.1 - u32gt - neq - if.true - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - push.20 - dup.4 - u32wrapping_add - dup.6 - dup.8 - movup.3 - swap.10 - movdn.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.20 - dup.3 - u32wrapping_add - push.8 - dup.4 - u32wrapping_add - dup.5 - movup.2 - swap.3 - swap.9 - movdn.2 - swap.4 - swap.8 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::raw_vec::finish_grow - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.7 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.4 - else - movup.2 - swap.6 - movdn.2 - swap.1 - swap.5 - swap.1 - swap.4 - drop - drop - drop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - end - push.2147483649 - movdn.2 - movdn.3 - cdrop - swap.1 - end - end - end - end - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.2 - push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 - else - drop - push.0 - push.2147483648 - dup.7 - u32wrapping_sub - dup.2 - swap.1 - u32lte - neq - dup.0 - if.true - push.0 - dup.2 - neq - if.true - push.0 - movup.6 - neq - if.true - push.1 - dup.3 - dup.7 - dup.4 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.3 - u32wrapping_add - dup.6 - dup.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::allocate - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - movup.6 - movup.2 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movup.7 - movup.4 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.0 - push.1 - movup.2 - cdrop - else - movup.2 - swap.5 - movdn.2 - swap.4 - swap.1 - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 - end - else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 - end - push.0 - push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 - movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 - cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 - end - movup.5 - eq.0 - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.1 - swap.1 - else - drop - drop - end - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.8 - dup.2 - u32wrapping_add - movup.2 - swap.5 - movdn.2 - swap.1 - swap.3 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - movup.3 - drop - swap.1 - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.0 - movup.4 - neq - if.true - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_alloc - trace.252 - nop - end - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq - if.true - movdn.3 - drop - drop - drop - push.0 - push.4 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - else - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.3 - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - movup.2 - swap.1 - end - push.8 - push.4 - movup.3 - cdrop - end - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) - movup.4 - drop - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.5 - swap.1 - trace.240 - nop - exec.::intrinsics::i32::is_gte - trace.252 - nop - neq - dup.0 - if.true - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - if.true - movup.5 - drop - dup.4 - dup.4 - dup.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::::allocate - trace.252 - nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - dup.1 - neq - if.true - movup.6 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.5 - dup.7 - swap.3 - swap.1 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::__rustc::__rust_realloc - trace.252 - nop - dup.5 - swap.1 - else - movup.6 - swap.1 - drop - drop - push.0 - push.8 - dup.3 - u32wrapping_add - dup.5 - dup.7 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_five_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - end - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - dup.2 - neq - dup.2 - movup.2 - swap.8 - movdn.2 - swap.1 - cdrop - movup.6 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - dup.1 - eq - push.0 - movup.2 - neq - swap.1 - swap.6 - swap.2 - swap.1 - cdrop - movup.4 - swap.1 - else - movup.2 - swap.5 - movdn.2 - swap.1 - swap.4 - swap.1 - swap.3 - drop - drop - drop - push.1 - push.0 - end - push.4 - push.8 - movup.4 - cdrop - dup.4 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop - drop - drop - push.0 - assert -end - -@callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 - push.0 - dup.2 - dup.2 - swap.1 - u32gt - neq - cdrop -end - diff --git a/felt-repr/tests/expected/onchain_five_felts_struct.wat b/felt-repr/tests/expected/onchain_five_felts_struct.wat deleted file mode 100644 index a757e1312..000000000 --- a/felt-repr/tests/expected/onchain_five_felts_struct.wat +++ /dev/null @@ -1,753 +0,0 @@ -(module $onchain_five_felts_struct.wasm - (type (;0;) (func (param i32 f32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32 i32 i32) (result i32))) - (type (;5;) (func)) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func (result i32))) - (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;9;) (func (param i32 i32 i32 i32 i32))) - (type (;10;) (func (param i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32))) - (table (;0;) 1 1 funcref) - (memory (;0;) 17) - (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) - (export "memory" (memory 0)) - (export "entrypoint" (func $entrypoint)) - (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) - (local i32) - block ;; label = @1 - local.get 0 - i32.load offset=8 - local.tee 2 - local.get 0 - i32.load - i32.ne - br_if 0 (;@1;) - local.get 0 - call $alloc::raw_vec::RawVec::grow_one - end - local.get 0 - i32.load offset=4 - local.get 2 - i32.const 2 - i32.shl - i32.add - local.get 1 - f32.store - local.get 0 - local.get 2 - i32.const 1 - i32.add - i32.store offset=8 - ) - (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - i32.const 8 - i32.add - local.get 0 - local.get 0 - i32.load - i32.const 1 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::grow_amortized - block ;; label = @1 - local.get 1 - i32.load offset=8 - local.tee 0 - i32.const -2147483647 - i32.eq - br_if 0 (;@1;) - local.get 0 - local.get 1 - i32.load offset=12 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 f32 f32 f32 i32) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 2 - global.set $__stack_pointer - local.get 1 - f32.load offset=16 - local.set 3 - local.get 1 - f32.load offset=12 - local.set 4 - local.get 1 - f32.load offset=8 - local.set 5 - local.get 1 - f32.load offset=4 - local.set 6 - local.get 1 - f32.load - local.set 7 - local.get 2 - i32.const 20 - i32.add - i32.const 256 - i32.const 0 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 2 - i32.load offset=24 - local.set 1 - block ;; label = @1 - local.get 2 - i32.load offset=20 - i32.const 1 - i32.ne - br_if 0 (;@1;) - local.get 1 - local.get 2 - i32.load offset=28 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 2 - i32.const 8 - i32.add - i32.const 8 - i32.add - local.tee 8 - i32.const 0 - i32.store - local.get 2 - local.get 2 - i32.load offset=28 - i32.store offset=12 - local.get 2 - local.get 1 - i32.store offset=8 - local.get 2 - i32.const 8 - i32.add - local.get 7 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 6 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 5 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 4 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 3 - call $alloc::vec::Vec::push - local.get 0 - i32.const 8 - i32.add - local.get 8 - i32.load - i32.store - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store align=4 - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 2 - local.get 3 - call $::alloc - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - local.get 1 - local.get 3 - local.get 1 - i32.lt_u - select - local.tee 3 - i32.eqz - br_if 0 (;@1;) - local.get 2 - local.get 0 - local.get 3 - memory.copy - end - local.get 2 - ) - (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - local.tee 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.const 0 - local.get 0 - memory.fill - end - local.get 1 - ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) - return - ) - (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) - (local i32 i32) - block ;; label = @1 - local.get 1 - i32.const 16 - local.get 1 - i32.const 16 - i32.gt_u - select - local.tee 3 - local.get 3 - i32.const -1 - i32.add - i32.and - br_if 0 (;@1;) - local.get 2 - i32.const -2147483648 - local.get 1 - local.get 3 - call $core::ptr::alignment::Alignment::max - local.tee 1 - i32.sub - i32.gt_u - br_if 0 (;@1;) - i32.const 0 - local.set 3 - local.get 2 - local.get 1 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 1 - i32.sub - i32.and - local.set 2 - block ;; label = @2 - local.get 0 - i32.load - br_if 0 (;@2;) - local.get 0 - call $intrinsics::mem::heap_base - memory.size - i32.const 16 - i32.shl - i32.add - i32.store - end - block ;; label = @2 - local.get 2 - local.get 0 - i32.load - local.tee 4 - i32.const -1 - i32.xor - i32.gt_u - br_if 0 (;@2;) - local.get 0 - local.get 4 - local.get 2 - i32.add - i32.store - local.get 4 - local.get 1 - i32.add - local.set 3 - end - local.get 3 - return - end - unreachable - ) - (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) - unreachable - ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) - (local i32 i32 i32 i64) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 6 - global.set $__stack_pointer - i32.const 0 - local.set 7 - block ;; label = @1 - block ;; label = @2 - local.get 5 - i32.eqz - br_if 0 (;@2;) - local.get 2 - local.get 3 - i32.add - local.tee 3 - local.get 2 - i32.lt_u - br_if 1 (;@1;) - i32.const 0 - local.set 7 - local.get 4 - local.get 5 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 4 - i32.sub - i32.and - i64.extend_i32_u - local.get 3 - local.get 1 - i32.load - i32.const 1 - i32.shl - local.tee 8 - local.get 3 - local.get 8 - i32.gt_u - select - local.tee 8 - i32.const 8 - i32.const 4 - i32.const 1 - local.get 5 - i32.const 1025 - i32.lt_u - select - local.get 5 - i32.const 1 - i32.eq - select - local.tee 2 - local.get 8 - local.get 2 - i32.gt_u - select - local.tee 2 - i64.extend_i32_u - i64.mul - local.tee 9 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@2;) - local.get 9 - i32.wrap_i64 - local.tee 3 - i32.const -2147483648 - local.get 4 - i32.sub - i32.gt_u - br_if 1 (;@1;) - local.get 6 - i32.const 20 - i32.add - local.get 1 - local.get 4 - local.get 5 - call $alloc::raw_vec::RawVecInner::current_memory - local.get 6 - i32.const 8 - i32.add - local.get 4 - local.get 3 - local.get 6 - i32.const 20 - i32.add - local.get 0 - call $alloc::raw_vec::finish_grow - local.get 6 - i32.load offset=12 - local.set 7 - block ;; label = @3 - local.get 6 - i32.load offset=8 - i32.eqz - br_if 0 (;@3;) - local.get 6 - i32.load offset=16 - local.set 8 - br 2 (;@1;) - end - local.get 1 - local.get 2 - i32.store - local.get 1 - local.get 7 - i32.store offset=4 - i32.const -2147483647 - local.set 7 - br 1 (;@1;) - end - end - local.get 0 - local.get 8 - i32.store offset=4 - local.get 0 - local.get 7 - i32.store - local.get 6 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;10;) (type 9) (param i32 i32 i32 i32 i32) - (local i32 i64) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - block ;; label = @1 - block ;; label = @2 - block ;; label = @3 - local.get 3 - local.get 4 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 3 - i32.sub - i32.and - i64.extend_i32_u - local.get 1 - i64.extend_i32_u - i64.mul - local.tee 6 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@3;) - local.get 6 - i32.wrap_i64 - local.tee 4 - i32.const -2147483648 - local.get 3 - i32.sub - i32.le_u - br_if 1 (;@2;) - end - local.get 0 - i32.const 0 - i32.store offset=4 - i32.const 1 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - local.get 4 - br_if 0 (;@2;) - local.get 0 - local.get 3 - i32.store offset=8 - i32.const 0 - local.set 3 - local.get 0 - i32.const 0 - i32.store offset=4 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 2 - br_if 0 (;@3;) - local.get 5 - i32.const 8 - i32.add - local.get 3 - local.get 4 - call $::allocate - local.get 5 - i32.load offset=8 - local.set 2 - br 1 (;@2;) - end - local.get 5 - local.get 3 - local.get 4 - i32.const 1 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load - local.set 2 - end - block ;; label = @2 - local.get 2 - i32.eqz - br_if 0 (;@2;) - local.get 0 - local.get 2 - i32.store offset=8 - local.get 0 - local.get 1 - i32.store offset=4 - i32.const 0 - local.set 3 - br 1 (;@1;) - end - local.get 0 - local.get 4 - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - i32.const 1 - local.set 3 - end - local.get 0 - local.get 3 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;11;) (type 10) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 3 - i32.load offset=12 - local.set 2 - local.get 0 - local.get 3 - i32.load offset=8 - i32.store - local.get 0 - local.get 2 - i32.store offset=4 - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::alloc::Global::alloc_impl (;12;) (type 11) (param i32 i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @2 - local.get 3 - br_if 0 (;@2;) - local.get 2 - local.get 1 - call $__rustc::__rust_alloc - local.set 1 - br 1 (;@1;) - end - local.get 2 - local.get 1 - call $__rustc::__rust_alloc_zeroed - local.set 1 - end - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.store - ) - (func $alloc::raw_vec::RawVecInner::current_memory (;13;) (type 11) (param i32 i32 i32 i32) - (local i32 i32 i32) - i32.const 0 - local.set 4 - i32.const 4 - local.set 5 - block ;; label = @1 - local.get 3 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.load - local.tee 6 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.load offset=4 - i32.store - local.get 6 - local.get 3 - i32.mul - local.set 4 - i32.const 8 - local.set 5 - end - local.get 0 - local.get 5 - i32.add - local.get 4 - i32.store - ) - (func $alloc::raw_vec::finish_grow (;14;) (type 9) (param i32 i32 i32 i32 i32) - (local i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - i32.const 0 - local.set 6 - block ;; label = @1 - block ;; label = @2 - local.get 2 - i32.const 0 - i32.ge_s - br_if 0 (;@2;) - i32.const 1 - local.set 2 - i32.const 4 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 3 - i32.load offset=4 - i32.eqz - br_if 0 (;@3;) - block ;; label = @4 - local.get 3 - i32.load offset=8 - local.tee 6 - br_if 0 (;@4;) - local.get 5 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load offset=12 - local.set 6 - local.get 5 - i32.load offset=8 - local.set 3 - br 2 (;@2;) - end - local.get 3 - i32.load - local.get 6 - local.get 1 - local.get 2 - call $__rustc::__rust_realloc - local.set 3 - local.get 2 - local.set 6 - br 1 (;@2;) - end - local.get 5 - local.get 1 - local.get 2 - call $::allocate - local.get 5 - i32.load offset=4 - local.set 6 - local.get 5 - i32.load - local.set 3 - end - local.get 0 - local.get 3 - local.get 1 - local.get 3 - select - i32.store offset=4 - local.get 6 - local.get 2 - local.get 3 - select - local.set 6 - local.get 3 - i32.eqz - local.set 2 - i32.const 8 - local.set 3 - end - local.get 0 - local.get 3 - i32.add - local.get 6 - i32.store - local.get 0 - local.get 2 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::handle_error (;15;) (type 10) (param i32 i32 i32) - unreachable - ) - (func $core::ptr::alignment::Alignment::max (;16;) (type 3) (param i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 0 - local.get 1 - i32.gt_u - select - ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") -) diff --git a/felt-repr/tests/expected/onchain_minimal_u64_bug.hir b/felt-repr/tests/expected/onchain_minimal_u64_bug.hir deleted file mode 100644 index 1a1c790e2..000000000 --- a/felt-repr/tests/expected/onchain_minimal_u64_bug.hir +++ /dev/null @@ -1,1326 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @onchain_minimal_u64_bug { - private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { - ^block4(v0: i32, v1: felt): - v4 = arith.constant 8 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.add v3, v4 : u32 #[overflow = checked]; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; - hir.assertz v7 #[code = 250]; - v8 = hir.int_to_ptr v5 : ptr; - v9 = hir.load v8 : i32; - v10 = hir.bitcast v0 : u32; - v981 = arith.constant 4 : u32; - v12 = arith.mod v10, v981 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : i32; - v2 = arith.constant 0 : i32; - v15 = arith.neq v9, v14 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v2 : i1; - scf.if v19{ - ^block104: - scf.yield ; - } else { - ^block7: - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVec::grow_one(v0) - scf.yield ; - }; - v980 = arith.constant 4 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v980 : u32 #[overflow = checked]; - v979 = arith.constant 4 : u32; - v25 = arith.mod v23, v979 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - v27 = hir.load v26 : i32; - v971 = arith.constant 2 : u32; - v31 = arith.shl v9, v971 : i32; - v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v32 : u32; - v978 = arith.constant 4 : u32; - v36 = arith.mod v34, v978 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v1; - v977 = arith.constant 8 : u32; - v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v977 : u32 #[overflow = checked]; - v976 = arith.constant 4 : u32; - v44 = arith.mod v42, v976 : u32; - hir.assertz v44 #[code = 250]; - v38 = arith.constant 1 : i32; - v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v39; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { - ^block8(v46: i32): - v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 16 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; - v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v54 = hir.bitcast v53 : ptr; - hir.store v54, v52; - v57 = hir.bitcast v46 : u32; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v63 = arith.constant 4 : i32; - v62 = arith.constant 1 : i32; - v55 = arith.constant 8 : i32; - v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) - v66 = arith.constant 8 : u32; - v65 = hir.bitcast v52 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v985 = arith.constant 4 : u32; - v69 = arith.mod v67, v985 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i32; - v47 = arith.constant 0 : i32; - v72 = arith.constant -2147483647 : i32; - v73 = arith.eq v71, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v47 : i1; - cf.cond_br v77 ^block10, ^block11; - ^block10: - v984 = arith.constant 16 : i32; - v87 = arith.add v52, v984 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret ; - ^block11: - v79 = arith.constant 12 : u32; - v78 = hir.bitcast v52 : u32; - v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v983 = arith.constant 4 : u32; - v82 = arith.mod v80, v983 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::handle_error(v71, v84, v85) - ub.unreachable ; - }; - - public builtin.function @entrypoint(v90: i32, v91: i32) { - ^block12(v90: i32, v91: i32): - v96 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v97 = hir.bitcast v96 : ptr; - v98 = hir.load v97 : i32; - v99 = arith.constant 32 : i32; - v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; - v101 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v102 = hir.bitcast v101 : ptr; - hir.store v102, v100; - v103 = hir.bitcast v91 : u32; - v104 = arith.constant 4 : u32; - v105 = arith.mod v103, v104 : u32; - hir.assertz v105 #[code = 250]; - v106 = hir.int_to_ptr v103 : ptr; - v107 = hir.load v106 : felt; - v108 = arith.constant 111111 : i32; - v109 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::from_u32(v108) : felt - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::assert_eq(v107, v109) - v111 = arith.constant 16 : u32; - v110 = hir.bitcast v91 : u32; - v112 = arith.add v110, v111 : u32 #[overflow = checked]; - v1016 = arith.constant 4 : u32; - v114 = arith.mod v112, v1016 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : felt; - v117 = arith.constant 55 : i32; - v118 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::from_u32(v117) : felt - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::assert_eq(v116, v118) - v119 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v107) : i64 - v1015 = arith.constant 4 : u32; - v120 = hir.bitcast v91 : u32; - v122 = arith.add v120, v1015 : u32 #[overflow = checked]; - v1014 = arith.constant 4 : u32; - v124 = arith.mod v122, v1014 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : felt; - v127 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v126) : i64 - v129 = arith.constant 8 : u32; - v128 = hir.bitcast v91 : u32; - v130 = arith.add v128, v129 : u32 #[overflow = checked]; - v1013 = arith.constant 4 : u32; - v132 = arith.mod v130, v1013 : u32; - hir.assertz v132 #[code = 250]; - v133 = hir.int_to_ptr v130 : ptr; - v134 = hir.load v133 : felt; - v135 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v134) : i64 - v137 = arith.constant 12 : u32; - v136 = hir.bitcast v91 : u32; - v138 = arith.add v136, v137 : u32 #[overflow = checked]; - v1012 = arith.constant 4 : u32; - v140 = arith.mod v138, v1012 : u32; - hir.assertz v140 #[code = 250]; - v141 = hir.int_to_ptr v138 : ptr; - v142 = hir.load v141 : felt; - v143 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v142) : i64 - v144 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::as_u64(v116) : i64 - v149 = arith.constant 4 : i32; - v92 = arith.constant 0 : i32; - v147 = arith.constant 256 : i32; - v145 = arith.constant 20 : i32; - v146 = arith.add v100, v145 : i32 #[overflow = wrapping]; - hir.store_local v90 #[local = lv0]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVecInner::try_allocate_in(v146, v147, v92, v149, v149) - v152 = arith.constant 24 : u32; - v151 = hir.bitcast v100 : u32; - v153 = arith.add v151, v152 : u32 #[overflow = checked]; - v1011 = arith.constant 4 : u32; - v155 = arith.mod v153, v1011 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - v157 = hir.load v156 : i32; - v159 = arith.constant 20 : u32; - v158 = hir.bitcast v100 : u32; - v160 = arith.add v158, v159 : u32 #[overflow = checked]; - v1010 = arith.constant 4 : u32; - v162 = arith.mod v160, v1010 : u32; - hir.assertz v162 #[code = 250]; - v163 = hir.int_to_ptr v160 : ptr; - v164 = hir.load v163 : i32; - v1009 = arith.constant 0 : i32; - v165 = arith.constant 1 : i32; - v166 = arith.neq v164, v165 : i1; - v167 = arith.zext v166 : u32; - v168 = hir.bitcast v167 : i32; - v170 = arith.neq v168, v1009 : i1; - cf.cond_br v170 ^block14, ^block15; - ^block14: - v1008 = arith.constant 8 : i32; - v179 = arith.constant 8 : i32; - v180 = arith.add v100, v179 : i32 #[overflow = wrapping]; - v182 = arith.add v180, v1008 : i32 #[overflow = wrapping]; - v184 = hir.bitcast v182 : u32; - v1007 = arith.constant 4 : u32; - v186 = arith.mod v184, v1007 : u32; - hir.assertz v186 #[code = 250]; - v1006 = arith.constant 0 : i32; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v1006; - v189 = arith.constant 28 : u32; - v188 = hir.bitcast v100 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v1005 = arith.constant 4 : u32; - v192 = arith.mod v190, v1005 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - v194 = hir.load v193 : i32; - v1004 = arith.constant 12 : u32; - v195 = hir.bitcast v100 : u32; - v197 = arith.add v195, v1004 : u32 #[overflow = checked]; - v1003 = arith.constant 4 : u32; - v199 = arith.mod v197, v1003 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v194; - v1002 = arith.constant 8 : u32; - v201 = hir.bitcast v100 : u32; - v203 = arith.add v201, v1002 : u32 #[overflow = checked]; - v1001 = arith.constant 4 : u32; - v205 = arith.mod v203, v1001 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v157; - v209 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::felt::from_u64_unchecked(v119) : felt - v1000 = arith.constant 8 : i32; - v208 = arith.add v100, v1000 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v208, v209) - v212 = arith.trunc v127 : i32; - v213 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v212) : felt - v999 = arith.constant 8 : i32; - v211 = arith.add v100, v999 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v211, v213) - v216 = arith.trunc v135 : i32; - v217 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v216) : felt - v998 = arith.constant 8 : i32; - v215 = arith.add v100, v998 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v215, v217) - v220 = arith.trunc v143 : i32; - v221 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v220) : felt - v997 = arith.constant 8 : i32; - v219 = arith.add v100, v997 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v219, v221) - v224 = arith.trunc v144 : i32; - v225 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/>::from(v224) : felt - v996 = arith.constant 8 : i32; - v223 = arith.add v100, v996 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::vec::Vec::push(v223, v225) - v228 = hir.bitcast v182 : u32; - v995 = arith.constant 4 : u32; - v230 = arith.mod v228, v995 : u32; - hir.assertz v230 #[code = 250]; - v231 = hir.int_to_ptr v228 : ptr; - v232 = hir.load v231 : i32; - v994 = arith.constant 8 : i32; - v1018 = hir.load_local : i32 #[local = lv0]; - v227 = arith.add v1018, v994 : i32 #[overflow = wrapping]; - v233 = hir.bitcast v227 : u32; - v993 = arith.constant 4 : u32; - v235 = arith.mod v233, v993 : u32; - hir.assertz v235 #[code = 250]; - v236 = hir.int_to_ptr v233 : ptr; - hir.store v236, v232; - v992 = arith.constant 8 : u32; - v237 = hir.bitcast v100 : u32; - v239 = arith.add v237, v992 : u32 #[overflow = checked]; - v991 = arith.constant 4 : u32; - v241 = arith.mod v239, v991 : u32; - hir.assertz v241 #[code = 250]; - v242 = hir.int_to_ptr v239 : ptr; - v243 = hir.load v242 : i64; - v244 = hir.bitcast v1018 : u32; - v990 = arith.constant 4 : u32; - v246 = arith.mod v244, v990 : u32; - hir.assertz v246 #[code = 250]; - v247 = hir.int_to_ptr v244 : ptr; - hir.store v247, v243; - v989 = arith.constant 32 : i32; - v249 = arith.add v100, v989 : i32 #[overflow = wrapping]; - v250 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v251 = hir.bitcast v250 : ptr; - hir.store v251, v249; - builtin.ret ; - ^block15: - v988 = arith.constant 28 : u32; - v171 = hir.bitcast v100 : u32; - v173 = arith.add v171, v988 : u32 #[overflow = checked]; - v987 = arith.constant 4 : u32; - v175 = arith.mod v173, v987 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i32; - v178 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::handle_error(v157, v177, v178) - ub.unreachable ; - }; - - private builtin.function @__rustc::__rust_alloc(v252: i32, v253: i32) -> i32 { - ^block16(v252: i32, v253: i32): - v255 = arith.constant 1048604 : i32; - v256 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::alloc(v255, v253, v252) : i32 - builtin.ret v256; - }; - - private builtin.function @__rustc::__rust_realloc(v257: i32, v258: i32, v259: i32, v260: i32) -> i32 { - ^block18(v257: i32, v258: i32, v259: i32, v260: i32): - v262 = arith.constant 1048604 : i32; - v263 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::alloc(v262, v259, v260) : i32 - v1027 = arith.constant 0 : i32; - v264 = arith.constant 0 : i32; - v265 = arith.eq v263, v264 : i1; - v266 = arith.zext v265 : u32; - v267 = hir.bitcast v266 : i32; - v269 = arith.neq v267, v1027 : i1; - scf.if v269{ - ^block20: - scf.yield ; - } else { - ^block21: - v1026 = arith.constant 0 : i32; - v271 = hir.bitcast v258 : u32; - v270 = hir.bitcast v260 : u32; - v272 = arith.lt v270, v271 : i1; - v273 = arith.zext v272 : u32; - v274 = hir.bitcast v273 : i32; - v276 = arith.neq v274, v1026 : i1; - v277 = cf.select v276, v260, v258 : i32; - v1024 = arith.constant 0 : i32; - v1025 = arith.constant 0 : i32; - v279 = arith.eq v277, v1025 : i1; - v280 = arith.zext v279 : u32; - v281 = hir.bitcast v280 : i32; - v283 = arith.neq v281, v1024 : i1; - scf.if v283{ - ^block110: - scf.yield ; - } else { - ^block22: - v284 = hir.bitcast v277 : u32; - v285 = hir.bitcast v263 : u32; - v286 = hir.int_to_ptr v285 : ptr; - v287 = hir.bitcast v257 : u32; - v288 = hir.int_to_ptr v287 : ptr; - hir.mem_cpy v288, v286, v284; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v263; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v290: i32, v291: i32) -> i32 { - ^block23(v290: i32, v291: i32): - v293 = arith.constant 1048604 : i32; - v294 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::alloc(v293, v291, v290) : i32 - v1036 = arith.constant 0 : i32; - v295 = arith.constant 0 : i32; - v296 = arith.eq v294, v295 : i1; - v297 = arith.zext v296 : u32; - v298 = hir.bitcast v297 : i32; - v300 = arith.neq v298, v1036 : i1; - scf.if v300{ - ^block25: - scf.yield ; - } else { - ^block26: - v1034 = arith.constant 0 : i32; - v1035 = arith.constant 0 : i32; - v302 = arith.eq v290, v1035 : i1; - v303 = arith.zext v302 : u32; - v304 = hir.bitcast v303 : i32; - v306 = arith.neq v304, v1034 : i1; - scf.if v306{ - ^block113: - scf.yield ; - } else { - ^block27: - v1028 = arith.constant 0 : u8; - v309 = hir.bitcast v290 : u32; - v310 = hir.bitcast v294 : u32; - v311 = hir.int_to_ptr v310 : ptr; - hir.mem_set v311, v309, v1028; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v294; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block28: - builtin.ret ; - }; - - private builtin.function @::alloc(v313: i32, v314: i32, v315: i32) -> i32 { - ^block30(v313: i32, v314: i32, v315: i32): - v318 = arith.constant 16 : i32; - v317 = arith.constant 0 : i32; - v1038 = arith.constant 16 : u32; - v320 = hir.bitcast v314 : u32; - v322 = arith.gt v320, v1038 : i1; - v323 = arith.zext v322 : u32; - v324 = hir.bitcast v323 : i32; - v326 = arith.neq v324, v317 : i1; - v327 = cf.select v326, v314, v318 : i32; - v1078 = arith.constant 0 : i32; - v328 = arith.constant -1 : i32; - v329 = arith.add v327, v328 : i32 #[overflow = wrapping]; - v330 = arith.band v327, v329 : i32; - v332 = arith.neq v330, v1078 : i1; - v1047, v1048 = scf.if v332 : i32, u32 { - ^block118: - v1039 = arith.constant 0 : u32; - v1043 = ub.poison i32 : i32; - scf.yield v1043, v1039; - } else { - ^block33: - v334 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/core::ptr::alignment::Alignment::max(v314, v327) : i32 - v1077 = arith.constant 0 : i32; - v333 = arith.constant -2147483648 : i32; - v335 = arith.sub v333, v334 : i32 #[overflow = wrapping]; - v337 = hir.bitcast v335 : u32; - v336 = hir.bitcast v315 : u32; - v338 = arith.gt v336, v337 : i1; - v339 = arith.zext v338 : u32; - v340 = hir.bitcast v339 : i32; - v342 = arith.neq v340, v1077 : i1; - v1062 = scf.if v342 : i32 { - ^block117: - v1076 = ub.poison i32 : i32; - scf.yield v1076; - } else { - ^block34: - v1074 = arith.constant 0 : i32; - v348 = arith.sub v1074, v334 : i32 #[overflow = wrapping]; - v1075 = arith.constant -1 : i32; - v344 = arith.add v315, v334 : i32 #[overflow = wrapping]; - v346 = arith.add v344, v1075 : i32 #[overflow = wrapping]; - v349 = arith.band v346, v348 : i32; - v350 = hir.bitcast v313 : u32; - v351 = arith.constant 4 : u32; - v352 = arith.mod v350, v351 : u32; - hir.assertz v352 #[code = 250]; - v353 = hir.int_to_ptr v350 : ptr; - v354 = hir.load v353 : i32; - v1073 = arith.constant 0 : i32; - v356 = arith.neq v354, v1073 : i1; - scf.if v356{ - ^block116: - scf.yield ; - } else { - ^block36: - v357 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/intrinsics::mem::heap_base() : i32 - v358 = hir.mem_size : u32; - v364 = hir.bitcast v313 : u32; - v1072 = arith.constant 4 : u32; - v366 = arith.mod v364, v1072 : u32; - hir.assertz v366 #[code = 250]; - v1071 = arith.constant 16 : u32; - v359 = hir.bitcast v358 : i32; - v362 = arith.shl v359, v1071 : i32; - v363 = arith.add v357, v362 : i32 #[overflow = wrapping]; - v367 = hir.int_to_ptr v364 : ptr; - hir.store v367, v363; - scf.yield ; - }; - v370 = hir.bitcast v313 : u32; - v1070 = arith.constant 4 : u32; - v372 = arith.mod v370, v1070 : u32; - hir.assertz v372 #[code = 250]; - v373 = hir.int_to_ptr v370 : ptr; - v374 = hir.load v373 : i32; - v1068 = arith.constant 0 : i32; - v1069 = arith.constant -1 : i32; - v376 = arith.bxor v374, v1069 : i32; - v378 = hir.bitcast v376 : u32; - v377 = hir.bitcast v349 : u32; - v379 = arith.gt v377, v378 : i1; - v380 = arith.zext v379 : u32; - v381 = hir.bitcast v380 : i32; - v383 = arith.neq v381, v1068 : i1; - v1061 = scf.if v383 : i32 { - ^block37: - v1067 = arith.constant 0 : i32; - scf.yield v1067; - } else { - ^block38: - v385 = hir.bitcast v313 : u32; - v1066 = arith.constant 4 : u32; - v387 = arith.mod v385, v1066 : u32; - hir.assertz v387 #[code = 250]; - v384 = arith.add v374, v349 : i32 #[overflow = wrapping]; - v388 = hir.int_to_ptr v385 : ptr; - hir.store v388, v384; - v390 = arith.add v374, v334 : i32 #[overflow = wrapping]; - scf.yield v390; - }; - scf.yield v1061; - }; - v1044 = arith.constant 1 : u32; - v1065 = arith.constant 0 : u32; - v1063 = cf.select v342, v1065, v1044 : u32; - scf.yield v1062, v1063; - }; - v1064 = arith.constant 0 : u32; - v1060 = arith.eq v1048, v1064 : i1; - cf.cond_br v1060 ^block32, ^block120(v1047); - ^block32: - ub.unreachable ; - ^block120(v1040: i32): - builtin.ret v1040; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block39: - v393 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v393; - }; - - private builtin.function @>::from(v395: i32) -> felt { - ^block43(v395: i32): - v397 = hir.bitcast v395 : felt; - builtin.ret v397; - }; - - private builtin.function @intrinsics::felt::from_u64_unchecked(v398: i64) -> felt { - ^block45(v398: i64): - v399 = hir.cast v398 : felt; - builtin.ret v399; - }; - - private builtin.function @intrinsics::felt::from_u32(v401: i32) -> felt { - ^block47(v401: i32): - v402 = hir.bitcast v401 : felt; - builtin.ret v402; - }; - - private builtin.function @intrinsics::felt::as_u64(v404: felt) -> i64 { - ^block49(v404: felt): - v405 = hir.cast v404 : i64; - builtin.ret v405; - }; - - private builtin.function @intrinsics::felt::assert_eq(v407: felt, v408: felt) { - ^block51(v407: felt, v408: felt): - hir.assert_eq v407, v408; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v409: i32, v410: i32, v411: i32, v412: i32, v413: i32, v414: i32) { - ^block53(v409: i32, v410: i32, v411: i32, v412: i32, v413: i32, v414: i32): - v417 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v418 = hir.bitcast v417 : ptr; - v419 = hir.load v418 : i32; - v420 = arith.constant 32 : i32; - v421 = arith.sub v419, v420 : i32 #[overflow = wrapping]; - v422 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v423 = hir.bitcast v422 : ptr; - hir.store v423, v421; - v1155 = arith.constant 0 : i32; - v415 = arith.constant 0 : i32; - v426 = arith.eq v414, v415 : i1; - v427 = arith.zext v426 : u32; - v428 = hir.bitcast v427 : i32; - v430 = arith.neq v428, v1155 : i1; - v1126, v1127 = scf.if v430 : i32, i32 { - ^block56: - v1154 = arith.constant 0 : i32; - scf.yield v1154, v1154; - } else { - ^block57: - v431 = arith.add v411, v412 : i32 #[overflow = wrapping]; - v1153 = arith.constant 0 : i32; - v433 = hir.bitcast v411 : u32; - v432 = hir.bitcast v431 : u32; - v434 = arith.lt v432, v433 : i1; - v435 = arith.zext v434 : u32; - v436 = hir.bitcast v435 : i32; - v438 = arith.neq v436, v1153 : i1; - v1124, v1125 = scf.if v438 : i32, i32 { - ^block126: - v1152 = arith.constant 0 : i32; - scf.yield v1152, v1152; - } else { - ^block58: - v449 = hir.bitcast v410 : u32; - v563 = arith.constant 4 : u32; - v451 = arith.mod v449, v563 : u32; - hir.assertz v451 #[code = 250]; - v452 = hir.int_to_ptr v449 : ptr; - v453 = hir.load v452 : i32; - v1080 = arith.constant 1 : u32; - v456 = arith.shl v453, v1080 : i32; - v1151 = arith.constant 0 : i32; - v458 = hir.bitcast v456 : u32; - v457 = hir.bitcast v431 : u32; - v459 = arith.gt v457, v458 : i1; - v460 = arith.zext v459 : u32; - v461 = hir.bitcast v460 : i32; - v463 = arith.neq v461, v1151 : i1; - v464 = cf.select v463, v431, v456 : i32; - v1148 = arith.constant 1 : i32; - v466 = arith.constant 4 : i32; - v1149 = arith.constant 0 : i32; - v1079 = arith.constant 1025 : u32; - v469 = hir.bitcast v414 : u32; - v471 = arith.lt v469, v1079 : i1; - v472 = arith.zext v471 : u32; - v473 = hir.bitcast v472 : i32; - v475 = arith.neq v473, v1149 : i1; - v476 = cf.select v475, v466, v1148 : i32; - v465 = arith.constant 8 : i32; - v1150 = arith.constant 0 : i32; - v454 = arith.constant 1 : i32; - v478 = arith.eq v414, v454 : i1; - v479 = arith.zext v478 : u32; - v480 = hir.bitcast v479 : i32; - v482 = arith.neq v480, v1150 : i1; - v483 = cf.select v482, v465, v476 : i32; - v1147 = arith.constant 0 : i32; - v485 = hir.bitcast v483 : u32; - v484 = hir.bitcast v464 : u32; - v486 = arith.gt v484, v485 : i1; - v487 = arith.zext v486 : u32; - v488 = hir.bitcast v487 : i32; - v490 = arith.neq v488, v1147 : i1; - v491 = cf.select v490, v464, v483 : i32; - v492 = hir.bitcast v491 : u32; - v493 = arith.zext v492 : u64; - v494 = hir.bitcast v493 : i64; - v1146 = arith.constant 0 : i32; - v444 = arith.sub v1146, v413 : i32 #[overflow = wrapping]; - v441 = arith.constant -1 : i32; - v440 = arith.add v413, v414 : i32 #[overflow = wrapping]; - v442 = arith.add v440, v441 : i32 #[overflow = wrapping]; - v445 = arith.band v442, v444 : i32; - v446 = hir.bitcast v445 : u32; - v447 = arith.zext v446 : u64; - v448 = hir.bitcast v447 : i64; - v495 = arith.mul v448, v494 : i64 #[overflow = wrapping]; - v1145 = arith.constant 0 : i32; - v496 = arith.constant 32 : i64; - v498 = hir.cast v496 : u32; - v497 = hir.bitcast v495 : u64; - v499 = arith.shr v497, v498 : u64; - v500 = hir.bitcast v499 : i64; - v501 = arith.trunc v500 : i32; - v503 = arith.neq v501, v1145 : i1; - v1122, v1123 = scf.if v503 : i32, i32 { - ^block125: - v1144 = arith.constant 0 : i32; - scf.yield v464, v1144; - } else { - ^block59: - v504 = arith.trunc v495 : i32; - v1143 = arith.constant 0 : i32; - v505 = arith.constant -2147483648 : i32; - v506 = arith.sub v505, v413 : i32 #[overflow = wrapping]; - v508 = hir.bitcast v506 : u32; - v507 = hir.bitcast v504 : u32; - v509 = arith.gt v507, v508 : i1; - v510 = arith.zext v509 : u32; - v511 = hir.bitcast v510 : i32; - v513 = arith.neq v511, v1143 : i1; - v1120, v1121 = scf.if v513 : i32, i32 { - ^block124: - v1142 = arith.constant 0 : i32; - scf.yield v464, v1142; - } else { - ^block60: - v514 = arith.constant 20 : i32; - v515 = arith.add v421, v514 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::RawVecInner::current_memory(v515, v410, v413, v414) - v1140 = arith.constant 20 : i32; - v519 = arith.add v421, v1140 : i32 #[overflow = wrapping]; - v1141 = arith.constant 8 : i32; - v517 = arith.add v421, v1141 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::raw_vec::finish_grow(v517, v413, v504, v519, v409) - v521 = arith.constant 12 : u32; - v520 = hir.bitcast v421 : u32; - v522 = arith.add v520, v521 : u32 #[overflow = checked]; - v1139 = arith.constant 4 : u32; - v524 = arith.mod v522, v1139 : u32; - hir.assertz v524 #[code = 250]; - v525 = hir.int_to_ptr v522 : ptr; - v526 = hir.load v525 : i32; - v528 = arith.constant 8 : u32; - v527 = hir.bitcast v421 : u32; - v529 = arith.add v527, v528 : u32 #[overflow = checked]; - v1138 = arith.constant 4 : u32; - v531 = arith.mod v529, v1138 : u32; - hir.assertz v531 #[code = 250]; - v532 = hir.int_to_ptr v529 : ptr; - v533 = hir.load v532 : i32; - v1136 = arith.constant 0 : i32; - v1137 = arith.constant 0 : i32; - v535 = arith.eq v533, v1137 : i1; - v536 = arith.zext v535 : u32; - v537 = hir.bitcast v536 : i32; - v539 = arith.neq v537, v1136 : i1; - v1118 = scf.if v539 : i32 { - ^block61: - v547 = hir.bitcast v410 : u32; - v1135 = arith.constant 4 : u32; - v549 = arith.mod v547, v1135 : u32; - hir.assertz v549 #[code = 250]; - v550 = hir.int_to_ptr v547 : ptr; - hir.store v550, v491; - v1134 = arith.constant 4 : u32; - v551 = hir.bitcast v410 : u32; - v553 = arith.add v551, v1134 : u32 #[overflow = checked]; - v1133 = arith.constant 4 : u32; - v555 = arith.mod v553, v1133 : u32; - hir.assertz v555 #[code = 250]; - v556 = hir.int_to_ptr v553 : ptr; - hir.store v556, v526; - scf.yield v464; - } else { - ^block62: - v541 = arith.constant 16 : u32; - v540 = hir.bitcast v421 : u32; - v542 = arith.add v540, v541 : u32 #[overflow = checked]; - v1132 = arith.constant 4 : u32; - v544 = arith.mod v542, v1132 : u32; - hir.assertz v544 #[code = 250]; - v545 = hir.int_to_ptr v542 : ptr; - v546 = hir.load v545 : i32; - scf.yield v546; - }; - v557 = arith.constant -2147483647 : i32; - v1119 = cf.select v539, v557, v526 : i32; - scf.yield v1118, v1119; - }; - scf.yield v1120, v1121; - }; - scf.yield v1122, v1123; - }; - scf.yield v1124, v1125; - }; - v1131 = arith.constant 4 : u32; - v562 = hir.bitcast v409 : u32; - v564 = arith.add v562, v1131 : u32 #[overflow = checked]; - v1130 = arith.constant 4 : u32; - v566 = arith.mod v564, v1130 : u32; - hir.assertz v566 #[code = 250]; - v567 = hir.int_to_ptr v564 : ptr; - hir.store v567, v1126; - v570 = hir.bitcast v409 : u32; - v1129 = arith.constant 4 : u32; - v572 = arith.mod v570, v1129 : u32; - hir.assertz v572 #[code = 250]; - v573 = hir.int_to_ptr v570 : ptr; - hir.store v573, v1127; - v1128 = arith.constant 32 : i32; - v577 = arith.add v421, v1128 : i32 #[overflow = wrapping]; - v578 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v579 = hir.bitcast v578 : ptr; - hir.store v579, v577; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v580: i32, v581: i32, v582: i32, v583: i32, v584: i32) { - ^block63(v580: i32, v581: i32, v582: i32, v583: i32, v584: i32): - v587 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v588 = hir.bitcast v587 : ptr; - v589 = hir.load v588 : i32; - v590 = arith.constant 16 : i32; - v591 = arith.sub v589, v590 : i32 #[overflow = wrapping]; - v592 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v593 = hir.bitcast v592 : ptr; - hir.store v593, v591; - v603 = hir.bitcast v581 : u32; - v604 = arith.zext v603 : u64; - v605 = hir.bitcast v604 : i64; - v585 = arith.constant 0 : i32; - v598 = arith.sub v585, v583 : i32 #[overflow = wrapping]; - v595 = arith.constant -1 : i32; - v594 = arith.add v583, v584 : i32 #[overflow = wrapping]; - v596 = arith.add v594, v595 : i32 #[overflow = wrapping]; - v599 = arith.band v596, v598 : i32; - v600 = hir.bitcast v599 : u32; - v601 = arith.zext v600 : u64; - v602 = hir.bitcast v601 : i64; - v606 = arith.mul v602, v605 : i64 #[overflow = wrapping]; - v1259 = arith.constant 0 : i32; - v607 = arith.constant 32 : i64; - v609 = hir.cast v607 : u32; - v608 = hir.bitcast v606 : u64; - v610 = arith.shr v608, v609 : u64; - v611 = hir.bitcast v610 : i64; - v612 = arith.trunc v611 : i32; - v614 = arith.neq v612, v1259 : i1; - v1171, v1172, v1173, v1174, v1175, v1176 = scf.if v614 : i32, i32, i32, i32, i32, u32 { - ^block132: - v1156 = arith.constant 0 : u32; - v1163 = ub.poison i32 : i32; - scf.yield v580, v591, v1163, v1163, v1163, v1156; - } else { - ^block68: - v615 = arith.trunc v606 : i32; - v1258 = arith.constant 0 : i32; - v616 = arith.constant -2147483648 : i32; - v617 = arith.sub v616, v583 : i32 #[overflow = wrapping]; - v619 = hir.bitcast v617 : u32; - v618 = hir.bitcast v615 : u32; - v620 = arith.lte v618, v619 : i1; - v621 = arith.zext v620 : u32; - v622 = hir.bitcast v621 : i32; - v624 = arith.neq v622, v1258 : i1; - v1219 = scf.if v624 : i32 { - ^block66: - v1257 = arith.constant 0 : i32; - v635 = arith.neq v615, v1257 : i1; - v1218 = scf.if v635 : i32 { - ^block70: - v1256 = arith.constant 0 : i32; - v651 = arith.neq v582, v1256 : i1; - v1217 = scf.if v651 : i32 { - ^block73: - v633 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::alloc::Global::alloc_impl(v591, v583, v615, v633) - v662 = hir.bitcast v591 : u32; - v707 = arith.constant 4 : u32; - v664 = arith.mod v662, v707 : u32; - hir.assertz v664 #[code = 250]; - v665 = hir.int_to_ptr v662 : ptr; - v666 = hir.load v665 : i32; - scf.yield v666; - } else { - ^block74: - v652 = arith.constant 8 : i32; - v653 = arith.add v591, v652 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::allocate(v653, v583, v615) - v637 = arith.constant 8 : u32; - v654 = hir.bitcast v591 : u32; - v656 = arith.add v654, v637 : u32 #[overflow = checked]; - v1255 = arith.constant 4 : u32; - v658 = arith.mod v656, v1255 : u32; - hir.assertz v658 #[code = 250]; - v659 = hir.int_to_ptr v656 : ptr; - v660 = hir.load v659 : i32; - scf.yield v660; - }; - v1253 = arith.constant 0 : i32; - v1254 = arith.constant 0 : i32; - v669 = arith.eq v1217, v1254 : i1; - v670 = arith.zext v669 : u32; - v671 = hir.bitcast v670 : i32; - v673 = arith.neq v671, v1253 : i1; - scf.if v673{ - ^block75: - v1252 = arith.constant 8 : u32; - v690 = hir.bitcast v580 : u32; - v692 = arith.add v690, v1252 : u32 #[overflow = checked]; - v1251 = arith.constant 4 : u32; - v694 = arith.mod v692, v1251 : u32; - hir.assertz v694 #[code = 250]; - v695 = hir.int_to_ptr v692 : ptr; - hir.store v695, v615; - v1250 = arith.constant 4 : u32; - v697 = hir.bitcast v580 : u32; - v699 = arith.add v697, v1250 : u32 #[overflow = checked]; - v1249 = arith.constant 4 : u32; - v701 = arith.mod v699, v1249 : u32; - hir.assertz v701 #[code = 250]; - v702 = hir.int_to_ptr v699 : ptr; - hir.store v702, v583; - scf.yield ; - } else { - ^block76: - v1248 = arith.constant 8 : u32; - v675 = hir.bitcast v580 : u32; - v677 = arith.add v675, v1248 : u32 #[overflow = checked]; - v1247 = arith.constant 4 : u32; - v679 = arith.mod v677, v1247 : u32; - hir.assertz v679 #[code = 250]; - v680 = hir.int_to_ptr v677 : ptr; - hir.store v680, v1217; - v1246 = arith.constant 4 : u32; - v682 = hir.bitcast v580 : u32; - v684 = arith.add v682, v1246 : u32 #[overflow = checked]; - v1245 = arith.constant 4 : u32; - v686 = arith.mod v684, v1245 : u32; - hir.assertz v686 #[code = 250]; - v687 = hir.int_to_ptr v684 : ptr; - hir.store v687, v581; - scf.yield ; - }; - v1243 = arith.constant 0 : i32; - v1244 = arith.constant 1 : i32; - v1216 = cf.select v673, v1244, v1243 : i32; - scf.yield v1216; - } else { - ^block71: - v1242 = arith.constant 8 : u32; - v636 = hir.bitcast v580 : u32; - v638 = arith.add v636, v1242 : u32 #[overflow = checked]; - v1241 = arith.constant 4 : u32; - v640 = arith.mod v638, v1241 : u32; - hir.assertz v640 #[code = 250]; - v641 = hir.int_to_ptr v638 : ptr; - hir.store v641, v583; - v1240 = arith.constant 4 : u32; - v644 = hir.bitcast v580 : u32; - v646 = arith.add v644, v1240 : u32 #[overflow = checked]; - v1239 = arith.constant 4 : u32; - v648 = arith.mod v646, v1239 : u32; - hir.assertz v648 #[code = 250]; - v1238 = arith.constant 0 : i32; - v649 = hir.int_to_ptr v646 : ptr; - hir.store v649, v1238; - v1237 = arith.constant 0 : i32; - scf.yield v1237; - }; - scf.yield v1218; - } else { - ^block69: - v1236 = ub.poison i32 : i32; - scf.yield v1236; - }; - v1231 = arith.constant 0 : u32; - v1164 = arith.constant 1 : u32; - v1224 = cf.select v624, v1164, v1231 : u32; - v1232 = ub.poison i32 : i32; - v1223 = cf.select v624, v591, v1232 : i32; - v1233 = ub.poison i32 : i32; - v1222 = cf.select v624, v580, v1233 : i32; - v1234 = ub.poison i32 : i32; - v1221 = cf.select v624, v1234, v591 : i32; - v1235 = ub.poison i32 : i32; - v1220 = cf.select v624, v1235, v580 : i32; - scf.yield v1220, v1221, v1222, v1219, v1223, v1224; - }; - v1177, v1178, v1179 = scf.index_switch v1176 : i32, i32, i32 - case 0 { - ^block67: - v1230 = arith.constant 4 : u32; - v627 = hir.bitcast v1171 : u32; - v629 = arith.add v627, v1230 : u32 #[overflow = checked]; - v1229 = arith.constant 4 : u32; - v631 = arith.mod v629, v1229 : u32; - hir.assertz v631 #[code = 250]; - v1228 = arith.constant 0 : i32; - v632 = hir.int_to_ptr v629 : ptr; - hir.store v632, v1228; - v1227 = arith.constant 1 : i32; - scf.yield v1171, v1227, v1172; - } - default { - ^block136: - scf.yield v1173, v1174, v1175; - }; - v706 = hir.bitcast v1177 : u32; - v1226 = arith.constant 4 : u32; - v708 = arith.mod v706, v1226 : u32; - hir.assertz v708 #[code = 250]; - v709 = hir.int_to_ptr v706 : ptr; - hir.store v709, v1178; - v1225 = arith.constant 16 : i32; - v714 = arith.add v1179, v1225 : i32 #[overflow = wrapping]; - v715 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v716 = hir.bitcast v715 : ptr; - hir.store v716, v714; - builtin.ret ; - }; - - private builtin.function @::allocate(v717: i32, v718: i32, v719: i32) { - ^block77(v717: i32, v718: i32, v719: i32): - v721 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v722 = hir.bitcast v721 : ptr; - v723 = hir.load v722 : i32; - v724 = arith.constant 16 : i32; - v725 = arith.sub v723, v724 : i32 #[overflow = wrapping]; - v726 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v727 = hir.bitcast v726 : ptr; - hir.store v727, v725; - v720 = arith.constant 0 : i32; - v728 = arith.constant 8 : i32; - v729 = arith.add v725, v728 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::alloc::Global::alloc_impl(v729, v718, v719, v720) - v732 = arith.constant 12 : u32; - v731 = hir.bitcast v725 : u32; - v733 = arith.add v731, v732 : u32 #[overflow = checked]; - v734 = arith.constant 4 : u32; - v735 = arith.mod v733, v734 : u32; - hir.assertz v735 #[code = 250]; - v736 = hir.int_to_ptr v733 : ptr; - v737 = hir.load v736 : i32; - v739 = arith.constant 8 : u32; - v738 = hir.bitcast v725 : u32; - v740 = arith.add v738, v739 : u32 #[overflow = checked]; - v1264 = arith.constant 4 : u32; - v742 = arith.mod v740, v1264 : u32; - hir.assertz v742 #[code = 250]; - v743 = hir.int_to_ptr v740 : ptr; - v744 = hir.load v743 : i32; - v745 = hir.bitcast v717 : u32; - v1263 = arith.constant 4 : u32; - v747 = arith.mod v745, v1263 : u32; - hir.assertz v747 #[code = 250]; - v748 = hir.int_to_ptr v745 : ptr; - hir.store v748, v744; - v1262 = arith.constant 4 : u32; - v749 = hir.bitcast v717 : u32; - v751 = arith.add v749, v1262 : u32 #[overflow = checked]; - v1261 = arith.constant 4 : u32; - v753 = arith.mod v751, v1261 : u32; - hir.assertz v753 #[code = 250]; - v754 = hir.int_to_ptr v751 : ptr; - hir.store v754, v737; - v1260 = arith.constant 16 : i32; - v756 = arith.add v725, v1260 : i32 #[overflow = wrapping]; - v757 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v758 = hir.bitcast v757 : ptr; - hir.store v758, v756; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v759: i32, v760: i32, v761: i32, v762: i32) { - ^block79(v759: i32, v760: i32, v761: i32, v762: i32): - v1280 = arith.constant 0 : i32; - v763 = arith.constant 0 : i32; - v764 = arith.eq v761, v763 : i1; - v765 = arith.zext v764 : u32; - v766 = hir.bitcast v765 : i32; - v768 = arith.neq v766, v1280 : i1; - v1276 = scf.if v768 : i32 { - ^block139: - scf.yield v760; - } else { - ^block82: - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1279 = arith.constant 0 : i32; - v770 = arith.neq v762, v1279 : i1; - v1275 = scf.if v770 : i32 { - ^block83: - v772 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_alloc_zeroed(v761, v760) : i32 - scf.yield v772; - } else { - ^block84: - v771 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_alloc(v761, v760) : i32 - scf.yield v771; - }; - scf.yield v1275; - }; - v776 = arith.constant 4 : u32; - v775 = hir.bitcast v759 : u32; - v777 = arith.add v775, v776 : u32 #[overflow = checked]; - v1278 = arith.constant 4 : u32; - v779 = arith.mod v777, v1278 : u32; - hir.assertz v779 #[code = 250]; - v780 = hir.int_to_ptr v777 : ptr; - hir.store v780, v761; - v782 = hir.bitcast v759 : u32; - v1277 = arith.constant 4 : u32; - v784 = arith.mod v782, v1277 : u32; - hir.assertz v784 #[code = 250]; - v785 = hir.int_to_ptr v782 : ptr; - hir.store v785, v1276; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v786: i32, v787: i32, v788: i32, v789: i32) { - ^block85(v786: i32, v787: i32, v788: i32, v789: i32): - v1306 = arith.constant 0 : i32; - v790 = arith.constant 0 : i32; - v794 = arith.eq v789, v790 : i1; - v795 = arith.zext v794 : u32; - v796 = hir.bitcast v795 : i32; - v798 = arith.neq v796, v1306 : i1; - v1293, v1294 = scf.if v798 : i32, i32 { - ^block143: - v1305 = arith.constant 0 : i32; - v792 = arith.constant 4 : i32; - scf.yield v792, v1305; - } else { - ^block88: - v799 = hir.bitcast v787 : u32; - v834 = arith.constant 4 : u32; - v801 = arith.mod v799, v834 : u32; - hir.assertz v801 #[code = 250]; - v802 = hir.int_to_ptr v799 : ptr; - v803 = hir.load v802 : i32; - v1303 = arith.constant 0 : i32; - v1304 = arith.constant 0 : i32; - v805 = arith.eq v803, v1304 : i1; - v806 = arith.zext v805 : u32; - v807 = hir.bitcast v806 : i32; - v809 = arith.neq v807, v1303 : i1; - v1291 = scf.if v809 : i32 { - ^block142: - v1302 = arith.constant 0 : i32; - scf.yield v1302; - } else { - ^block89: - v1301 = arith.constant 4 : u32; - v810 = hir.bitcast v786 : u32; - v812 = arith.add v810, v1301 : u32 #[overflow = checked]; - v1300 = arith.constant 4 : u32; - v814 = arith.mod v812, v1300 : u32; - hir.assertz v814 #[code = 250]; - v815 = hir.int_to_ptr v812 : ptr; - hir.store v815, v788; - v1299 = arith.constant 4 : u32; - v816 = hir.bitcast v787 : u32; - v818 = arith.add v816, v1299 : u32 #[overflow = checked]; - v1298 = arith.constant 4 : u32; - v820 = arith.mod v818, v1298 : u32; - hir.assertz v820 #[code = 250]; - v821 = hir.int_to_ptr v818 : ptr; - v822 = hir.load v821 : i32; - v823 = hir.bitcast v786 : u32; - v1297 = arith.constant 4 : u32; - v825 = arith.mod v823, v1297 : u32; - hir.assertz v825 #[code = 250]; - v826 = hir.int_to_ptr v823 : ptr; - hir.store v826, v822; - v827 = arith.mul v803, v789 : i32 #[overflow = wrapping]; - scf.yield v827; - }; - v828 = arith.constant 8 : i32; - v1296 = arith.constant 4 : i32; - v1292 = cf.select v809, v1296, v828 : i32; - scf.yield v1292, v1291; - }; - v831 = arith.add v786, v1293 : i32 #[overflow = wrapping]; - v833 = hir.bitcast v831 : u32; - v1295 = arith.constant 4 : u32; - v835 = arith.mod v833, v1295 : u32; - hir.assertz v835 #[code = 250]; - v836 = hir.int_to_ptr v833 : ptr; - hir.store v836, v1294; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::finish_grow(v837: i32, v838: i32, v839: i32, v840: i32, v841: i32) { - ^block90(v837: i32, v838: i32, v839: i32, v840: i32, v841: i32): - v843 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v844 = hir.bitcast v843 : ptr; - v845 = hir.load v844 : i32; - v846 = arith.constant 16 : i32; - v847 = arith.sub v845, v846 : i32 #[overflow = wrapping]; - v848 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v849 = hir.bitcast v848 : ptr; - hir.store v849, v847; - v1361 = arith.constant 0 : i32; - v842 = arith.constant 0 : i32; - v852 = arith.gte v839, v842 : i1; - v853 = arith.zext v852 : u32; - v854 = hir.bitcast v853 : i32; - v856 = arith.neq v854, v1361 : i1; - v1335, v1336 = scf.if v856 : i32, i32 { - ^block93: - v943 = arith.constant 4 : u32; - v859 = hir.bitcast v840 : u32; - v861 = arith.add v859, v943 : u32 #[overflow = checked]; - v1360 = arith.constant 4 : u32; - v863 = arith.mod v861, v1360 : u32; - hir.assertz v863 #[code = 250]; - v864 = hir.int_to_ptr v861 : ptr; - v865 = hir.load v864 : i32; - v1358 = arith.constant 0 : i32; - v1359 = arith.constant 0 : i32; - v867 = arith.eq v865, v1359 : i1; - v868 = arith.zext v867 : u32; - v869 = hir.bitcast v868 : i32; - v871 = arith.neq v869, v1358 : i1; - v1333, v1334 = scf.if v871 : i32, i32 { - ^block96: - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/::allocate(v847, v838, v839) - v1357 = arith.constant 4 : u32; - v904 = hir.bitcast v847 : u32; - v906 = arith.add v904, v1357 : u32 #[overflow = checked]; - v1356 = arith.constant 4 : u32; - v908 = arith.mod v906, v1356 : u32; - hir.assertz v908 #[code = 250]; - v909 = hir.int_to_ptr v906 : ptr; - v910 = hir.load v909 : i32; - v911 = hir.bitcast v847 : u32; - v1355 = arith.constant 4 : u32; - v913 = arith.mod v911, v1355 : u32; - hir.assertz v913 #[code = 250]; - v914 = hir.int_to_ptr v911 : ptr; - v915 = hir.load v914 : i32; - scf.yield v915, v910; - } else { - ^block97: - v873 = arith.constant 8 : u32; - v872 = hir.bitcast v840 : u32; - v874 = arith.add v872, v873 : u32 #[overflow = checked]; - v1354 = arith.constant 4 : u32; - v876 = arith.mod v874, v1354 : u32; - hir.assertz v876 #[code = 250]; - v877 = hir.int_to_ptr v874 : ptr; - v878 = hir.load v877 : i32; - v1353 = arith.constant 0 : i32; - v880 = arith.neq v878, v1353 : i1; - v1331, v1332 = scf.if v880 : i32, i32 { - ^block98: - v898 = hir.bitcast v840 : u32; - v1352 = arith.constant 4 : u32; - v900 = arith.mod v898, v1352 : u32; - hir.assertz v900 #[code = 250]; - v901 = hir.int_to_ptr v898 : ptr; - v902 = hir.load v901 : i32; - v903 = hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/__rustc::__rust_realloc(v902, v878, v838, v839) : i32 - scf.yield v903, v839; - } else { - ^block99: - v1351 = arith.constant 0 : i32; - v937 = arith.constant 8 : i32; - v882 = arith.add v847, v937 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_minimal_u64_bug/alloc::alloc::Global::alloc_impl(v882, v838, v839, v1351) - v885 = arith.constant 12 : u32; - v884 = hir.bitcast v847 : u32; - v886 = arith.add v884, v885 : u32 #[overflow = checked]; - v1350 = arith.constant 4 : u32; - v888 = arith.mod v886, v1350 : u32; - hir.assertz v888 #[code = 250]; - v889 = hir.int_to_ptr v886 : ptr; - v890 = hir.load v889 : i32; - v1349 = arith.constant 8 : u32; - v891 = hir.bitcast v847 : u32; - v893 = arith.add v891, v1349 : u32 #[overflow = checked]; - v1348 = arith.constant 4 : u32; - v895 = arith.mod v893, v1348 : u32; - hir.assertz v895 #[code = 250]; - v896 = hir.int_to_ptr v893 : ptr; - v897 = hir.load v896 : i32; - scf.yield v897, v890; - }; - scf.yield v1331, v1332; - }; - v1347 = arith.constant 4 : u32; - v922 = hir.bitcast v837 : u32; - v924 = arith.add v922, v1347 : u32 #[overflow = checked]; - v1346 = arith.constant 4 : u32; - v926 = arith.mod v924, v1346 : u32; - hir.assertz v926 #[code = 250]; - v1345 = arith.constant 0 : i32; - v920 = arith.neq v1333, v1345 : i1; - v921 = cf.select v920, v1333, v838 : i32; - v927 = hir.int_to_ptr v924 : ptr; - hir.store v927, v921; - v1343 = arith.constant 0 : i32; - v934 = arith.eq v1333, v1343 : i1; - v935 = arith.zext v934 : u32; - v936 = hir.bitcast v935 : i32; - v1344 = arith.constant 0 : i32; - v931 = arith.neq v1333, v1344 : i1; - v932 = cf.select v931, v1334, v839 : i32; - scf.yield v932, v936; - } else { - ^block94: - v857 = arith.constant 1 : i32; - v1342 = arith.constant 0 : i32; - scf.yield v1342, v857; - }; - v858 = arith.constant 4 : i32; - v1341 = arith.constant 8 : i32; - v1337 = cf.select v856, v1341, v858 : i32; - v940 = arith.add v837, v1337 : i32 #[overflow = wrapping]; - v942 = hir.bitcast v940 : u32; - v1340 = arith.constant 4 : u32; - v944 = arith.mod v942, v1340 : u32; - hir.assertz v944 #[code = 250]; - v945 = hir.int_to_ptr v942 : ptr; - hir.store v945, v1335; - v947 = hir.bitcast v837 : u32; - v1339 = arith.constant 4 : u32; - v949 = arith.mod v947, v1339 : u32; - hir.assertz v949 #[code = 250]; - v950 = hir.int_to_ptr v947 : ptr; - hir.store v950, v1336; - v1338 = arith.constant 16 : i32; - v954 = arith.add v847, v1338 : i32 #[overflow = wrapping]; - v955 = builtin.global_symbol @root_ns:root@1.0.0/onchain_minimal_u64_bug/__stack_pointer : ptr - v956 = hir.bitcast v955 : ptr; - hir.store v956, v954; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v957: i32, v958: i32, v959: i32) { - ^block100(v957: i32, v958: i32, v959: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v960: i32, v961: i32) -> i32 { - ^block102(v960: i32, v961: i32): - v968 = arith.constant 0 : i32; - v964 = hir.bitcast v961 : u32; - v963 = hir.bitcast v960 : u32; - v965 = arith.gt v963, v964 : i1; - v966 = arith.zext v965 : u32; - v967 = hir.bitcast v966 : i32; - v969 = arith.neq v967, v968 : i1; - v970 = cf.select v969, v960, v961 : i32; - builtin.ret v970; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; - }; -}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_minimal_u64_bug.masm b/felt-repr/tests/expected/onchain_minimal_u64_bug.masm deleted file mode 100644 index 79df20aea..000000000 --- a/felt-repr/tests/expected/onchain_minimal_u64_bug.masm +++ /dev/null @@ -1,2614 +0,0 @@ -# mod root_ns:root@1.0.0 - -proc init - push.1179648 - trace.240 - exec.::intrinsics::mem::heap_init - trace.252 - push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] - adv.push_mapval - push.262144 - push.2 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop - push.1048576 - u32assert - mem_store.278536 -end - -# mod root_ns:root@1.0.0::onchain_minimal_u64_bug - -@callconv("C") -proc alloc::vec::Vec::push(i32, felt) - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - swap.1 - dup.2 - neq - neq - if.true - nop - else - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVec::grow_one - trace.252 - nop - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.2 - swap.1 - u32shl - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVec::grow_one(i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - push.1 - push.8 - dup.4 - u32wrapping_add - dup.2 - movup.2 - swap.3 - swap.4 - movdn.2 - swap.5 - swap.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVecInner::grow_amortized - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.2147483649 - dup.2 - eq - neq - if.true - drop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -pub proc entrypoint.1(i32, i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.111111 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::from_u32 - trace.252 - nop - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::assert_eq - trace.252 - nop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.55 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::from_u32 - trace.252 - nop - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::assert_eq - trace.252 - nop - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 - trace.252 - nop - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 - trace.252 - nop - push.8 - dup.8 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 - trace.252 - nop - push.12 - movup.10 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 - trace.252 - nop - movup.8 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::as_u64 - trace.252 - nop - push.4 - push.0 - push.256 - push.20 - dup.14 - u32wrapping_add - movup.15 - locaddr.0 - push.0 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.3 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVecInner::try_allocate_in - trace.252 - nop - push.24 - dup.11 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.20 - dup.12 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.1 - movup.2 - neq - neq - if.true - push.8 - push.8 - dup.13 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.28 - dup.13 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.14 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.13 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.10 - movup.10 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::felt::from_u64_unchecked - trace.252 - nop - push.8 - dup.11 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push - trace.252 - nop - movup.8 - movup.8 - drop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from - trace.252 - nop - push.8 - dup.9 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push - trace.252 - nop - movup.6 - movup.6 - drop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from - trace.252 - nop - push.8 - dup.7 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push - trace.252 - nop - movup.4 - movup.4 - drop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from - trace.252 - nop - push.8 - dup.5 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push - trace.252 - nop - movdn.2 - drop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::>::from - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - locaddr.0 - push.0 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.0 - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movdn.10 - dropw - dropw - drop - drop - push.28 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 - dup.5 - swap.1 - u32lt - neq - swap.1 - swap.4 - swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - swap.1 - drop - else - push.0 - push.0 - dup.3 - eq - neq - if.true - swap.1 - drop - else - push.0 - movup.2 - dup.2 - push.0 - dup.2 - push.0 - gte - while.true - dup.1 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.4 - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.3 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop -end - -@callconv("C") -proc ::alloc( - i32, - i32, - i32 -) -> i32 - push.16 - push.0 - push.16 - dup.4 - swap.1 - u32gt - neq - dup.3 - swap.1 - cdrop - push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 - else - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::core::ptr::alignment::Alignment::max - trace.252 - nop - push.0 - push.2147483648 - dup.2 - u32wrapping_sub - dup.4 - swap.1 - u32gt - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - else - push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop - exec.::intrinsics::mem::memory_size - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.16 - movup.2 - swap.1 - u32shl - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.4294967295 - dup.2 - u32xor - dup.3 - swap.1 - u32gt - neq - if.true - drop - drop - movdn.2 - drop - drop - push.0 - else - movup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - u32wrapping_add - end - end - push.1 - push.0 - movup.3 - cdrop - swap.1 - end - push.0 - movup.2 - eq - if.true - drop - push.0 - assert - else - nop - end -end - -@callconv("C") -proc intrinsics::mem::heap_base( - -) -> i32 - trace.240 - nop - exec.::intrinsics::mem::heap_base - trace.252 - nop -end - -@callconv("C") -proc >::from( - i32 -) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::from_u64_unchecked([u32; 2]) -> felt - dup.1 - dup.1 - push.1 - push.4294967295 - trace.240 - nop - exec.::std::math::u64::lt - trace.252 - nop - assert - mul.4294967296 - add -end - -@callconv("C") -proc intrinsics::felt::from_u32(i32) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split -end - -@callconv("C") -proc intrinsics::felt::assert_eq(felt, felt) - assert_eq -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::grow_amortized( - i32, - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.8 - eq - neq - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - movup.4 - dup.4 - u32wrapping_add - push.0 - movup.5 - dup.2 - swap.1 - u32lt - neq - if.true - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1 - u32shl - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - movup.2 - swap.1 - cdrop - push.1 - push.4 - push.0 - push.1025 - dup.9 - swap.1 - u32lt - neq - cdrop - push.8 - push.0 - push.1 - dup.9 - eq - neq - cdrop - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - dup.2 - swap.1 - cdrop - dup.0 - push.0 - push.0 - dup.8 - u32wrapping_sub - push.4294967295 - dup.9 - dup.11 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - drop - push.0 - push.2147483648 - dup.8 - u32wrapping_sub - dup.2 - swap.1 - u32gt - neq - if.true - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - push.20 - dup.4 - u32wrapping_add - dup.6 - dup.8 - movup.3 - swap.10 - movdn.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.20 - dup.3 - u32wrapping_add - push.8 - dup.4 - u32wrapping_add - dup.5 - movup.2 - swap.3 - swap.9 - movdn.2 - swap.4 - swap.8 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::raw_vec::finish_grow - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.7 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.4 - else - movup.2 - swap.6 - movdn.2 - swap.1 - swap.5 - swap.1 - swap.4 - drop - drop - drop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - end - push.2147483649 - movdn.2 - movdn.3 - cdrop - swap.1 - end - end - end - end - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.2 - push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 - else - drop - push.0 - push.2147483648 - dup.7 - u32wrapping_sub - dup.2 - swap.1 - u32lte - neq - dup.0 - if.true - push.0 - dup.2 - neq - if.true - push.0 - movup.6 - neq - if.true - push.1 - dup.3 - dup.7 - dup.4 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::alloc::Global::alloc_impl - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.3 - u32wrapping_add - dup.6 - dup.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::allocate - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - movup.6 - movup.2 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movup.7 - movup.4 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.0 - push.1 - movup.2 - cdrop - else - movup.2 - swap.5 - movdn.2 - swap.4 - swap.1 - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 - end - else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 - end - push.0 - push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 - movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 - cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 - end - movup.5 - eq.0 - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.1 - swap.1 - else - drop - drop - end - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.8 - dup.2 - u32wrapping_add - movup.2 - swap.5 - movdn.2 - swap.1 - swap.3 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - movup.3 - drop - swap.1 - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.0 - movup.4 - neq - if.true - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_alloc - trace.252 - nop - end - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq - if.true - movdn.3 - drop - drop - drop - push.0 - push.4 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - else - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.3 - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - movup.2 - swap.1 - end - push.8 - push.4 - movup.3 - cdrop - end - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) - movup.4 - drop - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.5 - swap.1 - trace.240 - nop - exec.::intrinsics::i32::is_gte - trace.252 - nop - neq - dup.0 - if.true - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - if.true - movup.5 - drop - dup.4 - dup.4 - dup.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::::allocate - trace.252 - nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - dup.1 - neq - if.true - movup.6 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.5 - dup.7 - swap.3 - swap.1 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::__rustc::__rust_realloc - trace.252 - nop - dup.5 - swap.1 - else - movup.6 - swap.1 - drop - drop - push.0 - push.8 - dup.3 - u32wrapping_add - dup.5 - dup.7 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_minimal_u64_bug::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - end - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - dup.2 - neq - dup.2 - movup.2 - swap.8 - movdn.2 - swap.1 - cdrop - movup.6 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - dup.1 - eq - push.0 - movup.2 - neq - swap.1 - swap.6 - swap.2 - swap.1 - cdrop - movup.4 - swap.1 - else - movup.2 - swap.5 - movdn.2 - swap.1 - swap.4 - swap.1 - swap.3 - drop - drop - drop - push.1 - push.0 - end - push.4 - push.8 - movup.4 - cdrop - dup.4 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop - drop - drop - push.0 - assert -end - -@callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 - push.0 - dup.2 - dup.2 - swap.1 - u32gt - neq - cdrop -end - diff --git a/felt-repr/tests/expected/onchain_minimal_u64_bug.wat b/felt-repr/tests/expected/onchain_minimal_u64_bug.wat deleted file mode 100644 index ba1afb17f..000000000 --- a/felt-repr/tests/expected/onchain_minimal_u64_bug.wat +++ /dev/null @@ -1,797 +0,0 @@ -(module $onchain_minimal_u64_bug.wasm - (type (;0;) (func (param i32 f32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32 i32 i32) (result i32))) - (type (;5;) (func)) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func (result i32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param i64) (result f32))) - (type (;10;) (func (param f32) (result i64))) - (type (;11;) (func (param f32 f32))) - (type (;12;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;13;) (func (param i32 i32 i32 i32 i32))) - (type (;14;) (func (param i32 i32 i32))) - (type (;15;) (func (param i32 i32 i32 i32))) - (table (;0;) 1 1 funcref) - (memory (;0;) 17) - (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) - (export "memory" (memory 0)) - (export "entrypoint" (func $entrypoint)) - (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) - (local i32) - block ;; label = @1 - local.get 0 - i32.load offset=8 - local.tee 2 - local.get 0 - i32.load - i32.ne - br_if 0 (;@1;) - local.get 0 - call $alloc::raw_vec::RawVec::grow_one - end - local.get 0 - i32.load offset=4 - local.get 2 - i32.const 2 - i32.shl - i32.add - local.get 1 - f32.store - local.get 0 - local.get 2 - i32.const 1 - i32.add - i32.store offset=8 - ) - (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - i32.const 8 - i32.add - local.get 0 - local.get 0 - i32.load - i32.const 1 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::grow_amortized - block ;; label = @1 - local.get 1 - i32.load offset=8 - local.tee 0 - i32.const -2147483647 - i32.eq - br_if 0 (;@1;) - local.get 0 - local.get 1 - i32.load offset=12 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 i64 i64 i64 i64 i64 i32) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 2 - global.set $__stack_pointer - local.get 1 - f32.load - local.tee 3 - i32.const 111111 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - local.get 1 - f32.load offset=16 - local.tee 4 - i32.const 55 - call $intrinsics::felt::from_u32 - call $intrinsics::felt::assert_eq - local.get 3 - call $intrinsics::felt::as_u64 - local.set 5 - local.get 1 - f32.load offset=4 - call $intrinsics::felt::as_u64 - local.set 6 - local.get 1 - f32.load offset=8 - call $intrinsics::felt::as_u64 - local.set 7 - local.get 1 - f32.load offset=12 - call $intrinsics::felt::as_u64 - local.set 8 - local.get 4 - call $intrinsics::felt::as_u64 - local.set 9 - local.get 2 - i32.const 20 - i32.add - i32.const 256 - i32.const 0 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 2 - i32.load offset=24 - local.set 1 - block ;; label = @1 - local.get 2 - i32.load offset=20 - i32.const 1 - i32.ne - br_if 0 (;@1;) - local.get 1 - local.get 2 - i32.load offset=28 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 2 - i32.const 8 - i32.add - i32.const 8 - i32.add - local.tee 10 - i32.const 0 - i32.store - local.get 2 - local.get 2 - i32.load offset=28 - i32.store offset=12 - local.get 2 - local.get 1 - i32.store offset=8 - local.get 2 - i32.const 8 - i32.add - local.get 5 - call $intrinsics::felt::from_u64_unchecked - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 6 - i32.wrap_i64 - call $>::from - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 7 - i32.wrap_i64 - call $>::from - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 8 - i32.wrap_i64 - call $>::from - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 9 - i32.wrap_i64 - call $>::from - call $alloc::vec::Vec::push - local.get 0 - i32.const 8 - i32.add - local.get 10 - i32.load - i32.store - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store align=4 - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 2 - local.get 3 - call $::alloc - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - local.get 1 - local.get 3 - local.get 1 - i32.lt_u - select - local.tee 3 - i32.eqz - br_if 0 (;@1;) - local.get 2 - local.get 0 - local.get 3 - memory.copy - end - local.get 2 - ) - (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - local.tee 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.const 0 - local.get 0 - memory.fill - end - local.get 1 - ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) - return - ) - (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) - (local i32 i32) - block ;; label = @1 - local.get 1 - i32.const 16 - local.get 1 - i32.const 16 - i32.gt_u - select - local.tee 3 - local.get 3 - i32.const -1 - i32.add - i32.and - br_if 0 (;@1;) - local.get 2 - i32.const -2147483648 - local.get 1 - local.get 3 - call $core::ptr::alignment::Alignment::max - local.tee 1 - i32.sub - i32.gt_u - br_if 0 (;@1;) - i32.const 0 - local.set 3 - local.get 2 - local.get 1 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 1 - i32.sub - i32.and - local.set 2 - block ;; label = @2 - local.get 0 - i32.load - br_if 0 (;@2;) - local.get 0 - call $intrinsics::mem::heap_base - memory.size - i32.const 16 - i32.shl - i32.add - i32.store - end - block ;; label = @2 - local.get 2 - local.get 0 - i32.load - local.tee 4 - i32.const -1 - i32.xor - i32.gt_u - br_if 0 (;@2;) - local.get 0 - local.get 4 - local.get 2 - i32.add - i32.store - local.get 4 - local.get 1 - i32.add - local.set 3 - end - local.get 3 - return - end - unreachable - ) - (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) - unreachable - ) - (func $>::from (;9;) (type 8) (param i32) (result f32) - local.get 0 - f32.reinterpret_i32 - ) - (func $intrinsics::felt::from_u64_unchecked (;10;) (type 9) (param i64) (result f32) - unreachable - ) - (func $intrinsics::felt::from_u32 (;11;) (type 8) (param i32) (result f32) - unreachable - ) - (func $intrinsics::felt::as_u64 (;12;) (type 10) (param f32) (result i64) - unreachable - ) - (func $intrinsics::felt::assert_eq (;13;) (type 11) (param f32 f32) - unreachable - ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;14;) (type 12) (param i32 i32 i32 i32 i32 i32) - (local i32 i32 i32 i64) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 6 - global.set $__stack_pointer - i32.const 0 - local.set 7 - block ;; label = @1 - block ;; label = @2 - local.get 5 - i32.eqz - br_if 0 (;@2;) - local.get 2 - local.get 3 - i32.add - local.tee 3 - local.get 2 - i32.lt_u - br_if 1 (;@1;) - i32.const 0 - local.set 7 - local.get 4 - local.get 5 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 4 - i32.sub - i32.and - i64.extend_i32_u - local.get 3 - local.get 1 - i32.load - i32.const 1 - i32.shl - local.tee 8 - local.get 3 - local.get 8 - i32.gt_u - select - local.tee 8 - i32.const 8 - i32.const 4 - i32.const 1 - local.get 5 - i32.const 1025 - i32.lt_u - select - local.get 5 - i32.const 1 - i32.eq - select - local.tee 2 - local.get 8 - local.get 2 - i32.gt_u - select - local.tee 2 - i64.extend_i32_u - i64.mul - local.tee 9 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@2;) - local.get 9 - i32.wrap_i64 - local.tee 3 - i32.const -2147483648 - local.get 4 - i32.sub - i32.gt_u - br_if 1 (;@1;) - local.get 6 - i32.const 20 - i32.add - local.get 1 - local.get 4 - local.get 5 - call $alloc::raw_vec::RawVecInner::current_memory - local.get 6 - i32.const 8 - i32.add - local.get 4 - local.get 3 - local.get 6 - i32.const 20 - i32.add - local.get 0 - call $alloc::raw_vec::finish_grow - local.get 6 - i32.load offset=12 - local.set 7 - block ;; label = @3 - local.get 6 - i32.load offset=8 - i32.eqz - br_if 0 (;@3;) - local.get 6 - i32.load offset=16 - local.set 8 - br 2 (;@1;) - end - local.get 1 - local.get 2 - i32.store - local.get 1 - local.get 7 - i32.store offset=4 - i32.const -2147483647 - local.set 7 - br 1 (;@1;) - end - end - local.get 0 - local.get 8 - i32.store offset=4 - local.get 0 - local.get 7 - i32.store - local.get 6 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;15;) (type 13) (param i32 i32 i32 i32 i32) - (local i32 i64) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - block ;; label = @1 - block ;; label = @2 - block ;; label = @3 - local.get 3 - local.get 4 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 3 - i32.sub - i32.and - i64.extend_i32_u - local.get 1 - i64.extend_i32_u - i64.mul - local.tee 6 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@3;) - local.get 6 - i32.wrap_i64 - local.tee 4 - i32.const -2147483648 - local.get 3 - i32.sub - i32.le_u - br_if 1 (;@2;) - end - local.get 0 - i32.const 0 - i32.store offset=4 - i32.const 1 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - local.get 4 - br_if 0 (;@2;) - local.get 0 - local.get 3 - i32.store offset=8 - i32.const 0 - local.set 3 - local.get 0 - i32.const 0 - i32.store offset=4 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 2 - br_if 0 (;@3;) - local.get 5 - i32.const 8 - i32.add - local.get 3 - local.get 4 - call $::allocate - local.get 5 - i32.load offset=8 - local.set 2 - br 1 (;@2;) - end - local.get 5 - local.get 3 - local.get 4 - i32.const 1 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load - local.set 2 - end - block ;; label = @2 - local.get 2 - i32.eqz - br_if 0 (;@2;) - local.get 0 - local.get 2 - i32.store offset=8 - local.get 0 - local.get 1 - i32.store offset=4 - i32.const 0 - local.set 3 - br 1 (;@1;) - end - local.get 0 - local.get 4 - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - i32.const 1 - local.set 3 - end - local.get 0 - local.get 3 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;16;) (type 14) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 3 - i32.load offset=12 - local.set 2 - local.get 0 - local.get 3 - i32.load offset=8 - i32.store - local.get 0 - local.get 2 - i32.store offset=4 - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::alloc::Global::alloc_impl (;17;) (type 15) (param i32 i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @2 - local.get 3 - br_if 0 (;@2;) - local.get 2 - local.get 1 - call $__rustc::__rust_alloc - local.set 1 - br 1 (;@1;) - end - local.get 2 - local.get 1 - call $__rustc::__rust_alloc_zeroed - local.set 1 - end - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.store - ) - (func $alloc::raw_vec::RawVecInner::current_memory (;18;) (type 15) (param i32 i32 i32 i32) - (local i32 i32 i32) - i32.const 0 - local.set 4 - i32.const 4 - local.set 5 - block ;; label = @1 - local.get 3 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.load - local.tee 6 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.load offset=4 - i32.store - local.get 6 - local.get 3 - i32.mul - local.set 4 - i32.const 8 - local.set 5 - end - local.get 0 - local.get 5 - i32.add - local.get 4 - i32.store - ) - (func $alloc::raw_vec::finish_grow (;19;) (type 13) (param i32 i32 i32 i32 i32) - (local i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - i32.const 0 - local.set 6 - block ;; label = @1 - block ;; label = @2 - local.get 2 - i32.const 0 - i32.ge_s - br_if 0 (;@2;) - i32.const 1 - local.set 2 - i32.const 4 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 3 - i32.load offset=4 - i32.eqz - br_if 0 (;@3;) - block ;; label = @4 - local.get 3 - i32.load offset=8 - local.tee 6 - br_if 0 (;@4;) - local.get 5 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load offset=12 - local.set 6 - local.get 5 - i32.load offset=8 - local.set 3 - br 2 (;@2;) - end - local.get 3 - i32.load - local.get 6 - local.get 1 - local.get 2 - call $__rustc::__rust_realloc - local.set 3 - local.get 2 - local.set 6 - br 1 (;@2;) - end - local.get 5 - local.get 1 - local.get 2 - call $::allocate - local.get 5 - i32.load offset=4 - local.set 6 - local.get 5 - i32.load - local.set 3 - end - local.get 0 - local.get 3 - local.get 1 - local.get 3 - select - i32.store offset=4 - local.get 6 - local.get 2 - local.get 3 - select - local.set 6 - local.get 3 - i32.eqz - local.set 2 - i32.const 8 - local.set 3 - end - local.get 0 - local.get 3 - i32.add - local.get 6 - i32.store - local.get 0 - local.get 2 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::handle_error (;20;) (type 14) (param i32 i32 i32) - unreachable - ) - (func $core::ptr::alignment::Alignment::max (;21;) (type 3) (param i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 0 - local.get 1 - i32.gt_u - select - ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") -) diff --git a/felt-repr/tests/expected/onchain_mixed_types_no_u64.hir b/felt-repr/tests/expected/onchain_mixed_types_no_u64.hir deleted file mode 100644 index 057dbc279..000000000 --- a/felt-repr/tests/expected/onchain_mixed_types_no_u64.hir +++ /dev/null @@ -1,1305 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @onchain_mixed_types_no_u64 { - private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { - ^block4(v0: i32, v1: felt): - v4 = arith.constant 8 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.add v3, v4 : u32 #[overflow = checked]; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; - hir.assertz v7 #[code = 250]; - v8 = hir.int_to_ptr v5 : ptr; - v9 = hir.load v8 : i32; - v10 = hir.bitcast v0 : u32; - v972 = arith.constant 4 : u32; - v12 = arith.mod v10, v972 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : i32; - v2 = arith.constant 0 : i32; - v15 = arith.neq v9, v14 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v2 : i1; - scf.if v19{ - ^block98: - scf.yield ; - } else { - ^block7: - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVec::grow_one(v0) - scf.yield ; - }; - v971 = arith.constant 4 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v971 : u32 #[overflow = checked]; - v970 = arith.constant 4 : u32; - v25 = arith.mod v23, v970 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - v27 = hir.load v26 : i32; - v962 = arith.constant 2 : u32; - v31 = arith.shl v9, v962 : i32; - v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v32 : u32; - v969 = arith.constant 4 : u32; - v36 = arith.mod v34, v969 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v1; - v968 = arith.constant 8 : u32; - v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v968 : u32 #[overflow = checked]; - v967 = arith.constant 4 : u32; - v44 = arith.mod v42, v967 : u32; - hir.assertz v44 #[code = 250]; - v38 = arith.constant 1 : i32; - v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v39; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { - ^block8(v46: i32): - v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 16 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; - v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v54 = hir.bitcast v53 : ptr; - hir.store v54, v52; - v57 = hir.bitcast v46 : u32; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v63 = arith.constant 4 : i32; - v62 = arith.constant 1 : i32; - v55 = arith.constant 8 : i32; - v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) - v66 = arith.constant 8 : u32; - v65 = hir.bitcast v52 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v976 = arith.constant 4 : u32; - v69 = arith.mod v67, v976 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i32; - v47 = arith.constant 0 : i32; - v72 = arith.constant -2147483647 : i32; - v73 = arith.eq v71, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v47 : i1; - cf.cond_br v77 ^block10, ^block11; - ^block10: - v975 = arith.constant 16 : i32; - v87 = arith.add v52, v975 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret ; - ^block11: - v79 = arith.constant 12 : u32; - v78 = hir.bitcast v52 : u32; - v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v974 = arith.constant 4 : u32; - v82 = arith.mod v80, v974 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::handle_error(v71, v84, v85) - ub.unreachable ; - }; - - public builtin.function @entrypoint(v90: i32, v91: i32) { - ^block12(v90: i32, v91: i32): - v96 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v97 = hir.bitcast v96 : ptr; - v98 = hir.load v97 : i32; - v99 = arith.constant 32 : i32; - v100 = arith.sub v98, v99 : i32 #[overflow = wrapping]; - v101 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v102 = hir.bitcast v101 : ptr; - hir.store v102, v100; - v104 = arith.constant 12 : u32; - v103 = hir.bitcast v91 : u32; - v105 = arith.add v103, v104 : u32 #[overflow = checked]; - v106 = arith.constant 4 : u32; - v107 = arith.mod v105, v106 : u32; - hir.assertz v107 #[code = 250]; - v108 = hir.int_to_ptr v105 : ptr; - v109 = hir.load v108 : felt; - v111 = arith.constant 8 : u32; - v110 = hir.bitcast v91 : u32; - v112 = arith.add v110, v111 : u32 #[overflow = checked]; - v1010 = arith.constant 4 : u32; - v114 = arith.mod v112, v1010 : u32; - hir.assertz v114 #[code = 250]; - v115 = hir.int_to_ptr v112 : ptr; - v116 = hir.load v115 : felt; - v1009 = arith.constant 4 : u32; - v117 = hir.bitcast v91 : u32; - v119 = arith.add v117, v1009 : u32 #[overflow = checked]; - v1008 = arith.constant 4 : u32; - v121 = arith.mod v119, v1008 : u32; - hir.assertz v121 #[code = 250]; - v122 = hir.int_to_ptr v119 : ptr; - v123 = hir.load v122 : felt; - v124 = hir.bitcast v91 : u32; - v1007 = arith.constant 4 : u32; - v126 = arith.mod v124, v1007 : u32; - hir.assertz v126 #[code = 250]; - v127 = hir.int_to_ptr v124 : ptr; - v128 = hir.load v127 : felt; - v130 = arith.constant 16 : u32; - v129 = hir.bitcast v91 : u32; - v131 = arith.add v129, v130 : u32 #[overflow = checked]; - v1006 = arith.constant 4 : u32; - v133 = arith.mod v131, v1006 : u32; - hir.assertz v133 #[code = 250]; - v134 = hir.int_to_ptr v131 : ptr; - v135 = hir.load v134 : felt; - v136 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/intrinsics::felt::as_u64(v135) : i64 - v138 = arith.constant 20 : u32; - v137 = hir.bitcast v91 : u32; - v139 = arith.add v137, v138 : u32 #[overflow = checked]; - v1005 = arith.constant 4 : u32; - v141 = arith.mod v139, v1005 : u32; - hir.assertz v141 #[code = 250]; - v142 = hir.int_to_ptr v139 : ptr; - v143 = hir.load v142 : felt; - v144 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/intrinsics::felt::as_u64(v143) : i64 - v149 = arith.constant 4 : i32; - v92 = arith.constant 0 : i32; - v147 = arith.constant 256 : i32; - v145 = arith.constant 20 : i32; - v146 = arith.add v100, v145 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVecInner::try_allocate_in(v146, v147, v92, v149, v149) - v152 = arith.constant 24 : u32; - v151 = hir.bitcast v100 : u32; - v153 = arith.add v151, v152 : u32 #[overflow = checked]; - v1004 = arith.constant 4 : u32; - v155 = arith.mod v153, v1004 : u32; - hir.assertz v155 #[code = 250]; - v156 = hir.int_to_ptr v153 : ptr; - v157 = hir.load v156 : i32; - v1003 = arith.constant 20 : u32; - v158 = hir.bitcast v100 : u32; - v160 = arith.add v158, v1003 : u32 #[overflow = checked]; - v1002 = arith.constant 4 : u32; - v162 = arith.mod v160, v1002 : u32; - hir.assertz v162 #[code = 250]; - v163 = hir.int_to_ptr v160 : ptr; - v164 = hir.load v163 : i32; - v1001 = arith.constant 0 : i32; - v165 = arith.constant 1 : i32; - v166 = arith.neq v164, v165 : i1; - v167 = arith.zext v166 : u32; - v168 = hir.bitcast v167 : i32; - v170 = arith.neq v168, v1001 : i1; - cf.cond_br v170 ^block14, ^block15; - ^block14: - v1000 = arith.constant 8 : i32; - v179 = arith.constant 8 : i32; - v180 = arith.add v100, v179 : i32 #[overflow = wrapping]; - v182 = arith.add v180, v1000 : i32 #[overflow = wrapping]; - v184 = hir.bitcast v182 : u32; - v999 = arith.constant 4 : u32; - v186 = arith.mod v184, v999 : u32; - hir.assertz v186 #[code = 250]; - v998 = arith.constant 0 : i32; - v187 = hir.int_to_ptr v184 : ptr; - hir.store v187, v998; - v189 = arith.constant 28 : u32; - v188 = hir.bitcast v100 : u32; - v190 = arith.add v188, v189 : u32 #[overflow = checked]; - v997 = arith.constant 4 : u32; - v192 = arith.mod v190, v997 : u32; - hir.assertz v192 #[code = 250]; - v193 = hir.int_to_ptr v190 : ptr; - v194 = hir.load v193 : i32; - v996 = arith.constant 12 : u32; - v195 = hir.bitcast v100 : u32; - v197 = arith.add v195, v996 : u32 #[overflow = checked]; - v995 = arith.constant 4 : u32; - v199 = arith.mod v197, v995 : u32; - hir.assertz v199 #[code = 250]; - v200 = hir.int_to_ptr v197 : ptr; - hir.store v200, v194; - v994 = arith.constant 8 : u32; - v201 = hir.bitcast v100 : u32; - v203 = arith.add v201, v994 : u32 #[overflow = checked]; - v993 = arith.constant 4 : u32; - v205 = arith.mod v203, v993 : u32; - hir.assertz v205 #[code = 250]; - v206 = hir.int_to_ptr v203 : ptr; - hir.store v206, v157; - v992 = arith.constant 8 : i32; - v208 = arith.add v100, v992 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v208, v128) - v991 = arith.constant 8 : i32; - v210 = arith.add v100, v991 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v210, v123) - v990 = arith.constant 8 : i32; - v212 = arith.add v100, v990 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v212, v116) - v989 = arith.constant 8 : i32; - v214 = arith.add v100, v989 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v214, v109) - v217 = arith.trunc v136 : i32; - v218 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/>::from(v217) : felt - v988 = arith.constant 8 : i32; - v216 = arith.add v100, v988 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v216, v218) - v222 = arith.constant 255 : i32; - v221 = arith.trunc v144 : i32; - v223 = arith.band v221, v222 : i32; - v224 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/>::from(v223) : felt - v987 = arith.constant 8 : i32; - v220 = arith.add v100, v987 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::vec::Vec::push(v220, v224) - v227 = hir.bitcast v182 : u32; - v986 = arith.constant 4 : u32; - v229 = arith.mod v227, v986 : u32; - hir.assertz v229 #[code = 250]; - v230 = hir.int_to_ptr v227 : ptr; - v231 = hir.load v230 : i32; - v985 = arith.constant 8 : i32; - v226 = arith.add v90, v985 : i32 #[overflow = wrapping]; - v232 = hir.bitcast v226 : u32; - v984 = arith.constant 4 : u32; - v234 = arith.mod v232, v984 : u32; - hir.assertz v234 #[code = 250]; - v235 = hir.int_to_ptr v232 : ptr; - hir.store v235, v231; - v983 = arith.constant 8 : u32; - v236 = hir.bitcast v100 : u32; - v238 = arith.add v236, v983 : u32 #[overflow = checked]; - v982 = arith.constant 4 : u32; - v240 = arith.mod v238, v982 : u32; - hir.assertz v240 #[code = 250]; - v241 = hir.int_to_ptr v238 : ptr; - v242 = hir.load v241 : i64; - v243 = hir.bitcast v90 : u32; - v981 = arith.constant 4 : u32; - v245 = arith.mod v243, v981 : u32; - hir.assertz v245 #[code = 250]; - v246 = hir.int_to_ptr v243 : ptr; - hir.store v246, v242; - v980 = arith.constant 32 : i32; - v248 = arith.add v100, v980 : i32 #[overflow = wrapping]; - v249 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v250 = hir.bitcast v249 : ptr; - hir.store v250, v248; - builtin.ret ; - ^block15: - v979 = arith.constant 28 : u32; - v171 = hir.bitcast v100 : u32; - v173 = arith.add v171, v979 : u32 #[overflow = checked]; - v978 = arith.constant 4 : u32; - v175 = arith.mod v173, v978 : u32; - hir.assertz v175 #[code = 250]; - v176 = hir.int_to_ptr v173 : ptr; - v177 = hir.load v176 : i32; - v178 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::handle_error(v157, v177, v178) - ub.unreachable ; - }; - - private builtin.function @__rustc::__rust_alloc(v251: i32, v252: i32) -> i32 { - ^block16(v251: i32, v252: i32): - v254 = arith.constant 1048604 : i32; - v255 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::alloc(v254, v252, v251) : i32 - builtin.ret v255; - }; - - private builtin.function @__rustc::__rust_realloc(v256: i32, v257: i32, v258: i32, v259: i32) -> i32 { - ^block18(v256: i32, v257: i32, v258: i32, v259: i32): - v261 = arith.constant 1048604 : i32; - v262 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::alloc(v261, v258, v259) : i32 - v1019 = arith.constant 0 : i32; - v263 = arith.constant 0 : i32; - v264 = arith.eq v262, v263 : i1; - v265 = arith.zext v264 : u32; - v266 = hir.bitcast v265 : i32; - v268 = arith.neq v266, v1019 : i1; - scf.if v268{ - ^block20: - scf.yield ; - } else { - ^block21: - v1018 = arith.constant 0 : i32; - v270 = hir.bitcast v257 : u32; - v269 = hir.bitcast v259 : u32; - v271 = arith.lt v269, v270 : i1; - v272 = arith.zext v271 : u32; - v273 = hir.bitcast v272 : i32; - v275 = arith.neq v273, v1018 : i1; - v276 = cf.select v275, v259, v257 : i32; - v1016 = arith.constant 0 : i32; - v1017 = arith.constant 0 : i32; - v278 = arith.eq v276, v1017 : i1; - v279 = arith.zext v278 : u32; - v280 = hir.bitcast v279 : i32; - v282 = arith.neq v280, v1016 : i1; - scf.if v282{ - ^block104: - scf.yield ; - } else { - ^block22: - v283 = hir.bitcast v276 : u32; - v284 = hir.bitcast v262 : u32; - v285 = hir.int_to_ptr v284 : ptr; - v286 = hir.bitcast v256 : u32; - v287 = hir.int_to_ptr v286 : ptr; - hir.mem_cpy v287, v285, v283; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v262; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v289: i32, v290: i32) -> i32 { - ^block23(v289: i32, v290: i32): - v292 = arith.constant 1048604 : i32; - v293 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::alloc(v292, v290, v289) : i32 - v1028 = arith.constant 0 : i32; - v294 = arith.constant 0 : i32; - v295 = arith.eq v293, v294 : i1; - v296 = arith.zext v295 : u32; - v297 = hir.bitcast v296 : i32; - v299 = arith.neq v297, v1028 : i1; - scf.if v299{ - ^block25: - scf.yield ; - } else { - ^block26: - v1026 = arith.constant 0 : i32; - v1027 = arith.constant 0 : i32; - v301 = arith.eq v289, v1027 : i1; - v302 = arith.zext v301 : u32; - v303 = hir.bitcast v302 : i32; - v305 = arith.neq v303, v1026 : i1; - scf.if v305{ - ^block107: - scf.yield ; - } else { - ^block27: - v1020 = arith.constant 0 : u8; - v308 = hir.bitcast v289 : u32; - v309 = hir.bitcast v293 : u32; - v310 = hir.int_to_ptr v309 : ptr; - hir.mem_set v310, v308, v1020; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v293; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block28: - builtin.ret ; - }; - - private builtin.function @::alloc(v312: i32, v313: i32, v314: i32) -> i32 { - ^block30(v312: i32, v313: i32, v314: i32): - v317 = arith.constant 16 : i32; - v316 = arith.constant 0 : i32; - v1030 = arith.constant 16 : u32; - v319 = hir.bitcast v313 : u32; - v321 = arith.gt v319, v1030 : i1; - v322 = arith.zext v321 : u32; - v323 = hir.bitcast v322 : i32; - v325 = arith.neq v323, v316 : i1; - v326 = cf.select v325, v313, v317 : i32; - v1070 = arith.constant 0 : i32; - v327 = arith.constant -1 : i32; - v328 = arith.add v326, v327 : i32 #[overflow = wrapping]; - v329 = arith.band v326, v328 : i32; - v331 = arith.neq v329, v1070 : i1; - v1039, v1040 = scf.if v331 : i32, u32 { - ^block112: - v1031 = arith.constant 0 : u32; - v1035 = ub.poison i32 : i32; - scf.yield v1035, v1031; - } else { - ^block33: - v333 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/core::ptr::alignment::Alignment::max(v313, v326) : i32 - v1069 = arith.constant 0 : i32; - v332 = arith.constant -2147483648 : i32; - v334 = arith.sub v332, v333 : i32 #[overflow = wrapping]; - v336 = hir.bitcast v334 : u32; - v335 = hir.bitcast v314 : u32; - v337 = arith.gt v335, v336 : i1; - v338 = arith.zext v337 : u32; - v339 = hir.bitcast v338 : i32; - v341 = arith.neq v339, v1069 : i1; - v1054 = scf.if v341 : i32 { - ^block111: - v1068 = ub.poison i32 : i32; - scf.yield v1068; - } else { - ^block34: - v1066 = arith.constant 0 : i32; - v347 = arith.sub v1066, v333 : i32 #[overflow = wrapping]; - v1067 = arith.constant -1 : i32; - v343 = arith.add v314, v333 : i32 #[overflow = wrapping]; - v345 = arith.add v343, v1067 : i32 #[overflow = wrapping]; - v348 = arith.band v345, v347 : i32; - v349 = hir.bitcast v312 : u32; - v350 = arith.constant 4 : u32; - v351 = arith.mod v349, v350 : u32; - hir.assertz v351 #[code = 250]; - v352 = hir.int_to_ptr v349 : ptr; - v353 = hir.load v352 : i32; - v1065 = arith.constant 0 : i32; - v355 = arith.neq v353, v1065 : i1; - scf.if v355{ - ^block110: - scf.yield ; - } else { - ^block36: - v356 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/intrinsics::mem::heap_base() : i32 - v357 = hir.mem_size : u32; - v363 = hir.bitcast v312 : u32; - v1064 = arith.constant 4 : u32; - v365 = arith.mod v363, v1064 : u32; - hir.assertz v365 #[code = 250]; - v1063 = arith.constant 16 : u32; - v358 = hir.bitcast v357 : i32; - v361 = arith.shl v358, v1063 : i32; - v362 = arith.add v356, v361 : i32 #[overflow = wrapping]; - v366 = hir.int_to_ptr v363 : ptr; - hir.store v366, v362; - scf.yield ; - }; - v369 = hir.bitcast v312 : u32; - v1062 = arith.constant 4 : u32; - v371 = arith.mod v369, v1062 : u32; - hir.assertz v371 #[code = 250]; - v372 = hir.int_to_ptr v369 : ptr; - v373 = hir.load v372 : i32; - v1060 = arith.constant 0 : i32; - v1061 = arith.constant -1 : i32; - v375 = arith.bxor v373, v1061 : i32; - v377 = hir.bitcast v375 : u32; - v376 = hir.bitcast v348 : u32; - v378 = arith.gt v376, v377 : i1; - v379 = arith.zext v378 : u32; - v380 = hir.bitcast v379 : i32; - v382 = arith.neq v380, v1060 : i1; - v1053 = scf.if v382 : i32 { - ^block37: - v1059 = arith.constant 0 : i32; - scf.yield v1059; - } else { - ^block38: - v384 = hir.bitcast v312 : u32; - v1058 = arith.constant 4 : u32; - v386 = arith.mod v384, v1058 : u32; - hir.assertz v386 #[code = 250]; - v383 = arith.add v373, v348 : i32 #[overflow = wrapping]; - v387 = hir.int_to_ptr v384 : ptr; - hir.store v387, v383; - v389 = arith.add v373, v333 : i32 #[overflow = wrapping]; - scf.yield v389; - }; - scf.yield v1053; - }; - v1036 = arith.constant 1 : u32; - v1057 = arith.constant 0 : u32; - v1055 = cf.select v341, v1057, v1036 : u32; - scf.yield v1054, v1055; - }; - v1056 = arith.constant 0 : u32; - v1052 = arith.eq v1040, v1056 : i1; - cf.cond_br v1052 ^block32, ^block114(v1039); - ^block32: - ub.unreachable ; - ^block114(v1032: i32): - builtin.ret v1032; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block39: - v392 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v392; - }; - - private builtin.function @>::from(v394: i32) -> felt { - ^block43(v394: i32): - v396 = hir.bitcast v394 : felt; - builtin.ret v396; - }; - - private builtin.function @intrinsics::felt::as_u64(v397: felt) -> i64 { - ^block45(v397: felt): - v398 = hir.cast v397 : i64; - builtin.ret v398; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v400: i32, v401: i32, v402: i32, v403: i32, v404: i32, v405: i32) { - ^block47(v400: i32, v401: i32, v402: i32, v403: i32, v404: i32, v405: i32): - v408 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v409 = hir.bitcast v408 : ptr; - v410 = hir.load v409 : i32; - v411 = arith.constant 32 : i32; - v412 = arith.sub v410, v411 : i32 #[overflow = wrapping]; - v413 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v414 = hir.bitcast v413 : ptr; - hir.store v414, v412; - v1147 = arith.constant 0 : i32; - v406 = arith.constant 0 : i32; - v417 = arith.eq v405, v406 : i1; - v418 = arith.zext v417 : u32; - v419 = hir.bitcast v418 : i32; - v421 = arith.neq v419, v1147 : i1; - v1118, v1119 = scf.if v421 : i32, i32 { - ^block50: - v1146 = arith.constant 0 : i32; - scf.yield v1146, v1146; - } else { - ^block51: - v422 = arith.add v402, v403 : i32 #[overflow = wrapping]; - v1145 = arith.constant 0 : i32; - v424 = hir.bitcast v402 : u32; - v423 = hir.bitcast v422 : u32; - v425 = arith.lt v423, v424 : i1; - v426 = arith.zext v425 : u32; - v427 = hir.bitcast v426 : i32; - v429 = arith.neq v427, v1145 : i1; - v1116, v1117 = scf.if v429 : i32, i32 { - ^block120: - v1144 = arith.constant 0 : i32; - scf.yield v1144, v1144; - } else { - ^block52: - v440 = hir.bitcast v401 : u32; - v554 = arith.constant 4 : u32; - v442 = arith.mod v440, v554 : u32; - hir.assertz v442 #[code = 250]; - v443 = hir.int_to_ptr v440 : ptr; - v444 = hir.load v443 : i32; - v1072 = arith.constant 1 : u32; - v447 = arith.shl v444, v1072 : i32; - v1143 = arith.constant 0 : i32; - v449 = hir.bitcast v447 : u32; - v448 = hir.bitcast v422 : u32; - v450 = arith.gt v448, v449 : i1; - v451 = arith.zext v450 : u32; - v452 = hir.bitcast v451 : i32; - v454 = arith.neq v452, v1143 : i1; - v455 = cf.select v454, v422, v447 : i32; - v1140 = arith.constant 1 : i32; - v457 = arith.constant 4 : i32; - v1141 = arith.constant 0 : i32; - v1071 = arith.constant 1025 : u32; - v460 = hir.bitcast v405 : u32; - v462 = arith.lt v460, v1071 : i1; - v463 = arith.zext v462 : u32; - v464 = hir.bitcast v463 : i32; - v466 = arith.neq v464, v1141 : i1; - v467 = cf.select v466, v457, v1140 : i32; - v456 = arith.constant 8 : i32; - v1142 = arith.constant 0 : i32; - v445 = arith.constant 1 : i32; - v469 = arith.eq v405, v445 : i1; - v470 = arith.zext v469 : u32; - v471 = hir.bitcast v470 : i32; - v473 = arith.neq v471, v1142 : i1; - v474 = cf.select v473, v456, v467 : i32; - v1139 = arith.constant 0 : i32; - v476 = hir.bitcast v474 : u32; - v475 = hir.bitcast v455 : u32; - v477 = arith.gt v475, v476 : i1; - v478 = arith.zext v477 : u32; - v479 = hir.bitcast v478 : i32; - v481 = arith.neq v479, v1139 : i1; - v482 = cf.select v481, v455, v474 : i32; - v483 = hir.bitcast v482 : u32; - v484 = arith.zext v483 : u64; - v485 = hir.bitcast v484 : i64; - v1138 = arith.constant 0 : i32; - v435 = arith.sub v1138, v404 : i32 #[overflow = wrapping]; - v432 = arith.constant -1 : i32; - v431 = arith.add v404, v405 : i32 #[overflow = wrapping]; - v433 = arith.add v431, v432 : i32 #[overflow = wrapping]; - v436 = arith.band v433, v435 : i32; - v437 = hir.bitcast v436 : u32; - v438 = arith.zext v437 : u64; - v439 = hir.bitcast v438 : i64; - v486 = arith.mul v439, v485 : i64 #[overflow = wrapping]; - v1137 = arith.constant 0 : i32; - v487 = arith.constant 32 : i64; - v489 = hir.cast v487 : u32; - v488 = hir.bitcast v486 : u64; - v490 = arith.shr v488, v489 : u64; - v491 = hir.bitcast v490 : i64; - v492 = arith.trunc v491 : i32; - v494 = arith.neq v492, v1137 : i1; - v1114, v1115 = scf.if v494 : i32, i32 { - ^block119: - v1136 = arith.constant 0 : i32; - scf.yield v455, v1136; - } else { - ^block53: - v495 = arith.trunc v486 : i32; - v1135 = arith.constant 0 : i32; - v496 = arith.constant -2147483648 : i32; - v497 = arith.sub v496, v404 : i32 #[overflow = wrapping]; - v499 = hir.bitcast v497 : u32; - v498 = hir.bitcast v495 : u32; - v500 = arith.gt v498, v499 : i1; - v501 = arith.zext v500 : u32; - v502 = hir.bitcast v501 : i32; - v504 = arith.neq v502, v1135 : i1; - v1112, v1113 = scf.if v504 : i32, i32 { - ^block118: - v1134 = arith.constant 0 : i32; - scf.yield v455, v1134; - } else { - ^block54: - v505 = arith.constant 20 : i32; - v506 = arith.add v412, v505 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::RawVecInner::current_memory(v506, v401, v404, v405) - v1132 = arith.constant 20 : i32; - v510 = arith.add v412, v1132 : i32 #[overflow = wrapping]; - v1133 = arith.constant 8 : i32; - v508 = arith.add v412, v1133 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::raw_vec::finish_grow(v508, v404, v495, v510, v400) - v512 = arith.constant 12 : u32; - v511 = hir.bitcast v412 : u32; - v513 = arith.add v511, v512 : u32 #[overflow = checked]; - v1131 = arith.constant 4 : u32; - v515 = arith.mod v513, v1131 : u32; - hir.assertz v515 #[code = 250]; - v516 = hir.int_to_ptr v513 : ptr; - v517 = hir.load v516 : i32; - v519 = arith.constant 8 : u32; - v518 = hir.bitcast v412 : u32; - v520 = arith.add v518, v519 : u32 #[overflow = checked]; - v1130 = arith.constant 4 : u32; - v522 = arith.mod v520, v1130 : u32; - hir.assertz v522 #[code = 250]; - v523 = hir.int_to_ptr v520 : ptr; - v524 = hir.load v523 : i32; - v1128 = arith.constant 0 : i32; - v1129 = arith.constant 0 : i32; - v526 = arith.eq v524, v1129 : i1; - v527 = arith.zext v526 : u32; - v528 = hir.bitcast v527 : i32; - v530 = arith.neq v528, v1128 : i1; - v1110 = scf.if v530 : i32 { - ^block55: - v538 = hir.bitcast v401 : u32; - v1127 = arith.constant 4 : u32; - v540 = arith.mod v538, v1127 : u32; - hir.assertz v540 #[code = 250]; - v541 = hir.int_to_ptr v538 : ptr; - hir.store v541, v482; - v1126 = arith.constant 4 : u32; - v542 = hir.bitcast v401 : u32; - v544 = arith.add v542, v1126 : u32 #[overflow = checked]; - v1125 = arith.constant 4 : u32; - v546 = arith.mod v544, v1125 : u32; - hir.assertz v546 #[code = 250]; - v547 = hir.int_to_ptr v544 : ptr; - hir.store v547, v517; - scf.yield v455; - } else { - ^block56: - v532 = arith.constant 16 : u32; - v531 = hir.bitcast v412 : u32; - v533 = arith.add v531, v532 : u32 #[overflow = checked]; - v1124 = arith.constant 4 : u32; - v535 = arith.mod v533, v1124 : u32; - hir.assertz v535 #[code = 250]; - v536 = hir.int_to_ptr v533 : ptr; - v537 = hir.load v536 : i32; - scf.yield v537; - }; - v548 = arith.constant -2147483647 : i32; - v1111 = cf.select v530, v548, v517 : i32; - scf.yield v1110, v1111; - }; - scf.yield v1112, v1113; - }; - scf.yield v1114, v1115; - }; - scf.yield v1116, v1117; - }; - v1123 = arith.constant 4 : u32; - v553 = hir.bitcast v400 : u32; - v555 = arith.add v553, v1123 : u32 #[overflow = checked]; - v1122 = arith.constant 4 : u32; - v557 = arith.mod v555, v1122 : u32; - hir.assertz v557 #[code = 250]; - v558 = hir.int_to_ptr v555 : ptr; - hir.store v558, v1118; - v561 = hir.bitcast v400 : u32; - v1121 = arith.constant 4 : u32; - v563 = arith.mod v561, v1121 : u32; - hir.assertz v563 #[code = 250]; - v564 = hir.int_to_ptr v561 : ptr; - hir.store v564, v1119; - v1120 = arith.constant 32 : i32; - v568 = arith.add v412, v1120 : i32 #[overflow = wrapping]; - v569 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v570 = hir.bitcast v569 : ptr; - hir.store v570, v568; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v571: i32, v572: i32, v573: i32, v574: i32, v575: i32) { - ^block57(v571: i32, v572: i32, v573: i32, v574: i32, v575: i32): - v578 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v579 = hir.bitcast v578 : ptr; - v580 = hir.load v579 : i32; - v581 = arith.constant 16 : i32; - v582 = arith.sub v580, v581 : i32 #[overflow = wrapping]; - v583 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v584 = hir.bitcast v583 : ptr; - hir.store v584, v582; - v594 = hir.bitcast v572 : u32; - v595 = arith.zext v594 : u64; - v596 = hir.bitcast v595 : i64; - v576 = arith.constant 0 : i32; - v589 = arith.sub v576, v574 : i32 #[overflow = wrapping]; - v586 = arith.constant -1 : i32; - v585 = arith.add v574, v575 : i32 #[overflow = wrapping]; - v587 = arith.add v585, v586 : i32 #[overflow = wrapping]; - v590 = arith.band v587, v589 : i32; - v591 = hir.bitcast v590 : u32; - v592 = arith.zext v591 : u64; - v593 = hir.bitcast v592 : i64; - v597 = arith.mul v593, v596 : i64 #[overflow = wrapping]; - v1251 = arith.constant 0 : i32; - v598 = arith.constant 32 : i64; - v600 = hir.cast v598 : u32; - v599 = hir.bitcast v597 : u64; - v601 = arith.shr v599, v600 : u64; - v602 = hir.bitcast v601 : i64; - v603 = arith.trunc v602 : i32; - v605 = arith.neq v603, v1251 : i1; - v1163, v1164, v1165, v1166, v1167, v1168 = scf.if v605 : i32, i32, i32, i32, i32, u32 { - ^block126: - v1148 = arith.constant 0 : u32; - v1155 = ub.poison i32 : i32; - scf.yield v571, v582, v1155, v1155, v1155, v1148; - } else { - ^block62: - v606 = arith.trunc v597 : i32; - v1250 = arith.constant 0 : i32; - v607 = arith.constant -2147483648 : i32; - v608 = arith.sub v607, v574 : i32 #[overflow = wrapping]; - v610 = hir.bitcast v608 : u32; - v609 = hir.bitcast v606 : u32; - v611 = arith.lte v609, v610 : i1; - v612 = arith.zext v611 : u32; - v613 = hir.bitcast v612 : i32; - v615 = arith.neq v613, v1250 : i1; - v1211 = scf.if v615 : i32 { - ^block60: - v1249 = arith.constant 0 : i32; - v626 = arith.neq v606, v1249 : i1; - v1210 = scf.if v626 : i32 { - ^block64: - v1248 = arith.constant 0 : i32; - v642 = arith.neq v573, v1248 : i1; - v1209 = scf.if v642 : i32 { - ^block67: - v624 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::alloc::Global::alloc_impl(v582, v574, v606, v624) - v653 = hir.bitcast v582 : u32; - v698 = arith.constant 4 : u32; - v655 = arith.mod v653, v698 : u32; - hir.assertz v655 #[code = 250]; - v656 = hir.int_to_ptr v653 : ptr; - v657 = hir.load v656 : i32; - scf.yield v657; - } else { - ^block68: - v643 = arith.constant 8 : i32; - v644 = arith.add v582, v643 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::allocate(v644, v574, v606) - v628 = arith.constant 8 : u32; - v645 = hir.bitcast v582 : u32; - v647 = arith.add v645, v628 : u32 #[overflow = checked]; - v1247 = arith.constant 4 : u32; - v649 = arith.mod v647, v1247 : u32; - hir.assertz v649 #[code = 250]; - v650 = hir.int_to_ptr v647 : ptr; - v651 = hir.load v650 : i32; - scf.yield v651; - }; - v1245 = arith.constant 0 : i32; - v1246 = arith.constant 0 : i32; - v660 = arith.eq v1209, v1246 : i1; - v661 = arith.zext v660 : u32; - v662 = hir.bitcast v661 : i32; - v664 = arith.neq v662, v1245 : i1; - scf.if v664{ - ^block69: - v1244 = arith.constant 8 : u32; - v681 = hir.bitcast v571 : u32; - v683 = arith.add v681, v1244 : u32 #[overflow = checked]; - v1243 = arith.constant 4 : u32; - v685 = arith.mod v683, v1243 : u32; - hir.assertz v685 #[code = 250]; - v686 = hir.int_to_ptr v683 : ptr; - hir.store v686, v606; - v1242 = arith.constant 4 : u32; - v688 = hir.bitcast v571 : u32; - v690 = arith.add v688, v1242 : u32 #[overflow = checked]; - v1241 = arith.constant 4 : u32; - v692 = arith.mod v690, v1241 : u32; - hir.assertz v692 #[code = 250]; - v693 = hir.int_to_ptr v690 : ptr; - hir.store v693, v574; - scf.yield ; - } else { - ^block70: - v1240 = arith.constant 8 : u32; - v666 = hir.bitcast v571 : u32; - v668 = arith.add v666, v1240 : u32 #[overflow = checked]; - v1239 = arith.constant 4 : u32; - v670 = arith.mod v668, v1239 : u32; - hir.assertz v670 #[code = 250]; - v671 = hir.int_to_ptr v668 : ptr; - hir.store v671, v1209; - v1238 = arith.constant 4 : u32; - v673 = hir.bitcast v571 : u32; - v675 = arith.add v673, v1238 : u32 #[overflow = checked]; - v1237 = arith.constant 4 : u32; - v677 = arith.mod v675, v1237 : u32; - hir.assertz v677 #[code = 250]; - v678 = hir.int_to_ptr v675 : ptr; - hir.store v678, v572; - scf.yield ; - }; - v1235 = arith.constant 0 : i32; - v1236 = arith.constant 1 : i32; - v1208 = cf.select v664, v1236, v1235 : i32; - scf.yield v1208; - } else { - ^block65: - v1234 = arith.constant 8 : u32; - v627 = hir.bitcast v571 : u32; - v629 = arith.add v627, v1234 : u32 #[overflow = checked]; - v1233 = arith.constant 4 : u32; - v631 = arith.mod v629, v1233 : u32; - hir.assertz v631 #[code = 250]; - v632 = hir.int_to_ptr v629 : ptr; - hir.store v632, v574; - v1232 = arith.constant 4 : u32; - v635 = hir.bitcast v571 : u32; - v637 = arith.add v635, v1232 : u32 #[overflow = checked]; - v1231 = arith.constant 4 : u32; - v639 = arith.mod v637, v1231 : u32; - hir.assertz v639 #[code = 250]; - v1230 = arith.constant 0 : i32; - v640 = hir.int_to_ptr v637 : ptr; - hir.store v640, v1230; - v1229 = arith.constant 0 : i32; - scf.yield v1229; - }; - scf.yield v1210; - } else { - ^block63: - v1228 = ub.poison i32 : i32; - scf.yield v1228; - }; - v1223 = arith.constant 0 : u32; - v1156 = arith.constant 1 : u32; - v1216 = cf.select v615, v1156, v1223 : u32; - v1224 = ub.poison i32 : i32; - v1215 = cf.select v615, v582, v1224 : i32; - v1225 = ub.poison i32 : i32; - v1214 = cf.select v615, v571, v1225 : i32; - v1226 = ub.poison i32 : i32; - v1213 = cf.select v615, v1226, v582 : i32; - v1227 = ub.poison i32 : i32; - v1212 = cf.select v615, v1227, v571 : i32; - scf.yield v1212, v1213, v1214, v1211, v1215, v1216; - }; - v1169, v1170, v1171 = scf.index_switch v1168 : i32, i32, i32 - case 0 { - ^block61: - v1222 = arith.constant 4 : u32; - v618 = hir.bitcast v1163 : u32; - v620 = arith.add v618, v1222 : u32 #[overflow = checked]; - v1221 = arith.constant 4 : u32; - v622 = arith.mod v620, v1221 : u32; - hir.assertz v622 #[code = 250]; - v1220 = arith.constant 0 : i32; - v623 = hir.int_to_ptr v620 : ptr; - hir.store v623, v1220; - v1219 = arith.constant 1 : i32; - scf.yield v1163, v1219, v1164; - } - default { - ^block130: - scf.yield v1165, v1166, v1167; - }; - v697 = hir.bitcast v1169 : u32; - v1218 = arith.constant 4 : u32; - v699 = arith.mod v697, v1218 : u32; - hir.assertz v699 #[code = 250]; - v700 = hir.int_to_ptr v697 : ptr; - hir.store v700, v1170; - v1217 = arith.constant 16 : i32; - v705 = arith.add v1171, v1217 : i32 #[overflow = wrapping]; - v706 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v707 = hir.bitcast v706 : ptr; - hir.store v707, v705; - builtin.ret ; - }; - - private builtin.function @::allocate(v708: i32, v709: i32, v710: i32) { - ^block71(v708: i32, v709: i32, v710: i32): - v712 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v713 = hir.bitcast v712 : ptr; - v714 = hir.load v713 : i32; - v715 = arith.constant 16 : i32; - v716 = arith.sub v714, v715 : i32 #[overflow = wrapping]; - v717 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v718 = hir.bitcast v717 : ptr; - hir.store v718, v716; - v711 = arith.constant 0 : i32; - v719 = arith.constant 8 : i32; - v720 = arith.add v716, v719 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::alloc::Global::alloc_impl(v720, v709, v710, v711) - v723 = arith.constant 12 : u32; - v722 = hir.bitcast v716 : u32; - v724 = arith.add v722, v723 : u32 #[overflow = checked]; - v725 = arith.constant 4 : u32; - v726 = arith.mod v724, v725 : u32; - hir.assertz v726 #[code = 250]; - v727 = hir.int_to_ptr v724 : ptr; - v728 = hir.load v727 : i32; - v730 = arith.constant 8 : u32; - v729 = hir.bitcast v716 : u32; - v731 = arith.add v729, v730 : u32 #[overflow = checked]; - v1256 = arith.constant 4 : u32; - v733 = arith.mod v731, v1256 : u32; - hir.assertz v733 #[code = 250]; - v734 = hir.int_to_ptr v731 : ptr; - v735 = hir.load v734 : i32; - v736 = hir.bitcast v708 : u32; - v1255 = arith.constant 4 : u32; - v738 = arith.mod v736, v1255 : u32; - hir.assertz v738 #[code = 250]; - v739 = hir.int_to_ptr v736 : ptr; - hir.store v739, v735; - v1254 = arith.constant 4 : u32; - v740 = hir.bitcast v708 : u32; - v742 = arith.add v740, v1254 : u32 #[overflow = checked]; - v1253 = arith.constant 4 : u32; - v744 = arith.mod v742, v1253 : u32; - hir.assertz v744 #[code = 250]; - v745 = hir.int_to_ptr v742 : ptr; - hir.store v745, v728; - v1252 = arith.constant 16 : i32; - v747 = arith.add v716, v1252 : i32 #[overflow = wrapping]; - v748 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v749 = hir.bitcast v748 : ptr; - hir.store v749, v747; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v750: i32, v751: i32, v752: i32, v753: i32) { - ^block73(v750: i32, v751: i32, v752: i32, v753: i32): - v1272 = arith.constant 0 : i32; - v754 = arith.constant 0 : i32; - v755 = arith.eq v752, v754 : i1; - v756 = arith.zext v755 : u32; - v757 = hir.bitcast v756 : i32; - v759 = arith.neq v757, v1272 : i1; - v1268 = scf.if v759 : i32 { - ^block133: - scf.yield v751; - } else { - ^block76: - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1271 = arith.constant 0 : i32; - v761 = arith.neq v753, v1271 : i1; - v1267 = scf.if v761 : i32 { - ^block77: - v763 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_alloc_zeroed(v752, v751) : i32 - scf.yield v763; - } else { - ^block78: - v762 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_alloc(v752, v751) : i32 - scf.yield v762; - }; - scf.yield v1267; - }; - v767 = arith.constant 4 : u32; - v766 = hir.bitcast v750 : u32; - v768 = arith.add v766, v767 : u32 #[overflow = checked]; - v1270 = arith.constant 4 : u32; - v770 = arith.mod v768, v1270 : u32; - hir.assertz v770 #[code = 250]; - v771 = hir.int_to_ptr v768 : ptr; - hir.store v771, v752; - v773 = hir.bitcast v750 : u32; - v1269 = arith.constant 4 : u32; - v775 = arith.mod v773, v1269 : u32; - hir.assertz v775 #[code = 250]; - v776 = hir.int_to_ptr v773 : ptr; - hir.store v776, v1268; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v777: i32, v778: i32, v779: i32, v780: i32) { - ^block79(v777: i32, v778: i32, v779: i32, v780: i32): - v1298 = arith.constant 0 : i32; - v781 = arith.constant 0 : i32; - v785 = arith.eq v780, v781 : i1; - v786 = arith.zext v785 : u32; - v787 = hir.bitcast v786 : i32; - v789 = arith.neq v787, v1298 : i1; - v1285, v1286 = scf.if v789 : i32, i32 { - ^block137: - v1297 = arith.constant 0 : i32; - v783 = arith.constant 4 : i32; - scf.yield v783, v1297; - } else { - ^block82: - v790 = hir.bitcast v778 : u32; - v825 = arith.constant 4 : u32; - v792 = arith.mod v790, v825 : u32; - hir.assertz v792 #[code = 250]; - v793 = hir.int_to_ptr v790 : ptr; - v794 = hir.load v793 : i32; - v1295 = arith.constant 0 : i32; - v1296 = arith.constant 0 : i32; - v796 = arith.eq v794, v1296 : i1; - v797 = arith.zext v796 : u32; - v798 = hir.bitcast v797 : i32; - v800 = arith.neq v798, v1295 : i1; - v1283 = scf.if v800 : i32 { - ^block136: - v1294 = arith.constant 0 : i32; - scf.yield v1294; - } else { - ^block83: - v1293 = arith.constant 4 : u32; - v801 = hir.bitcast v777 : u32; - v803 = arith.add v801, v1293 : u32 #[overflow = checked]; - v1292 = arith.constant 4 : u32; - v805 = arith.mod v803, v1292 : u32; - hir.assertz v805 #[code = 250]; - v806 = hir.int_to_ptr v803 : ptr; - hir.store v806, v779; - v1291 = arith.constant 4 : u32; - v807 = hir.bitcast v778 : u32; - v809 = arith.add v807, v1291 : u32 #[overflow = checked]; - v1290 = arith.constant 4 : u32; - v811 = arith.mod v809, v1290 : u32; - hir.assertz v811 #[code = 250]; - v812 = hir.int_to_ptr v809 : ptr; - v813 = hir.load v812 : i32; - v814 = hir.bitcast v777 : u32; - v1289 = arith.constant 4 : u32; - v816 = arith.mod v814, v1289 : u32; - hir.assertz v816 #[code = 250]; - v817 = hir.int_to_ptr v814 : ptr; - hir.store v817, v813; - v818 = arith.mul v794, v780 : i32 #[overflow = wrapping]; - scf.yield v818; - }; - v819 = arith.constant 8 : i32; - v1288 = arith.constant 4 : i32; - v1284 = cf.select v800, v1288, v819 : i32; - scf.yield v1284, v1283; - }; - v822 = arith.add v777, v1285 : i32 #[overflow = wrapping]; - v824 = hir.bitcast v822 : u32; - v1287 = arith.constant 4 : u32; - v826 = arith.mod v824, v1287 : u32; - hir.assertz v826 #[code = 250]; - v827 = hir.int_to_ptr v824 : ptr; - hir.store v827, v1286; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::finish_grow(v828: i32, v829: i32, v830: i32, v831: i32, v832: i32) { - ^block84(v828: i32, v829: i32, v830: i32, v831: i32, v832: i32): - v834 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v835 = hir.bitcast v834 : ptr; - v836 = hir.load v835 : i32; - v837 = arith.constant 16 : i32; - v838 = arith.sub v836, v837 : i32 #[overflow = wrapping]; - v839 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v840 = hir.bitcast v839 : ptr; - hir.store v840, v838; - v1353 = arith.constant 0 : i32; - v833 = arith.constant 0 : i32; - v843 = arith.gte v830, v833 : i1; - v844 = arith.zext v843 : u32; - v845 = hir.bitcast v844 : i32; - v847 = arith.neq v845, v1353 : i1; - v1327, v1328 = scf.if v847 : i32, i32 { - ^block87: - v934 = arith.constant 4 : u32; - v850 = hir.bitcast v831 : u32; - v852 = arith.add v850, v934 : u32 #[overflow = checked]; - v1352 = arith.constant 4 : u32; - v854 = arith.mod v852, v1352 : u32; - hir.assertz v854 #[code = 250]; - v855 = hir.int_to_ptr v852 : ptr; - v856 = hir.load v855 : i32; - v1350 = arith.constant 0 : i32; - v1351 = arith.constant 0 : i32; - v858 = arith.eq v856, v1351 : i1; - v859 = arith.zext v858 : u32; - v860 = hir.bitcast v859 : i32; - v862 = arith.neq v860, v1350 : i1; - v1325, v1326 = scf.if v862 : i32, i32 { - ^block90: - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/::allocate(v838, v829, v830) - v1349 = arith.constant 4 : u32; - v895 = hir.bitcast v838 : u32; - v897 = arith.add v895, v1349 : u32 #[overflow = checked]; - v1348 = arith.constant 4 : u32; - v899 = arith.mod v897, v1348 : u32; - hir.assertz v899 #[code = 250]; - v900 = hir.int_to_ptr v897 : ptr; - v901 = hir.load v900 : i32; - v902 = hir.bitcast v838 : u32; - v1347 = arith.constant 4 : u32; - v904 = arith.mod v902, v1347 : u32; - hir.assertz v904 #[code = 250]; - v905 = hir.int_to_ptr v902 : ptr; - v906 = hir.load v905 : i32; - scf.yield v906, v901; - } else { - ^block91: - v864 = arith.constant 8 : u32; - v863 = hir.bitcast v831 : u32; - v865 = arith.add v863, v864 : u32 #[overflow = checked]; - v1346 = arith.constant 4 : u32; - v867 = arith.mod v865, v1346 : u32; - hir.assertz v867 #[code = 250]; - v868 = hir.int_to_ptr v865 : ptr; - v869 = hir.load v868 : i32; - v1345 = arith.constant 0 : i32; - v871 = arith.neq v869, v1345 : i1; - v1323, v1324 = scf.if v871 : i32, i32 { - ^block92: - v889 = hir.bitcast v831 : u32; - v1344 = arith.constant 4 : u32; - v891 = arith.mod v889, v1344 : u32; - hir.assertz v891 #[code = 250]; - v892 = hir.int_to_ptr v889 : ptr; - v893 = hir.load v892 : i32; - v894 = hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__rustc::__rust_realloc(v893, v869, v829, v830) : i32 - scf.yield v894, v830; - } else { - ^block93: - v1343 = arith.constant 0 : i32; - v928 = arith.constant 8 : i32; - v873 = arith.add v838, v928 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_mixed_types_no_u64/alloc::alloc::Global::alloc_impl(v873, v829, v830, v1343) - v876 = arith.constant 12 : u32; - v875 = hir.bitcast v838 : u32; - v877 = arith.add v875, v876 : u32 #[overflow = checked]; - v1342 = arith.constant 4 : u32; - v879 = arith.mod v877, v1342 : u32; - hir.assertz v879 #[code = 250]; - v880 = hir.int_to_ptr v877 : ptr; - v881 = hir.load v880 : i32; - v1341 = arith.constant 8 : u32; - v882 = hir.bitcast v838 : u32; - v884 = arith.add v882, v1341 : u32 #[overflow = checked]; - v1340 = arith.constant 4 : u32; - v886 = arith.mod v884, v1340 : u32; - hir.assertz v886 #[code = 250]; - v887 = hir.int_to_ptr v884 : ptr; - v888 = hir.load v887 : i32; - scf.yield v888, v881; - }; - scf.yield v1323, v1324; - }; - v1339 = arith.constant 4 : u32; - v913 = hir.bitcast v828 : u32; - v915 = arith.add v913, v1339 : u32 #[overflow = checked]; - v1338 = arith.constant 4 : u32; - v917 = arith.mod v915, v1338 : u32; - hir.assertz v917 #[code = 250]; - v1337 = arith.constant 0 : i32; - v911 = arith.neq v1325, v1337 : i1; - v912 = cf.select v911, v1325, v829 : i32; - v918 = hir.int_to_ptr v915 : ptr; - hir.store v918, v912; - v1335 = arith.constant 0 : i32; - v925 = arith.eq v1325, v1335 : i1; - v926 = arith.zext v925 : u32; - v927 = hir.bitcast v926 : i32; - v1336 = arith.constant 0 : i32; - v922 = arith.neq v1325, v1336 : i1; - v923 = cf.select v922, v1326, v830 : i32; - scf.yield v923, v927; - } else { - ^block88: - v848 = arith.constant 1 : i32; - v1334 = arith.constant 0 : i32; - scf.yield v1334, v848; - }; - v849 = arith.constant 4 : i32; - v1333 = arith.constant 8 : i32; - v1329 = cf.select v847, v1333, v849 : i32; - v931 = arith.add v828, v1329 : i32 #[overflow = wrapping]; - v933 = hir.bitcast v931 : u32; - v1332 = arith.constant 4 : u32; - v935 = arith.mod v933, v1332 : u32; - hir.assertz v935 #[code = 250]; - v936 = hir.int_to_ptr v933 : ptr; - hir.store v936, v1327; - v938 = hir.bitcast v828 : u32; - v1331 = arith.constant 4 : u32; - v940 = arith.mod v938, v1331 : u32; - hir.assertz v940 #[code = 250]; - v941 = hir.int_to_ptr v938 : ptr; - hir.store v941, v1328; - v1330 = arith.constant 16 : i32; - v945 = arith.add v838, v1330 : i32 #[overflow = wrapping]; - v946 = builtin.global_symbol @root_ns:root@1.0.0/onchain_mixed_types_no_u64/__stack_pointer : ptr - v947 = hir.bitcast v946 : ptr; - hir.store v947, v945; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v948: i32, v949: i32, v950: i32) { - ^block94(v948: i32, v949: i32, v950: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v951: i32, v952: i32) -> i32 { - ^block96(v951: i32, v952: i32): - v959 = arith.constant 0 : i32; - v955 = hir.bitcast v952 : u32; - v954 = hir.bitcast v951 : u32; - v956 = arith.gt v954, v955 : i1; - v957 = arith.zext v956 : u32; - v958 = hir.bitcast v957 : i32; - v960 = arith.neq v958, v959 : i1; - v961 = cf.select v960, v951, v952 : i32; - builtin.ret v961; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; - }; -}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_mixed_types_no_u64.masm b/felt-repr/tests/expected/onchain_mixed_types_no_u64.masm deleted file mode 100644 index 31b679b01..000000000 --- a/felt-repr/tests/expected/onchain_mixed_types_no_u64.masm +++ /dev/null @@ -1,2540 +0,0 @@ -# mod root_ns:root@1.0.0 - -proc init - push.1179648 - trace.240 - exec.::intrinsics::mem::heap_init - trace.252 - push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] - adv.push_mapval - push.262144 - push.2 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop - push.1048576 - u32assert - mem_store.278536 -end - -# mod root_ns:root@1.0.0::onchain_mixed_types_no_u64 - -@callconv("C") -proc alloc::vec::Vec::push(i32, felt) - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - swap.1 - dup.2 - neq - neq - if.true - nop - else - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVec::grow_one - trace.252 - nop - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.2 - swap.1 - u32shl - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVec::grow_one(i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - push.1 - push.8 - dup.4 - u32wrapping_add - dup.2 - movup.2 - swap.3 - swap.4 - movdn.2 - swap.5 - swap.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVecInner::grow_amortized - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.2147483649 - dup.2 - eq - neq - if.true - drop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -pub proc entrypoint(i32, i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.12 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.8 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.16 - dup.7 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::intrinsics::felt::as_u64 - trace.252 - nop - push.20 - movup.9 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::intrinsics::felt::as_u64 - trace.252 - nop - push.4 - push.0 - push.256 - push.20 - dup.12 - u32wrapping_add - dup.3 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVecInner::try_allocate_in - trace.252 - nop - push.24 - dup.9 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.20 - dup.10 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.1 - movup.2 - neq - neq - if.true - push.8 - push.8 - dup.11 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.28 - dup.11 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.12 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.11 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.10 - u32wrapping_add - movup.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.9 - u32wrapping_add - movup.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.8 - u32wrapping_add - movup.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.7 - u32wrapping_add - movup.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push - trace.252 - nop - movup.4 - movup.4 - drop - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::>::from - trace.252 - nop - push.8 - dup.5 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push - trace.252 - nop - push.255 - movup.3 - movup.3 - drop - u32and - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::>::from - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movdn.8 - dropw - dropw - movup.2 - drop - push.28 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 - dup.5 - swap.1 - u32lt - neq - swap.1 - swap.4 - swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - swap.1 - drop - else - push.0 - push.0 - dup.3 - eq - neq - if.true - swap.1 - drop - else - push.0 - movup.2 - dup.2 - push.0 - dup.2 - push.0 - gte - while.true - dup.1 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.4 - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.3 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop -end - -@callconv("C") -proc ::alloc( - i32, - i32, - i32 -) -> i32 - push.16 - push.0 - push.16 - dup.4 - swap.1 - u32gt - neq - dup.3 - swap.1 - cdrop - push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 - else - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::core::ptr::alignment::Alignment::max - trace.252 - nop - push.0 - push.2147483648 - dup.2 - u32wrapping_sub - dup.4 - swap.1 - u32gt - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - else - push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop - exec.::intrinsics::mem::memory_size - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.16 - movup.2 - swap.1 - u32shl - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.4294967295 - dup.2 - u32xor - dup.3 - swap.1 - u32gt - neq - if.true - drop - drop - movdn.2 - drop - drop - push.0 - else - movup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - u32wrapping_add - end - end - push.1 - push.0 - movup.3 - cdrop - swap.1 - end - push.0 - movup.2 - eq - if.true - drop - push.0 - assert - else - nop - end -end - -@callconv("C") -proc intrinsics::mem::heap_base( - -) -> i32 - trace.240 - nop - exec.::intrinsics::mem::heap_base - trace.252 - nop -end - -@callconv("C") -proc >::from( - i32 -) -> felt - nop -end - -@callconv("C") -proc intrinsics::felt::as_u64(felt) -> [u32; 2] - u32split -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::grow_amortized( - i32, - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.8 - eq - neq - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - movup.4 - dup.4 - u32wrapping_add - push.0 - movup.5 - dup.2 - swap.1 - u32lt - neq - if.true - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1 - u32shl - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - movup.2 - swap.1 - cdrop - push.1 - push.4 - push.0 - push.1025 - dup.9 - swap.1 - u32lt - neq - cdrop - push.8 - push.0 - push.1 - dup.9 - eq - neq - cdrop - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - dup.2 - swap.1 - cdrop - dup.0 - push.0 - push.0 - dup.8 - u32wrapping_sub - push.4294967295 - dup.9 - dup.11 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - drop - push.0 - push.2147483648 - dup.8 - u32wrapping_sub - dup.2 - swap.1 - u32gt - neq - if.true - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - push.20 - dup.4 - u32wrapping_add - dup.6 - dup.8 - movup.3 - swap.10 - movdn.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.20 - dup.3 - u32wrapping_add - push.8 - dup.4 - u32wrapping_add - dup.5 - movup.2 - swap.3 - swap.9 - movdn.2 - swap.4 - swap.8 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::raw_vec::finish_grow - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.7 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.4 - else - movup.2 - swap.6 - movdn.2 - swap.1 - swap.5 - swap.1 - swap.4 - drop - drop - drop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - end - push.2147483649 - movdn.2 - movdn.3 - cdrop - swap.1 - end - end - end - end - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.2 - push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 - else - drop - push.0 - push.2147483648 - dup.7 - u32wrapping_sub - dup.2 - swap.1 - u32lte - neq - dup.0 - if.true - push.0 - dup.2 - neq - if.true - push.0 - movup.6 - neq - if.true - push.1 - dup.3 - dup.7 - dup.4 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::alloc::Global::alloc_impl - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.3 - u32wrapping_add - dup.6 - dup.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::allocate - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - movup.6 - movup.2 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movup.7 - movup.4 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.0 - push.1 - movup.2 - cdrop - else - movup.2 - swap.5 - movdn.2 - swap.4 - swap.1 - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 - end - else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 - end - push.0 - push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 - movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 - cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 - end - movup.5 - eq.0 - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.1 - swap.1 - else - drop - drop - end - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.8 - dup.2 - u32wrapping_add - movup.2 - swap.5 - movdn.2 - swap.1 - swap.3 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - movup.3 - drop - swap.1 - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.0 - movup.4 - neq - if.true - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_alloc - trace.252 - nop - end - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq - if.true - movdn.3 - drop - drop - drop - push.0 - push.4 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - else - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.3 - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - movup.2 - swap.1 - end - push.8 - push.4 - movup.3 - cdrop - end - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) - movup.4 - drop - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.5 - swap.1 - trace.240 - nop - exec.::intrinsics::i32::is_gte - trace.252 - nop - neq - dup.0 - if.true - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - if.true - movup.5 - drop - dup.4 - dup.4 - dup.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::::allocate - trace.252 - nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - dup.1 - neq - if.true - movup.6 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.5 - dup.7 - swap.3 - swap.1 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::__rustc::__rust_realloc - trace.252 - nop - dup.5 - swap.1 - else - movup.6 - swap.1 - drop - drop - push.0 - push.8 - dup.3 - u32wrapping_add - dup.5 - dup.7 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_mixed_types_no_u64::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - end - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - dup.2 - neq - dup.2 - movup.2 - swap.8 - movdn.2 - swap.1 - cdrop - movup.6 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - dup.1 - eq - push.0 - movup.2 - neq - swap.1 - swap.6 - swap.2 - swap.1 - cdrop - movup.4 - swap.1 - else - movup.2 - swap.5 - movdn.2 - swap.1 - swap.4 - swap.1 - swap.3 - drop - drop - drop - push.1 - push.0 - end - push.4 - push.8 - movup.4 - cdrop - dup.4 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop - drop - drop - push.0 - assert -end - -@callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 - push.0 - dup.2 - dup.2 - swap.1 - u32gt - neq - cdrop -end - diff --git a/felt-repr/tests/expected/onchain_mixed_types_no_u64.wat b/felt-repr/tests/expected/onchain_mixed_types_no_u64.wat deleted file mode 100644 index d72c03adc..000000000 --- a/felt-repr/tests/expected/onchain_mixed_types_no_u64.wat +++ /dev/null @@ -1,778 +0,0 @@ -(module $onchain_mixed_types_no_u64.wasm - (type (;0;) (func (param i32 f32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32 i32 i32) (result i32))) - (type (;5;) (func)) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func (result i32))) - (type (;8;) (func (param i32) (result f32))) - (type (;9;) (func (param f32) (result i64))) - (type (;10;) (func (param i32 i32 i32 i32 i32 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))) - (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 $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) - (local i32) - block ;; label = @1 - local.get 0 - i32.load offset=8 - local.tee 2 - local.get 0 - i32.load - i32.ne - br_if 0 (;@1;) - local.get 0 - call $alloc::raw_vec::RawVec::grow_one - end - local.get 0 - i32.load offset=4 - local.get 2 - i32.const 2 - i32.shl - i32.add - local.get 1 - f32.store - local.get 0 - local.get 2 - i32.const 1 - i32.add - i32.store offset=8 - ) - (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - i32.const 8 - i32.add - local.get 0 - local.get 0 - i32.load - i32.const 1 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::grow_amortized - block ;; label = @1 - local.get 1 - i32.load offset=8 - local.tee 0 - i32.const -2147483647 - i32.eq - br_if 0 (;@1;) - local.get 0 - local.get 1 - i32.load offset=12 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 f32 f32 i64 i64 i32) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 2 - global.set $__stack_pointer - local.get 1 - f32.load offset=12 - local.set 3 - local.get 1 - f32.load offset=8 - local.set 4 - local.get 1 - f32.load offset=4 - local.set 5 - local.get 1 - f32.load - local.set 6 - local.get 1 - f32.load offset=16 - call $intrinsics::felt::as_u64 - local.set 7 - local.get 1 - f32.load offset=20 - call $intrinsics::felt::as_u64 - local.set 8 - local.get 2 - i32.const 20 - i32.add - i32.const 256 - i32.const 0 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 2 - i32.load offset=24 - local.set 1 - block ;; label = @1 - local.get 2 - i32.load offset=20 - i32.const 1 - i32.ne - br_if 0 (;@1;) - local.get 1 - local.get 2 - i32.load offset=28 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 2 - i32.const 8 - i32.add - i32.const 8 - i32.add - local.tee 9 - i32.const 0 - i32.store - local.get 2 - local.get 2 - i32.load offset=28 - i32.store offset=12 - local.get 2 - local.get 1 - i32.store offset=8 - local.get 2 - i32.const 8 - i32.add - local.get 6 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 5 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 4 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 3 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 7 - i32.wrap_i64 - call $>::from - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 8 - i32.wrap_i64 - i32.const 255 - i32.and - call $>::from - call $alloc::vec::Vec::push - local.get 0 - i32.const 8 - i32.add - local.get 9 - i32.load - i32.store - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store align=4 - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 2 - local.get 3 - call $::alloc - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - local.get 1 - local.get 3 - local.get 1 - i32.lt_u - select - local.tee 3 - i32.eqz - br_if 0 (;@1;) - local.get 2 - local.get 0 - local.get 3 - memory.copy - end - local.get 2 - ) - (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - local.tee 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.const 0 - local.get 0 - memory.fill - end - local.get 1 - ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) - return - ) - (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) - (local i32 i32) - block ;; label = @1 - local.get 1 - i32.const 16 - local.get 1 - i32.const 16 - i32.gt_u - select - local.tee 3 - local.get 3 - i32.const -1 - i32.add - i32.and - br_if 0 (;@1;) - local.get 2 - i32.const -2147483648 - local.get 1 - local.get 3 - call $core::ptr::alignment::Alignment::max - local.tee 1 - i32.sub - i32.gt_u - br_if 0 (;@1;) - i32.const 0 - local.set 3 - local.get 2 - local.get 1 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 1 - i32.sub - i32.and - local.set 2 - block ;; label = @2 - local.get 0 - i32.load - br_if 0 (;@2;) - local.get 0 - call $intrinsics::mem::heap_base - memory.size - i32.const 16 - i32.shl - i32.add - i32.store - end - block ;; label = @2 - local.get 2 - local.get 0 - i32.load - local.tee 4 - i32.const -1 - i32.xor - i32.gt_u - br_if 0 (;@2;) - local.get 0 - local.get 4 - local.get 2 - i32.add - i32.store - local.get 4 - local.get 1 - i32.add - local.set 3 - end - local.get 3 - return - end - unreachable - ) - (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) - unreachable - ) - (func $>::from (;9;) (type 8) (param i32) (result f32) - local.get 0 - f32.reinterpret_i32 - ) - (func $intrinsics::felt::as_u64 (;10;) (type 9) (param f32) (result i64) - unreachable - ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;11;) (type 10) (param i32 i32 i32 i32 i32 i32) - (local i32 i32 i32 i64) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 6 - global.set $__stack_pointer - i32.const 0 - local.set 7 - block ;; label = @1 - block ;; label = @2 - local.get 5 - i32.eqz - br_if 0 (;@2;) - local.get 2 - local.get 3 - i32.add - local.tee 3 - local.get 2 - i32.lt_u - br_if 1 (;@1;) - i32.const 0 - local.set 7 - local.get 4 - local.get 5 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 4 - i32.sub - i32.and - i64.extend_i32_u - local.get 3 - local.get 1 - i32.load - i32.const 1 - i32.shl - local.tee 8 - local.get 3 - local.get 8 - i32.gt_u - select - local.tee 8 - i32.const 8 - i32.const 4 - i32.const 1 - local.get 5 - i32.const 1025 - i32.lt_u - select - local.get 5 - i32.const 1 - i32.eq - select - local.tee 2 - local.get 8 - local.get 2 - i32.gt_u - select - local.tee 2 - i64.extend_i32_u - i64.mul - local.tee 9 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@2;) - local.get 9 - i32.wrap_i64 - local.tee 3 - i32.const -2147483648 - local.get 4 - i32.sub - i32.gt_u - br_if 1 (;@1;) - local.get 6 - i32.const 20 - i32.add - local.get 1 - local.get 4 - local.get 5 - call $alloc::raw_vec::RawVecInner::current_memory - local.get 6 - i32.const 8 - i32.add - local.get 4 - local.get 3 - local.get 6 - i32.const 20 - i32.add - local.get 0 - call $alloc::raw_vec::finish_grow - local.get 6 - i32.load offset=12 - local.set 7 - block ;; label = @3 - local.get 6 - i32.load offset=8 - i32.eqz - br_if 0 (;@3;) - local.get 6 - i32.load offset=16 - local.set 8 - br 2 (;@1;) - end - local.get 1 - local.get 2 - i32.store - local.get 1 - local.get 7 - i32.store offset=4 - i32.const -2147483647 - local.set 7 - br 1 (;@1;) - end - end - local.get 0 - local.get 8 - i32.store offset=4 - local.get 0 - local.get 7 - i32.store - local.get 6 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;12;) (type 11) (param i32 i32 i32 i32 i32) - (local i32 i64) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - block ;; label = @1 - block ;; label = @2 - block ;; label = @3 - local.get 3 - local.get 4 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 3 - i32.sub - i32.and - i64.extend_i32_u - local.get 1 - i64.extend_i32_u - i64.mul - local.tee 6 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@3;) - local.get 6 - i32.wrap_i64 - local.tee 4 - i32.const -2147483648 - local.get 3 - i32.sub - i32.le_u - br_if 1 (;@2;) - end - local.get 0 - i32.const 0 - i32.store offset=4 - i32.const 1 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - local.get 4 - br_if 0 (;@2;) - local.get 0 - local.get 3 - i32.store offset=8 - i32.const 0 - local.set 3 - local.get 0 - i32.const 0 - i32.store offset=4 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 2 - br_if 0 (;@3;) - local.get 5 - i32.const 8 - i32.add - local.get 3 - local.get 4 - call $::allocate - local.get 5 - i32.load offset=8 - local.set 2 - br 1 (;@2;) - end - local.get 5 - local.get 3 - local.get 4 - i32.const 1 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load - local.set 2 - end - block ;; label = @2 - local.get 2 - i32.eqz - br_if 0 (;@2;) - local.get 0 - local.get 2 - i32.store offset=8 - local.get 0 - local.get 1 - i32.store offset=4 - i32.const 0 - local.set 3 - br 1 (;@1;) - end - local.get 0 - local.get 4 - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - i32.const 1 - local.set 3 - end - local.get 0 - local.get 3 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;13;) (type 12) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 3 - i32.load offset=12 - local.set 2 - local.get 0 - local.get 3 - i32.load offset=8 - i32.store - local.get 0 - local.get 2 - i32.store offset=4 - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::alloc::Global::alloc_impl (;14;) (type 13) (param i32 i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @2 - local.get 3 - br_if 0 (;@2;) - local.get 2 - local.get 1 - call $__rustc::__rust_alloc - local.set 1 - br 1 (;@1;) - end - local.get 2 - local.get 1 - call $__rustc::__rust_alloc_zeroed - local.set 1 - end - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.store - ) - (func $alloc::raw_vec::RawVecInner::current_memory (;15;) (type 13) (param i32 i32 i32 i32) - (local i32 i32 i32) - i32.const 0 - local.set 4 - i32.const 4 - local.set 5 - block ;; label = @1 - local.get 3 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.load - local.tee 6 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.load offset=4 - i32.store - local.get 6 - local.get 3 - i32.mul - local.set 4 - i32.const 8 - local.set 5 - end - local.get 0 - local.get 5 - i32.add - local.get 4 - i32.store - ) - (func $alloc::raw_vec::finish_grow (;16;) (type 11) (param i32 i32 i32 i32 i32) - (local i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - i32.const 0 - local.set 6 - block ;; label = @1 - block ;; label = @2 - local.get 2 - i32.const 0 - i32.ge_s - br_if 0 (;@2;) - i32.const 1 - local.set 2 - i32.const 4 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 3 - i32.load offset=4 - i32.eqz - br_if 0 (;@3;) - block ;; label = @4 - local.get 3 - i32.load offset=8 - local.tee 6 - br_if 0 (;@4;) - local.get 5 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load offset=12 - local.set 6 - local.get 5 - i32.load offset=8 - local.set 3 - br 2 (;@2;) - end - local.get 3 - i32.load - local.get 6 - local.get 1 - local.get 2 - call $__rustc::__rust_realloc - local.set 3 - local.get 2 - local.set 6 - br 1 (;@2;) - end - local.get 5 - local.get 1 - local.get 2 - call $::allocate - local.get 5 - i32.load offset=4 - local.set 6 - local.get 5 - i32.load - local.set 3 - end - local.get 0 - local.get 3 - local.get 1 - local.get 3 - select - i32.store offset=4 - local.get 6 - local.get 2 - local.get 3 - select - local.set 6 - local.get 3 - i32.eqz - local.set 2 - i32.const 8 - local.set 3 - end - local.get 0 - local.get 3 - i32.add - local.get 6 - i32.store - local.get 0 - local.get 2 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::handle_error (;17;) (type 12) (param i32 i32 i32) - unreachable - ) - (func $core::ptr::alignment::Alignment::max (;18;) (type 3) (param i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 0 - local.get 1 - i32.gt_u - select - ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") -) diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.hir b/felt-repr/tests/expected/onchain_two_felts_struct.hir deleted file mode 100644 index a1d21fade..000000000 --- a/felt-repr/tests/expected/onchain_two_felts_struct.hir +++ /dev/null @@ -1,1241 +0,0 @@ -builtin.component root_ns:root@1.0.0 { - builtin.module public @onchain_two_felts_struct { - private builtin.function @alloc::vec::Vec::push(v0: i32, v1: felt) { - ^block4(v0: i32, v1: felt): - v4 = arith.constant 8 : u32; - v3 = hir.bitcast v0 : u32; - v5 = arith.add v3, v4 : u32 #[overflow = checked]; - v6 = arith.constant 4 : u32; - v7 = arith.mod v5, v6 : u32; - hir.assertz v7 #[code = 250]; - v8 = hir.int_to_ptr v5 : ptr; - v9 = hir.load v8 : i32; - v10 = hir.bitcast v0 : u32; - v921 = arith.constant 4 : u32; - v12 = arith.mod v10, v921 : u32; - hir.assertz v12 #[code = 250]; - v13 = hir.int_to_ptr v10 : ptr; - v14 = hir.load v13 : i32; - v2 = arith.constant 0 : i32; - v15 = arith.neq v9, v14 : i1; - v16 = arith.zext v15 : u32; - v17 = hir.bitcast v16 : i32; - v19 = arith.neq v17, v2 : i1; - scf.if v19{ - ^block94: - scf.yield ; - } else { - ^block7: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVec::grow_one(v0) - scf.yield ; - }; - v920 = arith.constant 4 : u32; - v21 = hir.bitcast v0 : u32; - v23 = arith.add v21, v920 : u32 #[overflow = checked]; - v919 = arith.constant 4 : u32; - v25 = arith.mod v23, v919 : u32; - hir.assertz v25 #[code = 250]; - v26 = hir.int_to_ptr v23 : ptr; - v27 = hir.load v26 : i32; - v911 = arith.constant 2 : u32; - v31 = arith.shl v9, v911 : i32; - v32 = arith.add v27, v31 : i32 #[overflow = wrapping]; - v34 = hir.bitcast v32 : u32; - v918 = arith.constant 4 : u32; - v36 = arith.mod v34, v918 : u32; - hir.assertz v36 #[code = 250]; - v37 = hir.int_to_ptr v34 : ptr; - hir.store v37, v1; - v917 = arith.constant 8 : u32; - v40 = hir.bitcast v0 : u32; - v42 = arith.add v40, v917 : u32 #[overflow = checked]; - v916 = arith.constant 4 : u32; - v44 = arith.mod v42, v916 : u32; - hir.assertz v44 #[code = 250]; - v38 = arith.constant 1 : i32; - v39 = arith.add v9, v38 : i32 #[overflow = wrapping]; - v45 = hir.int_to_ptr v42 : ptr; - hir.store v45, v39; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVec::grow_one(v46: i32) { - ^block8(v46: i32): - v48 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v49 = hir.bitcast v48 : ptr; - v50 = hir.load v49 : i32; - v51 = arith.constant 16 : i32; - v52 = arith.sub v50, v51 : i32 #[overflow = wrapping]; - v53 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v54 = hir.bitcast v53 : ptr; - hir.store v54, v52; - v57 = hir.bitcast v46 : u32; - v58 = arith.constant 4 : u32; - v59 = arith.mod v57, v58 : u32; - hir.assertz v59 #[code = 250]; - v60 = hir.int_to_ptr v57 : ptr; - v61 = hir.load v60 : i32; - v63 = arith.constant 4 : i32; - v62 = arith.constant 1 : i32; - v55 = arith.constant 8 : i32; - v56 = arith.add v52, v55 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::grow_amortized(v56, v46, v61, v62, v63, v63) - v66 = arith.constant 8 : u32; - v65 = hir.bitcast v52 : u32; - v67 = arith.add v65, v66 : u32 #[overflow = checked]; - v925 = arith.constant 4 : u32; - v69 = arith.mod v67, v925 : u32; - hir.assertz v69 #[code = 250]; - v70 = hir.int_to_ptr v67 : ptr; - v71 = hir.load v70 : i32; - v47 = arith.constant 0 : i32; - v72 = arith.constant -2147483647 : i32; - v73 = arith.eq v71, v72 : i1; - v74 = arith.zext v73 : u32; - v75 = hir.bitcast v74 : i32; - v77 = arith.neq v75, v47 : i1; - cf.cond_br v77 ^block10, ^block11; - ^block10: - v924 = arith.constant 16 : i32; - v87 = arith.add v52, v924 : i32 #[overflow = wrapping]; - v88 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v89 = hir.bitcast v88 : ptr; - hir.store v89, v87; - builtin.ret ; - ^block11: - v79 = arith.constant 12 : u32; - v78 = hir.bitcast v52 : u32; - v80 = arith.add v78, v79 : u32 #[overflow = checked]; - v923 = arith.constant 4 : u32; - v82 = arith.mod v80, v923 : u32; - hir.assertz v82 #[code = 250]; - v83 = hir.int_to_ptr v80 : ptr; - v84 = hir.load v83 : i32; - v85 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::handle_error(v71, v84, v85) - ub.unreachable ; - }; - - public builtin.function @entrypoint(v90: i32, v91: i32) { - ^block12(v90: i32, v91: i32): - v95 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v96 = hir.bitcast v95 : ptr; - v97 = hir.load v96 : i32; - v98 = arith.constant 32 : i32; - v99 = arith.sub v97, v98 : i32 #[overflow = wrapping]; - v100 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v101 = hir.bitcast v100 : ptr; - hir.store v101, v99; - v103 = arith.constant 4 : u32; - v102 = hir.bitcast v91 : u32; - v104 = arith.add v102, v103 : u32 #[overflow = checked]; - v948 = arith.constant 4 : u32; - v106 = arith.mod v104, v948 : u32; - hir.assertz v106 #[code = 250]; - v107 = hir.int_to_ptr v104 : ptr; - v108 = hir.load v107 : felt; - v109 = hir.bitcast v91 : u32; - v947 = arith.constant 4 : u32; - v111 = arith.mod v109, v947 : u32; - hir.assertz v111 #[code = 250]; - v112 = hir.int_to_ptr v109 : ptr; - v113 = hir.load v112 : felt; - v118 = arith.constant 4 : i32; - v92 = arith.constant 0 : i32; - v116 = arith.constant 256 : i32; - v114 = arith.constant 20 : i32; - v115 = arith.add v99, v114 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::try_allocate_in(v115, v116, v92, v118, v118) - v121 = arith.constant 24 : u32; - v120 = hir.bitcast v99 : u32; - v122 = arith.add v120, v121 : u32 #[overflow = checked]; - v946 = arith.constant 4 : u32; - v124 = arith.mod v122, v946 : u32; - hir.assertz v124 #[code = 250]; - v125 = hir.int_to_ptr v122 : ptr; - v126 = hir.load v125 : i32; - v128 = arith.constant 20 : u32; - v127 = hir.bitcast v99 : u32; - v129 = arith.add v127, v128 : u32 #[overflow = checked]; - v945 = arith.constant 4 : u32; - v131 = arith.mod v129, v945 : u32; - hir.assertz v131 #[code = 250]; - v132 = hir.int_to_ptr v129 : ptr; - v133 = hir.load v132 : i32; - v944 = arith.constant 0 : i32; - v134 = arith.constant 1 : i32; - v135 = arith.neq v133, v134 : i1; - v136 = arith.zext v135 : u32; - v137 = hir.bitcast v136 : i32; - v139 = arith.neq v137, v944 : i1; - cf.cond_br v139 ^block14, ^block15; - ^block14: - v943 = arith.constant 8 : i32; - v148 = arith.constant 8 : i32; - v149 = arith.add v99, v148 : i32 #[overflow = wrapping]; - v151 = arith.add v149, v943 : i32 #[overflow = wrapping]; - v153 = hir.bitcast v151 : u32; - v942 = arith.constant 4 : u32; - v155 = arith.mod v153, v942 : u32; - hir.assertz v155 #[code = 250]; - v941 = arith.constant 0 : i32; - v156 = hir.int_to_ptr v153 : ptr; - hir.store v156, v941; - v158 = arith.constant 28 : u32; - v157 = hir.bitcast v99 : u32; - v159 = arith.add v157, v158 : u32 #[overflow = checked]; - v940 = arith.constant 4 : u32; - v161 = arith.mod v159, v940 : u32; - hir.assertz v161 #[code = 250]; - v162 = hir.int_to_ptr v159 : ptr; - v163 = hir.load v162 : i32; - v165 = arith.constant 12 : u32; - v164 = hir.bitcast v99 : u32; - v166 = arith.add v164, v165 : u32 #[overflow = checked]; - v939 = arith.constant 4 : u32; - v168 = arith.mod v166, v939 : u32; - hir.assertz v168 #[code = 250]; - v169 = hir.int_to_ptr v166 : ptr; - hir.store v169, v163; - v171 = arith.constant 8 : u32; - v170 = hir.bitcast v99 : u32; - v172 = arith.add v170, v171 : u32 #[overflow = checked]; - v938 = arith.constant 4 : u32; - v174 = arith.mod v172, v938 : u32; - hir.assertz v174 #[code = 250]; - v175 = hir.int_to_ptr v172 : ptr; - hir.store v175, v126; - v937 = arith.constant 8 : i32; - v177 = arith.add v99, v937 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v177, v113) - v936 = arith.constant 8 : i32; - v179 = arith.add v99, v936 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::vec::Vec::push(v179, v108) - v182 = hir.bitcast v151 : u32; - v935 = arith.constant 4 : u32; - v184 = arith.mod v182, v935 : u32; - hir.assertz v184 #[code = 250]; - v185 = hir.int_to_ptr v182 : ptr; - v186 = hir.load v185 : i32; - v934 = arith.constant 8 : i32; - v181 = arith.add v90, v934 : i32 #[overflow = wrapping]; - v187 = hir.bitcast v181 : u32; - v933 = arith.constant 4 : u32; - v189 = arith.mod v187, v933 : u32; - hir.assertz v189 #[code = 250]; - v190 = hir.int_to_ptr v187 : ptr; - hir.store v190, v186; - v932 = arith.constant 8 : u32; - v191 = hir.bitcast v99 : u32; - v193 = arith.add v191, v932 : u32 #[overflow = checked]; - v931 = arith.constant 4 : u32; - v195 = arith.mod v193, v931 : u32; - hir.assertz v195 #[code = 250]; - v196 = hir.int_to_ptr v193 : ptr; - v197 = hir.load v196 : i64; - v198 = hir.bitcast v90 : u32; - v930 = arith.constant 4 : u32; - v200 = arith.mod v198, v930 : u32; - hir.assertz v200 #[code = 250]; - v201 = hir.int_to_ptr v198 : ptr; - hir.store v201, v197; - v929 = arith.constant 32 : i32; - v203 = arith.add v99, v929 : i32 #[overflow = wrapping]; - v204 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v205 = hir.bitcast v204 : ptr; - hir.store v205, v203; - builtin.ret ; - ^block15: - v928 = arith.constant 28 : u32; - v140 = hir.bitcast v99 : u32; - v142 = arith.add v140, v928 : u32 #[overflow = checked]; - v927 = arith.constant 4 : u32; - v144 = arith.mod v142, v927 : u32; - hir.assertz v144 #[code = 250]; - v145 = hir.int_to_ptr v142 : ptr; - v146 = hir.load v145 : i32; - v147 = arith.constant 1048588 : i32; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::handle_error(v126, v146, v147) - ub.unreachable ; - }; - - private builtin.function @__rustc::__rust_alloc(v206: i32, v207: i32) -> i32 { - ^block16(v206: i32, v207: i32): - v209 = arith.constant 1048604 : i32; - v210 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v209, v207, v206) : i32 - builtin.ret v210; - }; - - private builtin.function @__rustc::__rust_realloc(v211: i32, v212: i32, v213: i32, v214: i32) -> i32 { - ^block18(v211: i32, v212: i32, v213: i32, v214: i32): - v216 = arith.constant 1048604 : i32; - v217 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v216, v213, v214) : i32 - v957 = arith.constant 0 : i32; - v218 = arith.constant 0 : i32; - v219 = arith.eq v217, v218 : i1; - v220 = arith.zext v219 : u32; - v221 = hir.bitcast v220 : i32; - v223 = arith.neq v221, v957 : i1; - scf.if v223{ - ^block20: - scf.yield ; - } else { - ^block21: - v956 = arith.constant 0 : i32; - v225 = hir.bitcast v212 : u32; - v224 = hir.bitcast v214 : u32; - v226 = arith.lt v224, v225 : i1; - v227 = arith.zext v226 : u32; - v228 = hir.bitcast v227 : i32; - v230 = arith.neq v228, v956 : i1; - v231 = cf.select v230, v214, v212 : i32; - v954 = arith.constant 0 : i32; - v955 = arith.constant 0 : i32; - v233 = arith.eq v231, v955 : i1; - v234 = arith.zext v233 : u32; - v235 = hir.bitcast v234 : i32; - v237 = arith.neq v235, v954 : i1; - scf.if v237{ - ^block100: - scf.yield ; - } else { - ^block22: - v238 = hir.bitcast v231 : u32; - v239 = hir.bitcast v217 : u32; - v240 = hir.int_to_ptr v239 : ptr; - v241 = hir.bitcast v211 : u32; - v242 = hir.int_to_ptr v241 : ptr; - hir.mem_cpy v242, v240, v238; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v217; - }; - - private builtin.function @__rustc::__rust_alloc_zeroed(v244: i32, v245: i32) -> i32 { - ^block23(v244: i32, v245: i32): - v247 = arith.constant 1048604 : i32; - v248 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::alloc(v247, v245, v244) : i32 - v966 = arith.constant 0 : i32; - v249 = arith.constant 0 : i32; - v250 = arith.eq v248, v249 : i1; - v251 = arith.zext v250 : u32; - v252 = hir.bitcast v251 : i32; - v254 = arith.neq v252, v966 : i1; - scf.if v254{ - ^block25: - scf.yield ; - } else { - ^block26: - v964 = arith.constant 0 : i32; - v965 = arith.constant 0 : i32; - v256 = arith.eq v244, v965 : i1; - v257 = arith.zext v256 : u32; - v258 = hir.bitcast v257 : i32; - v260 = arith.neq v258, v964 : i1; - scf.if v260{ - ^block103: - scf.yield ; - } else { - ^block27: - v958 = arith.constant 0 : u8; - v263 = hir.bitcast v244 : u32; - v264 = hir.bitcast v248 : u32; - v265 = hir.int_to_ptr v264 : ptr; - hir.mem_set v265, v263, v958; - scf.yield ; - }; - scf.yield ; - }; - builtin.ret v248; - }; - - private builtin.function @__rustc::__rust_no_alloc_shim_is_unstable_v2() { - ^block28: - builtin.ret ; - }; - - private builtin.function @::alloc(v267: i32, v268: i32, v269: i32) -> i32 { - ^block30(v267: i32, v268: i32, v269: i32): - v272 = arith.constant 16 : i32; - v271 = arith.constant 0 : i32; - v968 = arith.constant 16 : u32; - v274 = hir.bitcast v268 : u32; - v276 = arith.gt v274, v968 : i1; - v277 = arith.zext v276 : u32; - v278 = hir.bitcast v277 : i32; - v280 = arith.neq v278, v271 : i1; - v281 = cf.select v280, v268, v272 : i32; - v1008 = arith.constant 0 : i32; - v282 = arith.constant -1 : i32; - v283 = arith.add v281, v282 : i32 #[overflow = wrapping]; - v284 = arith.band v281, v283 : i32; - v286 = arith.neq v284, v1008 : i1; - v977, v978 = scf.if v286 : i32, u32 { - ^block108: - v969 = arith.constant 0 : u32; - v973 = ub.poison i32 : i32; - scf.yield v973, v969; - } else { - ^block33: - v288 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/core::ptr::alignment::Alignment::max(v268, v281) : i32 - v1007 = arith.constant 0 : i32; - v287 = arith.constant -2147483648 : i32; - v289 = arith.sub v287, v288 : i32 #[overflow = wrapping]; - v291 = hir.bitcast v289 : u32; - v290 = hir.bitcast v269 : u32; - v292 = arith.gt v290, v291 : i1; - v293 = arith.zext v292 : u32; - v294 = hir.bitcast v293 : i32; - v296 = arith.neq v294, v1007 : i1; - v992 = scf.if v296 : i32 { - ^block107: - v1006 = ub.poison i32 : i32; - scf.yield v1006; - } else { - ^block34: - v1004 = arith.constant 0 : i32; - v302 = arith.sub v1004, v288 : i32 #[overflow = wrapping]; - v1005 = arith.constant -1 : i32; - v298 = arith.add v269, v288 : i32 #[overflow = wrapping]; - v300 = arith.add v298, v1005 : i32 #[overflow = wrapping]; - v303 = arith.band v300, v302 : i32; - v304 = hir.bitcast v267 : u32; - v305 = arith.constant 4 : u32; - v306 = arith.mod v304, v305 : u32; - hir.assertz v306 #[code = 250]; - v307 = hir.int_to_ptr v304 : ptr; - v308 = hir.load v307 : i32; - v1003 = arith.constant 0 : i32; - v310 = arith.neq v308, v1003 : i1; - scf.if v310{ - ^block106: - scf.yield ; - } else { - ^block36: - v311 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/intrinsics::mem::heap_base() : i32 - v312 = hir.mem_size : u32; - v318 = hir.bitcast v267 : u32; - v1002 = arith.constant 4 : u32; - v320 = arith.mod v318, v1002 : u32; - hir.assertz v320 #[code = 250]; - v1001 = arith.constant 16 : u32; - v313 = hir.bitcast v312 : i32; - v316 = arith.shl v313, v1001 : i32; - v317 = arith.add v311, v316 : i32 #[overflow = wrapping]; - v321 = hir.int_to_ptr v318 : ptr; - hir.store v321, v317; - scf.yield ; - }; - v324 = hir.bitcast v267 : u32; - v1000 = arith.constant 4 : u32; - v326 = arith.mod v324, v1000 : u32; - hir.assertz v326 #[code = 250]; - v327 = hir.int_to_ptr v324 : ptr; - v328 = hir.load v327 : i32; - v998 = arith.constant 0 : i32; - v999 = arith.constant -1 : i32; - v330 = arith.bxor v328, v999 : i32; - v332 = hir.bitcast v330 : u32; - v331 = hir.bitcast v303 : u32; - v333 = arith.gt v331, v332 : i1; - v334 = arith.zext v333 : u32; - v335 = hir.bitcast v334 : i32; - v337 = arith.neq v335, v998 : i1; - v991 = scf.if v337 : i32 { - ^block37: - v997 = arith.constant 0 : i32; - scf.yield v997; - } else { - ^block38: - v339 = hir.bitcast v267 : u32; - v996 = arith.constant 4 : u32; - v341 = arith.mod v339, v996 : u32; - hir.assertz v341 #[code = 250]; - v338 = arith.add v328, v303 : i32 #[overflow = wrapping]; - v342 = hir.int_to_ptr v339 : ptr; - hir.store v342, v338; - v344 = arith.add v328, v288 : i32 #[overflow = wrapping]; - scf.yield v344; - }; - scf.yield v991; - }; - v974 = arith.constant 1 : u32; - v995 = arith.constant 0 : u32; - v993 = cf.select v296, v995, v974 : u32; - scf.yield v992, v993; - }; - v994 = arith.constant 0 : u32; - v990 = arith.eq v978, v994 : i1; - cf.cond_br v990 ^block32, ^block110(v977); - ^block32: - ub.unreachable ; - ^block110(v970: i32): - builtin.ret v970; - }; - - private builtin.function @intrinsics::mem::heap_base() -> i32 { - ^block39: - v347 = hir.exec @intrinsics/mem/heap_base() : i32 - builtin.ret v347; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::grow_amortized(v349: i32, v350: i32, v351: i32, v352: i32, v353: i32, v354: i32) { - ^block43(v349: i32, v350: i32, v351: i32, v352: i32, v353: i32, v354: i32): - v357 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v358 = hir.bitcast v357 : ptr; - v359 = hir.load v358 : i32; - v360 = arith.constant 32 : i32; - v361 = arith.sub v359, v360 : i32 #[overflow = wrapping]; - v362 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v363 = hir.bitcast v362 : ptr; - hir.store v363, v361; - v1085 = arith.constant 0 : i32; - v355 = arith.constant 0 : i32; - v366 = arith.eq v354, v355 : i1; - v367 = arith.zext v366 : u32; - v368 = hir.bitcast v367 : i32; - v370 = arith.neq v368, v1085 : i1; - v1056, v1057 = scf.if v370 : i32, i32 { - ^block46: - v1084 = arith.constant 0 : i32; - scf.yield v1084, v1084; - } else { - ^block47: - v371 = arith.add v351, v352 : i32 #[overflow = wrapping]; - v1083 = arith.constant 0 : i32; - v373 = hir.bitcast v351 : u32; - v372 = hir.bitcast v371 : u32; - v374 = arith.lt v372, v373 : i1; - v375 = arith.zext v374 : u32; - v376 = hir.bitcast v375 : i32; - v378 = arith.neq v376, v1083 : i1; - v1054, v1055 = scf.if v378 : i32, i32 { - ^block116: - v1082 = arith.constant 0 : i32; - scf.yield v1082, v1082; - } else { - ^block48: - v389 = hir.bitcast v350 : u32; - v503 = arith.constant 4 : u32; - v391 = arith.mod v389, v503 : u32; - hir.assertz v391 #[code = 250]; - v392 = hir.int_to_ptr v389 : ptr; - v393 = hir.load v392 : i32; - v1010 = arith.constant 1 : u32; - v396 = arith.shl v393, v1010 : i32; - v1081 = arith.constant 0 : i32; - v398 = hir.bitcast v396 : u32; - v397 = hir.bitcast v371 : u32; - v399 = arith.gt v397, v398 : i1; - v400 = arith.zext v399 : u32; - v401 = hir.bitcast v400 : i32; - v403 = arith.neq v401, v1081 : i1; - v404 = cf.select v403, v371, v396 : i32; - v1078 = arith.constant 1 : i32; - v406 = arith.constant 4 : i32; - v1079 = arith.constant 0 : i32; - v1009 = arith.constant 1025 : u32; - v409 = hir.bitcast v354 : u32; - v411 = arith.lt v409, v1009 : i1; - v412 = arith.zext v411 : u32; - v413 = hir.bitcast v412 : i32; - v415 = arith.neq v413, v1079 : i1; - v416 = cf.select v415, v406, v1078 : i32; - v405 = arith.constant 8 : i32; - v1080 = arith.constant 0 : i32; - v394 = arith.constant 1 : i32; - v418 = arith.eq v354, v394 : i1; - v419 = arith.zext v418 : u32; - v420 = hir.bitcast v419 : i32; - v422 = arith.neq v420, v1080 : i1; - v423 = cf.select v422, v405, v416 : i32; - v1077 = arith.constant 0 : i32; - v425 = hir.bitcast v423 : u32; - v424 = hir.bitcast v404 : u32; - v426 = arith.gt v424, v425 : i1; - v427 = arith.zext v426 : u32; - v428 = hir.bitcast v427 : i32; - v430 = arith.neq v428, v1077 : i1; - v431 = cf.select v430, v404, v423 : i32; - v432 = hir.bitcast v431 : u32; - v433 = arith.zext v432 : u64; - v434 = hir.bitcast v433 : i64; - v1076 = arith.constant 0 : i32; - v384 = arith.sub v1076, v353 : i32 #[overflow = wrapping]; - v381 = arith.constant -1 : i32; - v380 = arith.add v353, v354 : i32 #[overflow = wrapping]; - v382 = arith.add v380, v381 : i32 #[overflow = wrapping]; - v385 = arith.band v382, v384 : i32; - v386 = hir.bitcast v385 : u32; - v387 = arith.zext v386 : u64; - v388 = hir.bitcast v387 : i64; - v435 = arith.mul v388, v434 : i64 #[overflow = wrapping]; - v1075 = arith.constant 0 : i32; - v436 = arith.constant 32 : i64; - v438 = hir.cast v436 : u32; - v437 = hir.bitcast v435 : u64; - v439 = arith.shr v437, v438 : u64; - v440 = hir.bitcast v439 : i64; - v441 = arith.trunc v440 : i32; - v443 = arith.neq v441, v1075 : i1; - v1052, v1053 = scf.if v443 : i32, i32 { - ^block115: - v1074 = arith.constant 0 : i32; - scf.yield v404, v1074; - } else { - ^block49: - v444 = arith.trunc v435 : i32; - v1073 = arith.constant 0 : i32; - v445 = arith.constant -2147483648 : i32; - v446 = arith.sub v445, v353 : i32 #[overflow = wrapping]; - v448 = hir.bitcast v446 : u32; - v447 = hir.bitcast v444 : u32; - v449 = arith.gt v447, v448 : i1; - v450 = arith.zext v449 : u32; - v451 = hir.bitcast v450 : i32; - v453 = arith.neq v451, v1073 : i1; - v1050, v1051 = scf.if v453 : i32, i32 { - ^block114: - v1072 = arith.constant 0 : i32; - scf.yield v404, v1072; - } else { - ^block50: - v454 = arith.constant 20 : i32; - v455 = arith.add v361, v454 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::RawVecInner::current_memory(v455, v350, v353, v354) - v1070 = arith.constant 20 : i32; - v459 = arith.add v361, v1070 : i32 #[overflow = wrapping]; - v1071 = arith.constant 8 : i32; - v457 = arith.add v361, v1071 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::raw_vec::finish_grow(v457, v353, v444, v459, v349) - v461 = arith.constant 12 : u32; - v460 = hir.bitcast v361 : u32; - v462 = arith.add v460, v461 : u32 #[overflow = checked]; - v1069 = arith.constant 4 : u32; - v464 = arith.mod v462, v1069 : u32; - hir.assertz v464 #[code = 250]; - v465 = hir.int_to_ptr v462 : ptr; - v466 = hir.load v465 : i32; - v468 = arith.constant 8 : u32; - v467 = hir.bitcast v361 : u32; - v469 = arith.add v467, v468 : u32 #[overflow = checked]; - v1068 = arith.constant 4 : u32; - v471 = arith.mod v469, v1068 : u32; - hir.assertz v471 #[code = 250]; - v472 = hir.int_to_ptr v469 : ptr; - v473 = hir.load v472 : i32; - v1066 = arith.constant 0 : i32; - v1067 = arith.constant 0 : i32; - v475 = arith.eq v473, v1067 : i1; - v476 = arith.zext v475 : u32; - v477 = hir.bitcast v476 : i32; - v479 = arith.neq v477, v1066 : i1; - v1048 = scf.if v479 : i32 { - ^block51: - v487 = hir.bitcast v350 : u32; - v1065 = arith.constant 4 : u32; - v489 = arith.mod v487, v1065 : u32; - hir.assertz v489 #[code = 250]; - v490 = hir.int_to_ptr v487 : ptr; - hir.store v490, v431; - v1064 = arith.constant 4 : u32; - v491 = hir.bitcast v350 : u32; - v493 = arith.add v491, v1064 : u32 #[overflow = checked]; - v1063 = arith.constant 4 : u32; - v495 = arith.mod v493, v1063 : u32; - hir.assertz v495 #[code = 250]; - v496 = hir.int_to_ptr v493 : ptr; - hir.store v496, v466; - scf.yield v404; - } else { - ^block52: - v481 = arith.constant 16 : u32; - v480 = hir.bitcast v361 : u32; - v482 = arith.add v480, v481 : u32 #[overflow = checked]; - v1062 = arith.constant 4 : u32; - v484 = arith.mod v482, v1062 : u32; - hir.assertz v484 #[code = 250]; - v485 = hir.int_to_ptr v482 : ptr; - v486 = hir.load v485 : i32; - scf.yield v486; - }; - v497 = arith.constant -2147483647 : i32; - v1049 = cf.select v479, v497, v466 : i32; - scf.yield v1048, v1049; - }; - scf.yield v1050, v1051; - }; - scf.yield v1052, v1053; - }; - scf.yield v1054, v1055; - }; - v1061 = arith.constant 4 : u32; - v502 = hir.bitcast v349 : u32; - v504 = arith.add v502, v1061 : u32 #[overflow = checked]; - v1060 = arith.constant 4 : u32; - v506 = arith.mod v504, v1060 : u32; - hir.assertz v506 #[code = 250]; - v507 = hir.int_to_ptr v504 : ptr; - hir.store v507, v1056; - v510 = hir.bitcast v349 : u32; - v1059 = arith.constant 4 : u32; - v512 = arith.mod v510, v1059 : u32; - hir.assertz v512 #[code = 250]; - v513 = hir.int_to_ptr v510 : ptr; - hir.store v513, v1057; - v1058 = arith.constant 32 : i32; - v517 = arith.add v361, v1058 : i32 #[overflow = wrapping]; - v518 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v519 = hir.bitcast v518 : ptr; - hir.store v519, v517; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::try_allocate_in(v520: i32, v521: i32, v522: i32, v523: i32, v524: i32) { - ^block53(v520: i32, v521: i32, v522: i32, v523: i32, v524: i32): - v527 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v528 = hir.bitcast v527 : ptr; - v529 = hir.load v528 : i32; - v530 = arith.constant 16 : i32; - v531 = arith.sub v529, v530 : i32 #[overflow = wrapping]; - v532 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v533 = hir.bitcast v532 : ptr; - hir.store v533, v531; - v543 = hir.bitcast v521 : u32; - v544 = arith.zext v543 : u64; - v545 = hir.bitcast v544 : i64; - v525 = arith.constant 0 : i32; - v538 = arith.sub v525, v523 : i32 #[overflow = wrapping]; - v535 = arith.constant -1 : i32; - v534 = arith.add v523, v524 : i32 #[overflow = wrapping]; - v536 = arith.add v534, v535 : i32 #[overflow = wrapping]; - v539 = arith.band v536, v538 : i32; - v540 = hir.bitcast v539 : u32; - v541 = arith.zext v540 : u64; - v542 = hir.bitcast v541 : i64; - v546 = arith.mul v542, v545 : i64 #[overflow = wrapping]; - v1189 = arith.constant 0 : i32; - v547 = arith.constant 32 : i64; - v549 = hir.cast v547 : u32; - v548 = hir.bitcast v546 : u64; - v550 = arith.shr v548, v549 : u64; - v551 = hir.bitcast v550 : i64; - v552 = arith.trunc v551 : i32; - v554 = arith.neq v552, v1189 : i1; - v1101, v1102, v1103, v1104, v1105, v1106 = scf.if v554 : i32, i32, i32, i32, i32, u32 { - ^block122: - v1086 = arith.constant 0 : u32; - v1093 = ub.poison i32 : i32; - scf.yield v520, v531, v1093, v1093, v1093, v1086; - } else { - ^block58: - v555 = arith.trunc v546 : i32; - v1188 = arith.constant 0 : i32; - v556 = arith.constant -2147483648 : i32; - v557 = arith.sub v556, v523 : i32 #[overflow = wrapping]; - v559 = hir.bitcast v557 : u32; - v558 = hir.bitcast v555 : u32; - v560 = arith.lte v558, v559 : i1; - v561 = arith.zext v560 : u32; - v562 = hir.bitcast v561 : i32; - v564 = arith.neq v562, v1188 : i1; - v1149 = scf.if v564 : i32 { - ^block56: - v1187 = arith.constant 0 : i32; - v575 = arith.neq v555, v1187 : i1; - v1148 = scf.if v575 : i32 { - ^block60: - v1186 = arith.constant 0 : i32; - v591 = arith.neq v522, v1186 : i1; - v1147 = scf.if v591 : i32 { - ^block63: - v573 = arith.constant 1 : i32; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v531, v523, v555, v573) - v602 = hir.bitcast v531 : u32; - v647 = arith.constant 4 : u32; - v604 = arith.mod v602, v647 : u32; - hir.assertz v604 #[code = 250]; - v605 = hir.int_to_ptr v602 : ptr; - v606 = hir.load v605 : i32; - scf.yield v606; - } else { - ^block64: - v592 = arith.constant 8 : i32; - v593 = arith.add v531, v592 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v593, v523, v555) - v577 = arith.constant 8 : u32; - v594 = hir.bitcast v531 : u32; - v596 = arith.add v594, v577 : u32 #[overflow = checked]; - v1185 = arith.constant 4 : u32; - v598 = arith.mod v596, v1185 : u32; - hir.assertz v598 #[code = 250]; - v599 = hir.int_to_ptr v596 : ptr; - v600 = hir.load v599 : i32; - scf.yield v600; - }; - v1183 = arith.constant 0 : i32; - v1184 = arith.constant 0 : i32; - v609 = arith.eq v1147, v1184 : i1; - v610 = arith.zext v609 : u32; - v611 = hir.bitcast v610 : i32; - v613 = arith.neq v611, v1183 : i1; - scf.if v613{ - ^block65: - v1182 = arith.constant 8 : u32; - v630 = hir.bitcast v520 : u32; - v632 = arith.add v630, v1182 : u32 #[overflow = checked]; - v1181 = arith.constant 4 : u32; - v634 = arith.mod v632, v1181 : u32; - hir.assertz v634 #[code = 250]; - v635 = hir.int_to_ptr v632 : ptr; - hir.store v635, v555; - v1180 = arith.constant 4 : u32; - v637 = hir.bitcast v520 : u32; - v639 = arith.add v637, v1180 : u32 #[overflow = checked]; - v1179 = arith.constant 4 : u32; - v641 = arith.mod v639, v1179 : u32; - hir.assertz v641 #[code = 250]; - v642 = hir.int_to_ptr v639 : ptr; - hir.store v642, v523; - scf.yield ; - } else { - ^block66: - v1178 = arith.constant 8 : u32; - v615 = hir.bitcast v520 : u32; - v617 = arith.add v615, v1178 : u32 #[overflow = checked]; - v1177 = arith.constant 4 : u32; - v619 = arith.mod v617, v1177 : u32; - hir.assertz v619 #[code = 250]; - v620 = hir.int_to_ptr v617 : ptr; - hir.store v620, v1147; - v1176 = arith.constant 4 : u32; - v622 = hir.bitcast v520 : u32; - v624 = arith.add v622, v1176 : u32 #[overflow = checked]; - v1175 = arith.constant 4 : u32; - v626 = arith.mod v624, v1175 : u32; - hir.assertz v626 #[code = 250]; - v627 = hir.int_to_ptr v624 : ptr; - hir.store v627, v521; - scf.yield ; - }; - v1173 = arith.constant 0 : i32; - v1174 = arith.constant 1 : i32; - v1146 = cf.select v613, v1174, v1173 : i32; - scf.yield v1146; - } else { - ^block61: - v1172 = arith.constant 8 : u32; - v576 = hir.bitcast v520 : u32; - v578 = arith.add v576, v1172 : u32 #[overflow = checked]; - v1171 = arith.constant 4 : u32; - v580 = arith.mod v578, v1171 : u32; - hir.assertz v580 #[code = 250]; - v581 = hir.int_to_ptr v578 : ptr; - hir.store v581, v523; - v1170 = arith.constant 4 : u32; - v584 = hir.bitcast v520 : u32; - v586 = arith.add v584, v1170 : u32 #[overflow = checked]; - v1169 = arith.constant 4 : u32; - v588 = arith.mod v586, v1169 : u32; - hir.assertz v588 #[code = 250]; - v1168 = arith.constant 0 : i32; - v589 = hir.int_to_ptr v586 : ptr; - hir.store v589, v1168; - v1167 = arith.constant 0 : i32; - scf.yield v1167; - }; - scf.yield v1148; - } else { - ^block59: - v1166 = ub.poison i32 : i32; - scf.yield v1166; - }; - v1161 = arith.constant 0 : u32; - v1094 = arith.constant 1 : u32; - v1154 = cf.select v564, v1094, v1161 : u32; - v1162 = ub.poison i32 : i32; - v1153 = cf.select v564, v531, v1162 : i32; - v1163 = ub.poison i32 : i32; - v1152 = cf.select v564, v520, v1163 : i32; - v1164 = ub.poison i32 : i32; - v1151 = cf.select v564, v1164, v531 : i32; - v1165 = ub.poison i32 : i32; - v1150 = cf.select v564, v1165, v520 : i32; - scf.yield v1150, v1151, v1152, v1149, v1153, v1154; - }; - v1107, v1108, v1109 = scf.index_switch v1106 : i32, i32, i32 - case 0 { - ^block57: - v1160 = arith.constant 4 : u32; - v567 = hir.bitcast v1101 : u32; - v569 = arith.add v567, v1160 : u32 #[overflow = checked]; - v1159 = arith.constant 4 : u32; - v571 = arith.mod v569, v1159 : u32; - hir.assertz v571 #[code = 250]; - v1158 = arith.constant 0 : i32; - v572 = hir.int_to_ptr v569 : ptr; - hir.store v572, v1158; - v1157 = arith.constant 1 : i32; - scf.yield v1101, v1157, v1102; - } - default { - ^block126: - scf.yield v1103, v1104, v1105; - }; - v646 = hir.bitcast v1107 : u32; - v1156 = arith.constant 4 : u32; - v648 = arith.mod v646, v1156 : u32; - hir.assertz v648 #[code = 250]; - v649 = hir.int_to_ptr v646 : ptr; - hir.store v649, v1108; - v1155 = arith.constant 16 : i32; - v654 = arith.add v1109, v1155 : i32 #[overflow = wrapping]; - v655 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v656 = hir.bitcast v655 : ptr; - hir.store v656, v654; - builtin.ret ; - }; - - private builtin.function @::allocate(v657: i32, v658: i32, v659: i32) { - ^block67(v657: i32, v658: i32, v659: i32): - v661 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v662 = hir.bitcast v661 : ptr; - v663 = hir.load v662 : i32; - v664 = arith.constant 16 : i32; - v665 = arith.sub v663, v664 : i32 #[overflow = wrapping]; - v666 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v667 = hir.bitcast v666 : ptr; - hir.store v667, v665; - v660 = arith.constant 0 : i32; - v668 = arith.constant 8 : i32; - v669 = arith.add v665, v668 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v669, v658, v659, v660) - v672 = arith.constant 12 : u32; - v671 = hir.bitcast v665 : u32; - v673 = arith.add v671, v672 : u32 #[overflow = checked]; - v674 = arith.constant 4 : u32; - v675 = arith.mod v673, v674 : u32; - hir.assertz v675 #[code = 250]; - v676 = hir.int_to_ptr v673 : ptr; - v677 = hir.load v676 : i32; - v679 = arith.constant 8 : u32; - v678 = hir.bitcast v665 : u32; - v680 = arith.add v678, v679 : u32 #[overflow = checked]; - v1194 = arith.constant 4 : u32; - v682 = arith.mod v680, v1194 : u32; - hir.assertz v682 #[code = 250]; - v683 = hir.int_to_ptr v680 : ptr; - v684 = hir.load v683 : i32; - v685 = hir.bitcast v657 : u32; - v1193 = arith.constant 4 : u32; - v687 = arith.mod v685, v1193 : u32; - hir.assertz v687 #[code = 250]; - v688 = hir.int_to_ptr v685 : ptr; - hir.store v688, v684; - v1192 = arith.constant 4 : u32; - v689 = hir.bitcast v657 : u32; - v691 = arith.add v689, v1192 : u32 #[overflow = checked]; - v1191 = arith.constant 4 : u32; - v693 = arith.mod v691, v1191 : u32; - hir.assertz v693 #[code = 250]; - v694 = hir.int_to_ptr v691 : ptr; - hir.store v694, v677; - v1190 = arith.constant 16 : i32; - v696 = arith.add v665, v1190 : i32 #[overflow = wrapping]; - v697 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v698 = hir.bitcast v697 : ptr; - hir.store v698, v696; - builtin.ret ; - }; - - private builtin.function @alloc::alloc::Global::alloc_impl(v699: i32, v700: i32, v701: i32, v702: i32) { - ^block69(v699: i32, v700: i32, v701: i32, v702: i32): - v1210 = arith.constant 0 : i32; - v703 = arith.constant 0 : i32; - v704 = arith.eq v701, v703 : i1; - v705 = arith.zext v704 : u32; - v706 = hir.bitcast v705 : i32; - v708 = arith.neq v706, v1210 : i1; - v1206 = scf.if v708 : i32 { - ^block129: - scf.yield v700; - } else { - ^block72: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_no_alloc_shim_is_unstable_v2() - v1209 = arith.constant 0 : i32; - v710 = arith.neq v702, v1209 : i1; - v1205 = scf.if v710 : i32 { - ^block73: - v712 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc_zeroed(v701, v700) : i32 - scf.yield v712; - } else { - ^block74: - v711 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_alloc(v701, v700) : i32 - scf.yield v711; - }; - scf.yield v1205; - }; - v716 = arith.constant 4 : u32; - v715 = hir.bitcast v699 : u32; - v717 = arith.add v715, v716 : u32 #[overflow = checked]; - v1208 = arith.constant 4 : u32; - v719 = arith.mod v717, v1208 : u32; - hir.assertz v719 #[code = 250]; - v720 = hir.int_to_ptr v717 : ptr; - hir.store v720, v701; - v722 = hir.bitcast v699 : u32; - v1207 = arith.constant 4 : u32; - v724 = arith.mod v722, v1207 : u32; - hir.assertz v724 #[code = 250]; - v725 = hir.int_to_ptr v722 : ptr; - hir.store v725, v1206; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::RawVecInner::current_memory(v726: i32, v727: i32, v728: i32, v729: i32) { - ^block75(v726: i32, v727: i32, v728: i32, v729: i32): - v1236 = arith.constant 0 : i32; - v730 = arith.constant 0 : i32; - v734 = arith.eq v729, v730 : i1; - v735 = arith.zext v734 : u32; - v736 = hir.bitcast v735 : i32; - v738 = arith.neq v736, v1236 : i1; - v1223, v1224 = scf.if v738 : i32, i32 { - ^block133: - v1235 = arith.constant 0 : i32; - v732 = arith.constant 4 : i32; - scf.yield v732, v1235; - } else { - ^block78: - v739 = hir.bitcast v727 : u32; - v774 = arith.constant 4 : u32; - v741 = arith.mod v739, v774 : u32; - hir.assertz v741 #[code = 250]; - v742 = hir.int_to_ptr v739 : ptr; - v743 = hir.load v742 : i32; - v1233 = arith.constant 0 : i32; - v1234 = arith.constant 0 : i32; - v745 = arith.eq v743, v1234 : i1; - v746 = arith.zext v745 : u32; - v747 = hir.bitcast v746 : i32; - v749 = arith.neq v747, v1233 : i1; - v1221 = scf.if v749 : i32 { - ^block132: - v1232 = arith.constant 0 : i32; - scf.yield v1232; - } else { - ^block79: - v1231 = arith.constant 4 : u32; - v750 = hir.bitcast v726 : u32; - v752 = arith.add v750, v1231 : u32 #[overflow = checked]; - v1230 = arith.constant 4 : u32; - v754 = arith.mod v752, v1230 : u32; - hir.assertz v754 #[code = 250]; - v755 = hir.int_to_ptr v752 : ptr; - hir.store v755, v728; - v1229 = arith.constant 4 : u32; - v756 = hir.bitcast v727 : u32; - v758 = arith.add v756, v1229 : u32 #[overflow = checked]; - v1228 = arith.constant 4 : u32; - v760 = arith.mod v758, v1228 : u32; - hir.assertz v760 #[code = 250]; - v761 = hir.int_to_ptr v758 : ptr; - v762 = hir.load v761 : i32; - v763 = hir.bitcast v726 : u32; - v1227 = arith.constant 4 : u32; - v765 = arith.mod v763, v1227 : u32; - hir.assertz v765 #[code = 250]; - v766 = hir.int_to_ptr v763 : ptr; - hir.store v766, v762; - v767 = arith.mul v743, v729 : i32 #[overflow = wrapping]; - scf.yield v767; - }; - v768 = arith.constant 8 : i32; - v1226 = arith.constant 4 : i32; - v1222 = cf.select v749, v1226, v768 : i32; - scf.yield v1222, v1221; - }; - v771 = arith.add v726, v1223 : i32 #[overflow = wrapping]; - v773 = hir.bitcast v771 : u32; - v1225 = arith.constant 4 : u32; - v775 = arith.mod v773, v1225 : u32; - hir.assertz v775 #[code = 250]; - v776 = hir.int_to_ptr v773 : ptr; - hir.store v776, v1224; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::finish_grow(v777: i32, v778: i32, v779: i32, v780: i32, v781: i32) { - ^block80(v777: i32, v778: i32, v779: i32, v780: i32, v781: i32): - v783 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v784 = hir.bitcast v783 : ptr; - v785 = hir.load v784 : i32; - v786 = arith.constant 16 : i32; - v787 = arith.sub v785, v786 : i32 #[overflow = wrapping]; - v788 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v789 = hir.bitcast v788 : ptr; - hir.store v789, v787; - v1291 = arith.constant 0 : i32; - v782 = arith.constant 0 : i32; - v792 = arith.gte v779, v782 : i1; - v793 = arith.zext v792 : u32; - v794 = hir.bitcast v793 : i32; - v796 = arith.neq v794, v1291 : i1; - v1265, v1266 = scf.if v796 : i32, i32 { - ^block83: - v883 = arith.constant 4 : u32; - v799 = hir.bitcast v780 : u32; - v801 = arith.add v799, v883 : u32 #[overflow = checked]; - v1290 = arith.constant 4 : u32; - v803 = arith.mod v801, v1290 : u32; - hir.assertz v803 #[code = 250]; - v804 = hir.int_to_ptr v801 : ptr; - v805 = hir.load v804 : i32; - v1288 = arith.constant 0 : i32; - v1289 = arith.constant 0 : i32; - v807 = arith.eq v805, v1289 : i1; - v808 = arith.zext v807 : u32; - v809 = hir.bitcast v808 : i32; - v811 = arith.neq v809, v1288 : i1; - v1263, v1264 = scf.if v811 : i32, i32 { - ^block86: - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/::allocate(v787, v778, v779) - v1287 = arith.constant 4 : u32; - v844 = hir.bitcast v787 : u32; - v846 = arith.add v844, v1287 : u32 #[overflow = checked]; - v1286 = arith.constant 4 : u32; - v848 = arith.mod v846, v1286 : u32; - hir.assertz v848 #[code = 250]; - v849 = hir.int_to_ptr v846 : ptr; - v850 = hir.load v849 : i32; - v851 = hir.bitcast v787 : u32; - v1285 = arith.constant 4 : u32; - v853 = arith.mod v851, v1285 : u32; - hir.assertz v853 #[code = 250]; - v854 = hir.int_to_ptr v851 : ptr; - v855 = hir.load v854 : i32; - scf.yield v855, v850; - } else { - ^block87: - v813 = arith.constant 8 : u32; - v812 = hir.bitcast v780 : u32; - v814 = arith.add v812, v813 : u32 #[overflow = checked]; - v1284 = arith.constant 4 : u32; - v816 = arith.mod v814, v1284 : u32; - hir.assertz v816 #[code = 250]; - v817 = hir.int_to_ptr v814 : ptr; - v818 = hir.load v817 : i32; - v1283 = arith.constant 0 : i32; - v820 = arith.neq v818, v1283 : i1; - v1261, v1262 = scf.if v820 : i32, i32 { - ^block88: - v838 = hir.bitcast v780 : u32; - v1282 = arith.constant 4 : u32; - v840 = arith.mod v838, v1282 : u32; - hir.assertz v840 #[code = 250]; - v841 = hir.int_to_ptr v838 : ptr; - v842 = hir.load v841 : i32; - v843 = hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/__rustc::__rust_realloc(v842, v818, v778, v779) : i32 - scf.yield v843, v779; - } else { - ^block89: - v1281 = arith.constant 0 : i32; - v877 = arith.constant 8 : i32; - v822 = arith.add v787, v877 : i32 #[overflow = wrapping]; - hir.exec @root_ns:root@1.0.0/onchain_two_felts_struct/alloc::alloc::Global::alloc_impl(v822, v778, v779, v1281) - v825 = arith.constant 12 : u32; - v824 = hir.bitcast v787 : u32; - v826 = arith.add v824, v825 : u32 #[overflow = checked]; - v1280 = arith.constant 4 : u32; - v828 = arith.mod v826, v1280 : u32; - hir.assertz v828 #[code = 250]; - v829 = hir.int_to_ptr v826 : ptr; - v830 = hir.load v829 : i32; - v1279 = arith.constant 8 : u32; - v831 = hir.bitcast v787 : u32; - v833 = arith.add v831, v1279 : u32 #[overflow = checked]; - v1278 = arith.constant 4 : u32; - v835 = arith.mod v833, v1278 : u32; - hir.assertz v835 #[code = 250]; - v836 = hir.int_to_ptr v833 : ptr; - v837 = hir.load v836 : i32; - scf.yield v837, v830; - }; - scf.yield v1261, v1262; - }; - v1277 = arith.constant 4 : u32; - v862 = hir.bitcast v777 : u32; - v864 = arith.add v862, v1277 : u32 #[overflow = checked]; - v1276 = arith.constant 4 : u32; - v866 = arith.mod v864, v1276 : u32; - hir.assertz v866 #[code = 250]; - v1275 = arith.constant 0 : i32; - v860 = arith.neq v1263, v1275 : i1; - v861 = cf.select v860, v1263, v778 : i32; - v867 = hir.int_to_ptr v864 : ptr; - hir.store v867, v861; - v1273 = arith.constant 0 : i32; - v874 = arith.eq v1263, v1273 : i1; - v875 = arith.zext v874 : u32; - v876 = hir.bitcast v875 : i32; - v1274 = arith.constant 0 : i32; - v871 = arith.neq v1263, v1274 : i1; - v872 = cf.select v871, v1264, v779 : i32; - scf.yield v872, v876; - } else { - ^block84: - v797 = arith.constant 1 : i32; - v1272 = arith.constant 0 : i32; - scf.yield v1272, v797; - }; - v798 = arith.constant 4 : i32; - v1271 = arith.constant 8 : i32; - v1267 = cf.select v796, v1271, v798 : i32; - v880 = arith.add v777, v1267 : i32 #[overflow = wrapping]; - v882 = hir.bitcast v880 : u32; - v1270 = arith.constant 4 : u32; - v884 = arith.mod v882, v1270 : u32; - hir.assertz v884 #[code = 250]; - v885 = hir.int_to_ptr v882 : ptr; - hir.store v885, v1265; - v887 = hir.bitcast v777 : u32; - v1269 = arith.constant 4 : u32; - v889 = arith.mod v887, v1269 : u32; - hir.assertz v889 #[code = 250]; - v890 = hir.int_to_ptr v887 : ptr; - hir.store v890, v1266; - v1268 = arith.constant 16 : i32; - v894 = arith.add v787, v1268 : i32 #[overflow = wrapping]; - v895 = builtin.global_symbol @root_ns:root@1.0.0/onchain_two_felts_struct/__stack_pointer : ptr - v896 = hir.bitcast v895 : ptr; - hir.store v896, v894; - builtin.ret ; - }; - - private builtin.function @alloc::raw_vec::handle_error(v897: i32, v898: i32, v899: i32) { - ^block90(v897: i32, v898: i32, v899: i32): - ub.unreachable ; - }; - - private builtin.function @core::ptr::alignment::Alignment::max(v900: i32, v901: i32) -> i32 { - ^block92(v900: i32, v901: i32): - v908 = arith.constant 0 : i32; - v904 = hir.bitcast v901 : u32; - v903 = hir.bitcast v900 : u32; - v905 = arith.gt v903, v904 : i1; - v906 = arith.zext v905 : u32; - v907 = hir.bitcast v906 : i32; - v909 = arith.neq v907, v908 : i1; - v910 = cf.select v909, v900, v901 : i32; - builtin.ret v910; - }; - - builtin.global_variable private @#__stack_pointer : i32 { - builtin.ret_imm 1048576; - }; - - builtin.segment readonly @1048576 = 0x00000000000000000000000a0010000000003e64657463616465723c; - }; -}; \ No newline at end of file diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.masm b/felt-repr/tests/expected/onchain_two_felts_struct.masm deleted file mode 100644 index c64ea6675..000000000 --- a/felt-repr/tests/expected/onchain_two_felts_struct.masm +++ /dev/null @@ -1,2396 +0,0 @@ -# mod root_ns:root@1.0.0 - -proc init - push.1179648 - trace.240 - exec.::intrinsics::mem::heap_init - trace.252 - push.[5069684220085911070,12575515707502338447,6750708512266443820,15471277435400365850] - adv.push_mapval - push.262144 - push.2 - trace.240 - exec.::std::mem::pipe_preimage_to_memory - trace.252 - drop - push.1048576 - u32assert - mem_store.278536 -end - -# mod root_ns:root@1.0.0::onchain_two_felts_struct - -@callconv("C") -proc alloc::vec::Vec::push(i32, felt) - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - swap.1 - dup.2 - neq - neq - if.true - nop - else - dup.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVec::grow_one - trace.252 - nop - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.2 - dup.2 - swap.1 - u32shl - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_felt - trace.252 - nop - push.8 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.1 - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVec::grow_one(i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.4 - push.1 - push.8 - dup.4 - u32wrapping_add - dup.2 - movup.2 - swap.3 - swap.4 - movdn.2 - swap.5 - swap.6 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::grow_amortized - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.2147483649 - dup.2 - eq - neq - if.true - drop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - push.12 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -pub proc entrypoint(i32, i32) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_felt - trace.252 - nop - push.4 - push.0 - push.256 - push.20 - dup.6 - u32wrapping_add - dup.3 - swap.4 - swap.3 - swap.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::try_allocate_in - trace.252 - nop - push.24 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.20 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.1 - movup.2 - neq - neq - if.true - push.8 - push.8 - dup.5 - u32wrapping_add - u32wrapping_add - dup.0 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.28 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.12 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.4 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::vec::Vec::push - trace.252 - nop - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_dw - trace.252 - nop - movup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_dw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movdn.2 - drop - drop - movup.2 - drop - push.28 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1048588 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::handle_error - trace.252 - nop - push.0 - assert - end -end - -@callconv("C") -proc __rustc::__rust_alloc(i32, i32) -> i32 - push.1048604 - movup.2 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc - trace.252 - nop -end - -@callconv("C") -proc __rustc::__rust_realloc(i32, i32, i32, i32) -> i32 - push.1048604 - dup.4 - swap.2 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - movdn.3 - drop - drop - drop - else - push.0 - dup.2 - dup.5 - swap.1 - u32lt - neq - swap.1 - swap.4 - swap.1 - cdrop - push.0 - push.0 - dup.2 - eq - neq - if.true - drop - drop - else - dup.2 - movup.2 - push.0 - dup.3 - push.0 - gte - while.true - dup.2 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.2 - dup.2 - push.1 - u32overflowing_madd - assertz - u32divmod.4 - swap.1 - swap.1 - dup.1 - mem_load - swap.1 - push.8 - u32wrapping_mul - u32shr - swap.1 - drop - push.255 - u32and - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.4 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_alloc_zeroed(i32, i32) -> i32 - push.1048604 - dup.1 - swap.2 - swap.3 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::alloc - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - if.true - swap.1 - drop - else - push.0 - push.0 - dup.3 - eq - neq - if.true - swap.1 - drop - else - push.0 - movup.2 - dup.2 - push.0 - dup.2 - push.0 - gte - while.true - dup.1 - dup.1 - push.1 - u32overflowing_madd - assertz - dup.4 - swap.1 - u32divmod.4 - swap.1 - dup.0 - mem_load - dup.2 - push.8 - u32wrapping_mul - push.255 - swap.1 - u32shl - u32not - swap.1 - u32and - movup.3 - movup.3 - push.8 - u32wrapping_mul - u32shl - u32or - swap.1 - mem_store - u32wrapping_add.1 - dup.0 - dup.3 - u32gte - end - dropw - end - end -end - -@callconv("C") -proc __rustc::__rust_no_alloc_shim_is_unstable_v2( - -) - nop -end - -@callconv("C") -proc ::alloc( - i32, - i32, - i32 -) -> i32 - push.16 - push.0 - push.16 - dup.4 - swap.1 - u32gt - neq - dup.3 - swap.1 - cdrop - push.0 - push.4294967295 - dup.2 - u32wrapping_add - dup.2 - u32and - neq - if.true - dropw - push.0 - push.3735929054 - else - movup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::core::ptr::alignment::Alignment::max - trace.252 - nop - push.0 - push.2147483648 - dup.2 - u32wrapping_sub - dup.4 - swap.1 - u32gt - neq - dup.0 - if.true - movdn.3 - drop - drop - drop - push.3735929054 - else - push.0 - dup.2 - u32wrapping_sub - push.4294967295 - movup.5 - dup.4 - u32wrapping_add - u32wrapping_add - u32and - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - neq - if.true - nop - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::intrinsics::mem::heap_base - trace.252 - nop - trace.240 - nop - exec.::intrinsics::mem::memory_size - trace.252 - nop - dup.5 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.16 - movup.2 - swap.1 - u32shl - movup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.4294967295 - dup.2 - u32xor - dup.3 - swap.1 - u32gt - neq - if.true - drop - drop - movdn.2 - drop - drop - push.0 - else - movup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - dup.2 - u32wrapping_add - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - u32wrapping_add - end - end - push.1 - push.0 - movup.3 - cdrop - swap.1 - end - push.0 - movup.2 - eq - if.true - drop - push.0 - assert - else - nop - end -end - -@callconv("C") -proc intrinsics::mem::heap_base( - -) -> i32 - trace.240 - nop - exec.::intrinsics::mem::heap_base - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::grow_amortized( - i32, - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.32 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.8 - eq - neq - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - movup.4 - dup.4 - u32wrapping_add - push.0 - movup.5 - dup.2 - swap.1 - u32lt - neq - if.true - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - dup.0 - else - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.1 - u32shl - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - movup.2 - swap.1 - cdrop - push.1 - push.4 - push.0 - push.1025 - dup.9 - swap.1 - u32lt - neq - cdrop - push.8 - push.0 - push.1 - dup.9 - eq - neq - cdrop - push.0 - dup.1 - dup.3 - swap.1 - u32gt - neq - dup.2 - swap.1 - cdrop - dup.0 - push.0 - push.0 - dup.8 - u32wrapping_sub - push.4294967295 - dup.9 - dup.11 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - drop - push.0 - push.2147483648 - dup.8 - u32wrapping_sub - dup.2 - swap.1 - u32gt - neq - if.true - drop - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.0 - swap.1 - else - push.20 - dup.4 - u32wrapping_add - dup.6 - dup.8 - movup.3 - swap.10 - movdn.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::RawVecInner::current_memory - trace.252 - nop - push.20 - dup.3 - u32wrapping_add - push.8 - dup.4 - u32wrapping_add - dup.5 - movup.2 - swap.3 - swap.9 - movdn.2 - swap.4 - swap.8 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::raw_vec::finish_grow - trace.252 - nop - push.12 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - dup.0 - if.true - dup.4 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.7 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - dup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.4 - else - movup.2 - swap.6 - movdn.2 - swap.1 - swap.5 - swap.1 - swap.4 - drop - drop - drop - push.16 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - swap.1 - swap.4 - swap.3 - swap.2 - swap.1 - end - push.2147483649 - movdn.2 - movdn.3 - cdrop - swap.1 - end - end - end - end - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.32 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::try_allocate_in( - i32, - i32, - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - dup.2 - push.0 - push.0 - dup.7 - u32wrapping_sub - push.4294967295 - movup.9 - dup.9 - u32wrapping_add - u32wrapping_add - u32and - push.0 - trace.240 - nop - exec.::intrinsics::i64::wrapping_mul - trace.252 - nop - push.0 - push.32 - push.0 - dup.0 - push.2147483648 - u32and - eq.2147483648 - assertz - assertz - dup.0 - push.4294967295 - u32lte - assert - dup.3 - dup.3 - movup.2 - trace.240 - nop - exec.::std::math::u64::shr - trace.252 - nop - drop - neq - if.true - drop - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - push.3735929054 - dup.0 - dup.1 - swap.4 - swap.1 - swap.3 - swap.5 - else - drop - push.0 - push.2147483648 - dup.7 - u32wrapping_sub - dup.2 - swap.1 - u32lte - neq - dup.0 - if.true - push.0 - dup.2 - neq - if.true - push.0 - movup.6 - neq - if.true - push.1 - dup.3 - dup.7 - dup.4 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.3 - u32wrapping_add - dup.6 - dup.3 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::allocate - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - movup.6 - movup.2 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - else - movup.7 - movup.4 - drop - drop - push.8 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.2 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - end - push.0 - push.1 - movup.2 - cdrop - else - movup.2 - swap.5 - movdn.2 - swap.4 - swap.1 - drop - drop - drop - push.8 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.4 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - swap.1 - swap.3 - swap.2 - swap.1 - end - else - swap.1 - drop - movup.3 - drop - movup.3 - drop - movup.3 - drop - push.3735929054 - end - push.0 - push.1 - dup.3 - cdrop - push.3735929054 - dup.3 - dup.5 - swap.1 - cdrop - push.3735929054 - dup.4 - dup.7 - swap.1 - cdrop - push.3735929054 - dup.5 - movup.2 - swap.7 - movdn.2 - cdrop - push.3735929054 - movup.2 - swap.7 - movdn.2 - swap.1 - swap.5 - cdrop - swap.1 - swap.5 - swap.4 - swap.2 - swap.3 - swap.1 - end - movup.5 - eq.0 - if.true - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.4 - dup.1 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.1 - swap.1 - else - drop - drop - end - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc ::allocate( - i32, - i32, - i32 -) - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.8 - dup.2 - u32wrapping_add - movup.2 - swap.5 - movdn.2 - swap.1 - swap.3 - swap.4 - swap.1 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::alloc::Global::alloc_impl( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.4 - eq - neq - if.true - movup.3 - drop - swap.1 - else - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_no_alloc_shim_is_unstable_v2 - trace.252 - nop - push.0 - movup.4 - neq - if.true - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_alloc_zeroed - trace.252 - nop - else - swap.1 - dup.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_alloc - trace.252 - nop - end - end - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.3 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::RawVecInner::current_memory( - i32, - i32, - i32, - i32 -) - push.0 - push.0 - dup.5 - eq - neq - if.true - movdn.3 - drop - drop - drop - push.0 - push.4 - else - dup.1 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - dup.2 - eq - neq - dup.0 - if.true - swap.1 - drop - movup.2 - drop - movup.2 - drop - movup.2 - drop - push.0 - else - push.4 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - movup.5 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.4 - movup.4 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.3 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - swap.3 - trace.240 - nop - exec.::intrinsics::i32::wrapping_mul - trace.252 - nop - movup.2 - swap.1 - end - push.8 - push.4 - movup.3 - cdrop - end - movup.2 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::finish_grow(i32, i32, i32, i32, i32) - movup.4 - drop - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.16 - u32wrapping_sub - push.1114144 - dup.1 - swap.1 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - push.0 - dup.5 - swap.1 - trace.240 - nop - exec.::intrinsics::i32::is_gte - trace.252 - nop - neq - dup.0 - if.true - push.4 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - push.0 - movup.2 - eq - neq - if.true - movup.5 - drop - dup.4 - dup.4 - dup.3 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::::allocate - trace.252 - nop - push.4 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - else - push.8 - dup.6 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.0 - dup.1 - neq - if.true - movup.6 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - dup.5 - dup.7 - swap.3 - swap.1 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::__rustc::__rust_realloc - trace.252 - nop - dup.5 - swap.1 - else - movup.6 - swap.1 - drop - drop - push.0 - push.8 - dup.3 - u32wrapping_add - dup.5 - dup.7 - swap.2 - trace.240 - nop - exec.::root_ns:root@1.0.0::onchain_two_felts_struct::alloc::alloc::Global::alloc_impl - trace.252 - nop - push.12 - dup.2 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - push.8 - dup.3 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::load_sw - trace.252 - nop - end - end - push.4 - dup.5 - add - u32assert - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - push.0 - dup.2 - neq - dup.2 - movup.2 - swap.8 - movdn.2 - swap.1 - cdrop - movup.6 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.0 - dup.1 - eq - push.0 - movup.2 - neq - swap.1 - swap.6 - swap.2 - swap.1 - cdrop - movup.4 - swap.1 - else - movup.2 - swap.5 - movdn.2 - swap.1 - swap.4 - swap.1 - swap.3 - drop - drop - drop - push.1 - push.0 - end - push.4 - push.8 - movup.4 - cdrop - dup.4 - u32wrapping_add - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - movup.2 - push.4 - dup.1 - swap.1 - u32mod - u32assert - assertz - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop - push.16 - u32wrapping_add - push.1114144 - u32divmod.4 - swap.1 - trace.240 - nop - exec.::intrinsics::mem::store_sw - trace.252 - nop -end - -@callconv("C") -proc alloc::raw_vec::handle_error(i32, i32, i32) - drop - drop - drop - push.0 - assert -end - -@callconv("C") -proc core::ptr::alignment::Alignment::max(i32, i32) -> i32 - push.0 - dup.2 - dup.2 - swap.1 - u32gt - neq - cdrop -end - diff --git a/felt-repr/tests/expected/onchain_two_felts_struct.wat b/felt-repr/tests/expected/onchain_two_felts_struct.wat deleted file mode 100644 index 05c5adfa4..000000000 --- a/felt-repr/tests/expected/onchain_two_felts_struct.wat +++ /dev/null @@ -1,729 +0,0 @@ -(module $onchain_two_felts_struct.wasm - (type (;0;) (func (param i32 f32))) - (type (;1;) (func (param i32))) - (type (;2;) (func (param i32 i32))) - (type (;3;) (func (param i32 i32) (result i32))) - (type (;4;) (func (param i32 i32 i32 i32) (result i32))) - (type (;5;) (func)) - (type (;6;) (func (param i32 i32 i32) (result i32))) - (type (;7;) (func (result i32))) - (type (;8;) (func (param i32 i32 i32 i32 i32 i32))) - (type (;9;) (func (param i32 i32 i32 i32 i32))) - (type (;10;) (func (param i32 i32 i32))) - (type (;11;) (func (param i32 i32 i32 i32))) - (table (;0;) 1 1 funcref) - (memory (;0;) 17) - (global $__stack_pointer (;0;) (mut i32) i32.const 1048576) - (export "memory" (memory 0)) - (export "entrypoint" (func $entrypoint)) - (func $alloc::vec::Vec::push (;0;) (type 0) (param i32 f32) - (local i32) - block ;; label = @1 - local.get 0 - i32.load offset=8 - local.tee 2 - local.get 0 - i32.load - i32.ne - br_if 0 (;@1;) - local.get 0 - call $alloc::raw_vec::RawVec::grow_one - end - local.get 0 - i32.load offset=4 - local.get 2 - i32.const 2 - i32.shl - i32.add - local.get 1 - f32.store - local.get 0 - local.get 2 - i32.const 1 - i32.add - i32.store offset=8 - ) - (func $alloc::raw_vec::RawVec::grow_one (;1;) (type 1) (param i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 1 - global.set $__stack_pointer - local.get 1 - i32.const 8 - i32.add - local.get 0 - local.get 0 - i32.load - i32.const 1 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::grow_amortized - block ;; label = @1 - local.get 1 - i32.load offset=8 - local.tee 0 - i32.const -2147483647 - i32.eq - br_if 0 (;@1;) - local.get 0 - local.get 1 - i32.load offset=12 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 1 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $entrypoint (;2;) (type 2) (param i32 i32) - (local i32 f32 f32 i32) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 2 - global.set $__stack_pointer - local.get 1 - f32.load offset=4 - local.set 3 - local.get 1 - f32.load - local.set 4 - local.get 2 - i32.const 20 - i32.add - i32.const 256 - i32.const 0 - i32.const 4 - i32.const 4 - call $alloc::raw_vec::RawVecInner::try_allocate_in - local.get 2 - i32.load offset=24 - local.set 1 - block ;; label = @1 - local.get 2 - i32.load offset=20 - i32.const 1 - i32.ne - br_if 0 (;@1;) - local.get 1 - local.get 2 - i32.load offset=28 - i32.const 1048588 - call $alloc::raw_vec::handle_error - unreachable - end - local.get 2 - i32.const 8 - i32.add - i32.const 8 - i32.add - local.tee 5 - i32.const 0 - i32.store - local.get 2 - local.get 2 - i32.load offset=28 - i32.store offset=12 - local.get 2 - local.get 1 - i32.store offset=8 - local.get 2 - i32.const 8 - i32.add - local.get 4 - call $alloc::vec::Vec::push - local.get 2 - i32.const 8 - i32.add - local.get 3 - call $alloc::vec::Vec::push - local.get 0 - i32.const 8 - i32.add - local.get 5 - i32.load - i32.store - local.get 0 - local.get 2 - i64.load offset=8 align=4 - i64.store align=4 - local.get 2 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $__rustc::__rust_alloc (;3;) (type 3) (param i32 i32) (result i32) - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - ) - (func $__rustc::__rust_realloc (;4;) (type 4) (param i32 i32 i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 2 - local.get 3 - call $::alloc - local.tee 2 - i32.eqz - br_if 0 (;@1;) - local.get 3 - local.get 1 - local.get 3 - local.get 1 - i32.lt_u - select - local.tee 3 - i32.eqz - br_if 0 (;@1;) - local.get 2 - local.get 0 - local.get 3 - memory.copy - end - local.get 2 - ) - (func $__rustc::__rust_alloc_zeroed (;5;) (type 3) (param i32 i32) (result i32) - block ;; label = @1 - i32.const 1048604 - local.get 1 - local.get 0 - call $::alloc - local.tee 1 - i32.eqz - br_if 0 (;@1;) - local.get 0 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.const 0 - local.get 0 - memory.fill - end - local.get 1 - ) - (func $__rustc::__rust_no_alloc_shim_is_unstable_v2 (;6;) (type 5) - return - ) - (func $::alloc (;7;) (type 6) (param i32 i32 i32) (result i32) - (local i32 i32) - block ;; label = @1 - local.get 1 - i32.const 16 - local.get 1 - i32.const 16 - i32.gt_u - select - local.tee 3 - local.get 3 - i32.const -1 - i32.add - i32.and - br_if 0 (;@1;) - local.get 2 - i32.const -2147483648 - local.get 1 - local.get 3 - call $core::ptr::alignment::Alignment::max - local.tee 1 - i32.sub - i32.gt_u - br_if 0 (;@1;) - i32.const 0 - local.set 3 - local.get 2 - local.get 1 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 1 - i32.sub - i32.and - local.set 2 - block ;; label = @2 - local.get 0 - i32.load - br_if 0 (;@2;) - local.get 0 - call $intrinsics::mem::heap_base - memory.size - i32.const 16 - i32.shl - i32.add - i32.store - end - block ;; label = @2 - local.get 2 - local.get 0 - i32.load - local.tee 4 - i32.const -1 - i32.xor - i32.gt_u - br_if 0 (;@2;) - local.get 0 - local.get 4 - local.get 2 - i32.add - i32.store - local.get 4 - local.get 1 - i32.add - local.set 3 - end - local.get 3 - return - end - unreachable - ) - (func $intrinsics::mem::heap_base (;8;) (type 7) (result i32) - unreachable - ) - (func $alloc::raw_vec::RawVecInner::grow_amortized (;9;) (type 8) (param i32 i32 i32 i32 i32 i32) - (local i32 i32 i32 i64) - global.get $__stack_pointer - i32.const 32 - i32.sub - local.tee 6 - global.set $__stack_pointer - i32.const 0 - local.set 7 - block ;; label = @1 - block ;; label = @2 - local.get 5 - i32.eqz - br_if 0 (;@2;) - local.get 2 - local.get 3 - i32.add - local.tee 3 - local.get 2 - i32.lt_u - br_if 1 (;@1;) - i32.const 0 - local.set 7 - local.get 4 - local.get 5 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 4 - i32.sub - i32.and - i64.extend_i32_u - local.get 3 - local.get 1 - i32.load - i32.const 1 - i32.shl - local.tee 8 - local.get 3 - local.get 8 - i32.gt_u - select - local.tee 8 - i32.const 8 - i32.const 4 - i32.const 1 - local.get 5 - i32.const 1025 - i32.lt_u - select - local.get 5 - i32.const 1 - i32.eq - select - local.tee 2 - local.get 8 - local.get 2 - i32.gt_u - select - local.tee 2 - i64.extend_i32_u - i64.mul - local.tee 9 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@2;) - local.get 9 - i32.wrap_i64 - local.tee 3 - i32.const -2147483648 - local.get 4 - i32.sub - i32.gt_u - br_if 1 (;@1;) - local.get 6 - i32.const 20 - i32.add - local.get 1 - local.get 4 - local.get 5 - call $alloc::raw_vec::RawVecInner::current_memory - local.get 6 - i32.const 8 - i32.add - local.get 4 - local.get 3 - local.get 6 - i32.const 20 - i32.add - local.get 0 - call $alloc::raw_vec::finish_grow - local.get 6 - i32.load offset=12 - local.set 7 - block ;; label = @3 - local.get 6 - i32.load offset=8 - i32.eqz - br_if 0 (;@3;) - local.get 6 - i32.load offset=16 - local.set 8 - br 2 (;@1;) - end - local.get 1 - local.get 2 - i32.store - local.get 1 - local.get 7 - i32.store offset=4 - i32.const -2147483647 - local.set 7 - br 1 (;@1;) - end - end - local.get 0 - local.get 8 - i32.store offset=4 - local.get 0 - local.get 7 - i32.store - local.get 6 - i32.const 32 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::RawVecInner::try_allocate_in (;10;) (type 9) (param i32 i32 i32 i32 i32) - (local i32 i64) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - block ;; label = @1 - block ;; label = @2 - block ;; label = @3 - local.get 3 - local.get 4 - i32.add - i32.const -1 - i32.add - i32.const 0 - local.get 3 - i32.sub - i32.and - i64.extend_i32_u - local.get 1 - i64.extend_i32_u - i64.mul - local.tee 6 - i64.const 32 - i64.shr_u - i32.wrap_i64 - br_if 0 (;@3;) - local.get 6 - i32.wrap_i64 - local.tee 4 - i32.const -2147483648 - local.get 3 - i32.sub - i32.le_u - br_if 1 (;@2;) - end - local.get 0 - i32.const 0 - i32.store offset=4 - i32.const 1 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - local.get 4 - br_if 0 (;@2;) - local.get 0 - local.get 3 - i32.store offset=8 - i32.const 0 - local.set 3 - local.get 0 - i32.const 0 - i32.store offset=4 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 2 - br_if 0 (;@3;) - local.get 5 - i32.const 8 - i32.add - local.get 3 - local.get 4 - call $::allocate - local.get 5 - i32.load offset=8 - local.set 2 - br 1 (;@2;) - end - local.get 5 - local.get 3 - local.get 4 - i32.const 1 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load - local.set 2 - end - block ;; label = @2 - local.get 2 - i32.eqz - br_if 0 (;@2;) - local.get 0 - local.get 2 - i32.store offset=8 - local.get 0 - local.get 1 - i32.store offset=4 - i32.const 0 - local.set 3 - br 1 (;@1;) - end - local.get 0 - local.get 4 - i32.store offset=8 - local.get 0 - local.get 3 - i32.store offset=4 - i32.const 1 - local.set 3 - end - local.get 0 - local.get 3 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $::allocate (;11;) (type 10) (param i32 i32 i32) - (local i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 3 - global.set $__stack_pointer - local.get 3 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 3 - i32.load offset=12 - local.set 2 - local.get 0 - local.get 3 - i32.load offset=8 - i32.store - local.get 0 - local.get 2 - i32.store offset=4 - local.get 3 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::alloc::Global::alloc_impl (;12;) (type 11) (param i32 i32 i32 i32) - block ;; label = @1 - local.get 2 - i32.eqz - br_if 0 (;@1;) - call $__rustc::__rust_no_alloc_shim_is_unstable_v2 - block ;; label = @2 - local.get 3 - br_if 0 (;@2;) - local.get 2 - local.get 1 - call $__rustc::__rust_alloc - local.set 1 - br 1 (;@1;) - end - local.get 2 - local.get 1 - call $__rustc::__rust_alloc_zeroed - local.set 1 - end - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.store - ) - (func $alloc::raw_vec::RawVecInner::current_memory (;13;) (type 11) (param i32 i32 i32 i32) - (local i32 i32 i32) - i32.const 0 - local.set 4 - i32.const 4 - local.set 5 - block ;; label = @1 - local.get 3 - i32.eqz - br_if 0 (;@1;) - local.get 1 - i32.load - local.tee 6 - i32.eqz - br_if 0 (;@1;) - local.get 0 - local.get 2 - i32.store offset=4 - local.get 0 - local.get 1 - i32.load offset=4 - i32.store - local.get 6 - local.get 3 - i32.mul - local.set 4 - i32.const 8 - local.set 5 - end - local.get 0 - local.get 5 - i32.add - local.get 4 - i32.store - ) - (func $alloc::raw_vec::finish_grow (;14;) (type 9) (param i32 i32 i32 i32 i32) - (local i32 i32) - global.get $__stack_pointer - i32.const 16 - i32.sub - local.tee 5 - global.set $__stack_pointer - i32.const 0 - local.set 6 - block ;; label = @1 - block ;; label = @2 - local.get 2 - i32.const 0 - i32.ge_s - br_if 0 (;@2;) - i32.const 1 - local.set 2 - i32.const 4 - local.set 3 - br 1 (;@1;) - end - block ;; label = @2 - block ;; label = @3 - local.get 3 - i32.load offset=4 - i32.eqz - br_if 0 (;@3;) - block ;; label = @4 - local.get 3 - i32.load offset=8 - local.tee 6 - br_if 0 (;@4;) - local.get 5 - i32.const 8 - i32.add - local.get 1 - local.get 2 - i32.const 0 - call $alloc::alloc::Global::alloc_impl - local.get 5 - i32.load offset=12 - local.set 6 - local.get 5 - i32.load offset=8 - local.set 3 - br 2 (;@2;) - end - local.get 3 - i32.load - local.get 6 - local.get 1 - local.get 2 - call $__rustc::__rust_realloc - local.set 3 - local.get 2 - local.set 6 - br 1 (;@2;) - end - local.get 5 - local.get 1 - local.get 2 - call $::allocate - local.get 5 - i32.load offset=4 - local.set 6 - local.get 5 - i32.load - local.set 3 - end - local.get 0 - local.get 3 - local.get 1 - local.get 3 - select - i32.store offset=4 - local.get 6 - local.get 2 - local.get 3 - select - local.set 6 - local.get 3 - i32.eqz - local.set 2 - i32.const 8 - local.set 3 - end - local.get 0 - local.get 3 - i32.add - local.get 6 - i32.store - local.get 0 - local.get 2 - i32.store - local.get 5 - i32.const 16 - i32.add - global.set $__stack_pointer - ) - (func $alloc::raw_vec::handle_error (;15;) (type 10) (param i32 i32 i32) - unreachable - ) - (func $core::ptr::alignment::Alignment::max (;16;) (type 3) (param i32 i32) (result i32) - local.get 0 - local.get 1 - local.get 0 - local.get 1 - i32.gt_u - select - ) - (data $.rodata (;0;) (i32.const 1048576) "\00\00\00\00\10\00\0a\00\00\00\00\00\00\00\00\00\00\00") -) diff --git a/felt-repr/tests/src/onchain.rs b/felt-repr/tests/src/onchain.rs index 96e21947c..842649c24 100644 --- a/felt-repr/tests/src/onchain.rs +++ b/felt-repr/tests/src/onchain.rs @@ -9,7 +9,6 @@ use miden_core::{Felt, FieldElement}; use miden_debug::Felt as TestFelt; use miden_felt_repr_offchain::{FeltReader, FromFeltRepr, ToFeltRepr}; use miden_integration_tests::testing::{eval_package, Initializer}; -use midenc_expect_test::expect_file; use midenc_frontend_wasm::WasmTranslationConfig; use crate::build_felt_repr_test; @@ -108,10 +107,6 @@ fn two_felts_struct_round_trip() { let artifact_name = "onchain_two_felts_struct"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); - test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); - let package = test.compiled_package(); let in_elem_addr = 21u32 * 16384; @@ -203,10 +198,6 @@ fn five_felts_struct_round_trip() { let artifact_name = "onchain_five_felts_struct"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); - test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); - let package = test.compiled_package(); let in_elem_addr = 21u32 * 16384; @@ -321,10 +312,6 @@ fn minimal_u64_bug() { let artifact_name = "onchain_minimal_u64_bug"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); - test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); - let package = test.compiled_package(); let in_elem_addr = 21u32 * 16384; @@ -427,10 +414,6 @@ fn mixed_types_no_u64_round_trip() { let artifact_name = "onchain_mixed_types_no_u64"; let mut test = build_felt_repr_test(artifact_name, onchain_code, config); - test.expect_wasm(expect_file![format!("../expected/{artifact_name}.wat")]); - test.expect_ir(expect_file![format!("../expected/{artifact_name}.hir")]); - test.expect_masm(expect_file![format!("../expected/{artifact_name}.masm")]); - let package = test.compiled_package(); let in_elem_addr = 21u32 * 16384;