diff --git a/Cargo.lock b/Cargo.lock index 2de938bec1..c8e50b4080 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2207,6 +2207,7 @@ dependencies = [ "num-bigint", "num-traits", "paste", + "ruint", "rustc-hash 2.1.1", "salsa", "smallvec 1.15.1", diff --git a/crates/codegen/tests/fixtures/create_contract.snap b/crates/codegen/tests/fixtures/create_contract.snap index be47fb6b43..143ca6423a 100644 --- a/crates/codegen/tests/fixtures/create_contract.snap +++ b/crates/codegen/tests/fixtures/create_contract.snap @@ -238,50 +238,47 @@ object "Child" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_f8f2(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_90b8(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_90b8(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -296,50 +293,47 @@ object "Child" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_afea(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_1b26(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_1b26(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1896,50 +1890,47 @@ object "Factory" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_3a5b(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a9cc(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a9cc(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1954,50 +1945,47 @@ object "Factory" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_7357(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9d90(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9d90(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -2012,50 +2000,47 @@ object "Factory" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_f2e9(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_3b13(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_3b13(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -2070,50 +2055,47 @@ object "Factory" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_7ae6(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9b8c(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9b8c(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -2522,50 +2504,47 @@ object "Factory" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_f8f2(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_90b8(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_90b8(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -2580,50 +2559,47 @@ object "Factory" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_afea(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_1b26(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_1b26(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 diff --git a/crates/codegen/tests/fixtures/effect_handle_field_deref.snap b/crates/codegen/tests/fixtures/effect_handle_field_deref.snap index 9f79669bbf..2f6f537871 100644 --- a/crates/codegen/tests/fixtures/effect_handle_field_deref.snap +++ b/crates/codegen/tests/fixtures/effect_handle_field_deref.snap @@ -914,50 +914,47 @@ object "EffectHandleFieldDeref" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_b143(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_ca68(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_ca68(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -972,50 +969,47 @@ object "EffectHandleFieldDeref" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_7233(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_caf8(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_caf8(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1030,50 +1024,47 @@ object "EffectHandleFieldDeref" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_0a8e(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_d0f7(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_d0f7(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1088,50 +1079,47 @@ object "EffectHandleFieldDeref" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_2605(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a18e(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a18e(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1146,50 +1134,47 @@ object "EffectHandleFieldDeref" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_c8fa(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_bd46(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_bd46(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1204,50 +1189,47 @@ object "EffectHandleFieldDeref" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_9b08(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_731b(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_731b(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 diff --git a/crates/codegen/tests/fixtures/erc20.snap b/crates/codegen/tests/fixtures/erc20.snap index 4b187e3c63..61e3a980ff 100644 --- a/crates/codegen/tests/fixtures/erc20.snap +++ b/crates/codegen/tests/fixtures/erc20.snap @@ -724,15 +724,12 @@ object "CoolCoin" { mstore(0x40, add(r1, 32)) mstore(r0, p0) mstore(r1, p1) - let t8 := mload(r0) - let v2 := t8 - let t9 := mload(r1) - let v5 := t9 - mstore(r1, v5) - let t10 := mload(r1) - let v6 := t10 - let v7 := iszero(iszero(eq(v2, v6))) - let v4 := iszero(iszero(v7)) + let t7 := mload(r0) + let v2 := t7 + let t8 := mload(r1) + let v5 := t8 + let v6 := iszero(iszero(eq(v2, v5))) + let v4 := iszero(iszero(v6)) ret := iszero(iszero(v4)) leave } @@ -1048,50 +1045,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_5bb5(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2d1c(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2d1c(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1106,50 +1100,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_6aca(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_8ba4(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_8ba4(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1164,50 +1155,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_c9e2_0(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_b2e2_0(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_b2e2_0(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1222,50 +1210,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_c9e2(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_b2e2(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_b2e2(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -6674,15 +6659,12 @@ object "CoolCoin" { mstore(0x40, add(r1, 32)) mstore(r0, p0) mstore(r1, p1) - let t8 := mload(r0) - let v2 := t8 - let t9 := mload(r1) - let v5 := t9 - mstore(r1, v5) - let t10 := mload(r1) - let v6 := t10 - let v7 := iszero(iszero(eq(v2, v6))) - let v4 := iszero(iszero(v7)) + let t7 := mload(r0) + let v2 := t7 + let t8 := mload(r1) + let v5 := t8 + let v6 := iszero(iszero(eq(v2, v5))) + let v4 := iszero(iszero(v6)) ret := iszero(iszero(v4)) leave } @@ -8371,50 +8353,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_4b56(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_f700(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_f700(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8429,50 +8408,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_52e4(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_ebca(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_ebca(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8487,50 +8463,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_d29e(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_90b5(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_90b5(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8545,50 +8518,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_f69f(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a844(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a844(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8603,50 +8573,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_6eac(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_dbef(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_dbef(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8661,50 +8628,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_acd0(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5d2f(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5d2f(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8719,50 +8683,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_3fdb(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_bd7e(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_bd7e(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8777,50 +8738,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_54c0(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_3e3b(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_3e3b(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8835,50 +8793,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_8f90(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_47bf(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_47bf(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8893,50 +8848,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_3194(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_f4a7(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_f4a7(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -8951,50 +8903,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_8042(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_71ef(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_71ef(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9009,50 +8958,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_8e49(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_10fb(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_10fb(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9067,50 +9013,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_83a5(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_63c2(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_63c2(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9125,50 +9068,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_7aa7(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_348a(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_348a(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9183,50 +9123,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_07fa(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_4b4e(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_4b4e(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9241,50 +9178,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_9e12(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_ece9(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_ece9(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9299,50 +9233,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_8f13(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2fc3(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2fc3(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9357,50 +9288,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_c5d0(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_6fee(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_6fee(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9415,50 +9343,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_5fa6(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_c1bd(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_c1bd(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9473,50 +9398,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_8379(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2cc5(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2cc5(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9531,50 +9453,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_1af2(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_7f9b(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_7f9b(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9589,50 +9508,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_af05(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_091f(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_091f(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9647,50 +9563,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_10c2(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_aab1(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_aab1(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9705,50 +9618,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_6679(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_8e1e(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_8e1e(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9763,50 +9673,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_7c3a(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_0ddd(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_0ddd(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9821,50 +9728,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_a6d8(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_de6a(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_de6a(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9879,50 +9783,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_8ee6(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_142c(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_142c(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9937,50 +9838,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_cf02(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_f768(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_f768(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -9995,50 +9893,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_5b55(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a988(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_a988(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -10053,50 +9948,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_c5ca(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_3283(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_3283(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -10111,50 +10003,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_98ab(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_8ac3(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_8ac3(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -10169,50 +10058,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_4f68(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9d5e(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9d5e(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -10227,50 +10113,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_6e05(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5ebd(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5ebd(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -10285,50 +10168,47 @@ object "CoolCoin" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_d2a6(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_41fc(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_41fc(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 diff --git a/crates/codegen/tests/fixtures/erc20_low_level.snap b/crates/codegen/tests/fixtures/erc20_low_level.snap index 5718f56f26..5267eb3e73 100644 --- a/crates/codegen/tests/fixtures/erc20_low_level.snap +++ b/crates/codegen/tests/fixtures/erc20_low_level.snap @@ -40,15 +40,12 @@ object "Erc20Contract" { mstore(0x40, add(r1, 32)) mstore(r0, p0) mstore(r1, p1) - let t8 := mload(r0) - let v2 := t8 - let t9 := mload(r1) - let v5 := t9 - mstore(r1, v5) - let t10 := mload(r1) - let v6 := t10 - let v7 := iszero(iszero(eq(v2, v6))) - let v4 := iszero(iszero(v7)) + let t7 := mload(r0) + let v2 := t7 + let t8 := mload(r1) + let v5 := t8 + let v6 := iszero(iszero(eq(v2, v5))) + let v4 := iszero(iszero(v6)) ret := iszero(iszero(v4)) leave } @@ -324,15 +321,12 @@ object "Erc20Contract" { mstore(0x40, add(r1, 32)) mstore(r0, p0) mstore(r1, p1) - let t8 := mload(r0) - let v2 := t8 - let t9 := mload(r1) - let v5 := t9 - mstore(r1, v5) - let t10 := mload(r1) - let v6 := t10 - let v7 := iszero(iszero(eq(v2, v6))) - let v4 := iszero(iszero(v7)) + let t7 := mload(r0) + let v2 := t7 + let t8 := mload(r1) + let v5 := t8 + let v6 := iszero(iszero(eq(v2, v5))) + let v4 := iszero(iszero(v6)) ret := iszero(iszero(v4)) leave } @@ -463,48 +457,45 @@ object "Erc20Contract" { let v26 := $std$lib$evm$effects$impl_trait$Evm$a1e8$caller_1c07_1() let v7 := v26 let v5 := v7 - let t39 := sload(add(p0, div(add(32, 31), 32))) - let v27 := t39 - sstore(add(p0, div(add(32, 31), 32)), v27) - let t40 := sload(add(p0, div(add(32, 31), 32))) - let v28 := t40 - let v29 := $core$lib$ops$trait$Eq$ne$g7528_a982_0(v5, v28) - let v10 := iszero(iszero(v29)) + let t38 := sload(add(p0, div(add(32, 31), 32))) + let v27 := t38 + let v28 := $core$lib$ops$trait$Eq$ne$g7528_a982_0(v5, v27) + let v10 := iszero(iszero(v28)) if iszero(iszero(v10)) { + let v29 := 0x00 + let v11 := v29 let v30 := 0x00 - let v11 := v30 - let v31 := 0x00 - let v12 := v31 + let v12 := v30 $std$lib$evm$effects$impl_trait$Evm$0098$revert_7c32_1(v11, v12) invalid() } if iszero(iszero(iszero(v10))) { let v15 := p1 - let v34 := $standalone$erc20_low_level$erc20_low_level$impl$Erc20$16d9$balance_of$g35d6_6d6f_1(p0, v15) - let v16 := v34 + let v33 := $standalone$erc20_low_level$erc20_low_level$impl$Erc20$16d9$balance_of$g35d6_6d6f_1(p0, v15) + let v16 := v33 let v6 := v16 let v18 := p1 let v19 := p2 - let t41 := add(v6, v19) - if lt(t41, v6) { + let t39 := add(v6, v19) + if lt(t39, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v35 := t41 - let v20 := v35 + let v34 := t39 + let v20 := v34 $std$lib$evm$storage_map$impl$StorageMap$9f54$set$g2163_a4c9_1(v18, v20) - let t42 := sload(p0) - let v22 := t42 + let t40 := sload(p0) + let v22 := t40 let v23 := p2 - let t43 := add(v22, v23) - if lt(t43, v22) { + let t41 := add(v22, v23) + if lt(t41, v22) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v38 := t43 - let v24 := v38 + let v37 := t41 + let v24 := v37 sstore(p0, v24) leave } diff --git a/crates/codegen/tests/fixtures/for_range.snap b/crates/codegen/tests/fixtures/for_range.snap index f46a0f6094..895e29d867 100644 --- a/crates/codegen/tests/fixtures/for_range.snap +++ b/crates/codegen/tests/fixtures/for_range.snap @@ -91,34 +91,31 @@ object "main" { } function $len(p0) -> ret { let v1 := 0 - let t15 := mload(add(p0, 32)) - let v2 := t15 - let t16 := mload(p0) - let v9 := t16 - mstore(p0, v9) - let t17 := mload(p0) - let v10 := t17 - let v11 := iszero(iszero(lt(v2, v10))) - let v4 := iszero(iszero(v11)) + let t14 := mload(add(p0, 32)) + let v2 := t14 + let t15 := mload(p0) + let v9 := t15 + let v10 := iszero(iszero(lt(v2, v9))) + let v4 := iszero(iszero(v10)) if iszero(iszero(v4)) { + let v11 := 0x00 + let v5 := v11 let v12 := 0x00 - let v5 := v12 - let v13 := 0x00 - v1 := v13 + v1 := v12 } if iszero(iszero(iszero(v4))) { - let t18 := mload(add(p0, 32)) - let v6 := t18 - let t19 := mload(p0) - let v7 := t19 - let t20 := sub(v6, v7) + let t16 := mload(add(p0, 32)) + let v6 := t16 + let t17 := mload(p0) + let v7 := t17 + let t18 := sub(v6, v7) if gt(v7, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v14 := t20 - let v8 := v14 + let v13 := t18 + let v8 := v13 v1 := v8 } ret := v1 diff --git a/crates/codegen/tests/fixtures/high_level_contract.snap b/crates/codegen/tests/fixtures/high_level_contract.snap index 2860d5e6e9..811c4277e2 100644 --- a/crates/codegen/tests/fixtures/high_level_contract.snap +++ b/crates/codegen/tests/fixtures/high_level_contract.snap @@ -238,50 +238,47 @@ object "EchoContract" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_f8c0(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_43ea(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_43ea(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -296,50 +293,47 @@ object "EchoContract" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_639c(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_d43a(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_d43a(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1126,50 +1120,47 @@ object "EchoContract" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_6ee3(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_caf9(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_caf9(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1184,50 +1175,47 @@ object "EchoContract" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_fbd3(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9b33(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_9b33(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 diff --git a/crates/codegen/tests/fixtures/init_args_with_child_dep.snap b/crates/codegen/tests/fixtures/init_args_with_child_dep.snap index e0f9a999a2..c7376e6b45 100644 --- a/crates/codegen/tests/fixtures/init_args_with_child_dep.snap +++ b/crates/codegen/tests/fixtures/init_args_with_child_dep.snap @@ -233,50 +233,47 @@ object "Child" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_5bb3(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2397(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2397(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -291,50 +288,47 @@ object "Child" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_b8bc(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5e1a(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5e1a(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1211,50 +1205,47 @@ object "Parent" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_cc6d(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_89b0(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_89b0(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1269,50 +1260,47 @@ object "Parent" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_0327(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_d08f(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_d08f(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1634,50 +1622,47 @@ object "Parent" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_5bb3(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2397(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_2397(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 @@ -1692,50 +1677,47 @@ object "Parent" { let v22 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$len_b8bc(v4) let v5 := v22 v1 := v5 - let t34 := mload(add(p0, 64)) - let v6 := t34 + let t33 := mload(add(p0, 64)) + let v6 := t33 let v23 := 0x20 let v7 := v23 - let t35 := add(v6, v7) - if lt(t35, v6) { + let t34 := add(v6, v7) + if lt(t34, v6) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v24 := t35 + let v24 := t34 let v8 := v24 v2 := v8 - let t36 := mload(add(p0, 64)) - let v25 := t36 - mstore(add(p0, 64), v25) - let t37 := mload(add(p0, 64)) - let v26 := t37 - let v27 := iszero(iszero(lt(v2, v26))) - let v11 := iszero(iszero(v27)) + let t35 := mload(add(p0, 64)) + let v25 := t35 + let v26 := iszero(iszero(lt(v2, v25))) + let v11 := iszero(iszero(v26)) if iszero(iszero(v11)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v11))) { let v12 := v1 - let v33 := iszero(iszero(gt(v2, v12))) - let v13 := iszero(iszero(v33)) + let v32 := iszero(iszero(gt(v2, v12))) + let v13 := iszero(iszero(v32)) if iszero(iszero(v13)) { + let v27 := 0x00 + let v14 := v27 let v28 := 0x00 - let v14 := v28 - let v29 := 0x00 - let v15 := v29 + let v15 := v28 revert(v14, v15) } if iszero(iszero(iszero(v13))) { let v18 := p0 - let t38 := mload(add(p0, 64)) - let v19 := t38 - let v32 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5e1a(v18, v19) - let v20 := v32 + let t36 := mload(add(p0, 64)) + let v19 := t36 + let v31 := $std$lib$evm$memory_input$impl_trait$MemoryBytes$c1cd$word_at_5e1a(v18, v19) + let v20 := v31 let v3 := v20 mstore(add(p0, 64), v2) ret := v3 diff --git a/crates/codegen/tests/fixtures/match_arm_return.snap b/crates/codegen/tests/fixtures/match_arm_return.snap index cd6dcca587..038e684e77 100644 --- a/crates/codegen/tests/fixtures/match_arm_return.snap +++ b/crates/codegen/tests/fixtures/match_arm_return.snap @@ -7,23 +7,19 @@ object "main" { code { function $f(p0) -> ret { let v8 := p0 - let t13 := and(byte(0, mload(v8)), 0xff) - let v7 := t13 + let t11 := and(byte(0, mload(v8)), 0xff) + let v7 := t11 switch and(v7, 0xff) case 0 { - let v10 := p0 - let t14 := mload(add(v10, 1)) - let v9 := t14 - mstore(add(p0, 1), v9) - let t15 := mload(add(p0, 1)) - let v11 := t15 - let v1 := v11 + let t12 := mload(add(p0, 1)) + let v9 := t12 + let v1 := v9 ret := v1 leave } case 1 { - let v12 := 0x00 - let v5 := v12 + let v10 := 0x00 + let v5 := v10 ret := v5 leave } diff --git a/crates/codegen/tests/fixtures/match_arm_return_comma.snap b/crates/codegen/tests/fixtures/match_arm_return_comma.snap index dbbfe5891b..7643712b15 100644 --- a/crates/codegen/tests/fixtures/match_arm_return_comma.snap +++ b/crates/codegen/tests/fixtures/match_arm_return_comma.snap @@ -7,23 +7,19 @@ object "main" { code { function $f(p0) -> ret { let v8 := p0 - let t13 := and(byte(0, mload(v8)), 0xff) - let v7 := t13 + let t11 := and(byte(0, mload(v8)), 0xff) + let v7 := t11 switch and(v7, 0xff) case 0 { - let v10 := p0 - let t14 := mload(add(v10, 1)) - let v9 := t14 - mstore(add(p0, 1), v9) - let t15 := mload(add(p0, 1)) - let v11 := t15 - let v1 := v11 + let t12 := mload(add(p0, 1)) + let v9 := t12 + let v1 := v9 ret := v1 leave } case 1 { - let v12 := 0x00 - let v5 := v12 + let v10 := 0x00 + let v5 := v10 ret := v5 leave } diff --git a/crates/codegen/tests/fixtures/match_nested_default.snap b/crates/codegen/tests/fixtures/match_nested_default.snap index 688a64c0ec..e028236df4 100644 --- a/crates/codegen/tests/fixtures/match_nested_default.snap +++ b/crates/codegen/tests/fixtures/match_nested_default.snap @@ -8,47 +8,41 @@ object "main" { function $deeply_nested_wildcard(p0) -> ret { let v1 := 0 let v8 := p0 - let t23 := and(byte(0, mload(v8)), 0xff) - let v7 := t23 + let t19 := and(byte(0, mload(v8)), 0xff) + let v7 := t19 switch and(v7, 0xff) case 0 { } default { invalid() } - let v10 := p0 - let v9 := add(v10, 1) - mstore(add(p0, 1), mload(v9)) - let v12 := add(p0, 1) - let t25 := and(byte(0, mload(v12)), 0xff) - let v11 := t25 - switch and(v11, 0xff) + let v10 := add(p0, 1) + let t20 := and(byte(0, mload(v10)), 0xff) + let v9 := t20 + switch and(v9, 0xff) case 0 { - let v14 := add(p0, 1) - let v13 := add(v14, 1) - mstore(add(add(p0, 1), 1), mload(v13)) - let v16 := add(add(p0, 1), 1) - let t27 := and(byte(0, mload(v16)), 0xff) - let v15 := t27 - switch and(v15, 0xff) + let v12 := add(add(p0, 1), 1) + let t21 := and(byte(0, mload(v12)), 0xff) + let v11 := t21 + switch and(v11, 0xff) case 0 { - let v19 := 0x01 - let v4 := and(v19, 0xff) - let v20 := 0x01 - v1 := and(v20, 0xff) + let v15 := 0x01 + let v4 := and(v15, 0xff) + let v16 := 0x01 + v1 := and(v16, 0xff) } default { - let v21 := 0x00 - let v5 := and(v21, 0xff) - let v22 := 0x00 - v1 := and(v22, 0xff) + let v17 := 0x00 + let v5 := and(v17, 0xff) + let v18 := 0x00 + v1 := and(v18, 0xff) } } default { - let v17 := 0x00 - let v6 := and(v17, 0xff) - let v18 := 0x00 - v1 := and(v18, 0xff) + let v13 := 0x00 + let v6 := and(v13, 0xff) + let v14 := 0x00 + v1 := and(v14, 0xff) } ret := and(v1, 0xff) leave @@ -56,44 +50,41 @@ object "main" { function $exhaustive_inner_outer_wildcard(p0) -> ret { let v1 := 0 let v8 := p0 - let t21 := and(byte(0, mload(v8)), 0xff) - let v7 := t21 + let t19 := and(byte(0, mload(v8)), 0xff) + let v7 := t19 switch and(v7, 0xff) case 0 { - let v10 := p0 - let v9 := add(v10, 1) - mstore(add(p0, 1), mload(v9)) - let v12 := add(p0, 1) - let t23 := and(byte(0, mload(v12)), 0xff) - let v11 := t23 - switch and(v11, 0xff) + let v10 := add(p0, 1) + let t20 := and(byte(0, mload(v10)), 0xff) + let v9 := t20 + switch and(v9, 0xff) case 0 { - let v15 := 0x01 - let v3 := and(v15, 0xff) - let v16 := 0x01 - v1 := and(v16, 0xff) + let v13 := 0x01 + let v3 := and(v13, 0xff) + let v14 := 0x01 + v1 := and(v14, 0xff) } case 1 { - let v17 := 0x02 - let v4 := and(v17, 0xff) - let v18 := 0x02 - v1 := and(v18, 0xff) + let v15 := 0x02 + let v4 := and(v15, 0xff) + let v16 := 0x02 + v1 := and(v16, 0xff) } case 2 { - let v19 := 0x03 - let v5 := and(v19, 0xff) - let v20 := 0x03 - v1 := and(v20, 0xff) + let v17 := 0x03 + let v5 := and(v17, 0xff) + let v18 := 0x03 + v1 := and(v18, 0xff) } default { invalid() } } default { - let v13 := 0x00 - let v6 := and(v13, 0xff) - let v14 := 0x00 - v1 := and(v14, 0xff) + let v11 := 0x00 + let v6 := and(v11, 0xff) + let v12 := 0x00 + v1 := and(v12, 0xff) } ret := and(v1, 0xff) leave @@ -252,49 +243,43 @@ object "main" { function $nested_with_defaults(p0) -> ret { let v1 := 0 let v9 := p0 - let t26 := and(byte(0, mload(v9)), 0xff) - let v8 := t26 + let t22 := and(byte(0, mload(v9)), 0xff) + let v8 := t22 switch and(v8, 0xff) case 0 { - let v11 := p0 - let v10 := add(v11, 1) - mstore(add(p0, 1), mload(v10)) - let v13 := add(p0, 1) - let t28 := and(byte(0, mload(v13)), 0xff) - let v12 := t28 - switch and(v12, 0xff) + let v11 := add(p0, 1) + let t23 := and(byte(0, mload(v11)), 0xff) + let v10 := t23 + switch and(v10, 0xff) case 0 { - let v18 := 0x01 - let v3 := and(v18, 0xff) - let v19 := 0x01 - v1 := and(v19, 0xff) + let v14 := 0x01 + let v3 := and(v14, 0xff) + let v15 := 0x01 + v1 := and(v15, 0xff) } default { - let v20 := 0x00 - let v4 := and(v20, 0xff) - let v21 := 0x00 - v1 := and(v21, 0xff) + let v16 := 0x00 + let v4 := and(v16, 0xff) + let v17 := 0x00 + v1 := and(v17, 0xff) } } case 1 { - let v15 := p0 - let v14 := add(v15, 1) - mstore(add(p0, 1), mload(v14)) - let v17 := add(p0, 1) - let t30 := and(byte(0, mload(v17)), 0xff) - let v16 := t30 - switch and(v16, 0xff) + let v13 := add(p0, 1) + let t24 := and(byte(0, mload(v13)), 0xff) + let v12 := t24 + switch and(v12, 0xff) case 1 { - let v22 := 0x02 - let v6 := and(v22, 0xff) - let v23 := 0x02 - v1 := and(v23, 0xff) + let v18 := 0x02 + let v6 := and(v18, 0xff) + let v19 := 0x02 + v1 := and(v19, 0xff) } default { - let v24 := 0x00 - let v7 := and(v24, 0xff) - let v25 := 0x00 - v1 := and(v25, 0xff) + let v20 := 0x00 + let v7 := and(v20, 0xff) + let v21 := 0x00 + v1 := and(v21, 0xff) } } default { @@ -306,35 +291,32 @@ object "main" { function $outer_specific_inner_wildcard(p0) -> ret { let v1 := 0 let v7 := p0 - let t18 := and(byte(0, mload(v7)), 0xff) - let v6 := t18 + let t16 := and(byte(0, mload(v7)), 0xff) + let v6 := t16 switch and(v6, 0xff) case 0 { - let v9 := p0 - let v8 := add(v9, 1) - mstore(add(p0, 1), mload(v8)) - let v11 := add(p0, 1) - let t20 := and(byte(0, mload(v11)), 0xff) - let v10 := t20 - switch and(v10, 0xff) + let v9 := add(p0, 1) + let t17 := and(byte(0, mload(v9)), 0xff) + let v8 := t17 + switch and(v8, 0xff) case 0 { - let v14 := 0x01 - let v3 := and(v14, 0xff) - let v15 := 0x01 - v1 := and(v15, 0xff) + let v12 := 0x01 + let v3 := and(v12, 0xff) + let v13 := 0x01 + v1 := and(v13, 0xff) } default { - let v16 := 0x02 - let v4 := and(v16, 0xff) - let v17 := 0x02 - v1 := and(v17, 0xff) + let v14 := 0x02 + let v4 := and(v14, 0xff) + let v15 := 0x02 + v1 := and(v15, 0xff) } } default { - let v12 := 0x03 - let v5 := and(v12, 0xff) - let v13 := 0x03 - v1 := and(v13, 0xff) + let v10 := 0x03 + let v5 := and(v10, 0xff) + let v11 := 0x03 + v1 := and(v11, 0xff) } ret := and(v1, 0xff) leave diff --git a/crates/codegen/tests/fixtures/match_struct.snap b/crates/codegen/tests/fixtures/match_struct.snap index ecf6fc9c91..79953479f4 100644 --- a/crates/codegen/tests/fixtures/match_struct.snap +++ b/crates/codegen/tests/fixtures/match_struct.snap @@ -65,70 +65,61 @@ object "main" { let v6 := 0 let v22 := p0 v5 := v22 - let t39 := and(mload(add(v5, 32)), 0xff) - let v23 := t39 - mstore(add(v5, 32), and(and(v23, 0xff), 0xff)) - let v24 := 0x00 - let v8 := and(v24, 0xff) - let t40 := and(mload(add(v5, 32)), 0xff) - let v25 := t40 - let v9 := iszero(iszero(eq(and(v25, 0xff), and(v8, 0xff)))) + let v23 := 0x00 + let v8 := and(v23, 0xff) + let t36 := and(mload(add(v5, 32)), 0xff) + let v24 := t36 + let v9 := iszero(iszero(eq(and(v24, 0xff), and(v8, 0xff)))) if iszero(iszero(v9)) { - let t41 := and(mload(v5), 0xff) - let v26 := t41 - mstore(v5, and(and(v26, 0xff), 0xff)) - let v27 := 0x00 - let v11 := and(v27, 0xff) - let t42 := and(mload(v5), 0xff) - let v28 := t42 - let v12 := iszero(iszero(eq(and(v28, 0xff), and(v11, 0xff)))) + let v25 := 0x00 + let v11 := and(v25, 0xff) + let t37 := and(mload(v5), 0xff) + let v26 := t37 + let v12 := iszero(iszero(eq(and(v26, 0xff), and(v11, 0xff)))) if iszero(iszero(v12)) { - let v32 := 0x00 - let v13 := and(v32, 0xff) - let v33 := 0x00 - v6 := and(v33, 0xff) + let v29 := 0x00 + let v13 := and(v29, 0xff) + let v30 := 0x00 + v6 := and(v30, 0xff) } if iszero(iszero(iszero(v12))) { - let t43 := and(mload(v5), 0xff) - let v34 := t43 - let v2 := and(v34, 0xff) + let t38 := and(mload(v5), 0xff) + let v31 := t38 + let v2 := and(v31, 0xff) let v14 := and(v2, 0xff) v6 := and(v14, 0xff) } } if iszero(iszero(iszero(v9))) { - let t44 := and(mload(v5), 0xff) - let v29 := t44 - mstore(v5, and(and(v29, 0xff), 0xff)) - let v30 := 0x00 - let v16 := and(v30, 0xff) - let t45 := and(mload(v5), 0xff) - let v31 := t45 - let v17 := iszero(iszero(eq(and(v31, 0xff), and(v16, 0xff)))) + let v27 := 0x00 + let v16 := and(v27, 0xff) + let t39 := and(mload(v5), 0xff) + let v28 := t39 + let v17 := iszero(iszero(eq(and(v28, 0xff), and(v16, 0xff)))) if iszero(iszero(v17)) { - let t46 := and(mload(add(v5, 32)), 0xff) - let v35 := t46 - let v1 := and(v35, 0xff) + let t40 := and(mload(add(v5, 32)), 0xff) + let v32 := t40 + let v1 := and(v32, 0xff) let v18 := and(v1, 0xff) v6 := and(v18, 0xff) } if iszero(iszero(iszero(v17))) { - let t47 := and(mload(add(v5, 32)), 0xff) - let v36 := t47 - let v4 := and(v36, 0xff) - let t48 := and(mload(v5), 0xff) - let v37 := t48 - let v3 := and(v37, 0xff) + let t41 := and(mload(add(v5, 32)), 0xff) + let v33 := t41 + let v4 := and(v33, 0xff) + let t42 := and(mload(v5), 0xff) + let v34 := t42 + let v3 := and(v34, 0xff) let v19 := and(v3, 0xff) let v20 := and(v4, 0xff) - let t49 := and(add(and(v19, 0xff), and(v20, 0xff)), 0xff) - if lt(t49, and(v19, 0xff)) { + let t43 := and(add(and(v19, 0xff), and(v20, 0xff)), 0xff) + if lt(t43, and(v19, 0xff)) { mstore(0, 0x4e487b7100000000000000000000000000000000000000000000000000000000) mstore(4, 0x11) revert(0, 36) } - let v38 := t49 - let v21 := and(v38, 0xff) + let v35 := t43 + let v21 := and(v35, 0xff) v6 := and(v21, 0xff) } } @@ -140,40 +131,34 @@ object "main" { let v2 := 0 let v12 := p0 v1 := v12 - let t25 := and(mload(v1), 0xff) - let v13 := t25 - mstore(v1, and(and(v13, 0xff), 0xff)) - let v14 := 0x00 - let v4 := and(v14, 0xff) - let t26 := and(mload(v1), 0xff) - let v15 := t26 - let v5 := iszero(iszero(eq(and(v15, 0xff), and(v4, 0xff)))) + let v13 := 0x00 + let v4 := and(v13, 0xff) + let t23 := and(mload(v1), 0xff) + let v14 := t23 + let v5 := iszero(iszero(eq(and(v14, 0xff), and(v4, 0xff)))) if iszero(iszero(v5)) { + let v15 := 0x01 + let v6 := and(v15, 0xff) let v16 := 0x01 - let v6 := and(v16, 0xff) - let v17 := 0x01 - v2 := and(v17, 0xff) + v2 := and(v16, 0xff) } if iszero(iszero(iszero(v5))) { - let t27 := and(mload(add(v1, 32)), 0xff) - let v18 := t27 - mstore(add(v1, 32), and(and(v18, 0xff), 0xff)) - let v19 := 0x00 - let v8 := and(v19, 0xff) - let t28 := and(mload(add(v1, 32)), 0xff) - let v20 := t28 - let v9 := iszero(iszero(eq(and(v20, 0xff), and(v8, 0xff)))) + let v17 := 0x00 + let v8 := and(v17, 0xff) + let t24 := and(mload(add(v1, 32)), 0xff) + let v18 := t24 + let v9 := iszero(iszero(eq(and(v18, 0xff), and(v8, 0xff)))) if iszero(iszero(v9)) { - let v21 := 0x02 - let v10 := and(v21, 0xff) - let v22 := 0x02 - v2 := and(v22, 0xff) + let v19 := 0x02 + let v10 := and(v19, 0xff) + let v20 := 0x02 + v2 := and(v20, 0xff) } if iszero(iszero(iszero(v9))) { - let v23 := 0x03 - let v11 := and(v23, 0xff) - let v24 := 0x03 - v2 := and(v24, 0xff) + let v21 := 0x03 + let v11 := and(v21, 0xff) + let v22 := 0x03 + v2 := and(v22, 0xff) } } ret := and(v2, 0xff) diff --git a/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap index 00402ed353..bb1281a45c 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/create_contract.snap @@ -1692,20 +1692,19 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f8f2 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f8f2 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1714,24 +1713,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_90b8 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_90b8 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1739,37 +1738,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3bfc(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3a5b v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3a5b v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1778,24 +1770,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a9cc v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a9cc v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1803,37 +1795,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8dbd(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_afea v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_afea v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1842,24 +1827,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_1b26 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_1b26 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1867,37 +1852,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_bdd2(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7357 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7357 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1906,24 +1884,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9d90 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9d90 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1931,37 +1909,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_be19(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f2e9 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f2e9 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1970,24 +1941,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3b13 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3b13 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1995,37 +1966,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e372(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7ae6 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7ae6 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -2034,24 +1998,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9b8c v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9b8c v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -2059,17 +2023,11 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolEncoder_19ce__set_base_3f4d(v0.objref<@layout_4>, v1.i256) { diff --git a/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap b/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap index a7dc0abede..fc08a94644 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/effect_handle_field_deref.snap @@ -1045,20 +1045,19 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_b143 v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_b143 v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1067,24 +1066,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_ca68 v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_ca68 v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1092,37 +1091,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_77a7(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7233 v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7233 v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1131,24 +1123,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_caf8 v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_caf8 v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1156,37 +1148,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b6e9(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_0a8e v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_0a8e v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1195,24 +1180,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d0f7 v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d0f7 v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1220,37 +1205,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c929(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_2605 v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_2605 v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1259,24 +1237,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a18e v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a18e v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1284,37 +1262,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d39e(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c8fa v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c8fa v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1323,24 +1294,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_bd46 v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_bd46 v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1348,37 +1319,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_ebbf(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_9b08 v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_9b08 v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1387,24 +1351,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_731b v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_731b v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1412,17 +1376,11 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_6a44(v0.objref<@layout_5>, v1.i256) { diff --git a/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap b/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap index 6db4dc0d1e..3407f4d0a2 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/erc20.snap @@ -5487,26 +5487,21 @@ func private %eq(v0.@layout_0, v1.@layout_0) -> i1 { block0: v2.objref<@layout_0> = obj.alloc @layout_0; v3.objref<@layout_0> = obj.alloc @layout_0; - v4.*i256 = alloca i256; - v6.objref = obj.proj v2 0.i256; - v7.i256 = extract_value v0 0.i256; - obj.store v6 v7; - v8.objref = obj.proj v3 0.i256; - v9.i256 = extract_value v1 0.i256; - obj.store v8 v9; + v5.objref = obj.proj v2 0.i256; + v6.i256 = extract_value v0 0.i256; + obj.store v5 v6; + v7.objref = obj.proj v3 0.i256; + v8.i256 = extract_value v1 0.i256; + obj.store v7 v8; jump block1; block1: - v10.objref = obj.proj v2 0.i256; - v11.i256 = obj.load v10; - v12.objref = obj.proj v3 0.i256; - v13.i256 = obj.load v12; - v14.objref = obj.proj v3 0.i256; - obj.store v14 v13; - v15.objref = obj.proj v3 0.i256; - v16.i256 = obj.load v15; - v17.i1 = eq v11 v16; - return v17; + v9.objref = obj.proj v2 0.i256; + v10.i256 = obj.load v9; + v11.objref = obj.proj v3 0.i256; + v12.i256 = obj.load v11; + v13.i1 = eq v10 v12; + return v13; } func private %std__lib__evm__word__impl_trait_u256_1f9e__from_word_2f17(v0.i256) -> i256 { @@ -7707,20 +7702,19 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_4b56 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_4b56 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -7729,24 +7723,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f700 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f700 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -7754,37 +7748,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0d5e(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_52e4 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_52e4 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -7793,24 +7780,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_ebca v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_ebca v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -7818,37 +7805,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_0 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1898(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_d29e v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_d29e v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -7857,24 +7837,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_90b5 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_90b5 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -7882,37 +7862,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2418(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f69f v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f69f v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -7921,24 +7894,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a844 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a844 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -7946,37 +7919,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2677(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6eac v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6eac v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -7985,24 +7951,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_dbef v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_dbef v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8010,37 +7976,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2ec5(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_acd0 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_acd0 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8049,24 +8008,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_5d2f v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_5d2f v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8074,37 +8033,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_2 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3bfe(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3fdb v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3fdb v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8113,24 +8065,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_bd7e v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_bd7e v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8138,37 +8090,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_3 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_44f9(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5bb5 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5bb5 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8177,24 +8122,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_4 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2d1c v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2d1c v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8202,37 +8147,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_4 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_50b8(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_54c0 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_54c0 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8241,24 +8179,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3e3b v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3e3b v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8266,37 +8204,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_51c6(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8f90 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8f90 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8305,24 +8236,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_47bf v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_47bf v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8330,37 +8261,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6776(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3194 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_3194 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8369,24 +8293,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f4a7 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f4a7 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8394,37 +8318,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_697f(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8042 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8042 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8433,24 +8350,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_71ef v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_71ef v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8458,37 +8375,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_6 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7304(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8e49 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8e49 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8497,24 +8407,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_10fb v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_10fb v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8522,37 +8432,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_75ad(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_83a5 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_83a5 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8561,24 +8464,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_63c2 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_63c2 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8586,37 +8489,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7676(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7aa7 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7aa7 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8625,24 +8521,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_348a v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_348a v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8650,37 +8546,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7972(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_07fa v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_07fa v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8689,24 +8578,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_4b4e v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_4b4e v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8714,37 +8603,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7ba8(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_9e12 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_9e12 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8753,24 +8635,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_ece9 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_ece9 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8778,37 +8660,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_7 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_83b2(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6aca v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6aca v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8817,24 +8692,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_8ba4 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_8ba4 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8842,37 +8717,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_87d4(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8f13 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8f13 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8881,24 +8749,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2fc3 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2fc3 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8906,37 +8774,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8be4(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c9e2 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c9e2 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -8945,24 +8806,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_b2e2 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_b2e2 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -8970,37 +8831,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8be4_0(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c9e2_0 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c9e2_0 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9009,24 +8863,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_b2e2_0 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_b2e2_0 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9034,37 +8888,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8cb0(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c5d0 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c5d0 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9073,24 +8920,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_6fee v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_6fee v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9098,37 +8945,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_8 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9212(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5fa6 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5fa6 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9137,24 +8977,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_c1bd v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_c1bd v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9162,37 +9002,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9246(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8379 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8379 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9201,24 +9034,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2cc5 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2cc5 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9226,37 +9059,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9743(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_1af2 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_1af2 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9265,24 +9091,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9 jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f9b v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_7f9b v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9290,37 +9116,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_9 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a048(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_af05 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_af05 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9329,24 +9148,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_091f v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_091f v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9354,37 +9173,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a40d(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_10c2 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_10c2 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9393,24 +9205,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_aab1 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_aab1 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9418,37 +9230,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a99d(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6679 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6679 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9457,24 +9262,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_8e1e v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_8e1e v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9482,37 +9287,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_a evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b3f4(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7c3a v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_7c3a v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9521,24 +9319,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_0ddd v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_0ddd v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9546,37 +9344,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_bc48(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_a6d8 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_a6d8 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9585,24 +9376,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_de6a v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_de6a v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9610,37 +9401,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_bffc(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8ee6 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_8ee6 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9649,24 +9433,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_142c v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_142c v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9674,37 +9458,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c0d0(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_cf02 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_cf02 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9713,24 +9490,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f768 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_f768 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9738,37 +9515,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d64a(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5b55 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5b55 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9777,24 +9547,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a988 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_a988 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9802,37 +9572,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_da62(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c5ca v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_c5ca v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9841,24 +9604,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3283 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_3283 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9866,37 +9629,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_d evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e05e(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_98ab v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_98ab v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9905,24 +9661,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_8ac3 v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_8ac3 v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9930,37 +9686,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e61f(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_4f68 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_4f68 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -9969,24 +9718,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9d5e v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9d5e v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -9994,37 +9743,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_ed8c(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6e05 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6e05 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -10033,24 +9775,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_5ebd v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_5ebd v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -10058,37 +9800,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_e evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_fd97(v0.objref<@layout_7>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_6> = obj.proj v0 0.i256; - v7.objref<@layout_5> = obj.proj v6 0.i256; - v8.@layout_5 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_d2a6 v8; - mstore v1 v9 i256; - v10.objref<@layout_6> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_6> = obj.proj v0 0.i256; + v6.objref<@layout_5> = obj.proj v5 0.i256; + v7.@layout_5 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_d2a6 v7; + mstore v1 v8 i256; + v9.objref<@layout_6> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -10097,24 +9832,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f jump block4; block4: - v32.objref<@layout_6> = obj.proj v0 0.i256; - v33.objref<@layout_5> = obj.proj v32 0.i256; - v34.@layout_5 = obj.load v33; - v35.objref<@layout_6> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_41fc v34 v37; - v40.objref<@layout_6> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_6> = obj.proj v0 0.i256; + v27.objref<@layout_5> = obj.proj v26 0.i256; + v28.@layout_5 = obj.load v27; + v29.objref<@layout_6> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_41fc v28 v31; + v34.objref<@layout_6> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -10122,17 +9857,11 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_6> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_6> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_6> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_6> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %require(v0.i256, v1.objref<@layout_2>) { diff --git a/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap b/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap index ac7d692a7f..0fe48c0bb6 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/erc20_low_level.snap @@ -303,52 +303,42 @@ func private %std__lib__evm__effects__impl_trait_Address_3ffb__eq_43a4(v0.@layou block0: v2.objref<@layout_2> = obj.alloc @layout_2; v3.objref<@layout_2> = obj.alloc @layout_2; - v4.*i256 = alloca i256; - v6.objref = obj.proj v2 0.i256; - v7.i256 = extract_value v0 0.i256; - obj.store v6 v7; - v8.objref = obj.proj v3 0.i256; - v9.i256 = extract_value v1 0.i256; - obj.store v8 v9; + v5.objref = obj.proj v2 0.i256; + v6.i256 = extract_value v0 0.i256; + obj.store v5 v6; + v7.objref = obj.proj v3 0.i256; + v8.i256 = extract_value v1 0.i256; + obj.store v7 v8; jump block1; block1: - v10.objref = obj.proj v2 0.i256; - v11.i256 = obj.load v10; - v12.objref = obj.proj v3 0.i256; - v13.i256 = obj.load v12; - v14.objref = obj.proj v3 0.i256; - obj.store v14 v13; - v15.objref = obj.proj v3 0.i256; - v16.i256 = obj.load v15; - v17.i1 = eq v11 v16; - return v17; + v9.objref = obj.proj v2 0.i256; + v10.i256 = obj.load v9; + v11.objref = obj.proj v3 0.i256; + v12.i256 = obj.load v11; + v13.i1 = eq v10 v12; + return v13; } func private %std__lib__evm__effects__impl_trait_Address_3ffb__eq_43a4_0(v0.@layout_2, v1.@layout_2) -> i1 { block0: v2.objref<@layout_2> = obj.alloc @layout_2; v3.objref<@layout_2> = obj.alloc @layout_2; - v4.*i256 = alloca i256; - v6.objref = obj.proj v2 0.i256; - v7.i256 = extract_value v0 0.i256; - obj.store v6 v7; - v8.objref = obj.proj v3 0.i256; - v9.i256 = extract_value v1 0.i256; - obj.store v8 v9; + v5.objref = obj.proj v2 0.i256; + v6.i256 = extract_value v0 0.i256; + obj.store v5 v6; + v7.objref = obj.proj v3 0.i256; + v8.i256 = extract_value v1 0.i256; + obj.store v7 v8; jump block1; block1: - v10.objref = obj.proj v2 0.i256; - v11.i256 = obj.load v10; - v12.objref = obj.proj v3 0.i256; - v13.i256 = obj.load v12; - v14.objref = obj.proj v3 0.i256; - obj.store v14 v13; - v15.objref = obj.proj v3 0.i256; - v16.i256 = obj.load v15; - v17.i1 = eq v11 v16; - return v17; + v9.objref = obj.proj v2 0.i256; + v10.i256 = obj.load v9; + v11.objref = obj.proj v3 0.i256; + v12.i256 = obj.load v11; + v13.i1 = eq v10 v12; + return v13; } func private %core__lib__effect_ref__impl_trait_StorPtr_27da__from_raw__gb51e_82ea(v0.i256) -> i256 { @@ -581,26 +571,19 @@ func private %mint__g0502(v0.i256, v1.@layout_2, v2.i256, v3.objref<@layout_1>, block0: v5.objref<@layout_2> = obj.alloc @layout_2; v6.*i256 = alloca i256; - v7.objref<@layout_2> = obj.alloc @layout_2; - v9.objref = obj.proj v5 0.i256; - v10.i256 = extract_value v1 0.i256; - obj.store v9 v10; + v8.objref = obj.proj v5 0.i256; + v9.i256 = extract_value v1 0.i256; + obj.store v8 v9; mstore v6 v2 i256; jump block1; block1: - v11.@layout_2 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_1c07_1; - v14.i256 = add v0 1.i256; - v16.i256 = evm_sload v14; - v17.@layout_2 = insert_value undef.@layout_2 0.i256 v16; - v18.i256 = add v0 1.i256; - v19.i256 = extract_value v17 0.i256; - evm_sstore v18 v19; - v20.i256 = add v0 1.i256; - v22.i256 = evm_sload v20; - v23.@layout_2 = insert_value undef.@layout_2 0.i256 v22; - v24.i1 = call %core__lib__ops__trait_Eq__ne__g7528_a982 v11 v23; - br v24 block2 block3; + v10.@layout_2 = call %std__lib__evm__effects__impl_trait_Evm_a1e8__caller_1c07_1; + v13.i256 = add v0 1.i256; + v15.i256 = evm_sload v13; + v16.@layout_2 = insert_value undef.@layout_2 0.i256 v15; + v17.i1 = call %core__lib__ops__trait_Eq__ne__g7528_a982 v10 v16; + br v17 block2 block3; block2: call %std__lib__evm__effects__impl_trait_Evm_0098__revert_7c32 0.i256 0.i256; @@ -610,12 +593,12 @@ func private %mint__g0502(v0.i256, v1.@layout_2, v2.i256, v3.objref<@layout_1>, jump block4; block4: - v25.@layout_2 = obj.load v5; - v27.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_6d6f v0 v25; - v28.@layout_2 = obj.load v5; - v29.i256 = mload v6 i256; - (v30.i256, v31.i1) = uaddo v27 v29; - br v31 block5 block6; + v18.@layout_2 = obj.load v5; + v20.i256 = call %standalone_erc20_low_level__erc20_low_level__impl_Erc20_16d9__balance_of__g35d6_6d6f v0 v18; + v21.@layout_2 = obj.load v5; + v22.i256 = mload v6 i256; + (v23.i256, v24.i1) = uaddo v20 v22; + br v24 block5 block6; block5: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -623,14 +606,14 @@ func private %mint__g0502(v0.i256, v1.@layout_2, v2.i256, v3.objref<@layout_1>, evm_revert 0.i256 36.i256; block6: - call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_a4c9 v28 v30; - v39.i256 = evm_sload v0; - v40.i256 = mload v6 i256; - (v41.i256, v42.i1) = uaddo v39 v40; - br v42 block5 block7; + call %std__lib__evm__storage_map__impl_StorageMap_9f54__set__g2163_a4c9 v21 v23; + v32.i256 = evm_sload v0; + v33.i256 = mload v6 i256; + (v34.i256, v35.i1) = uaddo v32 v33; + br v35 block5 block7; block7: - evm_sstore v0 v41; + evm_sstore v0 v34; return; } diff --git a/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap b/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap index 16789b333f..7c6991afdc 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/for_range.snap @@ -89,35 +89,30 @@ func private %get(v0.objref<@layout_0>, v1.i256) -> i256 { func private %len(v0.objref<@layout_0>) -> i256 { block0: - v1.*i256 = alloca i256; jump block1; block1: - v4.objref = obj.proj v0 1.i256; - v5.i256 = obj.load v4; - v7.objref = obj.proj v0 0.i256; - v8.i256 = obj.load v7; - v9.objref = obj.proj v0 0.i256; - obj.store v9 v8; - v10.objref = obj.proj v0 0.i256; - v11.i256 = obj.load v10; - v12.i1 = lt v5 v11; - br v12 block2 block3; + v3.objref = obj.proj v0 1.i256; + v4.i256 = obj.load v3; + v6.objref = obj.proj v0 0.i256; + v7.i256 = obj.load v6; + v8.i1 = lt v4 v7; + br v8 block2 block3; block2: jump block4; block3: - v14.objref = obj.proj v0 1.i256; - v15.i256 = obj.load v14; - v16.objref = obj.proj v0 0.i256; - v17.i256 = obj.load v16; - (v18.i256, v19.i1) = usubo v15 v17; - br v19 block5 block6; + v10.objref = obj.proj v0 1.i256; + v11.i256 = obj.load v10; + v12.objref = obj.proj v0 0.i256; + v13.i256 = obj.load v12; + (v14.i256, v15.i1) = usubo v11 v13; + br v15 block5 block6; block4: - v24.i256 = phi (0.i256 block2) (v18 block6); - return v24; + v20.i256 = phi (0.i256 block2) (v14 block6); + return v20; block5: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; diff --git a/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap b/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap index 65f3200cc8..3b32cd66a5 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/high_level_contract.snap @@ -905,20 +905,19 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_1> = obj.proj v0 0.i256; - v7.objref<@layout_0> = obj.proj v6 0.i256; - v8.@layout_0 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f8c0 v8; - mstore v1 v9 i256; - v10.objref<@layout_1> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_1> = obj.proj v0 0.i256; + v6.objref<@layout_0> = obj.proj v5 0.i256; + v7.@layout_0 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_f8c0 v7; + mstore v1 v8 i256; + v9.objref<@layout_1> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -927,24 +926,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 jump block4; block4: - v32.objref<@layout_1> = obj.proj v0 0.i256; - v33.objref<@layout_0> = obj.proj v32 0.i256; - v34.@layout_0 = obj.load v33; - v35.objref<@layout_1> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_43ea v34 v37; - v40.objref<@layout_1> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_1> = obj.proj v0 0.i256; + v27.objref<@layout_0> = obj.proj v26 0.i256; + v28.@layout_0 = obj.load v27; + v29.objref<@layout_1> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_43ea v28 v31; + v34.objref<@layout_1> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -952,37 +951,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_1> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_1> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_1> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_1> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1759(v0.objref<@layout_2>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_1> = obj.proj v0 0.i256; - v7.objref<@layout_0> = obj.proj v6 0.i256; - v8.@layout_0 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_639c v8; - mstore v1 v9 i256; - v10.objref<@layout_1> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_1> = obj.proj v0 0.i256; + v6.objref<@layout_0> = obj.proj v5 0.i256; + v7.@layout_0 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_639c v7; + mstore v1 v8 i256; + v9.objref<@layout_1> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -991,24 +983,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 jump block4; block4: - v32.objref<@layout_1> = obj.proj v0 0.i256; - v33.objref<@layout_0> = obj.proj v32 0.i256; - v34.@layout_0 = obj.load v33; - v35.objref<@layout_1> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d43a v34 v37; - v40.objref<@layout_1> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_1> = obj.proj v0 0.i256; + v27.objref<@layout_0> = obj.proj v26 0.i256; + v28.@layout_0 = obj.load v27; + v29.objref<@layout_1> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d43a v28 v31; + v34.objref<@layout_1> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1016,37 +1008,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_1> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_1> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_1> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_1> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5e30(v0.objref<@layout_2>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_1> = obj.proj v0 0.i256; - v7.objref<@layout_0> = obj.proj v6 0.i256; - v8.@layout_0 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6ee3 v8; - mstore v1 v9 i256; - v10.objref<@layout_1> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_1> = obj.proj v0 0.i256; + v6.objref<@layout_0> = obj.proj v5 0.i256; + v7.@layout_0 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_6ee3 v7; + mstore v1 v8 i256; + v9.objref<@layout_1> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1055,24 +1040,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5 jump block4; block4: - v32.objref<@layout_1> = obj.proj v0 0.i256; - v33.objref<@layout_0> = obj.proj v32 0.i256; - v34.@layout_0 = obj.load v33; - v35.objref<@layout_1> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_caf9 v34 v37; - v40.objref<@layout_1> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_1> = obj.proj v0 0.i256; + v27.objref<@layout_0> = obj.proj v26 0.i256; + v28.@layout_0 = obj.load v27; + v29.objref<@layout_1> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_caf9 v28 v31; + v34.objref<@layout_1> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1080,37 +1065,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_5 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_1> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_1> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_1> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_1> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_bf2c(v0.objref<@layout_2>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_1> = obj.proj v0 0.i256; - v7.objref<@layout_0> = obj.proj v6 0.i256; - v8.@layout_0 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_fbd3 v8; - mstore v1 v9 i256; - v10.objref<@layout_1> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_1> = obj.proj v0 0.i256; + v6.objref<@layout_0> = obj.proj v5 0.i256; + v7.@layout_0 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_fbd3 v7; + mstore v1 v8 i256; + v9.objref<@layout_1> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1119,24 +1097,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b jump block4; block4: - v32.objref<@layout_1> = obj.proj v0 0.i256; - v33.objref<@layout_0> = obj.proj v32 0.i256; - v34.@layout_0 = obj.load v33; - v35.objref<@layout_1> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9b33 v34 v37; - v40.objref<@layout_1> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_1> = obj.proj v0 0.i256; + v27.objref<@layout_0> = obj.proj v26 0.i256; + v28.@layout_0 = obj.load v27; + v29.objref<@layout_1> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_9b33 v28 v31; + v34.objref<@layout_1> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1144,17 +1122,11 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_b evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_1> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_1> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_1> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_1> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_0c04(v0.objref<@layout_2>, v1.i256) { diff --git a/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap b/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap index adcb368d46..719aa2dc40 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/init_args_with_child_dep.snap @@ -1061,20 +1061,19 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5bb3 v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_5bb3 v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1083,24 +1082,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2397 v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_2397 v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1108,37 +1107,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_1 evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c26a(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_b8bc v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_b8bc v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1147,24 +1139,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_5e1a v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_5e1a v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1172,37 +1164,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_c evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f2ee(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_cc6d v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_cc6d v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1211,24 +1196,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_89b0 v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_89b0 v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1236,37 +1221,30 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_fb8f(v0.objref<@layout_5>) -> i256 { block0: v1.*i256 = alloca i256; v2.*i256 = alloca i256; - v3.*i256 = alloca i256; jump block1; block1: - v6.objref<@layout_4> = obj.proj v0 0.i256; - v7.objref<@layout_3> = obj.proj v6 0.i256; - v8.@layout_3 = obj.load v7; - v9.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_0327 v8; - mstore v1 v9 i256; - v10.objref<@layout_4> = obj.proj v0 0.i256; - v12.objref = obj.proj v10 1.i256; - v13.i256 = obj.load v12; - (v15.i256, v16.i1) = uaddo v13 32.i256; - br v16 block6 block7; + v5.objref<@layout_4> = obj.proj v0 0.i256; + v6.objref<@layout_3> = obj.proj v5 0.i256; + v7.@layout_3 = obj.load v6; + v8.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__len_0327 v7; + mstore v1 v8 i256; + v9.objref<@layout_4> = obj.proj v0 0.i256; + v11.objref = obj.proj v9 1.i256; + v12.i256 = obj.load v11; + (v14.i256, v15.i1) = uaddo v12 32.i256; + br v15 block6 block7; block2: evm_revert 0.i256 0.i256; @@ -1275,24 +1253,24 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f jump block4; block4: - v32.objref<@layout_4> = obj.proj v0 0.i256; - v33.objref<@layout_3> = obj.proj v32 0.i256; - v34.@layout_3 = obj.load v33; - v35.objref<@layout_4> = obj.proj v0 0.i256; - v36.objref = obj.proj v35 1.i256; - v37.i256 = obj.load v36; - v38.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d08f v34 v37; - v40.objref<@layout_4> = obj.proj v0 0.i256; - v41.objref = obj.proj v40 1.i256; - obj.store v41 v15; - return v38; + v26.objref<@layout_4> = obj.proj v0 0.i256; + v27.objref<@layout_3> = obj.proj v26 0.i256; + v28.@layout_3 = obj.load v27; + v29.objref<@layout_4> = obj.proj v0 0.i256; + v30.objref = obj.proj v29 1.i256; + v31.i256 = obj.load v30; + v32.i256 = call %std__lib__evm__memory_input__impl_trait_MemoryBytes_c1cd__word_at_d08f v28 v31; + v34.objref<@layout_4> = obj.proj v0 0.i256; + v35.objref = obj.proj v34 1.i256; + obj.store v35 v14; + return v32; block5: - v42.i256 = mload v1 i256; - mstore v3 v42 i256; - v44.i256 = mload v3 i256; - v45.i1 = gt v15 v44; - br v45 block2 block3; + v36.i256 = mload v1 i256; + mstore v2 v36 i256; + v38.i256 = mload v2 i256; + v39.i1 = gt v14 v38; + br v39 block2 block3; block6: mstore 0.i256 35408467139433450592217433187231851964531694900788300625387963629091585785856.i256 i256; @@ -1300,17 +1278,11 @@ func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__read_word__g463e_f evm_revert 0.i256 36.i256; block7: - v22.objref<@layout_4> = obj.proj v0 0.i256; - v23.objref = obj.proj v22 1.i256; - v24.i256 = obj.load v23; - v25.objref<@layout_4> = obj.proj v0 0.i256; - v26.objref = obj.proj v25 1.i256; - obj.store v26 v24; - v27.objref<@layout_4> = obj.proj v0 0.i256; - v28.objref = obj.proj v27 1.i256; - v29.i256 = obj.load v28; - v30.i1 = lt v15 v29; - br v30 block2 block5; + v21.objref<@layout_4> = obj.proj v0 0.i256; + v22.objref = obj.proj v21 1.i256; + v23.i256 = obj.load v22; + v24.i1 = lt v14 v23; + br v24 block2 block5; } func private %std__lib__abi__sol__impl_trait_SolDecoder_68ab__set_base__g463e_6705(v0.objref<@layout_5>, v1.i256) { diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap index 2c7d51b04b..76715f2f52 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return.snap @@ -13,27 +13,20 @@ type @layout_0 = enum { func private %f(v0.objref<@layout_0>) -> i256 { block0: v1.*i256 = alloca i256; - v2.*i256 = alloca i256; jump block1; block1: - v4.@layout_0 = obj.load v0; - v5.enumtag(@layout_0) = enum.tag v4; - br_table v5 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); + v3.@layout_0 = obj.load v0; + v4.enumtag(@layout_0) = enum.tag v3; + br_table v4 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); block2: - v9.@layout_0 = obj.load v0; - enum.assert_variant v9 #A; - v11.i256 = enum.extract v9 #A 0.i256; - v12.objref<@layout_0> = enum.assert_variant_ref v0 #A; - v13.objref = enum.proj v12 #A 0.i256; - obj.store v13 v11; - v14.objref<@layout_0> = enum.assert_variant_ref v0 #A; - v15.objref = enum.proj v14 #A 0.i256; - v16.i256 = obj.load v15; - mstore v1 v16 i256; - v17.i256 = mload v1 i256; - return v17; + v9.objref<@layout_0> = enum.assert_variant_ref v0 #A; + v10.objref = enum.proj v9 #A 0.i256; + v11.i256 = obj.load v10; + mstore v1 v11 i256; + v12.i256 = mload v1 i256; + return v12; block3: return 0.i256; diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap index 9b5d5ad620..4cc2156973 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/match_arm_return_comma.snap @@ -13,27 +13,20 @@ type @layout_0 = enum { func private %f(v0.objref<@layout_0>) -> i256 { block0: v1.*i256 = alloca i256; - v2.*i256 = alloca i256; jump block1; block1: - v4.@layout_0 = obj.load v0; - v5.enumtag(@layout_0) = enum.tag v4; - br_table v5 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); + v3.@layout_0 = obj.load v0; + v4.enumtag(@layout_0) = enum.tag v3; + br_table v4 (0.enumtag(@layout_0) block2) (1.enumtag(@layout_0) block3); block2: - v9.@layout_0 = obj.load v0; - enum.assert_variant v9 #A; - v11.i256 = enum.extract v9 #A 0.i256; - v12.objref<@layout_0> = enum.assert_variant_ref v0 #A; - v13.objref = enum.proj v12 #A 0.i256; - obj.store v13 v11; - v14.objref<@layout_0> = enum.assert_variant_ref v0 #A; - v15.objref = enum.proj v14 #A 0.i256; - v16.i256 = obj.load v15; - mstore v1 v16 i256; - v17.i256 = mload v1 i256; - return v17; + v9.objref<@layout_0> = enum.assert_variant_ref v0 #A; + v10.objref = enum.proj v9 #A 0.i256; + v11.i256 = obj.load v10; + mstore v1 v11 i256; + v12.i256 = mload v1 i256; + return v12; block3: return 0.i256; diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap index bd4bb23f14..cc6d02011b 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/match_nested_default.snap @@ -21,40 +21,32 @@ type @layout_2 = enum { func private %deeply_nested_wildcard(v0.objref<@layout_2>) -> i8 { block0: - v1.objref<@layout_1> = obj.alloc @layout_1; - v2.objref<@layout_0> = obj.alloc @layout_0; jump block1; block1: - v4.@layout_2 = obj.load v0; - v5.enumtag(@layout_2) = enum.tag v4; - br_table v5 (0.enumtag(@layout_2) block3); + v2.@layout_2 = obj.load v0; + v3.enumtag(@layout_2) = enum.tag v2; + br_table v3 (0.enumtag(@layout_2) block3); block2: - v7.i8 = phi (0.i8 block5) (1.i8 block6) (0.i8 block7); - return v7; + v5.i8 = phi (0.i8 block5) (1.i8 block6) (0.i8 block7); + return v5; block3: - v9.@layout_2 = obj.load v0; - enum.assert_variant v9 #Wrap; - v11.@layout_1 = enum.extract v9 #Wrap 0.i256; - v12.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; - v13.objref<@layout_1> = enum.proj v12 #Wrap 0.i256; - v14.enumtag(@layout_1) = enum.tag v11; - br_table v14 block9 (0.enumtag(@layout_1) block10) (1.enumtag(@layout_1) block11); + v8.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; + v9.objref<@layout_1> = enum.proj v8 #Wrap 0.i256; + v10.@layout_1 = obj.load v9; + v11.enumtag(@layout_1) = enum.tag v10; + br_table v11 block5 (0.enumtag(@layout_1) block4); block4: - v32.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; - v33.objref<@layout_1> = enum.proj v32 #Wrap 0.i256; - v34.@layout_1 = obj.load v33; - enum.assert_variant v34 #First; - v35.@layout_0 = enum.extract v34 #First 0.i256; - v36.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; - v37.objref<@layout_1> = enum.proj v36 #Wrap 0.i256; - v38.objref<@layout_1> = enum.assert_variant_ref v37 #First; - v39.objref<@layout_0> = enum.proj v38 #First 0.i256; - v40.enumtag(@layout_0) = enum.tag v35; - br_table v40 block23 (0.enumtag(@layout_0) block24) (1.enumtag(@layout_0) block25) (2.enumtag(@layout_0) block26); + v14.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; + v15.objref<@layout_1> = enum.proj v14 #Wrap 0.i256; + v16.objref<@layout_1> = enum.assert_variant_ref v15 #First; + v17.objref<@layout_0> = enum.proj v16 #First 0.i256; + v18.@layout_0 = obj.load v17; + v19.enumtag(@layout_0) = enum.tag v18; + br_table v19 block7 (0.enumtag(@layout_0) block6); block5: jump block2; @@ -64,116 +56,27 @@ func private %deeply_nested_wildcard(v0.objref<@layout_2>) -> i8 { block7: jump block2; - - block8: - v27.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; - v28.objref<@layout_1> = enum.proj v27 #Wrap 0.i256; - v29.@layout_1 = obj.load v28; - v30.enumtag(@layout_1) = enum.tag v29; - br_table v30 block5 (0.enumtag(@layout_1) block4); - - block9: - unreachable; - - block10: - enum.set_tag v13 #First; - enum.assert_variant v11 #First; - v17.objref<@layout_0> = enum.proj v13 #First 0.i256; - v18.@layout_0 = enum.extract v11 #First 0.i256; - v19.enumtag(@layout_0) = enum.tag v18; - br_table v19 block13 (0.enumtag(@layout_0) block14) (1.enumtag(@layout_0) block15) (2.enumtag(@layout_0) block16); - - block11: - enum.set_tag v13 #Second; - enum.assert_variant v11 #Second; - v23.objref<@layout_0> = enum.proj v13 #Second 0.i256; - v24.@layout_0 = enum.extract v11 #Second 0.i256; - v25.enumtag(@layout_0) = enum.tag v24; - br_table v25 block18 (0.enumtag(@layout_0) block19) (1.enumtag(@layout_0) block20) (2.enumtag(@layout_0) block21); - - block12: - jump block8; - - block13: - unreachable; - - block14: - enum.set_tag v17 #A; - jump block12; - - block15: - enum.set_tag v17 #B; - jump block12; - - block16: - enum.set_tag v17 #C; - jump block12; - - block17: - jump block8; - - block18: - unreachable; - - block19: - enum.set_tag v23 #A; - jump block17; - - block20: - enum.set_tag v23 #B; - jump block17; - - block21: - enum.set_tag v23 #C; - jump block17; - - block22: - v42.objref<@layout_2> = enum.assert_variant_ref v0 #Wrap; - v43.objref<@layout_1> = enum.proj v42 #Wrap 0.i256; - v44.objref<@layout_1> = enum.assert_variant_ref v43 #First; - v45.objref<@layout_0> = enum.proj v44 #First 0.i256; - v46.@layout_0 = obj.load v45; - v47.enumtag(@layout_0) = enum.tag v46; - br_table v47 block7 (0.enumtag(@layout_0) block6); - - block23: - unreachable; - - block24: - enum.set_tag v39 #A; - jump block22; - - block25: - enum.set_tag v39 #B; - jump block22; - - block26: - enum.set_tag v39 #C; - jump block22; } func private %exhaustive_inner_outer_wildcard(v0.objref<@layout_1>) -> i8 { block0: - v1.objref<@layout_0> = obj.alloc @layout_0; jump block1; block1: - v3.@layout_1 = obj.load v0; - v4.enumtag(@layout_1) = enum.tag v3; - br_table v4 block4 (0.enumtag(@layout_1) block3); + v2.@layout_1 = obj.load v0; + v3.enumtag(@layout_1) = enum.tag v2; + br_table v3 block4 (0.enumtag(@layout_1) block3); block2: - v6.i8 = phi (0.i8 block4) (1.i8 block5) (2.i8 block6) (3.i8 block7); - return v6; + v5.i8 = phi (0.i8 block4) (1.i8 block5) (2.i8 block6) (3.i8 block7); + return v5; block3: - v8.@layout_1 = obj.load v0; - enum.assert_variant v8 #First; - v10.@layout_0 = enum.extract v8 #First 0.i256; - v11.objref<@layout_1> = enum.assert_variant_ref v0 #First; - v12.objref<@layout_0> = enum.proj v11 #First 0.i256; - v13.enumtag(@layout_0) = enum.tag v10; - br_table v13 block9 (0.enumtag(@layout_0) block10) (1.enumtag(@layout_0) block11) (2.enumtag(@layout_0) block12); + v8.objref<@layout_1> = enum.assert_variant_ref v0 #First; + v9.objref<@layout_0> = enum.proj v8 #First 0.i256; + v10.@layout_0 = obj.load v9; + v11.enumtag(@layout_0) = enum.tag v10; + br_table v11 (0.enumtag(@layout_0) block5) (1.enumtag(@layout_0) block6) (2.enumtag(@layout_0) block7); block4: jump block2; @@ -186,28 +89,6 @@ func private %exhaustive_inner_outer_wildcard(v0.objref<@layout_1>) -> i8 { block7: jump block2; - - block8: - v18.objref<@layout_1> = enum.assert_variant_ref v0 #First; - v19.objref<@layout_0> = enum.proj v18 #First 0.i256; - v20.@layout_0 = obj.load v19; - v21.enumtag(@layout_0) = enum.tag v20; - br_table v21 (0.enumtag(@layout_0) block5) (1.enumtag(@layout_0) block6) (2.enumtag(@layout_0) block7); - - block9: - unreachable; - - block10: - enum.set_tag v12 #A; - jump block8; - - block11: - enum.set_tag v12 #B; - jump block8; - - block12: - enum.set_tag v12 #C; - jump block8; } func private %main() -> @layout_3 { @@ -512,36 +393,30 @@ func private %main_root() { func private %nested_with_defaults(v0.objref<@layout_1>) -> i8 { block0: - v1.objref<@layout_0> = obj.alloc @layout_0; - v2.objref<@layout_0> = obj.alloc @layout_0; jump block1; block1: - v4.@layout_1 = obj.load v0; - v5.enumtag(@layout_1) = enum.tag v4; - br_table v5 (0.enumtag(@layout_1) block3) (1.enumtag(@layout_1) block4); + v2.@layout_1 = obj.load v0; + v3.enumtag(@layout_1) = enum.tag v2; + br_table v3 (0.enumtag(@layout_1) block3) (1.enumtag(@layout_1) block4); block2: - v8.i8 = phi (1.i8 block5) (0.i8 block6) (2.i8 block7) (0.i8 block8); - return v8; + v6.i8 = phi (1.i8 block5) (0.i8 block6) (2.i8 block7) (0.i8 block8); + return v6; block3: - v10.@layout_1 = obj.load v0; - enum.assert_variant v10 #First; - v12.@layout_0 = enum.extract v10 #First 0.i256; - v13.objref<@layout_1> = enum.assert_variant_ref v0 #First; - v14.objref<@layout_0> = enum.proj v13 #First 0.i256; - v15.enumtag(@layout_0) = enum.tag v12; - br_table v15 block10 (0.enumtag(@layout_0) block11) (1.enumtag(@layout_0) block12) (2.enumtag(@layout_0) block13); + v9.objref<@layout_1> = enum.assert_variant_ref v0 #First; + v10.objref<@layout_0> = enum.proj v9 #First 0.i256; + v11.@layout_0 = obj.load v10; + v12.enumtag(@layout_0) = enum.tag v11; + br_table v12 block6 (0.enumtag(@layout_0) block5); block4: - v25.@layout_1 = obj.load v0; - enum.assert_variant v25 #Second; - v26.@layout_0 = enum.extract v25 #Second 0.i256; - v27.objref<@layout_1> = enum.assert_variant_ref v0 #Second; - v28.objref<@layout_0> = enum.proj v27 #Second 0.i256; - v29.enumtag(@layout_0) = enum.tag v26; - br_table v29 block15 (0.enumtag(@layout_0) block16) (1.enumtag(@layout_0) block17) (2.enumtag(@layout_0) block18); + v15.objref<@layout_1> = enum.assert_variant_ref v0 #Second; + v16.objref<@layout_0> = enum.proj v15 #Second 0.i256; + v17.@layout_0 = obj.load v16; + v18.enumtag(@layout_0) = enum.tag v17; + br_table v18 block8 (1.enumtag(@layout_0) block7); block5: jump block2; @@ -554,74 +429,27 @@ func private %nested_with_defaults(v0.objref<@layout_1>) -> i8 { block8: jump block2; - - block9: - v20.objref<@layout_1> = enum.assert_variant_ref v0 #First; - v21.objref<@layout_0> = enum.proj v20 #First 0.i256; - v22.@layout_0 = obj.load v21; - v23.enumtag(@layout_0) = enum.tag v22; - br_table v23 block6 (0.enumtag(@layout_0) block5); - - block10: - unreachable; - - block11: - enum.set_tag v14 #A; - jump block9; - - block12: - enum.set_tag v14 #B; - jump block9; - - block13: - enum.set_tag v14 #C; - jump block9; - - block14: - v31.objref<@layout_1> = enum.assert_variant_ref v0 #Second; - v32.objref<@layout_0> = enum.proj v31 #Second 0.i256; - v33.@layout_0 = obj.load v32; - v34.enumtag(@layout_0) = enum.tag v33; - br_table v34 block8 (1.enumtag(@layout_0) block7); - - block15: - unreachable; - - block16: - enum.set_tag v28 #A; - jump block14; - - block17: - enum.set_tag v28 #B; - jump block14; - - block18: - enum.set_tag v28 #C; - jump block14; } func private %outer_specific_inner_wildcard(v0.objref<@layout_1>) -> i8 { block0: - v1.objref<@layout_0> = obj.alloc @layout_0; jump block1; block1: - v3.@layout_1 = obj.load v0; - v4.enumtag(@layout_1) = enum.tag v3; - br_table v4 block4 (0.enumtag(@layout_1) block3); + v2.@layout_1 = obj.load v0; + v3.enumtag(@layout_1) = enum.tag v2; + br_table v3 block4 (0.enumtag(@layout_1) block3); block2: - v6.i8 = phi (3.i8 block4) (1.i8 block5) (2.i8 block6); - return v6; + v5.i8 = phi (3.i8 block4) (1.i8 block5) (2.i8 block6); + return v5; block3: - v8.@layout_1 = obj.load v0; - enum.assert_variant v8 #First; - v10.@layout_0 = enum.extract v8 #First 0.i256; - v11.objref<@layout_1> = enum.assert_variant_ref v0 #First; - v12.objref<@layout_0> = enum.proj v11 #First 0.i256; - v13.enumtag(@layout_0) = enum.tag v10; - br_table v13 block8 (0.enumtag(@layout_0) block9) (1.enumtag(@layout_0) block10) (2.enumtag(@layout_0) block11); + v8.objref<@layout_1> = enum.assert_variant_ref v0 #First; + v9.objref<@layout_0> = enum.proj v8 #First 0.i256; + v10.@layout_0 = obj.load v9; + v11.enumtag(@layout_0) = enum.tag v10; + br_table v11 block6 (0.enumtag(@layout_0) block5); block4: jump block2; @@ -631,28 +459,6 @@ func private %outer_specific_inner_wildcard(v0.objref<@layout_1>) -> i8 { block6: jump block2; - - block7: - v18.objref<@layout_1> = enum.assert_variant_ref v0 #First; - v19.objref<@layout_0> = enum.proj v18 #First 0.i256; - v20.@layout_0 = obj.load v19; - v21.enumtag(@layout_0) = enum.tag v20; - br_table v21 block6 (0.enumtag(@layout_0) block5); - - block8: - unreachable; - - block9: - enum.set_tag v12 #A; - jump block7; - - block10: - enum.set_tag v12 #B; - jump block7; - - block11: - enum.set_tag v12 #C; - jump block7; } diff --git a/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap b/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap index 62b5461120..a89cd80960 100644 --- a/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap +++ b/crates/codegen/tests/fixtures/sonatina_ir/match_struct.snap @@ -65,47 +65,32 @@ func private %match_struct_fields(v0.objref<@layout_1>) -> i8 { v2.*i8 = alloca i8; v3.*i8 = alloca i8; v4.*i8 = alloca i8; - v5.*i8 = alloca i8; - v6.*i8 = alloca i8; - v7.*i8 = alloca i8; jump block1; block1: jump block3; block2: - v9.i8 = phi (0.i8 block7) (v37 block8) (v41 block10) (v49 block14); - return v9; + v6.i8 = phi (0.i8 block7) (v25 block8) (v29 block10) (v37 block14); + return v6; block3: - v12.objref = obj.proj v0 1.i256; - v13.i8 = obj.load v12; - v14.objref = obj.proj v0 1.i256; - obj.store v14 v13; - v16.objref = obj.proj v0 1.i256; - v17.i8 = obj.load v16; - v18.i1 = eq v17 0.i8; - br v18 block4 block6; + v10.objref = obj.proj v0 1.i256; + v11.i8 = obj.load v10; + v12.i1 = eq v11 0.i8; + br v12 block4 block6; block4: - v21.objref = obj.proj v0 0.i256; - v22.i8 = obj.load v21; - v23.objref = obj.proj v0 0.i256; - obj.store v23 v22; - v24.objref = obj.proj v0 0.i256; - v25.i8 = obj.load v24; - v26.i1 = eq v25 0.i8; - br v26 block7 block9; + v15.objref = obj.proj v0 0.i256; + v16.i8 = obj.load v15; + v17.i1 = eq v16 0.i8; + br v17 block7 block9; block5: - v28.objref = obj.proj v0 0.i256; - v29.i8 = obj.load v28; - v30.objref = obj.proj v0 0.i256; - obj.store v30 v29; - v31.objref = obj.proj v0 0.i256; - v32.i8 = obj.load v31; - v33.i1 = eq v32 0.i8; - br v33 block10 block12; + v19.objref = obj.proj v0 0.i256; + v20.i8 = obj.load v19; + v21.i1 = eq v20 0.i8; + br v21 block10 block12; block6: jump block5; @@ -114,33 +99,33 @@ func private %match_struct_fields(v0.objref<@layout_1>) -> i8 { jump block2; block8: - v35.objref = obj.proj v0 0.i256; - v36.i8 = obj.load v35; - mstore v2 v36 i8; - v37.i8 = mload v2 i8; + v23.objref = obj.proj v0 0.i256; + v24.i8 = obj.load v23; + mstore v2 v24 i8; + v25.i8 = mload v2 i8; jump block2; block9: jump block8; block10: - v39.objref = obj.proj v0 1.i256; - v40.i8 = obj.load v39; - mstore v1 v40 i8; - v41.i8 = mload v1 i8; + v27.objref = obj.proj v0 1.i256; + v28.i8 = obj.load v27; + mstore v1 v28 i8; + v29.i8 = mload v1 i8; jump block2; block11: - v43.objref = obj.proj v0 1.i256; - v44.i8 = obj.load v43; - mstore v4 v44 i8; - v45.objref = obj.proj v0 0.i256; - v46.i8 = obj.load v45; - mstore v3 v46 i8; - v47.i8 = mload v3 i8; - v48.i8 = mload v4 i8; - (v49.i8, v50.i1) = uaddo v47 v48; - br v50 block13 block14; + v31.objref = obj.proj v0 1.i256; + v32.i8 = obj.load v31; + mstore v4 v32 i8; + v33.objref = obj.proj v0 0.i256; + v34.i8 = obj.load v33; + mstore v3 v34 i8; + v35.i8 = mload v3 i8; + v36.i8 = mload v4 i8; + (v37.i8, v38.i1) = uaddo v35 v36; + br v38 block13 block14; block12: jump block11; @@ -156,39 +141,29 @@ func private %match_struct_fields(v0.objref<@layout_1>) -> i8 { func private %match_struct_wildcard(v0.objref<@layout_1>) -> i8 { block0: - v1.*i8 = alloca i8; - v2.*i8 = alloca i8; jump block1; block1: jump block3; block2: - v4.i8 = phi (1.i8 block4) (2.i8 block7) (3.i8 block8); - return v4; + v2.i8 = phi (1.i8 block4) (2.i8 block7) (3.i8 block8); + return v2; block3: - v7.objref = obj.proj v0 0.i256; - v8.i8 = obj.load v7; - v9.objref = obj.proj v0 0.i256; - obj.store v9 v8; - v11.objref = obj.proj v0 0.i256; - v12.i8 = obj.load v11; - v13.i1 = eq v12 0.i8; - br v13 block4 block6; + v6.objref = obj.proj v0 0.i256; + v7.i8 = obj.load v6; + v8.i1 = eq v7 0.i8; + br v8 block4 block6; block4: jump block2; block5: - v17.objref = obj.proj v0 1.i256; - v18.i8 = obj.load v17; - v19.objref = obj.proj v0 1.i256; - obj.store v19 v18; - v20.objref = obj.proj v0 1.i256; - v21.i8 = obj.load v20; - v22.i1 = eq v21 0.i8; - br v22 block7 block9; + v12.objref = obj.proj v0 1.i256; + v13.i8 = obj.load v12; + v14.i1 = eq v13 0.i8; + br v14 block7 block9; block6: jump block5; diff --git a/crates/codegen/tests/runtime_handle_preservation.rs b/crates/codegen/tests/runtime_handle_preservation.rs index 9a191190d6..88d20c63a5 100644 --- a/crates/codegen/tests/runtime_handle_preservation.rs +++ b/crates/codegen/tests/runtime_handle_preservation.rs @@ -4,7 +4,8 @@ use fe_codegen::{OptLevel, emit_module_sonatina_ir, emit_runtime_package_sonatin use mir::runtime::{AddressSpaceKind, RefKind}; use mir::{ IntrinsicArithBinOp, Layout, LayoutId, PlaceElem, PlaceRoot, RExpr, RLocalId, RStmt, - RuntimeBuiltin, RuntimeClass, build_runtime_package, build_test_runtime_package, + RuntimeBuiltin, RuntimeCarrier, RuntimeClass, RuntimeLocalRoot, build_runtime_package, + build_test_runtime_package, }; use url::Url; @@ -797,6 +798,76 @@ fn entry() -> u8 { ); } +#[test] +fn derived_place_bound_field_aliases_do_not_write_back_to_receiver() { + let mut db = DriverDataBase::default(); + let file_url = + Url::parse("file:///derived_place_bound_field_aliases_do_not_write_back_to_receiver.fe") + .unwrap(); + db.workspace().touch( + &mut db, + file_url.clone(), + Some( + r#"pub struct Pair { + pub a: u256, + pub b: u256, +} + +impl Copy for Pair {} + +impl Pair { + pub fn check(self, _ x: u256) -> bool { + x == self.a + } +} + +pub fn entry() -> bool { + Pair { a: 1, b: 2 }.check(1) +} +"# + .to_string(), + ), + ); + let file = db + .workspace() + .get(&db, &file_url) + .expect("file should be loaded"); + let top_mod = db.top_mod(file); + let package = build_runtime_package(&db, top_mod).expect("runtime package"); + let check = package + .functions(&db) + .iter() + .copied() + .find(|function| function.symbol(&db).contains("check")) + .expect("generated check runtime function"); + let body = check.instance(&db).body(&db); + let receiver = RLocalId::from_u32(0); + + assert!( + !body + .blocks + .iter() + .flat_map(|block| block.stmts.iter()) + .any(|stmt| matches!( + stmt, + RStmt::Store { dst, .. } | RStmt::CopyInto { dst, .. } + if dst.root == PlaceRoot::Slot(receiver) + )), + "field reads through a derived place-bound alias should not write back to the receiver:\n{body:#?}" + ); + assert!( + body.locals + .iter() + .skip(body.signature.params.len()) + .any(|local| { + local.semantic_ty.pretty_print(&db) == "u256" + && matches!(local.carrier, RuntimeCarrier::Erased) + && matches!(local.root, RuntimeLocalRoot::None) + }), + "derived place-bound scalar alias should stay carrierless/rootless:\n{body:#?}" + ); +} + #[test] fn linear_probe_big_struct_keeps_array_projection_reads_place_based() { let mut db = DriverDataBase::default(); diff --git a/crates/codegen/tests/yul_const_backed_calls.rs b/crates/codegen/tests/yul_const_backed_calls.rs index c206383475..9f393a6451 100644 --- a/crates/codegen/tests/yul_const_backed_calls.rs +++ b/crates/codegen/tests/yul_const_backed_calls.rs @@ -167,6 +167,40 @@ fn transparent_wrapper_get_loads_base_handle_before_inner_get() { ); } +#[test] +fn code_backed_copy_receiver_field_reads_do_not_store_into_code() { + let yul = emit_inline_test_yul( + "file:///code_backed_copy_receiver_field_reads_do_not_store_into_code.fe", + r#" +use std::evm::effects::assert + +pub struct Pair { + pub a: u256, + pub b: u256, +} + +impl Copy for Pair {} + +impl Pair { + pub fn check(self, _ x: u256) -> bool { + x == self.a + } +} + +#[test] +fn test_const_struct_receiver() { + let pair = Pair { a: 1, b: 2 } + assert(pair.check(1)) +} +"#, + ); + let check = function_body(&yul, "function $check_arg0_root_code("); + assert!( + check.contains("ret :="), + "code-backed receiver field-read helper should emit successfully:\n{check}" + ); +} + #[test] fn const_backed_constructor_args_stay_code_backed_until_abi_encoding() { let yul = emit_inline_test_yul( diff --git a/crates/fe/tests/fixtures/fe_test/const_ctfe_mutation.fe b/crates/fe/tests/fixtures/fe_test/const_ctfe_mutation.fe new file mode 100644 index 0000000000..fae7ddf647 --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_ctfe_mutation.fe @@ -0,0 +1,119 @@ +use std::evm::effects::assert + +enum Maybe { + Some(usize), + None, +} + +struct Pair { + a: usize, + b: usize, +} + +const fn mutate_fields() -> usize { + let mut pair = Pair { a: 1, b: 2 } + pair.a += 4 + pair.b += pair.a + pair.b +} + +const fn sum_while() -> usize { + let mut i: usize = 0 + let mut sum: usize = 0 + while i < 6 { + i += 1 + if i == 2 { + continue + } + sum += i + if sum > 7 { + break + } + } + sum +} + +const fn while_let_payload() -> usize { + let mut maybe = Maybe::Some(5) + let mut total: usize = 0 + while let Maybe::Some(value) = maybe { + total += value + maybe = Maybe::None + } + total +} + +const fn match_payload() -> usize { + match Maybe::Some(3) { + Maybe::Some(value) => value + mutate_fields() + Maybe::None => 0 + } +} + +const fn rewrite_array() -> [usize; 4] { + let mut values: [usize; 4] = [1, 2, 3, 4] + let idx: usize = 2 + values[idx] = 9 + values[3] = values[0] + values[1] + values[2] + values +} + +const fn repeated_inner_array_cow_score() -> usize { + let mut rows: [[usize; 2]; 2] = [[1, 2]; 2] + rows[0][1] = 9 + rows[0][1] + rows[1][1] +} + +const fn copied_local_array_cow_score() -> usize { + let mut original: [[usize; 2]; 2] = [[1, 2], [3, 4]] + let mut copy = original + copy[0][0] = 9 + original[0][0] * 10 + copy[0][0] +} + +const fn diagonal_matrix_cow_score() -> usize { + let mut rows: [[usize; 4]; 4] = [[0; 4]; 4] + let mut i: usize = 0 + while i < 4 { + rows[i][i] = i + 1 + i += 1 + } + rows[0][0] + + rows[1][1] + + rows[2][2] + + rows[3][3] + + rows[0][1] * 100 + + rows[1][0] * 1000 +} + +const MUTATED_FIELDS: usize = mutate_fields() +const WHILE_SUM: usize = sum_while() +const WHILE_LET_PAYLOAD: usize = while_let_payload() +const MATCH_PAYLOAD: usize = match_payload() +const REWRITTEN_VALUES: [usize; 4] = rewrite_array() +const REPEATED_INNER_ARRAY_COW_SCORE: usize = repeated_inner_array_cow_score() +const COPIED_LOCAL_ARRAY_COW_SCORE: usize = copied_local_array_cow_score() +const DIAGONAL_MATRIX_COW_SCORE: usize = diagonal_matrix_cow_score() + +#[test] +fn test_const_ctfe_mutation_and_control_flow() { + assert(MUTATED_FIELDS == 7) + assert(WHILE_SUM == 8) + assert(WHILE_LET_PAYLOAD == 5) + assert(MATCH_PAYLOAD == 10) +} + +#[test] +fn test_const_ctfe_array_index_writes() { + assert(REWRITTEN_VALUES[0] == 1) + assert(REWRITTEN_VALUES[1] == 2) + assert(REWRITTEN_VALUES[2] == 9) + assert(REWRITTEN_VALUES[3] == 12) +} + +#[test] +fn test_const_ctfe_aggregate_copy_on_write() { + assert(REPEATED_INNER_ARRAY_COW_SCORE == 11) + assert(COPIED_LOCAL_ARRAY_COW_SCORE == 19) + assert(DIAGONAL_MATRIX_COW_SCORE == 10) +} diff --git a/crates/fe/tests/fixtures/fe_test/const_evm_modular_arithmetic.fe b/crates/fe/tests/fixtures/fe_test/const_evm_modular_arithmetic.fe new file mode 100644 index 0000000000..bc3a98cbc1 --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_evm_modular_arithmetic.fe @@ -0,0 +1,76 @@ +use core::num::IntDowncast +use std::evm::crypto::{addmod, mulmod} +use std::evm::effects::assert + +const U256_MAX: u256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935 +const SNARK_SCALAR_FIELD: u256 = 21888242871839275222246405745257275088548364400416034343698204186575808495617 + +const MIX: [[u256; 3]; 3] = [ + [2, 1, 1], + [1, 2, 1], + [1, 1, 2], +] + +const fn field_add(lhs: u256, rhs: u256) -> u256 { + addmod(lhs, rhs, SNARK_SCALAR_FIELD) +} + +const fn field_mul(lhs: u256, rhs: u256) -> u256 { + mulmod(lhs, rhs, SNARK_SCALAR_FIELD) +} + +const fn poseidon_style_mix(state: [u256; 3]) -> [u256; 3] { + let mut out: [u256; 3] = [0, 0, 0] + let mut i: usize = 0 + while i < 3 { + let mut j: usize = 0 + while j < 3 { + out[i] = field_add(lhs: out[i], rhs: field_mul(lhs: MIX[i][j], rhs: state[j])) + j += 1 + } + i += 1 + } + out +} + +const fn mixed_state_at(index: usize) -> u256 { + poseidon_style_mix(state: [1, 2, 3])[index] +} + +type AddModOverflowWitness = [u8; addmod(U256_MAX, 2, 13).downcast_unchecked()] +type MulModOverflowWitness = [u8; mulmod(U256_MAX, U256_MAX, 13).downcast_unchecked()] +type AddModZeroModulusWitness = [u8; addmod(5, 8, 0).downcast_unchecked()] +type MulModZeroModulusWitness = [u8; mulmod(5, 8, 0).downcast_unchecked()] +type FieldAddWrapWitness = [u8; field_add(lhs: SNARK_SCALAR_FIELD - 1, rhs: 2).downcast_unchecked()] +type FieldMulWrapWitness = [u8; field_mul(lhs: SNARK_SCALAR_FIELD - 1, rhs: SNARK_SCALAR_FIELD - 1).downcast_unchecked()] +type MixedState0Witness = [u8; mixed_state_at(index: 0).downcast_unchecked()] +type MixedState1Witness = [u8; mixed_state_at(index: 1).downcast_unchecked()] +type MixedState2Witness = [u8; mixed_state_at(index: 2).downcast_unchecked()] + +#[test] +fn test_const_evm_modular_arithmetic() { + let _addmod_overflow_witness: AddModOverflowWitness = [0; 4] + let _mulmod_overflow_witness: MulModOverflowWitness = [0; 4] + let _addmod_zero_modulus_witness: AddModZeroModulusWitness = [0; 0] + let _mulmod_zero_modulus_witness: MulModZeroModulusWitness = [0; 0] + let _field_add_wrap_witness: FieldAddWrapWitness = [0; 1] + let _field_mul_wrap_witness: FieldMulWrapWitness = [0; 1] + + assert(addmod(U256_MAX, 2, 13) == 4) + assert(mulmod(U256_MAX, U256_MAX, 13) == 4) + assert(addmod(5, 8, 0) == 0) + assert(mulmod(5, 8, 0) == 0) + assert(field_add(lhs: SNARK_SCALAR_FIELD - 1, rhs: 2) == 1) + assert(field_mul(lhs: SNARK_SCALAR_FIELD - 1, rhs: SNARK_SCALAR_FIELD - 1) == 1) +} + +#[test] +fn test_const_poseidon_style_mix() { + let _mixed_state_0_witness: MixedState0Witness = [0; 7] + let _mixed_state_1_witness: MixedState1Witness = [0; 8] + let _mixed_state_2_witness: MixedState2Witness = [0; 9] + + assert(poseidon_style_mix(state: [1, 2, 3])[0] == 7) + assert(poseidon_style_mix(state: [1, 2, 3])[1] == 8) + assert(poseidon_style_mix(state: [1, 2, 3])[2] == 9) +} diff --git a/crates/fe/tests/fixtures/fe_test/const_generic_field_ops.fe b/crates/fe/tests/fixtures/fe_test/const_generic_field_ops.fe new file mode 100644 index 0000000000..0f2d127d9c --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_generic_field_ops.fe @@ -0,0 +1,60 @@ +use core::ops::{Add, Mul} +use std::evm::crypto::{addmod, mulmod} +use std::evm::effects::assert + +const FIELD_MODULUS: u256 = 17 + +struct Fr { + value: u256, +} + +impl Copy for Fr {} + +impl Fr { + const fn new(value: u256) -> Fr { + Fr { value: value } + } +} + +impl Add for Fr { + const fn add(own self, _ other: own Fr) -> Fr { + Fr::new(value: addmod(self.value, other.value, MODULUS)) + } +} + +impl Add for Fr { + const fn add(own self, _ other: own u256) -> Fr { + self + Fr::new(value: other) + } +} + +impl Mul for Fr { + const fn mul(own self, _ other: own Fr) -> Fr { + Fr::new(value: mulmod(self.value, other.value, MODULUS)) + } +} + +impl Mul for Fr { + const fn mul(own self, _ other: own u256) -> Fr { + self * Fr::new(value: other) + } +} + +type F17 = Fr + +const fn mixed_add_wraps() -> u256 { + (F17::new(value: FIELD_MODULUS - 1) + 2).value +} + +const fn mixed_mul_wraps() -> u256 { + (F17::new(value: FIELD_MODULUS - 1) * 3).value +} + +static_assert(mixed_add_wraps() == 1) +static_assert(mixed_mul_wraps() == 14) + +#[test] +fn test_const_generic_field_ops() { + assert(mixed_add_wraps() == 1) + assert(mixed_mul_wraps() == 14) +} diff --git a/crates/fe/tests/fixtures/fe_test/const_numeric_extern_intrinsics.fe b/crates/fe/tests/fixtures/fe_test/const_numeric_extern_intrinsics.fe new file mode 100644 index 0000000000..1a536fa4a7 --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_numeric_extern_intrinsics.fe @@ -0,0 +1,99 @@ +use core::num::IntWord +use std::evm::effects::assert + +extern { + const fn __checked_add(_: T, _: T) -> T + const fn __checked_neg(_: T) -> T + const fn __saturating_add(_: T, _: T) -> T + const fn __saturating_sub(_: T, _: T) -> T + const fn __saturating_mul(_: T, _: T) -> T + + const fn __add_u8(_: u8, _: u8) -> u8 + const fn __sub_u8(_: u8, _: u8) -> u8 + const fn __mul_u8(_: u8, _: u8) -> u8 + const fn __div_u8(_: u8, _: u8) -> u8 + const fn __rem_u8(_: u8, _: u8) -> u8 + const fn __pow_u8(_: u8, _: u8) -> u8 + const fn __shl_u8(_: u8, _: u8) -> u8 + const fn __shr_i8(_: i8, _: i8) -> i8 + const fn __shr_i16(_: i16, _: i16) -> i16 + const fn __bitand_u8(_: u8, _: u8) -> u8 + const fn __bitor_u8(_: u8, _: u8) -> u8 + const fn __bitxor_u8(_: u8, _: u8) -> u8 + const fn __lt_i8(_: i8, _: i8) -> bool + const fn __ge_u8(_: u8, _: u8) -> bool + const fn __neg_i8(_: i8) -> i8 + const fn __bitnot_u8(_: u8) -> u8 + + const fn __not_bool(_: bool) -> bool + const fn __bitand_bool(_: bool, _: bool) -> bool + const fn __bitor_bool(_: bool, _: bool) -> bool + const fn __bitxor_bool(_: bool, _: bool) -> bool + const fn __eq_bool(_: bool, _: bool) -> bool + const fn __ne_bool(_: bool, _: bool) -> bool +} + +const CHECKED_ADD: u8 = __checked_add(10, 5) +const CHECKED_NEG: i8 = __checked_neg(-5) +const SATURATING_ADD: u8 = __saturating_add(250, 10) +const SATURATING_SUB: u8 = __saturating_sub(0, 10) +const SATURATING_MUL: i8 = __saturating_mul(64, 4) + +const WRAPPING_ADD: u8 = __add_u8(255, 2) +const WRAPPING_SUB: u8 = __sub_u8(0, 1) +const WRAPPING_MUL: u8 = __mul_u8(16, 16) +const WRAPPING_DIV_ZERO: u8 = __div_u8(9, 0) +const WRAPPING_REM_ZERO: u8 = __rem_u8(9, 0) +const WRAPPING_POW: u8 = __pow_u8(2, 8) +const WRAPPING_SHL: u8 = __shl_u8(1, 8) +const WRAPPING_SIGNED_SHR: i8 = __shr_i8(-128, 7) +const WRAPPING_SIGNED_SHR_255: i8 = __shr_i8(-1, -1) +const WRAPPING_SIGNED_SHR_300: i16 = __shr_i16(-1, 300) +const WRAPPING_NEG: i8 = __neg_i8(-128) +const BIT_NOT: u8 = __bitnot_u8(0) +const BIT_AND: u8 = __bitand_u8(0b1010, 0b1100) +const BIT_OR: u8 = __bitor_u8(0b1010, 0b1100) +const BIT_XOR: u8 = __bitxor_u8(0b1010, 0b1100) +const LT_SIGNED: bool = __lt_i8(-1, 1) +const GE_UNSIGNED: bool = __ge_u8(2, 2) + +const BOOL_NOT: bool = __not_bool(false) +const BOOL_AND: bool = __bitand_bool(true, false) +const BOOL_OR: bool = __bitor_bool(true, false) +const BOOL_XOR: bool = __bitxor_bool(true, false) +const BOOL_EQ: bool = __eq_bool(true, true) +const BOOL_NE: bool = __ne_bool(true, false) + +#[test] +fn const_numeric_extern_intrinsics() { + assert(CHECKED_ADD == 15) + assert(CHECKED_NEG == 5) + assert(SATURATING_ADD == 255) + assert(SATURATING_SUB == 0) + assert(SATURATING_MUL == 127) + + assert(WRAPPING_ADD == 1) + assert(WRAPPING_SUB == 255) + assert(WRAPPING_MUL == 0) + assert(WRAPPING_DIV_ZERO == 0) + assert(WRAPPING_REM_ZERO == 0) + assert(WRAPPING_POW == 0) + assert(WRAPPING_SHL == 0) + assert(WRAPPING_SIGNED_SHR == -1) + assert(WRAPPING_SIGNED_SHR_255 == -1) + assert(WRAPPING_SIGNED_SHR_300 == -1) + assert(WRAPPING_NEG == -128) + assert(BIT_NOT == 255) + assert(BIT_AND == 0b1000) + assert(BIT_OR == 0b1110) + assert(BIT_XOR == 0b0110) + assert(LT_SIGNED) + assert(GE_UNSIGNED) + + assert(BOOL_NOT) + assert(!BOOL_AND) + assert(BOOL_OR) + assert(BOOL_XOR) + assert(BOOL_EQ) + assert(BOOL_NE) +} diff --git a/crates/fe/tests/fixtures/fe_test/const_poseidon.fe b/crates/fe/tests/fixtures/fe_test/const_poseidon.fe new file mode 100644 index 0000000000..70ebb506ee --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_poseidon.fe @@ -0,0 +1,1138 @@ +use core::ops::{Add, Mul} +use std::evm::crypto::{addmod, mulmod} +use std::evm::effects::assert + +// BN254 scalar field modulus. +const SNARK_SCALAR_FIELD: u256 = 21888242871839275222246405745257275088548364400416034343698204186575808495617 + +const POSEIDON_T3_FULL_ROUNDS: usize = 8 +const POSEIDON_T3_PARTIAL_ROUNDS: usize = 57 +const POSEIDON_T3_ROUNDS: usize = POSEIDON_T3_FULL_ROUNDS + POSEIDON_T3_PARTIAL_ROUNDS +const POSEIDON_T3_HALF_FULL_ROUNDS: usize = POSEIDON_T3_FULL_ROUNDS / 2 +const POSEIDON_T6_FULL_ROUNDS: usize = 8 +const POSEIDON_T6_PARTIAL_ROUNDS: usize = 60 +const POSEIDON_T6_ROUNDS: usize = POSEIDON_T6_FULL_ROUNDS + POSEIDON_T6_PARTIAL_ROUNDS +const POSEIDON_T6_HALF_FULL_ROUNDS: usize = POSEIDON_T6_FULL_ROUNDS / 2 + +const POSEIDON_T3_MDS: [[u256; 3]; 3] = [ + [ + 0x109b7f411ba0e4c9b2b70caf5c36a7b194be7c11ad24378bfedb68592ba8118b, + 0x16ed41e13bb9c0c66ae119424fddbcbc9314dc9fdbdeea55d6c64543dc4903e0, + 0x2b90bba00fca0589f617e7dcbfe82e0df706ab640ceb247b791a93b74e36736d, + ], + [ + 0x2969f27eed31a480b9c36c764379dbca2cc8fdd1415c3dded62940bcde0bd771, + 0x2e2419f9ec02ec394c9871c832963dc1b89d743c8c7b964029b2311687b1fe23, + 0x101071f0032379b697315876690f053d148d4e109f5fb065c8aacc55a0f89bfa, + ], + [ + 0x143021ec686a3f330d5f9e654638065ce6cd79e28c5b3753326244ee65a1b1a7, + 0x176cc029695ad02582a70eff08a6fd99d057e12e58e7d7b6b16cdfabc8ee2911, + 0x19a3fc0a56702bf417ba7fee3802593fa644470307043f7773279cd71d25d5e0, + ], +] + +const POSEIDON_T6_MDS: [[u256; 6]; 6] = [ + [ + 0x124666f80561ed5916f2f070b1bd248c6d53f44d273d956a0c87b917692a4d18, + 0x11924f02fd19b09255aaa1cf46ea0518e3d7bfeef47421609491011db0bd0b02, + 0x247fa7f022304a1994ff505456c2201ef9b717369498d3ffce446601ed9df845, + 0x03fd7b19ef2c861f22f77ff810f54e277bc94eb76c02d79d986be3dcdf051c3f, + 0x18bd41239c3e71579a677443ecffbd555a81eeeea69352a68b67c8563c0c2a06, + 0x2d78c3a5d28de9ff35bf0a257635196e5730ca7f40493277078cd75da8b4ebdc, + ], + [ + 0x0a514a5c227f4cec95dfa029e8dd124c34895aa46bb27c0911f3780d5015540a, + 0x192e16d17d956b257b85a652eefdf2ee09589eac5be80915775723d2cb1da06d, + 0x298ce0c1e3113bb935c7058e7772b533b1aa9db0c0926bdc8917e5605ca3ac10, + 0x094cb4e83621afd271e41bc71727f0158ebd612239ac9d698b17fe4be05b7fc8, + 0x03d880395be93c27d649af5fd142e76b33918cb8841d5a28173bd5cf7d328791, + 0x28eeae6b5866ad68e443bbaf91680db7d7e2b3037e38fef61b42cbccffceca81, + ], + [ + 0x278bb49a7b4e44aea46eb0f882cb692801a6e60fdd5b5c23c63cd65ccce4fe0a, + 0x063edec1bed831f506af8db648d6fdea145345887e8bdcff109035a1d9b674d7, + 0x1baef1cb5509b526a42061fb53657f99b3232500e855192cbe8c940e068c475f, + 0x1324564ac7bdf9e22164e9858d7fa8e368b165eaea3daf4eb67ee59c0df2e5d4, + 0x005761b8c6aecb1a8ca4ea4dfc2c8376064a4a8004ceeda210a55240562ddc13, + 0x10c9e283159d58cb4cb2e35fde83a3ba1fdc28002ed9963d2a99f186178a148d, + ], + [ + 0x0c399e9f67aa40707a203feefb0b958bbdadcec5ca34901d253d026a2419f6a2, + 0x083f0df3f1a0351d0330ec3ff602ca8cc353b7f6e762c7107184cd7b423449f6, + 0x1a6764d5943fc4a720b4c0a19fdb8c711984307287a58b9b5f9f5d58212cb263, + 0x011a63a26feabf87fa66bde66cc25a922c96382d76c6a7ff48f1537beaed683a, + 0x08ca7b64657c3548f32bef5b63ad24288a41c0b251099ad27f9434307e3e64d4, + 0x01998270471e9361955446b0cdb8bea915ec0675f1cd648ddcb04303507a4489, + ], + [ + 0x1d6b3d5f6ea369c26f825d2362933eaa31ea35ec0a77c1fbd9e01ca1523e4432, + 0x119ef188bb3dd0d32306976c19941e8664be687e7a69692da27da215a6f06d40, + 0x2d9e0ab5c06893dfdfd03481381ba86b6e6292df5609d71f2c64b2d9a79f809e, + 0x25f16631bf77060f7ea34087c025bf135784319ef08cda2e31419ee0a529e658, + 0x144c7a11da5a7c5dabae3f33fbd03cad86d18bc594c79a497ecb9894edb554f1, + 0x0f971162627723f3feadacb28b0c104cb8f74de508752fa8d7c0db2af13de8ee, + ], + [ + 0x24be510095436206dd0abd0b0cbb95c883ab304aa52598b1a69306ec981a688d, + 0x211610e2ad4a377426fadf7068b0c1a6c299a164c1c1a603eaed944870d0b9b9, + 0x15a67d981041b1f6f09f3f9ebefd864e779d3af08157786ac077505e50ec79fc, + 0x049327fa79d28c12a2c82406947f77f06775b0287468b3136877701dbe7c9598, + 0x230940dcc5232658ff9c29697a3fd416d170e8c998f1aa85dea0c42d79f951aa, + 0x1b121c049cd1159e289007e0c9da9995cc4bab4c26fb888ec3972a8a2e656964, + ], +] + +const POSEIDON_T3_ROUND_CONSTANTS: [[u256; 3]; 65] = [ + [ + 0x0ee9a592ba9a9518d05986d656f40c2114c4993c11bb29938d21d47304cd8e6e, + 0x00f1445235f2148c5986587169fc1bcd887b08d4d00868df5696fff40956e864, + 0x08dff3487e8ac99e1f29a058d0fa80b930c728730b7ab36ce879f3890ecf73f5, + ], + [ + 0x2f27be690fdaee46c3ce28f7532b13c856c35342c84bda6e20966310fadc01d0, + 0x2b2ae1acf68b7b8d2416bebf3d4f6234b763fe04b8043ee48b8327bebca16cf2, + 0x0319d062072bef7ecca5eac06f97d4d55952c175ab6b03eae64b44c7dbf11cfa, + ], + [ + 0x28813dcaebaeaa828a376df87af4a63bc8b7bf27ad49c6298ef7b387bf28526d, + 0x2727673b2ccbc903f181bf38e1c1d40d2033865200c352bc150928adddf9cb78, + 0x234ec45ca27727c2e74abd2b2a1494cd6efbd43e340587d6b8fb9e31e65cc632, + ], + [ + 0x15b52534031ae18f7f862cb2cf7cf760ab10a8150a337b1ccd99ff6e8797d428, + 0x0dc8fad6d9e4b35f5ed9a3d186b79ce38e0e8a8d1b58b132d701d4eecf68d1f6, + 0x1bcd95ffc211fbca600f705fad3fb567ea4eb378f62e1fec97805518a47e4d9c, + ], + [ + 0x10520b0ab721cadfe9eff81b016fc34dc76da36c2578937817cb978d069de559, + 0x1f6d48149b8e7f7d9b257d8ed5fbbaf42932498075fed0ace88a9eb81f5627f6, + 0x1d9655f652309014d29e00ef35a2089bfff8dc1c816f0dc9ca34bdb5460c8705, + ], + [ + 0x04df5a56ff95bcafb051f7b1cd43a99ba731ff67e47032058fe3d4185697cc7d, + 0x0672d995f8fff640151b3d290cedaf148690a10a8c8424a7f6ec282b6e4be828, + 0x099952b414884454b21200d7ffafdd5f0c9a9dcc06f2708e9fc1d8209b5c75b9, + ], + [ + 0x052cba2255dfd00c7c483143ba8d469448e43586a9b4cd9183fd0e843a6b9fa6, + 0x0b8badee690adb8eb0bd74712b7999af82de55707251ad7716077cb93c464ddc, + 0x119b1590f13307af5a1ee651020c07c749c15d60683a8050b963d0a8e4b2bdd1, + ], + [ + 0x03150b7cd6d5d17b2529d36be0f67b832c4acfc884ef4ee5ce15be0bfb4a8d09, + 0x2cc6182c5e14546e3cf1951f173912355374efb83d80898abe69cb317c9ea565, + 0x005032551e6378c450cfe129a404b3764218cadedac14e2b92d2cd73111bf0f9, + ], + [ + 0x233237e3289baa34bb147e972ebcb9516469c399fcc069fb88f9da2cc28276b5, + 0x05c8f4f4ebd4a6e3c980d31674bfbe6323037f21b34ae5a4e80c2d4c24d60280, + 0x0a7b1db13042d396ba05d818a319f25252bcf35ef3aeed91ee1f09b2590fc65b, + ], + [ + 0x2a73b71f9b210cf5b14296572c9d32dbf156e2b086ff47dc5df542365a404ec0, + 0x1ac9b0417abcc9a1935107e9ffc91dc3ec18f2c4dbe7f22976a760bb5c50c460, + 0x12c0339ae08374823fabb076707ef479269f3e4d6cb104349015ee046dc93fc0, + ], + [ + 0x0b7475b102a165ad7f5b18db4e1e704f52900aa3253baac68246682e56e9a28e, + 0x037c2849e191ca3edb1c5e49f6e8b8917c843e379366f2ea32ab3aa88d7f8448, + 0x05a6811f8556f014e92674661e217e9bd5206c5c93a07dc145fdb176a716346f, + ], + [ + 0x29a795e7d98028946e947b75d54e9f044076e87a7b2883b47b675ef5f38bd66e, + 0x20439a0c84b322eb45a3857afc18f5826e8c7382c8a1585c507be199981fd22f, + 0x2e0ba8d94d9ecf4a94ec2050c7371ff1bb50f27799a84b6d4a2a6f2a0982c887, + ], + [ + 0x143fd115ce08fb27ca38eb7cce822b4517822cd2109048d2e6d0ddcca17d71c8, + 0x0c64cbecb1c734b857968dbbdcf813cdf8611659323dbcbfc84323623be9caf1, + 0x028a305847c683f646fca925c163ff5ae74f348d62c2b670f1426cef9403da53, + ], + [ + 0x2e4ef510ff0b6fda5fa940ab4c4380f26a6bcb64d89427b824d6755b5db9e30c, + 0x0081c95bc43384e663d79270c956ce3b8925b4f6d033b078b96384f50579400e, + 0x2ed5f0c91cbd9749187e2fade687e05ee2491b349c039a0bba8a9f4023a0bb38, + ], + [ + 0x30509991f88da3504bbf374ed5aae2f03448a22c76234c8c990f01f33a735206, + 0x1c3f20fd55409a53221b7c4d49a356b9f0a1119fb2067b41a7529094424ec6ad, + 0x10b4e7f3ab5df003049514459b6e18eec46bb2213e8e131e170887b47ddcb96c, + ], + [ + 0x2a1982979c3ff7f43ddd543d891c2abddd80f804c077d775039aa3502e43adef, + 0x1c74ee64f15e1db6feddbead56d6d55dba431ebc396c9af95cad0f1315bd5c91, + 0x07533ec850ba7f98eab9303cace01b4b9e4f2e8b82708cfa9c2fe45a0ae146a0, + ], + [ + 0x21576b438e500449a151e4eeaf17b154285c68f42d42c1808a11abf3764c0750, + 0x2f17c0559b8fe79608ad5ca193d62f10bce8384c815f0906743d6930836d4a9e, + 0x2d477e3862d07708a79e8aae946170bc9775a4201318474ae665b0b1b7e2730e, + ], + [ + 0x162f5243967064c390e095577984f291afba2266c38f5abcd89be0f5b2747eab, + 0x2b4cb233ede9ba48264ecd2c8ae50d1ad7a8596a87f29f8a7777a70092393311, + 0x2c8fbcb2dd8573dc1dbaf8f4622854776db2eece6d85c4cf4254e7c35e03b07a, + ], + [ + 0x1d6f347725e4816af2ff453f0cd56b199e1b61e9f601e9ade5e88db870949da9, + 0x204b0c397f4ebe71ebc2d8b3df5b913df9e6ac02b68d31324cd49af5c4565529, + 0x0c4cb9dc3c4fd8174f1149b3c63c3c2f9ecb827cd7dc25534ff8fb75bc79c502, + ], + [ + 0x174ad61a1448c899a25416474f4930301e5c49475279e0639a616ddc45bc7b54, + 0x1a96177bcf4d8d89f759df4ec2f3cde2eaaa28c177cc0fa13a9816d49a38d2ef, + 0x066d04b24331d71cd0ef8054bc60c4ff05202c126a233c1a8242ace360b8a30a, + ], + [ + 0x2a4c4fc6ec0b0cf52195782871c6dd3b381cc65f72e02ad527037a62aa1bd804, + 0x13ab2d136ccf37d447e9f2e14a7cedc95e727f8446f6d9d7e55afc01219fd649, + 0x1121552fca26061619d24d843dc82769c1b04fcec26f55194c2e3e869acc6a9a, + ], + [ + 0x00ef653322b13d6c889bc81715c37d77a6cd267d595c4a8909a5546c7c97cff1, + 0x0e25483e45a665208b261d8ba74051e6400c776d652595d9845aca35d8a397d3, + 0x29f536dcb9dd7682245264659e15d88e395ac3d4dde92d8c46448db979eeba89, + ], + [ + 0x2a56ef9f2c53febadfda33575dbdbd885a124e2780bbea170e456baace0fa5be, + 0x1c8361c78eb5cf5decfb7a2d17b5c409f2ae2999a46762e8ee416240a8cb9af1, + 0x151aff5f38b20a0fc0473089aaf0206b83e8e68a764507bfd3d0ab4be74319c5, + ], + [ + 0x04c6187e41ed881dc1b239c88f7f9d43a9f52fc8c8b6cdd1e76e47615b51f100, + 0x13b37bd80f4d27fb10d84331f6fb6d534b81c61ed15776449e801b7ddc9c2967, + 0x01a5c536273c2d9df578bfbd32c17b7a2ce3664c2a52032c9321ceb1c4e8a8e4, + ], + [ + 0x2ab3561834ca73835ad05f5d7acb950b4a9a2c666b9726da832239065b7c3b02, + 0x1d4d8ec291e720db200fe6d686c0d613acaf6af4e95d3bf69f7ed516a597b646, + 0x041294d2cc484d228f5784fe7919fd2bb925351240a04b711514c9c80b65af1d, + ], + [ + 0x154ac98e01708c611c4fa715991f004898f57939d126e392042971dd90e81fc6, + 0x0b339d8acca7d4f83eedd84093aef51050b3684c88f8b0b04524563bc6ea4da4, + 0x0955e49e6610c94254a4f84cfbab344598f0e71eaff4a7dd81ed95b50839c82e, + ], + [ + 0x06746a6156eba54426b9e22206f15abca9a6f41e6f535c6f3525401ea0654626, + 0x0f18f5a0ecd1423c496f3820c549c27838e5790e2bd0a196ac917c7ff32077fb, + 0x04f6eeca1751f7308ac59eff5beb261e4bb563583ede7bc92a738223d6f76e13, + ], + [ + 0x2b56973364c4c4f5c1a3ec4da3cdce038811eb116fb3e45bc1768d26fc0b3758, + 0x123769dd49d5b054dcd76b89804b1bcb8e1392b385716a5d83feb65d437f29ef, + 0x2147b424fc48c80a88ee52b91169aacea989f6446471150994257b2fb01c63e9, + ], + [ + 0x0fdc1f58548b85701a6c5505ea332a29647e6f34ad4243c2ea54ad897cebe54d, + 0x12373a8251fea004df68abcf0f7786d4bceff28c5dbbe0c3944f685cc0a0b1f2, + 0x21e4f4ea5f35f85bad7ea52ff742c9e8a642756b6af44203dd8a1f35c1a90035, + ], + [ + 0x16243916d69d2ca3dfb4722224d4c462b57366492f45e90d8a81934f1bc3b147, + 0x1efbe46dd7a578b4f66f9adbc88b4378abc21566e1a0453ca13a4159cac04ac2, + 0x07ea5e8537cf5dd08886020e23a7f387d468d5525be66f853b672cc96a88969a, + ], + [ + 0x05a8c4f9968b8aa3b7b478a30f9a5b63650f19a75e7ce11ca9fe16c0b76c00bc, + 0x20f057712cc21654fbfe59bd345e8dac3f7818c701b9c7882d9d57b72a32e83f, + 0x04a12ededa9dfd689672f8c67fee31636dcd8e88d01d49019bd90b33eb33db69, + ], + [ + 0x27e88d8c15f37dcee44f1e5425a51decbd136ce5091a6767e49ec9544ccd101a, + 0x2feed17b84285ed9b8a5c8c5e95a41f66e096619a7703223176c41ee433de4d1, + 0x1ed7cc76edf45c7c404241420f729cf394e5942911312a0d6972b8bd53aff2b8, + ], + [ + 0x15742e99b9bfa323157ff8c586f5660eac6783476144cdcadf2874be45466b1a, + 0x1aac285387f65e82c895fc6887ddf40577107454c6ec0317284f033f27d0c785, + 0x25851c3c845d4790f9ddadbdb6057357832e2e7a49775f71ec75a96554d67c77, + ], + [ + 0x15a5821565cc2ec2ce78457db197edf353b7ebba2c5523370ddccc3d9f146a67, + 0x2411d57a4813b9980efa7e31a1db5966dcf64f36044277502f15485f28c71727, + 0x002e6f8d6520cd4713e335b8c0b6d2e647e9a98e12f4cd2558828b5ef6cb4c9b, + ], + [ + 0x2ff7bc8f4380cde997da00b616b0fcd1af8f0e91e2fe1ed7398834609e0315d2, + 0x00b9831b948525595ee02724471bcd182e9521f6b7bb68f1e93be4febb0d3cbe, + 0x0a2f53768b8ebf6a86913b0e57c04e011ca408648a4743a87d77adbf0c9c3512, + ], + [ + 0x00248156142fd0373a479f91ff239e960f599ff7e94be69b7f2a290305e1198d, + 0x171d5620b87bfb1328cf8c02ab3f0c9a397196aa6a542c2350eb512a2b2bcda9, + 0x170a4f55536f7dc970087c7c10d6fad760c952172dd54dd99d1045e4ec34a808, + ], + [ + 0x29aba33f799fe66c2ef3134aea04336ecc37e38c1cd211ba482eca17e2dbfae1, + 0x1e9bc179a4fdd758fdd1bb1945088d47e70d114a03f6a0e8b5ba650369e64973, + 0x1dd269799b660fad58f7f4892dfb0b5afeaad869a9c4b44f9c9e1c43bdaf8f09, + ], + [ + 0x22cdbc8b70117ad1401181d02e15459e7ccd426fe869c7c95d1dd2cb0f24af38, + 0x0ef042e454771c533a9f57a55c503fcefd3150f52ed94a7cd5ba93b9c7dacefd, + 0x11609e06ad6c8fe2f287f3036037e8851318e8b08a0359a03b304ffca62e8284, + ], + [ + 0x1166d9e554616dba9e753eea427c17b7fecd58c076dfe42708b08f5b783aa9af, + 0x2de52989431a859593413026354413db177fbf4cd2ac0b56f855a888357ee466, + 0x3006eb4ffc7a85819a6da492f3a8ac1df51aee5b17b8e89d74bf01cf5f71e9ad, + ], + [ + 0x2af41fbb61ba8a80fdcf6fff9e3f6f422993fe8f0a4639f962344c8225145086, + 0x119e684de476155fe5a6b41a8ebc85db8718ab27889e85e781b214bace4827c3, + 0x1835b786e2e8925e188bea59ae363537b51248c23828f047cff784b97b3fd800, + ], + [ + 0x28201a34c594dfa34d794996c6433a20d152bac2a7905c926c40e285ab32eeb6, + 0x083efd7a27d1751094e80fefaf78b000864c82eb571187724a761f88c22cc4e7, + 0x0b6f88a3577199526158e61ceea27be811c16df7774dd8519e079564f61fd13b, + ], + [ + 0x0ec868e6d15e51d9644f66e1d6471a94589511ca00d29e1014390e6ee4254f5b, + 0x2af33e3f866771271ac0c9b3ed2e1142ecd3e74b939cd40d00d937ab84c98591, + 0x0b520211f904b5e7d09b5d961c6ace7734568c547dd6858b364ce5e47951f178, + ], + [ + 0x0b2d722d0919a1aad8db58f10062a92ea0c56ac4270e822cca228620188a1d40, + 0x1f790d4d7f8cf094d980ceb37c2453e957b54a9991ca38bbe0061d1ed6e562d4, + 0x0171eb95dfbf7d1eaea97cd385f780150885c16235a2a6a8da92ceb01e504233, + ], + [ + 0x0c2d0e3b5fd57549329bf6885da66b9b790b40defd2c8650762305381b168873, + 0x1162fb28689c27154e5a8228b4e72b377cbcafa589e283c35d3803054407a18d, + 0x2f1459b65dee441b64ad386a91e8310f282c5a92a89e19921623ef8249711bc0, + ], + [ + 0x1e6ff3216b688c3d996d74367d5cd4c1bc489d46754eb712c243f70d1b53cfbb, + 0x01ca8be73832b8d0681487d27d157802d741a6f36cdc2a0576881f9326478875, + 0x1f7735706ffe9fc586f976d5bdf223dc680286080b10cea00b9b5de315f9650e, + ], + [ + 0x2522b60f4ea3307640a0c2dce041fba921ac10a3d5f096ef4745ca838285f019, + 0x23f0bee001b1029d5255075ddc957f833418cad4f52b6c3f8ce16c235572575b, + 0x2bc1ae8b8ddbb81fcaac2d44555ed5685d142633e9df905f66d9401093082d59, + ], + [ + 0x0f9406b8296564a37304507b8dba3ed162371273a07b1fc98011fcd6ad72205f, + 0x2360a8eb0cc7defa67b72998de90714e17e75b174a52ee4acb126c8cd995f0a8, + 0x15871a5cddead976804c803cbaef255eb4815a5e96df8b006dcbbc2767f88948, + ], + [ + 0x193a56766998ee9e0a8652dd2f3b1da0362f4f54f72379544f957ccdeefb420f, + 0x2a394a43934f86982f9be56ff4fab1703b2e63c8ad334834e4309805e777ae0f, + 0x1859954cfeb8695f3e8b635dcb345192892cd11223443ba7b4166e8876c0d142, + ], + [ + 0x04e1181763050e58013444dbcb99f1902b11bc25d90bbdca408d3819f4fed32b, + 0x0fdb253dee83869d40c335ea64de8c5bb10eb82db08b5e8b1f5e5552bfd05f23, + 0x058cbe8a9a5027bdaa4efb623adead6275f08686f1c08984a9d7c5bae9b4f1c0, + ], + [ + 0x1382edce9971e186497eadb1aeb1f52b23b4b83bef023ab0d15228b4cceca59a, + 0x03464990f045c6ee0819ca51fd11b0be7f61b8eb99f14b77e1e6634601d9e8b5, + 0x23f7bfc8720dc296fff33b41f98ff83c6fcab4605db2eb5aaa5bc137aeb70a58, + ], + [ + 0x0a59a158e3eec2117e6e94e7f0e9decf18c3ffd5e1531a9219636158bbaf62f2, + 0x06ec54c80381c052b58bf23b312ffd3ce2c4eba065420af8f4c23ed0075fd07b, + 0x118872dc832e0eb5476b56648e867ec8b09340f7a7bcb1b4962f0ff9ed1f9d01, + ], + [ + 0x13d69fa127d834165ad5c7cba7ad59ed52e0b0f0e42d7fea95e1906b520921b1, + 0x169a177f63ea681270b1c6877a73d21bde143942fb71dc55fd8a49f19f10c77b, + 0x04ef51591c6ead97ef42f287adce40d93abeb032b922f66ffb7e9a5a7450544d, + ], + [ + 0x256e175a1dc079390ecd7ca703fb2e3b19ec61805d4f03ced5f45ee6dd0f69ec, + 0x30102d28636abd5fe5f2af412ff6004f75cc360d3205dd2da002813d3e2ceeb2, + 0x10998e42dfcd3bbf1c0714bc73eb1bf40443a3fa99bef4a31fd31be182fcc792, + ], + [ + 0x193edd8e9fcf3d7625fa7d24b598a1d89f3362eaf4d582efecad76f879e36860, + 0x18168afd34f2d915d0368ce80b7b3347d1c7a561ce611425f2664d7aa51f0b5d, + 0x29383c01ebd3b6ab0c017656ebe658b6a328ec77bc33626e29e2e95b33ea6111, + ], + [ + 0x10646d2f2603de39a1f4ae5e7771a64a702db6e86fb76ab600bf573f9010c711, + 0x0beb5e07d1b27145f575f1395a55bf132f90c25b40da7b3864d0242dcb1117fb, + 0x16d685252078c133dc0d3ecad62b5c8830f95bb2e54b59abdffbf018d96fa336, + ], + [ + 0x0a6abd1d833938f33c74154e0404b4b40a555bbbec21ddfafd672dd62047f01a, + 0x1a679f5d36eb7b5c8ea12a4c2dedc8feb12dffeec450317270a6f19b34cf1860, + 0x0980fb233bd456c23974d50e0ebfde4726a423eada4e8f6ffbc7592e3f1b93d6, + ], + [ + 0x161b42232e61b84cbf1810af93a38fc0cece3d5628c9282003ebacb5c312c72b, + 0x0ada10a90c7f0520950f7d47a60d5e6a493f09787f1564e5d09203db47de1a0b, + 0x1a730d372310ba82320345a29ac4238ed3f07a8a2b4e121bb50ddb9af407f451, + ], + [ + 0x2c8120f268ef054f817064c369dda7ea908377feaba5c4dffbda10ef58e8c556, + 0x1c7c8824f758753fa57c00789c684217b930e95313bcb73e6e7b8649a4968f70, + 0x2cd9ed31f5f8691c8e39e4077a74faa0f400ad8b491eb3f7b47b27fa3fd1cf77, + ], + [ + 0x23ff4f9d46813457cf60d92f57618399a5e022ac321ca550854ae23918a22eea, + 0x09945a5d147a4f66ceece6405dddd9d0af5a2c5103529407dff1ea58f180426d, + 0x188d9c528025d4c2b67660c6b771b90f7c7da6eaa29d3f268a6dd223ec6fc630, + ], + [ + 0x3050e37996596b7f81f68311431d8734dba7d926d3633595e0c0d8ddf4f0f47f, + 0x15af1169396830a91600ca8102c35c426ceae5461e3f95d89d829518d30afd78, + 0x1da6d09885432ea9a06d9f37f873d985dae933e351466b2904284da3320d8acc, + ], + [ + 0x2796ea90d269af29f5f8acf33921124e4e4fad3dbe658945e546ee411ddaa9cb, + 0x202d7dd1da0f6b4b0325c8b3307742f01e15612ec8e9304a7cb0319e01d32d60, + 0x096d6790d05bb759156a952ba263d672a2d7f9c788f4c831a29dace4c0f8be5f, + ], + [ + 0x054efa1f65b0fce283808965275d877b438da23ce5b13e1963798cb1447d25a4, + 0x1b162f83d917e93edb3308c29802deb9d8aa690113b2e14864ccf6e18e4165f1, + 0x21e5241e12564dd6fd9f1cdd2a0de39eedfefc1466cc568ec5ceb745a0506edc, + ], + [ + 0x1cfb5662e8cf5ac9226a80ee17b36abecb73ab5f87e161927b4349e10e4bdf08, + 0x0f21177e302a771bbae6d8d1ecb373b62c99af346220ac0129c53f666eb24100, + 0x1671522374606992affb0dd7f71b12bec4236aede6290546bcef7e1f515c2320, + ], + [ + 0x0fa3ec5b9488259c2eb4cf24501bfad9be2ec9e42c5cc8ccd419d2a692cad870, + 0x193c0e04e0bd298357cb266c1506080ed36edce85c648cc085e8c57b1ab54bba, + 0x102adf8ef74735a27e9128306dcbc3c99f6f7291cd406578ce14ea2adaba68f8, + ], + [ + 0x0fe0af7858e49859e2a54d6f1ad945b1316aa24bfbdd23ae40a6d0cb70c3eab1, + 0x216f6717bbc7dedb08536a2220843f4e2da5f1daa9ebdefde8a5ea7344798d22, + 0x1da55cc900f0d21f4a3e694391918a1b3c23b2ac773c6b3ef88e2e4228325161, + ], +] + +const POSEIDON_T6_ROUND_CONSTANTS: [[u256; 6]; 68] = [ + [ + 0x1448614598e00f98e7ae7dea45fbd83bd968653ef8390cde2e86b706ad40c651, + 0xab7b291388e5c9e43c0dc1f591fb83ecdb65022e1b70af43b8a7b40c1dff7c3, + 0x2b7cbb217896f52c9a8c088e654af21e84cde754a3cef5b15c4d5466612d6adf, + 0x2bc6b0ddbe1d701b6570428bdc1ca1bf0da59ff3bbbb95fc2bc71c0c6e67a65c, + 0x123a55a31980384f3d20b2cecbc44ed60c38c11f7d20e9271efab9a905eefd3c, + 0x37501cc8c9dc819309a769f4df098e588b01858bc8eb7e279e2883be9fb8c53, + ], + [ + 0x1c2116e47e03a86bb11695b0a5f6dab6b9a460b1eb951ab01c259eca3fd47d51, + 0x2c18213489032e85a9c8cb8e9a65839bfaed13e57bc0fae49dbdaebf54f56f93, + 0x2ee8fed3d4d2c71a0429eafd8e5db1718f29e2227985fdf2ad8703c835b9e031, + 0x28c64d8f5ed7aac004c92029d9e9bf91ba9436d1cce94b9316d111c70a0c1714, + 0x18a01d9ffb747ae0de3e83c707f8b24f682c84f15abf571b34254a03478665e0, + 0x1c21d92bef197e73b234e4777b60db14e642a56cee71515d54e1ac71cde72bd3, + ], + [ + 0xad404ccbcb1e195897cb60c80981ebb9d66a6677dbbedad8b6455fe62d807b1, + 0xa9b6de833064f93b6adb99af6c005945cb654cb7bd14c8b97af8b60cc1fb387, + 0x13129e3f930aed6d47690331ff09dc5160efa58ddce2c3e6180d45bec3aa3a6f, + 0xd7a614c8991508ab1ce4895813bb1c82f18bf7bfc9e280ccca18079839387f1, + 0x532f7ec36e30041b0486986875c913a49bddf2f5af5febe8c31f2f4094ffea5, + 0x6bbcb8e8e180201293e712f4950f1b0bbee808c9d64263c84d9d8ae155cb892, + ], + [ + 0xf558a4db1a3ac07f61e2e6bee947f73586bf40f211ceb4f687ca5678a9dcb33, + 0x2be140a60b5b5f2f8edd78a818a969b20c643e419bcf0b577c24a0d0e7acfe98, + 0x1c49c4b9a9f09f7b9ad5f74ebacc710512b8e867bace27cb0dea06e89b96f631, + 0x170c1a732721b12cde7f33e476a39a1aa77a81c06e2eac503847b00d597652db, + 0x19c27d0e52f65ca34f4e31a068e49331c6bfc39d9241f9d4c302041615cf27f1, + 0x2f1bdc5254f9220c1a731fc5276964dab26b385fa40b6b04bed9960e2543ba08, + ], + [ + 0x5b42d2fbccbf4d39d2be9339cabe9d0dc6d921e855cd91154b639d28d4a1cf0, + 0x1220040715a41ad59f4f410e0c05a42c5fd32ac52fe9d06f88188d71f61e0935, + 0x25f9526526155b83946609f7bb9507dd4925ef871dee916d9144ebb4ece1343c, + 0x17bfe4284299ae7740b6d0e204951e314a8a5d0452419147978a95b34742444, + 0x2a5d4764021ca71d78a9674cb6708f1588d2ceaf3578c4111cf8b359eef089cf, + 0x17f02dab745fbe3c081321fe5cef845e7b8d070b2514d29b2a7b7d89cc0815da, + ], + [ + 0x19da62626db7199b65f4adcf57fa4a3dbaa1764a7bd155708ee6f378c89ef013, + 0xf88e295fa2ed81b426c91fa69366a73edf75f39bf18634cd266ec4038829e05, + 0x1fe31c5548546c7948fe4ee1bd7412e3280eff7d20cb09aa85f49f2766148017, + 0x10fdc1613bdbf67f38bdde561b2f91e4cc48b59f98d643638fdc0afadbfe126e, + 0x1f2618c2ebe9574508b9c52f0000e33ebfddad1a03fdd6bca6ef7f0093127bef, + 0x129fe7fc3efac6a8ab23dba6d886f394da11f5953cf98e28269a0dba2a745dd3, + ], + [ + 0x15afd4cdf1e4f820c1631d4ab85ca4ba3bafcfee72beade9fae60523102448e3, + 0x1f2c74ba5c367e370d728e71e15b268851a7bb8b45528cb734956079ac99b012, + 0x1130e1872d76f2f9369cf59b95edf9ce19f01fa89c9c36b26e09def6786dad3c, + 0x13523d173f7e6badb73b63fc1c9bbdbee242c61bc68656493327533a5c1b1dca, + 0x14da40d0af427a65f1841b5adc96538653368f7254cb5667ddadbbad7a574cd4, + 0x91f96400e4297ea85bb186c17b304e82638e57fd631ff6315976e1a5dd8b86, + ], + [ + 0x303329bf9031c5515b9a34d49a64bb6a0267bc7b54a0deca5c450277a002cdcb, + 0x14ed47e55c1da1c2f05d3c1a1b2e6c18509fc8336ecfe9db737916e283fa821b, + 0x1161f10b357775d810ad53bcc4a20d5add2b03251c747deb04ee94c565e58d6b, + 0x17a8a50ae72ce707f22bc070eb992851ca914eb94cc68eafbb8a96a714eb8221, + 0x1a6c61d795dbaf62f99250b37ec5df88645a1c153791db6312b932dc250e4f62, + 0x1f8bd2ab8aa840664c4eee198c4684dc4b05772bb2a0869da6722b15f447a133, + ], + [ + 0x1ffcb852a4f0027a9799f131cd74b98ccfb8cbc06349d8fefcc62f10c8fb3e2f, + 0x35e742ec52f19b36d489c720f467ffad77cd53bc2db5dddb246b23021f79f18, + 0x1dfaaee41bdf94d783aa29fc62b7ec7b55673aa818d305fd42d175a05f2e3d86, + 0x2821378477a02e995005a5635088540945bd333f2d1455f038a219b8c4796b3a, + 0x1db4a4d0f238a570b1061c6eec81c02f31ffdd4a7c19e763174f238d04897421, + 0x14bf7889457b20b7a1367b34a3a538217d693b52426aff40a4bb72893b1784ca, + ], + [ + 0x2ced52c2bf296f87e57410c3ec9a9483a796d164f6049127109ff0d3a9c08465, + 0x1ddeac5805a7f4ada4d0441ed108e3149d4ce6584f49ae5bdfd46d6766eea334, + 0x2e36b4e5e9c97b462304e8e2b5f9dc88e1c9f2161ba040673f911123f042ae70, + 0xc6840d1cb0666dc59e89b1865275d8a164b447c5ed64347caee63502c238d5e, + 0x137e2e3e89e71d461f4c9bc3e8f12183262a4d1db55c589b2caeaac01238f58c, + 0x250932e7b0adcf2c84ed4bfb60a36b6b82e55aa94751157b1d45794b081c8aad, + ], + [ + 0x170a7292f5634c06dd3bf09ab5c9c4ecd4b00d5ce2f35f972b4555391f16b42d, + 0xd68cbbe77289e78d5cbf51d70f1b75ba215df4e7bd0149d10b2c50f2a4f3b81, + 0xcaf74563b90525f645a6d2036ecd1306fa1dc680b49d9ce4ed24c9749973178, + 0x20a7d1c0a27fcce78ffe372f4c58306b166f9456ed46cdeb255e395b7d30d42a, + 0x623f3226b5470b2789b8a53040e44443385e96b9cfa0be4d35015158a468465, + 0x1632308688c25e790f57d68a5350241242a56305347de4a5009ce46b8cdcb91f, + ], + [ + 0x2de4793a6f99cd14e3f6642211f4d0b7bcfa361597c544ffcb5a567e9076f47f, + 0x1d4d06d19ea1b09cad79086d51bde11725a554fa99559ca2f09f3bb73d728c66, + 0x480e7479a66a7cd9ea61c8b28974389908350abc4aafc18cd75e33dd130c144, + 0x30430b03368ebcaa91246960490bcf917d78681463e2e7d744bfb44335dac24d, + 0xb57b37320127d4c50f269124b0dbdcb2b1f1352241a5d12103283e089c0c742, + 0x2cf4890650d27240e195f60a4f698eda249b8dd614b23376b50178d2df6d2b8f, + ], + [ + 0x1e221c5526898bfd12de86851a0d9703751a2f239008ab5f9b7d3b6911c64184, + 0x28e07485ad7d992ed1a58f329ca12adce4ec693ebddbb2952e54d339f2eebda5, + 0x2f44d64f84de16dc67bd5ead51efb1dc8381c84520c12854dd5ef3a079acd4e0, + 0x50a76bc32ebd1dfe2be330f304edc7ace7167ab7ba1516f4021c62cf0d4fac2, + 0x2f58c45e5d659a67d781367241f6c35d8cb46361d97b28947d29421c270594a9, + 0x25e8da9ae0e42e840e04b230370e782bdb67534844325ba36fc7e5e160c66a74, + ], + [ + 0x2fec734da20fe32003ea04f127f844724f38a368ba10c29544252be796040f7f, + 0x288a6778f3a83988a8ed1727f15e93b4cb14f4e3a3bbb91dd6d1facafffd5eef, + 0x20dcc6c75fd89259be7f406750b3db679a25a8cd2715d245b9175390ac922c84, + 0x17f42ba10942df25cb8a541782a18b6fd31cf965d11178c7b04ac45b4dea5dd3, + 0x28eeb85d115a904020e0c6148eec6603e9cedabc664abee764aafd455986ba5, + 0xb1d7cecf3a79b2ad3fa298f6cea7ae95d80c0299ecc918e9f8c9c3d38d59d40, + ], + [ + 0x440339c9764cec79c16efdb834a26261db8e3f12ce1cf722d23c0e11ff4cf07, + 0x6ca647c29727c1962a002177da2d504f4b07a5f7eb57c79b88e6b7abbbdad5c, + 0x2ea120a864f5c4093dd1a962e8f013c7b8ef778b04d2ba5bfc3cab28619ba9e3, + 0x2bb737546c4aee7c0cc2ba87c1157e2a77c479ebfb5dc76adbb39cf8697633fd, + 0xe30da6490625d33e79cd50176f568f9a2c28c2f449a2bd51a25d15686803a93, + 0xdf7ca7278a13650b919d85497b2ebb0f71035a7c20430d4131d903ab7f57521, + ], + [ + 0x27cc589f5bf585794abace589fb8a74a2f784c0990b80fcaa6944097f870e2d5, + 0x2255c36a38c8735de45cedf452afa842332d33042f78e60c43c7455421b325bf, + 0x133d9602bd3378d69f681c27b05bdffc98b7d86cca63d73a60caed485784d087, + 0xe1548e942ae9d3e26860699b93727c817a9948616c93ef4accd981b1dc3d78a, + 0xf20f0e55d93689fe09ec312f6af47627482e4bde0a1602a8e2c8d6e84e8a6ae, + 0x2e52328483cb5b7ff2eb4e45b12e51b26232c9bc17b7292954c0a9f6bfa51bb9, + ], + [ + 0x2b2162d533e059a6eda2abb74712edb3a7860beea95dd8a4abfc957660804f4, + 0x19e0927715d1cc6d389429947fb3737dad733974c6b2e13e5b3d432519516c74, + 0xd3a800457d77785636303b8b94f17dcffcb46048872ac9f74ef7f27ee573705, + 0x2c974d1952557a1aac5f7bae4996616da619b73f441c4e504dc8fe9cfb559e32, + 0x766bfeeede2ccf3708e1b4ff30714c22c1d434cdbe8f55514babc2dd5d97bef, + 0x23dac8ea54082fc131e173ae55e4630cd4ca7c871b2a0a479c1e74e7f191e62c, + ], + [ + 0x17d5fb6c2cb37010e3e358ab2d575376870ed33186b8eae49ad3b47e340a8d7f, + 0x175dcac76d8a8126139b583ae38853290246e43e783fa6903ec8007f178c0023, + 0xc4fd08fede5d221adb7abf549898c91e5be7e85bf1fd2a611bf182cc2e71655, + 0x277934b909e72d3a3475bb1ec766ab7a38ad59b128303fc5002f02a65bdfe729, + 0xe88349998dfe703f1b184524f9c394d6004ccacf9cb952896e8cfdb0b078b68, + 0x1f1b2078b60b0fce07824e2a2bc8cae8ee673514b0070a8b45710cc78cbb9942, + ], + [ + 0x2eb1559566c536ddbc316f6482d51fa340557657700f5b8a846e812a0ed334d1, + 0x1c4dbdc335cf6764355208b4c9d243d34541d623c669dec2c3ba066bbeaf6773, + 0x2374a6b2da6f8cab8e5cfe8d805dd3a2dfca1e8b7eba5dc8574021fd1241e3b4, + 0x19dd342533ccc603a99738e3fb5a569b94ef71b3e49f90fb874f6161733072f4, + 0x217d66db6c7fb3effa508800587d2eb3c6d03d8385132f2fcce7f35f2705cccf, + 0x815fb8591fe01038cd3a3b38b236f9efca77c618d3bfc6c2a7fa89296c7e64f, + ], + [ + 0x2bb943b40c2bd456a6c17853b1ca88eb0ff36f5974b2ff9a5f5093e9bf63a16f, + 0x11a5153fce659513ee7cb9974ae6cba581e3b4cd14570c5709fec3d8d3fc82e9, + 0x1b72bfd07635d8501b2eff8785a2495bae74c7653cf90e6d5c9f144426836df4, + 0x14902c0700eec897ae178ba8caf850d793f1d87512bea0ecea39cf6b1fee233d, + 0x9c138c6e0a616a49ff90d43a6b043f3b745b78865856dc4c1a45e2fd84cb3f4, + 0x5b58a3dce57b281a271d69895052d887458a715783e8317e024a61a35ec10bc, + ], + [ + 0x2be8d29525c0cfdd5e6b3125e3bde3bf558e55fbe867f024457a96765474d037, + 0x61d72f78f1ba9dc6b4d7f7784225d6a81bdfc1b5ad6c24369f9c0560523d9ad, + 0xbf18aefcacffabdf4112eddadca6145738b4803b36145bb9516db501a0692e9, + 0x2e73dd105fa8b2ec931d8cdf29ec679e3a9801a93071a7d5ea30659255f03bc6, + 0xf8440ef667c9ae81337ba5d8c927a5347de7296860b211cad1ecbfb5d3598ef, + 0x4d303b2dea627b2731be83f93ac34e7d14d178a13800558ca7396395eb118f, + ], + [ + 0x234541ad72040a70da2996a35269230c94699eef313a4d480508008cbc3d37c1, + 0xd123f1e72d26b92bdd8fd73d14286c312ad4c23acb46b2e08c157104409e174, + 0x2fb360776f0de79d7098ee7aa4123c05ee6b05a8be460a774f3a048e138545bb, + 0x3685c079434e167276c57d3cc79703b7dfdc41c156ea1e8b7f99b6956a55326, + 0x260af0e0fffcc9772c1631b179344566b47aaada3681eb9034c6f75c3705c1c7, + 0x2862b41374f89b695274b33b773f2554916e2bff9ff672545fc2f49563f62767, + ], + [ + 0x2a9912fe170310227189ea1e691d0362f18b38b400b0eff192ca59513eba8d5, + 0x8e513ade694a0d8ac1f3ebf1a96440d32c713d5058e1224e070348c281f4a6f, + 0x140a4a431e2ee79400ed7465978d84773213c628264ff80f21ac7a6b673d09ab, + 0x296af4d019cb5df7d959b29d549c3f071202b4eba8b53dc5ee979ed143377927, + 0x1832e284a7f4c81614882b6939fc0f185573bd2023e3e505765470bb812b349, + 0x1a84d56a67bfdd3d965abdcd329aa78d4fe93434496f2d103861fd19d66d7260, + ], + [ + 0x40cb82847773927d2aefdc07489037a9d1f7631eca75c9fb0dda0cb9dbde143, + 0x10dcf084cc29cb7caecf26aa633bce4ed2b019f2887cee7b1a78f89d3fabe2f, + 0x7edc22a0911ea214425ef542b776db23b0fe5817810d40c72ca98aabd9afa83, + 0x2eea4ab08aec775f2148479ea36fbb96936da58ba48bd1d2d3acd48173aaabe7, + 0x1e40c0e8257fe4a61005cdcfad148cf7f47d1b5cfddfaa082738695518245f19, + 0x23a27809583bd1ea51f436de5443e108f69d44cdf51dc1f03e21948b4980b876, + ], + [ + 0x2e4652b044dbfe40e63b6b232fcd5f3f39abfbd2051ee68adc754080d49250a9, + 0x11e7abdb6ecbafc2e7d8cdefe9c7b9c50475eb475db3c2caf7f7d67f485775f2, + 0x199d52350cc30e8c73821f802096f0e547a13551b27bf6b899396f63ac5cf8e7, + 0xf575d6ee67cbecd98345624e032a37c859a7cbef30b3fddc949cd0978484101, + 0x1c4b6f9a2ae2b418e6265acba9c96b06184d07028e5fb784f3475ae7772ff057, + 0x2dcb5cf8896de39f228e157c0c5593f4626fb9bc225206383db20360abf0c925, + ], + [ + 0x1340abb9f4e113186bdc26cbdf4bcca50b531a107f863ca544575e3cf870f8e1, + 0x2368e692b72787cb8870ea888e714e006f59d2b4460cfb74c48a8cc73b1d1a5b, + 0x1fab9add9baa4a4f56f23165775c6f2d922a7632a94f96374b7dc852756f54b6, + 0xc7f7b82300d3c6ce3f8957ba1e4add54c4c015e20d9765d220571c16ab8680f, + 0x15d63e86beacd93c6083688e5d9c8f3c6947929f9f1f99ab578a4c3a922eff03, + 0xbe843ae5f9b07e52572178af7dae8ed05d36b12c0607862929355ea74023d9e, + ], + [ + 0x1332749c523694cb6935e0963a07e81b05967ce1d950c0b731058ec92a7a0c9a, + 0x25439408810e074c0bdd4598b9815fee892bb95ca51029ecf009bffa5b9b9682, + 0x57e8d19dd999a918da29b0940b383ba9fd15db0b0f64996dff67feb55f9a742, + 0x1e014e37e9b117cf3b4870d999f2b55d3534d0a6be98e9e357fa43f01e70a29d, + 0x1a4ed24e6e03aebcd6bdb100533dc966597afe15c851b4b863f6e889084c6479, + 0x253420007083f1aa863ad4760905c1039ed4111c9f053f27710452f83ce36a90, + ], + [ + 0x2276a1441971709affe6d2a99320001ec45ec72155c575ddeecac0e32759ab06, + 0x28957dd1218ea799fd3411eb19325853adf7ae8ae1281f753302fe7d31dfa7b0, + 0x2fd925726ab794c88bd75796aa3e7f1e6692f2914cf802267ddf01e37902a008, + 0x1cf8a5c9c76a84b147c8238d9253cd55b47c0c43d82966c4636a28674705fd9a, + 0x373cbbc306e1bab9e7077368715e6230b4b2e2e4a1db9c674b8c359a41e9108, + 0x60283d2fe7f23dff513d9110b3dc62448bc48f531ce0c1eab5920bf23290a40, + ], + [ + 0xdab465d6d910740f33ef6cc0eadc71bf8119bdfd5a3527dc8bbfadfaa40263c, + 0xcba7bcbc8224b2a8e4aba17977230a686cd6421dc0ca5346f3446b62439c4c3, + 0x1e4365db0790c9c4f445b0653c466ff21db96c38b4076ba8bd68bcb4dea6911d, + 0x1bb2dba2199a9ab3bc86ef5f9de7f6c5ca13d60eab42ced68de98fc643800a8d, + 0xad3c1870c6d6ef40eebad52123cd1a2913d9d62e80bfbacae812e082021f9ca, + 0x1b098c91e7b0cbb5c34588077c0ddf95300ddf614935630c0ce3a2627245308, + ], + [ + 0x19fd5c0eac14fae7598bd4ceea3b1e2998b0c168493b6d72ae41b576e55b9c3f, + 0xd4749d79cc163f17110a404a46fe427c6434f3fe67b7e7b4ccfa6ab95bd7e18, + 0x1ebbfe8114a41bb809e0b33399241232eb940ad8728c8a516d40ada440dbfdcf, + 0x2704e5b6133d9764d6d3f17d49d833223e3937f80eb9faeabbfba9baf4b4c1b8, + 0x2165e1c8027305b1ae0e323571635e5d540d13d710c3f9a390b6913f14d035e3, + 0x2e3497e4d35fda596c06afa63bc3a0f2e55d4eeba4aceb60e65081ad63aa8b8a, + ], + [ + 0x31da4345eecd6db6c0f7b07c7815d7add1fe0546d738f4d79ab5c57aa841edf, + 0x89ece54e47aa5c908e43e5f08737c1436967089006acab1c9cd19eac4a20876, + 0x2f53c15e2aded33c47f55a070483e6cc7f3821fbf8aa40677d0552ed9d10d847, + 0x142aa34f4b2e8ad0df7a21b3e39c00c8b0aa2857094801eaafd72befed077f93, + 0x17aea4da4c7bcf0d7588b014eb8b40979dd2725eda4e6ace331982467c7ff2bf, + 0xe970c19d19748d8c465104d8f02200363f9a41786f02f1827742b20dc0d1727, + ], + [ + 0x4bcad9e553795642f59baf714a6bdb432fc45a0a0b77f1aba3a9823476df9b9, + 0x242c0bfbcdaa76f715dbd4ba825c71fcfed671c1b1901fa484c87f810315d0ce, + 0x25db1343c24104071023fb6ed34d9909078311e1efe85af0a11b19114fa9e790, + 0x2ffe4d9c420a59e9cdc7c31ab2bf35187ca147cb898a3942deb3677786036a80, + 0x125bb03af3e2cf18bbe6f5b590eb3bf8d0d1ba63be696483e98f283bc7cd07a3, + 0x816be42745b7dbb4ceffe5b8e24ea60fd8b719deba50037ac7b75948745c6bc, + ], + [ + 0x111160f9acf6ec360d1b6a712313a0dbcbe23e64420055471d2ee4c5dedb35d4, + 0x1377978e1b1f6a8925fa8e7b7941bdf8fb59ab9542342419283d8203435c9391, + 0xdefc1d8882166ef3ccde53a4f236fba83d384621937cee57e421a513d0d3397, + 0x2f8fa5c78c706e3a5d4a03f2a7a3953046d7e94cb88a7ef350e67b5ba0f0debf, + 0x1a2a957ec0a723da61c2134bab0bf17beb00e6dcd84690c230dcb9e58da94827, + 0x1cdf8710995f5e03412b4a7f699532f9fd01f0ea167a8dfc1ddf37e2805addef, + ], + [ + 0x26fd31471828c36ae36c27b748054b0c0c4fe5239b301699e3765eebecc18946, + 0x775d996cc2c4456f303a2c1f9007647e11a921d9fea3f7b926143b99d2fa0be, + 0x16fb9337708ca638cdfda91bd0daea6b97224ef7b2062672addd1bd18bb8900, + 0x2c392fbe7d3fde42fca4f9478bb439331258255356f184af6f76f119054117d7, + 0x187a2a3bf79a69fa3e5089ef9f1fd56fdb47c55eece77aa228aa3de1b486bcb1, + 0x271a863a280a32641ffa33510b2edd278c98630359532f3e506b275fd5d20ce, + ], + [ + 0x1557459c9c74c94aa00e5af69a1e3112fb69537ce897ec0c718958d96516f2ab, + 0x2a8e26ca8d647d9a6388516ea9dcff89083d539e58168c2a50c6dae30f109f21, + 0x21cb752194cf43f3b51942eb0040eba9de2bcfb1c2a3fae97924b710f26832cd, + 0x2c26daf996be247acd6dd4acad60d38b5a471e6322188d02c137e7cb484377ec, + 0x240176ee0e7982eebe92a68d3e3a38c26821acc0f5d058cf8c137bca2d26f1b, + 0x2636e0973c865c1bd974dd78daaa8d0a84cdaf6be1ad47ecf2a0d18f117318f2, + ], + [ + 0x19e84f4f25a799496041661dc5d975b681f6e06744cee89b7be5d9fde1744ac0, + 0xebf89064a3af247ca1f36f6f3570188e271e0b326c4fb26664e89e1454ca110, + 0x25c7e97b475be00e8b559a38c452364f4c9c531fecb8ac698f7fd73ce22e71ec, + 0x444c99e592353e5aecaa302add901c14d8c55270a160afed4429ef5598ad74f, + 0x138db8887830565f2693d0e0f02e4e79e144967f0ba53b03519aba764b5c994a, + 0x24d40f462114fe9ee02aafcf74b4fca24e1ae365dc75c3b52bb13cbbb2f21edd, + ], + [ + 0x21e65d6d8ee43760bca40e730b5df4c4cf3a8a732db148f4b2951b4c61d68e8c, + 0x248dd79669ec09dbf0350a15d6c75c6a9bdaacefca14d51300978f13d1ab6d1c, + 0x2b8238c1548f9cbe29fd35cf91e7b48f0ebda7e639edf69fe8d5aba7924d5362, + 0x2439fd239257f38181c7be3cf513f1bf7235eba94f6b8942a94cbddecf6f62f7, + 0x200958235281a61ba2c4be0aa3282a18c74b6d262f5de7c2e33d2bb3e893dfec, + 0xe1eca5df88ee5f60cfa7e1fe5befbb719fad8211fa9b2d02fcc233190c17f12, + ], + [ + 0x26b53427f9b3ea2c769d9c660fc60881a169c12732d001b7158ee4b1b842ca24, + 0x20f3b3f4acafe9f8af3e06661b3a8f778fa2812522b9d70a67402cff8db2b1b4, + 0x211e5d2b39d62520a7a627ece8cacbac9f97506def4ec286928ba6c27d463b17, + 0xbb743ee34802129c556731aed9d302dcd085313ce572f6242d13832e536b4b4, + 0x23cb2661b488ee71e4c753ff23ae4bd25d8a44094f66b6532977e22140eba5cb, + 0x3a35aa3123911cdb4535baed3359f5f6a5205b9c93ef31d35323a47807b8bc9, + ], + [ + 0x27803848a0aed96a93fa943b6635e450217e137f4ade74a62d7917322714b697, + 0xcb37839c2c9a7ff79884cbec75f41e9be5e47c76d61538231bd8162996d6f67, + 0x1f0026d0bf1f8e1dd5423cc2fec1fb5cdaa1ecdc4c3cb218dbceef77c00d2f93, + 0x2a7d7bb970b8a6ed2ee66fabbba956b6da3b100f5b5fb928eef42f9708273c9, + 0xcfd7f4215e434c8da17ec3258b0bc605ad1ab2e90aa494351e4ee40bbc491fa, + 0x180b11b720622a156849dc6f7f6e7f571659be69682230c5ed9ac339700a7cde, + ], + [ + 0x4e96a965bce3d3a0a24a4a457c951582c871349ce7eee1aabfe578a94c65011, + 0x15931f782b45f7fb656f2cdbd1f7705c353a23fe1d30a5a46a1522ed160df3ad, + 0x2e296e57c97a5309acd26febf55ac963a5444c1c5f703ad88a0d7b97b9dd38b1, + 0x26157bceb78e846bbb262f9a1e06d4271bde5a5bce8f0419952f97ffd13eaca8, + 0x2194eb89847d6b0f1897f675f19c0c56b61b13248eff3ca36e34fb9d1c79ee43, + 0x2350bf35477656899151ad7dde96ea7857e15501447008dab6b3d27c8ffa274f, + ], + [ + 0x1a486f0ae591cacdaf09c58a49c4d1795405435340819e003f0469d110b7752b, + 0x1b56dcf76fb23cc4a834d455a4065e133571402b7df309d59bc3105d42a8c301, + 0x1a749d7964af0b7202913ef204c653f2b4bfb65ceab7b685233ab59ce3bb6925, + 0x18ae590073f969696af762ffa4e8f0ebbf97f8cc787e37cddd1f321be3beadbb, + 0x21c47b275d82dde6460d5e769a99421144b1c5a9da59294ade9cbb317103f249, + 0x473ddbd52e737e527364e8eb63207975c38d5fd6cc32b272102b082cd1518fb, + ], + [ + 0xb12fac95b6d3a881d892657c8424e645ac4e6b00515f902d594574302b26e02, + 0x8ae7616a260cf6657f8f73ac284588d2c5f07ff425d837aa7cdcef63e3e2103, + 0x39daf6876280b80e873bf2a32fd2834a83c69757badd58a888ef819e926ce28, + 0x25e7b1d7470a3c75f13f0b56546c8e09f2d8efeff06ef766f9c783ca869d130d, + 0x1e8fd3634c3ff764184d03435f98584b11b5b15aeb9c75262da3f1ea2c2a9e7a, + 0x241dcc51ac37808a415dd1e3c281f05aff11789dc0cafdd77a35484e0993f9a4, + ], + [ + 0x1ffc3153c56ef9755932cea2be0573749bdafe1c4fa0781a4b8b4078ce9d7547, + 0x17630d62d9a3e510c88a4d43c360f92bc0fa00b66031adec29bd9543fd3a17ee, + 0x2980400edd1d74e3d69db5458d2ccd5fabdb236ec16a82a4301a0ab59ea4a6e9, + 0x3034fb24366123ec6dcafcad35726dbfb16194c036dcd648fa69439bfcd00cd4, + 0x1aa7e8f4189ca9dff3db2ab7648be0a2392995ce46041e04680dca8ad7232df0, + 0x1fa195f834a69e62372f60eb497da167646eae14153d803b39dc5d11f5d7800b, + ], + [ + 0xf23f1c74d5fbf6195ad5a6aee5e56993c5477e8453f5b93a0d7bafd333036d3, + 0x16556fac9348a735ab50aa089c97151b3caaf0a20a34fb9d9370505a1515729, + 0x23d92b793648110fc5aeef0633f0c77cacb0dbbca1879b8a6f6e5df445e5f70b, + 0x2e4c10ec5e65e2f239bbc43c13031df2686ab40fd79a304b05d611b823f23b73, + 0x12418bbfd77b63ad5e16864ad9c32ffbfc5a3dd9b78ec2b79329fe5e0a8d2953, + 0x1e4a8aace15abc1d5b76a9e848431d2c06a78f72b6bebb1293e6c58e5185696d, + ], + [ + 0xf3e96107decdbd6872c20ea09acf92cdf17a3ee1d1331488092d96176deb755, + 0x12c3780207f395cc21deb0abd951681eea32498ddba6ce897a8f9f0c2357067, + 0x13eab1b4e672ba1b1c1bb901769301f1e5659d03ea10c61de2477ff0ac221421, + 0x20dc664abb20b7456c06629ce37a1ecb1a27a4e8b24e31b48b9c4635aa30323e, + 0x2c6b1e2cfea78e2c36785e76a8cfb1b057e9471f24f5b391175c3decb01e000f, + 0x188c926255f5b7af3da96355729c2a8670ab4c2c70400481b2ac903740e0c5ab, + ], + [ + 0x2f9913208e09e3d6e9e6fba6384fd076ab89f2662976e3e30e0870bb30eb54f2, + 0x2b33803d90889706e714f720b5628d26fb60b545a1f3e9ce49a6ae912b024086, + 0x26ccabc10eb04327cb5cc3dde2abb36f097086c97e738c133c9f57077e748b09, + 0x1b16ae0d7c54408cb75fd931f246751f2b0c3dc20d79e82a2531b76c22b4d5df, + 0x11d0bb461bd8af2844f49f0f840c94ef9518b2511344742d1f5438fe3d415ae4, + 0x233031847b476bead0118d3db338e89133ec420d673e504ad647259df655571e, + ], + [ + 0x1f84e97895bee438eb3c92dc9b1846c9ad29c164387b06aeb6ed1841ed8c4dca, + 0x277f7f9b542f0c2bb5f45bed054f09624536010c3cf9452d2273193327f801d6, + 0x1efc9c9069e5068baac13d2e6645641b7d27e80fc23077161535c44682ee57a9, + 0xd6ec477761e2efbac4f14b3bf3d5257a99e64c3f25fe104faf988b20fe5ff44, + 0xe0e7d7c5501999b7d16173b59b7cae1f203bef21aebf00251881439ccf93013, + 0x217bef2f4f12c6dcc91c2058a23391cb77de53ca6e44dcdc6ea3d36fea326ea6, + ], + [ + 0x5780c88adf01531b50f817e3fe44447d29b35aa8a389c71e8cf1226acef68ba, + 0x18733887a6b2b3b4c90d8e4990196e23445e47d7ea5939ebfb89a3ee3d67b4bd, + 0x20bace63acfcae0b1c9f2bee24b8e9da85ba597d37b0905720c4f15db231b07a, + 0x166ea595375a6786ac527ee9eced73ed6bf550876abcaf3ac92b42c808b00d8f, + 0x304262a9eff4040acf43e322d6f52676ae2f853ec2e7a80db00c488cf917c74e, + 0x226bac7050166e5f6db78cd0b12d36f305b6e8c9a055114ad7709e6f57245b6b, + ], + [ + 0x26b2f539c573829f6aca91baa954505bc5c3eb4e1df1d638582717fbdf2388cc, + 0x6a0fbf4cd52e93ba5e4c6c4af65db02ee96297f8ad200f2f1cff252e769b551, + 0x2cb9c24112d35341aceac88360fb528924e58b6ecac321b9fb29e6aa3368ff23, + 0x20e88a4d607526dd07fe08a3552a44669129eb87fcc0b13aac8fe8afd9301521, + 0x1544649a2bd73e3ba72f396df91dd65401dd8faf51de325fbaedb9d536ad94fc, + 0x1980077457995712c44da7e17713258e3f8eb354bfd80ed9eaf3ecbaf6960105, + ], + [ + 0x25d1d22ff13e7705d3c085f97fc4e4f6914b82ffaa5d2091ec64dac423765ef7, + 0x2fec990ef556efe1035a464ff5581e74067445cd54abcaf6b8c0399fe0d24cfc, + 0x1bd9563506d9544ef3e4830e13545012c579379c2dcc1330416c4ae49bc4ec61, + 0xaffcd17ba6003c56dfa85571fc29737b225a80d480e7dd7edec01f14f23010, + 0x23670dbaef966881f07f919a2d883128c7b23cf767a477b2b2e0762bc0dbc18b, + 0x1f93a532917394c7e22fd17abeea6389c66fd7ae2dd9f02f860f6d96947f0edd, + ], + [ + 0x2de42e9f537b7d61b0213771c0e74f555512be07b6a50934734e2c5beb40be37, + 0x25c557f45b99781cd37d3bb22931662a67f78b37782c885b456bb96d55e88404, + 0x2074c8b709705c9888538a7f8a3c4aff647731bd16f8e254fa74ea9f2be7662c, + 0x2738355956298138949e442171d6a4e4b74ef2065740db7cfc3a0b60fd573acb, + 0x13d36ad0a4ebeb81969778649659c65cb7d0c41cc519871fdb71a9ea6a0caa56, + 0x8a2c18ba41381348c1acfbf9617716806b462a1691bc2e343b79b8085e376b0, + ], + [ + 0x59092fc395aed285807bbf557ad9a1041f59c079822b1088457882fee7b612c, + 0x161924151b5a5ad2d8cac119522a991a906f15e8531dc70567f6b28371cc24e3, + 0x1c68ca8f7aa17659075405ef6341b8e69a298b9a4d72f3bb854b309e4ba87a1b, + 0x27f5d03bca1c8207f7239a4b2cf73ae559a15aa37e7bdddf3aab05eec5ce5592, + 0xecbff4846962a975d347ea9a8fc465fb46861557622f2c2564a7e639833c169, + 0x277c4de2363d8b5b456cfc5a7ff8e46ff2ec8daa59855f5ad64bc0521f3ac567, + ], + [ + 0x1b11862c52acd351b7a464793f4fbb57fec99f832b63226f95d175c8d2fc08b2, + 0x6a719c584c74ffbdd7218eb565cb4c8bd86c92e3dfb3c73e1527201aa51234e, + 0x230e4adeecb799877f7ce9a58c836b99d533584a195c1d77a313abe1c7d126bd, + 0x10b109b864809c4767a133cce6cbad6c88628173b8ea51e8cca85830ca7de522, + 0xe21117970dcfbd4b1526b253636f377538d3b4faaeb5a8b24bf6200d14cc591, + 0x2667349978401362f6b17939eeb0e64ff55607ebdb35c7071db46bb3e7ba4778, + ], + [ + 0x5000fa5fda505e029a13bfe304c267b0d86c72c039babf6d3ff02ee246be02e, + 0x264d9e094aed5f41a60242220a34a284089087b2436a9bfce8174cc9be8c2e20, + 0x8076f9c4743de6130ff622cf401edd2c92f24bfe114f3c5e724891746315c47, + 0x132370abddbb0b1dd57f2a520c25336bd7cede94b95bbf5c2151d6d88e641b64, + 0x8ff1116b7a227bfdfd4465a67890882b615c8c4c17f28d8d24958edf602ddcb, + 0x2bcb0b0db8b9e3e02b7e9c1c9460fdd9c6cd98562332e648d8a3e0ab94597520, + ], + [ + 0x12ea68ce6881becad7f8a6b117b03ab976f7abd597f903b0bf230d20d21a943a, + 0x27439c98a76688067a097b19b6fdd7d78d5f88e274e0d8fea5ea6b7406fdda7f, + 0x2f40d0ad05f5652e31ef9440ad71ebc8419e393493937f05f00499d02a99e36, + 0x2fbf04284327ee4f680f06bd390e309d0d13acc74b9c5b14b63059b8cc7abff5, + 0x1be686d53e2a8ad57a828b0651425cfc6978c7027edbf247f6b6723c21df86e7, + 0x2683b425e85a508f96852f14b4220fcfe9f7ad8b17bfefc0e348c47ca78bb57f, + ], + [ + 0x16dace9b2e8012e31db1c7ebe672d86bbe61a1aa3e1693e0eddfc0de0a9dd951, + 0x27a321f8c7d3c9022e962f7fef2e3c848b4539dbb75aa139f30430fe545bcedb, + 0x6ccd7210dee1d6b0e22b79e12d19082d8078b788d71007b95e7a774ed86a651, + 0xa41dd42221653752bef350f6d74a917b6cbb1fd76a3a12166f4d0be978e4026, + 0x220a02881e4d47ac94d950cdf8386274d1782e27cbd0d845978deec91298f165, + 0xe2155a545fe5f3cbb6397606589eac19cd92639339c6b017298a4ad3408b4b9, + ], + [ + 0xf0f19c6291e51546a267c60cc774e5fb9d088bac530782d891ec1af4b847073, + 0xe925bcd1c6ddb4a3a1c67ec8deefbd40c53c0d33e7aeef1b46795aed5943c9d, + 0x2ad000b1748abb812cd6e5411286b9ff3ef0a5bd3d259a36e45ef05b9eb5beeb, + 0xa65aa232d32ed6e8de63d1cdffebc2f3fa616465c27aaf97e8cd3dcff648652, + 0x263d8470ab4b1c61d74d8e896242f4f261dcb167a3a06923893d7cb2c93d6a1, + 0x2901d946addc94b040fd58004d9a5f8cd1926540c7a8612cec1c58cb60c2b3a5, + ], + [ + 0x1889cfa8209f4952df9022db9dc583b5717a0696da41cee64937d0cd6321e693, + 0x236064d71cb6c64c84747ac25fcf8d881502e5f03bff87561b85a116b1f39aca, + 0x2ff7a174ffcec29862e04f5dbdc73ebf3661570033576290c0c1f6cd8ced27ae, + 0x19e724a1d742cab103455f0040edf745a2696a71084c93e322715450dd4d6f5b, + 0x3eed3892b6f0e6c5da1059c5f3793985835aa283500a8129904a94c87f161bf, + 0x8e2b8273bfa30c1ac850306d91e468a9e8d05092aee4cbc80c687248463ba30, + ], + [ + 0x7adcca76d8337728839a1b6ac3b3ed42afb87d72af98f52f416f2ec58b28cec, + 0x171ef37896bae2b1020a0a5839bd51784ce11bb4237d548c171169d32fa19b40, + 0x20ffdfcb86f4d005064edbc296918c332d32fbeff1729de5056a26abbc3a35fa, + 0x8ecd7a6f1735eed86baa094e608f488f38dbb398fcfed4b994383a0ca8e4647, + 0x1c3f5d86e5921fde9890189f1d8c618754288600e6928bc182ac4d5e4c9f0ccb, + 0x29c61184ed9d460f337558a1af639aa7e3c0975e4014ed8ebcad4a25d51eabf3, + ], + [ + 0xdefd45b28958728228adbb2dbdaef6a5e9b1a64902a734f402b8cefb8ab3b56, + 0xa74ea22d8a09336060610179ac1d82fffa9492df76deed4ea60e0133b0811a8, + 0x3a37bf12daf1400d297ac4ac13ba24c17dc262db16c8523deee4e0ccde9a680, + 0x11fe1790d5abbf5935ff22318e4f7ffe69966ada2f9136b54f830eacb0a65368, + 0x18165842f406375f2346686915afb14bf1fe0564c8858ee3bde0aba3de5f68f, + 0x261db25e7cff5a9fb72f276b1f9260b667300fb7d361b50fd5c0e8b6995b05f9, + ], + [ + 0x2a3ac3314b2b66e796fbe36df778c5e46972320cc43ec807048826b6704ba7c4, + 0x23caa4b80ecfa99e9d3fea2bbc1dbbf369d1bfc8937d03d074061c30fd8cd76b, + 0x27db260085e224898df145f23f635f2066d8e4e124e581e8c6261929b1dfe107, + 0x274f6c5fd34a784d6b915ef05d424ee6c0babbf369e79ab138b8167b5618ec7f, + 0x2c3a29e13a84d26a0911c9289daf1aa4cf5840aada0701d57e23dfc796da6da1, + 0x1ea210f2001a334d3e801f4e53270d42da7aaf317a553b4282aa78eaa2282e6d, + ], + [ + 0x254dbeb52884b699c1ba7fa0d6e80d610903b18a3e509c36351ccc3b024946e3, + 0x59e781d65896ebe0e4ba26dc2f29907f47bcdeda4a2ca2c713d8505ea31fd5d, + 0xb5b1cec63d42d5e615dc269b885a24cef303ec78c972dd17cdbb3e915cc4ffb, + 0x2a7c015e9c3b2c57ca8b7d26d39a1bcc85d6ffacb7d9fbd66d2a8f1d64ed0c92, + 0x29b736b911d71a79cf63d8a6f786f11bd5abee24161dc567a7c851eae1e43b51, + 0x285745a90a7fe3d09af5a808704bc69c6f1701e573912df5cc1e265d596c4141, + ], + [ + 0x2d901b8195c3c96c8c36eb99fec0134ec2b8304ae810bd30da554e3080826715, + 0x1905d3518355eaba7859b591ed7b8c9c253980f0450dbdf54d7a7782ba058392, + 0x23e813026fc0b80064d19b5c5428942fdf7efea80bfa8ec4095272bfdb7b4c9f, + 0x23c0a19a252c87e6b1c1c21b1a79800200c3fbff3e3300e7e5568071de9efb81, + 0x11c4ae607bae492413bf62cdaa2c2868ed1fec6dc0631b067ca60fab125b9e2a, + 0x2cd055ebb7ee4686365dea450f046ff62405fae1b1afc9fb01707cf81da0e3b9, + ], + [ + 0x53c9fef2e021fa9a20fada22fdea1505b58a3159bbb47337dbf791b215b1452, + 0xa35bd74e87cbabaabe89ad1319d2c9e863b4c631c21938c9a5395bf97872a9f, + 0x1c115056539ce20cd5a04d1a5c43e2b00fbe83b25901be36f5ddc4666fc383fe, + 0x242954047e5772fd3bded590ec8beb4c542f2e264c8c3e284cdc473505c51a90, + 0xe2abd315b47c0dc93849c0cdf267e811cbdbdb200a6e7c2b67edf7cb0174214, + 0x282b37020c0890d751c3fd76950d8068668e1dfeae621dd552d2de887da2ea75, + ], + [ + 0x28933852266b52d9ea6b5bb923d9d94f2e5a5be5c778e75e07942c234b643bd9, + 0x99ab6765505ba1198ef140e77b7954d4fbe79a056ce72bace39c048c00da3cf, + 0x2af211d8e0ac2d8fda7f849b8f229a225c6186b55762c7a7b2ae2d1dd85c57cb, + 0xcd070f234014a2809ab90c71c1da61e98a96322fedd99b6aaae1ca104f3facf, + 0x26793e2abc8d3c30c60626fbaa158f263587d6bd15833d448b116264b930256a, + 0x225be36ed0ee85e1f845ada84e5748a56699152113ff61b5056b6d8bde60c19d, + ], + [ + 0x2174f49edb02d5154d2beca2dc92b9cc595383da1fde8f09e4b5ee3ea5a065e, + 0xf64891c2c8b020e46c3594cb758f0bddcdbd09bd0308816fb41734a869872c3, + 0x192a84ca2f99d36991e2d2b1deff3989d1c156c239e10e9f56140e1854576067, + 0x29dfcd7b63f05abf2753a8c341d6b7a60c6243b04c9a1b8b3320bba04a4d4787, + 0x1ee27ad6b9b5a867733afc61a2b3e76a52ba3e4bd5e657ade91fc038819dba5b, + 0xab4773f150c3f8ad3bc9538f43cec395a7e3731ae973fefeb623a09217e64c7, + ], + [ + 0x13c352a02f595186202cb0b99fa58c5542ab67f9b6d3a0afd103deeff6d80f41, + 0x2a97cf2c10c4bfbfd299f67c52a169f92c05b7dac56a41c4dd4fe87c8246ce14, + 0xbecbb47042bd7f8c9f6bb422162d1aed089a28482f7fd16ab06a13285fe702, + 0x8e44da21d738691b881757ef37ed29c5bd9f7a4450fcf53290a92cc2ca2176, + 0x2b205a8b6d4b7063d931f3bb5d3464053843fe7fbe4b83c17883f86527882a18, + 0x2d9e32a7c90556fe108d255ac01e75df338fcd63b2bf84c19280d427298863fc, + ], + [ + 0x29a322a84c25bd2ddf6e2e4200228d95abd6349a02266ac1dbba520738ceca97, + 0x678c9bfc6f2df012f4fe55e33bb68ac14ced1df0d02152792089d046d828c43, + 0xfaff3a5e7425794fe20a7e0eb615b8b1760394b7f2304286a3ae4009124db23, + 0x1f8f5b611af9feb9cea86c084058120553e404103aee213f5a41d1d02541c0d3, + 0x160875d8479602f96f40acc2d042ee52c1588b6a29de4284965a6dc6c930ea07, + 0x16d87a5183a316a1d70afc951efe2cd667c77328fcfda458cbf5fe3045f46d9e, + ], +] + +struct Fr { value: u256 } + +impl Copy for Fr {} + +impl Fr { + const fn new(_ value: u256) -> Fr { + Fr { value: value } + } + + const fn pow5(self) -> Fr { + let x2 = self * self + let x4 = x2 * x2 + x4 * self + } +} + +impl Add for Fr { + const fn add(own self, _ other: own Fr) -> Fr { + Fr::new(addmod(self.value, other.value, SNARK_SCALAR_FIELD)) + } +} + +impl Add for Fr { + const fn add(own self, _ other: own u256) -> Fr { + self + Fr::new(other) + } +} + +impl Mul for Fr { + const fn mul(own self, _ other: own Fr) -> Fr { + Fr::new(mulmod(self.value, other.value, SNARK_SCALAR_FIELD)) + } +} + +impl Mul for Fr { + const fn mul(own self, _ other: own u256) -> Fr { + self * Fr::new(other) + } +} + +const fn is_full_round(round: usize, half_full_rounds: usize, partial_rounds: usize) -> bool { + round < half_full_rounds || round >= half_full_rounds + partial_rounds +} + +const fn apply_round_constants3(state: [Fr; 3], round: usize) -> [Fr; 3] { + let constants = POSEIDON_T3_ROUND_CONSTANTS[round] + [state[0] + constants[0], state[1] + constants[1], state[2] + constants[2]] +} + +const fn apply_round_constants6(state: [Fr; 6], round: usize) -> [Fr; 6] { + let constants = POSEIDON_T6_ROUND_CONSTANTS[round] + [ + state[0] + constants[0], + state[1] + constants[1], + state[2] + constants[2], + state[3] + constants[3], + state[4] + constants[4], + state[5] + constants[5], + ] +} + +const fn apply_sbox3(state: [Fr; 3], full_round: bool) -> [Fr; 3] { + if full_round { + return [state[0].pow5(), state[1].pow5(), state[2].pow5()] + } + [state[0].pow5(), state[1], state[2]] +} + +const fn apply_sbox6(state: [Fr; 6], full_round: bool) -> [Fr; 6] { + if full_round { + return [ + state[0].pow5(), + state[1].pow5(), + state[2].pow5(), + state[3].pow5(), + state[4].pow5(), + state[5].pow5(), + ] + } + [state[0].pow5(), state[1], state[2], state[3], state[4], state[5]] +} + +const fn mix3(state: [Fr; 3]) -> [Fr; 3] { + let mut mixed: [Fr; 3] = [Fr::new(0); 3] + let mut row: usize = 0 + while row < 3 { + let mut col: usize = 0 + while col < 3 { + mixed[row] = mixed[row] + state[col] * POSEIDON_T3_MDS[row][col] + col += 1 + } + row += 1 + } + mixed +} + +const fn mix6(state: [Fr; 6]) -> [Fr; 6] { + let mut mixed: [Fr; 6] = [Fr::new(0); 6] + let mut row: usize = 0 + while row < 6 { + let mut col: usize = 0 + while col < 6 { + mixed[row] = mixed[row] + state[col] * POSEIDON_T6_MDS[row][col] + col += 1 + } + row += 1 + } + mixed +} + +const fn permute3(mut _ state: own [Fr; 3]) -> [Fr; 3] { + let mut round: usize = 0 + while round < POSEIDON_T3_ROUNDS { + state = apply_round_constants3(state, round) + state = apply_sbox3( + state, + full_round: is_full_round( + round, + half_full_rounds: POSEIDON_T3_HALF_FULL_ROUNDS, + partial_rounds: POSEIDON_T3_PARTIAL_ROUNDS, + ), + ) + state = mix3(state) + round += 1 + } + state +} + +const fn permute6(mut _ state: own [Fr; 6]) -> [Fr; 6] { + let mut round: usize = 0 + while round < POSEIDON_T6_ROUNDS { + state = apply_round_constants6(state, round) + state = apply_sbox6( + state, + full_round: is_full_round( + round, + half_full_rounds: POSEIDON_T6_HALF_FULL_ROUNDS, + partial_rounds: POSEIDON_T6_PARTIAL_ROUNDS, + ), + ) + state = mix6(state) + round += 1 + } + state +} + +pub const fn hash2(_ left: u256, _ right: u256) -> u256 { + permute3([Fr::new(0), Fr::new(left), Fr::new(right)])[0].value +} + +pub const fn hash5(_ a: u256, _ b: u256, _ c: u256, _ d: u256, _ e: u256) -> u256 { + permute6( + [Fr::new(0), Fr::new(a), Fr::new(b), Fr::new(c), Fr::new(d), Fr::new(e)], + )[0].value +} + +static_assert(hash2(0, 0) == 0x2098f5fb9e239eab3ceac3f27b81e481dc3124d55ffed523a839ee8446b64864) +static_assert(hash2(1, 2) == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a) +static_assert(hash5(0, 0, 0, 0, 0) + == 0x2066be41bebe6caf7e079360abe14fbf9118c62eabc42e2fe75e342b160a95bc) +static_assert(hash5(1, 2, 3, 4, 5) + == 0x0dab9449e4a1398a15224c0b15a49d598b2174d305a316c918125f8feeb123c0) + +#[test] +fn test_const_poseidon_vectors() { + assert( + hash2(0, 0) == 0x2098f5fb9e239eab3ceac3f27b81e481dc3124d55ffed523a839ee8446b64864, + ) + assert( + hash2(1, 2) == 0x115cc0f5e7d690413df64c6b9662e9cf2a3617f2743245519e19607a4417189a, + ) + assert( + hash5(0, 0, 0, 0, 0) == 0x2066be41bebe6caf7e079360abe14fbf9118c62eabc42e2fe75e342b160a95bc, + ) + assert( + hash5(1, 2, 3, 4, 5) == 0x0dab9449e4a1398a15224c0b15a49d598b2174d305a316c918125f8feeb123c0, + ) +} diff --git a/crates/fe/tests/fixtures/fe_test/const_user_op_impl.fe b/crates/fe/tests/fixtures/fe_test/const_user_op_impl.fe new file mode 100644 index 0000000000..f484ebafa2 --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_user_op_impl.fe @@ -0,0 +1,28 @@ +use core::ops::Add +use std::evm::effects::assert + +struct Counter { + value: usize, +} + +impl Copy for Counter {} + +impl Add for Counter { + const fn add(own self, _ other: own Counter) -> Counter { + Counter { value: self.value + other.value + 1 } + } +} + +const fn combine(lhs: Counter, rhs: Counter) -> Counter { + lhs + rhs +} + +const COMBINED: Counter = combine(lhs: Counter { value: 2 }, rhs: Counter { value: 3 }) +const COMBINED_VALUE: usize = COMBINED.value +type CombinedWitness = [u8; COMBINED_VALUE] + +#[test] +fn const_user_op_impl() { + let _witness: CombinedWitness = [0; 6] + assert(COMBINED.value == 6) +} diff --git a/crates/fe/tests/fixtures/fe_test/const_zk_kit_array_builders.fe b/crates/fe/tests/fixtures/fe_test/const_zk_kit_array_builders.fe new file mode 100644 index 0000000000..fb6030fd44 --- /dev/null +++ b/crates/fe/tests/fixtures/fe_test/const_zk_kit_array_builders.fe @@ -0,0 +1,111 @@ +use core::num::IntDowncast +use std::evm::effects::assert + +const MAX_DEPTH: usize = 32 +const QUINARY_ARITY: usize = 5 +const QUINARY_SIBLINGS_PER_LEVEL: usize = 4 +const QUINARY_TEST_MAX_LEAVES: usize = 25 +const QUINARY_EMPTY_SIBLINGS: [[u256; QUINARY_SIBLINGS_PER_LEVEL]; MAX_DEPTH] = [[0; QUINARY_SIBLINGS_PER_LEVEL]; MAX_DEPTH] + +const fn binary_depth2_slots() -> [u256; 4] { + let mut slots: [u256; 4] = [0; 4] + let mut i: usize = 0 + while i < 4 { + slots[i] = (i + 1) as u256 + i += 1 + } + slots +} + +const fn binary_depth2_proof_shape( + slots: [u256; 4], + index: usize, + upper_sibling: u256, +) -> ([u256; MAX_DEPTH], [u8; MAX_DEPTH]) { + let mut siblings: [u256; MAX_DEPTH] = [0; MAX_DEPTH] + let mut indices: [u8; MAX_DEPTH] = [0; MAX_DEPTH] + + if index % 2 == 1 { + siblings[0] = slots[index - 1] + indices[0] = 1 + } else { + siblings[0] = slots[index + 1] + } + + siblings[1] = upper_sibling + if index >= 2 { + indices[1] = 1 + } + + (siblings, indices) +} + +const fn quinary_test_slots(count: usize) -> [u256; QUINARY_TEST_MAX_LEAVES] { + let mut slots: [u256; QUINARY_TEST_MAX_LEAVES] = [0; QUINARY_TEST_MAX_LEAVES] + let mut i: usize = 0 + while i < count { + slots[i] = (i + 1) as u256 + i += 1 + } + slots +} + +const fn quinary_first_level_proof( + slots: [u256; QUINARY_TEST_MAX_LEAVES], + target_index: usize, +) -> ( + [[u256; QUINARY_SIBLINGS_PER_LEVEL]; MAX_DEPTH], + [u8; MAX_DEPTH], +) { + let mut siblings: [[u256; QUINARY_SIBLINGS_PER_LEVEL]; MAX_DEPTH] = QUINARY_EMPTY_SIBLINGS + let mut indices: [u8; MAX_DEPTH] = [0; MAX_DEPTH] + let mut current: [u256; QUINARY_TEST_MAX_LEAVES] = [0; QUINARY_TEST_MAX_LEAVES] + let mut copy_index: usize = 0 + while copy_index < QUINARY_TEST_MAX_LEAVES { + current[copy_index] = slots[copy_index] + copy_index += 1 + } + + let path = target_index % QUINARY_ARITY + indices[0] = path.downcast_unchecked() + let group_start = (target_index / QUINARY_ARITY) * QUINARY_ARITY + let mut sibling_pos: usize = 0 + let mut j: usize = 0 + while j < QUINARY_ARITY { + if j != path { + siblings[0][sibling_pos] = current[group_start + j] + sibling_pos += 1 + } + j += 1 + } + + (siblings, indices) +} + +const BINARY_SLOTS: [u256; 4] = binary_depth2_slots() +const BINARY_PROOF: ([u256; MAX_DEPTH], [u8; MAX_DEPTH]) = binary_depth2_proof_shape(slots: BINARY_SLOTS, index: 2, upper_sibling: 12) +const QUINARY_SLOTS: [u256; QUINARY_TEST_MAX_LEAVES] = quinary_test_slots(count: 6) +const QUINARY_FIRST_LEVEL_PROOF: ([[u256; QUINARY_SIBLINGS_PER_LEVEL]; MAX_DEPTH], [u8; MAX_DEPTH]) = quinary_first_level_proof(slots: QUINARY_SLOTS, target_index: 3) + +#[test] +fn test_const_binary_imt_array_builders() { + let (siblings, indices) = BINARY_PROOF + assert(BINARY_SLOTS[0] == 1) + assert(BINARY_SLOTS[3] == 4) + assert(siblings[0] == 4) + assert(siblings[1] == 12) + assert(indices[0] == 0) + assert(indices[1] == 1) +} + +#[test] +fn test_const_quinary_imt_array_builders() { + let (siblings, indices) = QUINARY_FIRST_LEVEL_PROOF + assert(QUINARY_SLOTS[0] == 1) + assert(QUINARY_SLOTS[5] == 6) + assert(siblings[0][0] == 1) + assert(siblings[0][1] == 2) + assert(siblings[0][2] == 3) + assert(siblings[0][3] == 5) + assert(indices[0] == 3) +} diff --git a/crates/fe/tests/fixtures/fe_test/int_downcast.fe b/crates/fe/tests/fixtures/fe_test/int_downcast.fe index fcb5bdaa63..d11f2948d6 100644 --- a/crates/fe/tests/fixtures/fe_test/int_downcast.fe +++ b/crates/fe/tests/fixtures/fe_test/int_downcast.fe @@ -1,6 +1,43 @@ use core::num::IntDowncast use core::option::Option +const fn const_checked_downcast() -> Option { + let x: u256 = 200 + x.downcast() +} + +const fn const_truncated_downcast() -> u8 { + let x: u256 = 256 + x.downcast_truncate() +} + +const fn const_saturated_downcast() -> u8 { + let x: u256 = 300 + x.downcast_saturate() +} + +const fn const_unchecked_downcast() -> u8 { + let x: u256 = 200 + x.downcast_unchecked() +} + +const fn const_negative_truncated_downcast() -> u8 { + let x: i256 = -1 + x.downcast_truncate() +} + +const fn const_negative_saturated_downcast() -> u8 { + let x: i256 = -1 + x.downcast_saturate() +} + +const CHECKED_DOWNCAST: Option = const_checked_downcast() +const TRUNCATED_DOWNCAST: u8 = const_truncated_downcast() +const SATURATED_DOWNCAST: u8 = const_saturated_downcast() +const UNCHECKED_DOWNCAST: u8 = const_unchecked_downcast() +const NEGATIVE_TRUNCATED_DOWNCAST: u8 = const_negative_truncated_downcast() +const NEGATIVE_SATURATED_DOWNCAST: u8 = const_negative_saturated_downcast() + #[test] fn test_int_downcast() uses (evm: mut Evm) { let x: u256 = 256 @@ -27,3 +64,16 @@ fn test_int_downcast() uses (evm: mut Evm) { let s2: u8 = neg.downcast_saturate() assert(s2 == 0) } + +#[test] +fn test_const_int_downcast() uses (evm: mut Evm) { + match CHECKED_DOWNCAST { + Option::Some(value) => assert(value == 200) + Option::None => assert(false) + } + assert(TRUNCATED_DOWNCAST == 0) + assert(SATURATED_DOWNCAST == 255) + assert(UNCHECKED_DOWNCAST == 200) + assert(NEGATIVE_TRUNCATED_DOWNCAST == 255) + assert(NEGATIVE_SATURATED_DOWNCAST == 0) +} diff --git a/crates/hir/Cargo.toml b/crates/hir/Cargo.toml index 2881579526..6881402dcb 100644 --- a/crates/hir/Cargo.toml +++ b/crates/hir/Cargo.toml @@ -23,6 +23,7 @@ num-bigint.workspace = true num-traits = "0.2.19" paste.workspace = true rustc-hash.workspace = true +ruint = "1.17.2" salsa.workspace = true smallvec.workspace = true smallvec1.workspace = true diff --git a/crates/hir/src/analysis/diagnostics.rs b/crates/hir/src/analysis/diagnostics.rs index 90f45a5ad0..6aceaa7b77 100644 --- a/crates/hir/src/analysis/diagnostics.rs +++ b/crates/hir/src/analysis/diagnostics.rs @@ -4132,38 +4132,6 @@ impl DiagnosticVoucher for BodyDiag<'_> { error_code, ), - BodyDiag::ConstFnLoopNotAllowed(primary) => primary_diag( - severity, - "loops are not allowed in a `const fn`", - "loops are not supported in const evaluation (MVP)", - primary.resolve(db), - error_code, - ), - - BodyDiag::ConstFnAssignmentNotAllowed(primary) => primary_diag( - severity, - "assignment is not allowed in a `const fn`", - "mutation is not supported in const evaluation (MVP)", - primary.resolve(db), - error_code, - ), - - BodyDiag::ConstFnAggregateNotAllowed(primary) => primary_diag( - severity, - "aggregate operations are not allowed in a `const fn`", - "aggregates are not supported in const evaluation (MVP)", - primary.resolve(db), - error_code, - ), - - BodyDiag::ConstFnMutableBindingNotAllowed(primary) => primary_diag( - severity, - "`mut` bindings are not allowed in a `const fn`", - "mutation is not supported in const evaluation (MVP)", - primary.resolve(db), - error_code, - ), - BodyDiag::ConstFnNonConstCall { primary, callee } => { let name = callee .name(db) diff --git a/crates/hir/src/analysis/name_resolution/method_selection.rs b/crates/hir/src/analysis/name_resolution/method_selection.rs index be8bdafd10..fe0c012fb5 100644 --- a/crates/hir/src/analysis/name_resolution/method_selection.rs +++ b/crates/hir/src/analysis/name_resolution/method_selection.rs @@ -55,6 +55,18 @@ impl<'db> TraitMethodCand<'db> { } } +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Update)] +pub struct AmbiguousTraitMethodCand<'db> { + pub cand: TraitMethodCand<'db>, + pub needs_confirmation: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash, salsa::Update)] +pub struct AmbiguousTraitMethods<'db> { + pub candidates: ThinVec>, + pub diagnostic_traits: ThinVec>, +} + pub(crate) fn select_method_candidate<'db>( db: &'db dyn HirAnalysisDb, receiver: &Canonicalized<'db, TyId<'db>>, @@ -345,8 +357,19 @@ impl<'db, 'a> MethodSelector<'db, 'a> { return Ok(MethodCandidate::TraitMethod(confirmed[0])); } + let diagnostic_traits = visible_traits.iter().map(|cand| cand.0).collect(); + let candidates = selected + .into_iter() + .map(|(cand, confirmed)| AmbiguousTraitMethodCand { + cand, + needs_confirmation: !confirmed, + }) + .collect(); Err(MethodSelectionError::AmbiguousTraitMethod( - visible_traits.into_iter().map(|cand| cand.0).collect(), + AmbiguousTraitMethods { + candidates, + diagnostic_traits, + }, )) } } @@ -481,7 +504,7 @@ impl<'db, 'a> MethodSelector<'db, 'a> { #[derive(Debug, Clone, PartialEq, Eq, Hash, salsa::Update)] pub enum MethodSelectionError<'db> { AmbiguousInherentMethod(ThinVec>), - AmbiguousTraitMethod(ThinVec>), + AmbiguousTraitMethod(AmbiguousTraitMethods<'db>), NotFound, InvisibleInherentMethod(CallableDef<'db>), InvisibleTraitMethod(ThinVec>), diff --git a/crates/hir/src/analysis/name_resolution/path_resolver.rs b/crates/hir/src/analysis/name_resolution/path_resolver.rs index 7f8072f80c..92d8494380 100644 --- a/crates/hir/src/analysis/name_resolution/path_resolver.rs +++ b/crates/hir/src/analysis/name_resolution/path_resolver.rs @@ -204,8 +204,11 @@ impl<'db> PathResError<'db> { MethodSelectionError::AmbiguousInherentMethod(cands) => { format!("Ambiguous method; {} inherent candidates.", cands.len()) } - MethodSelectionError::AmbiguousTraitMethod(traits) => { - format!("Ambiguous method; {} trait candidates.", traits.len()) + MethodSelectionError::AmbiguousTraitMethod(ambiguous) => { + format!( + "Ambiguous method; {} trait candidates.", + ambiguous.diagnostic_traits.len() + ) } MethodSelectionError::NotFound => "Method not found".to_string(), MethodSelectionError::InvisibleInherentMethod(_) => { @@ -393,11 +396,11 @@ impl<'db> PathResError<'db> { candidates, } } - MethodSelectionError::AmbiguousTraitMethod(trait_insts) => { + MethodSelectionError::AmbiguousTraitMethod(ambiguous) => { PathResDiag::AmbiguousTrait { primary: span, method_name: ident, - trait_insts, + trait_insts: ambiguous.diagnostic_traits, } } MethodSelectionError::InvisibleInherentMethod(func) => { diff --git a/crates/hir/src/analysis/semantic/borrowck/normalize.rs b/crates/hir/src/analysis/semantic/borrowck/normalize.rs index 052386888d..26ef99efe7 100644 --- a/crates/hir/src/analysis/semantic/borrowck/normalize.rs +++ b/crates/hir/src/analysis/semantic/borrowck/normalize.rs @@ -310,10 +310,10 @@ impl<'db> NormalizeCtxt<'db> { .map(|snapshot_source| self.normalize_snapshot_source(local, snapshot_source)) .transpose()?; let mut root_demand = NLocalRootDemand::default(); - if matches!( - interface, - SemanticLocalKind::PlaceBoundValue | SemanticLocalKind::PlaceCarrier - ) { + if matches!(interface, SemanticLocalKind::PlaceCarrier) + || (matches!(interface, SemanticLocalKind::PlaceBoundValue) + && !matches!(origin, NLocalOrigin::AliasedPlace)) + { root_demand.always_rooted = true; } self.root_demands[local.index()] = root_demand; diff --git a/crates/hir/src/analysis/semantic/ctfe/machine.rs b/crates/hir/src/analysis/semantic/ctfe/machine.rs index 7e1d1c7cbd..dcbebdd303 100644 --- a/crates/hir/src/analysis/semantic/ctfe/machine.rs +++ b/crates/hir/src/analysis/semantic/ctfe/machine.rs @@ -1,7 +1,10 @@ use cranelift_entity::EntityRef; -use num_bigint::BigInt; +use num_bigint::{BigInt, BigUint, Sign}; use num_traits::{One, ToPrimitive, Zero}; +use ruint::aliases::U256; +use rustc_hash::FxHashMap; use salsa::Update; +use std::rc::Rc; use tiny_keccak::{Hasher, Keccak}; use crate::{ @@ -16,24 +19,25 @@ use crate::{ STerminatorKind, SemConstId, SemConstScalar, SemConstValue, SemOrigin, SemanticBody, SemanticConstRef, VariantIndex, array_const, bool_const, bytes_const, enum_const, int_const, int_ty_shape, normalize_int_to_shape, runtime_size_bytes, sem_const_eq, - sem_const_from_ty, struct_const, tuple_const, unit_const, + sem_const_from_ty, sem_const_ty, struct_const, tuple_const, unit_const, }, ty::{ const_expr::{ConstExpr, ConstExprId}, const_ty::{ConstTyData, ConstTyId, EvaluatedConstTy, const_ty_from_sem_const}, - corelib::{PrimitiveWrapperCallKind, core_primitive_wrapper_call_kind}, + corelib::{ + PrimitiveWrapperCallKind, RuntimeBuiltinFuncKind, core_primitive_wrapper_call_kind, + runtime_builtin_func_kind, + }, normalize::normalize_ty, ty_check::{BodyOwner, check_anon_const_body, check_const_body, check_func_body}, ty_def::{PrimTy, TyBase, TyData, TyId}, }, }, core::hir_def::expr::LogicalBinOp, - hir_def::{ArithBinOp, BinOp, CompBinOp, Func, UnOp, attr::ArithmeticMode}, + hir_def::{ArithBinOp, BinOp, CompBinOp, UnOp, attr::ArithmeticMode}, projection::{IndexSource, Projection}, }; -use super::ops::{project_const, store_const}; - #[derive(Clone, Debug, PartialEq, Eq, Hash, Update)] pub struct CtfeConfig { pub step_limit: usize, @@ -43,7 +47,7 @@ pub struct CtfeConfig { impl Default for CtfeConfig { fn default() -> Self { Self { - step_limit: 10_000, + step_limit: 1_000_000, recursion_limit: 64, } } @@ -101,6 +105,32 @@ pub enum CtfeError<'db> { }, } +#[derive(Clone, Copy)] +enum EvmModularArithmetic { + Add, + Mul, +} + +#[derive(Clone, Copy)] +enum NumericExternIntrinsic { + CheckedBinary(ArithBinOp), + WrappingBinary(ArithBinOp), + SaturatingBinary(SaturatingArithmetic), + Comparison(CompBinOp), + BoolBinary(ArithBinOp), + CheckedNeg, + WrappingNeg, + BitNot, + BoolNot, +} + +#[derive(Clone, Copy)] +enum SaturatingArithmetic { + Add, + Sub, + Mul, +} + #[salsa::tracked] pub fn eval_const_instance<'db>( db: &'db dyn HirAnalysisDb, @@ -161,7 +191,9 @@ pub fn eval_body_owner_const_with_args<'db>( let mut machine = CtfeMachine::new(db, CtfeConfig::default()); machine.eval_root( instance, - args.into_iter().map(CtfeValue::concrete).collect(), + args.into_iter() + .map(|arg| CtfeValue::concrete(db, arg)) + .collect(), SemOrigin::Body(owner), ) } @@ -184,11 +216,13 @@ struct CtfeMachine<'db> { db: &'db dyn HirAnalysisDb, config: CtfeConfig, steps: usize, + instance_cache: FxHashMap, SemanticInstance<'db>>, + body_cache: FxHashMap, Rc>>, frames: Vec>, } struct CtfeFrame<'db> { - body: SemanticBody<'db>, + body: Rc>, locals: Vec>, current: usize, } @@ -207,40 +241,607 @@ enum CtfeValue<'db> { #[derive(Clone)] struct CtfeConstValue<'db> { - value: SemConstId<'db>, + kind: CtfeConstKind<'db>, deferred_origin: Option>, } +#[derive(Clone)] +enum CtfeConstKind<'db> { + Interned(SemConstId<'db>), + Unit, + Bool(bool), + Int { + ty: TyId<'db>, + value: CtfeInt, + }, + Bytes { + ty: TyId<'db>, + bytes: Rc<[u8]>, + }, + Tuple { + ty: TyId<'db>, + elems: Rc<[CtfeConstValue<'db>]>, + }, + Struct { + ty: TyId<'db>, + fields: Rc<[CtfeConstValue<'db>]>, + }, + Array { + ty: TyId<'db>, + elems: Rc<[CtfeConstValue<'db>]>, + }, + Enum { + ty: TyId<'db>, + variant: VariantIndex, + fields: Rc<[CtfeConstValue<'db>]>, + }, +} + +#[derive(Clone)] +enum CtfeInt { + Word { bits: u16, signed: bool, word: U256 }, + Big(BigInt), +} + impl<'db> CtfeConstValue<'db> { - fn concrete(value: SemConstId<'db>) -> Self { + fn unit() -> Self { Self { - value, + kind: CtfeConstKind::Unit, + deferred_origin: None, + } + } + + fn bool(value: bool) -> Self { + Self { + kind: CtfeConstKind::Bool(value), + deferred_origin: None, + } + } + + fn int(db: &'db dyn HirAnalysisDb, ty: TyId<'db>, value: BigInt) -> Self { + Self { + kind: CtfeConstKind::Int { + ty, + value: CtfeInt::from_bigint(db, ty, value), + }, + deferred_origin: None, + } + } + + fn int_word(db: &'db dyn HirAnalysisDb, ty: TyId<'db>, word: U256) -> Self { + let value = match int_ty_shape(db, ty) { + Some((bits, signed)) => CtfeInt::from_word(bits, signed, word), + None => CtfeInt::Big(bigint_from_u256(word)), + }; + Self { + kind: CtfeConstKind::Int { ty, value }, + deferred_origin: None, + } + } + + fn bytes(ty: TyId<'db>, bytes: Vec) -> Self { + Self { + kind: CtfeConstKind::Bytes { + ty, + bytes: bytes.into(), + }, + deferred_origin: None, + } + } + + fn tuple(ty: TyId<'db>, elems: Vec>) -> Self { + Self { + kind: CtfeConstKind::Tuple { + ty, + elems: elems.into(), + }, + deferred_origin: None, + } + } + + fn struct_(ty: TyId<'db>, fields: Vec>) -> Self { + Self { + kind: CtfeConstKind::Struct { + ty, + fields: fields.into(), + }, + deferred_origin: None, + } + } + + fn array(ty: TyId<'db>, elems: Vec>) -> Self { + Self { + kind: CtfeConstKind::Array { + ty, + elems: elems.into(), + }, + deferred_origin: None, + } + } + + fn enum_(ty: TyId<'db>, variant: VariantIndex, fields: Vec>) -> Self { + Self { + kind: CtfeConstKind::Enum { + ty, + variant, + fields: fields.into(), + }, + deferred_origin: None, + } + } + + fn concrete(db: &'db dyn HirAnalysisDb, value: SemConstId<'db>) -> Self { + let kind = match value.value(db) { + SemConstValue::Unit => CtfeConstKind::Unit, + SemConstValue::Scalar { + value: SemConstScalar::Bool(value), + .. + } => CtfeConstKind::Bool(value), + SemConstValue::Scalar { + ty, + value: SemConstScalar::Int { value }, + } => CtfeConstKind::Int { + ty, + value: CtfeInt::from_bigint(db, ty, value.clone()), + }, + SemConstValue::Scalar { + ty, + value: SemConstScalar::Bytes(bytes), + } => CtfeConstKind::Bytes { + ty, + bytes: Rc::from(bytes.as_slice()), + }, + SemConstValue::TypeLevel { .. } + | SemConstValue::Tuple { .. } + | SemConstValue::Struct { .. } + | SemConstValue::Array { .. } + | SemConstValue::Enum { .. } => CtfeConstKind::Interned(value), + }; + Self { + kind, + deferred_origin: None, + } + } + + fn expand_sem_const_shallow(db: &'db dyn HirAnalysisDb, value: SemConstId<'db>) -> Self { + let kind = match value.value(db) { + SemConstValue::Unit => CtfeConstKind::Unit, + SemConstValue::Scalar { + value: SemConstScalar::Bool(value), + .. + } => CtfeConstKind::Bool(value), + SemConstValue::Scalar { + ty, + value: SemConstScalar::Int { value }, + } => CtfeConstKind::Int { + ty, + value: CtfeInt::from_bigint(db, ty, value.clone()), + }, + SemConstValue::Scalar { + ty, + value: SemConstScalar::Bytes(bytes), + } => CtfeConstKind::Bytes { + ty, + bytes: Rc::from(bytes.as_slice()), + }, + SemConstValue::TypeLevel { .. } => CtfeConstKind::Interned(value), + SemConstValue::Tuple { ty, elems } => CtfeConstKind::Tuple { + ty, + elems: elems + .iter() + .copied() + .map(|elem| Self::concrete(db, elem)) + .collect::>() + .into(), + }, + SemConstValue::Struct { ty, fields } => CtfeConstKind::Struct { + ty, + fields: fields + .iter() + .copied() + .map(|field| Self::concrete(db, field)) + .collect::>() + .into(), + }, + SemConstValue::Array { ty, elems } => CtfeConstKind::Array { + ty, + elems: elems + .iter() + .copied() + .map(|elem| Self::concrete(db, elem)) + .collect::>() + .into(), + }, + SemConstValue::Enum { + ty, + variant, + fields, + } => CtfeConstKind::Enum { + ty, + variant, + fields: fields + .iter() + .copied() + .map(|field| Self::concrete(db, field)) + .collect::>() + .into(), + }, + }; + Self { + kind, deferred_origin: None, } } fn with_deferred_origin( - value: SemConstId<'db>, + mut self, + db: &'db dyn HirAnalysisDb, deferred_origin: Option>, ) -> Self { - Self { - value, - deferred_origin, - } + self.set_deferred_origin(db, deferred_origin); + self + } + + fn set_deferred_origin( + &mut self, + db: &'db dyn HirAnalysisDb, + deferred_origin: Option>, + ) { + self.deferred_origin = if deferred_origin.is_some() && self.contains_type_level(db) { + deferred_origin + } else { + None + }; } fn error_origin(&self, origin: SemOrigin<'db>) -> SemOrigin<'db> { self.deferred_origin.unwrap_or(origin) } + + fn materialize(&self, db: &'db dyn HirAnalysisDb) -> SemConstId<'db> { + match &self.kind { + CtfeConstKind::Interned(value) => *value, + CtfeConstKind::Unit => unit_const(db), + CtfeConstKind::Bool(value) => bool_const(db, *value), + CtfeConstKind::Int { ty, value } => int_const(db, *ty, value.to_bigint()), + CtfeConstKind::Bytes { ty, bytes } => bytes_const(db, *ty, bytes.to_vec()), + CtfeConstKind::Tuple { ty, elems } => tuple_const( + db, + *ty, + elems + .iter() + .map(|elem| elem.materialize(db)) + .collect::>() + .into_boxed_slice(), + ), + CtfeConstKind::Struct { ty, fields } => struct_const( + db, + *ty, + fields + .iter() + .map(|field| field.materialize(db)) + .collect::>() + .into_boxed_slice(), + ), + CtfeConstKind::Array { ty, elems } => array_const( + db, + *ty, + elems + .iter() + .map(|elem| elem.materialize(db)) + .collect::>() + .into_boxed_slice(), + ), + CtfeConstKind::Enum { + ty, + variant, + fields, + } => enum_const( + db, + *ty, + *variant, + fields + .iter() + .map(|field| field.materialize(db)) + .collect::>() + .into_boxed_slice(), + ), + } + } + + fn ty(&self, db: &'db dyn HirAnalysisDb) -> TyId<'db> { + match &self.kind { + CtfeConstKind::Interned(value) => sem_const_ty(db, *value), + CtfeConstKind::Unit => TyId::unit(db), + CtfeConstKind::Bool(_) => TyId::bool(db), + CtfeConstKind::Int { ty, .. } + | CtfeConstKind::Bytes { ty, .. } + | CtfeConstKind::Tuple { ty, .. } + | CtfeConstKind::Struct { ty, .. } + | CtfeConstKind::Array { ty, .. } + | CtfeConstKind::Enum { ty, .. } => *ty, + } + } + + fn is_scalar(&self, db: &'db dyn HirAnalysisDb) -> bool { + match &self.kind { + CtfeConstKind::Bool(_) | CtfeConstKind::Int { .. } | CtfeConstKind::Bytes { .. } => { + true + } + CtfeConstKind::Interned(value) => { + matches!(value.value(db), SemConstValue::Scalar { .. }) + } + CtfeConstKind::Unit + | CtfeConstKind::Tuple { .. } + | CtfeConstKind::Struct { .. } + | CtfeConstKind::Array { .. } + | CtfeConstKind::Enum { .. } => false, + } + } + + fn contains_type_level(&self, db: &'db dyn HirAnalysisDb) -> bool { + match &self.kind { + CtfeConstKind::Interned(value) => sem_const_contains_type_level(db, *value), + CtfeConstKind::Tuple { elems, .. } | CtfeConstKind::Array { elems, .. } => { + elems.iter().any(|elem| elem.contains_type_level(db)) + } + CtfeConstKind::Struct { fields, .. } | CtfeConstKind::Enum { fields, .. } => { + fields.iter().any(|field| field.contains_type_level(db)) + } + CtfeConstKind::Unit + | CtfeConstKind::Bool(_) + | CtfeConstKind::Int { .. } + | CtfeConstKind::Bytes { .. } => false, + } + } +} + +impl CtfeInt { + fn from_bigint<'db>(db: &'db dyn HirAnalysisDb, ty: TyId<'db>, value: BigInt) -> Self { + let Some((bits, signed)) = int_ty_shape(db, ty) else { + return Self::Big(value); + }; + let value = normalize_int_to_shape(value, bits, false); + Self::Word { + bits, + signed, + word: u256_from_bigint(&value), + } + } + + fn from_word(bits: u16, signed: bool, word: U256) -> Self { + let word = if bits == 0 { + U256::ZERO + } else if bits < 256 { + word & ((U256::from(1u8) << usize::from(bits)) - U256::from(1u8)) + } else { + word + }; + Self::Word { bits, signed, word } + } + + fn to_bigint(&self) -> BigInt { + match self { + CtfeInt::Word { bits, signed, word } => { + let unsigned = bigint_from_u256(*word); + if *signed && *bits > 0 { + let sign_bit = BigInt::one() << usize::from(bits - 1); + if unsigned >= sign_bit { + return unsigned - (BigInt::one() << usize::from(*bits)); + } + } + unsigned + } + CtfeInt::Big(value) => value.clone(), + } + } + + fn to_u256(&self) -> U256 { + match self { + CtfeInt::Word { word, .. } => *word, + CtfeInt::Big(value) => { + u256_from_bigint(&normalize_int_to_shape(value.clone(), 256, false)) + } + } + } +} + +fn u256_from_bigint(value: &BigInt) -> U256 { + let (_, bytes) = value.to_bytes_be(); + let mut out = [0u8; 32]; + let bytes = if bytes.len() > out.len() { + &bytes[bytes.len() - out.len()..] + } else { + &bytes + }; + let offset = out.len() - bytes.len(); + out[offset..].copy_from_slice(bytes); + U256::from_be_bytes(out) +} + +fn biguint_from_u256(value: U256) -> BigUint { + BigUint::from_bytes_be(&value.to_be_bytes::<32>()) +} + +fn bigint_from_u256(value: U256) -> BigInt { + BigInt::from_bytes_be(Sign::Plus, &value.to_be_bytes::<32>()) +} + +fn signed_word_is_negative(bits: u16, word: U256) -> bool { + bits > 0 && word.bit(usize::from(bits - 1)) +} + +fn sign_extend_word(bits: u16, word: U256) -> U256 { + if bits == 0 || bits == 256 || !signed_word_is_negative(bits, word) { + word + } else { + word | (U256::MAX << usize::from(bits)) + } +} + +fn wrapping_shift_word(bits: u16, signed: bool, lhs: U256, rhs: U256, left: bool) -> U256 { + if rhs >= U256::from(256u16) { + if left || !signed || !signed_word_is_negative(bits, lhs) { + U256::ZERO + } else { + U256::MAX + } + } else if left { + lhs.wrapping_shl(rhs.wrapping_to::()) + } else if signed { + sign_extend_word(bits, lhs).arithmetic_shr(rhs.wrapping_to::()) + } else { + lhs.wrapping_shr(rhs.wrapping_to::()) + } +} + +fn expect_binary_args<'a, 'db>( + args: &'a [CtfeConstValue<'db>], + origin: SemOrigin<'db>, +) -> Result<(&'a CtfeConstValue<'db>, &'a CtfeConstValue<'db>), CtfeError<'db>> { + let [lhs, rhs] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + Ok((lhs, rhs)) +} + +fn checked_result<'db>( + value: BigInt, + machine: &CtfeMachine<'db>, + result_ty: TyId<'db>, + origin: SemOrigin<'db>, +) -> Result> { + if !machine.int_in_range(result_ty, &value) { + return Err(CtfeError::ArithmeticOverflow { origin }); + } + Ok(value) +} + +fn int_bounds(bits: u16, signed: bool) -> (BigInt, BigInt) { + if signed { + let half = BigInt::one() << (usize::from(bits) - 1); + (-half.clone(), half - BigInt::one()) + } else { + ( + BigInt::zero(), + (BigInt::one() << usize::from(bits)) - BigInt::one(), + ) + } +} + +fn numeric_extern_intrinsic(name: &str) -> Option { + Some(match name { + "__checked_add" => NumericExternIntrinsic::CheckedBinary(ArithBinOp::Add), + "__checked_sub" => NumericExternIntrinsic::CheckedBinary(ArithBinOp::Sub), + "__checked_mul" => NumericExternIntrinsic::CheckedBinary(ArithBinOp::Mul), + "__checked_div" => NumericExternIntrinsic::CheckedBinary(ArithBinOp::Div), + "__checked_rem" => NumericExternIntrinsic::CheckedBinary(ArithBinOp::Rem), + "__checked_pow" => NumericExternIntrinsic::CheckedBinary(ArithBinOp::Pow), + "__checked_neg" => NumericExternIntrinsic::CheckedNeg, + "__saturating_add" => NumericExternIntrinsic::SaturatingBinary(SaturatingArithmetic::Add), + "__saturating_sub" => NumericExternIntrinsic::SaturatingBinary(SaturatingArithmetic::Sub), + "__saturating_mul" => NumericExternIntrinsic::SaturatingBinary(SaturatingArithmetic::Mul), + "__not_bool" => NumericExternIntrinsic::BoolNot, + "__bitand_bool" => NumericExternIntrinsic::BoolBinary(ArithBinOp::BitAnd), + "__bitor_bool" => NumericExternIntrinsic::BoolBinary(ArithBinOp::BitOr), + "__bitxor_bool" => NumericExternIntrinsic::BoolBinary(ArithBinOp::BitXor), + "__eq_bool" => NumericExternIntrinsic::Comparison(CompBinOp::Eq), + "__ne_bool" => NumericExternIntrinsic::Comparison(CompBinOp::NotEq), + _ => { + let suffix = |prefix| { + name.strip_prefix(prefix) + .filter(|suffix| has_integer_numeric_suffix(suffix)) + }; + if suffix("__add_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::Add) + } else if suffix("__sub_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::Sub) + } else if suffix("__mul_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::Mul) + } else if suffix("__div_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::Div) + } else if suffix("__rem_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::Rem) + } else if suffix("__pow_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::Pow) + } else if suffix("__shl_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::LShift) + } else if suffix("__shr_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::RShift) + } else if suffix("__bitand_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::BitAnd) + } else if suffix("__bitor_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::BitOr) + } else if suffix("__bitxor_").is_some() { + NumericExternIntrinsic::WrappingBinary(ArithBinOp::BitXor) + } else if suffix("__eq_").is_some() { + NumericExternIntrinsic::Comparison(CompBinOp::Eq) + } else if suffix("__ne_").is_some() { + NumericExternIntrinsic::Comparison(CompBinOp::NotEq) + } else if suffix("__lt_").is_some() { + NumericExternIntrinsic::Comparison(CompBinOp::Lt) + } else if suffix("__le_").is_some() { + NumericExternIntrinsic::Comparison(CompBinOp::LtEq) + } else if suffix("__gt_").is_some() { + NumericExternIntrinsic::Comparison(CompBinOp::Gt) + } else if suffix("__ge_").is_some() { + NumericExternIntrinsic::Comparison(CompBinOp::GtEq) + } else if suffix("__neg_").is_some() { + NumericExternIntrinsic::WrappingNeg + } else if suffix("__bitnot_").is_some() { + NumericExternIntrinsic::BitNot + } else { + return None; + } + } + }) +} + +fn has_integer_numeric_suffix(suffix: &str) -> bool { + matches!( + suffix, + "u8" | "u16" + | "u32" + | "u64" + | "u128" + | "u256" + | "usize" + | "i8" + | "i16" + | "i32" + | "i64" + | "i128" + | "i256" + | "isize" + ) +} + +fn sem_const_contains_type_level<'db>(db: &'db dyn HirAnalysisDb, value: SemConstId<'db>) -> bool { + match value.value(db) { + SemConstValue::TypeLevel { .. } => true, + SemConstValue::Tuple { elems, .. } | SemConstValue::Array { elems, .. } => elems + .iter() + .copied() + .any(|elem| sem_const_contains_type_level(db, elem)), + SemConstValue::Struct { fields, .. } | SemConstValue::Enum { fields, .. } => fields + .iter() + .copied() + .any(|field| sem_const_contains_type_level(db, field)), + SemConstValue::Unit | SemConstValue::Scalar { .. } => false, + } } impl<'db> CtfeValue<'db> { - fn concrete(value: SemConstId<'db>) -> Self { - Self::Value(CtfeConstValue::concrete(value)) + fn concrete(db: &'db dyn HirAnalysisDb, value: SemConstId<'db>) -> Self { + Self::Value(CtfeConstValue::concrete(db, value)) } - fn deferred(value: SemConstId<'db>, origin: SemOrigin<'db>) -> Self { - Self::Value(CtfeConstValue::with_deferred_origin(value, Some(origin))) + fn deferred( + db: &'db dyn HirAnalysisDb, + value: SemConstId<'db>, + origin: SemOrigin<'db>, + ) -> Self { + Self::Value(CtfeConstValue::concrete(db, value).with_deferred_origin(db, Some(origin))) } } @@ -261,22 +862,37 @@ pub(super) enum CtfePathElem { Index(usize), } -#[derive(Clone, Copy)] -enum CtfePrimitiveCall { - Unary(UnOp), - Binary(BinOp), -} - impl<'db> CtfeMachine<'db> { fn new(db: &'db dyn HirAnalysisDb, config: CtfeConfig) -> Self { Self { db, config, steps: 0, + instance_cache: FxHashMap::default(), + body_cache: FxHashMap::default(), frames: Vec::new(), } } + fn instance_for_key(&mut self, key: SemanticInstanceKey<'db>) -> SemanticInstance<'db> { + if let Some(instance) = self.instance_cache.get(&key).copied() { + return instance; + } + let instance = SemanticInstance::new(self.db, key); + self.instance_cache.insert(key, instance); + instance + } + + fn body_for_instance(&mut self, instance: SemanticInstance<'db>) -> Rc> { + let key = instance.key(self.db); + if let Some(body) = self.body_cache.get(&key) { + return body.clone(); + } + let body = Rc::new(instance.body(self.db)); + self.body_cache.insert(key, body.clone()); + body + } + fn eval_root( &mut self, instance: SemanticInstance<'db>, @@ -287,7 +903,7 @@ impl<'db> CtfeMachine<'db> { let CtfeValue::Value(value) = value else { return Err(CtfeError::InvalidBorrow { origin }); }; - Ok(value.value) + Ok(value.materialize(self.db)) } fn eval_expr_with_locals( @@ -298,13 +914,13 @@ impl<'db> CtfeMachine<'db> { locals: &[Option>], origin: SemOrigin<'db>, ) -> Result, CtfeError<'db>> { - let body = instance.body(self.db); + let body = self.body_for_instance(instance); let mut frame_locals = vec![CtfeSlot::Uninit; body.locals.len()]; for (idx, value) in locals.iter().copied().enumerate() { if let Some(value) = value && let Some(slot) = frame_locals.get_mut(idx) { - *slot = CtfeSlot::Init(CtfeValue::concrete(value)); + *slot = CtfeSlot::Init(CtfeValue::concrete(self.db, value)); } } let frame_idx = self.frames.len(); @@ -314,7 +930,7 @@ impl<'db> CtfeMachine<'db> { current: 0, }); let result = match self.eval_expr(frame_idx, result_ty, expr, origin)? { - CtfeValue::Value(value) => Ok(value.value), + CtfeValue::Value(value) => Ok(value.materialize(self.db)), CtfeValue::Ref(_) => Err(CtfeError::InvalidBorrow { origin }), }; self.frames.pop(); @@ -332,7 +948,7 @@ impl<'db> CtfeMachine<'db> { return Err(CtfeError::RecursionLimitExceeded { origin }); } - let body = instance.body(self.db); + let body = self.body_for_instance(instance); let mut locals = vec![CtfeSlot::Uninit; body.locals.len()]; for (idx, arg) in args.into_iter().enumerate() { let Some(slot) = locals.get_mut(idx) else { @@ -434,7 +1050,7 @@ impl<'db> CtfeMachine<'db> { return self.read_operand(frame_idx, value, term_origin); } STerminatorKind::Return(None) => { - return Ok(CtfeValue::concrete(unit_const(self.db))); + return Ok(CtfeValue::Value(CtfeConstValue::unit())); } } } @@ -472,9 +1088,9 @@ impl<'db> CtfeMachine<'db> { self.read_operand(frame_idx, value, origin) } SExpr::CodeRegionRef { .. } => Err(CtfeError::NotConstEvaluable { origin }), - SExpr::Const(SConst::Value(value)) => Ok(CtfeValue::concrete(value)), + SExpr::Const(SConst::Value(value)) => Ok(CtfeValue::concrete(self.db, value)), SExpr::Const(SConst::Ref(cref)) => eval_const_ref(self.db, cref) - .map(CtfeValue::concrete) + .map(|value| CtfeValue::concrete(self.db, value)) .map_err(|err| CtfeError::CalleeError { origin: cref.origin(self.db), callee: SemanticInstance::new(self.db, cref.instance(self.db)), @@ -510,15 +1126,8 @@ impl<'db> CtfeMachine<'db> { variant, fields, .. } => { let fields = self.eval_value_args(frame_idx, &fields, origin)?; - Ok(CtfeValue::concrete(enum_const( - self.db, - result_ty, - variant, - fields - .into_iter() - .map(|field| field.value) - .collect::>() - .into_boxed_slice(), + Ok(CtfeValue::Value(CtfeConstValue::enum_( + result_ty, variant, fields, ))) } SExpr::ReadPlace { place } => { @@ -562,7 +1171,7 @@ impl<'db> CtfeMachine<'db> { SExpr::GetEnumTag { value } => { let value = self.load_value(frame_idx, value, origin)?; let variant = self.load_enum_variant(value, origin)?; - Ok(CtfeValue::concrete(int_const( + Ok(CtfeValue::Value(CtfeConstValue::int( self.db, result_ty, BigInt::from(variant.0), @@ -571,7 +1180,7 @@ impl<'db> CtfeMachine<'db> { SExpr::IsEnumVariant { value, variant } => { let value = self.load_value(frame_idx, value, origin)?; let actual = self.load_enum_variant(value, origin)?; - Ok(CtfeValue::concrete(bool_const(self.db, actual == variant))) + Ok(CtfeValue::Value(CtfeConstValue::bool(actual == variant))) } SExpr::ExtractEnumField { value, @@ -595,11 +1204,11 @@ impl<'db> CtfeMachine<'db> { .eval_args(frame_idx, &args, origin)? .into_iter() .collect::>(); - let instance = SemanticInstance::new(self.db, callee.key); - if let Some(value) = - self.try_eval_primitive_call(frame_idx, instance, result_ty, &args, origin)? - { - return Ok(CtfeValue::concrete(value)); + let instance = self.instance_for_key(callee.key); + if let Some(value) = self.try_eval_core_primitive_wrapper_call( + frame_idx, instance, result_ty, &args, origin, + )? { + return Ok(CtfeValue::Value(value)); } if let BodyOwner::Func(func) = instance.key(self.db).owner(self.db) && func.is_extern(self.db) @@ -608,39 +1217,47 @@ impl<'db> CtfeMachine<'db> { return Err(CtfeError::NonConstCall { origin }); } let deferred_origin = self.first_deferred_origin(&args).unwrap_or(origin); - let value_args = self.materialize_args(args, origin)?; + let value_args = self.value_args(args, origin)?; return match self.eval_extern_const_fn( + frame_idx, instance, func, result_ty, &value_args, origin, ) { - Ok(value) => Ok(CtfeValue::concrete(value)), - Err(CtfeError::NotConstEvaluable { .. }) => Ok(CtfeValue::deferred( - self.abstract_const_call( - ConstExpr::ExternConstFnCall { - func, - generic_args: instance - .key(self.db) - .subst(self.db) - .generic_args(self.db) - .clone(), - args: value_args - .iter() - .copied() - .map(|arg| { - TyId::const_ty( - self.db, - const_ty_from_sem_const(self.db, arg), - ) - }) - .collect(), - }, - result_ty, - ), - deferred_origin, - )), + Ok(value) => Ok(CtfeValue::Value(value)), + Err(CtfeError::NotConstEvaluable { .. }) => { + let materialized_args = value_args + .iter() + .map(|arg| arg.materialize(self.db)) + .collect::>(); + Ok(CtfeValue::deferred( + self.db, + self.abstract_const_call( + ConstExpr::ExternConstFnCall { + func, + generic_args: instance + .key(self.db) + .subst(self.db) + .generic_args(self.db) + .clone(), + args: materialized_args + .iter() + .copied() + .map(|arg| { + TyId::const_ty( + self.db, + const_ty_from_sem_const(self.db, arg), + ) + }) + .collect(), + }, + result_ty, + ), + deferred_origin, + )) + } Err(err) => Err(err), }; } @@ -659,6 +1276,7 @@ impl<'db> CtfeMachine<'db> { let deferred_origin = self.first_deferred_origin(&args).unwrap_or(origin); let value_args = self.materialize_args(args, origin)?; Ok(CtfeValue::deferred( + self.db, self.abstract_const_call( ConstExpr::UserConstFnCall { func, @@ -701,153 +1319,105 @@ impl<'db> CtfeMachine<'db> { } } - fn try_eval_primitive_call( - &self, + fn try_eval_core_primitive_wrapper_call( + &mut self, frame_idx: usize, instance: SemanticInstance<'db>, result_ty: TyId<'db>, args: &[CtfeValue<'db>], origin: SemOrigin<'db>, - ) -> Result>, CtfeError<'db>> { + ) -> Result>, CtfeError<'db>> { let BodyOwner::Func(func) = instance.key(self.db).owner(self.db) else { return Ok(None); }; - let Some(call) = self.primitive_call_kind(func, result_ty) else { + let Some(call) = core_primitive_wrapper_call_kind(self.db, func, result_ty) else { return Ok(None); }; - let value_args = self.materialize_args(args.to_vec(), origin)?; - if !value_args - .iter() - .all(|arg| matches!(arg.value(self.db), SemConstValue::Scalar { .. })) - { + if let PrimitiveWrapperCallKind::Assign(op) = call { + return self.try_eval_core_primitive_assign(frame_idx, op, args, origin); + } + + let value_args = self.value_args(args.to_vec(), origin)?; + if !value_args.iter().all(|arg| arg.is_scalar(self.db)) { return Ok(None); } let value = match call { - CtfePrimitiveCall::Unary(op) => { + PrimitiveWrapperCallKind::Unary(op) => { let [value] = value_args.as_slice() else { return Ok(None); }; - let CtfeValue::Value(value) = self.eval_unary( - frame_idx, - result_ty, - op, - CtfeConstValue::concrete(*value), - origin, - )? + let CtfeValue::Value(value) = + self.eval_unary(frame_idx, result_ty, op, value.clone(), origin)? else { return Err(CtfeError::InvalidBorrow { origin }); }; value } - CtfePrimitiveCall::Binary(op) => { + PrimitiveWrapperCallKind::Binary(op) => { let [lhs, rhs] = value_args.as_slice() else { return Ok(None); }; - let CtfeValue::Value(value) = self.eval_binary( - frame_idx, - result_ty, - op, - CtfeConstValue::concrete(*lhs), - CtfeConstValue::concrete(*rhs), - origin, - )? + let CtfeValue::Value(value) = + self.eval_binary(frame_idx, result_ty, op, lhs.clone(), rhs.clone(), origin)? else { return Err(CtfeError::InvalidBorrow { origin }); }; value } + PrimitiveWrapperCallKind::Assign(_) => unreachable!(), }; - Ok(Some(value.value)) + Ok(Some(value)) } - fn primitive_call_kind( - &self, - func: Func<'db>, - result_ty: TyId<'db>, - ) -> Option { - if func.is_extern(self.db) { - return self.extern_primitive_call_kind(func); - } - self.core_ops_wrapper_call_kind(func, result_ty) - } - - fn extern_primitive_call_kind(&self, func: Func<'db>) -> Option { - fn has_numeric_suffix(name: &str) -> bool { - matches!( - name, - "u8" | "u16" - | "u32" - | "u64" - | "u128" - | "u256" - | "usize" - | "i8" - | "i16" - | "i32" - | "i64" - | "i128" - | "i256" - | "isize" - ) + fn try_eval_core_primitive_assign( + &mut self, + frame_idx: usize, + op: BinOp, + args: &[CtfeValue<'db>], + origin: SemOrigin<'db>, + ) -> Result>, CtfeError<'db>> { + let [dst, rhs] = args else { + return Ok(None); + }; + let CtfeValue::Ref(dst_ref) = dst else { + return Ok(None); + }; + let lhs = self.load_ref_value(dst_ref, origin)?; + let rhs = match rhs { + CtfeValue::Value(value) => value.clone(), + CtfeValue::Ref(r#ref) => self.load_ref_value(r#ref, origin)?, + }; + if !lhs.is_scalar(self.db) || !rhs.is_scalar(self.db) { + return Ok(None); } - - let name = func.name(self.db).to_opt()?.data(self.db); - Some(match name.as_str() { - "__checked_add" => CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::Add)), - "__checked_sub" => CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::Sub)), - "__checked_mul" => CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::Mul)), - "__checked_div" => CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::Div)), - "__checked_rem" => CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::Rem)), - "__checked_pow" => CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::Pow)), - "__checked_neg" => CtfePrimitiveCall::Unary(UnOp::Minus), - "__not_bool" => CtfePrimitiveCall::Unary(UnOp::Not), - _ => { - let suffix = |prefix| { - name.strip_prefix(prefix) - .filter(|suffix| has_numeric_suffix(suffix)) - }; - if suffix("__shl_").is_some() { - CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::LShift)) - } else if suffix("__shr_").is_some() { - CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::RShift)) - } else if suffix("__bitand_").is_some() || name == "__bitand_bool" { - CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::BitAnd)) - } else if suffix("__bitor_").is_some() || name == "__bitor_bool" { - CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::BitOr)) - } else if suffix("__bitxor_").is_some() || name == "__bitxor_bool" { - CtfePrimitiveCall::Binary(BinOp::Arith(ArithBinOp::BitXor)) - } else if suffix("__eq_").is_some() || name == "__eq_bool" { - CtfePrimitiveCall::Binary(BinOp::Comp(CompBinOp::Eq)) - } else if suffix("__ne_").is_some() || name == "__ne_bool" { - CtfePrimitiveCall::Binary(BinOp::Comp(CompBinOp::NotEq)) - } else if suffix("__lt_").is_some() { - CtfePrimitiveCall::Binary(BinOp::Comp(CompBinOp::Lt)) - } else if suffix("__le_").is_some() { - CtfePrimitiveCall::Binary(BinOp::Comp(CompBinOp::LtEq)) - } else if suffix("__gt_").is_some() { - CtfePrimitiveCall::Binary(BinOp::Comp(CompBinOp::Gt)) - } else if suffix("__ge_").is_some() { - CtfePrimitiveCall::Binary(BinOp::Comp(CompBinOp::GtEq)) - } else if suffix("__bitnot_").is_some() { - CtfePrimitiveCall::Unary(UnOp::BitNot) - } else { - return None; - } - } - }) + let ty = lhs.ty(self.db); + let CtfeValue::Value(value) = self.eval_binary(frame_idx, ty, op, lhs, rhs, origin)? else { + return Err(CtfeError::InvalidBorrow { origin }); + }; + self.store_place( + ResolvedPlace { + frame: dst_ref.frame, + root: dst_ref.root, + path: dst_ref.path.clone().into_vec(), + }, + value, + origin, + )?; + Ok(Some(CtfeConstValue::unit())) } - fn core_ops_wrapper_call_kind( + fn value_args( &self, - func: Func<'db>, - result_ty: TyId<'db>, - ) -> Option { - match core_primitive_wrapper_call_kind(self.db, func, result_ty)? { - PrimitiveWrapperCallKind::Unary(op) => Some(CtfePrimitiveCall::Unary(op)), - PrimitiveWrapperCallKind::Binary(op) => Some(CtfePrimitiveCall::Binary(op)), - PrimitiveWrapperCallKind::Assign(_) => None, - } + args: Vec>, + origin: SemOrigin<'db>, + ) -> Result>, CtfeError<'db>> { + args.into_iter() + .map(|arg| match arg { + CtfeValue::Value(value) => Ok(value), + CtfeValue::Ref(r#ref) => self.load_ref_value(&r#ref, origin), + }) + .collect() } fn materialize_args( @@ -857,7 +1427,7 @@ impl<'db> CtfeMachine<'db> { ) -> Result>, CtfeError<'db>> { args.into_iter() .map(|arg| match arg { - CtfeValue::Value(value) => Ok(value.value), + CtfeValue::Value(value) => Ok(value.materialize(self.db)), CtfeValue::Ref(r#ref) => self.load_ref(&r#ref, origin), }) .collect() @@ -872,12 +1442,33 @@ impl<'db> CtfeMachine<'db> { fn eval_extern_const_fn( &self, + frame_idx: usize, instance: SemanticInstance<'db>, func: crate::hir_def::Func<'db>, result_ty: TyId<'db>, - args: &[SemConstId<'db>], + args: &[CtfeConstValue<'db>], origin: SemOrigin<'db>, - ) -> Result, CtfeError<'db>> { + ) -> Result, CtfeError<'db>> { + match runtime_builtin_func_kind(self.db, func) { + Some(RuntimeBuiltinFuncKind::AddMod) => { + return self.eval_evm_modular_arithmetic( + result_ty, + args, + EvmModularArithmetic::Add, + origin, + ); + } + Some(RuntimeBuiltinFuncKind::MulMod) => { + return self.eval_evm_modular_arithmetic( + result_ty, + args, + EvmModularArithmetic::Mul, + origin, + ); + } + _ => {} + } + let Some(name) = func.name(self.db).to_opt() else { return Err(CtfeError::NotConstEvaluable { origin }); }; @@ -886,17 +1477,443 @@ impl<'db> CtfeMachine<'db> { "size_of" => self.eval_intrinsic_size_of(instance, result_ty, args, origin), "__as_bytes" => self.eval_intrinsic_as_bytes(result_ty, args, origin), "__keccak256" => self.eval_intrinsic_keccak(result_ty, args, origin), + "__bitcast" => self.eval_intrinsic_bitcast(result_ty, args, origin), + name => self.eval_numeric_extern_intrinsic(frame_idx, name, result_ty, args, origin), + } + } + + fn eval_numeric_extern_intrinsic( + &self, + frame_idx: usize, + name: &str, + result_ty: TyId<'db>, + args: &[CtfeConstValue<'db>], + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + let Some(kind) = numeric_extern_intrinsic(name) else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + + match kind { + NumericExternIntrinsic::CheckedBinary(op) => { + let (lhs, rhs) = expect_binary_args(args, origin)?; + if self.is_type_level(lhs) || self.is_type_level(rhs) { + let CtfeValue::Value(value) = self.eval_binary( + frame_idx, + result_ty, + BinOp::Arith(op), + lhs.clone(), + rhs.clone(), + origin, + )? + else { + return Err(CtfeError::InvalidBorrow { origin }); + }; + return Ok(value); + } + self.eval_checked_numeric_binary( + frame_idx, + result_ty, + op, + lhs.clone(), + rhs.clone(), + origin, + ) + } + NumericExternIntrinsic::WrappingBinary(op) => { + let (lhs, rhs) = expect_binary_args(args, origin)?; + if self.is_type_level(lhs) || self.is_type_level(rhs) { + let CtfeValue::Value(value) = self.eval_binary( + frame_idx, + result_ty, + BinOp::Arith(op), + lhs.clone(), + rhs.clone(), + origin, + )? + else { + return Err(CtfeError::InvalidBorrow { origin }); + }; + return Ok(value); + } + self.eval_wrapping_numeric_binary( + frame_idx, + result_ty, + op, + lhs.clone(), + rhs.clone(), + origin, + ) + } + NumericExternIntrinsic::SaturatingBinary(op) => { + let (lhs, rhs) = expect_binary_args(args, origin)?; + if self.is_type_level(lhs) || self.is_type_level(rhs) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + self.eval_saturating_numeric_binary( + frame_idx, + result_ty, + op, + lhs.clone(), + rhs.clone(), + origin, + ) + } + NumericExternIntrinsic::Comparison(op) => { + let (lhs, rhs) = expect_binary_args(args, origin)?; + if self.is_type_level(lhs) || self.is_type_level(rhs) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + let CtfeValue::Value(value) = + self.eval_compare(frame_idx, op, lhs.clone(), rhs.clone(), origin)? + else { + return Err(CtfeError::InvalidBorrow { origin }); + }; + Ok(value) + } + NumericExternIntrinsic::BoolBinary(op) => { + let (lhs, rhs) = expect_binary_args(args, origin)?; + if self.is_type_level(lhs) || self.is_type_level(rhs) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + let lhs = self.expect_bool(frame_idx, lhs.clone(), origin)?; + let rhs = self.expect_bool(frame_idx, rhs.clone(), origin)?; + let value = match op { + ArithBinOp::BitAnd => lhs & rhs, + ArithBinOp::BitOr => lhs | rhs, + ArithBinOp::BitXor => lhs ^ rhs, + _ => return Err(CtfeError::NotConstEvaluable { origin }), + }; + Ok(CtfeConstValue::bool(value)) + } + NumericExternIntrinsic::CheckedNeg => { + let [value] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + if self.is_type_level(value) { + let CtfeValue::Value(value) = + self.eval_unary(frame_idx, result_ty, UnOp::Minus, value.clone(), origin)? + else { + return Err(CtfeError::InvalidBorrow { origin }); + }; + return Ok(value); + } + let value = -self.expect_int(frame_idx, value.clone(), origin)?; + if !self.int_in_range(result_ty, &value) { + return Err(CtfeError::ArithmeticOverflow { origin }); + } + Ok(CtfeConstValue::int(self.db, result_ty, value)) + } + NumericExternIntrinsic::WrappingNeg => { + let [value] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + if self.is_type_level(value) { + let CtfeValue::Value(value) = + self.eval_unary(frame_idx, result_ty, UnOp::Minus, value.clone(), origin)? + else { + return Err(CtfeError::InvalidBorrow { origin }); + }; + return Ok(value); + } + if let Some(word) = self.expect_matching_int_word(value, result_ty, origin)? { + return Ok(CtfeConstValue::int_word( + self.db, + result_ty, + word.wrapping_neg(), + )); + } + Ok(CtfeConstValue::int( + self.db, + result_ty, + -self.expect_int(frame_idx, value.clone(), origin)?, + )) + } + NumericExternIntrinsic::BitNot => { + let [value] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + if self.is_type_level(value) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + if let Some(word) = self.expect_matching_int_word(value, result_ty, origin)? { + return Ok(CtfeConstValue::int_word(self.db, result_ty, word.not())); + } + let value = self.expect_int(frame_idx, value.clone(), origin)?; + Ok(CtfeConstValue::int( + self.db, + result_ty, + -value - BigInt::one(), + )) + } + NumericExternIntrinsic::BoolNot => { + let [value] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + if self.is_type_level(value) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + Ok(CtfeConstValue::bool(!self.expect_bool( + frame_idx, + value.clone(), + origin, + )?)) + } + } + } + + fn eval_checked_numeric_binary( + &self, + frame_idx: usize, + result_ty: TyId<'db>, + op: ArithBinOp, + lhs: CtfeConstValue<'db>, + rhs: CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + let lhs = self.expect_int(frame_idx, lhs, origin)?; + let rhs = self.expect_int(frame_idx, rhs, origin)?; + let value = match op { + ArithBinOp::Add => checked_result(lhs + rhs, self, result_ty, origin)?, + ArithBinOp::Sub => checked_result(lhs - rhs, self, result_ty, origin)?, + ArithBinOp::Mul => checked_result(lhs * rhs, self, result_ty, origin)?, + ArithBinOp::Div => { + if rhs.is_zero() { + return Err(CtfeError::DivisionByZero { origin }); + } + if self.signed_div_overflows(result_ty, &lhs, &rhs) { + return Err(CtfeError::ArithmeticOverflow { origin }); + } + lhs / rhs + } + ArithBinOp::Rem => { + if rhs.is_zero() { + return Err(CtfeError::DivisionByZero { origin }); + } + lhs % rhs + } + ArithBinOp::Pow => self.checked_pow(result_ty, lhs, rhs, origin)?, + ArithBinOp::Range + | ArithBinOp::LShift + | ArithBinOp::RShift + | ArithBinOp::BitAnd + | ArithBinOp::BitOr + | ArithBinOp::BitXor => { + return Err(CtfeError::NotConstEvaluable { origin }); + } + }; + Ok(CtfeConstValue::int(self.db, result_ty, value)) + } + + fn eval_wrapping_numeric_binary( + &self, + frame_idx: usize, + result_ty: TyId<'db>, + op: ArithBinOp, + lhs: CtfeConstValue<'db>, + rhs: CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + if let Some(value) = + self.eval_wrapping_numeric_binary_word(result_ty, op, &lhs, &rhs, origin)? + { + return Ok(value); + } + let lhs = self.expect_int(frame_idx, lhs, origin)?; + let rhs = self.expect_int(frame_idx, rhs, origin)?; + let value = match op { + ArithBinOp::Add => lhs + rhs, + ArithBinOp::Sub => lhs - rhs, + ArithBinOp::Mul => lhs * rhs, + ArithBinOp::Div => { + if rhs.is_zero() { + BigInt::zero() + } else { + lhs / rhs + } + } + ArithBinOp::Rem => { + if rhs.is_zero() { + BigInt::zero() + } else { + lhs % rhs + } + } + ArithBinOp::Pow => self.wrapping_pow(result_ty, &lhs, &rhs, origin)?, + ArithBinOp::LShift => self.wrapping_shift(result_ty, lhs, rhs, true, origin)?, + ArithBinOp::RShift => self.wrapping_shift(result_ty, lhs, rhs, false, origin)?, + ArithBinOp::BitAnd => self.bitwise(result_ty, lhs, rhs, |lhs, rhs| lhs & rhs)?, + ArithBinOp::BitOr => self.bitwise(result_ty, lhs, rhs, |lhs, rhs| lhs | rhs)?, + ArithBinOp::BitXor => self.bitwise(result_ty, lhs, rhs, |lhs, rhs| lhs ^ rhs)?, + ArithBinOp::Range => return Err(CtfeError::NotConstEvaluable { origin }), + }; + Ok(CtfeConstValue::int(self.db, result_ty, value)) + } + + fn eval_wrapping_numeric_binary_word( + &self, + result_ty: TyId<'db>, + op: ArithBinOp, + lhs: &CtfeConstValue<'db>, + rhs: &CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Result>, CtfeError<'db>> { + let Some((bits, signed)) = int_ty_shape(self.db, result_ty) else { + return Ok(None); + }; + let Some(lhs) = self.expect_matching_int_word(lhs, result_ty, origin)? else { + return Ok(None); + }; + let Some(rhs) = self.expect_matching_int_word(rhs, result_ty, origin)? else { + return Ok(None); + }; + let value = match op { + ArithBinOp::Add => lhs.wrapping_add(rhs), + ArithBinOp::Sub => lhs.wrapping_sub(rhs), + ArithBinOp::Mul => lhs.wrapping_mul(rhs), + ArithBinOp::Div if !signed => { + if rhs.is_zero() { + U256::ZERO + } else { + lhs.wrapping_div(rhs) + } + } + ArithBinOp::Rem if !signed => { + if rhs.is_zero() { + U256::ZERO + } else { + lhs.wrapping_rem(rhs) + } + } + ArithBinOp::Pow => lhs.wrapping_pow(rhs), + ArithBinOp::LShift => wrapping_shift_word(bits, signed, lhs, rhs, true), + ArithBinOp::RShift => wrapping_shift_word(bits, signed, lhs, rhs, false), + ArithBinOp::BitAnd => lhs & rhs, + ArithBinOp::BitOr => lhs | rhs, + ArithBinOp::BitXor => lhs ^ rhs, + ArithBinOp::Div | ArithBinOp::Rem => return Ok(None), + ArithBinOp::Range => return Err(CtfeError::NotConstEvaluable { origin }), + }; + Ok(Some(CtfeConstValue::int_word(self.db, result_ty, value))) + } + + fn eval_saturating_numeric_binary( + &self, + frame_idx: usize, + result_ty: TyId<'db>, + op: SaturatingArithmetic, + lhs: CtfeConstValue<'db>, + rhs: CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + let lhs = self.expect_int(frame_idx, lhs, origin)?; + let rhs = self.expect_int(frame_idx, rhs, origin)?; + let value = match op { + SaturatingArithmetic::Add => lhs + rhs, + SaturatingArithmetic::Sub => lhs - rhs, + SaturatingArithmetic::Mul => lhs * rhs, + }; + let Some((bits, signed)) = int_ty_shape(self.db, result_ty) else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + let (min, max) = int_bounds(bits, signed); + Ok(CtfeConstValue::int( + self.db, + result_ty, + value.clamp(min, max), + )) + } + + fn eval_evm_modular_arithmetic( + &self, + result_ty: TyId<'db>, + args: &[CtfeConstValue<'db>], + op: EvmModularArithmetic, + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + if result_ty != TyId::u256(self.db) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + let [lhs, rhs, modulus] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + let lhs = self.expect_u256_const(lhs, origin)?; + let rhs = self.expect_u256_const(rhs, origin)?; + let modulus = self.expect_u256_const(modulus, origin)?; + if modulus.is_zero() { + return Ok(CtfeConstValue::int_word(self.db, result_ty, U256::ZERO)); + } + let value = match op { + EvmModularArithmetic::Add => lhs.add_mod(rhs, modulus), + EvmModularArithmetic::Mul => lhs.mul_mod(rhs, modulus), + }; + Ok(CtfeConstValue::int_word(self.db, result_ty, value)) + } + + fn expect_u256_const( + &self, + value: &CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Result> { + if value.ty(self.db) != TyId::u256(self.db) { + return Err(CtfeError::NotConstEvaluable { origin }); + } + match &value.kind { + CtfeConstKind::Int { value, .. } => Ok(value.to_u256()), + CtfeConstKind::Interned(value) => { + let SemConstValue::Scalar { + value: SemConstScalar::Int { value }, + .. + } = value.value(self.db) + else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + Ok(u256_from_bigint(&normalize_int_to_shape( + value.clone(), + 256, + false, + ))) + } _ => Err(CtfeError::NotConstEvaluable { origin }), } } + fn eval_intrinsic_bitcast( + &self, + result_ty: TyId<'db>, + args: &[CtfeConstValue<'db>], + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + let [value] = args else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + if int_ty_shape(self.db, result_ty).is_none() { + return Err(CtfeError::NotConstEvaluable { origin }); + } + let value = match &value.kind { + CtfeConstKind::Int { value, .. } => value.to_bigint(), + CtfeConstKind::Interned(value) => { + let SemConstValue::Scalar { + value: SemConstScalar::Int { value }, + .. + } = value.value(self.db) + else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + value.clone() + } + _ => return Err(CtfeError::NotConstEvaluable { origin }), + }; + Ok(CtfeConstValue::int(self.db, result_ty, value)) + } + fn eval_intrinsic_size_of( &self, instance: SemanticInstance<'db>, result_ty: TyId<'db>, - args: &[SemConstId<'db>], + args: &[CtfeConstValue<'db>], origin: SemOrigin<'db>, - ) -> Result, CtfeError<'db>> { + ) -> Result, CtfeError<'db>> { if !args.is_empty() { return Err(CtfeError::NotConstEvaluable { origin }); } @@ -917,7 +1934,7 @@ impl<'db> CtfeMachine<'db> { ); let size = runtime_size_bytes(self.db, ty).ok_or(CtfeError::NotConstEvaluable { origin })?; - Ok(int_const(self.db, result_ty, BigInt::from(size))) + Ok(CtfeConstValue::int(self.db, result_ty, BigInt::from(size))) } fn abstract_const_call(&self, expr: ConstExpr<'db>, result_ty: TyId<'db>) -> SemConstId<'db> { @@ -937,42 +1954,42 @@ impl<'db> CtfeMachine<'db> { fn eval_intrinsic_as_bytes( &self, result_ty: TyId<'db>, - args: &[SemConstId<'db>], + args: &[CtfeConstValue<'db>], origin: SemOrigin<'db>, - ) -> Result, CtfeError<'db>> { + ) -> Result, CtfeError<'db>> { if !is_u8_array_ty(self.db, result_ty) { return Err(CtfeError::NotConstEvaluable { origin }); } let [value] = args else { return Err(CtfeError::NotConstEvaluable { origin }); }; - let bytes = self.const_as_bytes(*value, origin)?; + let bytes = self.const_as_bytes(value, origin)?; if let Some(len) = array_len(self.db, result_ty) && bytes.len() != len { return Err(CtfeError::NotConstEvaluable { origin }); } - Ok(bytes_const(self.db, result_ty, bytes)) + Ok(CtfeConstValue::bytes(result_ty, bytes)) } fn eval_intrinsic_keccak( &self, result_ty: TyId<'db>, - args: &[SemConstId<'db>], + args: &[CtfeConstValue<'db>], origin: SemOrigin<'db>, - ) -> Result, CtfeError<'db>> { + ) -> Result, CtfeError<'db>> { let [value] = args else { return Err(CtfeError::NotConstEvaluable { origin }); }; - let bytes = self.const_as_bytes(*value, origin)?; + let bytes = self.const_as_bytes(value, origin)?; let mut hasher = Keccak::v256(); hasher.update(&bytes); let mut out = [0u8; 32]; hasher.finalize(&mut out); - Ok(int_const( + Ok(CtfeConstValue::int_word( self.db, result_ty, - BigInt::from_bytes_be(num_bigint::Sign::Plus, &out), + U256::from_be_bytes(out), )) } @@ -1098,7 +2115,7 @@ impl<'db> CtfeMachine<'db> { r#ref: &CtfeRef, origin: SemOrigin<'db>, ) -> Result, CtfeError<'db>> { - Ok(self.load_ref_value(r#ref, origin)?.value) + Ok(self.load_ref_value(r#ref, origin)?.materialize(self.db)) } fn load_ref_value( @@ -1121,15 +2138,28 @@ impl<'db> CtfeMachine<'db> { value: CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Result<(), CtfeError<'db>> { - let root = match self.frames[place.frame].locals.get(place.root.index()) { - Some(CtfeSlot::Init(CtfeValue::Value(value))) => value.clone(), - _ => return Err(CtfeError::InvalidBorrow { origin }), + let mut root = { + let slot = self + .frames + .get_mut(place.frame) + .and_then(|frame| frame.locals.get_mut(place.root.index())) + .ok_or(CtfeError::InvalidBorrow { origin })?; + match std::mem::replace(slot, CtfeSlot::Uninit) { + CtfeSlot::Init(CtfeValue::Value(value)) => value, + other => { + *slot = other; + return Err(CtfeError::InvalidBorrow { origin }); + } + } }; - let updated = store_const(self.db, root.value, &place.path, value.value, origin)?; - self.frames[place.frame].locals[place.root.index()] = CtfeSlot::Init(CtfeValue::Value( - self.value_with_origin(updated, value.deferred_origin.or(root.deferred_origin)), - )); - Ok(()) + let deferred_origin = value.deferred_origin.or(root.deferred_origin); + let result = self.store_const_value_in_place(&mut root, &place.path, value, origin); + if result.is_ok() { + root.set_deferred_origin(self.db, root.deferred_origin.or(deferred_origin)); + } + self.frames[place.frame].locals[place.root.index()] = + CtfeSlot::Init(CtfeValue::Value(root)); + result } fn project_field( @@ -1157,25 +2187,26 @@ impl<'db> CtfeMachine<'db> { field: FieldIndex, origin: SemOrigin<'db>, ) -> Result, CtfeError<'db>> { - let SemConstValue::Enum { + let value = self.expand_interned(value); + let CtfeConstKind::Enum { variant: actual, fields, .. - } = value.value.value(self.db) + } = &value.kind else { return Err(CtfeError::VariantMismatch { origin: value.error_origin(origin), }); }; - if actual != variant { + if *actual != variant { return Err(CtfeError::VariantMismatch { origin: value.error_origin(origin), }); } fields .get(field.0 as usize) - .copied() - .map(CtfeConstValue::concrete) + .cloned() + .map(|field| self.value_with_origin(field, value.deferred_origin)) .ok_or(CtfeError::OutOfBounds { origin: value.error_origin(origin), }) @@ -1186,7 +2217,8 @@ impl<'db> CtfeMachine<'db> { value: CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Result> { - let SemConstValue::Enum { variant, .. } = value.value.value(self.db) else { + let value = self.expand_interned(value); + let CtfeConstKind::Enum { variant, .. } = value.kind else { return Err(CtfeError::VariantMismatch { origin: value.error_origin(origin), }); @@ -1200,45 +2232,52 @@ impl<'db> CtfeMachine<'db> { value: CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Result> { - match value.value.value(self.db) { - SemConstValue::Scalar { - value: SemConstScalar::Bool(value), - .. - } => Ok(value), - SemConstValue::TypeLevel { ty, const_ty } if ty == TyId::bool(self.db) => { - let TyData::ConstTy(const_ty) = const_ty.data(self.db) else { - return Err(CtfeError::InvalidOperation { - origin: value.error_origin(origin), - message: format!("expected bool, got {:?}", value.value.value(self.db)), - }); - }; - let mut const_ty = const_ty.evaluate(self.db, Some(ty)); - if matches!(const_ty.data(self.db), ConstTyData::Abstract(..)) { - let subst = self.frames[frame_idx] - .body - .owner - .key(self.db) - .subst(self.db); - let instantiated = instantiate_with_generic_args( - self.db, - TyId::const_ty(self.db, const_ty), - subst.generic_args(self.db), - ); - let TyData::ConstTy(instantiated) = instantiated.data(self.db) else { - unreachable!("instantiating a const ty must yield a const ty"); + match &value.kind { + CtfeConstKind::Bool(value) => Ok(*value), + CtfeConstKind::Interned(interned) => match interned.value(self.db) { + SemConstValue::Scalar { + value: SemConstScalar::Bool(value), + .. + } => Ok(value), + SemConstValue::TypeLevel { ty, const_ty } if ty == TyId::bool(self.db) => { + let TyData::ConstTy(const_ty) = const_ty.data(self.db) else { + return Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: format!("expected bool, got {:?}", interned.value(self.db)), + }); + }; + let mut const_ty = const_ty.evaluate(self.db, Some(ty)); + if matches!(const_ty.data(self.db), ConstTyData::Abstract(..)) { + let subst = self.frames[frame_idx] + .body + .owner + .key(self.db) + .subst(self.db); + let instantiated = instantiate_with_generic_args( + self.db, + TyId::const_ty(self.db, const_ty), + subst.generic_args(self.db), + ); + let TyData::ConstTy(instantiated) = instantiated.data(self.db) else { + unreachable!("instantiating a const ty must yield a const ty"); + }; + const_ty = instantiated.evaluate(self.db, Some(ty)); + } + let ConstTyData::Evaluated(EvaluatedConstTy::LitBool(value), _) = + const_ty.data(self.db) + else { + return Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "expected bool".into(), + }); }; - const_ty = instantiated.evaluate(self.db, Some(ty)); + Ok(*value) } - let ConstTyData::Evaluated(EvaluatedConstTy::LitBool(value), _) = - const_ty.data(self.db) - else { - return Err(CtfeError::InvalidOperation { - origin: value.error_origin(origin), - message: "expected bool".into(), - }); - }; - Ok(*value) - } + _ => Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "expected bool".into(), + }), + }, _ => Err(CtfeError::InvalidOperation { origin: value.error_origin(origin), message: "expected bool".into(), @@ -1247,23 +2286,31 @@ impl<'db> CtfeMachine<'db> { } fn is_bool_like(&self, value: &CtfeConstValue<'db>) -> bool { - match value.value.value(self.db) { - SemConstValue::Scalar { - value: SemConstScalar::Bool(_), - .. - } => true, - SemConstValue::TypeLevel { ty, .. } => ty == TyId::bool(self.db), + match &value.kind { + CtfeConstKind::Bool(_) => true, + CtfeConstKind::Interned(value) => match value.value(self.db) { + SemConstValue::Scalar { + value: SemConstScalar::Bool(_), + .. + } => true, + SemConstValue::TypeLevel { ty, .. } => ty == TyId::bool(self.db), + _ => false, + }, _ => false, } } fn is_int_like(&self, value: &CtfeConstValue<'db>) -> bool { - match value.value.value(self.db) { - SemConstValue::Scalar { - value: SemConstScalar::Int { .. }, - .. - } => true, - SemConstValue::TypeLevel { ty, .. } => int_ty_shape(self.db, ty).is_some(), + match &value.kind { + CtfeConstKind::Int { .. } => true, + CtfeConstKind::Interned(value) => match value.value(self.db) { + SemConstValue::Scalar { + value: SemConstScalar::Int { .. }, + .. + } => true, + SemConstValue::TypeLevel { ty, .. } => int_ty_shape(self.db, ty).is_some(), + _ => false, + }, _ => false, } } @@ -1274,45 +2321,96 @@ impl<'db> CtfeMachine<'db> { value: CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Result> { - match value.value.value(self.db) { - SemConstValue::Scalar { - value: SemConstScalar::Int { value }, - .. - } => Ok(value.clone()), - SemConstValue::TypeLevel { ty, const_ty } => { - let TyData::ConstTy(const_ty) = const_ty.data(self.db) else { - return Err(CtfeError::InvalidOperation { - origin: value.error_origin(origin), - message: format!("expected int, got {:?}", value.value.value(self.db)), - }); - }; - let mut const_ty = const_ty.evaluate(self.db, Some(ty)); - if matches!(const_ty.data(self.db), ConstTyData::Abstract(..)) { - let subst = self.frames[frame_idx] - .body - .owner - .key(self.db) - .subst(self.db); - let instantiated = instantiate_with_generic_args( - self.db, - TyId::const_ty(self.db, const_ty), - subst.generic_args(self.db), - ); - let TyData::ConstTy(instantiated) = instantiated.data(self.db) else { - unreachable!("instantiating a const ty must yield a const ty"); + match &value.kind { + CtfeConstKind::Int { value, .. } => Ok(value.to_bigint()), + CtfeConstKind::Interned(interned) => match interned.value(self.db) { + SemConstValue::Scalar { + value: SemConstScalar::Int { value }, + .. + } => Ok(value.clone()), + SemConstValue::TypeLevel { ty, const_ty } => { + let TyData::ConstTy(const_ty) = const_ty.data(self.db) else { + return Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: format!("expected int, got {:?}", interned.value(self.db)), + }); + }; + let mut const_ty = const_ty.evaluate(self.db, Some(ty)); + if matches!(const_ty.data(self.db), ConstTyData::Abstract(..)) { + let subst = self.frames[frame_idx] + .body + .owner + .key(self.db) + .subst(self.db); + let instantiated = instantiate_with_generic_args( + self.db, + TyId::const_ty(self.db, const_ty), + subst.generic_args(self.db), + ); + let TyData::ConstTy(instantiated) = instantiated.data(self.db) else { + unreachable!("instantiating a const ty must yield a const ty"); + }; + const_ty = instantiated.evaluate(self.db, Some(ty)); + } + let ConstTyData::Evaluated(EvaluatedConstTy::LitInt(int_id), _) = + const_ty.data(self.db) + else { + return Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "expected int".into(), + }); }; - const_ty = instantiated.evaluate(self.db, Some(ty)); + Ok(BigInt::from(int_id.data(self.db).clone())) } - let ConstTyData::Evaluated(EvaluatedConstTy::LitInt(int_id), _) = - const_ty.data(self.db) - else { - return Err(CtfeError::InvalidOperation { - origin: value.error_origin(origin), - message: "expected int".into(), - }); - }; - Ok(BigInt::from(int_id.data(self.db).clone())) - } + _ => Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "expected int".into(), + }), + }, + _ => Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "expected int".into(), + }), + } + } + + fn expect_matching_int_word( + &self, + value: &CtfeConstValue<'db>, + result_ty: TyId<'db>, + origin: SemOrigin<'db>, + ) -> Result, CtfeError<'db>> { + let Some((bits, signed)) = int_ty_shape(self.db, result_ty) else { + return Ok(None); + }; + match &value.kind { + CtfeConstKind::Int { + value: + CtfeInt::Word { + bits: value_bits, + signed: value_signed, + word, + }, + .. + } if (*value_bits, *value_signed) == (bits, signed) => Ok(Some(*word)), + CtfeConstKind::Int { .. } => Ok(None), + CtfeConstKind::Interned(interned) => match interned.value(self.db) { + SemConstValue::Scalar { + ty, + value: SemConstScalar::Int { value }, + } if int_ty_shape(self.db, ty) == Some((bits, signed)) => Ok(Some( + u256_from_bigint(&normalize_int_to_shape(value.clone(), bits, false)), + )), + SemConstValue::Scalar { + value: SemConstScalar::Int { .. }, + .. + } + | SemConstValue::TypeLevel { .. } => Ok(None), + _ => Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "expected int".into(), + }), + }, _ => Err(CtfeError::InvalidOperation { origin: value.error_origin(origin), message: "expected int".into(), @@ -1344,12 +2442,27 @@ impl<'db> CtfeMachine<'db> { match op { UnOp::Plus => Ok(CtfeValue::Value(value)), UnOp::Minus => { - let value = self.expect_int(frame_idx, value, origin)?; - let value = match self.frames[frame_idx] + if self.is_type_level(&value) + && let Some(value) = + self.eval_type_level_unary(result_ty, op, value.clone(), origin) + { + return Ok(CtfeValue::Value(value)); + } + let arithmetic_mode = self.frames[frame_idx] .body .template_owner - .arithmetic_mode(self.db) + .arithmetic_mode(self.db); + if arithmetic_mode == ArithmeticMode::Unchecked + && let Some(word) = self.expect_matching_int_word(&value, result_ty, origin)? { + return Ok(CtfeValue::Value(CtfeConstValue::int_word( + self.db, + result_ty, + word.wrapping_neg(), + ))); + } + let value = self.expect_int(frame_idx, value, origin)?; + let value = match arithmetic_mode { ArithmeticMode::Checked => { let value = -value; if !self.int_in_range(result_ty, &value) { @@ -1359,15 +2472,23 @@ impl<'db> CtfeMachine<'db> { } ArithmeticMode::Unchecked => -value, }; - Ok(CtfeValue::concrete(int_const(self.db, result_ty, value))) + Ok(CtfeValue::Value(CtfeConstValue::int( + self.db, result_ty, value, + ))) } - UnOp::Not => Ok(CtfeValue::concrete(bool_const( - self.db, + UnOp::Not => Ok(CtfeValue::Value(CtfeConstValue::bool( !self.expect_bool(frame_idx, value, origin)?, ))), UnOp::BitNot => { + if let Some(word) = self.expect_matching_int_word(&value, result_ty, origin)? { + return Ok(CtfeValue::Value(CtfeConstValue::int_word( + self.db, + result_ty, + word.not(), + ))); + } let int = self.expect_int(frame_idx, value, origin)?; - Ok(CtfeValue::concrete(int_const( + Ok(CtfeValue::Value(CtfeConstValue::int( self.db, result_ty, -int - BigInt::one(), @@ -1398,7 +2519,7 @@ impl<'db> CtfeMachine<'db> { LogicalBinOp::And => lhs && rhs, LogicalBinOp::Or => lhs || rhs, }; - Ok(CtfeValue::concrete(bool_const(self.db, value))) + Ok(CtfeValue::Value(CtfeConstValue::bool(value))) } BinOp::Index => Err(CtfeError::InvalidOperation { origin, @@ -1406,8 +2527,7 @@ impl<'db> CtfeMachine<'db> { }), BinOp::Arith(ArithBinOp::Range) => Err(CtfeError::NotConstEvaluable { origin }), BinOp::Arith(arith) => { - if (matches!(lhs.value.value(self.db), SemConstValue::TypeLevel { .. }) - || matches!(rhs.value.value(self.db), SemConstValue::TypeLevel { .. })) + if (self.is_type_level(&lhs) || self.is_type_level(&rhs)) && let Some(value) = self.eval_type_level_binary( result_ty, arith, @@ -1420,18 +2540,15 @@ impl<'db> CtfeMachine<'db> { } if self.is_bool_like(&lhs) && self.is_bool_like(&rhs) { return match arith { - ArithBinOp::BitAnd => Ok(CtfeValue::concrete(bool_const( - self.db, + ArithBinOp::BitAnd => Ok(CtfeValue::Value(CtfeConstValue::bool( self.expect_bool(frame_idx, lhs, origin)? & self.expect_bool(frame_idx, rhs, origin)?, ))), - ArithBinOp::BitOr => Ok(CtfeValue::concrete(bool_const( - self.db, + ArithBinOp::BitOr => Ok(CtfeValue::Value(CtfeConstValue::bool( self.expect_bool(frame_idx, lhs, origin)? | self.expect_bool(frame_idx, rhs, origin)?, ))), - ArithBinOp::BitXor => Ok(CtfeValue::concrete(bool_const( - self.db, + ArithBinOp::BitXor => Ok(CtfeValue::Value(CtfeConstValue::bool( self.expect_bool(frame_idx, lhs, origin)? ^ self.expect_bool(frame_idx, rhs, origin)?, ))), @@ -1551,7 +2668,9 @@ impl<'db> CtfeMachine<'db> { } ArithBinOp::Range => unreachable!(), }; - Ok(CtfeValue::concrete(int_const(self.db, result_ty, value))) + Ok(CtfeValue::Value(CtfeConstValue::int( + self.db, result_ty, value, + ))) } } } @@ -1588,8 +2707,12 @@ impl<'db> CtfeMachine<'db> { } } else { match op { - CompBinOp::Eq => sem_const_eq(self.db, lhs.value, rhs.value), - CompBinOp::NotEq => !sem_const_eq(self.db, lhs.value, rhs.value), + CompBinOp::Eq => { + sem_const_eq(self.db, lhs.materialize(self.db), rhs.materialize(self.db)) + } + CompBinOp::NotEq => { + !sem_const_eq(self.db, lhs.materialize(self.db), rhs.materialize(self.db)) + } CompBinOp::Lt => { self.expect_int(frame_idx, lhs, origin)? < self.expect_int(frame_idx, rhs, origin)? @@ -1608,7 +2731,27 @@ impl<'db> CtfeMachine<'db> { } } }; - Ok(CtfeValue::concrete(bool_const(self.db, result))) + Ok(CtfeValue::Value(CtfeConstValue::bool(result))) + } + + fn eval_type_level_unary( + &self, + result_ty: TyId<'db>, + op: UnOp, + value: CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Option> { + let const_value = value.materialize(self.db); + let const_ty = TyId::const_ty(self.db, const_ty_from_sem_const(self.db, const_value)); + let expr = ConstExprId::new(self.db, ConstExpr::UnOp { op, expr: const_ty }); + let const_ty = ConstTyId::new(self.db, ConstTyData::Abstract(expr, result_ty)) + .evaluate(self.db, Some(result_ty)); + sem_const_from_ty(self.db, TyId::const_ty(self.db, const_ty)).map(|const_value| { + self.value_with_origin( + CtfeConstValue::concrete(self.db, const_value), + value.deferred_origin.or(Some(origin)), + ) + }) } fn eval_type_level_binary( @@ -1619,8 +2762,10 @@ impl<'db> CtfeMachine<'db> { rhs: CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Option> { - let lhs_ty = TyId::const_ty(self.db, const_ty_from_sem_const(self.db, lhs.value)); - let rhs_ty = TyId::const_ty(self.db, const_ty_from_sem_const(self.db, rhs.value)); + let lhs_value = lhs.materialize(self.db); + let rhs_value = rhs.materialize(self.db); + let lhs_ty = TyId::const_ty(self.db, const_ty_from_sem_const(self.db, lhs_value)); + let rhs_ty = TyId::const_ty(self.db, const_ty_from_sem_const(self.db, rhs_value)); let expr = ConstExprId::new( self.db, ConstExpr::ArithBinOp { @@ -1633,12 +2778,115 @@ impl<'db> CtfeMachine<'db> { .evaluate(self.db, Some(result_ty)); sem_const_from_ty(self.db, TyId::const_ty(self.db, const_ty)).map(|value| { self.value_with_origin( - value, + CtfeConstValue::concrete(self.db, value), lhs.deferred_origin.or(rhs.deferred_origin).or(Some(origin)), ) }) } + fn signed_div_overflows(&self, result_ty: TyId<'db>, lhs: &BigInt, rhs: &BigInt) -> bool { + if let Some((bits, true)) = int_ty_shape(self.db, result_ty) { + lhs == &-(BigInt::one() << (usize::from(bits) - 1)) && rhs == &-BigInt::one() + } else { + false + } + } + + fn checked_pow( + &self, + result_ty: TyId<'db>, + lhs: BigInt, + rhs: BigInt, + origin: SemOrigin<'db>, + ) -> Result> { + if rhs.sign() == num_bigint::Sign::Minus { + return Err(CtfeError::NegativeExponent { origin }); + } + let Some(mut exp) = rhs.to_biguint() else { + return Err(CtfeError::NegativeExponent { origin }); + }; + let mut acc = BigInt::one(); + let mut base = lhs; + while !exp.is_zero() { + if (&exp & BigUint::one()) == BigUint::one() { + acc *= base.clone(); + if !self.int_in_range(result_ty, &acc) { + return Err(CtfeError::ArithmeticOverflow { origin }); + } + } + exp >>= 1usize; + if exp.is_zero() { + break; + } + base = base.clone() * base; + if !self.int_in_range(result_ty, &base) { + return Err(CtfeError::ArithmeticOverflow { origin }); + } + } + Ok(acc) + } + + fn wrapping_pow( + &self, + result_ty: TyId<'db>, + lhs: &BigInt, + rhs: &BigInt, + origin: SemOrigin<'db>, + ) -> Result> { + let Some((bits, _)) = int_ty_shape(self.db, result_ty) else { + return Err(CtfeError::NotConstEvaluable { origin }); + }; + if bits == 0 { + return Ok(BigInt::zero()); + } + let modulus = BigUint::one() << usize::from(bits); + let base = biguint_from_u256(u256_from_bigint(&normalize_int_to_shape( + lhs.clone(), + bits, + false, + ))); + let exp = biguint_from_u256(u256_from_bigint(&normalize_int_to_shape( + rhs.clone(), + bits, + false, + ))); + Ok(BigInt::from_biguint( + Sign::Plus, + base.modpow(&exp, &modulus), + )) + } + + fn wrapping_shift( + &self, + result_ty: TyId<'db>, + lhs: BigInt, + rhs: BigInt, + left: bool, + origin: SemOrigin<'db>, + ) -> Result> { + let Some((bits, signed)) = int_ty_shape(self.db, result_ty) else { + let Some(shift) = rhs.to_usize() else { + return Err(CtfeError::InvalidOperation { + origin, + message: "invalid shift amount".into(), + }); + }; + return Ok(if left { lhs << shift } else { lhs >> shift }); + }; + let shift_word = u256_from_bigint(&normalize_int_to_shape(rhs, bits, false)); + if shift_word >= U256::from(256u16) { + return Ok(if left || !signed || lhs.sign() != Sign::Minus { + BigInt::zero() + } else { + -BigInt::one() + }); + } + let shift = bigint_from_u256(shift_word) + .to_usize() + .expect("shift amount below 256 fits usize"); + Ok(if left { lhs << shift } else { lhs >> shift }) + } + fn bitwise( &self, result_ty: TyId<'db>, @@ -1674,36 +2922,28 @@ impl<'db> CtfeMachine<'db> { value: CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Result, CtfeError<'db>> { - match value.value.value(self.db) { - SemConstValue::Scalar { - value: SemConstScalar::Bool(value), - .. - } if int_ty_shape(self.db, result_ty).is_some() => Ok(CtfeValue::concrete(int_const( - self.db, - result_ty, - if value { BigInt::one() } else { BigInt::zero() }, - ))), - SemConstValue::Scalar { - value: SemConstScalar::Int { value }, - .. - } if result_ty == TyId::bool(self.db) => { - Ok(CtfeValue::concrete(bool_const(self.db, !value.is_zero()))) + let value = self.expand_interned(value); + match &value.kind { + CtfeConstKind::Bool(value) if int_ty_shape(self.db, result_ty).is_some() => { + Ok(CtfeValue::Value(CtfeConstValue::int( + self.db, + result_ty, + if *value { + BigInt::one() + } else { + BigInt::zero() + }, + ))) } - SemConstValue::Scalar { - value: SemConstScalar::Int { value }, - .. - } if int_ty_shape(self.db, result_ty).is_some() => Ok(CtfeValue::concrete(int_const( - self.db, - result_ty, - value.clone(), - ))), - SemConstValue::Scalar { - value: SemConstScalar::Bytes(bytes), - .. - } => Ok(CtfeValue::concrete(bytes_const( - self.db, + CtfeConstKind::Int { value, .. } if result_ty == TyId::bool(self.db) => Ok( + CtfeValue::Value(CtfeConstValue::bool(!value.to_bigint().is_zero())), + ), + CtfeConstKind::Int { value, .. } if int_ty_shape(self.db, result_ty).is_some() => Ok( + CtfeValue::Value(CtfeConstValue::int(self.db, result_ty, value.to_bigint())), + ), + CtfeConstKind::Bytes { bytes, .. } => Ok(CtfeValue::Value(CtfeConstValue::bytes( result_ty, - bytes.clone(), + bytes.to_vec(), ))), _ => Err(CtfeError::InvalidOperation { origin: value.error_origin(origin), @@ -1718,17 +2958,12 @@ impl<'db> CtfeMachine<'db> { fields: Vec>, ) -> CtfeValue<'db> { let deferred_origin = fields.iter().find_map(|field| field.deferred_origin); - let fields = fields - .into_iter() - .map(|field| field.value) - .collect::>() - .into_boxed_slice(); let value = if result_ty.is_tuple(self.db) { - tuple_const(self.db, result_ty, fields) + CtfeConstValue::tuple(result_ty, fields) } else if result_ty.is_array(self.db) { - array_const(self.db, result_ty, fields) + CtfeConstValue::array(result_ty, fields) } else { - struct_const(self.db, result_ty, fields) + CtfeConstValue::struct_(result_ty, fields) }; CtfeValue::Value(self.value_with_origin(value, deferred_origin)) } @@ -1739,43 +2974,198 @@ impl<'db> CtfeMachine<'db> { path: &[CtfePathElem], origin: SemOrigin<'db>, ) -> Result, CtfeError<'db>> { - if matches!(value.value.value(self.db), SemConstValue::TypeLevel { .. }) { - return Err(CtfeError::InvalidOperation { - origin: value.error_origin(origin), - message: "invalid const projection".into(), - }); + let mut value = value; + for elem in path { + value = self.expand_interned(value); + let projected = match (&value.kind, elem) { + (CtfeConstKind::Tuple { elems, .. }, CtfePathElem::Field(field)) + | (CtfeConstKind::Struct { fields: elems, .. }, CtfePathElem::Field(field)) => { + elems + .get(field.0 as usize) + .cloned() + .ok_or(CtfeError::OutOfBounds { origin })? + } + ( + CtfeConstKind::Enum { + variant: actual, + fields, + .. + }, + CtfePathElem::VariantField { variant, field }, + ) if actual == variant => fields + .get(field.0 as usize) + .cloned() + .ok_or(CtfeError::OutOfBounds { origin })?, + (CtfeConstKind::Bytes { bytes, .. }, CtfePathElem::Index(index)) => { + let byte = *bytes.get(*index).ok_or(CtfeError::OutOfBounds { origin })?; + CtfeConstValue::int( + self.db, + TyId::new(self.db, TyData::TyBase(TyBase::Prim(PrimTy::U8))), + byte.into(), + ) + } + (CtfeConstKind::Array { elems, .. }, CtfePathElem::Index(index)) => elems + .get(*index) + .cloned() + .ok_or(CtfeError::OutOfBounds { origin })?, + (CtfeConstKind::Interned(interned), _) + if matches!(interned.value(self.db), SemConstValue::TypeLevel { .. }) => + { + return Err(CtfeError::InvalidOperation { + origin: value.error_origin(origin), + message: "invalid const projection".into(), + }); + } + _ => { + return Err(CtfeError::InvalidOperation { + origin, + message: "invalid const projection".into(), + }); + } + }; + value = self.value_with_origin(projected, value.deferred_origin); } - project_const(self.db, value.value, path, origin) - .map(|projected| self.value_with_origin(projected, value.deferred_origin)) + Ok(value) } fn value_with_origin( &self, - value: SemConstId<'db>, + value: CtfeConstValue<'db>, deferred_origin: Option>, ) -> CtfeConstValue<'db> { - CtfeConstValue::with_deferred_origin( - value, - self.sem_const_contains_type_level(value) - .then_some(()) - .and(deferred_origin), + value.with_deferred_origin(self.db, deferred_origin) + } + + fn is_type_level(&self, value: &CtfeConstValue<'db>) -> bool { + matches!( + &value.kind, + CtfeConstKind::Interned(value) + if matches!(value.value(self.db), SemConstValue::TypeLevel { .. }) ) } - fn sem_const_contains_type_level(&self, value: SemConstId<'db>) -> bool { - match value.value(self.db) { - SemConstValue::TypeLevel { .. } => true, - SemConstValue::Tuple { elems, .. } - | SemConstValue::Struct { fields: elems, .. } - | SemConstValue::Array { elems, .. } - | SemConstValue::Enum { fields: elems, .. } => elems - .iter() - .copied() - .any(|elem| self.sem_const_contains_type_level(elem)), - SemConstValue::Unit | SemConstValue::Scalar { .. } => false, + fn expand_interned(&self, value: CtfeConstValue<'db>) -> CtfeConstValue<'db> { + let deferred_origin = value.deferred_origin; + match value.kind { + CtfeConstKind::Interned(interned) + if !matches!(interned.value(self.db), SemConstValue::TypeLevel { .. }) => + { + CtfeConstValue::expand_sem_const_shallow(self.db, interned) + .with_deferred_origin(self.db, deferred_origin) + } + kind => CtfeConstValue { + kind, + deferred_origin, + }, } } + fn expand_interned_in_place(&self, value: &mut CtfeConstValue<'db>) { + let interned = match &value.kind { + CtfeConstKind::Interned(interned) + if !matches!(interned.value(self.db), SemConstValue::TypeLevel { .. }) => + { + *interned + } + _ => return, + }; + *value = CtfeConstValue::expand_sem_const_shallow(self.db, interned) + .with_deferred_origin(self.db, value.deferred_origin); + } + + fn store_const_value_in_place( + &self, + root: &mut CtfeConstValue<'db>, + path: &[CtfePathElem], + new_value: CtfeConstValue<'db>, + origin: SemOrigin<'db>, + ) -> Result<(), CtfeError<'db>> { + self.expand_interned_in_place(root); + let Some((head, tail)) = path.split_first() else { + *root = new_value; + return Ok(()); + }; + let root_origin = root.error_origin(origin); + let root_deferred_origin = root.deferred_origin; + let deferred_origin = match &mut root.kind { + CtfeConstKind::Tuple { elems, .. } => { + let CtfePathElem::Field(field) = head else { + return Err(CtfeError::InvalidOperation { + origin: root_origin, + message: "tuple store requires field projection".into(), + }); + }; + let elems = Rc::make_mut(elems); + let slot = elems + .get_mut(field.0 as usize) + .ok_or(CtfeError::OutOfBounds { origin })?; + self.store_const_value_in_place(slot, tail, new_value, origin)?; + slot.deferred_origin.or(root_deferred_origin) + } + CtfeConstKind::Struct { fields, .. } => { + let CtfePathElem::Field(field) = head else { + return Err(CtfeError::InvalidOperation { + origin: root_origin, + message: "struct store requires field projection".into(), + }); + }; + let fields = Rc::make_mut(fields); + let slot = fields + .get_mut(field.0 as usize) + .ok_or(CtfeError::OutOfBounds { origin })?; + self.store_const_value_in_place(slot, tail, new_value, origin)?; + slot.deferred_origin.or(root_deferred_origin) + } + CtfeConstKind::Array { elems, .. } => { + let CtfePathElem::Index(index) = head else { + return Err(CtfeError::InvalidOperation { + origin: root_origin, + message: "array store requires index projection".into(), + }); + }; + let elems = Rc::make_mut(elems); + let slot = elems + .get_mut(*index) + .ok_or(CtfeError::OutOfBounds { origin })?; + self.store_const_value_in_place(slot, tail, new_value, origin)?; + slot.deferred_origin.or(root_deferred_origin) + } + CtfeConstKind::Enum { + variant, fields, .. + } => { + let CtfePathElem::VariantField { + variant: expected, + field, + } = head + else { + return Err(CtfeError::InvalidOperation { + origin: root_origin, + message: "enum store requires variant field projection".into(), + }); + }; + if *variant != *expected { + return Err(CtfeError::VariantMismatch { + origin: root_origin, + }); + } + let fields = Rc::make_mut(fields); + let slot = fields + .get_mut(field.0 as usize) + .ok_or(CtfeError::OutOfBounds { origin })?; + self.store_const_value_in_place(slot, tail, new_value, origin)?; + slot.deferred_origin.or(root_deferred_origin) + } + _ => { + return Err(CtfeError::InvalidOperation { + origin: root_origin, + message: "invalid CTFE store target".into(), + }); + } + }; + root.set_deferred_origin(self.db, deferred_origin); + Ok(()) + } + fn bump(&mut self, origin: SemOrigin<'db>) -> Result<(), CtfeError<'db>> { self.steps += 1; if self.steps > self.config.step_limit { @@ -1786,45 +3176,50 @@ impl<'db> CtfeMachine<'db> { fn const_as_bytes( &self, - value: SemConstId<'db>, + value: &CtfeConstValue<'db>, origin: SemOrigin<'db>, ) -> Result, CtfeError<'db>> { - match value.value(self.db) { - SemConstValue::Scalar { - value: SemConstScalar::Bool(flag), - .. - } => Ok(vec![u8::from(flag)]), - SemConstValue::Scalar { - ty, - value: SemConstScalar::Int { value }, - } => { - let Some((bits, _)) = int_ty_shape(self.db, ty) else { + let value = self.expand_interned(value.clone()); + match &value.kind { + CtfeConstKind::Bool(flag) => Ok(vec![u8::from(*flag)]), + CtfeConstKind::Int { ty, value } => { + let Some((bits, _)) = int_ty_shape(self.db, *ty) else { return Err(CtfeError::NotConstEvaluable { origin }); }; let width = usize::from(bits / 8); - let (_, bytes) = normalize_int_to_shape(value.clone(), bits, false).to_bytes_be(); - if bytes.len() > width { - return Err(CtfeError::NotConstEvaluable { origin }); + match value { + CtfeInt::Word { word, .. } => { + Ok(word.to_be_bytes::<32>()[32 - width..].to_vec()) + } + CtfeInt::Big(value) => { + let (_, bytes) = + normalize_int_to_shape(value.clone(), bits, false).to_bytes_be(); + if bytes.len() > width { + return Err(CtfeError::NotConstEvaluable { origin }); + } + let mut out = vec![0u8; width]; + let offset = width - bytes.len(); + out[offset..].copy_from_slice(&bytes); + Ok(out) + } } - let mut out = vec![0u8; width]; - let offset = width - bytes.len(); - out[offset..].copy_from_slice(&bytes); - Ok(out) } - SemConstValue::Scalar { - value: SemConstScalar::Bytes(bytes), - .. - } => Ok(bytes.clone()), - SemConstValue::Tuple { elems, .. } - | SemConstValue::Struct { fields: elems, .. } - | SemConstValue::Array { elems, .. } => { + CtfeConstKind::Bytes { bytes, .. } => Ok(bytes.to_vec()), + CtfeConstKind::Tuple { elems, .. } | CtfeConstKind::Array { elems, .. } => { let mut out = Vec::new(); - for elem in elems.iter().copied() { + for elem in elems.iter() { out.extend(self.const_as_bytes(elem, origin)?); } Ok(out) } - SemConstValue::Enum { ty, variant, .. } if ty.is_unit_variant_only_enum(self.db) => { + CtfeConstKind::Struct { fields, .. } => { + let mut out = Vec::new(); + for field in fields.iter() { + out.extend(self.const_as_bytes(field, origin)?); + } + Ok(out) + } + CtfeConstKind::Enum { ty, variant, .. } if ty.is_unit_variant_only_enum(self.db) => { let width = 32; let (_, bytes) = BigInt::from(variant.0).to_bytes_be(); let mut out = vec![0u8; width]; @@ -1832,7 +3227,7 @@ impl<'db> CtfeMachine<'db> { out[offset..].copy_from_slice(&bytes); Ok(out) } - SemConstValue::Unit | SemConstValue::TypeLevel { .. } | SemConstValue::Enum { .. } => { + CtfeConstKind::Unit | CtfeConstKind::Interned(_) | CtfeConstKind::Enum { .. } => { Err(CtfeError::NotConstEvaluable { origin }) } } diff --git a/crates/hir/src/analysis/semantic/ctfe/mod.rs b/crates/hir/src/analysis/semantic/ctfe/mod.rs index cb4c040d5c..c1bc320631 100644 --- a/crates/hir/src/analysis/semantic/ctfe/mod.rs +++ b/crates/hir/src/analysis/semantic/ctfe/mod.rs @@ -1,6 +1,5 @@ mod canonicalize; mod machine; -mod ops; pub(crate) use canonicalize::canonicalize_provisional_semantic_consts_from_body; pub use canonicalize::canonicalize_semantic_consts; diff --git a/crates/hir/src/analysis/semantic/ctfe/ops.rs b/crates/hir/src/analysis/semantic/ctfe/ops.rs deleted file mode 100644 index fdc0db2179..0000000000 --- a/crates/hir/src/analysis/semantic/ctfe/ops.rs +++ /dev/null @@ -1,148 +0,0 @@ -use crate::analysis::{ - HirAnalysisDb, - semantic::{ - CtfeError, SemConstId, SemConstScalar, SemConstValue, SemOrigin, array_const, enum_const, - int_const, struct_const, tuple_const, - }, - ty::ty_def::{PrimTy, TyBase, TyData, TyId}, -}; - -use super::machine::CtfePathElem; - -pub(super) fn project_const<'db>( - db: &'db dyn HirAnalysisDb, - mut value: SemConstId<'db>, - path: &[CtfePathElem], - origin: SemOrigin<'db>, -) -> Result, CtfeError<'db>> { - for elem in path { - value = match (value.value(db), elem) { - (SemConstValue::Tuple { elems, .. }, CtfePathElem::Field(field)) - | (SemConstValue::Struct { fields: elems, .. }, CtfePathElem::Field(field)) => elems - .get(field.0 as usize) - .copied() - .ok_or(CtfeError::OutOfBounds { origin })?, - ( - SemConstValue::Enum { - variant: actual, - fields, - .. - }, - CtfePathElem::VariantField { variant, field }, - ) if actual == *variant => fields - .get(field.0 as usize) - .copied() - .ok_or(CtfeError::OutOfBounds { origin })?, - ( - SemConstValue::Scalar { - value: SemConstScalar::Bytes(bytes), - .. - }, - CtfePathElem::Index(index), - ) => { - let byte = *bytes.get(*index).ok_or(CtfeError::OutOfBounds { origin })?; - int_const( - db, - TyId::new(db, TyData::TyBase(TyBase::Prim(PrimTy::U8))), - byte.into(), - ) - } - (SemConstValue::Array { elems, .. }, CtfePathElem::Index(index)) => elems - .get(*index) - .copied() - .ok_or(CtfeError::OutOfBounds { origin })?, - _ => { - return Err(CtfeError::InvalidOperation { - origin, - message: "invalid const projection".into(), - }); - } - }; - } - Ok(value) -} - -pub(super) fn store_const<'db>( - db: &'db dyn HirAnalysisDb, - root: SemConstId<'db>, - path: &[CtfePathElem], - new_value: SemConstId<'db>, - origin: SemOrigin<'db>, -) -> Result, CtfeError<'db>> { - let Some((head, tail)) = path.split_first() else { - return Ok(new_value); - }; - match root.value(db) { - SemConstValue::Tuple { ty, elems } => { - let mut elems = elems.to_vec(); - let CtfePathElem::Field(field) = head else { - return Err(CtfeError::InvalidOperation { - origin, - message: "tuple store requires field projection".into(), - }); - }; - let Some(slot) = elems.get_mut(field.0 as usize) else { - return Err(CtfeError::OutOfBounds { origin }); - }; - *slot = store_const(db, *slot, tail, new_value, origin)?; - Ok(tuple_const(db, ty, elems.into_boxed_slice())) - } - SemConstValue::Struct { ty, fields } => { - let mut fields = fields.to_vec(); - let CtfePathElem::Field(field) = head else { - return Err(CtfeError::InvalidOperation { - origin, - message: "struct store requires field projection".into(), - }); - }; - let Some(slot) = fields.get_mut(field.0 as usize) else { - return Err(CtfeError::OutOfBounds { origin }); - }; - *slot = store_const(db, *slot, tail, new_value, origin)?; - Ok(struct_const(db, ty, fields.into_boxed_slice())) - } - SemConstValue::Array { ty, elems } => { - let mut elems = elems.to_vec(); - let CtfePathElem::Index(index) = head else { - return Err(CtfeError::InvalidOperation { - origin, - message: "array store requires index projection".into(), - }); - }; - let Some(slot) = elems.get_mut(*index) else { - return Err(CtfeError::OutOfBounds { origin }); - }; - *slot = store_const(db, *slot, tail, new_value, origin)?; - Ok(array_const(db, ty, elems.into_boxed_slice())) - } - SemConstValue::Enum { - ty, - variant, - fields, - } => { - let mut fields = fields.to_vec(); - let CtfePathElem::VariantField { - variant: expected, - field, - } = head - else { - return Err(CtfeError::InvalidOperation { - origin, - message: "enum store requires variant field projection".into(), - }); - }; - if variant != *expected { - return Err(CtfeError::VariantMismatch { origin }); - } - let Some(slot) = fields.get_mut(field.0 as usize) else { - return Err(CtfeError::OutOfBounds { origin }); - }; - *slot = store_const(db, *slot, tail, new_value, origin)?; - Ok(enum_const(db, ty, variant, fields.into_boxed_slice())) - } - _ => Err(CtfeError::InvalidOperation { - origin, - message: "invalid CTFE store target".into(), - }), - } -} diff --git a/crates/hir/src/analysis/ty/const_check.rs b/crates/hir/src/analysis/ty/const_check.rs index f3a1f74c88..9365ed0c05 100644 --- a/crates/hir/src/analysis/ty/const_check.rs +++ b/crates/hir/src/analysis/ty/const_check.rs @@ -1,10 +1,12 @@ use crate::analysis::HirAnalysisDb; -use crate::analysis::ty::adt_def::AdtRef; use crate::analysis::ty::diagnostics::{BodyDiag, FuncBodyDiag}; -use crate::analysis::ty::ty_check::TypedBody; +use crate::analysis::ty::trait_def::resolve_trait_method_instance; +use crate::analysis::ty::trait_resolution::TraitSolveCx; +use crate::analysis::ty::ty_check::{Callable, TypedBody}; use crate::hir_def::{ Body, CallableDef, Cond, CondId, Expr, ExprId, Func, Partial, Pat, Stmt, StmtId, }; +use crate::span::DynLazySpan; pub(crate) fn check_const_fn_body<'db>( db: &'db dyn HirAnalysisDb, @@ -44,30 +46,49 @@ impl<'db> ConstFnChecker<'db, '_> { self.diags.push(diag.into()); } - fn check_call_target(&mut self, expr: ExprId) { - let Some(callable) = self.typed_body.callable_expr(expr) else { - return; - }; - let CallableDef::Func(callee) = callable.callable_def else { - self.push(BodyDiag::ConstFnAggregateNotAllowed( - expr.span(self.body).into(), - )); + fn check_callable(&mut self, primary: DynLazySpan<'db>, callable: &Callable<'db>) { + let Some(callee) = self.callable_func(callable) else { return; }; if !callee.is_const(self.db) { self.push(BodyDiag::ConstFnNonConstCall { - primary: expr.span(self.body).into(), - callee: callable.callable_def, + primary, + callee: callable.callable_def(), }); } else if callee.has_effects(self.db) { self.push(BodyDiag::ConstFnEffectfulCall { - primary: expr.span(self.body).into(), - callee: callable.callable_def, + primary, + callee: callable.callable_def(), }); } } + fn callable_func(&self, callable: &Callable<'db>) -> Option> { + let CallableDef::Func(func) = callable.callable_def() else { + return None; + }; + if let Some(inst) = callable.trait_inst() + && let Some(name) = func.name(self.db).to_opt() + && let Some((impl_func, _)) = resolve_trait_method_instance( + self.db, + TraitSolveCx::new(self.db, self.body.scope()) + .with_assumptions(self.typed_body.assumptions()), + inst, + name, + ) + { + return Some(impl_func); + } + Some(func) + } + + fn check_call_target(&mut self, expr: ExprId) { + if let Some(callable) = self.typed_body.callable_expr(expr) { + self.check_callable(expr.span(self.body).into(), callable); + } + } + fn check_stmt(&mut self, stmt: StmtId) { let Partial::Present(stmt_data) = stmt.data(self.db, self.body) else { return; @@ -80,9 +101,21 @@ impl<'db> ConstFnChecker<'db, '_> { self.check_expr(*init); } } - Stmt::For(..) | Stmt::While(..) | Stmt::Continue | Stmt::Break => { - self.push(BodyDiag::ConstFnLoopNotAllowed(stmt.span(self.body).into())); + Stmt::For(pat, iter, body, _) => { + self.check_let_pat(*pat); + self.check_expr(*iter); + if let Some(seq) = self.typed_body.for_loop_seq(stmt) { + let span: DynLazySpan<'db> = stmt.span(self.body).into(); + self.check_callable(span.clone(), &seq.len_callable); + self.check_callable(span, &seq.get_callable); + } + self.check_expr(*body); } + Stmt::While(cond, body) => { + self.check_cond(*cond); + self.check_expr(*body); + } + Stmt::Continue | Stmt::Break => {} Stmt::Return(expr) => { if let Some(expr) = expr { self.check_expr(*expr); @@ -99,36 +132,17 @@ impl<'db> ConstFnChecker<'db, '_> { match pat_data { Pat::WildCard | Pat::Rest => {} - Pat::Path(_, is_mut) => { - if *is_mut { - self.push(BodyDiag::ConstFnMutableBindingNotAllowed( - pat.span(self.body).into(), - )); - } - - if self.typed_body.pat_binding(pat).is_none() { - self.push(BodyDiag::ConstFnAggregateNotAllowed( - pat.span(self.body).into(), - )); - } + Pat::Lit(_) | Pat::Path(_, _) => {} + Pat::Tuple(elems) | Pat::PathTuple(_, elems) => { + elems.iter().for_each(|elem| self.check_let_pat(*elem)); } - Pat::Tuple(elems) => elems.iter().for_each(|elem| self.check_let_pat(*elem)), - Pat::Record(_, fields) => { - let ty = self.typed_body.pat_ty(self.db, pat); - if !matches!(ty.adt_ref(self.db), Some(AdtRef::Struct(_))) { - self.push(BodyDiag::ConstFnAggregateNotAllowed( - pat.span(self.body).into(), - )); - return; - } - - fields - .iter() - .for_each(|field| self.check_let_pat(field.pat)); + Pat::Record(_, fields) => fields + .iter() + .for_each(|field| self.check_let_pat(field.pat)), + Pat::Or(lhs, rhs) => { + self.check_let_pat(*lhs); + self.check_let_pat(*rhs); } - _ => self.push(BodyDiag::ConstFnAggregateNotAllowed( - pat.span(self.body).into(), - )), } } @@ -150,12 +164,15 @@ impl<'db> ConstFnChecker<'db, '_> { Expr::Bin(lhs, rhs, _) => { self.check_expr(*lhs); self.check_expr(*rhs); + self.check_call_target(expr); } - Expr::Un(inner, _) - | Expr::Field(inner, _) - | Expr::ArrayRep(inner, _) - | Expr::Cast(inner, _) => { + Expr::Un(inner, _) => { + self.check_expr(*inner); + self.check_call_target(expr); + } + + Expr::Field(inner, _) | Expr::ArrayRep(inner, _) | Expr::Cast(inner, _) => { self.check_expr(*inner); } @@ -187,9 +204,7 @@ impl<'db> ConstFnChecker<'db, '_> { Expr::Assign(lhs, rhs) | Expr::AugAssign(lhs, rhs, _) => { self.check_expr(*lhs); self.check_expr(*rhs); - self.push(BodyDiag::ConstFnAssignmentNotAllowed( - expr.span(self.body).into(), - )); + self.check_call_target(expr); } Expr::With(_bindings, _body) => { self.push(BodyDiag::ConstFnWithNotAllowed(expr.span(self.body).into())); @@ -229,46 +244,17 @@ impl<'db> ConstFnChecker<'db, '_> { match pat_data { Pat::WildCard | Pat::Rest => {} - Pat::Lit(Partial::Present( - crate::hir_def::LitKind::Int(_) - | crate::hir_def::LitKind::Bool(_) - | crate::hir_def::LitKind::String(_), - )) => {} - Pat::Lit(Partial::Absent) => {} - Pat::Path(_, is_mut) => { - if *is_mut { - self.push(BodyDiag::ConstFnMutableBindingNotAllowed( - pat.span(self.body).into(), - )); - } - - if self.typed_body.pat_binding(pat).is_none() { - self.push(BodyDiag::ConstFnAggregateNotAllowed( - pat.span(self.body).into(), - )); - } - } - Pat::Tuple(elems) => elems.iter().for_each(|elem| self.check_match_pat(*elem)), - Pat::Record(_, fields) => { - let ty = self.typed_body.pat_ty(self.db, pat); - if !matches!(ty.adt_ref(self.db), Some(AdtRef::Struct(_))) { - self.push(BodyDiag::ConstFnAggregateNotAllowed( - pat.span(self.body).into(), - )); - return; - } - - fields - .iter() - .for_each(|field| self.check_match_pat(field.pat)); + Pat::Lit(_) | Pat::Path(_, _) => {} + Pat::Tuple(elems) | Pat::PathTuple(_, elems) => { + elems.iter().for_each(|elem| self.check_match_pat(*elem)); } + Pat::Record(_, fields) => fields + .iter() + .for_each(|field| self.check_match_pat(field.pat)), Pat::Or(lhs, rhs) => { self.check_match_pat(*lhs); self.check_match_pat(*rhs); } - _ => self.push(BodyDiag::ConstFnAggregateNotAllowed( - pat.span(self.body).into(), - )), } } } diff --git a/crates/hir/src/analysis/ty/corelib.rs b/crates/hir/src/analysis/ty/corelib.rs index 7a5cd69e45..65ea7b877e 100644 --- a/crates/hir/src/analysis/ty/corelib.rs +++ b/crates/hir/src/analysis/ty/corelib.rs @@ -331,6 +331,7 @@ pub fn core_primitive_wrapper_call_kind<'db>( }) } +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct CoreRangeTypes<'db> { pub range: TyId<'db>, pub known: TyId<'db>, diff --git a/crates/hir/src/analysis/ty/diagnostics.rs b/crates/hir/src/analysis/ty/diagnostics.rs index 39e2f9d56d..d19fc43086 100644 --- a/crates/hir/src/analysis/ty/diagnostics.rs +++ b/crates/hir/src/analysis/ty/diagnostics.rs @@ -659,10 +659,6 @@ pub enum BodyDiag<'db> { // Const fn / const-check diagnostics ----------------------------------- ConstFnEffectsNotAllowed(DynLazySpan<'db>), ConstFnWithNotAllowed(DynLazySpan<'db>), - ConstFnLoopNotAllowed(DynLazySpan<'db>), - ConstFnAssignmentNotAllowed(DynLazySpan<'db>), - ConstFnAggregateNotAllowed(DynLazySpan<'db>), - ConstFnMutableBindingNotAllowed(DynLazySpan<'db>), ConstFnNonConstCall { primary: DynLazySpan<'db>, callee: CallableDef<'db>, @@ -827,10 +823,6 @@ impl<'db> BodyDiag<'db> { Self::RecvFallbackReturnTypeNotAllowed { .. } => 80, Self::ConstFnEffectsNotAllowed(_) => 55, Self::ConstFnWithNotAllowed(_) => 56, - Self::ConstFnLoopNotAllowed(_) => 57, - Self::ConstFnAssignmentNotAllowed(_) => 59, - Self::ConstFnAggregateNotAllowed(_) => 60, - Self::ConstFnMutableBindingNotAllowed(_) => 61, Self::ConstFnNonConstCall { .. } => 62, Self::ConstFnEffectfulCall { .. } => 63, } diff --git a/crates/hir/src/analysis/ty/method_cmp.rs b/crates/hir/src/analysis/ty/method_cmp.rs index 2936416c87..d0d16df6a2 100644 --- a/crates/hir/src/analysis/ty/method_cmp.rs +++ b/crates/hir/src/analysis/ty/method_cmp.rs @@ -5,7 +5,7 @@ use super::{ binder::Binder, const_expr::ConstExpr, const_ty::{ - CallableInputLayoutHoleOrigin, ConstCanonEnv, ConstCanonMode, ConstTyData, + CallableInputLayoutHoleOrigin, ConstCanonEnv, ConstCanonMode, ConstTyData, ConstTyId, canonicalize_ty_for_mode, const_ty_from_assoc_const_use, normalize_const_tys_for_comparison, }, @@ -26,6 +26,7 @@ use super::{ }, ty_check::{ConstRef, check_anon_const_body}, ty_def::{InvalidCause, TyData, TyId}, + unify::UnificationTable, }; use crate::analysis::{HirAnalysisDb, semantic::instantiate_with_generic_args}; use crate::hir_def::{CallableDef, Expr, Partial, PathKind, scope_graph::ScopeId}; @@ -552,17 +553,40 @@ fn collect_effect_provider_entries<'db>( } }; } - Some(EffectProviderEntry { - effect_idx, - provider_param, - identity: canonical_effect_identity_for_binding( + let rebase_same_trait_uses = param_subst.is_some(); + let mut identity = canonical_effect_identity_for_binding( + db, + &binding, + scope, + assumptions, + Some(trait_inst), + EffectKeyCanonMode::Compare, + ); + identity.key_ty = identity.key_ty.map(|ty| { + normalize_compare_assoc_consts( db, - &binding, + normalize_ty(db, ty, scope, assumptions), scope, assumptions, - Some(trait_inst), - EffectKeyCanonMode::Compare, - ), + trait_inst, + rebase_same_trait_uses, + ) + }); + identity.key_trait = identity.key_trait.map(|inst| { + normalize_predicate_for_comparison( + db, + inst, + scope, + assumptions, + trait_inst, + rebase_same_trait_uses, + ) + }); + + Some(EffectProviderEntry { + effect_idx, + provider_param, + identity, }) }) .collect() @@ -623,15 +647,14 @@ fn effect_identity_matches<'db>( match trait_identity.key_kind { EffectKeyKind::Type => match (trait_identity.key_ty, impl_identity.key_ty) { (Some(trait_key_ty), Some(impl_key_ty)) => { - alpha_rename_hidden_layout_placeholders(db, trait_key_ty, impl_key_ty) - == impl_key_ty + effect_identity_tys_match(db, trait_key_ty, impl_key_ty) } _ => false, }, EffectKeyKind::Trait => match (trait_identity.key_trait, impl_identity.key_trait) { (Some(trait_key_trait), Some(impl_key_trait)) => { trait_effect_key_matches_with(db, trait_key_trait, impl_key_trait, |lhs, rhs| { - lhs == rhs + effect_identity_tys_match(db, lhs, rhs) }) } _ => false, @@ -640,6 +663,15 @@ fn effect_identity_matches<'db>( } } +fn effect_identity_tys_match<'db>( + db: &'db dyn HirAnalysisDb, + expected: TyId<'db>, + actual: TyId<'db>, +) -> bool { + let expected = alpha_rename_hidden_layout_placeholders(db, expected, actual); + UnificationTable::new(db).unify(expected, actual).is_ok() +} + fn instantiate_with_partial_map<'db, T>( db: &'db dyn HirAnalysisDb, binder: Binder, @@ -816,6 +848,25 @@ fn normalize_compare_assoc_consts<'db>( self.normalize_assoc_const_ty(db, assoc, expected_ty) } + + fn normalize_unevaluated_const_fn_call( + &mut self, + db: &'db dyn HirAnalysisDb, + const_ty: ConstTyId<'db>, + expected_ty: TyId<'db>, + ) -> Option> { + let evaluated = const_ty.evaluate(db, Some(expected_ty)); + if evaluated == const_ty || evaluated.ty(db).invalid_cause(db).is_some() { + return None; + } + if !matches!( + evaluated.data(db), + ConstTyData::Evaluated(..) | ConstTyData::Abstract(..) + ) { + return None; + } + Some(self.fold_ty(db, TyId::new(db, TyData::ConstTy(evaluated)))) + } } impl<'db> TyFolder<'db> for CompareAssocConstNormalizer<'db> { @@ -859,7 +910,9 @@ fn normalize_compare_assoc_consts<'db>( }; let expr = body.expr(db); let Partial::Present(Expr::Path(path)) = expr.data(db, *body) else { - return ty; + return self + .normalize_unevaluated_const_fn_call(db, *const_ty, expected_ty) + .unwrap_or(ty); }; let Some(path) = path.to_opt() else { return ty; @@ -875,7 +928,9 @@ fn normalize_compare_assoc_consts<'db>( return ty; }; if !parent.is_self_ty(db) || !path_generic_args.is_empty(db) { - return ty; + return self + .normalize_unevaluated_const_fn_call(db, *const_ty, expected_ty) + .unwrap_or(ty); } self.normalize_unevaluated_assoc_const(db, *body, expected_ty, generic_args) @@ -892,12 +947,13 @@ fn normalize_compare_assoc_consts<'db>( trait_inst, rebase_same_trait_uses, }; - canonicalize_ty_for_mode( + let ty = canonicalize_ty_for_mode( db, ty.fold_with(db, &mut folder), ConstCanonEnv::new(scope, assumptions, None), ConstCanonMode::Identity, - ) + ); + ty.fold_with(db, &mut folder) } /// Checks if the method constraints are stricter than the trait constraints. diff --git a/crates/hir/src/analysis/ty/ty_check/env.rs b/crates/hir/src/analysis/ty/ty_check/env.rs index a13c89d6e4..c693a8b4aa 100644 --- a/crates/hir/src/analysis/ty/ty_check/env.rs +++ b/crates/hir/src/analysis/ty/ty_check/env.rs @@ -1510,10 +1510,17 @@ pub(super) struct PendingMethod<'db> { pub expr: crate::core::hir_def::ExprId, pub recv_ty: TyId<'db>, pub method_name: crate::core::hir_def::IdentId<'db>, - pub candidates: Vec>, + pub candidates: Vec>, pub span: DynLazySpan<'db>, } +#[derive(Debug, Clone, Copy)] +pub(super) struct PendingMethodCandidate<'db> { + pub inst: TraitInstId<'db>, + pub method: Func<'db>, + pub needs_confirmation: bool, +} + #[derive(Debug, Clone)] pub(super) enum PendingPrimitiveOp { Unary { diff --git a/crates/hir/src/analysis/ty/ty_check/expr.rs b/crates/hir/src/analysis/ty/ty_check/expr.rs index 095e3c9a90..6946c0fa7c 100644 --- a/crates/hir/src/analysis/ty/ty_check/expr.rs +++ b/crates/hir/src/analysis/ty/ty_check/expr.rs @@ -2968,7 +2968,7 @@ impl<'db> TyChecker<'db> { Ok(candidate) => candidate, Err(err) => { match err { - MethodSelectionError::AmbiguousTraitMethod(insts) => { + MethodSelectionError::AmbiguousTraitMethod(ambiguous) => { // Defer resolution using return-type constraints let ret_ty = self.fresh_ty(); let typed = ExprProp::new(ret_ty, true); @@ -2978,14 +2978,19 @@ impl<'db> TyChecker<'db> { for arg in args.iter() { self.check_expr_unknown(arg.expr); } - // Instantiate candidates with fresh inference vars so - // later unifications can bind their parameters. - let cands: Vec<_> = insts + let candidates = ambiguous + .candidates .into_iter() - .map(|inst| { - self.table.instantiate_with_fresh_vars( - crate::analysis::ty::binder::Binder::bind(inst), - ) + .map(|candidate| { + let inst = canonical_r_ty + .extract_solution(&mut self.table, candidate.cand.inst); + let inst = + self.specialize_same_trait_method_inst(method_name, inst); + super::env::PendingMethodCandidate { + inst, + method: candidate.cand.method, + needs_confirmation: candidate.needs_confirmation, + } }) .collect(); @@ -2993,7 +2998,7 @@ impl<'db> TyChecker<'db> { expr, recv_ty: selected_receiver_ty, method_name, - candidates: cands, + candidates, span: call_span.method_name().into(), }); return typed; @@ -4143,7 +4148,7 @@ impl<'db> TyChecker<'db> { (func_ty, inst) } - Err(MethodSelectionError::AmbiguousTraitMethod(insts)) => { + Err(MethodSelectionError::AmbiguousTraitMethod(ambiguous)) => { let Some(rhs_expr) = rhs_expr else { unreachable!("unary core::ops ambiguity"); }; @@ -4153,36 +4158,34 @@ impl<'db> TyChecker<'db> { return ExprProp::invalid(self.db); } - let method_ident = op.trait_method(self.db); - let trait_method = *trait_def.method_defs(self.db).get(&method_ident).unwrap(); - - let mut viable: Vec<(TyId<'db>, TraitInstId<'db>, TyId<'db>)> = Vec::new(); - for inst in insts.iter().copied() { + let mut viable = Vec::new(); + for candidate in ambiguous.candidates.iter().copied() { let snapshot = self.snapshot_state(); - let candidate_func_ty = super::instantiate_trait_method( - self.db, - trait_method, - &mut self.table, - selected_lhs_ty, - inst, - ); - let candidate_func_ty = self.table.instantiate_to_term(candidate_func_ty); - let (base, gen_args) = candidate_func_ty.decompose_ty_app(self.db); - let expected_rhs = - if let TyData::TyBase(TyBase::Func(func_def)) = base.data(self.db) { - let mut subst = AssocTySubst::new(inst); - let ty = func_def.arg_tys(self.db)[1].instantiate(self.db, gen_args); - self.normalize_ty(ty.fold_with(self.db, &mut subst)) - } else { - unreachable!("candidate func ty should be a func"); - }; - let rhs_ty = self - .try_coerce_capability_for_expr_to_expected(rhs_expr, rhs.ty, expected_rhs) - .unwrap_or(rhs.ty); - let unifies = self.table.unify(rhs_ty, expected_rhs).is_ok(); + let unifies = (|| { + let inst = c_lhs_ty.extract_solution(&mut self.table, candidate.cand.inst); + let func_ty = super::try_instantiate_trait_method( + self.db, + candidate.cand.method, + &mut self.table, + selected_lhs_ty, + inst, + ) + .ok()?; + let func_ty = self.table.instantiate_to_term(func_ty); + let expected_rhs = self.instantiated_ops_rhs_ty(func_ty, inst)?; + let rhs_ty = self + .try_coerce_capability_for_expr_to_expected( + rhs_expr, + rhs.ty, + expected_rhs, + ) + .unwrap_or(rhs.ty); + self.table.unify(rhs_ty, expected_rhs).ok() + })() + .is_some(); self.rollback_state(snapshot); if unifies { - viable.push((candidate_func_ty, inst, expected_rhs)); + viable.push(candidate); } } @@ -4198,26 +4201,46 @@ impl<'db> TyChecker<'db> { return ExprProp::invalid(self.db); } 1 => { - let (func_ty, inst, expected_rhs) = viable.pop().unwrap(); - self.env.register_trait_obligation(TraitObligation { - goal: inst, - origin: TraitObligationOrigin::GenericConfirmation, - span: expr.span(self.body()).into(), - }); - let rhs_ty = self - .try_coerce_capability_for_expr_to_expected( - rhs_expr, - rhs.ty, + let candidate = viable.pop().unwrap(); + let inst = c_lhs_ty.extract_solution(&mut self.table, candidate.cand.inst); + if candidate.needs_confirmation { + self.env.register_trait_obligation(TraitObligation { + goal: inst, + origin: TraitObligationOrigin::GenericConfirmation, + span: expr.span(self.body()).into(), + }); + } + let func_ty = self.instantiate_trait_method_to_term( + candidate.cand.method, + selected_lhs_ty, + inst, + ); + if let Some(expected_rhs) = self.instantiated_ops_rhs_ty(func_ty, inst) { + let rhs_ty = self + .try_coerce_capability_for_expr_to_expected( + rhs_expr, + rhs.ty, + expected_rhs, + ) + .unwrap_or(rhs.ty); + self.unify_ty( + Typeable::Expr(rhs_expr, rhs.clone()), + rhs_ty, expected_rhs, - ) - .unwrap_or(rhs.ty); - self.unify_ty(Typeable::Expr(rhs_expr, rhs.clone()), rhs_ty, expected_rhs); + ); + } (func_ty, inst) } _ => { + let cands = viable + .into_iter() + .map(|candidate| { + c_lhs_ty.extract_solution(&mut self.table, candidate.cand.inst) + }) + .collect(); self.push_diag(BodyDiag::AmbiguousTraitInst { primary: expr.span(self.body()).into(), - cands: viable.into_iter().map(|(_, inst, _)| inst).collect(), + cands, required_by: None, }); return ExprProp::invalid(self.db); @@ -4413,10 +4436,10 @@ fn body_diag_from_method_selection_err<'db>( .into() } - MethodSelectionError::AmbiguousTraitMethod(traits) => BodyDiag::AmbiguousTrait { + MethodSelectionError::AmbiguousTraitMethod(ambiguous) => BodyDiag::AmbiguousTrait { primary: method.span, method_name: method.data, - traits, + traits: ambiguous.diagnostic_traits, } .into(), diff --git a/crates/hir/src/analysis/ty/ty_check/mod.rs b/crates/hir/src/analysis/ty/ty_check/mod.rs index 772811575f..7c17944585 100644 --- a/crates/hir/src/analysis/ty/ty_check/mod.rs +++ b/crates/hir/src/analysis/ty/ty_check/mod.rs @@ -145,10 +145,14 @@ pub fn check_static_assert<'db>( Ok(value) => match static_assert_bool_value(db, value) { Some(true) => {} Some(false) => { - let mut diags = Vec::new(); - let comparison = assert_.comparison(db).and_then(|comparison| { - static_assert_comparison_values(db, condition, typed_body, comparison) - }); + let mut diags = body_diags.clone(); + let comparison = if body_diags.is_empty() { + assert_.comparison(db).and_then(|comparison| { + static_assert_comparison_values(db, condition, typed_body, comparison) + }) + } else { + None + }; diags.push( BodyDiag::StaticAssertFailed { primary: condition.span().into(), @@ -857,6 +861,21 @@ impl<'db> TyChecker<'db> { unique } + fn dedup_equivalent_pending_method_candidates( + &self, + candidates: Vec>, + ) -> Vec> { + let db = self.db; + let mut seen = FxHashSet::default(); + let mut unique = Vec::new(); + for candidate in candidates { + if seen.insert(Canonical::new(db, candidate.inst)) { + unique.push(candidate); + } + } + unique + } + fn call_constraint_diag_info( &self, callable_def: CallableDef<'db>, @@ -1233,24 +1252,33 @@ impl<'db> TyChecker<'db> { receiver: ExprId, generic_args: crate::hir_def::GenericArgListId<'db>, call_args: &[crate::hir_def::CallArg<'db>], - inst: TraitInstId<'db>| { + candidate: env::PendingMethodCandidate<'db>| { let snap = this.snapshot_state(); let result = (|| { + let inst = candidate.inst; let recv_ty = { let mut prober = env::Prober::new(&mut this.table, scope); pending.recv_ty.fold_with(db, &mut prober) }; let inst_self = this.table.instantiate_to_term(inst.self_ty(db)); - if this.table.unify(inst_self, recv_ty).is_err() { + let recv_ty = if this.table.unify(inst_self, recv_ty).is_ok() { + recv_ty + } else { let recv_inner = recv_ty.as_capability(db).map(|(_, inner)| inner)?; this.table.unify(inst_self, recv_inner).ok()?; - } + recv_inner + }; - let trait_method = *inst.def(db).method_defs(db).get(&pending.method_name)?; - let func_ty = - instantiate_trait_method(db, trait_method, &mut this.table, recv_ty, inst); + let func_ty = try_instantiate_trait_method( + db, + candidate.method, + &mut this.table, + recv_ty, + inst, + ) + .ok()?; let func_ty = this.table.instantiate_to_term(func_ty); let mut callable = Callable::new(db, func_ty, receiver.span(body).into(), Some(inst)).ok()?; @@ -1359,7 +1387,7 @@ impl<'db> TyChecker<'db> { .candidates .iter() .copied() - .filter(|&inst| { + .filter(|&candidate| { is_viable( self, &pending, @@ -1367,15 +1395,16 @@ impl<'db> TyChecker<'db> { receiver, generic_args, call_args, - inst, + candidate, ) }) .collect(); - let viable = self.dedup_equivalent_trait_insts(viable); + let viable = self.dedup_equivalent_pending_method_candidates(viable); - if let [inst] = viable.as_slice() { + if let [candidate] = viable.as_slice() { if self.env.callable_expr(pending.expr).is_none() { let call_span = pending.expr.span(body).into_method_call_expr(); + let inst = candidate.inst; let receiver_prop = self .env @@ -1386,22 +1415,17 @@ impl<'db> TyChecker<'db> { pending.recv_ty.fold_with(db, &mut prober) }; - let trait_method = *inst - .def(db) - .method_defs(db) - .get(&pending.method_name) - .unwrap(); let func_ty = self.instantiate_trait_method_to_term( - trait_method, + candidate.method, recv_ty, - *inst, + inst, ); let mut callable = match Callable::new( db, func_ty, receiver.span(body).into(), - Some(*inst), + Some(inst), ) { Ok(callable) => callable, Err(diag) => { @@ -1411,6 +1435,14 @@ impl<'db> TyChecker<'db> { } }; + if candidate.needs_confirmation { + self.env.register_trait_obligation(env::TraitObligation { + goal: inst, + origin: env::TraitObligationOrigin::GenericConfirmation, + span: call_span.clone().into(), + }); + } + if !callable.unify_generic_args( self, generic_args, @@ -1512,7 +1544,7 @@ impl<'db> TyChecker<'db> { .candidates .iter() .copied() - .filter(|&inst| { + .filter(|&candidate| { is_viable( self, &pending, @@ -1520,16 +1552,16 @@ impl<'db> TyChecker<'db> { receiver, generic_args, call_args, - inst, + candidate, ) }) .collect(); - let viable = self.dedup_equivalent_trait_insts(viable); + let viable = self.dedup_equivalent_pending_method_candidates(viable); if viable.len() > 1 { self.push_diag(BodyDiag::AmbiguousTrait { primary: pending.span.clone(), method_name: pending.method_name, - traits: viable.into_iter().collect(), + traits: viable.into_iter().map(|candidate| candidate.inst).collect(), }); } } @@ -3886,13 +3918,13 @@ impl Typeable<'_> { } } -fn instantiate_trait_method<'db>( +fn try_instantiate_trait_method<'db>( db: &'db dyn HirAnalysisDb, method: Func<'db>, table: &mut UnificationTable<'db>, receiver_ty: TyId<'db>, inst: TraitInstId<'db>, -) -> TyId<'db> { +) -> Result, UnificationError> { let ty = TyId::foldl( db, TyId::func(db, method.as_callable(db).unwrap()), @@ -3900,12 +3932,23 @@ fn instantiate_trait_method<'db>( ); let inst_self = table.instantiate_to_term(inst.self_ty(db)); - table.unify(inst_self, receiver_ty).unwrap(); + table.unify(inst_self, receiver_ty)?; // Apply associated type substitutions from the trait instance use crate::analysis::ty::fold::{AssocTySubst, TyFoldable}; let mut subst = AssocTySubst::new(inst); - ty.fold_with(db, &mut subst) + Ok(ty.fold_with(db, &mut subst)) +} + +fn instantiate_trait_method<'db>( + db: &'db dyn HirAnalysisDb, + method: Func<'db>, + table: &mut UnificationTable<'db>, + receiver_ty: TyId<'db>, + inst: TraitInstId<'db>, +) -> TyId<'db> { + try_instantiate_trait_method(db, method, table, receiver_ty, inst) + .expect("selected trait method candidate receiver should unify") } /// Instantiate a trait-associated function type (no receiver), e.g. `T::make`. diff --git a/crates/hir/src/core/span/item.rs b/crates/hir/src/core/span/item.rs index ea9a11ead5..2f372c0f9e 100644 --- a/crates/hir/src/core/span/item.rs +++ b/crates/hir/src/core/span/item.rs @@ -927,7 +927,7 @@ pub contract Counter { "#, ]; - for (i, text) in cases.iter().enumerate() { + for text in cases { let file = db.standalone_file(text); let top_mod = map_file_to_mod(&db, file); let sg = scope_graph(&db, top_mod); @@ -937,7 +937,6 @@ pub contract Counter { let _ = reference.span().resolve(&db); } } - eprintln!("case {i} ok"); } } } diff --git a/crates/hir/test_files/ty_check/const_eval_user_const_fn_const_params.snap b/crates/hir/test_files/ty_check/const_eval_user_const_fn_const_params.snap index 42a1dae288..8841cf04a7 100644 --- a/crates/hir/test_files/ty_check/const_eval_user_const_fn_const_params.snap +++ b/crates/hir/test_files/ty_check/const_eval_user_const_fn_const_params.snap @@ -66,10 +66,10 @@ note: ┌─ const_eval_user_const_fn_const_params.fe:14:9 │ 14 │ let a: Foo<{ N }> - │ ^ Foo + │ ^ Foo note: ┌─ const_eval_user_const_fn_const_params.fe:15:9 │ 15 │ let b: Bar<{ N }> - │ ^ Bar + │ ^ Bar diff --git a/crates/hir/tests/effect_key_normalization.rs b/crates/hir/tests/effect_key_normalization.rs index 395508bcf9..c838dbdd8f 100644 --- a/crates/hir/tests/effect_key_normalization.rs +++ b/crates/hir/tests/effect_key_normalization.rs @@ -622,12 +622,6 @@ fn caller(token: Token) -> Address uses (evm: mut Evm) { let caller = find_func(&db, top_mod, "caller"); let call_expr = find_method_call_expr(&db, caller); let typed_body = check_func_body(&db, caller).1.clone(); - eprintln!( - "effect_args={:#?}", - typed_body - .call_effect_args(call_expr) - .expect("missing effect args") - ); let callable = typed_body .callable_expr(call_expr) .expect("missing method callable"); @@ -682,21 +676,9 @@ fn caller(token: Token<0, 1>) -> Address uses (evm: mut Evm) { let caller = find_func(&db, top_mod, "caller"); let call_expr = find_method_call_expr(&db, caller); let typed_body = check_func_body(&db, caller).1.clone(); - eprintln!( - "effect_args={:#?}", - typed_body - .call_effect_args(call_expr) - .expect("missing effect args") - ); let callable = typed_body .callable_expr(call_expr) .expect("missing method callable"); - eprintln!( - "effect_args={:#?}", - typed_body - .call_effect_args(call_expr) - .expect("missing effect args") - ); let CallableDef::Func(method) = callable.callable_def() else { panic!("expected inherent method callable"); }; diff --git a/crates/hir/tests/semantic_ctfe.rs b/crates/hir/tests/semantic_ctfe.rs index 9aafda9f1a..8ce914886b 100644 --- a/crates/hir/tests/semantic_ctfe.rs +++ b/crates/hir/tests/semantic_ctfe.rs @@ -134,10 +134,6 @@ fn const_fn_match_has_no_const_body_diagnostic() { FuncBodyDiag::Body( BodyDiag::ConstFnEffectsNotAllowed(_) | BodyDiag::ConstFnWithNotAllowed(_) - | BodyDiag::ConstFnLoopNotAllowed(_) - | BodyDiag::ConstFnAssignmentNotAllowed(_) - | BodyDiag::ConstFnAggregateNotAllowed(_) - | BodyDiag::ConstFnMutableBindingNotAllowed(_) | BodyDiag::ConstFnNonConstCall { .. } | BodyDiag::ConstFnEffectfulCall { .. } ) diff --git a/crates/hir/tests/ty_check.rs b/crates/hir/tests/ty_check.rs index 7d470df489..b4de016621 100644 --- a/crates/hir/tests/ty_check.rs +++ b/crates/hir/tests/ty_check.rs @@ -119,6 +119,49 @@ fn trigger() { assert!(!diagnostics_contain(&diags, "const eval"), "{diags:#?}"); } +#[test] +fn generic_operator_ambiguity_preserves_checked_candidates() { + let mut db = HirAnalysisTestDb::default(); + let file = db.new_stand_alone( + "generic_operator_ambiguity_preserves_checked_candidates.fe".into(), + r#" +use core::ops::Add + +struct Box { + value: T, +} + +impl Copy for Box {} + +impl Box { + fn new(value: T) -> Box { + Box { value: value } + } +} + +impl Add for Box { + fn add(own self, _ other: own Box) -> Box { + self + } +} + +impl Add for Box { + fn add(own self, _ other: own T) -> Box { + self + Box::new(value: other) + } +} + +fn probe() -> u256 { + let box: Box = Box::new(value: 1) + (box + 2).value +} +"#, + ); + let (top_mod, _) = db.top_mod(file); + + db.assert_no_diags(top_mod); +} + fn diagnostics_for<'db>( db: &'db HirAnalysisTestDb, top_mod: TopLevelMod<'db>, diff --git a/crates/language-server/src/logging.rs b/crates/language-server/src/logging.rs index 252a802fe8..e7fd96bc9c 100644 --- a/crates/language-server/src/logging.rs +++ b/crates/language-server/src/logging.rs @@ -423,6 +423,7 @@ impl<'a> tracing_subscriber::fmt::MakeWriter<'a> for RotatingFileWriter { /// it as the thread-local default. The returned [`DefaultGuard`] must be /// held for as long as the subscriber should remain active — dropping it /// resets the thread-local dispatch. +#[allow(clippy::print_stderr)] pub fn setup_default_subscriber(client: ClientSocket) -> Option { use tracing::subscriber::set_default; diff --git a/crates/mir/src/runtime/lower/body.rs b/crates/mir/src/runtime/lower/body.rs index a5eca54983..a45734eda3 100644 --- a/crates/mir/src/runtime/lower/body.rs +++ b/crates/mir/src/runtime/lower/body.rs @@ -3,10 +3,11 @@ use hir::analysis::{ semantic::{ EffectProviderSubst, FieldIndex, GenericSubst, ImplEnv, SBlockId, SConst, SLocalId, SemConstId, SemConstScalar, SemConstValue, SemanticCalleeRef, SemanticCodeRegionRef, - SemanticInstance, SemanticInstanceKey, VariantIndex, + SemanticInstance, SemanticInstanceKey, SemanticLocalKind, VariantIndex, borrowck::{ - NBorrowRoot, NEffectArg, NExpr, NOperand, NSPlace, NSPlaceRoot, NSStmt, NSStmtKind, - NSTerminator, NSTerminatorKind, NormalizedSemanticBody, normalize_semantic_body, + NBorrowRoot, NBorrowRootId, NEffectArg, NExpr, NLocalOrigin, NOperand, NSPlace, + NSPlaceRoot, NSStmt, NSStmtKind, NSTerminator, NSTerminatorKind, + NormalizedBindingLowering, NormalizedSemanticBody, normalize_semantic_body, }, get_or_build_semantic_instance, reify_runtime_const_for_ty, sem_const_ty, }, @@ -522,6 +523,10 @@ impl<'db> RmirEmitter<'db> { self.lower_expr_into(bb, sink, expr); } Some(desired) => { + if self.semantic_local_is_derived_place_bound_alias(dst) { + self.lower_derived_place_bound_alias_assign(dst, expr); + return; + } if self.semantic_local_is_direct(dst) { self.specialize_direct_assign_target_from_expr(dst, expr); self.lower_expr_into(bb, self.runtime_value(dst), expr); @@ -3583,6 +3588,128 @@ impl<'db> RmirEmitter<'db> { ) } + fn semantic_local_is_derived_place_bound_alias(&self, local: SLocalId) -> bool { + self.semantic_body + .locals + .get(local.index()) + .is_some_and(|local| { + matches!( + (&local.facts.interface, &local.facts.origin), + ( + SemanticLocalKind::PlaceBoundValue, + NLocalOrigin::AliasedPlace + ) + ) + }) + } + + fn lower_derived_place_bound_alias_assign(&self, local: SLocalId, expr: &NExpr<'db>) { + if self.derived_place_bound_alias_expr_matches_place(local, expr) { + return; + } + panic!( + "derived place-bound local assigned from non-alias expression: owner={:?}; local={local:?}; local_data={:?}; expr={expr:?}", + self.current_semantic_key().owner(self.db), + self.semantic_body.local(local), + ); + } + + fn derived_place_bound_alias_expr_matches_place( + &self, + local: SLocalId, + expr: &NExpr<'db>, + ) -> bool { + let Some(dst_place) = self + .semantic_body + .local(local) + .and_then(|local| local.backing_place()) + else { + return false; + }; + match expr { + NExpr::ReadPlace { place, .. } => place == dst_place, + NExpr::Use(operand) => { + self.semantic_body + .local(operand.local) + .and_then(|local| local.backing_place()) + == Some(dst_place) + } + NExpr::ExtractEnumField { + value, + variant, + field, + } => { + let Some(mut place) = self.alias_source_place_for_local(value.local) else { + return false; + }; + let Some(value_local) = self.semantic_body.local(value.local) else { + return false; + }; + place.path.push(Projection::VariantField { + variant: *variant, + enum_ty: value_local.ty, + field_idx: field.0 as usize, + }); + place == *dst_place + } + NExpr::CodeRegionRef { .. } + | NExpr::Const(_) + | NExpr::Unary { .. } + | NExpr::Binary { .. } + | NExpr::Cast { .. } + | NExpr::ArrayRepeat { .. } + | NExpr::AggregateMake { .. } + | NExpr::EnumMake { .. } + | NExpr::Borrow { .. } + | NExpr::GetEnumTag { .. } + | NExpr::IsEnumVariant { .. } + | NExpr::Call { .. } + | NExpr::CodeRegionOffset { .. } + | NExpr::CodeRegionLen { .. } => false, + } + } + + fn alias_source_place_for_local(&self, local: SLocalId) -> Option> { + let local_data = self.semantic_body.local(local)?; + if let Some(place) = local_data.backing_place() { + return Some(place.clone()); + } + match &local_data.lowering { + NormalizedBindingLowering::CarrierLocal { provider, .. } => { + let root = if let Some(provider) = provider { + NSPlaceRoot::Root(self.provider_borrow_root(provider)?) + } else { + NSPlaceRoot::CarrierDerefLocal(local) + }; + Some(NSPlace { + root, + path: Default::default(), + }) + } + NormalizedBindingLowering::Erased + | NormalizedBindingLowering::ValueLocal { .. } + | NormalizedBindingLowering::PlaceBoundValue { .. } => None, + } + } + + fn provider_borrow_root( + &self, + provider: &hir::semantic::ProviderBinding<'db>, + ) -> Option { + self.semantic_body + .borrow_roots + .iter() + .enumerate() + .find_map(|(idx, root)| match root { + NBorrowRoot::Provider { binding } if binding == provider => { + Some(NBorrowRootId::from_u32(idx as u32)) + } + NBorrowRoot::Param { .. } + | NBorrowRoot::LocalSlot { .. } + | NBorrowRoot::Provider { .. } => None, + }) + } + fn semantic_value_class(&self, local: SLocalId) -> Option> { match self.semantic_local_lowering(local) { RuntimeLocalLowering::Erased => None, diff --git a/crates/mir/src/runtime/lower/infer.rs b/crates/mir/src/runtime/lower/infer.rs index 9ec273d3c6..50b1586666 100644 --- a/crates/mir/src/runtime/lower/infer.rs +++ b/crates/mir/src/runtime/lower/infer.rs @@ -250,6 +250,15 @@ pub(crate) fn desired_runtime_value_carrier<'db>( local: &NSLocal<'db>, class: RuntimeClass<'db>, ) -> RuntimeCarrier<'db> { + if matches!( + (&local.facts.interface, &local.facts.origin), + ( + SemanticLocalKind::PlaceBoundValue, + NLocalOrigin::AliasedPlace + ) + ) { + return RuntimeCarrier::Erased; + } match class { RuntimeClass::AggregateValue { layout } if matches!(local.facts.interface, SemanticLocalKind::DirectValue) diff --git a/crates/uitest/fixtures/ty_check/const_fn/non_const_operator_impl.fe b/crates/uitest/fixtures/ty_check/const_fn/non_const_operator_impl.fe new file mode 100644 index 0000000000..40f56d460a --- /dev/null +++ b/crates/uitest/fixtures/ty_check/const_fn/non_const_operator_impl.fe @@ -0,0 +1,23 @@ +use core::ops::Add + +struct RuntimeCounter { + value: usize, +} + +impl Copy for RuntimeCounter {} + +impl Add for RuntimeCounter { + fn add(own self, _ other: own RuntimeCounter) -> RuntimeCounter { + RuntimeCounter { value: self.value + other.value } + } +} + +const fn concrete_bad() -> RuntimeCounter { + (RuntimeCounter { value: 1 }) + (RuntimeCounter { value: 2 }) +} + +const fn generic_bad(lhs: T, rhs: T) -> T + where T: Add +{ + lhs + rhs +} diff --git a/crates/uitest/fixtures/ty_check/const_fn/non_const_operator_impl.snap b/crates/uitest/fixtures/ty_check/const_fn/non_const_operator_impl.snap new file mode 100644 index 0000000000..b4a134e4db --- /dev/null +++ b/crates/uitest/fixtures/ty_check/const_fn/non_const_operator_impl.snap @@ -0,0 +1,26 @@ +--- +source: crates/uitest/tests/ty_check.rs +expression: diags +input_file: fixtures/ty_check/const_fn/non_const_operator_impl.fe +--- +error[8-0062]: non-const call in `const fn` + ┌─ non_const_operator_impl.fe:16:5 + │ +16 │ (RuntimeCounter { value: 1 }) + (RuntimeCounter { value: 2 }) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `add` is not a `const fn` + │ + ┌─ src/ops.fe:4:8 + │ + 4 │ fn add(own self, _ other: own T) -> Self::Output + │ --- callee defined here + +error[8-0062]: non-const call in `const fn` + ┌─ non_const_operator_impl.fe:22:5 + │ +22 │ lhs + rhs + │ ^^^^^^^^^ `add` is not a `const fn` + │ + ┌─ src/ops.fe:4:8 + │ + 4 │ fn add(own self, _ other: own T) -> Self::Output + │ --- callee defined here diff --git a/crates/uitest/fixtures/ty_check/static_assert.fe b/crates/uitest/fixtures/ty_check/static_assert.fe index 198cb80d97..d85c61bd02 100644 --- a/crates/uitest/fixtures/ty_check/static_assert.fe +++ b/crates/uitest/fixtures/ty_check/static_assert.fe @@ -5,6 +5,7 @@ const LIE: bool = false static_assert(false) static_assert(2 == 3) +static_assert(1 + 2 == 2) static_assert(A + 2 == B) static_assert((TRUTH == LIE)) static_assert(A < 1) diff --git a/crates/uitest/fixtures/ty_check/static_assert.snap b/crates/uitest/fixtures/ty_check/static_assert.snap index 0dae417aa1..4729d4a9b1 100644 --- a/crates/uitest/fixtures/ty_check/static_assert.snap +++ b/crates/uitest/fixtures/ty_check/static_assert.snap @@ -4,23 +4,41 @@ expression: diags input_file: fixtures/ty_check/static_assert.fe --- error[3-0024]: non-const function call in const context - ┌─ static_assert.fe:30:15 + ┌─ static_assert.fe:31:15 │ -30 │ static_assert(runtime()) +31 │ static_assert(runtime()) │ ^^^^^^^^^ calls in const context must be `const fn` error[3-0025]: division by zero in const context - ┌─ static_assert.fe:15:15 + ┌─ static_assert.fe:16:15 │ -15 │ static_assert(1 / 0 == 0) +16 │ static_assert(1 / 0 == 0) │ ^^^^^ cannot divide by zero error[8-0000]: type mismatch - ┌─ static_assert.fe:16:15 + ┌─ static_assert.fe:17:15 │ -16 │ static_assert(1) +17 │ static_assert(1) │ ^ expected `bool`, but `{integer}` is given +error[8-0031]: type annotation is needed + ┌─ static_assert.fe:7:15 + │ +7 │ static_assert(2 == 3) + │ ^ + │ │ + │ type annotation is needed + │ no default type is provided for an integer type. consider giving integer type + +error[8-0031]: type annotation is needed + ┌─ static_assert.fe:8:15 + │ +8 │ static_assert(1 + 2 == 2) + │ ^^^^^ + │ │ + │ type annotation is needed + │ no default type is provided for an integer type. consider giving integer type + error[8-0081]: static assertion failed ┌─ static_assert.fe:6:15 │ @@ -32,35 +50,37 @@ error[8-0081]: static assertion failed │ 7 │ static_assert(2 == 3) │ ^^^^^^ `static_assert` evaluated to `false` - │ - = left: `2` - = right: `3` - = operator: `==` error[8-0081]: static assertion failed ┌─ static_assert.fe:8:15 │ -8 │ static_assert(A + 2 == B) +8 │ static_assert(1 + 2 == 2) │ ^^^^^^^^^^ `static_assert` evaluated to `false` - │ - = left: `3` - = right: `2` - = operator: `==` error[8-0081]: static assertion failed ┌─ static_assert.fe:9:15 │ -9 │ static_assert((TRUTH == LIE)) - │ ^^^^^^^^^^^^^^ `static_assert` evaluated to `false` +9 │ static_assert(A + 2 == B) + │ ^^^^^^^^^^ `static_assert` evaluated to `false` │ - = left: `true` - = right: `false` + = left: `3` + = right: `2` = operator: `==` error[8-0081]: static assertion failed ┌─ static_assert.fe:10:15 │ -10 │ static_assert(A < 1) +10 │ static_assert((TRUTH == LIE)) + │ ^^^^^^^^^^^^^^ `static_assert` evaluated to `false` + │ + = left: `true` + = right: `false` + = operator: `==` + +error[8-0081]: static assertion failed + ┌─ static_assert.fe:11:15 + │ +11 │ static_assert(A < 1) │ ^^^^^ `static_assert` evaluated to `false` │ = left: `1` @@ -68,9 +88,9 @@ error[8-0081]: static assertion failed = operator: `<` error[8-0081]: static assertion failed - ┌─ static_assert.fe:11:15 + ┌─ static_assert.fe:12:15 │ -11 │ static_assert(A > B) +12 │ static_assert(A > B) │ ^^^^^ `static_assert` evaluated to `false` │ = left: `1` @@ -78,9 +98,9 @@ error[8-0081]: static assertion failed = operator: `>` error[8-0081]: static assertion failed - ┌─ static_assert.fe:12:15 + ┌─ static_assert.fe:13:15 │ -12 │ static_assert(B <= A) +13 │ static_assert(B <= A) │ ^^^^^^ `static_assert` evaluated to `false` │ = left: `2` @@ -88,9 +108,9 @@ error[8-0081]: static assertion failed = operator: `<=` error[8-0081]: static assertion failed - ┌─ static_assert.fe:13:15 + ┌─ static_assert.fe:14:15 │ -13 │ static_assert(A >= B) +14 │ static_assert(A >= B) │ ^^^^^^ `static_assert` evaluated to `false` │ = left: `1` @@ -98,9 +118,9 @@ error[8-0081]: static assertion failed = operator: `>=` error[8-0081]: static assertion failed - ┌─ static_assert.fe:14:15 + ┌─ static_assert.fe:15:15 │ -14 │ static_assert(A != 1) +15 │ static_assert(A != 1) │ ^^^^^^ `static_assert` evaluated to `false` │ = left: `1` @@ -108,9 +128,9 @@ error[8-0081]: static assertion failed = operator: `!=` error[8-0081]: static assertion failed - ┌─ static_assert.fe:21:19 + ┌─ static_assert.fe:22:19 │ -21 │ static_assert(C == 6) +22 │ static_assert(C == 6) │ ^^^^^^ `static_assert` evaluated to `false` │ = left: `5` diff --git a/ingots/core/src/num.fe b/ingots/core/src/num.fe index 956dcf4f3f..b91eb32252 100644 --- a/ingots/core/src/num.fe +++ b/ingots/core/src/num.fe @@ -5,378 +5,378 @@ use super::panic // Generic bitcast intrinsic - reinterprets bits between any two primitive integer types extern { - fn __bitcast(_: From) -> To + const fn __bitcast(_: From) -> To } // Generic checked arithmetic intrinsics for primitive integer types. extern { - fn __checked_add(_: T, _: T) -> T - fn __checked_sub(_: T, _: T) -> T - fn __checked_mul(_: T, _: T) -> T - fn __checked_div(_: T, _: T) -> T - fn __checked_rem(_: T, _: T) -> T - fn __checked_pow(_: T, _: T) -> T - fn __checked_neg(_: T) -> T + const fn __checked_add(_: T, _: T) -> T + const fn __checked_sub(_: T, _: T) -> T + const fn __checked_mul(_: T, _: T) -> T + const fn __checked_div(_: T, _: T) -> T + const fn __checked_rem(_: T, _: T) -> T + const fn __checked_pow(_: T, _: T) -> T + const fn __checked_neg(_: T) -> T } // Generic saturating arithmetic intrinsics for primitive integer types. extern { - fn __saturating_add(_: T, _: T) -> T - fn __saturating_sub(_: T, _: T) -> T - fn __saturating_mul(_: T, _: T) -> T + const fn __saturating_add(_: T, _: T) -> T + const fn __saturating_sub(_: T, _: T) -> T + const fn __saturating_mul(_: T, _: T) -> T } // Extern intrinsics for u8 extern { - fn __add_u8(_: u8, _: u8) -> u8 - fn __sub_u8(_: u8, _: u8) -> u8 - fn __mul_u8(_: u8, _: u8) -> u8 - fn __div_u8(_: u8, _: u8) -> u8 - fn __rem_u8(_: u8, _: u8) -> u8 - fn __pow_u8(_: u8, _: u8) -> u8 - fn __shl_u8(_: u8, _: u8) -> u8 - fn __shr_u8(_: u8, _: u8) -> u8 - fn __bitand_u8(_: u8, _: u8) -> u8 - fn __bitor_u8(_: u8, _: u8) -> u8 - fn __bitxor_u8(_: u8, _: u8) -> u8 - - fn __eq_u8(_: u8, _: u8) -> bool - fn __ne_u8(_: u8, _: u8) -> bool - fn __lt_u8(_: u8, _: u8) -> bool - fn __le_u8(_: u8, _: u8) -> bool - fn __gt_u8(_: u8, _: u8) -> bool - fn __ge_u8(_: u8, _: u8) -> bool - - fn __bitnot_u8(_: u8) -> u8 + const fn __add_u8(_: u8, _: u8) -> u8 + const fn __sub_u8(_: u8, _: u8) -> u8 + const fn __mul_u8(_: u8, _: u8) -> u8 + const fn __div_u8(_: u8, _: u8) -> u8 + const fn __rem_u8(_: u8, _: u8) -> u8 + const fn __pow_u8(_: u8, _: u8) -> u8 + const fn __shl_u8(_: u8, _: u8) -> u8 + const fn __shr_u8(_: u8, _: u8) -> u8 + const fn __bitand_u8(_: u8, _: u8) -> u8 + const fn __bitor_u8(_: u8, _: u8) -> u8 + const fn __bitxor_u8(_: u8, _: u8) -> u8 + + const fn __eq_u8(_: u8, _: u8) -> bool + const fn __ne_u8(_: u8, _: u8) -> bool + const fn __lt_u8(_: u8, _: u8) -> bool + const fn __le_u8(_: u8, _: u8) -> bool + const fn __gt_u8(_: u8, _: u8) -> bool + const fn __ge_u8(_: u8, _: u8) -> bool + + const fn __bitnot_u8(_: u8) -> u8 } // Extern intrinsics for i8 extern { - fn __add_i8(_: i8, _: i8) -> i8 - fn __sub_i8(_: i8, _: i8) -> i8 - fn __mul_i8(_: i8, _: i8) -> i8 - fn __div_i8(_: i8, _: i8) -> i8 - fn __rem_i8(_: i8, _: i8) -> i8 - fn __pow_i8(_: i8, _: i8) -> i8 - fn __shl_i8(_: i8, _: i8) -> i8 - fn __shr_i8(_: i8, _: i8) -> i8 - fn __bitand_i8(_: i8, _: i8) -> i8 - fn __bitor_i8(_: i8, _: i8) -> i8 - fn __bitxor_i8(_: i8, _: i8) -> i8 - - fn __eq_i8(_: i8, _: i8) -> bool - fn __ne_i8(_: i8, _: i8) -> bool - fn __lt_i8(_: i8, _: i8) -> bool - fn __le_i8(_: i8, _: i8) -> bool - fn __gt_i8(_: i8, _: i8) -> bool - fn __ge_i8(_: i8, _: i8) -> bool - - fn __neg_i8(_: i8) -> i8 - fn __bitnot_i8(_: i8) -> i8 + const fn __add_i8(_: i8, _: i8) -> i8 + const fn __sub_i8(_: i8, _: i8) -> i8 + const fn __mul_i8(_: i8, _: i8) -> i8 + const fn __div_i8(_: i8, _: i8) -> i8 + const fn __rem_i8(_: i8, _: i8) -> i8 + const fn __pow_i8(_: i8, _: i8) -> i8 + const fn __shl_i8(_: i8, _: i8) -> i8 + const fn __shr_i8(_: i8, _: i8) -> i8 + const fn __bitand_i8(_: i8, _: i8) -> i8 + const fn __bitor_i8(_: i8, _: i8) -> i8 + const fn __bitxor_i8(_: i8, _: i8) -> i8 + + const fn __eq_i8(_: i8, _: i8) -> bool + const fn __ne_i8(_: i8, _: i8) -> bool + const fn __lt_i8(_: i8, _: i8) -> bool + const fn __le_i8(_: i8, _: i8) -> bool + const fn __gt_i8(_: i8, _: i8) -> bool + const fn __ge_i8(_: i8, _: i8) -> bool + + const fn __neg_i8(_: i8) -> i8 + const fn __bitnot_i8(_: i8) -> i8 } // Extern intrinsics for i16 extern { - fn __add_i16(_: i16, _: i16) -> i16 - fn __sub_i16(_: i16, _: i16) -> i16 - fn __mul_i16(_: i16, _: i16) -> i16 - fn __div_i16(_: i16, _: i16) -> i16 - fn __rem_i16(_: i16, _: i16) -> i16 - fn __pow_i16(_: i16, _: i16) -> i16 - fn __shl_i16(_: i16, _: i16) -> i16 - fn __shr_i16(_: i16, _: i16) -> i16 - fn __bitand_i16(_: i16, _: i16) -> i16 - fn __bitor_i16(_: i16, _: i16) -> i16 - fn __bitxor_i16(_: i16, _: i16) -> i16 - - fn __eq_i16(_: i16, _: i16) -> bool - fn __ne_i16(_: i16, _: i16) -> bool - fn __lt_i16(_: i16, _: i16) -> bool - fn __le_i16(_: i16, _: i16) -> bool - fn __gt_i16(_: i16, _: i16) -> bool - fn __ge_i16(_: i16, _: i16) -> bool - - fn __neg_i16(_: i16) -> i16 - fn __bitnot_i16(_: i16) -> i16 + const fn __add_i16(_: i16, _: i16) -> i16 + const fn __sub_i16(_: i16, _: i16) -> i16 + const fn __mul_i16(_: i16, _: i16) -> i16 + const fn __div_i16(_: i16, _: i16) -> i16 + const fn __rem_i16(_: i16, _: i16) -> i16 + const fn __pow_i16(_: i16, _: i16) -> i16 + const fn __shl_i16(_: i16, _: i16) -> i16 + const fn __shr_i16(_: i16, _: i16) -> i16 + const fn __bitand_i16(_: i16, _: i16) -> i16 + const fn __bitor_i16(_: i16, _: i16) -> i16 + const fn __bitxor_i16(_: i16, _: i16) -> i16 + + const fn __eq_i16(_: i16, _: i16) -> bool + const fn __ne_i16(_: i16, _: i16) -> bool + const fn __lt_i16(_: i16, _: i16) -> bool + const fn __le_i16(_: i16, _: i16) -> bool + const fn __gt_i16(_: i16, _: i16) -> bool + const fn __ge_i16(_: i16, _: i16) -> bool + + const fn __neg_i16(_: i16) -> i16 + const fn __bitnot_i16(_: i16) -> i16 } // Extern intrinsics for u16 extern { - fn __add_u16(_: u16, _: u16) -> u16 - fn __sub_u16(_: u16, _: u16) -> u16 - fn __mul_u16(_: u16, _: u16) -> u16 - fn __div_u16(_: u16, _: u16) -> u16 - fn __rem_u16(_: u16, _: u16) -> u16 - fn __pow_u16(_: u16, _: u16) -> u16 - fn __shl_u16(_: u16, _: u16) -> u16 - fn __shr_u16(_: u16, _: u16) -> u16 - fn __bitand_u16(_: u16, _: u16) -> u16 - fn __bitor_u16(_: u16, _: u16) -> u16 - fn __bitxor_u16(_: u16, _: u16) -> u16 - - fn __eq_u16(_: u16, _: u16) -> bool - fn __ne_u16(_: u16, _: u16) -> bool - fn __lt_u16(_: u16, _: u16) -> bool - fn __le_u16(_: u16, _: u16) -> bool - fn __gt_u16(_: u16, _: u16) -> bool - fn __ge_u16(_: u16, _: u16) -> bool - - fn __bitnot_u16(_: u16) -> u16 + const fn __add_u16(_: u16, _: u16) -> u16 + const fn __sub_u16(_: u16, _: u16) -> u16 + const fn __mul_u16(_: u16, _: u16) -> u16 + const fn __div_u16(_: u16, _: u16) -> u16 + const fn __rem_u16(_: u16, _: u16) -> u16 + const fn __pow_u16(_: u16, _: u16) -> u16 + const fn __shl_u16(_: u16, _: u16) -> u16 + const fn __shr_u16(_: u16, _: u16) -> u16 + const fn __bitand_u16(_: u16, _: u16) -> u16 + const fn __bitor_u16(_: u16, _: u16) -> u16 + const fn __bitxor_u16(_: u16, _: u16) -> u16 + + const fn __eq_u16(_: u16, _: u16) -> bool + const fn __ne_u16(_: u16, _: u16) -> bool + const fn __lt_u16(_: u16, _: u16) -> bool + const fn __le_u16(_: u16, _: u16) -> bool + const fn __gt_u16(_: u16, _: u16) -> bool + const fn __ge_u16(_: u16, _: u16) -> bool + + const fn __bitnot_u16(_: u16) -> u16 } // Extern intrinsics for i32 extern { - fn __add_i32(_: i32, _: i32) -> i32 - fn __sub_i32(_: i32, _: i32) -> i32 - fn __mul_i32(_: i32, _: i32) -> i32 - fn __div_i32(_: i32, _: i32) -> i32 - fn __rem_i32(_: i32, _: i32) -> i32 - fn __pow_i32(_: i32, _: i32) -> i32 - fn __shl_i32(_: i32, _: i32) -> i32 - fn __shr_i32(_: i32, _: i32) -> i32 - fn __bitand_i32(_: i32, _: i32) -> i32 - fn __bitor_i32(_: i32, _: i32) -> i32 - fn __bitxor_i32(_: i32, _: i32) -> i32 - - fn __eq_i32(_: i32, _: i32) -> bool - fn __ne_i32(_: i32, _: i32) -> bool - fn __lt_i32(_: i32, _: i32) -> bool - fn __le_i32(_: i32, _: i32) -> bool - fn __gt_i32(_: i32, _: i32) -> bool - fn __ge_i32(_: i32, _: i32) -> bool - - fn __neg_i32(_: i32) -> i32 - fn __bitnot_i32(_: i32) -> i32 + const fn __add_i32(_: i32, _: i32) -> i32 + const fn __sub_i32(_: i32, _: i32) -> i32 + const fn __mul_i32(_: i32, _: i32) -> i32 + const fn __div_i32(_: i32, _: i32) -> i32 + const fn __rem_i32(_: i32, _: i32) -> i32 + const fn __pow_i32(_: i32, _: i32) -> i32 + const fn __shl_i32(_: i32, _: i32) -> i32 + const fn __shr_i32(_: i32, _: i32) -> i32 + const fn __bitand_i32(_: i32, _: i32) -> i32 + const fn __bitor_i32(_: i32, _: i32) -> i32 + const fn __bitxor_i32(_: i32, _: i32) -> i32 + + const fn __eq_i32(_: i32, _: i32) -> bool + const fn __ne_i32(_: i32, _: i32) -> bool + const fn __lt_i32(_: i32, _: i32) -> bool + const fn __le_i32(_: i32, _: i32) -> bool + const fn __gt_i32(_: i32, _: i32) -> bool + const fn __ge_i32(_: i32, _: i32) -> bool + + const fn __neg_i32(_: i32) -> i32 + const fn __bitnot_i32(_: i32) -> i32 } // Extern intrinsics for u32 extern { - fn __add_u32(_: u32, _: u32) -> u32 - fn __sub_u32(_: u32, _: u32) -> u32 - fn __mul_u32(_: u32, _: u32) -> u32 - fn __div_u32(_: u32, _: u32) -> u32 - fn __rem_u32(_: u32, _: u32) -> u32 - fn __pow_u32(_: u32, _: u32) -> u32 - fn __shl_u32(_: u32, _: u32) -> u32 - fn __shr_u32(_: u32, _: u32) -> u32 - fn __bitand_u32(_: u32, _: u32) -> u32 - fn __bitor_u32(_: u32, _: u32) -> u32 - fn __bitxor_u32(_: u32, _: u32) -> u32 - - fn __eq_u32(_: u32, _: u32) -> bool - fn __ne_u32(_: u32, _: u32) -> bool - fn __lt_u32(_: u32, _: u32) -> bool - fn __le_u32(_: u32, _: u32) -> bool - fn __gt_u32(_: u32, _: u32) -> bool - fn __ge_u32(_: u32, _: u32) -> bool - - fn __bitnot_u32(_: u32) -> u32 + const fn __add_u32(_: u32, _: u32) -> u32 + const fn __sub_u32(_: u32, _: u32) -> u32 + const fn __mul_u32(_: u32, _: u32) -> u32 + const fn __div_u32(_: u32, _: u32) -> u32 + const fn __rem_u32(_: u32, _: u32) -> u32 + const fn __pow_u32(_: u32, _: u32) -> u32 + const fn __shl_u32(_: u32, _: u32) -> u32 + const fn __shr_u32(_: u32, _: u32) -> u32 + const fn __bitand_u32(_: u32, _: u32) -> u32 + const fn __bitor_u32(_: u32, _: u32) -> u32 + const fn __bitxor_u32(_: u32, _: u32) -> u32 + + const fn __eq_u32(_: u32, _: u32) -> bool + const fn __ne_u32(_: u32, _: u32) -> bool + const fn __lt_u32(_: u32, _: u32) -> bool + const fn __le_u32(_: u32, _: u32) -> bool + const fn __gt_u32(_: u32, _: u32) -> bool + const fn __ge_u32(_: u32, _: u32) -> bool + + const fn __bitnot_u32(_: u32) -> u32 } // Extern intrinsics for i64 extern { - fn __add_i64(_: i64, _: i64) -> i64 - fn __sub_i64(_: i64, _: i64) -> i64 - fn __mul_i64(_: i64, _: i64) -> i64 - fn __div_i64(_: i64, _: i64) -> i64 - fn __rem_i64(_: i64, _: i64) -> i64 - fn __pow_i64(_: i64, _: i64) -> i64 - fn __shl_i64(_: i64, _: i64) -> i64 - fn __shr_i64(_: i64, _: i64) -> i64 - fn __bitand_i64(_: i64, _: i64) -> i64 - fn __bitor_i64(_: i64, _: i64) -> i64 - fn __bitxor_i64(_: i64, _: i64) -> i64 - - fn __eq_i64(_: i64, _: i64) -> bool - fn __ne_i64(_: i64, _: i64) -> bool - fn __lt_i64(_: i64, _: i64) -> bool - fn __le_i64(_: i64, _: i64) -> bool - fn __gt_i64(_: i64, _: i64) -> bool - fn __ge_i64(_: i64, _: i64) -> bool - - fn __neg_i64(_: i64) -> i64 - fn __bitnot_i64(_: i64) -> i64 + const fn __add_i64(_: i64, _: i64) -> i64 + const fn __sub_i64(_: i64, _: i64) -> i64 + const fn __mul_i64(_: i64, _: i64) -> i64 + const fn __div_i64(_: i64, _: i64) -> i64 + const fn __rem_i64(_: i64, _: i64) -> i64 + const fn __pow_i64(_: i64, _: i64) -> i64 + const fn __shl_i64(_: i64, _: i64) -> i64 + const fn __shr_i64(_: i64, _: i64) -> i64 + const fn __bitand_i64(_: i64, _: i64) -> i64 + const fn __bitor_i64(_: i64, _: i64) -> i64 + const fn __bitxor_i64(_: i64, _: i64) -> i64 + + const fn __eq_i64(_: i64, _: i64) -> bool + const fn __ne_i64(_: i64, _: i64) -> bool + const fn __lt_i64(_: i64, _: i64) -> bool + const fn __le_i64(_: i64, _: i64) -> bool + const fn __gt_i64(_: i64, _: i64) -> bool + const fn __ge_i64(_: i64, _: i64) -> bool + + const fn __neg_i64(_: i64) -> i64 + const fn __bitnot_i64(_: i64) -> i64 } // Extern intrinsics for i128 extern { - fn __add_i128(_: i128, _: i128) -> i128 - fn __sub_i128(_: i128, _: i128) -> i128 - fn __mul_i128(_: i128, _: i128) -> i128 - fn __div_i128(_: i128, _: i128) -> i128 - fn __rem_i128(_: i128, _: i128) -> i128 - fn __pow_i128(_: i128, _: i128) -> i128 - fn __shl_i128(_: i128, _: i128) -> i128 - fn __shr_i128(_: i128, _: i128) -> i128 - fn __bitand_i128(_: i128, _: i128) -> i128 - fn __bitor_i128(_: i128, _: i128) -> i128 - fn __bitxor_i128(_: i128, _: i128) -> i128 - - fn __eq_i128(_: i128, _: i128) -> bool - fn __ne_i128(_: i128, _: i128) -> bool - fn __lt_i128(_: i128, _: i128) -> bool - fn __le_i128(_: i128, _: i128) -> bool - fn __gt_i128(_: i128, _: i128) -> bool - fn __ge_i128(_: i128, _: i128) -> bool - - fn __neg_i128(_: i128) -> i128 - fn __bitnot_i128(_: i128) -> i128 + const fn __add_i128(_: i128, _: i128) -> i128 + const fn __sub_i128(_: i128, _: i128) -> i128 + const fn __mul_i128(_: i128, _: i128) -> i128 + const fn __div_i128(_: i128, _: i128) -> i128 + const fn __rem_i128(_: i128, _: i128) -> i128 + const fn __pow_i128(_: i128, _: i128) -> i128 + const fn __shl_i128(_: i128, _: i128) -> i128 + const fn __shr_i128(_: i128, _: i128) -> i128 + const fn __bitand_i128(_: i128, _: i128) -> i128 + const fn __bitor_i128(_: i128, _: i128) -> i128 + const fn __bitxor_i128(_: i128, _: i128) -> i128 + + const fn __eq_i128(_: i128, _: i128) -> bool + const fn __ne_i128(_: i128, _: i128) -> bool + const fn __lt_i128(_: i128, _: i128) -> bool + const fn __le_i128(_: i128, _: i128) -> bool + const fn __gt_i128(_: i128, _: i128) -> bool + const fn __ge_i128(_: i128, _: i128) -> bool + + const fn __neg_i128(_: i128) -> i128 + const fn __bitnot_i128(_: i128) -> i128 } // Extern intrinsics for u64 extern { - fn __add_u64(_: u64, _: u64) -> u64 - fn __sub_u64(_: u64, _: u64) -> u64 - fn __mul_u64(_: u64, _: u64) -> u64 - fn __div_u64(_: u64, _: u64) -> u64 - fn __rem_u64(_: u64, _: u64) -> u64 - fn __pow_u64(_: u64, _: u64) -> u64 - fn __shl_u64(_: u64, _: u64) -> u64 - fn __shr_u64(_: u64, _: u64) -> u64 - fn __bitand_u64(_: u64, _: u64) -> u64 - fn __bitor_u64(_: u64, _: u64) -> u64 - fn __bitxor_u64(_: u64, _: u64) -> u64 - - fn __eq_u64(_: u64, _: u64) -> bool - fn __ne_u64(_: u64, _: u64) -> bool - fn __lt_u64(_: u64, _: u64) -> bool - fn __le_u64(_: u64, _: u64) -> bool - fn __gt_u64(_: u64, _: u64) -> bool - fn __ge_u64(_: u64, _: u64) -> bool - - fn __bitnot_u64(_: u64) -> u64 + const fn __add_u64(_: u64, _: u64) -> u64 + const fn __sub_u64(_: u64, _: u64) -> u64 + const fn __mul_u64(_: u64, _: u64) -> u64 + const fn __div_u64(_: u64, _: u64) -> u64 + const fn __rem_u64(_: u64, _: u64) -> u64 + const fn __pow_u64(_: u64, _: u64) -> u64 + const fn __shl_u64(_: u64, _: u64) -> u64 + const fn __shr_u64(_: u64, _: u64) -> u64 + const fn __bitand_u64(_: u64, _: u64) -> u64 + const fn __bitor_u64(_: u64, _: u64) -> u64 + const fn __bitxor_u64(_: u64, _: u64) -> u64 + + const fn __eq_u64(_: u64, _: u64) -> bool + const fn __ne_u64(_: u64, _: u64) -> bool + const fn __lt_u64(_: u64, _: u64) -> bool + const fn __le_u64(_: u64, _: u64) -> bool + const fn __gt_u64(_: u64, _: u64) -> bool + const fn __ge_u64(_: u64, _: u64) -> bool + + const fn __bitnot_u64(_: u64) -> u64 } // Extern intrinsics for u128 extern { - fn __add_u128(_: u128, _: u128) -> u128 - fn __sub_u128(_: u128, _: u128) -> u128 - fn __mul_u128(_: u128, _: u128) -> u128 - fn __div_u128(_: u128, _: u128) -> u128 - fn __rem_u128(_: u128, _: u128) -> u128 - fn __pow_u128(_: u128, _: u128) -> u128 - fn __shl_u128(_: u128, _: u128) -> u128 - fn __shr_u128(_: u128, _: u128) -> u128 - fn __bitand_u128(_: u128, _: u128) -> u128 - fn __bitor_u128(_: u128, _: u128) -> u128 - fn __bitxor_u128(_: u128, _: u128) -> u128 - - fn __eq_u128(_: u128, _: u128) -> bool - fn __ne_u128(_: u128, _: u128) -> bool - fn __lt_u128(_: u128, _: u128) -> bool - fn __le_u128(_: u128, _: u128) -> bool - fn __gt_u128(_: u128, _: u128) -> bool - fn __ge_u128(_: u128, _: u128) -> bool - - fn __bitnot_u128(_: u128) -> u128 + const fn __add_u128(_: u128, _: u128) -> u128 + const fn __sub_u128(_: u128, _: u128) -> u128 + const fn __mul_u128(_: u128, _: u128) -> u128 + const fn __div_u128(_: u128, _: u128) -> u128 + const fn __rem_u128(_: u128, _: u128) -> u128 + const fn __pow_u128(_: u128, _: u128) -> u128 + const fn __shl_u128(_: u128, _: u128) -> u128 + const fn __shr_u128(_: u128, _: u128) -> u128 + const fn __bitand_u128(_: u128, _: u128) -> u128 + const fn __bitor_u128(_: u128, _: u128) -> u128 + const fn __bitxor_u128(_: u128, _: u128) -> u128 + + const fn __eq_u128(_: u128, _: u128) -> bool + const fn __ne_u128(_: u128, _: u128) -> bool + const fn __lt_u128(_: u128, _: u128) -> bool + const fn __le_u128(_: u128, _: u128) -> bool + const fn __gt_u128(_: u128, _: u128) -> bool + const fn __ge_u128(_: u128, _: u128) -> bool + + const fn __bitnot_u128(_: u128) -> u128 } // Extern intrinsics for usize extern { - fn __add_usize(_: usize, _: usize) -> usize - fn __sub_usize(_: usize, _: usize) -> usize - fn __mul_usize(_: usize, _: usize) -> usize - fn __div_usize(_: usize, _: usize) -> usize - fn __rem_usize(_: usize, _: usize) -> usize - fn __pow_usize(_: usize, _: usize) -> usize - fn __shl_usize(_: usize, _: usize) -> usize - fn __shr_usize(_: usize, _: usize) -> usize - fn __bitand_usize(_: usize, _: usize) -> usize - fn __bitor_usize(_: usize, _: usize) -> usize - fn __bitxor_usize(_: usize, _: usize) -> usize - - fn __eq_usize(_: usize, _: usize) -> bool - fn __ne_usize(_: usize, _: usize) -> bool - fn __lt_usize(_: usize, _: usize) -> bool - fn __le_usize(_: usize, _: usize) -> bool - fn __gt_usize(_: usize, _: usize) -> bool - fn __ge_usize(_: usize, _: usize) -> bool - - fn __bitnot_usize(_: usize) -> usize + const fn __add_usize(_: usize, _: usize) -> usize + const fn __sub_usize(_: usize, _: usize) -> usize + const fn __mul_usize(_: usize, _: usize) -> usize + const fn __div_usize(_: usize, _: usize) -> usize + const fn __rem_usize(_: usize, _: usize) -> usize + const fn __pow_usize(_: usize, _: usize) -> usize + const fn __shl_usize(_: usize, _: usize) -> usize + const fn __shr_usize(_: usize, _: usize) -> usize + const fn __bitand_usize(_: usize, _: usize) -> usize + const fn __bitor_usize(_: usize, _: usize) -> usize + const fn __bitxor_usize(_: usize, _: usize) -> usize + + const fn __eq_usize(_: usize, _: usize) -> bool + const fn __ne_usize(_: usize, _: usize) -> bool + const fn __lt_usize(_: usize, _: usize) -> bool + const fn __le_usize(_: usize, _: usize) -> bool + const fn __gt_usize(_: usize, _: usize) -> bool + const fn __ge_usize(_: usize, _: usize) -> bool + + const fn __bitnot_usize(_: usize) -> usize } // Extern intrinsics for i256 extern { - fn __add_i256(_: i256, _: i256) -> i256 - fn __sub_i256(_: i256, _: i256) -> i256 - fn __mul_i256(_: i256, _: i256) -> i256 - fn __div_i256(_: i256, _: i256) -> i256 - fn __rem_i256(_: i256, _: i256) -> i256 - fn __pow_i256(_: i256, _: i256) -> i256 - fn __shl_i256(_: i256, _: i256) -> i256 - fn __shr_i256(_: i256, _: i256) -> i256 - fn __bitand_i256(_: i256, _: i256) -> i256 - fn __bitor_i256(_: i256, _: i256) -> i256 - fn __bitxor_i256(_: i256, _: i256) -> i256 - - fn __eq_i256(_: i256, _: i256) -> bool - fn __ne_i256(_: i256, _: i256) -> bool - fn __lt_i256(_: i256, _: i256) -> bool - fn __le_i256(_: i256, _: i256) -> bool - fn __gt_i256(_: i256, _: i256) -> bool - fn __ge_i256(_: i256, _: i256) -> bool - - fn __neg_i256(_: i256) -> i256 - fn __bitnot_i256(_: i256) -> i256 + const fn __add_i256(_: i256, _: i256) -> i256 + const fn __sub_i256(_: i256, _: i256) -> i256 + const fn __mul_i256(_: i256, _: i256) -> i256 + const fn __div_i256(_: i256, _: i256) -> i256 + const fn __rem_i256(_: i256, _: i256) -> i256 + const fn __pow_i256(_: i256, _: i256) -> i256 + const fn __shl_i256(_: i256, _: i256) -> i256 + const fn __shr_i256(_: i256, _: i256) -> i256 + const fn __bitand_i256(_: i256, _: i256) -> i256 + const fn __bitor_i256(_: i256, _: i256) -> i256 + const fn __bitxor_i256(_: i256, _: i256) -> i256 + + const fn __eq_i256(_: i256, _: i256) -> bool + const fn __ne_i256(_: i256, _: i256) -> bool + const fn __lt_i256(_: i256, _: i256) -> bool + const fn __le_i256(_: i256, _: i256) -> bool + const fn __gt_i256(_: i256, _: i256) -> bool + const fn __ge_i256(_: i256, _: i256) -> bool + + const fn __neg_i256(_: i256) -> i256 + const fn __bitnot_i256(_: i256) -> i256 } // Extern intrinsics for u256 extern { - fn __add_u256(_: u256, _: u256) -> u256 - fn __sub_u256(_: u256, _: u256) -> u256 - fn __mul_u256(_: u256, _: u256) -> u256 - fn __div_u256(_: u256, _: u256) -> u256 - fn __rem_u256(_: u256, _: u256) -> u256 - fn __pow_u256(_: u256, _: u256) -> u256 - fn __shl_u256(_: u256, _: u256) -> u256 - fn __shr_u256(_: u256, _: u256) -> u256 - fn __bitand_u256(_: u256, _: u256) -> u256 - fn __bitor_u256(_: u256, _: u256) -> u256 - fn __bitxor_u256(_: u256, _: u256) -> u256 - - fn __eq_u256(_: u256, _: u256) -> bool - fn __ne_u256(_: u256, _: u256) -> bool - fn __lt_u256(_: u256, _: u256) -> bool - fn __le_u256(_: u256, _: u256) -> bool - fn __gt_u256(_: u256, _: u256) -> bool - fn __ge_u256(_: u256, _: u256) -> bool - - fn __bitnot_u256(_: u256) -> u256 + const fn __add_u256(_: u256, _: u256) -> u256 + const fn __sub_u256(_: u256, _: u256) -> u256 + const fn __mul_u256(_: u256, _: u256) -> u256 + const fn __div_u256(_: u256, _: u256) -> u256 + const fn __rem_u256(_: u256, _: u256) -> u256 + const fn __pow_u256(_: u256, _: u256) -> u256 + const fn __shl_u256(_: u256, _: u256) -> u256 + const fn __shr_u256(_: u256, _: u256) -> u256 + const fn __bitand_u256(_: u256, _: u256) -> u256 + const fn __bitor_u256(_: u256, _: u256) -> u256 + const fn __bitxor_u256(_: u256, _: u256) -> u256 + + const fn __eq_u256(_: u256, _: u256) -> bool + const fn __ne_u256(_: u256, _: u256) -> bool + const fn __lt_u256(_: u256, _: u256) -> bool + const fn __le_u256(_: u256, _: u256) -> bool + const fn __gt_u256(_: u256, _: u256) -> bool + const fn __ge_u256(_: u256, _: u256) -> bool + + const fn __bitnot_u256(_: u256) -> u256 } // Extern intrinsics for isize extern { - fn __add_isize(_: isize, _: isize) -> isize - fn __sub_isize(_: isize, _: isize) -> isize - fn __mul_isize(_: isize, _: isize) -> isize - fn __div_isize(_: isize, _: isize) -> isize - fn __rem_isize(_: isize, _: isize) -> isize - fn __pow_isize(_: isize, _: isize) -> isize - fn __shl_isize(_: isize, _: isize) -> isize - fn __shr_isize(_: isize, _: isize) -> isize - fn __bitand_isize(_: isize, _: isize) -> isize - fn __bitor_isize(_: isize, _: isize) -> isize - fn __bitxor_isize(_: isize, _: isize) -> isize - - fn __eq_isize(_: isize, _: isize) -> bool - fn __ne_isize(_: isize, _: isize) -> bool - fn __lt_isize(_: isize, _: isize) -> bool - fn __le_isize(_: isize, _: isize) -> bool - fn __gt_isize(_: isize, _: isize) -> bool - fn __ge_isize(_: isize, _: isize) -> bool - - fn __neg_isize(_: isize) -> isize - fn __bitnot_isize(_: isize) -> isize + const fn __add_isize(_: isize, _: isize) -> isize + const fn __sub_isize(_: isize, _: isize) -> isize + const fn __mul_isize(_: isize, _: isize) -> isize + const fn __div_isize(_: isize, _: isize) -> isize + const fn __rem_isize(_: isize, _: isize) -> isize + const fn __pow_isize(_: isize, _: isize) -> isize + const fn __shl_isize(_: isize, _: isize) -> isize + const fn __shr_isize(_: isize, _: isize) -> isize + const fn __bitand_isize(_: isize, _: isize) -> isize + const fn __bitor_isize(_: isize, _: isize) -> isize + const fn __bitxor_isize(_: isize, _: isize) -> isize + + const fn __eq_isize(_: isize, _: isize) -> bool + const fn __ne_isize(_: isize, _: isize) -> bool + const fn __lt_isize(_: isize, _: isize) -> bool + const fn __le_isize(_: isize, _: isize) -> bool + const fn __gt_isize(_: isize, _: isize) -> bool + const fn __ge_isize(_: isize, _: isize) -> bool + + const fn __neg_isize(_: isize) -> isize + const fn __bitnot_isize(_: isize) -> isize } // Extern intrinsics for bool extern { - fn __not_bool(_: bool) -> bool - fn __bitand_bool(_: bool, _: bool) -> bool - fn __bitor_bool(_: bool, _: bool) -> bool - fn __bitxor_bool(_: bool, _: bool) -> bool - fn __eq_bool(_: bool, _: bool) -> bool - fn __ne_bool(_: bool, _: bool) -> bool + const fn __not_bool(_: bool) -> bool + const fn __bitand_bool(_: bool, _: bool) -> bool + const fn __bitor_bool(_: bool, _: bool) -> bool + const fn __bitxor_bool(_: bool, _: bool) -> bool + const fn __eq_bool(_: bool, _: bool) -> bool + const fn __ne_bool(_: bool, _: bool) -> bool } // Masks used to truncate a 256-bit word down to the requested primitive width. @@ -396,10 +396,10 @@ const I128_SIGN_BIT: u256 = 0x80000000000000000000000000000000 const I256_SIGN_BIT: u256 = 0x8000000000000000000000000000000000000000000000000000000000000000 pub trait IntDowncast { - fn downcast(self) -> Option - fn downcast_truncate(self) -> T - fn downcast_saturate(self) -> T - fn downcast_unchecked(self) -> T + const fn downcast(self) -> Option + const fn downcast_truncate(self) -> T + const fn downcast_saturate(self) -> T + const fn downcast_unchecked(self) -> T } pub trait IntWord { @@ -407,8 +407,8 @@ pub trait IntWord { const SIGN_BIT: u256 const IS_SIGNED: bool - fn to_word(self) -> u256 - fn from_word(_: u256) -> Self + const fn to_word(self) -> u256 + const fn from_word(_: u256) -> Self } pub trait WordValue { @@ -430,8 +430,8 @@ impl IntWord for u8 { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self as u256 } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { self as u256 } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for u16 { @@ -439,8 +439,8 @@ impl IntWord for u16 { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self as u256 } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { self as u256 } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for u32 { @@ -448,8 +448,8 @@ impl IntWord for u32 { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self as u256 } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { self as u256 } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for u64 { @@ -457,8 +457,8 @@ impl IntWord for u64 { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self as u256 } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { self as u256 } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for u128 { @@ -466,8 +466,8 @@ impl IntWord for u128 { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self as u256 } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { self as u256 } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for u256 { @@ -475,8 +475,8 @@ impl IntWord for u256 { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self } - fn from_word(_ word: u256) -> Self { word } + const fn to_word(self) -> u256 { self } + const fn from_word(_ word: u256) -> Self { word } } impl IntWord for usize { @@ -484,8 +484,8 @@ impl IntWord for usize { const SIGN_BIT: u256 = 0 const IS_SIGNED: bool = false - fn to_word(self) -> u256 { self as u256 } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { self as u256 } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for i8 { @@ -493,8 +493,8 @@ impl IntWord for i8 { const SIGN_BIT: u256 = I8_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self as i256) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self as i256) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for i16 { @@ -502,8 +502,8 @@ impl IntWord for i16 { const SIGN_BIT: u256 = I16_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self as i256) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self as i256) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for i32 { @@ -511,8 +511,8 @@ impl IntWord for i32 { const SIGN_BIT: u256 = I32_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self as i256) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self as i256) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for i64 { @@ -520,8 +520,8 @@ impl IntWord for i64 { const SIGN_BIT: u256 = I64_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self as i256) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self as i256) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for i128 { @@ -529,8 +529,8 @@ impl IntWord for i128 { const SIGN_BIT: u256 = I128_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self as i256) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self as i256) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for i256 { @@ -538,8 +538,8 @@ impl IntWord for i256 { const SIGN_BIT: u256 = I256_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntWord for isize { @@ -547,13 +547,13 @@ impl IntWord for isize { const SIGN_BIT: u256 = I256_SIGN_BIT const IS_SIGNED: bool = true - fn to_word(self) -> u256 { __bitcast(self as i256) } - fn from_word(_ word: u256) -> Self { __bitcast(word) } + const fn to_word(self) -> u256 { __bitcast(self as i256) } + const fn from_word(_ word: u256) -> Self { __bitcast(word) } } impl IntDowncast for S { - fn downcast(self) -> Option { - let word = self.to_word() + const fn downcast(self) -> Option { + let word = IntWord::to_word(self) if T::IS_SIGNED { let t_min_word = sign_extend(word: T::SIGN_BIT, mask: T::MASK, sign_bit: T::SIGN_BIT) let t_max_word = T::SIGN_BIT - 1 @@ -583,8 +583,8 @@ impl IntDowncast for S { } } - fn downcast_truncate(self) -> T { - let word = self.to_word() + const fn downcast_truncate(self) -> T { + let word = IntWord::to_word(self) if T::IS_SIGNED { T::from_word(sign_extend(word: word, mask: T::MASK, sign_bit: T::SIGN_BIT)) } else { @@ -592,8 +592,8 @@ impl IntDowncast for S { } } - fn downcast_saturate(self) -> T { - let word = self.to_word() + const fn downcast_saturate(self) -> T { + let word = IntWord::to_word(self) if !T::IS_SIGNED { let mut unsigned_word = word if S::IS_SIGNED && (word & I256_SIGN_BIT != 0) { @@ -635,14 +635,14 @@ impl IntDowncast for S { } } - fn downcast_unchecked(self) -> T { - let word = self.to_word() + const fn downcast_unchecked(self) -> T { + let word = IntWord::to_word(self) T::from_word(word) } } /// Performs two's-complement sign extension within the provided mask/sign bit. -pub fn sign_extend(word: u256, _ mask: u256, _ sign_bit: u256) -> u256 { +pub const fn sign_extend(word: u256, _ mask: u256, _ sign_bit: u256) -> u256 { let value = word & mask if value & sign_bit != 0 { value | (U256_MASK ^ mask) @@ -651,933 +651,933 @@ pub fn sign_extend(word: u256, _ mask: u256, _ sign_bit: u256) -> u256 { } } -fn pow_checked(_ base: own T, _ exp: own T) -> T +const fn pow_checked(_ base: own T, _ exp: own T) -> T where T: IntWord, T: Mul { __checked_pow(base, exp) } // u8 impls -impl BitNot for u8 { fn bit_not(own self) -> u8 { __bitnot_u8(self) } } -impl Not for u8 { fn not(own self) -> u8 { __bitnot_u8(self) } } +impl BitNot for u8 { const fn bit_not(own self) -> u8 { __bitnot_u8(self) } } +impl Not for u8 { const fn not(own self) -> u8 { __bitnot_u8(self) } } impl Add for u8 { - fn add(own self, _ other: own u8) -> u8 { + const fn add(own self, _ other: own u8) -> u8 { __checked_add(self, other) } } impl Sub for u8 { - fn sub(own self, _ other: own u8) -> u8 { + const fn sub(own self, _ other: own u8) -> u8 { __checked_sub(self, other) } } impl Mul for u8 { - fn mul(own self, _ other: own u8) -> u8 { + const fn mul(own self, _ other: own u8) -> u8 { __checked_mul(self, other) } } impl Div for u8 { - fn div(own self, _ other: own u8) -> u8 { + const fn div(own self, _ other: own u8) -> u8 { __checked_div(self, other) } } impl Rem for u8 { - fn rem(own self, _ other: own u8) -> u8 { + const fn rem(own self, _ other: own u8) -> u8 { __checked_rem(self, other) } } -impl Pow for u8 { fn pow(own self, _ other: own u8) -> u8 { pow_checked(self, other) } } -impl WrappingAdd for u8 { fn wrapping_add(self, _ other: u8) -> u8 { __add_u8(self, other) } } -impl WrappingSub for u8 { fn wrapping_sub(self, _ other: u8) -> u8 { __sub_u8(self, other) } } -impl WrappingMul for u8 { fn wrapping_mul(self, _ other: u8) -> u8 { __mul_u8(self, other) } } -impl SaturatingAdd for u8 { fn saturating_add(self, _ other: u8) -> u8 { __saturating_add(self, other) } } -impl SaturatingSub for u8 { fn saturating_sub(self, _ other: u8) -> u8 { __saturating_sub(self, other) } } -impl SaturatingMul for u8 { fn saturating_mul(self, _ other: u8) -> u8 { __saturating_mul(self, other) } } -impl Shl for u8 { fn shl(own self, _ other: own u8) -> u8 { __shl_u8(self, other) } } -impl Shr for u8 { fn shr(own self, _ other: own u8) -> u8 { __shr_u8(self, other) } } -impl BitAnd for u8 { fn bitand(own self, _ other: own u8) -> u8 { __bitand_u8(self, other) } } -impl BitOr for u8 { fn bitor(own self, _ other: own u8) -> u8 { __bitor_u8(self, other) } } -impl BitXor for u8 { fn bitxor(own self, _ other: own u8) -> u8 { __bitxor_u8(self, other) } } +impl Pow for u8 { const fn pow(own self, _ other: own u8) -> u8 { pow_checked(self, other) } } +impl WrappingAdd for u8 { const fn wrapping_add(self, _ other: u8) -> u8 { __add_u8(self, other) } } +impl WrappingSub for u8 { const fn wrapping_sub(self, _ other: u8) -> u8 { __sub_u8(self, other) } } +impl WrappingMul for u8 { const fn wrapping_mul(self, _ other: u8) -> u8 { __mul_u8(self, other) } } +impl SaturatingAdd for u8 { const fn saturating_add(self, _ other: u8) -> u8 { __saturating_add(self, other) } } +impl SaturatingSub for u8 { const fn saturating_sub(self, _ other: u8) -> u8 { __saturating_sub(self, other) } } +impl SaturatingMul for u8 { const fn saturating_mul(self, _ other: u8) -> u8 { __saturating_mul(self, other) } } +impl Shl for u8 { const fn shl(own self, _ other: own u8) -> u8 { __shl_u8(self, other) } } +impl Shr for u8 { const fn shr(own self, _ other: own u8) -> u8 { __shr_u8(self, other) } } +impl BitAnd for u8 { const fn bitand(own self, _ other: own u8) -> u8 { __bitand_u8(self, other) } } +impl BitOr for u8 { const fn bitor(own self, _ other: own u8) -> u8 { __bitor_u8(self, other) } } +impl BitXor for u8 { const fn bitxor(own self, _ other: own u8) -> u8 { __bitxor_u8(self, other) } } impl Eq for u8 { - fn eq(self, _ other: u8) -> bool { __eq_u8(self, other) } - fn ne(self, _ other: u8) -> bool { __ne_u8(self, other) } + const fn eq(self, _ other: u8) -> bool { __eq_u8(self, other) } + const fn ne(self, _ other: u8) -> bool { __ne_u8(self, other) } } impl Ord for u8 { - fn lt(self, _ other: u8) -> bool { __lt_u8(self, other) } - fn le(self, _ other: u8) -> bool { __le_u8(self, other) } - fn gt(self, _ other: u8) -> bool { __gt_u8(self, other) } - fn ge(self, _ other: u8) -> bool { __ge_u8(self, other) } -} -impl AddAssign for u8 { fn add_assign(mut self, _ other: own u8) { self = self + other } } -impl SubAssign for u8 { fn sub_assign(mut self, _ other: own u8) { self = self - other } } -impl MulAssign for u8 { fn mul_assign(mut self, _ other: own u8) { self = self * other } } -impl DivAssign for u8 { fn div_assign(mut self, _ other: own u8) { self = self / other } } -impl RemAssign for u8 { fn rem_assign(mut self, _ other: own u8) { self = self % other } } -impl PowAssign for u8 { fn pow_assign(mut self, _ other: own u8) { self = self ** other } } -impl ShlAssign for u8 { fn shl_assign(mut self, _ other: own u8) { self = self << other } } -impl ShrAssign for u8 { fn shr_assign(mut self, _ other: own u8) { self = self >> other } } -impl BitAndAssign for u8 { fn bitand_assign(mut self, _ other: own u8) { self = self & other } } -impl BitOrAssign for u8 { fn bitor_assign(mut self, _ other: own u8) { self = self | other } } -impl BitXorAssign for u8 { fn bitxor_assign(mut self, _ other: own u8) { self = self ^ other } } + const fn lt(self, _ other: u8) -> bool { __lt_u8(self, other) } + const fn le(self, _ other: u8) -> bool { __le_u8(self, other) } + const fn gt(self, _ other: u8) -> bool { __gt_u8(self, other) } + const fn ge(self, _ other: u8) -> bool { __ge_u8(self, other) } +} +impl AddAssign for u8 { const fn add_assign(mut self, _ other: own u8) { self = self + other } } +impl SubAssign for u8 { const fn sub_assign(mut self, _ other: own u8) { self = self - other } } +impl MulAssign for u8 { const fn mul_assign(mut self, _ other: own u8) { self = self * other } } +impl DivAssign for u8 { const fn div_assign(mut self, _ other: own u8) { self = self / other } } +impl RemAssign for u8 { const fn rem_assign(mut self, _ other: own u8) { self = self % other } } +impl PowAssign for u8 { const fn pow_assign(mut self, _ other: own u8) { self = self ** other } } +impl ShlAssign for u8 { const fn shl_assign(mut self, _ other: own u8) { self = self << other } } +impl ShrAssign for u8 { const fn shr_assign(mut self, _ other: own u8) { self = self >> other } } +impl BitAndAssign for u8 { const fn bitand_assign(mut self, _ other: own u8) { self = self & other } } +impl BitOrAssign for u8 { const fn bitor_assign(mut self, _ other: own u8) { self = self | other } } +impl BitXorAssign for u8 { const fn bitxor_assign(mut self, _ other: own u8) { self = self ^ other } } impl Default for u8 { fn default() -> Self { 0 } } // i8 impls impl Neg for i8 { - fn neg(own self) -> i8 { + const fn neg(own self) -> i8 { __checked_neg(self) } } -impl BitNot for i8 { fn bit_not(own self) -> i8 { __bitnot_i8(self) } } -impl Not for i8 { fn not(own self) -> i8 { __bitnot_i8(self) } } +impl BitNot for i8 { const fn bit_not(own self) -> i8 { __bitnot_i8(self) } } +impl Not for i8 { const fn not(own self) -> i8 { __bitnot_i8(self) } } impl Add for i8 { - fn add(own self, _ other: own i8) -> i8 { + const fn add(own self, _ other: own i8) -> i8 { __checked_add(self, other) } } impl Sub for i8 { - fn sub(own self, _ other: own i8) -> i8 { + const fn sub(own self, _ other: own i8) -> i8 { __checked_sub(self, other) } } impl Mul for i8 { - fn mul(own self, _ other: own i8) -> i8 { + const fn mul(own self, _ other: own i8) -> i8 { __checked_mul(self, other) } } impl Div for i8 { - fn div(own self, _ other: own i8) -> i8 { + const fn div(own self, _ other: own i8) -> i8 { __checked_div(self, other) } } impl Rem for i8 { - fn rem(own self, _ other: own i8) -> i8 { + const fn rem(own self, _ other: own i8) -> i8 { __checked_rem(self, other) } } -impl Pow for i8 { fn pow(own self, _ other: own i8) -> i8 { pow_checked(self, other) } } -impl WrappingAdd for i8 { fn wrapping_add(self, _ other: i8) -> i8 { __add_i8(self, other) } } -impl WrappingSub for i8 { fn wrapping_sub(self, _ other: i8) -> i8 { __sub_i8(self, other) } } -impl WrappingMul for i8 { fn wrapping_mul(self, _ other: i8) -> i8 { __mul_i8(self, other) } } -impl SaturatingAdd for i8 { fn saturating_add(self, _ other: i8) -> i8 { __saturating_add(self, other) } } -impl SaturatingSub for i8 { fn saturating_sub(self, _ other: i8) -> i8 { __saturating_sub(self, other) } } -impl SaturatingMul for i8 { fn saturating_mul(self, _ other: i8) -> i8 { __saturating_mul(self, other) } } -impl Shl for i8 { fn shl(own self, _ other: own i8) -> i8 { __shl_i8(self, other) } } -impl Shr for i8 { fn shr(own self, _ other: own i8) -> i8 { __shr_i8(self, other) } } -impl BitAnd for i8 { fn bitand(own self, _ other: own i8) -> i8 { __bitand_i8(self, other) } } -impl BitOr for i8 { fn bitor(own self, _ other: own i8) -> i8 { __bitor_i8(self, other) } } -impl BitXor for i8 { fn bitxor(own self, _ other: own i8) -> i8 { __bitxor_i8(self, other) } } +impl Pow for i8 { const fn pow(own self, _ other: own i8) -> i8 { pow_checked(self, other) } } +impl WrappingAdd for i8 { const fn wrapping_add(self, _ other: i8) -> i8 { __add_i8(self, other) } } +impl WrappingSub for i8 { const fn wrapping_sub(self, _ other: i8) -> i8 { __sub_i8(self, other) } } +impl WrappingMul for i8 { const fn wrapping_mul(self, _ other: i8) -> i8 { __mul_i8(self, other) } } +impl SaturatingAdd for i8 { const fn saturating_add(self, _ other: i8) -> i8 { __saturating_add(self, other) } } +impl SaturatingSub for i8 { const fn saturating_sub(self, _ other: i8) -> i8 { __saturating_sub(self, other) } } +impl SaturatingMul for i8 { const fn saturating_mul(self, _ other: i8) -> i8 { __saturating_mul(self, other) } } +impl Shl for i8 { const fn shl(own self, _ other: own i8) -> i8 { __shl_i8(self, other) } } +impl Shr for i8 { const fn shr(own self, _ other: own i8) -> i8 { __shr_i8(self, other) } } +impl BitAnd for i8 { const fn bitand(own self, _ other: own i8) -> i8 { __bitand_i8(self, other) } } +impl BitOr for i8 { const fn bitor(own self, _ other: own i8) -> i8 { __bitor_i8(self, other) } } +impl BitXor for i8 { const fn bitxor(own self, _ other: own i8) -> i8 { __bitxor_i8(self, other) } } impl Eq for i8 { - fn eq(self, _ other: i8) -> bool { __eq_i8(self, other) } - fn ne(self, _ other: i8) -> bool { __ne_i8(self, other) } + const fn eq(self, _ other: i8) -> bool { __eq_i8(self, other) } + const fn ne(self, _ other: i8) -> bool { __ne_i8(self, other) } } impl Ord for i8 { - fn lt(self, _ other: i8) -> bool { __lt_i8(self, other) } - fn le(self, _ other: i8) -> bool { __le_i8(self, other) } - fn gt(self, _ other: i8) -> bool { __gt_i8(self, other) } - fn ge(self, _ other: i8) -> bool { __ge_i8(self, other) } -} -impl AddAssign for i8 { fn add_assign(mut self, _ other: own i8) { self = self + other } } -impl SubAssign for i8 { fn sub_assign(mut self, _ other: own i8) { self = self - other } } -impl MulAssign for i8 { fn mul_assign(mut self, _ other: own i8) { self = self * other } } -impl DivAssign for i8 { fn div_assign(mut self, _ other: own i8) { self = self / other } } -impl RemAssign for i8 { fn rem_assign(mut self, _ other: own i8) { self = self % other } } -impl PowAssign for i8 { fn pow_assign(mut self, _ other: own i8) { self = self ** other } } -impl ShlAssign for i8 { fn shl_assign(mut self, _ other: own i8) { self = self << other } } -impl ShrAssign for i8 { fn shr_assign(mut self, _ other: own i8) { self = self >> other } } -impl BitAndAssign for i8 { fn bitand_assign(mut self, _ other: own i8) { self = self & other } } -impl BitOrAssign for i8 { fn bitor_assign(mut self, _ other: own i8) { self = self | other } } -impl BitXorAssign for i8 { fn bitxor_assign(mut self, _ other: own i8) { self = self ^ other } } + const fn lt(self, _ other: i8) -> bool { __lt_i8(self, other) } + const fn le(self, _ other: i8) -> bool { __le_i8(self, other) } + const fn gt(self, _ other: i8) -> bool { __gt_i8(self, other) } + const fn ge(self, _ other: i8) -> bool { __ge_i8(self, other) } +} +impl AddAssign for i8 { const fn add_assign(mut self, _ other: own i8) { self = self + other } } +impl SubAssign for i8 { const fn sub_assign(mut self, _ other: own i8) { self = self - other } } +impl MulAssign for i8 { const fn mul_assign(mut self, _ other: own i8) { self = self * other } } +impl DivAssign for i8 { const fn div_assign(mut self, _ other: own i8) { self = self / other } } +impl RemAssign for i8 { const fn rem_assign(mut self, _ other: own i8) { self = self % other } } +impl PowAssign for i8 { const fn pow_assign(mut self, _ other: own i8) { self = self ** other } } +impl ShlAssign for i8 { const fn shl_assign(mut self, _ other: own i8) { self = self << other } } +impl ShrAssign for i8 { const fn shr_assign(mut self, _ other: own i8) { self = self >> other } } +impl BitAndAssign for i8 { const fn bitand_assign(mut self, _ other: own i8) { self = self & other } } +impl BitOrAssign for i8 { const fn bitor_assign(mut self, _ other: own i8) { self = self | other } } +impl BitXorAssign for i8 { const fn bitxor_assign(mut self, _ other: own i8) { self = self ^ other } } impl Default for i8 { fn default() -> Self { 0 } } // i16 impls impl Neg for i16 { - fn neg(own self) -> i16 { + const fn neg(own self) -> i16 { __checked_neg(self) } } -impl BitNot for i16 { fn bit_not(own self) -> i16 { __bitnot_i16(self) } } -impl Not for i16 { fn not(own self) -> i16 { __bitnot_i16(self) } } +impl BitNot for i16 { const fn bit_not(own self) -> i16 { __bitnot_i16(self) } } +impl Not for i16 { const fn not(own self) -> i16 { __bitnot_i16(self) } } impl Add for i16 { - fn add(own self, _ other: own i16) -> i16 { + const fn add(own self, _ other: own i16) -> i16 { __checked_add(self, other) } } impl Sub for i16 { - fn sub(own self, _ other: own i16) -> i16 { + const fn sub(own self, _ other: own i16) -> i16 { __checked_sub(self, other) } } impl Mul for i16 { - fn mul(own self, _ other: own i16) -> i16 { + const fn mul(own self, _ other: own i16) -> i16 { __checked_mul(self, other) } } impl Div for i16 { - fn div(own self, _ other: own i16) -> i16 { + const fn div(own self, _ other: own i16) -> i16 { __checked_div(self, other) } } impl Rem for i16 { - fn rem(own self, _ other: own i16) -> i16 { + const fn rem(own self, _ other: own i16) -> i16 { __checked_rem(self, other) } } -impl Pow for i16 { fn pow(own self, _ other: own i16) -> i16 { pow_checked(self, other) } } -impl WrappingAdd for i16 { fn wrapping_add(self, _ other: i16) -> i16 { __add_i16(self, other) } } -impl WrappingSub for i16 { fn wrapping_sub(self, _ other: i16) -> i16 { __sub_i16(self, other) } } -impl WrappingMul for i16 { fn wrapping_mul(self, _ other: i16) -> i16 { __mul_i16(self, other) } } -impl SaturatingAdd for i16 { fn saturating_add(self, _ other: i16) -> i16 { __saturating_add(self, other) } } -impl SaturatingSub for i16 { fn saturating_sub(self, _ other: i16) -> i16 { __saturating_sub(self, other) } } -impl SaturatingMul for i16 { fn saturating_mul(self, _ other: i16) -> i16 { __saturating_mul(self, other) } } -impl Shl for i16 { fn shl(own self, _ other: own i16) -> i16 { __shl_i16(self, other) } } -impl Shr for i16 { fn shr(own self, _ other: own i16) -> i16 { __shr_i16(self, other) } } -impl BitAnd for i16 { fn bitand(own self, _ other: own i16) -> i16 { __bitand_i16(self, other) } } -impl BitOr for i16 { fn bitor(own self, _ other: own i16) -> i16 { __bitor_i16(self, other) } } -impl BitXor for i16 { fn bitxor(own self, _ other: own i16) -> i16 { __bitxor_i16(self, other) } } +impl Pow for i16 { const fn pow(own self, _ other: own i16) -> i16 { pow_checked(self, other) } } +impl WrappingAdd for i16 { const fn wrapping_add(self, _ other: i16) -> i16 { __add_i16(self, other) } } +impl WrappingSub for i16 { const fn wrapping_sub(self, _ other: i16) -> i16 { __sub_i16(self, other) } } +impl WrappingMul for i16 { const fn wrapping_mul(self, _ other: i16) -> i16 { __mul_i16(self, other) } } +impl SaturatingAdd for i16 { const fn saturating_add(self, _ other: i16) -> i16 { __saturating_add(self, other) } } +impl SaturatingSub for i16 { const fn saturating_sub(self, _ other: i16) -> i16 { __saturating_sub(self, other) } } +impl SaturatingMul for i16 { const fn saturating_mul(self, _ other: i16) -> i16 { __saturating_mul(self, other) } } +impl Shl for i16 { const fn shl(own self, _ other: own i16) -> i16 { __shl_i16(self, other) } } +impl Shr for i16 { const fn shr(own self, _ other: own i16) -> i16 { __shr_i16(self, other) } } +impl BitAnd for i16 { const fn bitand(own self, _ other: own i16) -> i16 { __bitand_i16(self, other) } } +impl BitOr for i16 { const fn bitor(own self, _ other: own i16) -> i16 { __bitor_i16(self, other) } } +impl BitXor for i16 { const fn bitxor(own self, _ other: own i16) -> i16 { __bitxor_i16(self, other) } } impl Eq for i16 { - fn eq(self, _ other: i16) -> bool { __eq_i16(self, other) } - fn ne(self, _ other: i16) -> bool { __ne_i16(self, other) } + const fn eq(self, _ other: i16) -> bool { __eq_i16(self, other) } + const fn ne(self, _ other: i16) -> bool { __ne_i16(self, other) } } impl Ord for i16 { - fn lt(self, _ other: i16) -> bool { __lt_i16(self, other) } - fn le(self, _ other: i16) -> bool { __le_i16(self, other) } - fn gt(self, _ other: i16) -> bool { __gt_i16(self, other) } - fn ge(self, _ other: i16) -> bool { __ge_i16(self, other) } -} -impl AddAssign for i16 { fn add_assign(mut self, _ other: own i16) { self = self + other } } -impl SubAssign for i16 { fn sub_assign(mut self, _ other: own i16) { self = self - other } } -impl MulAssign for i16 { fn mul_assign(mut self, _ other: own i16) { self = self * other } } -impl DivAssign for i16 { fn div_assign(mut self, _ other: own i16) { self = self / other } } -impl RemAssign for i16 { fn rem_assign(mut self, _ other: own i16) { self = self % other } } -impl PowAssign for i16 { fn pow_assign(mut self, _ other: own i16) { self = self ** other } } -impl ShlAssign for i16 { fn shl_assign(mut self, _ other: own i16) { self = self << other } } -impl ShrAssign for i16 { fn shr_assign(mut self, _ other: own i16) { self = self >> other } } -impl BitAndAssign for i16 { fn bitand_assign(mut self, _ other: own i16) { self = self & other } } -impl BitOrAssign for i16 { fn bitor_assign(mut self, _ other: own i16) { self = self | other } } -impl BitXorAssign for i16 { fn bitxor_assign(mut self, _ other: own i16) { self = self ^ other } } + const fn lt(self, _ other: i16) -> bool { __lt_i16(self, other) } + const fn le(self, _ other: i16) -> bool { __le_i16(self, other) } + const fn gt(self, _ other: i16) -> bool { __gt_i16(self, other) } + const fn ge(self, _ other: i16) -> bool { __ge_i16(self, other) } +} +impl AddAssign for i16 { const fn add_assign(mut self, _ other: own i16) { self = self + other } } +impl SubAssign for i16 { const fn sub_assign(mut self, _ other: own i16) { self = self - other } } +impl MulAssign for i16 { const fn mul_assign(mut self, _ other: own i16) { self = self * other } } +impl DivAssign for i16 { const fn div_assign(mut self, _ other: own i16) { self = self / other } } +impl RemAssign for i16 { const fn rem_assign(mut self, _ other: own i16) { self = self % other } } +impl PowAssign for i16 { const fn pow_assign(mut self, _ other: own i16) { self = self ** other } } +impl ShlAssign for i16 { const fn shl_assign(mut self, _ other: own i16) { self = self << other } } +impl ShrAssign for i16 { const fn shr_assign(mut self, _ other: own i16) { self = self >> other } } +impl BitAndAssign for i16 { const fn bitand_assign(mut self, _ other: own i16) { self = self & other } } +impl BitOrAssign for i16 { const fn bitor_assign(mut self, _ other: own i16) { self = self | other } } +impl BitXorAssign for i16 { const fn bitxor_assign(mut self, _ other: own i16) { self = self ^ other } } impl Default for i16 { fn default() -> Self { 0 } } // u16 impls -impl BitNot for u16 { fn bit_not(own self) -> u16 { __bitnot_u16(self) } } -impl Not for u16 { fn not(own self) -> u16 { __bitnot_u16(self) } } +impl BitNot for u16 { const fn bit_not(own self) -> u16 { __bitnot_u16(self) } } +impl Not for u16 { const fn not(own self) -> u16 { __bitnot_u16(self) } } impl Add for u16 { - fn add(own self, _ other: own u16) -> u16 { + const fn add(own self, _ other: own u16) -> u16 { __checked_add(self, other) } } impl Sub for u16 { - fn sub(own self, _ other: own u16) -> u16 { + const fn sub(own self, _ other: own u16) -> u16 { __checked_sub(self, other) } } impl Mul for u16 { - fn mul(own self, _ other: own u16) -> u16 { + const fn mul(own self, _ other: own u16) -> u16 { __checked_mul(self, other) } } impl Div for u16 { - fn div(own self, _ other: own u16) -> u16 { + const fn div(own self, _ other: own u16) -> u16 { __checked_div(self, other) } } impl Rem for u16 { - fn rem(own self, _ other: own u16) -> u16 { + const fn rem(own self, _ other: own u16) -> u16 { __checked_rem(self, other) } } -impl Pow for u16 { fn pow(own self, _ other: own u16) -> u16 { pow_checked(self, other) } } -impl WrappingAdd for u16 { fn wrapping_add(self, _ other: u16) -> u16 { __add_u16(self, other) } } -impl WrappingSub for u16 { fn wrapping_sub(self, _ other: u16) -> u16 { __sub_u16(self, other) } } -impl WrappingMul for u16 { fn wrapping_mul(self, _ other: u16) -> u16 { __mul_u16(self, other) } } -impl SaturatingAdd for u16 { fn saturating_add(self, _ other: u16) -> u16 { __saturating_add(self, other) } } -impl SaturatingSub for u16 { fn saturating_sub(self, _ other: u16) -> u16 { __saturating_sub(self, other) } } -impl SaturatingMul for u16 { fn saturating_mul(self, _ other: u16) -> u16 { __saturating_mul(self, other) } } -impl Shl for u16 { fn shl(own self, _ other: own u16) -> u16 { __shl_u16(self, other) } } -impl Shr for u16 { fn shr(own self, _ other: own u16) -> u16 { __shr_u16(self, other) } } -impl BitAnd for u16 { fn bitand(own self, _ other: own u16) -> u16 { __bitand_u16(self, other) } } -impl BitOr for u16 { fn bitor(own self, _ other: own u16) -> u16 { __bitor_u16(self, other) } } -impl BitXor for u16 { fn bitxor(own self, _ other: own u16) -> u16 { __bitxor_u16(self, other) } } +impl Pow for u16 { const fn pow(own self, _ other: own u16) -> u16 { pow_checked(self, other) } } +impl WrappingAdd for u16 { const fn wrapping_add(self, _ other: u16) -> u16 { __add_u16(self, other) } } +impl WrappingSub for u16 { const fn wrapping_sub(self, _ other: u16) -> u16 { __sub_u16(self, other) } } +impl WrappingMul for u16 { const fn wrapping_mul(self, _ other: u16) -> u16 { __mul_u16(self, other) } } +impl SaturatingAdd for u16 { const fn saturating_add(self, _ other: u16) -> u16 { __saturating_add(self, other) } } +impl SaturatingSub for u16 { const fn saturating_sub(self, _ other: u16) -> u16 { __saturating_sub(self, other) } } +impl SaturatingMul for u16 { const fn saturating_mul(self, _ other: u16) -> u16 { __saturating_mul(self, other) } } +impl Shl for u16 { const fn shl(own self, _ other: own u16) -> u16 { __shl_u16(self, other) } } +impl Shr for u16 { const fn shr(own self, _ other: own u16) -> u16 { __shr_u16(self, other) } } +impl BitAnd for u16 { const fn bitand(own self, _ other: own u16) -> u16 { __bitand_u16(self, other) } } +impl BitOr for u16 { const fn bitor(own self, _ other: own u16) -> u16 { __bitor_u16(self, other) } } +impl BitXor for u16 { const fn bitxor(own self, _ other: own u16) -> u16 { __bitxor_u16(self, other) } } impl Eq for u16 { - fn eq(self, _ other: u16) -> bool { __eq_u16(self, other) } - fn ne(self, _ other: u16) -> bool { __ne_u16(self, other) } + const fn eq(self, _ other: u16) -> bool { __eq_u16(self, other) } + const fn ne(self, _ other: u16) -> bool { __ne_u16(self, other) } } impl Ord for u16 { - fn lt(self, _ other: u16) -> bool { __lt_u16(self, other) } - fn le(self, _ other: u16) -> bool { __le_u16(self, other) } - fn gt(self, _ other: u16) -> bool { __gt_u16(self, other) } - fn ge(self, _ other: u16) -> bool { __ge_u16(self, other) } -} -impl AddAssign for u16 { fn add_assign(mut self, _ other: own u16) { self = self + other } } -impl SubAssign for u16 { fn sub_assign(mut self, _ other: own u16) { self = self - other } } -impl MulAssign for u16 { fn mul_assign(mut self, _ other: own u16) { self = self * other } } -impl DivAssign for u16 { fn div_assign(mut self, _ other: own u16) { self = self / other } } -impl RemAssign for u16 { fn rem_assign(mut self, _ other: own u16) { self = self % other } } -impl PowAssign for u16 { fn pow_assign(mut self, _ other: own u16) { self = self ** other } } -impl ShlAssign for u16 { fn shl_assign(mut self, _ other: own u16) { self = self << other } } -impl ShrAssign for u16 { fn shr_assign(mut self, _ other: own u16) { self = self >> other } } -impl BitAndAssign for u16 { fn bitand_assign(mut self, _ other: own u16) { self = self & other } } -impl BitOrAssign for u16 { fn bitor_assign(mut self, _ other: own u16) { self = self | other } } -impl BitXorAssign for u16 { fn bitxor_assign(mut self, _ other: own u16) { self = self ^ other } } + const fn lt(self, _ other: u16) -> bool { __lt_u16(self, other) } + const fn le(self, _ other: u16) -> bool { __le_u16(self, other) } + const fn gt(self, _ other: u16) -> bool { __gt_u16(self, other) } + const fn ge(self, _ other: u16) -> bool { __ge_u16(self, other) } +} +impl AddAssign for u16 { const fn add_assign(mut self, _ other: own u16) { self = self + other } } +impl SubAssign for u16 { const fn sub_assign(mut self, _ other: own u16) { self = self - other } } +impl MulAssign for u16 { const fn mul_assign(mut self, _ other: own u16) { self = self * other } } +impl DivAssign for u16 { const fn div_assign(mut self, _ other: own u16) { self = self / other } } +impl RemAssign for u16 { const fn rem_assign(mut self, _ other: own u16) { self = self % other } } +impl PowAssign for u16 { const fn pow_assign(mut self, _ other: own u16) { self = self ** other } } +impl ShlAssign for u16 { const fn shl_assign(mut self, _ other: own u16) { self = self << other } } +impl ShrAssign for u16 { const fn shr_assign(mut self, _ other: own u16) { self = self >> other } } +impl BitAndAssign for u16 { const fn bitand_assign(mut self, _ other: own u16) { self = self & other } } +impl BitOrAssign for u16 { const fn bitor_assign(mut self, _ other: own u16) { self = self | other } } +impl BitXorAssign for u16 { const fn bitxor_assign(mut self, _ other: own u16) { self = self ^ other } } impl Default for u16 { fn default() -> Self { 0 } } // i32 impls impl Neg for i32 { - fn neg(own self) -> i32 { + const fn neg(own self) -> i32 { __checked_neg(self) } } -impl BitNot for i32 { fn bit_not(own self) -> i32 { __bitnot_i32(self) } } -impl Not for i32 { fn not(own self) -> i32 { __bitnot_i32(self) } } +impl BitNot for i32 { const fn bit_not(own self) -> i32 { __bitnot_i32(self) } } +impl Not for i32 { const fn not(own self) -> i32 { __bitnot_i32(self) } } impl Add for i32 { - fn add(own self, _ other: own i32) -> i32 { + const fn add(own self, _ other: own i32) -> i32 { __checked_add(self, other) } } impl Sub for i32 { - fn sub(own self, _ other: own i32) -> i32 { + const fn sub(own self, _ other: own i32) -> i32 { __checked_sub(self, other) } } impl Mul for i32 { - fn mul(own self, _ other: own i32) -> i32 { + const fn mul(own self, _ other: own i32) -> i32 { __checked_mul(self, other) } } impl Div for i32 { - fn div(own self, _ other: own i32) -> i32 { + const fn div(own self, _ other: own i32) -> i32 { __checked_div(self, other) } } impl Rem for i32 { - fn rem(own self, _ other: own i32) -> i32 { + const fn rem(own self, _ other: own i32) -> i32 { __checked_rem(self, other) } } -impl Pow for i32 { fn pow(own self, _ other: own i32) -> i32 { pow_checked(self, other) } } -impl WrappingAdd for i32 { fn wrapping_add(self, _ other: i32) -> i32 { __add_i32(self, other) } } -impl WrappingSub for i32 { fn wrapping_sub(self, _ other: i32) -> i32 { __sub_i32(self, other) } } -impl WrappingMul for i32 { fn wrapping_mul(self, _ other: i32) -> i32 { __mul_i32(self, other) } } -impl SaturatingAdd for i32 { fn saturating_add(self, _ other: i32) -> i32 { __saturating_add(self, other) } } -impl SaturatingSub for i32 { fn saturating_sub(self, _ other: i32) -> i32 { __saturating_sub(self, other) } } -impl SaturatingMul for i32 { fn saturating_mul(self, _ other: i32) -> i32 { __saturating_mul(self, other) } } -impl Shl for i32 { fn shl(own self, _ other: own i32) -> i32 { __shl_i32(self, other) } } -impl Shr for i32 { fn shr(own self, _ other: own i32) -> i32 { __shr_i32(self, other) } } -impl BitAnd for i32 { fn bitand(own self, _ other: own i32) -> i32 { __bitand_i32(self, other) } } -impl BitOr for i32 { fn bitor(own self, _ other: own i32) -> i32 { __bitor_i32(self, other) } } -impl BitXor for i32 { fn bitxor(own self, _ other: own i32) -> i32 { __bitxor_i32(self, other) } } +impl Pow for i32 { const fn pow(own self, _ other: own i32) -> i32 { pow_checked(self, other) } } +impl WrappingAdd for i32 { const fn wrapping_add(self, _ other: i32) -> i32 { __add_i32(self, other) } } +impl WrappingSub for i32 { const fn wrapping_sub(self, _ other: i32) -> i32 { __sub_i32(self, other) } } +impl WrappingMul for i32 { const fn wrapping_mul(self, _ other: i32) -> i32 { __mul_i32(self, other) } } +impl SaturatingAdd for i32 { const fn saturating_add(self, _ other: i32) -> i32 { __saturating_add(self, other) } } +impl SaturatingSub for i32 { const fn saturating_sub(self, _ other: i32) -> i32 { __saturating_sub(self, other) } } +impl SaturatingMul for i32 { const fn saturating_mul(self, _ other: i32) -> i32 { __saturating_mul(self, other) } } +impl Shl for i32 { const fn shl(own self, _ other: own i32) -> i32 { __shl_i32(self, other) } } +impl Shr for i32 { const fn shr(own self, _ other: own i32) -> i32 { __shr_i32(self, other) } } +impl BitAnd for i32 { const fn bitand(own self, _ other: own i32) -> i32 { __bitand_i32(self, other) } } +impl BitOr for i32 { const fn bitor(own self, _ other: own i32) -> i32 { __bitor_i32(self, other) } } +impl BitXor for i32 { const fn bitxor(own self, _ other: own i32) -> i32 { __bitxor_i32(self, other) } } impl Eq for i32 { - fn eq(self, _ other: i32) -> bool { __eq_i32(self, other) } - fn ne(self, _ other: i32) -> bool { __ne_i32(self, other) } + const fn eq(self, _ other: i32) -> bool { __eq_i32(self, other) } + const fn ne(self, _ other: i32) -> bool { __ne_i32(self, other) } } impl Ord for i32 { - fn lt(self, _ other: i32) -> bool { __lt_i32(self, other) } - fn le(self, _ other: i32) -> bool { __le_i32(self, other) } - fn gt(self, _ other: i32) -> bool { __gt_i32(self, other) } - fn ge(self, _ other: i32) -> bool { __ge_i32(self, other) } -} -impl AddAssign for i32 { fn add_assign(mut self, _ other: own i32) { self = self + other } } -impl SubAssign for i32 { fn sub_assign(mut self, _ other: own i32) { self = self - other } } -impl MulAssign for i32 { fn mul_assign(mut self, _ other: own i32) { self = self * other } } -impl DivAssign for i32 { fn div_assign(mut self, _ other: own i32) { self = self / other } } -impl RemAssign for i32 { fn rem_assign(mut self, _ other: own i32) { self = self % other } } -impl PowAssign for i32 { fn pow_assign(mut self, _ other: own i32) { self = self ** other } } -impl ShlAssign for i32 { fn shl_assign(mut self, _ other: own i32) { self = self << other } } -impl ShrAssign for i32 { fn shr_assign(mut self, _ other: own i32) { self = self >> other } } -impl BitAndAssign for i32 { fn bitand_assign(mut self, _ other: own i32) { self = self & other } } -impl BitOrAssign for i32 { fn bitor_assign(mut self, _ other: own i32) { self = self | other } } -impl BitXorAssign for i32 { fn bitxor_assign(mut self, _ other: own i32) { self = self ^ other } } + const fn lt(self, _ other: i32) -> bool { __lt_i32(self, other) } + const fn le(self, _ other: i32) -> bool { __le_i32(self, other) } + const fn gt(self, _ other: i32) -> bool { __gt_i32(self, other) } + const fn ge(self, _ other: i32) -> bool { __ge_i32(self, other) } +} +impl AddAssign for i32 { const fn add_assign(mut self, _ other: own i32) { self = self + other } } +impl SubAssign for i32 { const fn sub_assign(mut self, _ other: own i32) { self = self - other } } +impl MulAssign for i32 { const fn mul_assign(mut self, _ other: own i32) { self = self * other } } +impl DivAssign for i32 { const fn div_assign(mut self, _ other: own i32) { self = self / other } } +impl RemAssign for i32 { const fn rem_assign(mut self, _ other: own i32) { self = self % other } } +impl PowAssign for i32 { const fn pow_assign(mut self, _ other: own i32) { self = self ** other } } +impl ShlAssign for i32 { const fn shl_assign(mut self, _ other: own i32) { self = self << other } } +impl ShrAssign for i32 { const fn shr_assign(mut self, _ other: own i32) { self = self >> other } } +impl BitAndAssign for i32 { const fn bitand_assign(mut self, _ other: own i32) { self = self & other } } +impl BitOrAssign for i32 { const fn bitor_assign(mut self, _ other: own i32) { self = self | other } } +impl BitXorAssign for i32 { const fn bitxor_assign(mut self, _ other: own i32) { self = self ^ other } } impl Default for i32 { fn default() -> Self { 0 } } // u32 impls -impl BitNot for u32 { fn bit_not(own self) -> u32 { __bitnot_u32(self) } } -impl Not for u32 { fn not(own self) -> u32 { __bitnot_u32(self) } } +impl BitNot for u32 { const fn bit_not(own self) -> u32 { __bitnot_u32(self) } } +impl Not for u32 { const fn not(own self) -> u32 { __bitnot_u32(self) } } impl Add for u32 { - fn add(own self, _ other: own u32) -> u32 { + const fn add(own self, _ other: own u32) -> u32 { __checked_add(self, other) } } impl Sub for u32 { - fn sub(own self, _ other: own u32) -> u32 { + const fn sub(own self, _ other: own u32) -> u32 { __checked_sub(self, other) } } impl Mul for u32 { - fn mul(own self, _ other: own u32) -> u32 { + const fn mul(own self, _ other: own u32) -> u32 { __checked_mul(self, other) } } impl Div for u32 { - fn div(own self, _ other: own u32) -> u32 { + const fn div(own self, _ other: own u32) -> u32 { __checked_div(self, other) } } impl Rem for u32 { - fn rem(own self, _ other: own u32) -> u32 { + const fn rem(own self, _ other: own u32) -> u32 { __checked_rem(self, other) } } -impl Pow for u32 { fn pow(own self, _ other: own u32) -> u32 { pow_checked(self, other) } } -impl WrappingAdd for u32 { fn wrapping_add(self, _ other: u32) -> u32 { __add_u32(self, other) } } -impl WrappingSub for u32 { fn wrapping_sub(self, _ other: u32) -> u32 { __sub_u32(self, other) } } -impl WrappingMul for u32 { fn wrapping_mul(self, _ other: u32) -> u32 { __mul_u32(self, other) } } -impl SaturatingAdd for u32 { fn saturating_add(self, _ other: u32) -> u32 { __saturating_add(self, other) } } -impl SaturatingSub for u32 { fn saturating_sub(self, _ other: u32) -> u32 { __saturating_sub(self, other) } } -impl SaturatingMul for u32 { fn saturating_mul(self, _ other: u32) -> u32 { __saturating_mul(self, other) } } -impl Shl for u32 { fn shl(own self, _ other: own u32) -> u32 { __shl_u32(self, other) } } -impl Shr for u32 { fn shr(own self, _ other: own u32) -> u32 { __shr_u32(self, other) } } -impl BitAnd for u32 { fn bitand(own self, _ other: own u32) -> u32 { __bitand_u32(self, other) } } -impl BitOr for u32 { fn bitor(own self, _ other: own u32) -> u32 { __bitor_u32(self, other) } } -impl BitXor for u32 { fn bitxor(own self, _ other: own u32) -> u32 { __bitxor_u32(self, other) } } +impl Pow for u32 { const fn pow(own self, _ other: own u32) -> u32 { pow_checked(self, other) } } +impl WrappingAdd for u32 { const fn wrapping_add(self, _ other: u32) -> u32 { __add_u32(self, other) } } +impl WrappingSub for u32 { const fn wrapping_sub(self, _ other: u32) -> u32 { __sub_u32(self, other) } } +impl WrappingMul for u32 { const fn wrapping_mul(self, _ other: u32) -> u32 { __mul_u32(self, other) } } +impl SaturatingAdd for u32 { const fn saturating_add(self, _ other: u32) -> u32 { __saturating_add(self, other) } } +impl SaturatingSub for u32 { const fn saturating_sub(self, _ other: u32) -> u32 { __saturating_sub(self, other) } } +impl SaturatingMul for u32 { const fn saturating_mul(self, _ other: u32) -> u32 { __saturating_mul(self, other) } } +impl Shl for u32 { const fn shl(own self, _ other: own u32) -> u32 { __shl_u32(self, other) } } +impl Shr for u32 { const fn shr(own self, _ other: own u32) -> u32 { __shr_u32(self, other) } } +impl BitAnd for u32 { const fn bitand(own self, _ other: own u32) -> u32 { __bitand_u32(self, other) } } +impl BitOr for u32 { const fn bitor(own self, _ other: own u32) -> u32 { __bitor_u32(self, other) } } +impl BitXor for u32 { const fn bitxor(own self, _ other: own u32) -> u32 { __bitxor_u32(self, other) } } impl Eq for u32 { - fn eq(self, _ other: u32) -> bool { __eq_u32(self, other) } - fn ne(self, _ other: u32) -> bool { __ne_u32(self, other) } + const fn eq(self, _ other: u32) -> bool { __eq_u32(self, other) } + const fn ne(self, _ other: u32) -> bool { __ne_u32(self, other) } } impl Ord for u32 { - fn lt(self, _ other: u32) -> bool { __lt_u32(self, other) } - fn le(self, _ other: u32) -> bool { __le_u32(self, other) } - fn gt(self, _ other: u32) -> bool { __gt_u32(self, other) } - fn ge(self, _ other: u32) -> bool { __ge_u32(self, other) } -} -impl AddAssign for u32 { fn add_assign(mut self, _ other: own u32) { self = self + other } } -impl SubAssign for u32 { fn sub_assign(mut self, _ other: own u32) { self = self - other } } -impl MulAssign for u32 { fn mul_assign(mut self, _ other: own u32) { self = self * other } } -impl DivAssign for u32 { fn div_assign(mut self, _ other: own u32) { self = self / other } } -impl RemAssign for u32 { fn rem_assign(mut self, _ other: own u32) { self = self % other } } -impl PowAssign for u32 { fn pow_assign(mut self, _ other: own u32) { self = self ** other } } -impl ShlAssign for u32 { fn shl_assign(mut self, _ other: own u32) { self = self << other } } -impl ShrAssign for u32 { fn shr_assign(mut self, _ other: own u32) { self = self >> other } } -impl BitAndAssign for u32 { fn bitand_assign(mut self, _ other: own u32) { self = self & other } } -impl BitOrAssign for u32 { fn bitor_assign(mut self, _ other: own u32) { self = self | other } } -impl BitXorAssign for u32 { fn bitxor_assign(mut self, _ other: own u32) { self = self ^ other } } + const fn lt(self, _ other: u32) -> bool { __lt_u32(self, other) } + const fn le(self, _ other: u32) -> bool { __le_u32(self, other) } + const fn gt(self, _ other: u32) -> bool { __gt_u32(self, other) } + const fn ge(self, _ other: u32) -> bool { __ge_u32(self, other) } +} +impl AddAssign for u32 { const fn add_assign(mut self, _ other: own u32) { self = self + other } } +impl SubAssign for u32 { const fn sub_assign(mut self, _ other: own u32) { self = self - other } } +impl MulAssign for u32 { const fn mul_assign(mut self, _ other: own u32) { self = self * other } } +impl DivAssign for u32 { const fn div_assign(mut self, _ other: own u32) { self = self / other } } +impl RemAssign for u32 { const fn rem_assign(mut self, _ other: own u32) { self = self % other } } +impl PowAssign for u32 { const fn pow_assign(mut self, _ other: own u32) { self = self ** other } } +impl ShlAssign for u32 { const fn shl_assign(mut self, _ other: own u32) { self = self << other } } +impl ShrAssign for u32 { const fn shr_assign(mut self, _ other: own u32) { self = self >> other } } +impl BitAndAssign for u32 { const fn bitand_assign(mut self, _ other: own u32) { self = self & other } } +impl BitOrAssign for u32 { const fn bitor_assign(mut self, _ other: own u32) { self = self | other } } +impl BitXorAssign for u32 { const fn bitxor_assign(mut self, _ other: own u32) { self = self ^ other } } impl Default for u32 { fn default() -> Self { 0 } } // i64 impls impl Neg for i64 { - fn neg(own self) -> i64 { + const fn neg(own self) -> i64 { __checked_neg(self) } } -impl BitNot for i64 { fn bit_not(own self) -> i64 { __bitnot_i64(self) } } -impl Not for i64 { fn not(own self) -> i64 { __bitnot_i64(self) } } +impl BitNot for i64 { const fn bit_not(own self) -> i64 { __bitnot_i64(self) } } +impl Not for i64 { const fn not(own self) -> i64 { __bitnot_i64(self) } } impl Add for i64 { - fn add(own self, _ other: own i64) -> i64 { + const fn add(own self, _ other: own i64) -> i64 { __checked_add(self, other) } } impl Sub for i64 { - fn sub(own self, _ other: own i64) -> i64 { + const fn sub(own self, _ other: own i64) -> i64 { __checked_sub(self, other) } } impl Mul for i64 { - fn mul(own self, _ other: own i64) -> i64 { + const fn mul(own self, _ other: own i64) -> i64 { __checked_mul(self, other) } } impl Div for i64 { - fn div(own self, _ other: own i64) -> i64 { + const fn div(own self, _ other: own i64) -> i64 { __checked_div(self, other) } } impl Rem for i64 { - fn rem(own self, _ other: own i64) -> i64 { + const fn rem(own self, _ other: own i64) -> i64 { __checked_rem(self, other) } } -impl Pow for i64 { fn pow(own self, _ other: own i64) -> i64 { pow_checked(self, other) } } -impl WrappingAdd for i64 { fn wrapping_add(self, _ other: i64) -> i64 { __add_i64(self, other) } } -impl WrappingSub for i64 { fn wrapping_sub(self, _ other: i64) -> i64 { __sub_i64(self, other) } } -impl WrappingMul for i64 { fn wrapping_mul(self, _ other: i64) -> i64 { __mul_i64(self, other) } } -impl SaturatingAdd for i64 { fn saturating_add(self, _ other: i64) -> i64 { __saturating_add(self, other) } } -impl SaturatingSub for i64 { fn saturating_sub(self, _ other: i64) -> i64 { __saturating_sub(self, other) } } -impl SaturatingMul for i64 { fn saturating_mul(self, _ other: i64) -> i64 { __saturating_mul(self, other) } } -impl Shl for i64 { fn shl(own self, _ other: own i64) -> i64 { __shl_i64(self, other) } } -impl Shr for i64 { fn shr(own self, _ other: own i64) -> i64 { __shr_i64(self, other) } } -impl BitAnd for i64 { fn bitand(own self, _ other: own i64) -> i64 { __bitand_i64(self, other) } } -impl BitOr for i64 { fn bitor(own self, _ other: own i64) -> i64 { __bitor_i64(self, other) } } -impl BitXor for i64 { fn bitxor(own self, _ other: own i64) -> i64 { __bitxor_i64(self, other) } } +impl Pow for i64 { const fn pow(own self, _ other: own i64) -> i64 { pow_checked(self, other) } } +impl WrappingAdd for i64 { const fn wrapping_add(self, _ other: i64) -> i64 { __add_i64(self, other) } } +impl WrappingSub for i64 { const fn wrapping_sub(self, _ other: i64) -> i64 { __sub_i64(self, other) } } +impl WrappingMul for i64 { const fn wrapping_mul(self, _ other: i64) -> i64 { __mul_i64(self, other) } } +impl SaturatingAdd for i64 { const fn saturating_add(self, _ other: i64) -> i64 { __saturating_add(self, other) } } +impl SaturatingSub for i64 { const fn saturating_sub(self, _ other: i64) -> i64 { __saturating_sub(self, other) } } +impl SaturatingMul for i64 { const fn saturating_mul(self, _ other: i64) -> i64 { __saturating_mul(self, other) } } +impl Shl for i64 { const fn shl(own self, _ other: own i64) -> i64 { __shl_i64(self, other) } } +impl Shr for i64 { const fn shr(own self, _ other: own i64) -> i64 { __shr_i64(self, other) } } +impl BitAnd for i64 { const fn bitand(own self, _ other: own i64) -> i64 { __bitand_i64(self, other) } } +impl BitOr for i64 { const fn bitor(own self, _ other: own i64) -> i64 { __bitor_i64(self, other) } } +impl BitXor for i64 { const fn bitxor(own self, _ other: own i64) -> i64 { __bitxor_i64(self, other) } } impl Eq for i64 { - fn eq(self, _ other: i64) -> bool { __eq_i64(self, other) } - fn ne(self, _ other: i64) -> bool { __ne_i64(self, other) } + const fn eq(self, _ other: i64) -> bool { __eq_i64(self, other) } + const fn ne(self, _ other: i64) -> bool { __ne_i64(self, other) } } impl Ord for i64 { - fn lt(self, _ other: i64) -> bool { __lt_i64(self, other) } - fn le(self, _ other: i64) -> bool { __le_i64(self, other) } - fn gt(self, _ other: i64) -> bool { __gt_i64(self, other) } - fn ge(self, _ other: i64) -> bool { __ge_i64(self, other) } -} -impl AddAssign for i64 { fn add_assign(mut self, _ other: own i64) { self = self + other } } -impl SubAssign for i64 { fn sub_assign(mut self, _ other: own i64) { self = self - other } } -impl MulAssign for i64 { fn mul_assign(mut self, _ other: own i64) { self = self * other } } -impl DivAssign for i64 { fn div_assign(mut self, _ other: own i64) { self = self / other } } -impl RemAssign for i64 { fn rem_assign(mut self, _ other: own i64) { self = self % other } } -impl PowAssign for i64 { fn pow_assign(mut self, _ other: own i64) { self = self ** other } } -impl ShlAssign for i64 { fn shl_assign(mut self, _ other: own i64) { self = self << other } } -impl ShrAssign for i64 { fn shr_assign(mut self, _ other: own i64) { self = self >> other } } -impl BitAndAssign for i64 { fn bitand_assign(mut self, _ other: own i64) { self = self & other } } -impl BitOrAssign for i64 { fn bitor_assign(mut self, _ other: own i64) { self = self | other } } -impl BitXorAssign for i64 { fn bitxor_assign(mut self, _ other: own i64) { self = self ^ other } } + const fn lt(self, _ other: i64) -> bool { __lt_i64(self, other) } + const fn le(self, _ other: i64) -> bool { __le_i64(self, other) } + const fn gt(self, _ other: i64) -> bool { __gt_i64(self, other) } + const fn ge(self, _ other: i64) -> bool { __ge_i64(self, other) } +} +impl AddAssign for i64 { const fn add_assign(mut self, _ other: own i64) { self = self + other } } +impl SubAssign for i64 { const fn sub_assign(mut self, _ other: own i64) { self = self - other } } +impl MulAssign for i64 { const fn mul_assign(mut self, _ other: own i64) { self = self * other } } +impl DivAssign for i64 { const fn div_assign(mut self, _ other: own i64) { self = self / other } } +impl RemAssign for i64 { const fn rem_assign(mut self, _ other: own i64) { self = self % other } } +impl PowAssign for i64 { const fn pow_assign(mut self, _ other: own i64) { self = self ** other } } +impl ShlAssign for i64 { const fn shl_assign(mut self, _ other: own i64) { self = self << other } } +impl ShrAssign for i64 { const fn shr_assign(mut self, _ other: own i64) { self = self >> other } } +impl BitAndAssign for i64 { const fn bitand_assign(mut self, _ other: own i64) { self = self & other } } +impl BitOrAssign for i64 { const fn bitor_assign(mut self, _ other: own i64) { self = self | other } } +impl BitXorAssign for i64 { const fn bitxor_assign(mut self, _ other: own i64) { self = self ^ other } } impl Default for i64 { fn default() -> Self { 0 } } // i128 impls impl Neg for i128 { - fn neg(own self) -> i128 { + const fn neg(own self) -> i128 { __checked_neg(self) } } -impl BitNot for i128 { fn bit_not(own self) -> i128 { __bitnot_i128(self) } } -impl Not for i128 { fn not(own self) -> i128 { __bitnot_i128(self) } } +impl BitNot for i128 { const fn bit_not(own self) -> i128 { __bitnot_i128(self) } } +impl Not for i128 { const fn not(own self) -> i128 { __bitnot_i128(self) } } impl Add for i128 { - fn add(own self, _ other: own i128) -> i128 { + const fn add(own self, _ other: own i128) -> i128 { __checked_add(self, other) } } impl Sub for i128 { - fn sub(own self, _ other: own i128) -> i128 { + const fn sub(own self, _ other: own i128) -> i128 { __checked_sub(self, other) } } impl Mul for i128 { - fn mul(own self, _ other: own i128) -> i128 { + const fn mul(own self, _ other: own i128) -> i128 { __checked_mul(self, other) } } impl Div for i128 { - fn div(own self, _ other: own i128) -> i128 { + const fn div(own self, _ other: own i128) -> i128 { __checked_div(self, other) } } impl Rem for i128 { - fn rem(own self, _ other: own i128) -> i128 { + const fn rem(own self, _ other: own i128) -> i128 { __checked_rem(self, other) } } -impl Pow for i128 { fn pow(own self, _ other: own i128) -> i128 { pow_checked(self, other) } } -impl WrappingAdd for i128 { fn wrapping_add(self, _ other: i128) -> i128 { __add_i128(self, other) } } -impl WrappingSub for i128 { fn wrapping_sub(self, _ other: i128) -> i128 { __sub_i128(self, other) } } -impl WrappingMul for i128 { fn wrapping_mul(self, _ other: i128) -> i128 { __mul_i128(self, other) } } -impl SaturatingAdd for i128 { fn saturating_add(self, _ other: i128) -> i128 { __saturating_add(self, other) } } -impl SaturatingSub for i128 { fn saturating_sub(self, _ other: i128) -> i128 { __saturating_sub(self, other) } } -impl SaturatingMul for i128 { fn saturating_mul(self, _ other: i128) -> i128 { __saturating_mul(self, other) } } -impl Shl for i128 { fn shl(own self, _ other: own i128) -> i128 { __shl_i128(self, other) } } -impl Shr for i128 { fn shr(own self, _ other: own i128) -> i128 { __shr_i128(self, other) } } -impl BitAnd for i128 { fn bitand(own self, _ other: own i128) -> i128 { __bitand_i128(self, other) } } -impl BitOr for i128 { fn bitor(own self, _ other: own i128) -> i128 { __bitor_i128(self, other) } } -impl BitXor for i128 { fn bitxor(own self, _ other: own i128) -> i128 { __bitxor_i128(self, other) } } +impl Pow for i128 { const fn pow(own self, _ other: own i128) -> i128 { pow_checked(self, other) } } +impl WrappingAdd for i128 { const fn wrapping_add(self, _ other: i128) -> i128 { __add_i128(self, other) } } +impl WrappingSub for i128 { const fn wrapping_sub(self, _ other: i128) -> i128 { __sub_i128(self, other) } } +impl WrappingMul for i128 { const fn wrapping_mul(self, _ other: i128) -> i128 { __mul_i128(self, other) } } +impl SaturatingAdd for i128 { const fn saturating_add(self, _ other: i128) -> i128 { __saturating_add(self, other) } } +impl SaturatingSub for i128 { const fn saturating_sub(self, _ other: i128) -> i128 { __saturating_sub(self, other) } } +impl SaturatingMul for i128 { const fn saturating_mul(self, _ other: i128) -> i128 { __saturating_mul(self, other) } } +impl Shl for i128 { const fn shl(own self, _ other: own i128) -> i128 { __shl_i128(self, other) } } +impl Shr for i128 { const fn shr(own self, _ other: own i128) -> i128 { __shr_i128(self, other) } } +impl BitAnd for i128 { const fn bitand(own self, _ other: own i128) -> i128 { __bitand_i128(self, other) } } +impl BitOr for i128 { const fn bitor(own self, _ other: own i128) -> i128 { __bitor_i128(self, other) } } +impl BitXor for i128 { const fn bitxor(own self, _ other: own i128) -> i128 { __bitxor_i128(self, other) } } impl Eq for i128 { - fn eq(self, _ other: i128) -> bool { __eq_i128(self, other) } - fn ne(self, _ other: i128) -> bool { __ne_i128(self, other) } + const fn eq(self, _ other: i128) -> bool { __eq_i128(self, other) } + const fn ne(self, _ other: i128) -> bool { __ne_i128(self, other) } } impl Ord for i128 { - fn lt(self, _ other: i128) -> bool { __lt_i128(self, other) } - fn le(self, _ other: i128) -> bool { __le_i128(self, other) } - fn gt(self, _ other: i128) -> bool { __gt_i128(self, other) } - fn ge(self, _ other: i128) -> bool { __ge_i128(self, other) } -} -impl AddAssign for i128 { fn add_assign(mut self, _ other: own i128) { self = self + other } } -impl SubAssign for i128 { fn sub_assign(mut self, _ other: own i128) { self = self - other } } -impl MulAssign for i128 { fn mul_assign(mut self, _ other: own i128) { self = self * other } } -impl DivAssign for i128 { fn div_assign(mut self, _ other: own i128) { self = self / other } } -impl RemAssign for i128 { fn rem_assign(mut self, _ other: own i128) { self = self % other } } -impl PowAssign for i128 { fn pow_assign(mut self, _ other: own i128) { self = self ** other } } -impl ShlAssign for i128 { fn shl_assign(mut self, _ other: own i128) { self = self << other } } -impl ShrAssign for i128 { fn shr_assign(mut self, _ other: own i128) { self = self >> other } } -impl BitAndAssign for i128 { fn bitand_assign(mut self, _ other: own i128) { self = self & other } } -impl BitOrAssign for i128 { fn bitor_assign(mut self, _ other: own i128) { self = self | other } } -impl BitXorAssign for i128 { fn bitxor_assign(mut self, _ other: own i128) { self = self ^ other } } + const fn lt(self, _ other: i128) -> bool { __lt_i128(self, other) } + const fn le(self, _ other: i128) -> bool { __le_i128(self, other) } + const fn gt(self, _ other: i128) -> bool { __gt_i128(self, other) } + const fn ge(self, _ other: i128) -> bool { __ge_i128(self, other) } +} +impl AddAssign for i128 { const fn add_assign(mut self, _ other: own i128) { self = self + other } } +impl SubAssign for i128 { const fn sub_assign(mut self, _ other: own i128) { self = self - other } } +impl MulAssign for i128 { const fn mul_assign(mut self, _ other: own i128) { self = self * other } } +impl DivAssign for i128 { const fn div_assign(mut self, _ other: own i128) { self = self / other } } +impl RemAssign for i128 { const fn rem_assign(mut self, _ other: own i128) { self = self % other } } +impl PowAssign for i128 { const fn pow_assign(mut self, _ other: own i128) { self = self ** other } } +impl ShlAssign for i128 { const fn shl_assign(mut self, _ other: own i128) { self = self << other } } +impl ShrAssign for i128 { const fn shr_assign(mut self, _ other: own i128) { self = self >> other } } +impl BitAndAssign for i128 { const fn bitand_assign(mut self, _ other: own i128) { self = self & other } } +impl BitOrAssign for i128 { const fn bitor_assign(mut self, _ other: own i128) { self = self | other } } +impl BitXorAssign for i128 { const fn bitxor_assign(mut self, _ other: own i128) { self = self ^ other } } impl Default for i128 { fn default() -> Self { 0 } } // u64 impls -impl BitNot for u64 { fn bit_not(own self) -> u64 { __bitnot_u64(self) } } -impl Not for u64 { fn not(own self) -> u64 { __bitnot_u64(self) } } +impl BitNot for u64 { const fn bit_not(own self) -> u64 { __bitnot_u64(self) } } +impl Not for u64 { const fn not(own self) -> u64 { __bitnot_u64(self) } } impl Add for u64 { - fn add(own self, _ other: own u64) -> u64 { + const fn add(own self, _ other: own u64) -> u64 { __checked_add(self, other) } } impl Sub for u64 { - fn sub(own self, _ other: own u64) -> u64 { + const fn sub(own self, _ other: own u64) -> u64 { __checked_sub(self, other) } } impl Mul for u64 { - fn mul(own self, _ other: own u64) -> u64 { + const fn mul(own self, _ other: own u64) -> u64 { __checked_mul(self, other) } } impl Div for u64 { - fn div(own self, _ other: own u64) -> u64 { + const fn div(own self, _ other: own u64) -> u64 { __checked_div(self, other) } } impl Rem for u64 { - fn rem(own self, _ other: own u64) -> u64 { + const fn rem(own self, _ other: own u64) -> u64 { __checked_rem(self, other) } } -impl Pow for u64 { fn pow(own self, _ other: own u64) -> u64 { pow_checked(self, other) } } -impl WrappingAdd for u64 { fn wrapping_add(self, _ other: u64) -> u64 { __add_u64(self, other) } } -impl WrappingSub for u64 { fn wrapping_sub(self, _ other: u64) -> u64 { __sub_u64(self, other) } } -impl WrappingMul for u64 { fn wrapping_mul(self, _ other: u64) -> u64 { __mul_u64(self, other) } } -impl SaturatingAdd for u64 { fn saturating_add(self, _ other: u64) -> u64 { __saturating_add(self, other) } } -impl SaturatingSub for u64 { fn saturating_sub(self, _ other: u64) -> u64 { __saturating_sub(self, other) } } -impl SaturatingMul for u64 { fn saturating_mul(self, _ other: u64) -> u64 { __saturating_mul(self, other) } } -impl Shl for u64 { fn shl(own self, _ other: own u64) -> u64 { __shl_u64(self, other) } } -impl Shr for u64 { fn shr(own self, _ other: own u64) -> u64 { __shr_u64(self, other) } } -impl BitAnd for u64 { fn bitand(own self, _ other: own u64) -> u64 { __bitand_u64(self, other) } } -impl BitOr for u64 { fn bitor(own self, _ other: own u64) -> u64 { __bitor_u64(self, other) } } -impl BitXor for u64 { fn bitxor(own self, _ other: own u64) -> u64 { __bitxor_u64(self, other) } } +impl Pow for u64 { const fn pow(own self, _ other: own u64) -> u64 { pow_checked(self, other) } } +impl WrappingAdd for u64 { const fn wrapping_add(self, _ other: u64) -> u64 { __add_u64(self, other) } } +impl WrappingSub for u64 { const fn wrapping_sub(self, _ other: u64) -> u64 { __sub_u64(self, other) } } +impl WrappingMul for u64 { const fn wrapping_mul(self, _ other: u64) -> u64 { __mul_u64(self, other) } } +impl SaturatingAdd for u64 { const fn saturating_add(self, _ other: u64) -> u64 { __saturating_add(self, other) } } +impl SaturatingSub for u64 { const fn saturating_sub(self, _ other: u64) -> u64 { __saturating_sub(self, other) } } +impl SaturatingMul for u64 { const fn saturating_mul(self, _ other: u64) -> u64 { __saturating_mul(self, other) } } +impl Shl for u64 { const fn shl(own self, _ other: own u64) -> u64 { __shl_u64(self, other) } } +impl Shr for u64 { const fn shr(own self, _ other: own u64) -> u64 { __shr_u64(self, other) } } +impl BitAnd for u64 { const fn bitand(own self, _ other: own u64) -> u64 { __bitand_u64(self, other) } } +impl BitOr for u64 { const fn bitor(own self, _ other: own u64) -> u64 { __bitor_u64(self, other) } } +impl BitXor for u64 { const fn bitxor(own self, _ other: own u64) -> u64 { __bitxor_u64(self, other) } } impl Eq for u64 { - fn eq(self, _ other: u64) -> bool { __eq_u64(self, other) } - fn ne(self, _ other: u64) -> bool { __ne_u64(self, other) } + const fn eq(self, _ other: u64) -> bool { __eq_u64(self, other) } + const fn ne(self, _ other: u64) -> bool { __ne_u64(self, other) } } impl Ord for u64 { - fn lt(self, _ other: u64) -> bool { __lt_u64(self, other) } - fn le(self, _ other: u64) -> bool { __le_u64(self, other) } - fn gt(self, _ other: u64) -> bool { __gt_u64(self, other) } - fn ge(self, _ other: u64) -> bool { __ge_u64(self, other) } -} -impl AddAssign for u64 { fn add_assign(mut self, _ other: own u64) { self = self + other } } -impl SubAssign for u64 { fn sub_assign(mut self, _ other: own u64) { self = self - other } } -impl MulAssign for u64 { fn mul_assign(mut self, _ other: own u64) { self = self * other } } -impl DivAssign for u64 { fn div_assign(mut self, _ other: own u64) { self = self / other } } -impl RemAssign for u64 { fn rem_assign(mut self, _ other: own u64) { self = self % other } } -impl PowAssign for u64 { fn pow_assign(mut self, _ other: own u64) { self = self ** other } } -impl ShlAssign for u64 { fn shl_assign(mut self, _ other: own u64) { self = self << other } } -impl ShrAssign for u64 { fn shr_assign(mut self, _ other: own u64) { self = self >> other } } -impl BitAndAssign for u64 { fn bitand_assign(mut self, _ other: own u64) { self = self & other } } -impl BitOrAssign for u64 { fn bitor_assign(mut self, _ other: own u64) { self = self | other } } -impl BitXorAssign for u64 { fn bitxor_assign(mut self, _ other: own u64) { self = self ^ other } } + const fn lt(self, _ other: u64) -> bool { __lt_u64(self, other) } + const fn le(self, _ other: u64) -> bool { __le_u64(self, other) } + const fn gt(self, _ other: u64) -> bool { __gt_u64(self, other) } + const fn ge(self, _ other: u64) -> bool { __ge_u64(self, other) } +} +impl AddAssign for u64 { const fn add_assign(mut self, _ other: own u64) { self = self + other } } +impl SubAssign for u64 { const fn sub_assign(mut self, _ other: own u64) { self = self - other } } +impl MulAssign for u64 { const fn mul_assign(mut self, _ other: own u64) { self = self * other } } +impl DivAssign for u64 { const fn div_assign(mut self, _ other: own u64) { self = self / other } } +impl RemAssign for u64 { const fn rem_assign(mut self, _ other: own u64) { self = self % other } } +impl PowAssign for u64 { const fn pow_assign(mut self, _ other: own u64) { self = self ** other } } +impl ShlAssign for u64 { const fn shl_assign(mut self, _ other: own u64) { self = self << other } } +impl ShrAssign for u64 { const fn shr_assign(mut self, _ other: own u64) { self = self >> other } } +impl BitAndAssign for u64 { const fn bitand_assign(mut self, _ other: own u64) { self = self & other } } +impl BitOrAssign for u64 { const fn bitor_assign(mut self, _ other: own u64) { self = self | other } } +impl BitXorAssign for u64 { const fn bitxor_assign(mut self, _ other: own u64) { self = self ^ other } } impl Default for u64 { fn default() -> Self { 0 } } // u128 impls -impl BitNot for u128 { fn bit_not(own self) -> u128 { __bitnot_u128(self) } } -impl Not for u128 { fn not(own self) -> u128 { __bitnot_u128(self) } } +impl BitNot for u128 { const fn bit_not(own self) -> u128 { __bitnot_u128(self) } } +impl Not for u128 { const fn not(own self) -> u128 { __bitnot_u128(self) } } impl Add for u128 { - fn add(own self, _ other: own u128) -> u128 { + const fn add(own self, _ other: own u128) -> u128 { __checked_add(self, other) } } impl Sub for u128 { - fn sub(own self, _ other: own u128) -> u128 { + const fn sub(own self, _ other: own u128) -> u128 { __checked_sub(self, other) } } impl Mul for u128 { - fn mul(own self, _ other: own u128) -> u128 { + const fn mul(own self, _ other: own u128) -> u128 { __checked_mul(self, other) } } impl Div for u128 { - fn div(own self, _ other: own u128) -> u128 { + const fn div(own self, _ other: own u128) -> u128 { __checked_div(self, other) } } impl Rem for u128 { - fn rem(own self, _ other: own u128) -> u128 { + const fn rem(own self, _ other: own u128) -> u128 { __checked_rem(self, other) } } -impl Pow for u128 { fn pow(own self, _ other: own u128) -> u128 { pow_checked(self, other) } } -impl WrappingAdd for u128 { fn wrapping_add(self, _ other: u128) -> u128 { __add_u128(self, other) } } -impl WrappingSub for u128 { fn wrapping_sub(self, _ other: u128) -> u128 { __sub_u128(self, other) } } -impl WrappingMul for u128 { fn wrapping_mul(self, _ other: u128) -> u128 { __mul_u128(self, other) } } -impl SaturatingAdd for u128 { fn saturating_add(self, _ other: u128) -> u128 { __saturating_add(self, other) } } -impl SaturatingSub for u128 { fn saturating_sub(self, _ other: u128) -> u128 { __saturating_sub(self, other) } } -impl SaturatingMul for u128 { fn saturating_mul(self, _ other: u128) -> u128 { __saturating_mul(self, other) } } -impl Shl for u128 { fn shl(own self, _ other: own u128) -> u128 { __shl_u128(self, other) } } -impl Shr for u128 { fn shr(own self, _ other: own u128) -> u128 { __shr_u128(self, other) } } -impl BitAnd for u128 { fn bitand(own self, _ other: own u128) -> u128 { __bitand_u128(self, other) } } -impl BitOr for u128 { fn bitor(own self, _ other: own u128) -> u128 { __bitor_u128(self, other) } } -impl BitXor for u128 { fn bitxor(own self, _ other: own u128) -> u128 { __bitxor_u128(self, other) } } +impl Pow for u128 { const fn pow(own self, _ other: own u128) -> u128 { pow_checked(self, other) } } +impl WrappingAdd for u128 { const fn wrapping_add(self, _ other: u128) -> u128 { __add_u128(self, other) } } +impl WrappingSub for u128 { const fn wrapping_sub(self, _ other: u128) -> u128 { __sub_u128(self, other) } } +impl WrappingMul for u128 { const fn wrapping_mul(self, _ other: u128) -> u128 { __mul_u128(self, other) } } +impl SaturatingAdd for u128 { const fn saturating_add(self, _ other: u128) -> u128 { __saturating_add(self, other) } } +impl SaturatingSub for u128 { const fn saturating_sub(self, _ other: u128) -> u128 { __saturating_sub(self, other) } } +impl SaturatingMul for u128 { const fn saturating_mul(self, _ other: u128) -> u128 { __saturating_mul(self, other) } } +impl Shl for u128 { const fn shl(own self, _ other: own u128) -> u128 { __shl_u128(self, other) } } +impl Shr for u128 { const fn shr(own self, _ other: own u128) -> u128 { __shr_u128(self, other) } } +impl BitAnd for u128 { const fn bitand(own self, _ other: own u128) -> u128 { __bitand_u128(self, other) } } +impl BitOr for u128 { const fn bitor(own self, _ other: own u128) -> u128 { __bitor_u128(self, other) } } +impl BitXor for u128 { const fn bitxor(own self, _ other: own u128) -> u128 { __bitxor_u128(self, other) } } impl Eq for u128 { - fn eq(self, _ other: u128) -> bool { __eq_u128(self, other) } - fn ne(self, _ other: u128) -> bool { __ne_u128(self, other) } + const fn eq(self, _ other: u128) -> bool { __eq_u128(self, other) } + const fn ne(self, _ other: u128) -> bool { __ne_u128(self, other) } } impl Ord for u128 { - fn lt(self, _ other: u128) -> bool { __lt_u128(self, other) } - fn le(self, _ other: u128) -> bool { __le_u128(self, other) } - fn gt(self, _ other: u128) -> bool { __gt_u128(self, other) } - fn ge(self, _ other: u128) -> bool { __ge_u128(self, other) } -} -impl AddAssign for u128 { fn add_assign(mut self, _ other: own u128) { self = self + other } } -impl SubAssign for u128 { fn sub_assign(mut self, _ other: own u128) { self = self - other } } -impl MulAssign for u128 { fn mul_assign(mut self, _ other: own u128) { self = self * other } } -impl DivAssign for u128 { fn div_assign(mut self, _ other: own u128) { self = self / other } } -impl RemAssign for u128 { fn rem_assign(mut self, _ other: own u128) { self = self % other } } -impl PowAssign for u128 { fn pow_assign(mut self, _ other: own u128) { self = self ** other } } -impl ShlAssign for u128 { fn shl_assign(mut self, _ other: own u128) { self = self << other } } -impl ShrAssign for u128 { fn shr_assign(mut self, _ other: own u128) { self = self >> other } } -impl BitAndAssign for u128 { fn bitand_assign(mut self, _ other: own u128) { self = self & other } } -impl BitOrAssign for u128 { fn bitor_assign(mut self, _ other: own u128) { self = self | other } } -impl BitXorAssign for u128 { fn bitxor_assign(mut self, _ other: own u128) { self = self ^ other } } + const fn lt(self, _ other: u128) -> bool { __lt_u128(self, other) } + const fn le(self, _ other: u128) -> bool { __le_u128(self, other) } + const fn gt(self, _ other: u128) -> bool { __gt_u128(self, other) } + const fn ge(self, _ other: u128) -> bool { __ge_u128(self, other) } +} +impl AddAssign for u128 { const fn add_assign(mut self, _ other: own u128) { self = self + other } } +impl SubAssign for u128 { const fn sub_assign(mut self, _ other: own u128) { self = self - other } } +impl MulAssign for u128 { const fn mul_assign(mut self, _ other: own u128) { self = self * other } } +impl DivAssign for u128 { const fn div_assign(mut self, _ other: own u128) { self = self / other } } +impl RemAssign for u128 { const fn rem_assign(mut self, _ other: own u128) { self = self % other } } +impl PowAssign for u128 { const fn pow_assign(mut self, _ other: own u128) { self = self ** other } } +impl ShlAssign for u128 { const fn shl_assign(mut self, _ other: own u128) { self = self << other } } +impl ShrAssign for u128 { const fn shr_assign(mut self, _ other: own u128) { self = self >> other } } +impl BitAndAssign for u128 { const fn bitand_assign(mut self, _ other: own u128) { self = self & other } } +impl BitOrAssign for u128 { const fn bitor_assign(mut self, _ other: own u128) { self = self | other } } +impl BitXorAssign for u128 { const fn bitxor_assign(mut self, _ other: own u128) { self = self ^ other } } impl Default for u128 { fn default() -> Self { 0 } } // usize impls -impl BitNot for usize { fn bit_not(own self) -> usize { __bitnot_usize(self) } } -impl Not for usize { fn not(own self) -> usize { __bitnot_usize(self) } } +impl BitNot for usize { const fn bit_not(own self) -> usize { __bitnot_usize(self) } } +impl Not for usize { const fn not(own self) -> usize { __bitnot_usize(self) } } impl Add for usize { - fn add(own self, _ other: own usize) -> usize { + const fn add(own self, _ other: own usize) -> usize { __checked_add(self, other) } } impl Sub for usize { - fn sub(own self, _ other: own usize) -> usize { + const fn sub(own self, _ other: own usize) -> usize { __checked_sub(self, other) } } impl Mul for usize { - fn mul(own self, _ other: own usize) -> usize { + const fn mul(own self, _ other: own usize) -> usize { __checked_mul(self, other) } } impl Div for usize { - fn div(own self, _ other: own usize) -> usize { + const fn div(own self, _ other: own usize) -> usize { __checked_div(self, other) } } impl Rem for usize { - fn rem(own self, _ other: own usize) -> usize { + const fn rem(own self, _ other: own usize) -> usize { __checked_rem(self, other) } } -impl Pow for usize { fn pow(own self, _ other: own usize) -> usize { pow_checked(self, other) } } -impl WrappingAdd for usize { fn wrapping_add(self, _ other: usize) -> usize { __add_usize(self, other) } } -impl WrappingSub for usize { fn wrapping_sub(self, _ other: usize) -> usize { __sub_usize(self, other) } } -impl WrappingMul for usize { fn wrapping_mul(self, _ other: usize) -> usize { __mul_usize(self, other) } } -impl SaturatingAdd for usize { fn saturating_add(self, _ other: usize) -> usize { __saturating_add(self, other) } } -impl SaturatingSub for usize { fn saturating_sub(self, _ other: usize) -> usize { __saturating_sub(self, other) } } -impl SaturatingMul for usize { fn saturating_mul(self, _ other: usize) -> usize { __saturating_mul(self, other) } } -impl Shl for usize { fn shl(own self, _ other: own usize) -> usize { __shl_usize(self, other) } } -impl Shr for usize { fn shr(own self, _ other: own usize) -> usize { __shr_usize(self, other) } } -impl BitAnd for usize { fn bitand(own self, _ other: own usize) -> usize { __bitand_usize(self, other) } } -impl BitOr for usize { fn bitor(own self, _ other: own usize) -> usize { __bitor_usize(self, other) } } -impl BitXor for usize { fn bitxor(own self, _ other: own usize) -> usize { __bitxor_usize(self, other) } } +impl Pow for usize { const fn pow(own self, _ other: own usize) -> usize { pow_checked(self, other) } } +impl WrappingAdd for usize { const fn wrapping_add(self, _ other: usize) -> usize { __add_usize(self, other) } } +impl WrappingSub for usize { const fn wrapping_sub(self, _ other: usize) -> usize { __sub_usize(self, other) } } +impl WrappingMul for usize { const fn wrapping_mul(self, _ other: usize) -> usize { __mul_usize(self, other) } } +impl SaturatingAdd for usize { const fn saturating_add(self, _ other: usize) -> usize { __saturating_add(self, other) } } +impl SaturatingSub for usize { const fn saturating_sub(self, _ other: usize) -> usize { __saturating_sub(self, other) } } +impl SaturatingMul for usize { const fn saturating_mul(self, _ other: usize) -> usize { __saturating_mul(self, other) } } +impl Shl for usize { const fn shl(own self, _ other: own usize) -> usize { __shl_usize(self, other) } } +impl Shr for usize { const fn shr(own self, _ other: own usize) -> usize { __shr_usize(self, other) } } +impl BitAnd for usize { const fn bitand(own self, _ other: own usize) -> usize { __bitand_usize(self, other) } } +impl BitOr for usize { const fn bitor(own self, _ other: own usize) -> usize { __bitor_usize(self, other) } } +impl BitXor for usize { const fn bitxor(own self, _ other: own usize) -> usize { __bitxor_usize(self, other) } } impl Eq for usize { - fn eq(self, _ other: usize) -> bool { __eq_usize(self, other) } - fn ne(self, _ other: usize) -> bool { __ne_usize(self, other) } + const fn eq(self, _ other: usize) -> bool { __eq_usize(self, other) } + const fn ne(self, _ other: usize) -> bool { __ne_usize(self, other) } } impl Ord for usize { - fn lt(self, _ other: usize) -> bool { __lt_usize(self, other) } - fn le(self, _ other: usize) -> bool { __le_usize(self, other) } - fn gt(self, _ other: usize) -> bool { __gt_usize(self, other) } - fn ge(self, _ other: usize) -> bool { __ge_usize(self, other) } -} -impl AddAssign for usize { fn add_assign(mut self, _ other: own usize) { self = self + other } } -impl SubAssign for usize { fn sub_assign(mut self, _ other: own usize) { self = self - other } } -impl MulAssign for usize { fn mul_assign(mut self, _ other: own usize) { self = self * other } } -impl DivAssign for usize { fn div_assign(mut self, _ other: own usize) { self = self / other } } -impl RemAssign for usize { fn rem_assign(mut self, _ other: own usize) { self = self % other } } -impl PowAssign for usize { fn pow_assign(mut self, _ other: own usize) { self = self ** other } } + const fn lt(self, _ other: usize) -> bool { __lt_usize(self, other) } + const fn le(self, _ other: usize) -> bool { __le_usize(self, other) } + const fn gt(self, _ other: usize) -> bool { __gt_usize(self, other) } + const fn ge(self, _ other: usize) -> bool { __ge_usize(self, other) } +} +impl AddAssign for usize { const fn add_assign(mut self, _ other: own usize) { self = self + other } } +impl SubAssign for usize { const fn sub_assign(mut self, _ other: own usize) { self = self - other } } +impl MulAssign for usize { const fn mul_assign(mut self, _ other: own usize) { self = self * other } } +impl DivAssign for usize { const fn div_assign(mut self, _ other: own usize) { self = self / other } } +impl RemAssign for usize { const fn rem_assign(mut self, _ other: own usize) { self = self % other } } +impl PowAssign for usize { const fn pow_assign(mut self, _ other: own usize) { self = self ** other } } impl Default for usize { fn default() -> Self { 0 } } // i256 impls impl Neg for i256 { - fn neg(own self) -> i256 { + const fn neg(own self) -> i256 { __checked_neg(self) } } -impl BitNot for i256 { fn bit_not(own self) -> i256 { __bitnot_i256(self) } } -impl Not for i256 { fn not(own self) -> i256 { __bitnot_i256(self) } } +impl BitNot for i256 { const fn bit_not(own self) -> i256 { __bitnot_i256(self) } } +impl Not for i256 { const fn not(own self) -> i256 { __bitnot_i256(self) } } impl Add for i256 { - fn add(own self, _ other: own i256) -> i256 { + const fn add(own self, _ other: own i256) -> i256 { __checked_add(self, other) } } impl Sub for i256 { - fn sub(own self, _ other: own i256) -> i256 { + const fn sub(own self, _ other: own i256) -> i256 { __checked_sub(self, other) } } impl Mul for i256 { - fn mul(own self, _ other: own i256) -> i256 { + const fn mul(own self, _ other: own i256) -> i256 { __checked_mul(self, other) } } impl Div for i256 { - fn div(own self, _ other: own i256) -> i256 { + const fn div(own self, _ other: own i256) -> i256 { __checked_div(self, other) } } impl Rem for i256 { - fn rem(own self, _ other: own i256) -> i256 { + const fn rem(own self, _ other: own i256) -> i256 { __checked_rem(self, other) } } -impl Pow for i256 { fn pow(own self, _ other: own i256) -> i256 { pow_checked(self, other) } } -impl WrappingAdd for i256 { fn wrapping_add(self, _ other: i256) -> i256 { __add_i256(self, other) } } -impl WrappingSub for i256 { fn wrapping_sub(self, _ other: i256) -> i256 { __sub_i256(self, other) } } -impl WrappingMul for i256 { fn wrapping_mul(self, _ other: i256) -> i256 { __mul_i256(self, other) } } -impl SaturatingAdd for i256 { fn saturating_add(self, _ other: i256) -> i256 { __saturating_add(self, other) } } -impl SaturatingSub for i256 { fn saturating_sub(self, _ other: i256) -> i256 { __saturating_sub(self, other) } } -impl SaturatingMul for i256 { fn saturating_mul(self, _ other: i256) -> i256 { __saturating_mul(self, other) } } -impl Shl for i256 { fn shl(own self, _ other: own i256) -> i256 { __shl_i256(self, other) } } -impl Shr for i256 { fn shr(own self, _ other: own i256) -> i256 { __shr_i256(self, other) } } -impl BitAnd for i256 { fn bitand(own self, _ other: own i256) -> i256 { __bitand_i256(self, other) } } -impl BitOr for i256 { fn bitor(own self, _ other: own i256) -> i256 { __bitor_i256(self, other) } } -impl BitXor for i256 { fn bitxor(own self, _ other: own i256) -> i256 { __bitxor_i256(self, other) } } +impl Pow for i256 { const fn pow(own self, _ other: own i256) -> i256 { pow_checked(self, other) } } +impl WrappingAdd for i256 { const fn wrapping_add(self, _ other: i256) -> i256 { __add_i256(self, other) } } +impl WrappingSub for i256 { const fn wrapping_sub(self, _ other: i256) -> i256 { __sub_i256(self, other) } } +impl WrappingMul for i256 { const fn wrapping_mul(self, _ other: i256) -> i256 { __mul_i256(self, other) } } +impl SaturatingAdd for i256 { const fn saturating_add(self, _ other: i256) -> i256 { __saturating_add(self, other) } } +impl SaturatingSub for i256 { const fn saturating_sub(self, _ other: i256) -> i256 { __saturating_sub(self, other) } } +impl SaturatingMul for i256 { const fn saturating_mul(self, _ other: i256) -> i256 { __saturating_mul(self, other) } } +impl Shl for i256 { const fn shl(own self, _ other: own i256) -> i256 { __shl_i256(self, other) } } +impl Shr for i256 { const fn shr(own self, _ other: own i256) -> i256 { __shr_i256(self, other) } } +impl BitAnd for i256 { const fn bitand(own self, _ other: own i256) -> i256 { __bitand_i256(self, other) } } +impl BitOr for i256 { const fn bitor(own self, _ other: own i256) -> i256 { __bitor_i256(self, other) } } +impl BitXor for i256 { const fn bitxor(own self, _ other: own i256) -> i256 { __bitxor_i256(self, other) } } impl Eq for i256 { - fn eq(self, _ other: i256) -> bool { __eq_i256(self, other) } - fn ne(self, _ other: i256) -> bool { __ne_i256(self, other) } + const fn eq(self, _ other: i256) -> bool { __eq_i256(self, other) } + const fn ne(self, _ other: i256) -> bool { __ne_i256(self, other) } } impl Ord for i256 { - fn lt(self, _ other: i256) -> bool { __lt_i256(self, other) } - fn le(self, _ other: i256) -> bool { __le_i256(self, other) } - fn gt(self, _ other: i256) -> bool { __gt_i256(self, other) } - fn ge(self, _ other: i256) -> bool { __ge_i256(self, other) } -} -impl AddAssign for i256 { fn add_assign(mut self, _ other: own i256) { self = self + other } } -impl SubAssign for i256 { fn sub_assign(mut self, _ other: own i256) { self = self - other } } -impl MulAssign for i256 { fn mul_assign(mut self, _ other: own i256) { self = self * other } } -impl DivAssign for i256 { fn div_assign(mut self, _ other: own i256) { self = self / other } } -impl RemAssign for i256 { fn rem_assign(mut self, _ other: own i256) { self = self % other } } -impl PowAssign for i256 { fn pow_assign(mut self, _ other: own i256) { self = self ** other } } -impl ShlAssign for i256 { fn shl_assign(mut self, _ other: own i256) { self = self << other } } -impl ShrAssign for i256 { fn shr_assign(mut self, _ other: own i256) { self = self >> other } } -impl BitAndAssign for i256 { fn bitand_assign(mut self, _ other: own i256) { self = self & other } } -impl BitOrAssign for i256 { fn bitor_assign(mut self, _ other: own i256) { self = self | other } } -impl BitXorAssign for i256 { fn bitxor_assign(mut self, _ other: own i256) { self = self ^ other } } + const fn lt(self, _ other: i256) -> bool { __lt_i256(self, other) } + const fn le(self, _ other: i256) -> bool { __le_i256(self, other) } + const fn gt(self, _ other: i256) -> bool { __gt_i256(self, other) } + const fn ge(self, _ other: i256) -> bool { __ge_i256(self, other) } +} +impl AddAssign for i256 { const fn add_assign(mut self, _ other: own i256) { self = self + other } } +impl SubAssign for i256 { const fn sub_assign(mut self, _ other: own i256) { self = self - other } } +impl MulAssign for i256 { const fn mul_assign(mut self, _ other: own i256) { self = self * other } } +impl DivAssign for i256 { const fn div_assign(mut self, _ other: own i256) { self = self / other } } +impl RemAssign for i256 { const fn rem_assign(mut self, _ other: own i256) { self = self % other } } +impl PowAssign for i256 { const fn pow_assign(mut self, _ other: own i256) { self = self ** other } } +impl ShlAssign for i256 { const fn shl_assign(mut self, _ other: own i256) { self = self << other } } +impl ShrAssign for i256 { const fn shr_assign(mut self, _ other: own i256) { self = self >> other } } +impl BitAndAssign for i256 { const fn bitand_assign(mut self, _ other: own i256) { self = self & other } } +impl BitOrAssign for i256 { const fn bitor_assign(mut self, _ other: own i256) { self = self | other } } +impl BitXorAssign for i256 { const fn bitxor_assign(mut self, _ other: own i256) { self = self ^ other } } impl Default for i256 { fn default() -> Self { 0 } } // u256 impls -impl BitNot for u256 { fn bit_not(own self) -> u256 { __bitnot_u256(self) } } -impl Not for u256 { fn not(own self) -> u256 { __bitnot_u256(self) } } +impl BitNot for u256 { const fn bit_not(own self) -> u256 { __bitnot_u256(self) } } +impl Not for u256 { const fn not(own self) -> u256 { __bitnot_u256(self) } } impl Add for u256 { - fn add(own self, _ other: own u256) -> u256 { + const fn add(own self, _ other: own u256) -> u256 { __checked_add(self, other) } } impl Sub for u256 { - fn sub(own self, _ other: own u256) -> u256 { + const fn sub(own self, _ other: own u256) -> u256 { __checked_sub(self, other) } } impl Mul for u256 { - fn mul(own self, _ other: own u256) -> u256 { + const fn mul(own self, _ other: own u256) -> u256 { __checked_mul(self, other) } } impl Div for u256 { - fn div(own self, _ other: own u256) -> u256 { + const fn div(own self, _ other: own u256) -> u256 { __checked_div(self, other) } } impl Rem for u256 { - fn rem(own self, _ other: own u256) -> u256 { + const fn rem(own self, _ other: own u256) -> u256 { __checked_rem(self, other) } } -impl Pow for u256 { fn pow(own self, _ other: own u256) -> u256 { pow_checked(self, other) } } -impl WrappingAdd for u256 { fn wrapping_add(self, _ other: u256) -> u256 { __add_u256(self, other) } } -impl WrappingSub for u256 { fn wrapping_sub(self, _ other: u256) -> u256 { __sub_u256(self, other) } } -impl WrappingMul for u256 { fn wrapping_mul(self, _ other: u256) -> u256 { __mul_u256(self, other) } } -impl SaturatingAdd for u256 { fn saturating_add(self, _ other: u256) -> u256 { __saturating_add(self, other) } } -impl SaturatingSub for u256 { fn saturating_sub(self, _ other: u256) -> u256 { __saturating_sub(self, other) } } -impl SaturatingMul for u256 { fn saturating_mul(self, _ other: u256) -> u256 { __saturating_mul(self, other) } } -impl Shl for u256 { fn shl(own self, _ other: own u256) -> u256 { __shl_u256(self, other) } } -impl Shr for u256 { fn shr(own self, _ other: own u256) -> u256 { __shr_u256(self, other) } } -impl BitAnd for u256 { fn bitand(own self, _ other: own u256) -> u256 { __bitand_u256(self, other) } } -impl BitOr for u256 { fn bitor(own self, _ other: own u256) -> u256 { __bitor_u256(self, other) } } -impl BitXor for u256 { fn bitxor(own self, _ other: own u256) -> u256 { __bitxor_u256(self, other) } } +impl Pow for u256 { const fn pow(own self, _ other: own u256) -> u256 { pow_checked(self, other) } } +impl WrappingAdd for u256 { const fn wrapping_add(self, _ other: u256) -> u256 { __add_u256(self, other) } } +impl WrappingSub for u256 { const fn wrapping_sub(self, _ other: u256) -> u256 { __sub_u256(self, other) } } +impl WrappingMul for u256 { const fn wrapping_mul(self, _ other: u256) -> u256 { __mul_u256(self, other) } } +impl SaturatingAdd for u256 { const fn saturating_add(self, _ other: u256) -> u256 { __saturating_add(self, other) } } +impl SaturatingSub for u256 { const fn saturating_sub(self, _ other: u256) -> u256 { __saturating_sub(self, other) } } +impl SaturatingMul for u256 { const fn saturating_mul(self, _ other: u256) -> u256 { __saturating_mul(self, other) } } +impl Shl for u256 { const fn shl(own self, _ other: own u256) -> u256 { __shl_u256(self, other) } } +impl Shr for u256 { const fn shr(own self, _ other: own u256) -> u256 { __shr_u256(self, other) } } +impl BitAnd for u256 { const fn bitand(own self, _ other: own u256) -> u256 { __bitand_u256(self, other) } } +impl BitOr for u256 { const fn bitor(own self, _ other: own u256) -> u256 { __bitor_u256(self, other) } } +impl BitXor for u256 { const fn bitxor(own self, _ other: own u256) -> u256 { __bitxor_u256(self, other) } } impl Eq for u256 { - fn eq(self, _ other: u256) -> bool { __eq_u256(self, other) } - fn ne(self, _ other: u256) -> bool { __ne_u256(self, other) } + const fn eq(self, _ other: u256) -> bool { __eq_u256(self, other) } + const fn ne(self, _ other: u256) -> bool { __ne_u256(self, other) } } impl Ord for u256 { - fn lt(self, _ other: u256) -> bool { __lt_u256(self, other) } - fn le(self, _ other: u256) -> bool { __le_u256(self, other) } - fn gt(self, _ other: u256) -> bool { __gt_u256(self, other) } - fn ge(self, _ other: u256) -> bool { __ge_u256(self, other) } -} -impl AddAssign for u256 { fn add_assign(mut self, _ other: own u256) { self = self + other } } -impl SubAssign for u256 { fn sub_assign(mut self, _ other: own u256) { self = self - other } } -impl MulAssign for u256 { fn mul_assign(mut self, _ other: own u256) { self = self * other } } -impl DivAssign for u256 { fn div_assign(mut self, _ other: own u256) { self = self / other } } -impl RemAssign for u256 { fn rem_assign(mut self, _ other: own u256) { self = self % other } } -impl PowAssign for u256 { fn pow_assign(mut self, _ other: own u256) { self = self ** other } } -impl ShlAssign for u256 { fn shl_assign(mut self, _ other: own u256) { self = self << other } } -impl ShrAssign for u256 { fn shr_assign(mut self, _ other: own u256) { self = self >> other } } -impl BitAndAssign for u256 { fn bitand_assign(mut self, _ other: own u256) { self = self & other } } -impl BitOrAssign for u256 { fn bitor_assign(mut self, _ other: own u256) { self = self | other } } -impl BitXorAssign for u256 { fn bitxor_assign(mut self, _ other: own u256) { self = self ^ other } } + const fn lt(self, _ other: u256) -> bool { __lt_u256(self, other) } + const fn le(self, _ other: u256) -> bool { __le_u256(self, other) } + const fn gt(self, _ other: u256) -> bool { __gt_u256(self, other) } + const fn ge(self, _ other: u256) -> bool { __ge_u256(self, other) } +} +impl AddAssign for u256 { const fn add_assign(mut self, _ other: own u256) { self = self + other } } +impl SubAssign for u256 { const fn sub_assign(mut self, _ other: own u256) { self = self - other } } +impl MulAssign for u256 { const fn mul_assign(mut self, _ other: own u256) { self = self * other } } +impl DivAssign for u256 { const fn div_assign(mut self, _ other: own u256) { self = self / other } } +impl RemAssign for u256 { const fn rem_assign(mut self, _ other: own u256) { self = self % other } } +impl PowAssign for u256 { const fn pow_assign(mut self, _ other: own u256) { self = self ** other } } +impl ShlAssign for u256 { const fn shl_assign(mut self, _ other: own u256) { self = self << other } } +impl ShrAssign for u256 { const fn shr_assign(mut self, _ other: own u256) { self = self >> other } } +impl BitAndAssign for u256 { const fn bitand_assign(mut self, _ other: own u256) { self = self & other } } +impl BitOrAssign for u256 { const fn bitor_assign(mut self, _ other: own u256) { self = self | other } } +impl BitXorAssign for u256 { const fn bitxor_assign(mut self, _ other: own u256) { self = self ^ other } } impl Default for u256 { fn default() -> Self { 0 } } // isize impls impl Neg for isize { - fn neg(own self) -> isize { + const fn neg(own self) -> isize { __checked_neg(self) } } -impl BitNot for isize { fn bit_not(own self) -> isize { __bitnot_isize(self) } } -impl Not for isize { fn not(own self) -> isize { __bitnot_isize(self) } } +impl BitNot for isize { const fn bit_not(own self) -> isize { __bitnot_isize(self) } } +impl Not for isize { const fn not(own self) -> isize { __bitnot_isize(self) } } impl Add for isize { - fn add(own self, _ other: own isize) -> isize { + const fn add(own self, _ other: own isize) -> isize { __checked_add(self, other) } } impl Sub for isize { - fn sub(own self, _ other: own isize) -> isize { + const fn sub(own self, _ other: own isize) -> isize { __checked_sub(self, other) } } impl Mul for isize { - fn mul(own self, _ other: own isize) -> isize { + const fn mul(own self, _ other: own isize) -> isize { __checked_mul(self, other) } } impl Div for isize { - fn div(own self, _ other: own isize) -> isize { + const fn div(own self, _ other: own isize) -> isize { __checked_div(self, other) } } impl Rem for isize { - fn rem(own self, _ other: own isize) -> isize { + const fn rem(own self, _ other: own isize) -> isize { __checked_rem(self, other) } } -impl Pow for isize { fn pow(own self, _ other: own isize) -> isize { pow_checked(self, other) } } -impl WrappingAdd for isize { fn wrapping_add(self, _ other: isize) -> isize { __add_isize(self, other) } } -impl WrappingSub for isize { fn wrapping_sub(self, _ other: isize) -> isize { __sub_isize(self, other) } } -impl WrappingMul for isize { fn wrapping_mul(self, _ other: isize) -> isize { __mul_isize(self, other) } } -impl SaturatingAdd for isize { fn saturating_add(self, _ other: isize) -> isize { __saturating_add(self, other) } } -impl SaturatingSub for isize { fn saturating_sub(self, _ other: isize) -> isize { __saturating_sub(self, other) } } -impl SaturatingMul for isize { fn saturating_mul(self, _ other: isize) -> isize { __saturating_mul(self, other) } } -impl Shl for isize { fn shl(own self, _ other: own isize) -> isize { __shl_isize(self, other) } } -impl Shr for isize { fn shr(own self, _ other: own isize) -> isize { __shr_isize(self, other) } } -impl BitAnd for isize { fn bitand(own self, _ other: own isize) -> isize { __bitand_isize(self, other) } } -impl BitOr for isize { fn bitor(own self, _ other: own isize) -> isize { __bitor_isize(self, other) } } -impl BitXor for isize { fn bitxor(own self, _ other: own isize) -> isize { __bitxor_isize(self, other) } } +impl Pow for isize { const fn pow(own self, _ other: own isize) -> isize { pow_checked(self, other) } } +impl WrappingAdd for isize { const fn wrapping_add(self, _ other: isize) -> isize { __add_isize(self, other) } } +impl WrappingSub for isize { const fn wrapping_sub(self, _ other: isize) -> isize { __sub_isize(self, other) } } +impl WrappingMul for isize { const fn wrapping_mul(self, _ other: isize) -> isize { __mul_isize(self, other) } } +impl SaturatingAdd for isize { const fn saturating_add(self, _ other: isize) -> isize { __saturating_add(self, other) } } +impl SaturatingSub for isize { const fn saturating_sub(self, _ other: isize) -> isize { __saturating_sub(self, other) } } +impl SaturatingMul for isize { const fn saturating_mul(self, _ other: isize) -> isize { __saturating_mul(self, other) } } +impl Shl for isize { const fn shl(own self, _ other: own isize) -> isize { __shl_isize(self, other) } } +impl Shr for isize { const fn shr(own self, _ other: own isize) -> isize { __shr_isize(self, other) } } +impl BitAnd for isize { const fn bitand(own self, _ other: own isize) -> isize { __bitand_isize(self, other) } } +impl BitOr for isize { const fn bitor(own self, _ other: own isize) -> isize { __bitor_isize(self, other) } } +impl BitXor for isize { const fn bitxor(own self, _ other: own isize) -> isize { __bitxor_isize(self, other) } } impl Eq for isize { - fn eq(self, _ other: isize) -> bool { __eq_isize(self, other) } - fn ne(self, _ other: isize) -> bool { __ne_isize(self, other) } + const fn eq(self, _ other: isize) -> bool { __eq_isize(self, other) } + const fn ne(self, _ other: isize) -> bool { __ne_isize(self, other) } } impl Ord for isize { - fn lt(self, _ other: isize) -> bool { __lt_isize(self, other) } - fn le(self, _ other: isize) -> bool { __le_isize(self, other) } - fn gt(self, _ other: isize) -> bool { __gt_isize(self, other) } - fn ge(self, _ other: isize) -> bool { __ge_isize(self, other) } -} -impl AddAssign for isize { fn add_assign(mut self, _ other: own isize) { self = self + other } } -impl SubAssign for isize { fn sub_assign(mut self, _ other: own isize) { self = self - other } } -impl MulAssign for isize { fn mul_assign(mut self, _ other: own isize) { self = self * other } } -impl DivAssign for isize { fn div_assign(mut self, _ other: own isize) { self = self / other } } -impl RemAssign for isize { fn rem_assign(mut self, _ other: own isize) { self = self % other } } -impl PowAssign for isize { fn pow_assign(mut self, _ other: own isize) { self = self ** other } } -impl ShlAssign for isize { fn shl_assign(mut self, _ other: own isize) { self = self << other } } -impl ShrAssign for isize { fn shr_assign(mut self, _ other: own isize) { self = self >> other } } -impl BitAndAssign for isize { fn bitand_assign(mut self, _ other: own isize) { self = self & other } } -impl BitOrAssign for isize { fn bitor_assign(mut self, _ other: own isize) { self = self | other } } -impl BitXorAssign for isize { fn bitxor_assign(mut self, _ other: own isize) { self = self ^ other } } + const fn lt(self, _ other: isize) -> bool { __lt_isize(self, other) } + const fn le(self, _ other: isize) -> bool { __le_isize(self, other) } + const fn gt(self, _ other: isize) -> bool { __gt_isize(self, other) } + const fn ge(self, _ other: isize) -> bool { __ge_isize(self, other) } +} +impl AddAssign for isize { const fn add_assign(mut self, _ other: own isize) { self = self + other } } +impl SubAssign for isize { const fn sub_assign(mut self, _ other: own isize) { self = self - other } } +impl MulAssign for isize { const fn mul_assign(mut self, _ other: own isize) { self = self * other } } +impl DivAssign for isize { const fn div_assign(mut self, _ other: own isize) { self = self / other } } +impl RemAssign for isize { const fn rem_assign(mut self, _ other: own isize) { self = self % other } } +impl PowAssign for isize { const fn pow_assign(mut self, _ other: own isize) { self = self ** other } } +impl ShlAssign for isize { const fn shl_assign(mut self, _ other: own isize) { self = self << other } } +impl ShrAssign for isize { const fn shr_assign(mut self, _ other: own isize) { self = self >> other } } +impl BitAndAssign for isize { const fn bitand_assign(mut self, _ other: own isize) { self = self & other } } +impl BitOrAssign for isize { const fn bitor_assign(mut self, _ other: own isize) { self = self | other } } +impl BitXorAssign for isize { const fn bitxor_assign(mut self, _ other: own isize) { self = self ^ other } } impl Default for isize { fn default() -> Self { 0 } } // bool impls -impl Not for bool { fn not(own self) -> bool { __not_bool(self) } } -impl BitAnd for bool { fn bitand(own self, _ other: own bool) -> bool { __bitand_bool(self, other) } } -impl BitOr for bool { fn bitor(own self, _ other: own bool) -> bool { __bitor_bool(self, other) } } -impl BitXor for bool { fn bitxor(own self, _ other: own bool) -> bool { __bitxor_bool(self, other) } } -impl BitOrAssign for bool { fn bitor_assign(mut self, _ other: own bool) { self = self | other } } +impl Not for bool { const fn not(own self) -> bool { __not_bool(self) } } +impl BitAnd for bool { const fn bitand(own self, _ other: own bool) -> bool { __bitand_bool(self, other) } } +impl BitOr for bool { const fn bitor(own self, _ other: own bool) -> bool { __bitor_bool(self, other) } } +impl BitXor for bool { const fn bitxor(own self, _ other: own bool) -> bool { __bitxor_bool(self, other) } } +impl BitOrAssign for bool { const fn bitor_assign(mut self, _ other: own bool) { self = self | other } } impl Eq for bool { - fn eq(self, _ other: bool) -> bool { __eq_bool(self, other) } - fn ne(self, _ other: bool) -> bool { __ne_bool(self, other) } + const fn eq(self, _ other: bool) -> bool { __eq_bool(self, other) } + const fn ne(self, _ other: bool) -> bool { __ne_bool(self, other) } } impl Default for bool { fn default() -> Self { false } } diff --git a/ingots/core/src/num_yul.fe b/ingots/core/src/num_yul.fe index 0c30765429..1f4eb5fecc 100644 --- a/ingots/core/src/num_yul.fe +++ b/ingots/core/src/num_yul.fe @@ -3,34 +3,34 @@ use super::num::{IntWord, sign_extend} use super::panic extern { - fn __div_u8(_: u8, _: u8) -> u8 - fn __rem_u8(_: u8, _: u8) -> u8 - fn __div_i8(_: i8, _: i8) -> i8 - fn __rem_i8(_: i8, _: i8) -> i8 - fn __div_i16(_: i16, _: i16) -> i16 - fn __rem_i16(_: i16, _: i16) -> i16 - fn __div_u16(_: u16, _: u16) -> u16 - fn __rem_u16(_: u16, _: u16) -> u16 - fn __div_i32(_: i32, _: i32) -> i32 - fn __rem_i32(_: i32, _: i32) -> i32 - fn __div_u32(_: u32, _: u32) -> u32 - fn __rem_u32(_: u32, _: u32) -> u32 - fn __div_i64(_: i64, _: i64) -> i64 - fn __rem_i64(_: i64, _: i64) -> i64 - fn __div_i128(_: i128, _: i128) -> i128 - fn __rem_i128(_: i128, _: i128) -> i128 - fn __div_u64(_: u64, _: u64) -> u64 - fn __rem_u64(_: u64, _: u64) -> u64 - fn __div_u128(_: u128, _: u128) -> u128 - fn __rem_u128(_: u128, _: u128) -> u128 - fn __div_usize(_: usize, _: usize) -> usize - fn __rem_usize(_: usize, _: usize) -> usize - fn __div_i256(_: i256, _: i256) -> i256 - fn __rem_i256(_: i256, _: i256) -> i256 - fn __div_u256(_: u256, _: u256) -> u256 - fn __rem_u256(_: u256, _: u256) -> u256 - fn __div_isize(_: isize, _: isize) -> isize - fn __rem_isize(_: isize, _: isize) -> isize + const fn __div_u8(_: u8, _: u8) -> u8 + const fn __rem_u8(_: u8, _: u8) -> u8 + const fn __div_i8(_: i8, _: i8) -> i8 + const fn __rem_i8(_: i8, _: i8) -> i8 + const fn __div_i16(_: i16, _: i16) -> i16 + const fn __rem_i16(_: i16, _: i16) -> i16 + const fn __div_u16(_: u16, _: u16) -> u16 + const fn __rem_u16(_: u16, _: u16) -> u16 + const fn __div_i32(_: i32, _: i32) -> i32 + const fn __rem_i32(_: i32, _: i32) -> i32 + const fn __div_u32(_: u32, _: u32) -> u32 + const fn __rem_u32(_: u32, _: u32) -> u32 + const fn __div_i64(_: i64, _: i64) -> i64 + const fn __rem_i64(_: i64, _: i64) -> i64 + const fn __div_i128(_: i128, _: i128) -> i128 + const fn __rem_i128(_: i128, _: i128) -> i128 + const fn __div_u64(_: u64, _: u64) -> u64 + const fn __rem_u64(_: u64, _: u64) -> u64 + const fn __div_u128(_: u128, _: u128) -> u128 + const fn __rem_u128(_: u128, _: u128) -> u128 + const fn __div_usize(_: usize, _: usize) -> usize + const fn __rem_usize(_: usize, _: usize) -> usize + const fn __div_i256(_: i256, _: i256) -> i256 + const fn __rem_i256(_: i256, _: i256) -> i256 + const fn __div_u256(_: u256, _: u256) -> u256 + const fn __rem_u256(_: u256, _: u256) -> u256 + const fn __div_isize(_: isize, _: isize) -> isize + const fn __rem_isize(_: isize, _: isize) -> isize } // ---------- generic checked-arithmetic helpers ---------- diff --git a/ingots/std/src/evm/crypto.fe b/ingots/std/src/evm/crypto.fe index 4e83686726..259c8b31b1 100644 --- a/ingots/std/src/evm/crypto.fe +++ b/ingots/std/src/evm/crypto.fe @@ -20,12 +20,12 @@ fn assert_precompile_ok(_ ok: u256, _ expected_ret_len: u256) { // --------------------------------------------------------------------------- /// Modular addition: `(a + b) % m` with 512-bit intermediate precision. -pub fn addmod(_ a: u256, _ b: u256, _ m: u256) -> u256 { +pub const fn addmod(_ a: u256, _ b: u256, _ m: u256) -> u256 { ops::addmod(a, b, m) } /// Modular multiplication: `(a * b) % m` with 512-bit intermediate precision. -pub fn mulmod(_ a: u256, _ b: u256, _ m: u256) -> u256 { +pub const fn mulmod(_ a: u256, _ b: u256, _ m: u256) -> u256 { ops::mulmod(a, b, m) } diff --git a/ingots/std/src/evm/effects.fe b/ingots/std/src/evm/effects.fe index d62b428d4a..54a7dcdee6 100644 --- a/ingots/std/src/evm/effects.fe +++ b/ingots/std/src/evm/effects.fe @@ -45,7 +45,7 @@ impl Address { } impl core::ops::Eq for Address { - fn eq(self, _ other: Address) -> bool { + const fn eq(self, _ other: Address) -> bool { self.inner == other.inner } } diff --git a/ingots/std/src/evm/ops.fe b/ingots/std/src/evm/ops.fe index 09045620fb..2ef7b9d99a 100644 --- a/ingots/std/src/evm/ops.fe +++ b/ingots/std/src/evm/ops.fe @@ -32,8 +32,8 @@ extern { pub(ingot) fn codecopy(dest: u256, offset: u256, len: u256) pub(ingot) fn codesize() -> u256 pub(ingot) fn keccak256(offset: u256, len: u256) -> u256 - pub(ingot) fn addmod(_ a: u256, _ b: u256, m: u256) -> u256 - pub(ingot) fn mulmod(_ a: u256, _ b: u256, m: u256) -> u256 + pub(ingot) const fn addmod(_ a: u256, _ b: u256, m: u256) -> u256 + pub(ingot) const fn mulmod(_ a: u256, _ b: u256, m: u256) -> u256 // ------------------------------------------------------------------------- // Environment diff --git a/newsfragments/+ctfe-evm-numeric.feature.md b/newsfragments/+ctfe-evm-numeric.feature.md new file mode 100644 index 0000000000..b60b553025 --- /dev/null +++ b/newsfragments/+ctfe-evm-numeric.feature.md @@ -0,0 +1 @@ +Make primitive numeric and boolean intrinsics, `IntDowncast` methods, and EVM `addmod`/`mulmod` const-evaluable. This enables modular arithmetic and field-arithmetic-heavy code to be used in `const fn` and `static_assert`. diff --git a/newsfragments/+ctfe-performance.performance.md b/newsfragments/+ctfe-performance.performance.md new file mode 100644 index 0000000000..aca4f220c0 --- /dev/null +++ b/newsfragments/+ctfe-performance.performance.md @@ -0,0 +1 @@ +Improve CTFE performance and scale by reducing repeated const interning, using copy-on-write aggregate stores, caching semantic bodies and instances, and raising the default CTFE step limit to 1,000,000. Larger constant computations such as Poseidon test vectors can now complete during normal checks. diff --git a/newsfragments/+ctfe-wrapping-intrinsics.bugfix.md b/newsfragments/+ctfe-wrapping-intrinsics.bugfix.md new file mode 100644 index 0000000000..e4d6a5d499 --- /dev/null +++ b/newsfragments/+ctfe-wrapping-intrinsics.bugfix.md @@ -0,0 +1 @@ +Fix CTFE evaluation of unchecked and wrapping numeric intrinsics to use fixed-width word semantics for wrapping negation, bitwise not, shifts, and division/remainder edge cases. diff --git a/newsfragments/+generic-operator-overload.bugfix.md b/newsfragments/+generic-operator-overload.bugfix.md new file mode 100644 index 0000000000..7fcfe78a1e --- /dev/null +++ b/newsfragments/+generic-operator-overload.bugfix.md @@ -0,0 +1 @@ +Fix generic operator overload resolution so ambiguous trait method candidates are preserved and can be disambiguated by argument constraints. Generic wrappers such as field element types can now support mixed operator impls like `Fr + u256`. diff --git a/newsfragments/1413.feature.md b/newsfragments/1413.feature.md new file mode 100644 index 0000000000..45610677c7 --- /dev/null +++ b/newsfragments/1413.feature.md @@ -0,0 +1 @@ +Expand `const fn` evaluation to support mutable locals, assignments, aggregate field and index writes, `while` and `while let` loops with `break` and `continue`, match/destructuring patterns, and const operator trait implementations. This allows more ordinary helper code, including array and proof builders, to run during CTFE.